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

The following examples show how to use org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity#setProperty() . 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: StartEventParseHandler.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
protected void createProcessDefinitionStartEvent(BpmnParse bpmnParse, ActivityImpl startEventActivity, StartEvent startEvent, ProcessDefinitionEntity processDefinition) {
    if (StringUtils.isNotEmpty(startEvent.getInitiator())) {
        processDefinition.setProperty(PROPERTYNAME_INITIATOR_VARIABLE_NAME, startEvent.getInitiator());
    }

    // all start events share the same behavior:
    startEventActivity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createNoneStartEventActivityBehavior(startEvent));
    if (!startEvent.getEventDefinitions().isEmpty()) {
        EventDefinition eventDefinition = startEvent.getEventDefinitions().get(0);
        if (eventDefinition instanceof TimerEventDefinition
                || eventDefinition instanceof MessageEventDefinition
                || eventDefinition instanceof SignalEventDefinition) {
            bpmnParse.getBpmnParserHandlers().parseElement(bpmnParse, eventDefinition);
        } else {
            LOGGER.warn("Unsupported event definition on start event {}", eventDefinition);
        }
    }
}
 
Example 2
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;
}