org.activiti.bpmn.constants.BpmnXMLConstants Java Examples

The following examples show how to use org.activiti.bpmn.constants.BpmnXMLConstants. 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: IntermediateThrowEventParseHandler.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, ThrowEvent intermediateEvent) {

    ActivityImpl nestedActivityImpl = createActivityOnCurrentScope(bpmnParse, intermediateEvent, BpmnXMLConstants.ELEMENT_EVENT_THROW);
    
    EventDefinition eventDefinition = null;
    if (!intermediateEvent.getEventDefinitions().isEmpty()) {
      eventDefinition = intermediateEvent.getEventDefinitions().get(0);
    }
    
    nestedActivityImpl.setAsync(intermediateEvent.isAsynchronous());
    nestedActivityImpl.setExclusive(!intermediateEvent.isNotExclusive());
    
    if (eventDefinition instanceof SignalEventDefinition) {
      bpmnParse.getBpmnParserHandlers().parseElement(bpmnParse, eventDefinition);
    } else if (eventDefinition instanceof org.activiti.bpmn.model.CompensateEventDefinition) {
      bpmnParse.getBpmnParserHandlers().parseElement(bpmnParse, eventDefinition);
    } else if (eventDefinition == null) {
      nestedActivityImpl.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createIntermediateThrowNoneEventActivityBehavior(intermediateEvent)); 
    } else { 
      logger.warn("Unsupported intermediate throw event type for throw event " + intermediateEvent.getId());
    }
  }
 
Example #2
Source File: UserTaskParseHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, UserTask userTask) {
  ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, userTask, BpmnXMLConstants.ELEMENT_TASK_USER);
  
  activity.setAsync(userTask.isAsynchronous());
  activity.setExclusive(!userTask.isNotExclusive()); 
  
  TaskDefinition taskDefinition = parseTaskDefinition(bpmnParse, userTask, userTask.getId(), (ProcessDefinitionEntity) bpmnParse.getCurrentScope().getProcessDefinition());
  activity.setProperty(PROPERTY_TASK_DEFINITION, taskDefinition);
  activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createUserTaskActivityBehavior(userTask, taskDefinition));
}
 
Example #3
Source File: CustomProcessDiagramGenerator.java    From lemon with Apache License 2.0 5 votes vote down vote up
protected static void init() {
    taskType.add(BpmnXMLConstants.ELEMENT_TASK_MANUAL);
    taskType.add(BpmnXMLConstants.ELEMENT_TASK_RECEIVE);
    taskType.add(BpmnXMLConstants.ELEMENT_TASK_SCRIPT);
    taskType.add(BpmnXMLConstants.ELEMENT_TASK_SEND);
    taskType.add(BpmnXMLConstants.ELEMENT_TASK_SERVICE);
    taskType.add(BpmnXMLConstants.ELEMENT_TASK_USER);

    gatewayType.add(BpmnXMLConstants.ELEMENT_GATEWAY_EXCLUSIVE);
    gatewayType.add(BpmnXMLConstants.ELEMENT_GATEWAY_INCLUSIVE);
    gatewayType.add(BpmnXMLConstants.ELEMENT_GATEWAY_EVENT);
    gatewayType.add(BpmnXMLConstants.ELEMENT_GATEWAY_PARALLEL);

    eventType.add("intermediateTimer");
    eventType.add("intermediateMessageCatch");
    eventType.add("intermediateSignalCatch");
    eventType.add("intermediateSignalThrow");
    eventType.add("messageStartEvent");
    eventType.add("startTimerEvent");
    eventType.add(BpmnXMLConstants.ELEMENT_ERROR);
    eventType.add(BpmnXMLConstants.ELEMENT_EVENT_START);
    eventType.add("errorEndEvent");
    eventType.add(BpmnXMLConstants.ELEMENT_EVENT_END);

    subProcessType.add(BpmnXMLConstants.ELEMENT_SUBPROCESS);
    subProcessType.add(BpmnXMLConstants.ELEMENT_CALL_ACTIVITY);
}
 
