05-22-2014 11:42 AM
public class TestCallWorkflowByJava extends ActionExecuterAbstractBase {
public static final String NAME = "test-workflow";
public static final String PARAM_NAME = "hello-name";
private NodeService nodeService;
private WorkflowService workflowService;
@Override
protected void addParameterDefinitions(List<ParameterDefinition> paramList) {
// Add definitions for action parameters
paramList.add(new ParameterDefinitionImpl(
PARAM_NAME,
DataTypeDefinition.TEXT,
true,
getParamDisplayLabel(PARAM_NAME)));
}
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef) {
if (this.nodeService.exists(actionedUponNodeRef) == true) {
String helloQName = (String) action.getParameterValue(PARAM_NAME);
NodeRef workflowPackage = this.workflowService.createPackage(null);
nodeService.addChild(workflowPackage, ?, ?, ?); // <– i dunno know what should be add to these 3 question marks.
Map<QName, Serializable> workflowProps = new HashMap<QName, Serializable>(16);
workflowProps.put(WorkflowModel.ASSOC_PACKAGE, workflowPackage);
QName PROP_QNAME_HELLO_NAME = QName.createQName(PeWorkflowModel.NAMESPACE_PE_CONTENT_MODEL, PeWorkflowModel.PROP_HELLO_NAME);
workflowProps.put(PROP_QNAME_HELLO_NAME, helloQName);
WorkflowDefinition workflowDefinition = this.workflowService.getDefinitionByName("activiti$helloWorld");
this.workflowService.startWorkflow(workflowDefinition.getId(), workflowProps);
}
}
// Setter
public void setNodeService(NodeService nodeService) {
this.nodeService = nodeService;
}
public void setWorkflowService(WorkflowService workflowService) {
this.workflowService = workflowService;
}
}
05-22-2014 12:32 PM
nodeService.addChild(workflowPackage, actionedUponNodeRef, WorkflowModel.ASSOC_PACKAGE_CONTAINS, "cm:assoname");
05-22-2014 01:15 PM
05-22-2014 07:48 PM
Data Model project : http://dev.alfresco.com/resource/docs/java/datamodel
The Alfresco Repository project :http://dev.alfresco.com/resource/docs/java/repository
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.