You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2008/06/11 16:39:16 UTC
svn commit: r666685 -
/lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java
Author: andreas
Date: Wed Jun 11 07:39:16 2008
New Revision: 666685
URL: http://svn.apache.org/viewvc?rev=666685&view=rev
Log:
Avoid RepositoryException in DocumentWorkflowable if node hasn't checked in yet.
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java
Modified: lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java?rev=666685&r1=666684&r2=666685&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java Wed Jun 11 07:39:16 2008
@@ -107,7 +107,7 @@
private Version[] versions = null;
- private long lastModified = 0;
+ private int revision = 0;
protected static final String METADATA_NAMESPACE = "http://apache.org/lenya/metadata/workflow/1.0";
protected static final String METADATA_VERSION = "workflowVersion";
@@ -118,7 +118,10 @@
public Version[] getVersions() {
try {
MetaData meta = this.document.getMetaData(METADATA_NAMESPACE);
- if (this.versions == null || meta.getLastModified() > this.lastModified) {
+
+ org.apache.lenya.cms.repository.History history = this.document.getRepositoryNode().getHistory();
+ boolean checkedIn = history.getRevisionNumbers().length > 0;
+ if (this.versions == null || (checkedIn && history.getLatestRevision().getNumber() > this.revision)) {
String[] versionStrings = meta.getValues(METADATA_VERSION);
this.versions = new Version[versionStrings.length];
@@ -141,7 +144,9 @@
number++;
}
- this.lastModified = meta.getLastModified();
+ if (checkedIn) {
+ this.revision = history.getLatestRevision().getNumber();
+ }
}
} catch (Exception e) {
throw new RuntimeException(e);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org