Examples of FormService


Examples of org.activiti.engine.FormService

  public void startProcess() throws Exception {
    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);
    assertNotNull(processInstance);

    RuntimeService runtimeService = activitiRule.getRuntimeService();
    System.err.println("=============");
//    runtimeService.suspendProcessInstanceById(processInstance.getId());
View Full Code Here

Examples of org.activiti.engine.FormService

  public void startProcess() throws Exception {
    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);
    assertNotNull(processInstance);
   
    // 运行时变量
    RuntimeService runtimeService = activitiRule.getRuntimeService();
    Map<String, Object> variables = runtimeService.getVariables(processInstance.getId());
    assertEquals(variables.size(), 1);
    Set<Entry<String, Object>> entrySet = variables.entrySet();
    for (Entry<String, Object> entry : entrySet) {
      System.out.println(entry.getKey() + "=" + entry.getValue());
    }
   
    // 历史记录
    HistoryService historyService = activitiRule.getHistoryService();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().formProperties().list();
    assertEquals(1, list.size());
   
    // 获取第一个节点
    TaskService taskService = activitiRule.getTaskService();
    Task task = taskService.createTaskQuery().singleResult();
    assertEquals("First Step", task.getName());
   
    TaskFormData taskFormData = formService.getTaskFormData(task.getId());
    assertNotNull(taskFormData);
    assertNull(taskFormData.getFormKey());
    List<FormProperty> taskFormProperties = taskFormData.getFormProperties();
    assertNotNull(taskFormProperties);
    for (FormProperty formProperty : taskFormProperties) {
      System.out.println(ToStringBuilder.reflectionToString(formProperty));
    }
    formProperties = new HashMap<String, String>();
    formProperties.put("setInFirstStep", "01/12/2012");
    formService.submitTaskFormData(task.getId(), formProperties);
   
    // 获取第二个节点
    task = taskService.createTaskQuery().taskName("Second Step").singleResult();
    assertNotNull(task);
    taskFormData = formService.getTaskFormData(task.getId());
    assertNotNull(taskFormData);
    List<FormProperty> formProperties2 = taskFormData.getFormProperties();
    assertNotNull(formProperties2);
    assertEquals(1, formProperties2.size());
    assertNotNull(formProperties2.get(0).getValue());
View Full Code Here

Examples of org.camunda.bpm.engine.FormService

  private void mockServices(ProcessEngine engine) {
    RepositoryService repoService = mock(RepositoryService.class);
    IdentityService identityService = mock(IdentityService.class);
    TaskService taskService = mock(TaskService.class);
    RuntimeService runtimeService = mock(RuntimeService.class);
    FormService formService = mock(FormService.class);
    HistoryService historyService = mock(HistoryService.class);
    ManagementService managementService = mock(ManagementService.class);
    CaseService caseService = mock(CaseService.class);
    FilterService filterService = mock(FilterService.class);
View Full Code Here

Examples of org.camunda.bpm.engine.FormService

      throw new RestException(Status.INTERNAL_SERVER_ERROR, e, errorMessage);
    }
  }

  public void submit(CompleteTaskDto dto) {
    FormService formService = engine.getFormService();

    try {
      VariableMap variables = VariableValueDto.toMap(dto.getVariables(), engine, objectMapper);
      formService.submitTaskForm(taskId, variables);

    } catch (RestException e) {
      String errorMessage = String.format("Cannot submit task form %s: %s", taskId, e.getMessage());
      throw new InvalidRequestException(e.getStatus(), e, errorMessage);
View Full Code Here

Examples of org.camunda.bpm.engine.FormService

    return HalTask.generate(task, engine);
  }

  @Override
  public FormDto getForm() {
    FormService formService = engine.getFormService();
    Task task = getTaskById(taskId);
    FormData formData;
    try {
      formData = formService.getTaskFormData(taskId);
    } catch (ProcessEngineException e) {
      throw new RestException(Status.BAD_REQUEST, e, "Cannot get form for task " + taskId);
    }

    FormDto dto = FormDto.fromFormData(formData);
View Full Code Here

Examples of org.camunda.bpm.engine.FormService

    return dto;
  }

  public String getRenderedForm() {
    FormService formService = engine.getFormService();
    Object renderedTaskForm = formService.getRenderedTaskForm(taskId);
    if(renderedTaskForm != null) {
      return renderedTaskForm.toString();
    }
    throw new InvalidRequestException(Status.NOT_FOUND, "No matching rendered form for task with the id " + taskId + " found.");
  }
View Full Code Here

Examples of org.camunda.bpm.engine.FormService

    return new LocalTaskVariablesResource(engine, taskId, objectMapper);
  }

  public Map<String, VariableValueDto> getFormVariables(String variableNames, boolean deserializeValues) {

    final FormService formService = engine.getFormService();
    List<String> formVariables = null;

    if(variableNames != null) {
      StringListConverter stringListConverter = new StringListConverter();
      formVariables = stringListConverter.convertQueryParameterToType(variableNames);
    }

    VariableMap startFormVariables = formService.getTaskFormVariables(taskId, formVariables, deserializeValues);

    return VariableValueDto.fromVariableMap(startFormVariables);
  }
View Full Code Here

Examples of org.camunda.bpm.engine.FormService

    return result;
  }

  @Override
  public ProcessInstanceDto submitForm(UriInfo context, StartProcessInstanceDto parameters) {
    FormService formService = engine.getFormService();

    ProcessInstance instance = null;
    try {
      Map<String, Object> variables = VariableValueDto.toMap(parameters.getVariables(), engine, objectMapper);
      String businessKey = parameters.getBusinessKey();
      if (businessKey != null) {
        instance = formService.submitStartForm(processDefinitionId, businessKey, variables);
      } else {
        instance = formService.submitStartForm(processDefinitionId, variables);
      }

    } catch (ProcessEngineException e) {
      String errorMessage = String.format("Cannot instantiate process definition %s: %s", processDefinitionId, e.getMessage());
      throw new RestException(Status.INTERNAL_SERVER_ERROR, e, errorMessage);
View Full Code Here

Examples of org.camunda.bpm.engine.FormService

    return mediaType;
  }

  @Override
  public FormDto getStartForm() {
    final FormService formService = engine.getFormService();

    final StartFormData formData;
    try {
      formData = formService.getStartFormData(processDefinitionId);
    } catch (ProcessEngineException e) {
      throw new InvalidRequestException(Status.BAD_REQUEST, e, "Cannot get start form data for process definition " + processDefinitionId);
    }
    FormDto dto = FormDto.fromFormData(formData);
    if(dto.getKey() == null || dto.getKey().isEmpty()) {
View Full Code Here

Examples of org.camunda.bpm.engine.FormService

    return dto;
  }

  public String getRenderedForm() {
    FormService formService = engine.getFormService();

    Object startForm = formService.getRenderedStartForm(processDefinitionId);
    if(startForm != null) {
      return startForm.toString();
    }

    throw new InvalidRequestException(Status.NOT_FOUND, "No matching rendered start form for process definition with the id " + processDefinitionId + " found.");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.