Example #4
Source File: DocApproveTest.java    From maven-framework-project with MIT License 5 votes vote down vote up
protected ExtensionAttribute createExpression(String expression) {
    ExtensionAttribute exp = new ExtensionAttribute();

    exp.setNamespacePrefix(BpmnXMLConstants.ACTIVITI_EXTENSIONS_PREFIX);
    exp.setNamespace(BpmnXMLConstants.ACTIVITI_EXTENSIONS_NAMESPACE);
    exp.setName(BpmnXMLConstants.ATTRIBUTE_TASK_SERVICE_EXPRESSION);
    exp.setValue(expression);
    return exp;

}
 
Example #5
Source File: BpmnDeployer.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected boolean localizeDataObjectElements(List<ValuedDataObject> dataObjects, ObjectNode infoNode) {
  boolean localizationValuesChanged = false;
  CommandContext commandContext = Context.getCommandContext();
  DynamicBpmnService dynamicBpmnService = commandContext.getProcessEngineConfiguration().getDynamicBpmnService();

  for(ValuedDataObject dataObject : dataObjects) {
    List<ExtensionElement> localizationElements = dataObject.getExtensionElements().get("localization");
    if (localizationElements != null) {
      for (ExtensionElement localizationElement : localizationElements) {
        if (BpmnXMLConstants.ACTIVITI_EXTENSIONS_PREFIX.equals(localizationElement.getNamespacePrefix())) {
          String locale = localizationElement.getAttributeValue(null, "locale");
          String name = localizationElement.getAttributeValue(null, "name");
          String documentation = null;

          List<ExtensionElement> documentationElements = localizationElement.getChildElements().get("documentation");
          if (documentationElements != null) {
            for (ExtensionElement documentationElement : documentationElements) {
              documentation = StringUtils.trimToNull(documentationElement.getElementText());
              break;
            }
          }
          
          if (name != null && isEqualToCurrentLocalizationValue(locale, dataObject.getId(), DynamicBpmnConstants.LOCALIZATION_NAME, name, infoNode) == false) {
            dynamicBpmnService.changeLocalizationName(locale, dataObject.getId(), name, infoNode);
            localizationValuesChanged = true;
          }
          
          if (documentation != null && isEqualToCurrentLocalizationValue(locale, dataObject.getId(), 
              DynamicBpmnConstants.LOCALIZATION_DESCRIPTION, documentation, infoNode) == false) {
            
            dynamicBpmnService.changeLocalizationDescription(locale, dataObject.getId(), documentation, infoNode);
            localizationValuesChanged = true;
          }
        }
      }
    }
  }
  
  return localizationValuesChanged;
}
 
Example #6
Source File: BpmnDeployer.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected boolean localizeDataObjectElements(List<ValuedDataObject> dataObjects, ObjectNode infoNode) {
  boolean localizationValuesChanged = false;
  CommandContext commandContext = Context.getCommandContext();
  DynamicBpmnService dynamicBpmnService = commandContext.getProcessEngineConfiguration().getDynamicBpmnService();

  for(ValuedDataObject dataObject : dataObjects) {
    List<ExtensionElement> localizationElements = dataObject.getExtensionElements().get("localization");
    if (localizationElements != null) {
      for (ExtensionElement localizationElement : localizationElements) {
        if (BpmnXMLConstants.ACTIVITI_EXTENSIONS_PREFIX.equals(localizationElement.getNamespacePrefix())) {
          String locale = localizationElement.getAttributeValue(null, "locale");
          String name = localizationElement.getAttributeValue(null, "name");
          String documentation = null;

          List<ExtensionElement> documentationElements = localizationElement.getChildElements().get("documentation");
          if (documentationElements != null) {
            for (ExtensionElement documentationElement : documentationElements) {
              documentation = StringUtils.trimToNull(documentationElement.getElementText());
              break;
            }
          }
          
          if (name != null && isEqualToCurrentLocalizationValue(locale, dataObject.getName(), DynamicBpmnConstants.LOCALIZATION_NAME, name, infoNode) == false) {
            dynamicBpmnService.changeLocalizationName(locale, dataObject.getName(), name, infoNode);
            localizationValuesChanged = true;
          }
          
          if (documentation != null && isEqualToCurrentLocalizationValue(locale, dataObject.getName(), 
              DynamicBpmnConstants.LOCALIZATION_DESCRIPTION, documentation, infoNode) == false) {
            
            dynamicBpmnService.changeLocalizationDescription(locale, dataObject.getName(), documentation, infoNode);
            localizationValuesChanged = true;
          }
        }
      }
    }
  }
  
  return localizationValuesChanged;
}
 
