/** * Since subprocesses are autolayouted independently (see {@link #handleSubProcess(FlowElement)}), the elements have x and y coordinates relative to the bounds of the subprocess (thinking the * subprocess is on (0,0). This however, does not work for nested subprocesses, as they need to take in account the x and y coordinates for each of the parent subproceses. * * This method is to be called after fully layouting one process, since ALL elements need to have x and y. */ protected void translateNestedSubprocesses(Process process) { for (FlowElement flowElement : process.getFlowElements()) { if (flowElement instanceof SubProcess) { translateNestedSubprocessElements((SubProcess) flowElement); } } }
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { for (FlowElement flowElement : process.getFlowElements()) { if (flowElement instanceof Activity) { Activity activity = (Activity) flowElement; handleConstraints(process, activity, errors); handleMultiInstanceLoopCharacteristics(process, activity, errors); handleDataAssociations(process, activity, errors); } } }
protected void addMessageEventSubscriptions(ProcessDefinitionEntity processDefinition, Process process, BpmnModel bpmnModel) { if (CollectionUtil.isNotEmpty(process.getFlowElements())) { for (FlowElement element : process.getFlowElements()) { if (element instanceof StartEvent) { StartEvent startEvent = (StartEvent) element; if (CollectionUtil.isNotEmpty(startEvent.getEventDefinitions())) { EventDefinition eventDefinition = startEvent.getEventDefinitions().get(0); if (eventDefinition instanceof MessageEventDefinition) { MessageEventDefinition messageEventDefinition = (MessageEventDefinition) eventDefinition; insertMessageEvent(messageEventDefinition, startEvent, processDefinition, bpmnModel); } } } } } }
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { validateListeners(process, process, process.getExecutionListeners(), errors); for (FlowElement flowElement : process.getFlowElements()) { validateListeners(process, flowElement, flowElement.getExecutionListeners(), errors); } }
Collection<FlowElement> flowElements = model.getMainProcess().getFlowElements(); Map<String, GraphicInfo> locations = new HashMap<String, GraphicInfo>(); Map<String, List<GraphicInfo>> flowLocations = new HashMap<String, List<GraphicInfo>>();
if (process.getFlowElements().isEmpty() && process.getLanes().isEmpty()) { for (FlowElement flowElement : process.getFlowElements()) { createXML(flowElement, model, xtw);
newMainProcess.getFlowElements().addAll(subFlowElements); newMainProcess.getArtifacts().addAll(((SubProcess)subElement).getArtifacts()); subModel.addProcess(newMainProcess);
processFlowElements(process.getFlowElements(), process);
if (process.getFlowElements().isEmpty() && process.getLanes().isEmpty()) { for (FlowElement flowElement : process.getFlowElements()) { createXML(flowElement, model, xtw);
public void parse(XMLStreamReader xtr, BpmnModel model) throws Exception { String resourceId = xtr.getAttributeValue(null, ATTRIBUTE_ID); String resourceName = xtr.getAttributeValue(null, ATTRIBUTE_NAME); Resource resource; if (model.containsResourceId(resourceId)) { resource = model.getResource(resourceId); resource.setName(resourceName); for (org.activiti.bpmn.model.Process process : model.getProcesses()) { for (FlowElement fe : process.getFlowElements()) { if (fe instanceof UserTask && ((UserTask) fe).getCandidateGroups().contains(resourceId)) { ((UserTask) fe).getCandidateGroups().remove(resourceId); ((UserTask) fe).getCandidateGroups().add(resourceName); } } } } else { resource = new Resource(resourceId, resourceName); model.addResource(resource); } BpmnXMLUtil.addXMLLocation(resource, xtr); } }
protected List<TimerJobEntity> getTimerDeclarations(ProcessDefinitionEntity processDefinition, Process process) { JobManager jobManager = Context.getCommandContext().getJobManager(); List<TimerJobEntity> timers = new ArrayList<TimerJobEntity>(); if (CollectionUtil.isNotEmpty(process.getFlowElements())) { for (FlowElement element : process.getFlowElements()) { if (element instanceof StartEvent) { StartEvent startEvent = (StartEvent) element;
process); process.setDataObjects(dataObjects); process.getFlowElements().addAll(dataObjects); process.getFlowElements(), edgeMap, bpmnModel,
public ProcessInstance createAndStartProcessInstanceByMessage(ProcessDefinition processDefinition, String messageName, Map<String, Object> variables, Map<String, Object> transientVariables) { CommandContext commandContext = Context.getCommandContext(); // Do not start process a process instance if the process definition is suspended if (ProcessDefinitionUtil.isProcessDefinitionSuspended(processDefinition.getId())) { throw new ActivitiException("Cannot start process instance. Process definition " + processDefinition.getName() + " (id = " + processDefinition.getId() + ") is suspended"); } // Get model from cache Process process = ProcessDefinitionUtil.getProcess(processDefinition.getId()); if (process == null) { throw new ActivitiException("Cannot start process instance. Process model " + processDefinition.getName() + " (id = " + processDefinition.getId() + ") could not be found"); } FlowElement initialFlowElement = null; for (FlowElement flowElement : process.getFlowElements()) { if (flowElement instanceof StartEvent) { StartEvent startEvent = (StartEvent) flowElement; if (CollectionUtil.isNotEmpty(startEvent.getEventDefinitions()) && startEvent.getEventDefinitions().get(0) instanceof MessageEventDefinition) { MessageEventDefinition messageEventDefinition = (MessageEventDefinition) startEvent.getEventDefinitions().get(0); if (messageEventDefinition.getMessageRef().equals(messageName)) { initialFlowElement = flowElement; break; } } } } if (initialFlowElement == null) { throw new ActivitiException("No message start event found for process definition " + processDefinition.getId() + " and message name " + messageName); } return createAndStartProcessInstanceWithInitialFlowElement(processDefinition, null, null, initialFlowElement, process, variables, transientVariables, true); }
for (FlowElement flowElement : process.getFlowElements()) {
boolean isFlowElementLocalizationChanged = localizeFlowElements(process.getFlowElements(), infoNode); boolean isDataObjectLocalizationChanged = localizeDataObjectElements(process.getDataObjects(),
if (CollectionUtil.isNotEmpty(previousProcess.getFlowElements())) {
Process process, BpmnModel bpmnModel) { if (CollectionUtil.isNotEmpty(process.getFlowElements())) { for (FlowElement element : process.getFlowElements()) { if (element instanceof StartEvent) { StartEvent startEvent = (StartEvent) element;
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; }
for (FlowElement flowElement : process.getFlowElements()) { if (flowElement instanceof EventSubProcess) { EventSubProcess eventSubProcess = (EventSubProcess) flowElement;
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { validateListeners(process, process, process.getExecutionListeners(), errors); for (FlowElement flowElement : process.getFlowElements()) { validateListeners(process, flowElement, flowElement.getExecutionListeners(), errors); } }