Java Code Examples for org.activiti.bpmn.model.StartEvent#getFormProperties()

The following examples show how to use org.activiti.bpmn.model.StartEvent#getFormProperties() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FormHandlerUtil.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public static StartFormHandler getStartFormHandler(CommandContext commandContext, ProcessDefinition processDefinition) {
  StartFormHandler startFormHandler = new DefaultStartFormHandler();
  org.activiti.bpmn.model.Process process = ProcessDefinitionUtil.getProcess(processDefinition.getId());
  
  FlowElement initialFlowElement = process.getInitialFlowElement();
  if (initialFlowElement instanceof StartEvent) {
    
    StartEvent startEvent = (StartEvent) initialFlowElement;
    
    List<FormProperty> formProperties = startEvent.getFormProperties();
    String formKey = startEvent.getFormKey();
    DeploymentEntity deploymentEntity = commandContext.getDeploymentEntityManager().findById(processDefinition.getDeploymentId());
    
    startFormHandler.parseConfiguration(formProperties, formKey, deploymentEntity, processDefinition);
    return startFormHandler;
  }
  
  return null;
  
}
 
Example 2
Source File: StartEventConverterTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
private void validateModel(BpmnModel model) {

    FlowElement flowElement = model.getMainProcess().getFlowElement("start", true);
    assertTrue(flowElement instanceof StartEvent);

    StartEvent startEvent = (StartEvent) flowElement;
    assertEquals("start", startEvent.getId());
    assertEquals("startName", startEvent.getName());
    assertEquals("startFormKey", startEvent.getFormKey());
    assertEquals("startInitiator", startEvent.getInitiator());
    assertEquals("startDoc", startEvent.getDocumentation());
 
    assertEquals(2, startEvent.getExecutionListeners().size());
    ActivitiListener executionListener = startEvent.getExecutionListeners().get(0);
    assertEquals("start", executionListener.getEvent());
    assertEquals("org.test.TestClass", executionListener.getImplementation());
    assertEquals(ImplementationType.IMPLEMENTATION_TYPE_CLASS, executionListener.getImplementationType());
    
    executionListener = startEvent.getExecutionListeners().get(1);
    assertEquals("end", executionListener.getEvent());
    assertEquals("${someExpression}", executionListener.getImplementation());
    assertEquals(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION, executionListener.getImplementationType());
    
    List<FormProperty> formProperties = startEvent.getFormProperties();
    assertEquals(2, formProperties.size());

    FormProperty formProperty = formProperties.get(0);
    assertEquals("startFormProp1", formProperty.getId());
    assertEquals("startFormProp1", formProperty.getName());
    assertEquals("string", formProperty.getType());

    formProperty = formProperties.get(1);
    assertEquals("startFormProp2", formProperty.getId());
    assertEquals("startFormProp2", formProperty.getName());
    assertEquals("boolean", formProperty.getType());

  }