Example #7
Source File: TaskParseHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, Task task) {
  ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, task, BpmnXMLConstants.ELEMENT_TASK);
  activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createTaskActivityBehavior(task));
  
  activity.setAsync(task.isAsynchronous());
  activity.setExclusive(!task.isNotExclusive());
}
 
Example #8
Source File: BoundaryEventParseHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, BoundaryEvent boundaryEvent) {
  
  ActivityImpl parentActivity = findActivity(bpmnParse, boundaryEvent.getAttachedToRefId());
  if (parentActivity == null) {
    logger.warn("Invalid reference in boundary event. Make sure that the referenced activity is defined in the same scope as the boundary event " +  boundaryEvent.getId());
    return;
  }
 
  ActivityImpl nestedActivity = createActivityOnScope(bpmnParse, boundaryEvent, BpmnXMLConstants.ELEMENT_EVENT_BOUNDARY, parentActivity);
  bpmnParse.setCurrentActivity(nestedActivity);

  EventDefinition eventDefinition = null;
  if (!boundaryEvent.getEventDefinitions().isEmpty()) {
    eventDefinition = boundaryEvent.getEventDefinitions().get(0);
  }
  
  if (eventDefinition instanceof TimerEventDefinition
          || eventDefinition instanceof org.activiti.bpmn.model.ErrorEventDefinition
          || eventDefinition instanceof SignalEventDefinition
          || eventDefinition instanceof CancelEventDefinition
          || eventDefinition instanceof MessageEventDefinition
          || eventDefinition instanceof org.activiti.bpmn.model.CompensateEventDefinition) {

    bpmnParse.getBpmnParserHandlers().parseElement(bpmnParse, eventDefinition);
    
  } else {
    logger.warn("Unsupported boundary event type for boundary event " + boundaryEvent.getId());
  }
}
 
Example #9
Source File: ManualTaskParseHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, ManualTask manualTask) {
  ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, manualTask, BpmnXMLConstants.ELEMENT_TASK_MANUAL);
  activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createManualTaskActivityBehavior(manualTask));
  
  activity.setAsync(manualTask.isAsynchronous());
  activity.setExclusive(!manualTask.isNotExclusive());
}
 
Example #10
Source File: ExclusiveGatewayParseHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, ExclusiveGateway gateway) {
  ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, gateway, BpmnXMLConstants.ELEMENT_GATEWAY_EXCLUSIVE);
  
  activity.setAsync(gateway.isAsynchronous());
  activity.setExclusive(!gateway.isNotExclusive());
  
  activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createExclusiveGatewayActivityBehavior(gateway));
}
 
Example #11
Source File: BusinessRuleParseHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Override
protected void executeParse(BpmnParse bpmnParse, BusinessRuleTask businessRuleTask) {
  
  ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, businessRuleTask, BpmnXMLConstants.ELEMENT_TASK_BUSINESSRULE);
  activity.setAsync(businessRuleTask.isAsynchronous());
  activity.setExclusive(!businessRuleTask.isNotExclusive());
  activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createBusinessRuleTaskActivityBehavior(businessRuleTask));
}
 
