[Yanel-commits] rev 41103 -
public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/menu/impl
michi at wyona.com
michi at wyona.com
Thu Jan 22 11:26:36 CET 2009
Author: michi
Date: 2009-01-22 11:26:36 +0100 (Thu, 22 Jan 2009)
New Revision: 41103
Modified:
public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/menu/impl/RevisionInformationMenuItem.java
Log:
check if resource has workflow if resource is workflowable
Modified: public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/menu/impl/RevisionInformationMenuItem.java
===================================================================
--- public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/menu/impl/RevisionInformationMenuItem.java 2009-01-22 10:25:52 UTC (rev 41102)
+++ public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/menu/impl/RevisionInformationMenuItem.java 2009-01-22 10:26:36 UTC (rev 41103)
@@ -7,7 +7,9 @@
import org.wyona.yanel.core.Resource;
import org.wyona.yanel.core.api.attributes.WorkflowableV1;
import org.wyona.yanel.core.attributes.versionable.RevisionInformation;
+import org.wyona.yanel.core.util.ResourceAttributeHelper;
import org.wyona.yanel.core.workflow.WorkflowException;
+import org.wyona.yanel.core.workflow.WorkflowHelper;
import org.wyona.yanel.servlet.menu.ITransitionMenuContent;
import org.wyona.yanel.servlet.menu.RevisionInformationMenuContent;
import org.wyona.yanel.servlet.menu.RevisionTransitions;
@@ -46,18 +48,26 @@
String value = "";
try {
- WorkflowableV1 workflowable = (WorkflowableV1) this.resource;
- String state = workflowable.getWorkflowState(revision.getName());
- value = "<li class=\"haschild\">"
- + this.revision.getName()
- + " (" + formatDate(this.revision.getDate()) + ", " + state + ")"
- + "   ";
+ if (ResourceAttributeHelper.hasAttributeImplemented(resource, "Workflowable", "1") && WorkflowHelper.hasWorkflow(resource)) {
+ WorkflowableV1 workflowable = (WorkflowableV1) this.resource;
+ String state = workflowable.getWorkflowState(revision.getName());
+ value = "<li class=\"haschild\">"
+ + this.revision.getName()
+ + " (" + formatDate(this.revision.getDate()) + ", " + state + ")"
+ + "   ";
- ITransitionMenuContent x =
- new TransitionMenuContentImpl(getResource(), state, getRevisionInfo().getName(), getMenuLanguageCode());
- RevisionTransitionsMenuContent rt = new RevisionTransitions(getResource(), getRevisionInfo().getName(), getMenuLanguageCode(), x);
- value += rt.toHTML();
- value += "</li>";
+ ITransitionMenuContent x =
+ new TransitionMenuContentImpl(getResource(), state, getRevisionInfo().getName(), getMenuLanguageCode());
+ RevisionTransitionsMenuContent rt = new RevisionTransitions(getResource(), getRevisionInfo().getName(), getMenuLanguageCode(), x);
+ value += rt.toHTML();
+ value += "</li>";
+ } else {
+ value = "<li>"
+ + this.revision.getName()
+ + " (" + formatDate(this.revision.getDate()) + ")"
+ + "   ";
+ value += "</li>";
+ }
} catch (WorkflowException e) {
value = "";
log.error("Could not get workflow.", e);
More information about the Yanel-commits
mailing list