[Yanel-commits] rev 41125 - public/yanel/contributions/resources/xinha/src/java/org/wyona/yanel/impl/resources/xinha

michi at wyona.com michi at wyona.com
Fri Jan 23 14:00:35 CET 2009


Author: michi
Date: 2009-01-23 14:00:35 +0100 (Fri, 23 Jan 2009)
New Revision: 41125

Modified:
   public/yanel/contributions/resources/xinha/src/java/org/wyona/yanel/impl/resources/xinha/XinhaResource.java
Log:
checkin added

Modified: public/yanel/contributions/resources/xinha/src/java/org/wyona/yanel/impl/resources/xinha/XinhaResource.java
===================================================================
--- public/yanel/contributions/resources/xinha/src/java/org/wyona/yanel/impl/resources/xinha/XinhaResource.java	2009-01-23 11:45:20 UTC (rev 41124)
+++ public/yanel/contributions/resources/xinha/src/java/org/wyona/yanel/impl/resources/xinha/XinhaResource.java	2009-01-23 13:00:35 UTC (rev 41125)
@@ -139,6 +139,18 @@
                 try {
                     OutputStream os = ((ModifiableV2) resToEdit).getOutputStream();
                     IOUtils.write(content, os);
+
+                    if (ResourceAttributeHelper.hasAttributeImplemented(resToEdit, "Versionable", "2")) {
+                        VersionableV2 versionable  = (VersionableV2)resToEdit;
+                        try {
+                            versionable.checkin("Updated with Xinha");
+                        } catch (Exception e) {
+                            String msg = "Could not check in resource: " + resToEdit.getPath() + " " + e.getMessage();
+                            log.error(msg, e);
+                            addError(msg);
+                            throw new UsecaseException(msg, e);
+                        }
+                    }
                 } catch (Exception e) {
                     log.error("Exception: " + e);
                     throw new UsecaseException(e.getMessage(), e);
@@ -261,7 +273,9 @@
                             if (checkoutUserID.equals(userID)) {
                                 log.warn("Resource " + resToEdit.getPath() + " is already checked out by this user: " + checkoutUserID);
                             } else {
-                                addError("Resource is already checked out by another user: " + checkoutUserID);
+                                String msg = "Resource is already checked out by another user: " + checkoutUserID;
+                                log.warn(msg);
+                                addError(msg);
                                 return null;
                             }
                         } else {



More information about the Yanel-commits mailing list