Example #12
Source File: ParallelGatewayParseHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, ParallelGateway gateway) {
  ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, gateway, BpmnXMLConstants.ELEMENT_GATEWAY_PARALLEL);
  
  activity.setAsync(gateway.isAsynchronous());
  activity.setExclusive(!gateway.isNotExclusive());
  
  activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createParallelGatewayActivityBehavior(gateway));
}
 
Example #13
Source File: CallActivityParseHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, CallActivity callActivity) {
  
  ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, callActivity, BpmnXMLConstants.ELEMENT_CALL_ACTIVITY);
  activity.setScope(true);
  activity.setAsync(callActivity.isAsynchronous());
  activity.setExclusive(!callActivity.isNotExclusive());
  activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createCallActivityBehavior(callActivity));
}
 
Example #14
Source File: SubProcessParseHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, SubProcess subProcess) {
  
  ActivityImpl activity = createActivityOnScope(bpmnParse, subProcess, BpmnXMLConstants.ELEMENT_SUBPROCESS, bpmnParse.getCurrentScope());
  
  activity.setAsync(subProcess.isAsynchronous());
  activity.setExclusive(!subProcess.isNotExclusive());

  boolean triggeredByEvent = false;
  if (subProcess instanceof EventSubProcess) {
    triggeredByEvent = true;
  }
  activity.setProperty("triggeredByEvent", triggeredByEvent);
  
  // event subprocesses are not scopes
  activity.setScope(!triggeredByEvent);
  activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createSubprocActivityBehavior(subProcess));
  
  bpmnParse.setCurrentScope(activity);
  bpmnParse.setCurrentSubProcess(subProcess);
  
  bpmnParse.processFlowElements(subProcess.getFlowElements());
  processArtifacts(bpmnParse, subProcess.getArtifacts(), activity);
  
  // no data objects for event subprocesses
  if (!(subProcess instanceof EventSubProcess)) {
    // parse out any data objects from the template in order to set up the necessary process variables
    Map<String, Object> variables = processDataObjects(bpmnParse, subProcess.getDataObjects(), activity);
    activity.setVariables(variables);
  }

  bpmnParse.removeCurrentScope();
  bpmnParse.removeCurrentSubProcess();
  
  if (subProcess.getIoSpecification() != null) {
    IOSpecification ioSpecification = createIOSpecification(bpmnParse, subProcess.getIoSpecification());
    activity.setIoSpecification(ioSpecification);
  }

}
 
Example #15
Source File: ReceiveTaskParseHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, ReceiveTask receiveTask) {
  ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, receiveTask, BpmnXMLConstants.ELEMENT_TASK_RECEIVE);
  activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createReceiveTaskActivityBehavior(receiveTask));
  
  activity.setAsync(receiveTask.isAsynchronous());
  activity.setExclusive(!receiveTask.isNotExclusive());
}
 
Example #16
Source File: EventBasedGatewayParseHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, EventGateway gateway) {
  ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, gateway, BpmnXMLConstants.ELEMENT_GATEWAY_EVENT);   
  activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createEventBasedGatewayActivityBehavior(gateway));
  
  activity.setAsync(gateway.isAsynchronous());
  activity.setExclusive(!gateway.isNotExclusive());
  activity.setScope(true);
}
 
Example #17
Source File: InclusiveGatewayParseHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, InclusiveGateway gateway) {
  ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, gateway, BpmnXMLConstants.ELEMENT_GATEWAY_INCLUSIVE);
  
  activity.setAsync(gateway.isAsynchronous());
  activity.setExclusive(!gateway.isNotExclusive());
  
  activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createInclusiveGatewayActivityBehavior(gateway));
}
 
Example #18
Source File: StartEventParseHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Override
protected void executeParse(BpmnParse bpmnParse, StartEvent startEvent) {
  ActivityImpl startEventActivity = createActivityOnCurrentScope(bpmnParse, startEvent, BpmnXMLConstants.ELEMENT_EVENT_START);

  ScopeImpl scope = bpmnParse.getCurrentScope();
  if (scope instanceof ProcessDefinitionEntity) {
    createProcessDefinitionStartEvent(bpmnParse, startEventActivity, startEvent, (ProcessDefinitionEntity) scope);
    selectInitial(bpmnParse, startEventActivity, startEvent, (ProcessDefinitionEntity) scope);
    createStartFormHandlers(bpmnParse, startEvent, (ProcessDefinitionEntity) scope);
  } else {
    createScopeStartEvent(bpmnParse, startEventActivity, startEvent);
  }
}
 
