02-09-2011 06:27 PM
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:adhocCustom">
…
<task-node name="adhoc">
<task name="wf:adhocTask" swimlane="assignee">
<event type="task-create">
<script>
if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
</script>
</event>
</task>
<transition name="" to="completed">
<action class="foo.bar.MyAction">
</action>
</transition>
</task-node>
…
</process-definition>
public class MyAction extends JBPMSpringActionHandler {
private NodeService nodeService;
private ContentService contentService;
private FileFolderService fileFolderService;
@Override
protected void initialiseHandler(BeanFactory factory)
{
ServiceRegistry services = (ServiceRegistry) factory.getBean(ServiceRegistry.SERVICE_REGISTRY);
nodeService = services.getNodeService();
contentService = services.getContentService();
fileFolderService = services.getFileFolderService();
}
public void execute(final ExecutionContext context) throws Exception
{
// Retrieving current "virtual" node hosting modified documents [1]
NodeRef virtualDirectory = ((JBPMNode) context.getContextInstance().getVariable("bpm_package")).getNodeRef();
// Browsing every modified files, and calling target sites deployments [2]
for(FileInfo fileInfo : fileFolderService.listFiles(virtualDirectory)){
// Retrieving document file path & content
Path filePath = nodeService.getPath(fileInfo.getNodeRef());
String fileContent = contentService.getReader(fileInfo.getNodeRef(), ContentModel.PROP_CONTENT).getContentString();
// …
}
}
}
02-11-2011 04:38 AM
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.