svn commit: r615668 - in /lenya/trunk/src/java/org/apache/lenya/cms: observation/RepositoryEvent.java observation/RepositoryEventFactory.java workflow/WorkflowEventDescriptor.java

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Sun Jan 27 14:28:07 2008
New Revision: 615668

URL: http://svn.apache.org/viewvc?rev=615668&view=rev
Log:
Implementing toString() functions of repository events to offer more useful repository logging

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEvent.java
    lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEventFactory.java
    lenya/trunk/src/java/org/apache/lenya/cms/workflow/WorkflowEventDescriptor.java

Modified: lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEvent.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEvent.java?rev=615668&r1=615667&r2=615668&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEvent.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEvent.java Sun Jan 27 14:28:07 2008
@@ -55,5 +55,25 @@
     public Object getDescriptor() {
         return this.descriptor;
     }
+    
+    public String toString() {
+        return "user:" + getSession().getIdentity().getUser() + " " + getNodeUri() + " " + getDescriptor();
+    }
+    
+    private String nodeUri;
+    
+    /**
+     * @param nodeUri The source URI of the affected node.
+     */
+    public void setNodeUri(String nodeUri) {
+        this.nodeUri = nodeUri;
+    }
+    
+    /**
+     * @return The source URI of the affected node.
+     */
+    public String getNodeUri() {
+        return this.nodeUri;
+    }
 
 }

Modified: lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEventFactory.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEventFactory.java?rev=615668&r1=615667&r2=615668&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEventFactory.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEventFactory.java Sun Jan 27 14:28:07 2008
@@ -56,9 +56,11 @@
     public static final RepositoryEvent createEvent(ServiceManager manager, Document doc,
             Logger logger, Object descriptor) {
         try {
-            return new DocumentEvent(doc.getRepositoryNode().getSession(), doc.getPublication()
+            RepositoryEvent event = new DocumentEvent(doc.getRepositoryNode().getSession(), doc.getPublication()
                     .getId(), doc.getArea(), doc.getUUID(), doc.getLanguage(), doc
                     .getResourceType(), descriptor);
+            event.setNodeUri(doc.getRepositoryNode().getSourceURI());
+            return event;
         } catch (DocumentException e) {
             throw new RuntimeException(e);
         }
@@ -84,6 +86,7 @@
             event = createEvent(manager, doc, logger, descriptor);
         } else {
             event = new RepositoryEvent(node.getSession(), descriptor);
+            event.setNodeUri(node.getSourceURI());
         }
         return event;
     }

Modified: lenya/trunk/src/java/org/apache/lenya/cms/workflow/WorkflowEventDescriptor.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/workflow/WorkflowEventDescriptor.java?rev=615668&r1=615667&r2=615668&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/workflow/WorkflowEventDescriptor.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/workflow/WorkflowEventDescriptor.java Sun Jan 27 14:28:07 2008
@@ -34,12 +34,16 @@
         Assert.notNull("version", version);
         this.version = version;
     }
-    
+
     /**
      * @return The version.
      */
     public Version getVersion() {
         return this.version;
     }
-    
+
+    public String toString() {
+        return "workflow:" + this.version.getEvent() + "->" + this.version.getState();
+    }
+
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.