Example #19
Source File: IntermediateCatchEventParseHandler.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, IntermediateCatchEvent event) {
  
  ActivityImpl nestedActivity = null;
  EventDefinition eventDefinition = null;
  if (!event.getEventDefinitions().isEmpty()) {
    eventDefinition = event.getEventDefinitions().get(0);
  }
 
  if (eventDefinition == null) {
    
    nestedActivity = createActivityOnCurrentScope(bpmnParse, event, BpmnXMLConstants.ELEMENT_EVENT_CATCH);
    nestedActivity.setAsync(event.isAsynchronous());
    nestedActivity.setExclusive(!event.isNotExclusive());
    
  } else {
    
    ScopeImpl scope = bpmnParse.getCurrentScope();
    String eventBasedGatewayId = getPrecedingEventBasedGateway(bpmnParse, event);
    if (eventBasedGatewayId  != null) {
      ActivityImpl gatewayActivity = scope.findActivity(eventBasedGatewayId);
      nestedActivity = createActivityOnScope(bpmnParse, event, BpmnXMLConstants.ELEMENT_EVENT_CATCH, gatewayActivity);
    } else {
      nestedActivity = createActivityOnScope(bpmnParse, event, BpmnXMLConstants.ELEMENT_EVENT_CATCH, scope);
    }
    
    nestedActivity.setAsync(event.isAsynchronous());
    nestedActivity.setExclusive(!event.isNotExclusive());
    
    // Catch event behavior is the same for all types
    nestedActivity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createIntermediateCatchEventActivityBehavior(event));
    
    if (eventDefinition instanceof TimerEventDefinition
            || eventDefinition instanceof SignalEventDefinition
            || eventDefinition instanceof MessageEventDefinition) {
      
      bpmnParse.getBpmnParserHandlers().parseElement(bpmnParse, eventDefinition);
      
    } else {
      logger.warn("Unsupported intermediate catch event type for event " + event.getId());
    }
  }
}
 
Example #20
Source File: TransactionParseHandler.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, Transaction transaction) {
  
  ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, transaction, BpmnXMLConstants.ELEMENT_TRANSACTION);
  
  activity.setAsync(transaction.isAsynchronous());
  activity.setExclusive(!transaction.isNotExclusive());
  
  activity.setScope(true);
  activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createTransactionActivityBehavior(transaction));
  

  bpmnParse.setCurrentScope(activity);
  
  bpmnParse.processFlowElements(transaction.getFlowElements());
  processArtifacts(bpmnParse, transaction.getArtifacts(), activity);
  
  bpmnParse.removeCurrentScope();
  
  if (transaction.getIoSpecification() != null) {
    IOSpecification ioSpecification = createIOSpecification(bpmnParse, transaction.getIoSpecification());
    activity.setIoSpecification(ioSpecification);
  }

}
 
