mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
WCM submit (for approval) workflow.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4540 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -11,7 +11,6 @@ import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.avmsync.AVMDifference;
|
||||
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.jbpm.graph.exe.ExecutionContext;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
@@ -31,10 +30,6 @@ public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements
|
||||
*/
|
||||
private AVMSyncService fAVMSyncService;
|
||||
|
||||
/**
|
||||
* The NodeService reference.
|
||||
*/
|
||||
private NodeService fNodeService;
|
||||
|
||||
/**
|
||||
* Initialize service references.
|
||||
@@ -45,7 +40,6 @@ public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements
|
||||
{
|
||||
fAVMService = (AVMService)factory.getBean("AVMService");
|
||||
fAVMSyncService = (AVMSyncService)factory.getBean("AVMSyncService");
|
||||
fNodeService = (NodeService)factory.getBean("NodeService");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,48 +48,25 @@ public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements
|
||||
*/
|
||||
public void execute(ExecutionContext executionContext) throws Exception
|
||||
{
|
||||
// TODO: Allow submit parameters to passed into this action handler
|
||||
// rather than pulling directly from execution context
|
||||
|
||||
NodeRef pkg = ((JBPMNode)executionContext.getContextInstance().getVariable("bpm_package")).getNodeRef();
|
||||
Pair<Integer, String> pkgPath = AVMNodeConverter.ToAVMVersionPath(pkg);
|
||||
|
||||
// submit the package changes
|
||||
String description = (String)executionContext.getContextInstance().getVariable("bpm_workflowDescription");
|
||||
String tag = (String)executionContext.getContextInstance().getVariable("wcmwf_label");
|
||||
AVMNodeDescriptor pkgDesc = fAVMService.lookup(pkgPath.getFirst(), pkgPath.getSecond());
|
||||
String targetPath = pkgDesc.getIndirection();
|
||||
List<AVMDifference> diff = fAVMSyncService.compare(pkgPath.getFirst(), pkgPath.getSecond(), -1, targetPath, null);
|
||||
fAVMSyncService.update(diff, null, true, true, false, false, null, null);
|
||||
fAVMSyncService.update(diff, null, true, true, false, false, tag, description);
|
||||
|
||||
String from = (String)executionContext.getContextInstance().getVariable("wf_from");
|
||||
fAVMSyncService.flatten(from, targetPath);
|
||||
|
||||
// List<ChildAssociationRef> children = fNodeService.getChildAssocs(pkg);
|
||||
// List<AVMDifference> diffs = new ArrayList<AVMDifference>();
|
||||
// Map<String, String> storesHit = new HashMap<String, String>();
|
||||
// for (ChildAssociationRef child : children)
|
||||
// {
|
||||
// NodeRef childRef = child.getChildRef();
|
||||
// if (!fNodeService.hasAspect(childRef, ContentModel.ASPECT_REFERENCES_NODE))
|
||||
// {
|
||||
// throw new AVMSyncException("Package node does not have cm:referencesnode.");
|
||||
// }
|
||||
// NodeRef toSubmit = (NodeRef)fNodeService.getProperty(childRef, ContentModel.PROP_NODE_REF);
|
||||
// Pair<Integer, String> versionPath = AVMNodeConverter.ToAVMVersionPath(toSubmit);
|
||||
// String avmPath = versionPath.getSecond();
|
||||
// String [] storePath = avmPath.split(":");
|
||||
// String websiteName = fAVMService.getStoreProperty(storePath[0],
|
||||
// QName.createQName(null, ".website.name")).
|
||||
// getStringValue();
|
||||
// String stagingName = websiteName + "-staging";
|
||||
// AVMDifference diff =
|
||||
// new AVMDifference(-1, avmPath,
|
||||
// -1, stagingName + ":" + storePath[1],
|
||||
// AVMDifference.NEWER);
|
||||
// diffs.add(diff);
|
||||
// storesHit.put(storePath[0], stagingName);
|
||||
// }
|
||||
// // TODO fix update comments if needed.
|
||||
// fAVMSyncService.update(diffs, true, true, false, false, null, null);
|
||||
// for (Map.Entry<String, String> entry : storesHit.entrySet())
|
||||
// {
|
||||
// fAVMSyncService.flatten(entry.getKey() + ":/appBase",
|
||||
// entry.getValue() + ":/appBase");
|
||||
// }
|
||||
// flatten source folder where changes were submitted from
|
||||
String from = (String)executionContext.getContextInstance().getVariable("wcmwf_fromPath");
|
||||
if (from != null && from.length() > 0)
|
||||
{
|
||||
fAVMSyncService.flatten(from, targetPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -42,9 +42,9 @@ public class TestModel
|
||||
bootstrapModels.add("alfresco/model/dictionaryModel.xml");
|
||||
bootstrapModels.add("alfresco/model/systemModel.xml");
|
||||
bootstrapModels.add("alfresco/model/contentModel.xml");
|
||||
bootstrapModels.add("alfresco/model/wcmModel.xml");
|
||||
bootstrapModels.add("alfresco/model/applicationModel.xml");
|
||||
bootstrapModels.add("alfresco/model/bpmModel.xml");
|
||||
bootstrapModels.add("alfresco/workflow/workflowModel.xml");
|
||||
|
||||
// include models specified on command line
|
||||
for (String arg: args)
|
||||
|
@@ -187,7 +187,7 @@ public class WorkflowInterpreter
|
||||
try
|
||||
{
|
||||
String line = fIn.readLine();
|
||||
if (line.equals("exit"))
|
||||
if (line.equals("exit") || line.equals("quit"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -347,13 +347,17 @@ public class WorkflowInterpreter
|
||||
return "Syntax Error. Workflow Id not specified.\n";
|
||||
}
|
||||
List<WorkflowPath> paths = workflowService.getWorkflowPaths(workflowId);
|
||||
if (paths.size() == 0)
|
||||
{
|
||||
out.println("no further transitions");
|
||||
}
|
||||
for (WorkflowPath path : paths)
|
||||
{
|
||||
out.println("path: " + path.id + " , node: " + path.node.name + " , active: " + path.active);
|
||||
List<WorkflowTask> tasks = workflowService.getTasksForWorkflowPath(path.id);
|
||||
for (WorkflowTask task : tasks)
|
||||
{
|
||||
out.println(" task id: " + task.id + " , name: " + task.name + " , properties: " + task.properties.size());
|
||||
out.println(" task id: " + task.id + " , name: " + task.name + ", title: " + task.title + " , desc: " + task.description + " , properties: " + task.properties.size());
|
||||
}
|
||||
for (WorkflowTransition transition : path.node.transitions)
|
||||
{
|
||||
@@ -564,8 +568,9 @@ public class WorkflowInterpreter
|
||||
return "Workflow definition not selected.\n";
|
||||
}
|
||||
WorkflowPath path = workflowService.startWorkflow(currentWorkflowDef.id, params);
|
||||
out.println("started workflow id: " + path.instance.id + ", path: " + path.id + " , node: " + path.node.name + " , def: " + path.instance.definition.title);
|
||||
out.println("started workflow id: " + path.instance.id + " , def: " + path.instance.definition.title);
|
||||
currentPath = path;
|
||||
out.print(interpretCommand("show transitions"));
|
||||
}
|
||||
|
||||
else if (command[0].equals("update"))
|
||||
@@ -619,7 +624,8 @@ public class WorkflowInterpreter
|
||||
return "Syntax Error.\n";
|
||||
}
|
||||
WorkflowPath path = workflowService.signal(command[1], (command.length == 3) ? command[2] : null);
|
||||
out.println("signal sent - path id: " + path.id + " , node: " + path.node.name);
|
||||
out.println("signal sent - path id: " + path.id);
|
||||
out.print(interpretCommand("show transitions"));
|
||||
}
|
||||
|
||||
else if (command[0].equals("end"))
|
||||
@@ -631,7 +637,8 @@ public class WorkflowInterpreter
|
||||
if (command[1].equals("task"))
|
||||
{
|
||||
WorkflowTask task = workflowService.endTask(command[2], (command.length == 4) ? command[3] : null);
|
||||
out.println("signal sent - path id: " + task.path.id + " , node: " + task.path.node.name);
|
||||
out.println("signal sent - path id: " + task.path.id);
|
||||
out.print(interpretCommand("show transitions"));
|
||||
}
|
||||
else if (command[1].equals("workflow"))
|
||||
{
|
||||
@@ -642,6 +649,7 @@ public class WorkflowInterpreter
|
||||
}
|
||||
workflowService.cancelWorkflow(workflowId);
|
||||
out.println("cancelled workflow" + workflowId);
|
||||
out.print(interpretCommand("show transitions"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user