diff --git a/config/alfresco/web-client-config-workflow.xml b/config/alfresco/web-client-config-workflow.xml
index 68b0d12edf..ecf53d81db 100644
--- a/config/alfresco/web-client-config-workflow.xml
+++ b/config/alfresco/web-client-config-workflow.xml
@@ -79,17 +79,24 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
-
diff --git a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java
index c5892ee48d..54c2629f5a 100644
--- a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java
+++ b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java
@@ -33,6 +33,7 @@ import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.avm.AVMNodeConverter;
+import org.alfresco.repo.avm.actions.StartAVMWorkflowAction;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ActionService;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
@@ -43,8 +44,10 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.search.SearchService;
+import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
+import org.alfresco.util.GUID;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.context.IContextListener;
@@ -87,6 +90,7 @@ public class AVMBrowseBean implements IContextListener
/** Action bean Id for the AVM Submit action*/
private static final String ACTION_AVM_SUBMIT = "simple-avm-submit";
+ private static final String ACTION_AVM_WORKFLOW = "start-avm-workflow";
/** Content Manager role name */
private static final String ROLE_CONTENT_MANAGER = "ContentManager";
@@ -127,6 +131,9 @@ public class AVMBrowseBean implements IContextListener
/** The NamespaceService bean reference. */
protected NamespaceService namespaceService;
+ /** The WorkflowService bean reference. */
+ protected WorkflowService workflowService;
+
/** The browse bean */
protected BrowseBean browseBean;
@@ -172,6 +179,15 @@ public class AVMBrowseBean implements IContextListener
this.nodeService = nodeService;
}
+ /**
+ * Set the workflow service
+ * @param service The workflow service instance.
+ */
+ public void setWorkflowService(WorkflowService service)
+ {
+ workflowService = service;
+ }
+
/**
* Getter used by the Inline Edit XML JSP
*
@@ -713,11 +729,28 @@ public class AVMBrowseBean implements IContextListener
try
{
FacesContext context = FacesContext.getCurrentInstance();
- tx = Repository.getUserTransaction(context, true);
+ tx = Repository.getUserTransaction(context, false);
tx.begin();
- Action action = this.actionService.createAction(ACTION_AVM_SUBMIT);
- this.actionService.executeAction(action, getAvmActionNode().getNodeRef());
+ NodeRef nodeRef = getAvmActionNode().getNodeRef();
+ String name = (String)this.nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
+ NodeRef workflowPackage = this.workflowService.createPackage(null);
+ ChildAssociationRef childRef =
+ this.nodeService.createNode(workflowPackage, ContentModel.ASSOC_CONTAINS,
+ QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,
+ name), ContentModel.TYPE_CMOBJECT);
+ Map aspectProperties = new HashMap(1);
+ aspectProperties.put(ContentModel.PROP_NODE_REF, nodeRef);
+ NodeRef childNodeRef = childRef.getChildRef();
+ this.nodeService.addAspect(childNodeRef, ContentModel.ASPECT_REFERENCES_NODE, aspectProperties);
+
+ Map actionParams = new HashMap();
+ actionParams.put(StartAVMWorkflowAction.PARAM_WORKFLOW_NAME, "jbpm$wcmwf:submit");
+ Action action = this.actionService.createAction(ACTION_AVM_WORKFLOW, actionParams);
+ this.actionService.executeAction(action, workflowPackage);
+
+ // Action action = this.actionService.createAction(ACTION_AVM_SUBMIT);
+ // this.actionService.executeAction(action, getAvmActionNode().getNodeRef());
// commit the transaction
tx.commit();
@@ -731,6 +764,7 @@ public class AVMBrowseBean implements IContextListener
}
catch (Throwable err)
{
+ err.printStackTrace(System.err);
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
diff --git a/source/test-resources/xforms/demos/note/note.xsl b/source/test-resources/xforms/demos/note/note.xsl
index 8eee738e60..83967c0038 100644
--- a/source/test-resources/xforms/demos/note/note.xsl
+++ b/source/test-resources/xforms/demos/note/note.xsl
@@ -53,7 +53,7 @@ body
-
+
diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml
index a803e7033f..e555b55768 100644
--- a/source/web/WEB-INF/faces-config-beans.xml
+++ b/source/web/WEB-INF/faces-config-beans.xml
@@ -2273,6 +2273,10 @@
actionService
#{ActionService}
+
+ workflowService
+ #{WorkflowService}
+