Example #21
Source File: EndEventParseHandler.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, EndEvent endEvent) {
  
  ActivityImpl endEventActivity = createActivityOnCurrentScope(bpmnParse, endEvent, BpmnXMLConstants.ELEMENT_EVENT_END);
  EventDefinition eventDefinition = null;
  if (!endEvent.getEventDefinitions().isEmpty()) {
    eventDefinition = endEvent.getEventDefinitions().get(0);
  }
  
  // Error end event
  if (eventDefinition instanceof org.activiti.bpmn.model.ErrorEventDefinition) {
    org.activiti.bpmn.model.ErrorEventDefinition errorDefinition = (org.activiti.bpmn.model.ErrorEventDefinition) eventDefinition;
    if (bpmnParse.getBpmnModel().containsErrorRef(errorDefinition.getErrorCode())) {
      String errorCode = bpmnParse.getBpmnModel().getErrors().get(errorDefinition.getErrorCode());
      if (StringUtils.isEmpty(errorCode)) {
        logger.warn("errorCode is required for an error event " + endEvent.getId());
      }
      endEventActivity.setProperty("type", "errorEndEvent");
      errorDefinition.setErrorCode(errorCode);
    }
    endEventActivity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createErrorEndEventActivityBehavior(endEvent, errorDefinition));
    
  // Cancel end event      
  } else if (eventDefinition instanceof CancelEventDefinition) {
    ScopeImpl scope = bpmnParse.getCurrentScope();
    if (scope.getProperty("type")==null || !scope.getProperty("type").equals("transaction")) {
      logger.warn("end event with cancelEventDefinition only supported inside transaction subprocess (id=" + endEvent.getId() + ")");
    } else {
      endEventActivity.setProperty("type", "cancelEndEvent");
      endEventActivity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createCancelEndEventActivityBehavior(endEvent));
    }
  
  // Terminate end event  
  } else if (eventDefinition instanceof TerminateEventDefinition) {
    endEventActivity.setAsync(endEvent.isAsynchronous());
    endEventActivity.setExclusive(!endEvent.isNotExclusive());
    endEventActivity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createTerminateEndEventActivityBehavior(endEvent));
    
  // None end event  
  } else if (eventDefinition == null) {
    endEventActivity.setAsync(endEvent.isAsynchronous());
    endEventActivity.setExclusive(!endEvent.isNotExclusive());
    endEventActivity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createNoneEndEventActivityBehavior(endEvent));
  }
}
 
Example #22
Source File: BpmnDeployer.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
protected void createLocalizationValues(String processDefinitionId, Process process) {
  if (process == null) return;
  
  CommandContext commandContext = Context.getCommandContext();
  DynamicBpmnService dynamicBpmnService = commandContext.getProcessEngineConfiguration().getDynamicBpmnService();
  ObjectNode infoNode = dynamicBpmnService.getProcessDefinitionInfo(processDefinitionId);

  boolean localizationValuesChanged = false;
  List<ExtensionElement> localizationElements = process.getExtensionElements().get("localization");
  if (localizationElements != null) {
    for (ExtensionElement localizationElement : localizationElements) {
      if (BpmnXMLConstants.ACTIVITI_EXTENSIONS_PREFIX.equals(localizationElement.getNamespacePrefix())) {
        String locale = localizationElement.getAttributeValue(null, "locale");
        String name = localizationElement.getAttributeValue(null, "name");
        String documentation = null;
        List<ExtensionElement> documentationElements = localizationElement.getChildElements().get("documentation");
        if (documentationElements != null) {
          for (ExtensionElement documentationElement : documentationElements) {
            documentation = StringUtils.trimToNull(documentationElement.getElementText());
            break;
          }
        }

        String processId = process.getId();
        if (isEqualToCurrentLocalizationValue(locale, processId, "name", name, infoNode) == false) {
          dynamicBpmnService.changeLocalizationName(locale, processId, name, infoNode);
          localizationValuesChanged = true;
        }
        
        if (documentation != null && isEqualToCurrentLocalizationValue(locale, processId, "description", documentation, infoNode) == false) {
          dynamicBpmnService.changeLocalizationDescription(locale, processId, documentation, infoNode);
          localizationValuesChanged = true;
        }
        
        break;
      }
    }
  }

  boolean isFlowElementLocalizationChanged = localizeFlowElements(process.getFlowElements(), infoNode);
  boolean isDataObjectLocalizationChanged = localizeDataObjectElements(process.getDataObjects(), infoNode);
  if (isFlowElementLocalizationChanged || isDataObjectLocalizationChanged) {
    localizationValuesChanged = true;
  }

  if (localizationValuesChanged) {
    dynamicBpmnService.saveProcessDefinitionInfo(processDefinitionId, infoNode);
  }
}
 
