This content has been marked as final.
Show 19 replies
-
15. Re: Start process with form
tom.baeyens Jun 26, 2009 8:02 AM (in response to heiko.braun)i was thinking a direct link.
in the jpdl process:<start form="forms/StartForm.form">...
in the object model / api:assertEquals("forms/StartForm.form", getStartFormResourceName("MyProcess", null) );
in the business archive:myprocess.jpdl.xml forms/StartForm.form
-
16. Re: Start process with form
kukeltje Jun 26, 2009 8:12 AM (in response to heiko.braun)But then my question again
There should also be a method on the taskservice to get the form for a normal task, why also have a special separate method to retrieve a form on the start activity if you already need a special method to retrieve the start activity? -
17. Re: Start process with form
camunda Jun 26, 2009 8:25 AM (in response to heiko.braun)Yeah, I think this kind of indirection is missing in the task forms yet, we already discussed about that:
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=155048&postdays=0&postorder=asc&start=10 -
18. Re: Start process with form
tom.baeyens Jun 27, 2009 7:44 AM (in response to heiko.braun)i'm adding these two to the repository service:
/** find all the activity names of the start activities for a given * process definition. Only top level activities are scanned. * Every activity that doesn't have incoming transitions is considered * a start activity. For the moment, jPDL only supports one * start activity. Start activity names can be null. */ List<String> getStartActivityNames(String processDefinitionId); /** the resource name for the given start activity. It is assumed that * the ProcessDefinition is already retrieved. From the ProcessDefinition, * the {@link ProcessDefinition#getId()} and the {@link ProcessDefinition#getDeploymentId()} * can be retrieved. The activityName can be obtained via {@link #getStartActivityNames(String)}. * An InputStream for the resource can be obtained with {@link #getResourceAsStream(String, String)} */ String getStartFormResourceName(String processDefinitionId, String activityName);
task forms are exposed through Task.getForm(). In order to make that method name consistent, I'll be refactoring it to Task.getFormResourceName() -
19. Re: Start process with form
tom.baeyens Jun 27, 2009 8:17 AM (in response to heiko.braun)here's the example usage (ProcessDefinitionStartFormTest):
public void testFormInUnnamedStartActivity() { String deploymentDbid = repositoryService.createDeployment() .addResourceFromString("xmlstring.jpdl.xml", "<process name='make print'>" + " <start form='org/jbpm/test/process/ProcessDefinitionStartForm.form' />" + "</process>" ) .addResourceFromClasspath("org/jbpm/test/process/ProcessDefinitionStartForm.form") .deploy(); registerDeployment(deploymentDbid); ProcessDefinition processDefinition = repositoryService .createProcessDefinitionQuery() .processDefinitionName("make print") .uniqueResult(); String processDefinitionId = processDefinition.getId(); List<String> startActivityNames = repositoryService.getStartActivityNames(processDefinitionId ); List<String> expectedStartActivityNames = new ArrayList<String>(); expectedStartActivityNames.add(null); assertEquals(expectedStartActivityNames, startActivityNames); String startFormResourceName = repositoryService.getStartFormResourceName(processDefinitionId, null); assertEquals("org/jbpm/test/process/ProcessDefinitionStartForm.form", startFormResourceName); InputStream formInputStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), startFormResourceName); String formContents = new String(IoUtil.readBytes(formInputStream)); assertEquals("start task form", formContents); } public void testFormInNamedStartActivity() { String deploymentDbid = repositoryService.createDeployment() .addResourceFromString("xmlstring.jpdl.xml", "<process name='make print'>" + " <start name='start' form='org/jbpm/test/process/ProcessDefinitionStartForm.form' />" + "</process>" ) .addResourceFromClasspath("org/jbpm/test/process/ProcessDefinitionStartForm.form") .deploy(); registerDeployment(deploymentDbid); ProcessDefinition processDefinition = repositoryService .createProcessDefinitionQuery() .processDefinitionName("make print") .uniqueResult(); String processDefinitionId = processDefinition.getId(); List<String> startActivityNames = repositoryService.getStartActivityNames(processDefinitionId ); List<String> expectedStartActivityNames = new ArrayList<String>(); expectedStartActivityNames.add("start"); assertEquals(expectedStartActivityNames, startActivityNames); String startFormResourceName = repositoryService.getStartFormResourceName(processDefinitionId, "start"); assertEquals("org/jbpm/test/process/ProcessDefinitionStartForm.form", startFormResourceName); InputStream formInputStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), startFormResourceName); String formContents = new String(IoUtil.readBytes(formInputStream)); assertEquals("start task form", formContents); }