Author: andreas
Date: Thu Apr 10 16:32:26 2008
New Revision: 647011
URL: http://svn.apache.org/viewvc?rev=647011&view=rev
Log:
Adding revision number to repository events.
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/repository/History.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=647011&r1=647010&r2=647011&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 Thu Apr 10 16:32:26 2008
@@ -27,6 +27,7 @@
private Session session;
private Object descriptor = null;
+ private int revision = -1;
/**
* Ctor.
@@ -74,6 +75,20 @@
*/
public String getNodeUri() {
return this.nodeUri;
+ }
+
+ /**
+ * @param revision The latest revision of the node at the time the event was created.
+ */
+ public void setRevision(int revision) {
+ this.revision = revision;
+ }
+
+ /**
+ * @return The latest revision of the node at the time the event was created.
+ */
+ public int getRevision() {
+ return this.revision;
}
}
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=647011&r1=647010&r2=647011&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 Thu Apr 10 16:32:26 2008
@@ -56,10 +56,15 @@
public static final RepositoryEvent createEvent(ServiceManager manager, Document doc,
Logger logger, Object descriptor) {
try {
- RepositoryEvent event = new DocumentEvent(doc.getRepositoryNode().getSession(), doc.getPublication()
+ Node node = doc.getRepositoryNode();
+ RepositoryEvent event = new DocumentEvent(node.getSession(), doc.getPublication()
.getId(), doc.getArea(), doc.getUUID(), doc.getLanguage(), doc
.getResourceType(), descriptor);
- event.setNodeUri(doc.getRepositoryNode().getSourceURI());
+ event.setNodeUri(node.getSourceURI());
+ int[] revisions = node.getHistory().getRevisionNumbers();
+ if (revisions.length > 0) {
+ event.setRevision(revisions[0]);
+ }
return event;
} catch (DocumentException e) {
throw new RuntimeException(e);
Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/History.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/repository/History.java?rev=647011&r1=647010&r2=647011&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/History.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/History.java Thu Apr 10 16:32:26 2008
@@ -29,6 +29,7 @@
/**
* @return The latest revision.
+ * @throws RuntimeException if the node has no revisions yet.
*/
Revision getLatestRevision();
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.