Example #23
Source File: BpmnDeployer.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
protected boolean localizeFlowElements(Collection<FlowElement> flowElements, ObjectNode infoNode) {
  boolean localizationValuesChanged = false;
  
  if (flowElements == null) return localizationValuesChanged;
  
  CommandContext commandContext = Context.getCommandContext();
  DynamicBpmnService dynamicBpmnService = commandContext.getProcessEngineConfiguration().getDynamicBpmnService();
  
  for (FlowElement flowElement : flowElements) {
    if (flowElement instanceof UserTask || flowElement instanceof SubProcess) {
      List<ExtensionElement> localizationElements = flowElement.getExtensionElements().get("localization");
      if (localizationElements != null) {
        for (ExtensionElement localizationElement : localizationElements) {
          if (BpmnXMLConstants.ACTIVITI_EXTENSIONS_PREFIX.equals(localizationElement.getNamespacePrefix())) {
            String locale = localizationElement.getAttributeValue(null, "locale");
            String name = localizationElement.getAttributeValue(null, "name");
            String documentation = null;
            List<ExtensionElement> documentationElements = localizationElement.getChildElements().get("documentation");
            if (documentationElements != null) {
              for (ExtensionElement documentationElement : documentationElements) {
                documentation = StringUtils.trimToNull(documentationElement.getElementText());
                break;
              }
            }

            String flowElementId = flowElement.getId();
            if (isEqualToCurrentLocalizationValue(locale, flowElementId, "name", name, infoNode) == false) {
              dynamicBpmnService.changeLocalizationName(locale, flowElementId, name, infoNode);
              localizationValuesChanged = true;
            }
            
            if (documentation != null && isEqualToCurrentLocalizationValue(locale, flowElementId, "description", documentation, infoNode) == false) {
              dynamicBpmnService.changeLocalizationDescription(locale, flowElementId, documentation, infoNode);
              localizationValuesChanged = true;
            }
            
            break;
          }
        }
      }
      
      if (flowElement instanceof SubProcess) {
        SubProcess subprocess = (SubProcess) flowElement;
        boolean isFlowElementLocalizationChanged = localizeFlowElements(subprocess.getFlowElements(), infoNode);
        boolean isDataObjectLocalizationChanged = localizeDataObjectElements(subprocess.getDataObjects(), infoNode);
        if (isFlowElementLocalizationChanged || isDataObjectLocalizationChanged) {
          localizationValuesChanged = true;
        }
      }
    }
  }
  
  return localizationValuesChanged;
}
 
Example #24
Source File: BpmnDeployer.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
protected void createLocalizationValues(String processDefinitionId, Process process) {
  if (process == null) return;
  
  CommandContext commandContext = Context.getCommandContext();
  DynamicBpmnService dynamicBpmnService = commandContext.getProcessEngineConfiguration().getDynamicBpmnService();
  ObjectNode infoNode = dynamicBpmnService.getProcessDefinitionInfo(processDefinitionId);

  boolean localizationValuesChanged = false;
  List<ExtensionElement> localizationElements = process.getExtensionElements().get("localization");
  if (localizationElements != null) {
    for (ExtensionElement localizationElement : localizationElements) {
      if (BpmnXMLConstants.ACTIVITI_EXTENSIONS_PREFIX.equals(localizationElement.getNamespacePrefix())) {
        String locale = localizationElement.getAttributeValue(null, "locale");
        String name = localizationElement.getAttributeValue(null, "name");
        String documentation = null;
        List<ExtensionElement> documentationElements = localizationElement.getChildElements().get("documentation");
        if (documentationElements != null) {
          for (ExtensionElement documentationElement : documentationElements) {
            documentation = StringUtils.trimToNull(documentationElement.getElementText());
            break;
          }
        }

        String processId = process.getId();
        if (isEqualToCurrentLocalizationValue(locale, processId, "name", name, infoNode) == false) {
          dynamicBpmnService.changeLocalizationName(locale, processId, name, infoNode);
          localizationValuesChanged = true;
        }
        
        if (documentation != null && isEqualToCurrentLocalizationValue(locale, processId, "description", documentation, infoNode) == false) {
          dynamicBpmnService.changeLocalizationDescription(locale, processId, documentation, infoNode);
          localizationValuesChanged = true;
        }

        break;
      }
    }
  }

  boolean isFlowElementLocalizationChanged = localizeFlowElements(process.getFlowElements(), infoNode);
  boolean isDataObjectLocalizationChanged = localizeDataObjectElements(process.getDataObjects(), infoNode);
  if (isFlowElementLocalizationChanged || isDataObjectLocalizationChanged) {
    localizationValuesChanged = true;
  }

  if (localizationValuesChanged) {
    dynamicBpmnService.saveProcessDefinitionInfo(processDefinitionId, infoNode);
  }
}
 
