Package org.activiti.engine.form

Examples of org.activiti.engine.form.StartFormData


    @RequestMapping("workspace-prepareStartProcessInstance")
    public String prepareStartProcessInstance(
            @RequestParam("processDefinitionId") String processDefinitionId,
            Model model) {
        FormService formService = processEngine.getFormService();
        StartFormData startFormData = formService
                .getStartFormData(processDefinitionId);
        model.addAttribute("startFormData", startFormData);

        return "bpm/workspace prepareStartProcessInstance";
    }
View Full Code Here


    RepositoryService repositoryService = activitiRule.getRepositoryService();
    repositoryService.createDeployment().addInputStream("DymaticForm.bpmn20.xml", new FileInputStream(filename)).deploy();
   
    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("DymaticForm").latestVersion().singleResult();
    FormService formService = activitiRule.getFormService();
    StartFormData startFormData = formService.getStartFormData(processDefinition.getId());
    assertNull(startFormData.getFormKey());
   
    Map<String, String> formProperties = new HashMap<String, String>();
    formProperties.put("name", "HenryYan");
   
    ProcessInstance processInstance = formService.submitStartFormData(processDefinition.getId(), formProperties);
View Full Code Here

  @Override
  protected List processList(List list) {
    List<ProcessDefinitionResponse> responseProcessDefinitions = new ArrayList<ProcessDefinitionResponse>();
    for (Object definition : list) {
      ProcessDefinitionResponse processDefinition = new ProcessDefinitionResponse((ProcessDefinitionEntity) definition);
      StartFormData startFormData = ActivitiUtil.getFormService().getStartFormData(((ProcessDefinitionEntity) definition).getId());
      if (startFormData != null) {
        processDefinition.setStartFormResourceKey(startFormData.getFormKey());
      }
     
      processDefinition.setGraphicNotationDefined(isGraphicNotationDefined(((ProcessDefinitionEntity) definition).getId()));
      responseProcessDefinitions.add(processDefinition);
    }
View Full Code Here

   
    if (formEngine==null) {
      throw new ActivitiException("No formEngine '" + formEngineName +"' defined process engine configuration");
    }
   
    StartFormData startForm = startFormHandler.createStartFormData(processDefinition);
   
    return formEngine.renderStartForm(startForm);
  }
View Full Code Here

  @Get
  public ObjectNode getStartFormProperties() {
    if(authenticate() == false) return null;
   
    String processDefinitionId = (String) getRequest().getAttributes().get("processDefinitionId");
    StartFormData startFormData = ActivitiUtil.getFormService().getStartFormData(processDefinitionId);
   
    ObjectNode responseJSON = new ObjectMapper().createObjectNode();
   
    ArrayNode propertiesJSON = new ObjectMapper().createArrayNode();
   
    if(startFormData != null) {
   
      List<FormProperty> properties = startFormData.getFormProperties();
     
      for (FormProperty property : properties) {
        ObjectNode propertyJSON = new ObjectMapper().createObjectNode();
        propertyJSON.put("id", property.getId());
        propertyJSON.put("name", property.getName());
View Full Code Here

        }
        result.addFormProperty(restFormProp);
      }
    }
    if (formData instanceof StartFormData) {
      StartFormData startFormData = (StartFormData) formData;
      if (startFormData.getProcessDefinition() != null) {
        result.setProcessDefinitionId(startFormData.getProcessDefinition().getId());
        result.setProcessDefinitionUrl(formatUrl(serverRootUrl, RestUrls.URL_PROCESS_DEFINITION, startFormData.getProcessDefinition().getId()));
      }
    } else if (formData instanceof TaskFormData) {
      TaskFormData taskFormData = (TaskFormData) formData;
      if (taskFormData.getTask() != null) {
        result.setTaskId(taskFormData.getTask().getId());
View Full Code Here

  @Autowired
  protected ObjectMapper objectMapper;
 
  @RequestMapping(value="/process-definition/{processDefinitionId}/properties", method = RequestMethod.GET, produces="application/json")
  public ObjectNode getStartFormProperties(@PathVariable String processDefinitionId) {
    StartFormData startFormData = formService.getStartFormData(processDefinitionId);
   
    ObjectNode responseJSON = objectMapper.createObjectNode();
   
    ArrayNode propertiesJSON = objectMapper.createArrayNode();
   
    if(startFormData != null) {
   
      List<FormProperty> properties = startFormData.getFormProperties();
     
      for (FormProperty property : properties) {
        ObjectNode propertyJSON = objectMapper.createObjectNode();
        propertyJSON.put("id", property.getId());
        propertyJSON.put("name", property.getName());
View Full Code Here

  @Deployment(resources = { "org/activiti/engine/test/api/form/FormsProcess.bpmn20.xml",
      "org/activiti/engine/test/api/form/start.form",
      "org/activiti/engine/test/api/form/task.form" })
  public void testTaskFormPropertyDefaultsAndFormRendering() {
    String procDefId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
    StartFormData startForm = formService.getStartFormData(procDefId);
    assertNotNull(startForm);
    assertEquals(deploymentIdFromDeploymentAnnotation, startForm.getDeploymentId());
    assertEquals("org/activiti/engine/test/api/form/start.form", startForm.getFormKey());
    assertEquals(new ArrayList<FormProperty>(), startForm.getFormProperties());
    assertEquals(procDefId, startForm.getProcessDefinition().getId());

    Object renderedStartForm = formService.getRenderedStartForm(procDefId);
    assertEquals("start form content", renderedStartForm);

    Map<String, String> properties = new HashMap<String, String>();
View Full Code Here

  @SuppressWarnings("unchecked")
  @Deployment
  public void testFormPropertyDetails() {
    String procDefId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
    StartFormData startFormData = formService.getStartFormData(procDefId);
    FormProperty property = startFormData.getFormProperties().get(0);
    assertEquals("speaker", property.getId());
    assertNull(property.getValue());
    assertTrue(property.isReadable());
    assertTrue(property.isWritable());
    assertFalse(property.isRequired());
    assertEquals("string", property.getType().getName());

    property = startFormData.getFormProperties().get(1);
    assertEquals("start", property.getId());
    assertNull(property.getValue());
    assertTrue(property.isReadable());
    assertTrue(property.isWritable());
    assertFalse(property.isRequired());
    assertEquals("date", property.getType().getName());
    assertEquals("dd-MMM-yyyy", property.getType().getInformation("datePattern"));

    property = startFormData.getFormProperties().get(2);
    assertEquals("direction", property.getId());
    assertNull(property.getValue());
    assertTrue(property.isReadable());
    assertTrue(property.isWritable());
    assertFalse(property.isRequired());
View Full Code Here

  }

  public void buttonClick(ClickEvent event) {
    // Check if process-definition defines a start-form
   
    StartFormData startFormData = formService.getStartFormData(processDefinition.getId());
    if(startFormData != null && ((startFormData.getFormProperties() != null && !startFormData.getFormProperties().isEmpty()) || startFormData.getFormKey() != null)) {
      parentPage.showStartForm(processDefinition, startFormData);
    } else {
      // Just start the process-instance since it has no form.
      // TODO: Error handling
      ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId());
View Full Code Here

TOP

Related Classes of org.activiti.engine.form.StartFormData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.