@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<ExclusiveGateway> gateways = process.findFlowElementsOfType(ExclusiveGateway.class); for (ExclusiveGateway gateway : gateways) { validateExclusiveGateway(process, gateway, errors); } }
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<ScriptTask> scriptTasks = process.findFlowElementsOfType(ScriptTask.class); for (ScriptTask scriptTask : scriptTasks) { if (StringUtils.isEmpty(scriptTask.getScript())) { addError(errors, Problems.SCRIPT_TASK_MISSING_SCRIPT, process, scriptTask, "No script provided for script task"); } } }
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<StartEvent> startEvents = process.findFlowElementsOfType(StartEvent.class, false); validateEventDefinitionTypes(startEvents, process, errors); validateMultipleStartEvents(startEvents, process, errors); }
protected Collection<BoundaryEvent> findBoundaryEventsForFlowNode(final String processDefinitionId, final FlowElement flowElement) { Process process = getProcessDefinition(processDefinitionId); // This could be cached or could be done at parsing time List<BoundaryEvent> results = new ArrayList<BoundaryEvent>(1); Collection<BoundaryEvent> boundaryEvents = process.findFlowElementsOfType(BoundaryEvent.class, true); for (BoundaryEvent boundaryEvent : boundaryEvents) { if (boundaryEvent.getAttachedToRefId() != null && boundaryEvent.getAttachedToRefId().equals(flowElement.getId())) { results.add(boundaryEvent); } } return results; }
protected Collection<BoundaryEvent> findBoundaryEventsForFlowNode(final String processDefinitionId, final FlowElement flowElement) { Process process = getProcessDefinition(processDefinitionId); // This could be cached or could be done at parsing time List<BoundaryEvent> results = new ArrayList<BoundaryEvent>(1); Collection<BoundaryEvent> boundaryEvents = process.findFlowElementsOfType(BoundaryEvent.class, true); for (BoundaryEvent boundaryEvent : boundaryEvents) { if (boundaryEvent.getAttachedToRefId() != null && boundaryEvent.getAttachedToRefId().equals(flowElement.getId())) { results.add(boundaryEvent); } } return results; }
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<ThrowEvent> throwEvents = process.findFlowElementsOfType(ThrowEvent.class); for (ThrowEvent throwEvent : throwEvents) { EventDefinition eventDefinition = null; if (!throwEvent.getEventDefinitions().isEmpty()) { eventDefinition = throwEvent.getEventDefinitions().get(0); } if (eventDefinition != null && !(eventDefinition instanceof SignalEventDefinition) && !(eventDefinition instanceof CompensateEventDefinition)) { addError(errors, Problems.THROW_EVENT_INVALID_EVENTDEFINITION, process, throwEvent, "Unsupported intermediate throw event type"); } } }
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { // Gather data objects List<ValuedDataObject> allDataObjects = new ArrayList<ValuedDataObject>(); allDataObjects.addAll(process.getDataObjects()); List<SubProcess> subProcesses = process.findFlowElementsOfType(SubProcess.class, true); for (SubProcess subProcess : subProcesses) { allDataObjects.addAll(subProcess.getDataObjects()); } // Validate for (ValuedDataObject dataObject : allDataObjects) { if (StringUtils.isEmpty(dataObject.getName())) { addError(errors, Problems.DATA_OBJECT_MISSING_NAME, process, dataObject, "Name is mandatory for a data object"); } } }
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<IntermediateCatchEvent> intermediateCatchEvents = process.findFlowElementsOfType(IntermediateCatchEvent.class); for (IntermediateCatchEvent intermediateCatchEvent : intermediateCatchEvents) { EventDefinition eventDefinition = null; if (!intermediateCatchEvent.getEventDefinitions().isEmpty()) { eventDefinition = intermediateCatchEvent.getEventDefinitions().get(0); } if (eventDefinition == null) { addError(errors, Problems.INTERMEDIATE_CATCH_EVENT_NO_EVENTDEFINITION, process, intermediateCatchEvent, "No event definition for intermediate catch event "); } else { if (!(eventDefinition instanceof TimerEventDefinition) && !(eventDefinition instanceof SignalEventDefinition) && !(eventDefinition instanceof MessageEventDefinition)) { addError(errors, Problems.INTERMEDIATE_CATCH_EVENT_INVALID_EVENTDEFINITION, process, intermediateCatchEvent, "Unsupported intermediate catch event type"); } } } }
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<SubProcess> subProcesses = process.findFlowElementsOfType(SubProcess.class); for (SubProcess subProcess : subProcesses) { if (!(subProcess instanceof EventSubProcess)) { // Verify start events List<StartEvent> startEvents = process.findFlowElementsInSubProcessOfType(subProcess, StartEvent.class, false); if (startEvents.size() > 1) { addError(errors, Problems.SUBPROCESS_MULTIPLE_START_EVENTS, process, subProcess, "Multiple start events not supported for subprocess"); } for (StartEvent startEvent : startEvents) { if (!startEvent.getEventDefinitions().isEmpty()) { addError(errors, Problems.SUBPROCESS_START_EVENT_EVENT_DEFINITION_NOT_ALLOWED, process, startEvent, "event definitions only allowed on start event if subprocess is an event subprocess"); } } } } }
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<EventSubProcess> eventSubprocesses = process.findFlowElementsOfType(EventSubProcess.class); for (EventSubProcess eventSubprocess : eventSubprocesses) { List<StartEvent> startEvents = process.findFlowElementsInSubProcessOfType(eventSubprocess, StartEvent.class); for (StartEvent startEvent : startEvents) { if (startEvent.getEventDefinitions() != null && !startEvent.getEventDefinitions().isEmpty()) { EventDefinition eventDefinition = startEvent.getEventDefinitions().get(0); if (!(eventDefinition instanceof org.activiti.bpmn.model.ErrorEventDefinition) && !(eventDefinition instanceof MessageEventDefinition) && !(eventDefinition instanceof SignalEventDefinition)) { addError(errors, Problems.EVENT_SUBPROCESS_INVALID_START_EVENT_DEFINITION, process, eventSubprocess, "start event of event subprocess must be of type 'error', 'message' or 'signal'"); } } } } }
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<EventGateway> eventGateways = process.findFlowElementsOfType(EventGateway.class); for (EventGateway eventGateway : eventGateways) { for (SequenceFlow sequenceFlow : eventGateway.getOutgoingFlows()) { FlowElement flowElement = process.getFlowElement(sequenceFlow.getTargetRef(), true); if (flowElement != null && !(flowElement instanceof IntermediateCatchEvent)) { addError(errors, Problems.EVENT_GATEWAY_ONLY_CONNECTED_TO_INTERMEDIATE_EVENTS, process, eventGateway, "Event based gateway can only be connected to elements of type intermediateCatchEvent"); } } } }
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<EndEvent> endEvents = process.findFlowElementsOfType(EndEvent.class); for (EndEvent endEvent : endEvents) { if (endEvent.getEventDefinitions() != null && !endEvent.getEventDefinitions().isEmpty()) { EventDefinition eventDefinition = endEvent.getEventDefinitions().get(0); // Error end event if (eventDefinition instanceof CancelEventDefinition) { FlowElementsContainer parent = process.findParent(endEvent); if (!(parent instanceof Transaction)) { addError(errors, Problems.END_EVENT_CANCEL_ONLY_INSIDE_TRANSACTION, process, endEvent, "end event with cancelEventDefinition only supported inside transaction subprocess"); } } } } }
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<ServiceTask> serviceTasks = process.findFlowElementsOfType(ServiceTask.class); for (ServiceTask serviceTask : serviceTasks) { verifyImplementation(process, serviceTask, errors); verifyType(process, serviceTask, errors); verifyResultVariableName(process, serviceTask, errors); verifyWebservice(bpmnModel, process, serviceTask, errors); } }
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<SendTask> sendTasks = process.findFlowElementsOfType(SendTask.class); for (SendTask sendTask : sendTasks) { // Verify implementation if (StringUtils.isEmpty(sendTask.getType()) && !ImplementationType.IMPLEMENTATION_TYPE_WEBSERVICE.equalsIgnoreCase(sendTask.getImplementationType())) { addError(errors, Problems.SEND_TASK_INVALID_IMPLEMENTATION, process, sendTask, "One of the attributes 'type' or 'operation' is mandatory on sendTask"); } // Verify type if (StringUtils.isNotEmpty(sendTask.getType())) { if (!sendTask.getType().equalsIgnoreCase("mail") && !sendTask.getType().equalsIgnoreCase("mule") && !sendTask.getType().equalsIgnoreCase("camel")) { addError(errors, Problems.SEND_TASK_INVALID_TYPE, process, sendTask, "Invalid or unsupported type for send task"); } if (sendTask.getType().equalsIgnoreCase("mail")) { validateFieldDeclarationsForEmail(process, sendTask, sendTask.getFieldExtensions(), errors); } } // Web service verifyWebservice(bpmnModel, process, sendTask, errors); } }
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<UserTask> userTasks = process.findFlowElementsOfType(UserTask.class); for (UserTask userTask : userTasks) { if (userTask.getTaskListeners() != null) { for (ActivitiListener listener : userTask.getTaskListeners()) { if (listener.getImplementation() == null || listener.getImplementationType() == null) { addError(errors, Problems.USER_TASK_LISTENER_IMPLEMENTATION_MISSING, process, userTask, "Element 'class' or 'expression' is mandatory on executionListener"); } } } } }
List<EventSubProcess> subProcesses = process.findFlowElementsOfType(EventSubProcess.class, true); for (EventSubProcess eventSubProcess : subProcesses) { for (FlowElement flowElement : eventSubProcess.getFlowElements()) { List<BoundaryEvent> boundaryEvents = process.findFlowElementsOfType(BoundaryEvent.class, true); for (BoundaryEvent boundaryEvent : boundaryEvents) { if (boundaryEvent.getAttachedToRefId() != null && CollectionUtil.isNotEmpty(boundaryEvent.getEventDefinitions()) && boundaryEvent.getEventDefinitions().get(0) instanceof ErrorEventDefinition) {
for (FlowNode flowNode : process.findFlowElementsOfType(FlowNode.class)) { if (flowNode.getBehavior() instanceof InactiveActivityBehavior) { flowNodeIdsWithInactivatedBehavior.add(flowNode.getId());
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<Event> events = process.findFlowElementsOfType(Event.class); for (Event event : events) { if (event.getEventDefinitions() != null) { for (EventDefinition eventDefinition : event.getEventDefinitions()) { if (eventDefinition instanceof MessageEventDefinition) { handleMessageEventDefinition(bpmnModel, process, event, eventDefinition, errors); } else if (eventDefinition instanceof SignalEventDefinition) { handleSignalEventDefinition(bpmnModel, process, event, eventDefinition, errors); } else if (eventDefinition instanceof TimerEventDefinition) { handleTimerEventDefinition(process, event, eventDefinition, errors); } else if (eventDefinition instanceof CompensateEventDefinition) { handleCompensationEventDefinition(bpmnModel, process, event, eventDefinition, errors); } } } } }
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<SequenceFlow> sequenceFlows = process.findFlowElementsOfType(SequenceFlow.class); for (SequenceFlow sequenceFlow : sequenceFlows) {
if (CollectionUtil.isNotEmpty(previousProcess.getFlowElements())) { List<StartEvent> startEvents = previousProcess.findFlowElementsOfType(StartEvent.class);