Example #25
Source File: BpmnDeployer.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
protected boolean localizeFlowElements(Collection<FlowElement> flowElements, ObjectNode infoNode) {
  boolean localizationValuesChanged = false;
  
  if (flowElements == null) return localizationValuesChanged;
  
  CommandContext commandContext = Context.getCommandContext();
  DynamicBpmnService dynamicBpmnService = commandContext.getProcessEngineConfiguration().getDynamicBpmnService();
  
  for (FlowElement flowElement : flowElements) {
    if (flowElement instanceof UserTask || flowElement instanceof SubProcess) {
      List<ExtensionElement> localizationElements = flowElement.getExtensionElements().get("localization");
      if (localizationElements != null) {
        for (ExtensionElement localizationElement : localizationElements) {
          if (BpmnXMLConstants.ACTIVITI_EXTENSIONS_PREFIX.equals(localizationElement.getNamespacePrefix())) {
            String locale = localizationElement.getAttributeValue(null, "locale");
            String name = localizationElement.getAttributeValue(null, "name");
            String documentation = null;
            List<ExtensionElement> documentationElements = localizationElement.getChildElements().get("documentation");
            if (documentationElements != null) {
              for (ExtensionElement documentationElement : documentationElements) {
                documentation = StringUtils.trimToNull(documentationElement.getElementText());
                break;
              }
            }

            String flowElementId = flowElement.getId();
            if (isEqualToCurrentLocalizationValue(locale, flowElementId, "name", name, infoNode) == false) {
              dynamicBpmnService.changeLocalizationName(locale, flowElementId, name, infoNode);
              localizationValuesChanged = true;
            }
            
            if (documentation != null && isEqualToCurrentLocalizationValue(locale, flowElementId, "description", documentation, infoNode) == false) {
              dynamicBpmnService.changeLocalizationDescription(locale, flowElementId, documentation, infoNode);
              localizationValuesChanged = true;
            }
            
            break;
          }
        }
      }
      
      if (flowElement instanceof SubProcess) {
        SubProcess subprocess = (SubProcess) flowElement;
        boolean isFlowElementLocalizationChanged = localizeFlowElements(subprocess.getFlowElements(), infoNode);
        boolean isDataObjectLocalizationChanged = localizeDataObjectElements(subprocess.getDataObjects(), infoNode);
        if (isFlowElementLocalizationChanged || isDataObjectLocalizationChanged) {
          localizationValuesChanged = true;
        }
      }
    }
  }
  
  return localizationValuesChanged;
}
 
Example #26
Source File: ScriptTaskParseHandler.java    From activiti6-boot2 with Apache License 2.0 3 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, ScriptTask scriptTask) {

    if (StringUtils.isEmpty(scriptTask.getScript())) {
      logger.warn("No script provided for scriptTask " + scriptTask.getId());
    }
    
    ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, scriptTask, BpmnXMLConstants.ELEMENT_TASK_SCRIPT);
    
    activity.setAsync(scriptTask.isAsynchronous());
    activity.setExclusive(!scriptTask.isNotExclusive());

    activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createScriptTaskActivityBehavior(scriptTask));
    
  }