Java Code Examples for org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity#setName()

The following examples show how to use org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity#setName() . 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: ProcessDefinitionsTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetProcessDefinitions() {

  when(repositoryService.createProcessDefinitionQuery()).thenReturn(processDefinitionQuery);
  List<ProcessDefinition> processDefinitionList = new ArrayList<ProcessDefinition>();
  ProcessDefinitionEntity pd = new ProcessDefinitionEntityImpl();
  pd.setId("testId");
  pd.setName("testName");
  pd.setVersion(175);
  pd.setSuspensionState(1);
  pd.setDescription("testDescription");

  processDefinitionList.add(pd);

  when(processDefinitionQuery.list()).thenReturn(processDefinitionList);

  List<List<String>> result = processDefinitionsMBean.getProcessDefinitions();
  assertNotNull(result);
  assertEquals(1, result.size());
  assertEquals(5, result.get(0).size());
  assertEquals("testId", result.get(0).get(0));
  assertEquals("testName", result.get(0).get(1));
  assertEquals("175", result.get(0).get(2));
  assertEquals("false", result.get(0).get(3));
  assertEquals("testDescription", result.get(0).get(4));

  pd.setSuspensionState(2);

  result = processDefinitionsMBean.getProcessDefinitions();
  assertEquals("true", result.get(0).get(3));

}
 
Example 2
Source File: ProcessParseHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected ProcessDefinitionEntity transformProcess(BpmnParse bpmnParse, Process process) {
  ProcessDefinitionEntity currentProcessDefinition = Context.getCommandContext().getProcessDefinitionEntityManager().create();
  bpmnParse.setCurrentProcessDefinition(currentProcessDefinition);

  /*
   * Mapping object model - bpmn xml: processDefinition.id -> generated by activiti engine processDefinition.key -> bpmn id (required) processDefinition.name -> bpmn name (optional)
   */
  currentProcessDefinition.setKey(process.getId());
  currentProcessDefinition.setName(process.getName());
  currentProcessDefinition.setCategory(bpmnParse.getBpmnModel().getTargetNamespace());
  currentProcessDefinition.setDescription(process.getDocumentation());
  currentProcessDefinition.setDeploymentId(bpmnParse.getDeployment().getId());
  
  if (bpmnParse.getDeployment().getEngineVersion() != null) {
    currentProcessDefinition.setEngineVersion(bpmnParse.getDeployment().getEngineVersion());
  }
  
  createEventListeners(bpmnParse, process.getEventListeners());

  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Parsing process {}", currentProcessDefinition.getKey());
  }
  
  bpmnParse.processFlowElements(process.getFlowElements());
  processArtifacts(bpmnParse, process.getArtifacts());

  return currentProcessDefinition;
}
 
Example 3
Source File: ProcessParseHandler.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
protected ProcessDefinitionEntity transformProcess(BpmnParse bpmnParse, Process process) {
    ProcessDefinitionEntity currentProcessDefinition = new ProcessDefinitionEntity();
    bpmnParse.setCurrentProcessDefinition(currentProcessDefinition);

    /*
     * Mapping object model - bpmn xml: processDefinition.id -> generated by activiti engine processDefinition.key -> bpmn id (required) processDefinition.name -> bpmn name (optional)
     */
    currentProcessDefinition.setKey(process.getId());
    currentProcessDefinition.setName(process.getName());
    currentProcessDefinition.setCategory(bpmnParse.getBpmnModel().getTargetNamespace());
    currentProcessDefinition.setDescription(process.getDocumentation());
    currentProcessDefinition.setProperty(PROPERTYNAME_DOCUMENTATION, process.getDocumentation()); // Kept for backwards compatibility. See ACT-1020
    currentProcessDefinition.setTaskDefinitions(new HashMap<>());
    currentProcessDefinition.setDeploymentId(bpmnParse.getDeployment().getId());
    createEventListeners(bpmnParse, process.getEventListeners());
    createExecutionListenersOnScope(bpmnParse, process.getExecutionListeners(), currentProcessDefinition);

    ExpressionManager expressionManager = bpmnParse.getExpressionManager();

    for (String candidateUser : process.getCandidateStarterUsers()) {
        currentProcessDefinition.addCandidateStarterUserIdExpression(expressionManager.createExpression(candidateUser));
    }

    for (String candidateGroup : process.getCandidateStarterGroups()) {
        currentProcessDefinition.addCandidateStarterGroupIdExpression(expressionManager.createExpression(candidateGroup));
    }

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Parsing process {}", currentProcessDefinition.getKey());
    }

    bpmnParse.setCurrentScope(currentProcessDefinition);

    bpmnParse.processFlowElements(process.getFlowElements());
    processArtifacts(bpmnParse, process.getArtifacts(), currentProcessDefinition);

    // parse out any data objects from the template in order to set up the necessary process variables
    Map<String, Object> variables = processDataObjects(bpmnParse, process.getDataObjects(), currentProcessDefinition);
    if (null != currentProcessDefinition.getVariables()) {
        currentProcessDefinition.getVariables().putAll(variables);
    } else {
        currentProcessDefinition.setVariables(variables);
    }

    bpmnParse.removeCurrentScope();

    return currentProcessDefinition;
}