@Override public void validate(BpmnModel bpmnModel, List<ValidationError> errors) { if (bpmnModel.getInterfaces() != null) { for (Interface bpmnInterface : bpmnModel.getInterfaces()) { if (bpmnInterface.getOperations() != null) { for (Operation operation : bpmnInterface.getOperations()) { if (bpmnModel.getMessage(operation.getInMessageRef()) == null) { addError(errors, Problems.OPERATION_INVALID_IN_MESSAGE_REFERENCE, null, operation, "Invalid inMessageRef for operation"); } } } } } }
protected void verifyWebservice(BpmnModel bpmnModel, Process process, ServiceTask serviceTask, List<ValidationError> errors) { if (ImplementationType.IMPLEMENTATION_TYPE_WEBSERVICE.equalsIgnoreCase(serviceTask.getImplementationType()) && StringUtils.isNotEmpty(serviceTask.getOperationRef())) { boolean operationFound = false; if (bpmnModel.getInterfaces() != null && !bpmnModel.getInterfaces().isEmpty()) { for (Interface bpmnInterface : bpmnModel.getInterfaces()) { if (bpmnInterface.getOperations() != null && !bpmnInterface.getOperations().isEmpty()) { for (Operation operation : bpmnInterface.getOperations()) { if (operation.getId() != null && operation.getId().equals(serviceTask.getOperationRef())) { operationFound = true; } } } } } if (!operationFound) { addError(errors, Problems.SERVICE_TASK_WEBSERVICE_INVALID_OPERATION_REF, process, serviceTask, "Invalid operation reference"); } } }
protected void verifyWebservice(BpmnModel bpmnModel, Process process, SendTask sendTask, List<ValidationError> errors) { if (ImplementationType.IMPLEMENTATION_TYPE_WEBSERVICE.equalsIgnoreCase(sendTask.getImplementationType()) && StringUtils.isNotEmpty(sendTask.getOperationRef())) { boolean operationFound = false; if (bpmnModel.getInterfaces() != null && !bpmnModel.getInterfaces().isEmpty()) { for (Interface bpmnInterface : bpmnModel.getInterfaces()) { if (bpmnInterface.getOperations() != null && !bpmnInterface.getOperations().isEmpty()) { for (Operation operation : bpmnInterface.getOperations()) { if (operation.getId() != null && operation.getId().equals(sendTask.getOperationRef())) { operationFound = true; } } } } } if (!operationFound) { addError(errors, Problems.SEND_TASK_WEBSERVICE_INVALID_OPERATION_REF, process, sendTask, "Invalid operation reference for send task"); } } }
model.getInterfaces().add(interfaceObject);
protected void createOperations() { for (Interface interfaceObject : bpmnModel.getInterfaces()) { BpmnInterface bpmnInterface = new BpmnInterface(interfaceObject.getId(), interfaceObject.getName()); bpmnInterface.setImplementation(this.interfaceImplementations.get(interfaceObject.getImplementationRef())); for (org.flowable.bpmn.model.Operation operationObject : interfaceObject.getOperations()) { if (this.messages.containsKey(operationObject.getInMessageRef())) { MessageDefinition inMessage = this.messages.get(operationObject.getInMessageRef()); Operation operation = new Operation(operationObject.getId(), operationObject.getName(), bpmnInterface, inMessage); operation.setImplementation(this.operationImplementations.get(operationObject.getImplementationRef())); if (StringUtils.isNotEmpty(operationObject.getOutMessageRef())) { if (this.messages.containsKey(operationObject.getOutMessageRef())) { MessageDefinition outMessage = this.messages.get(operationObject.getOutMessageRef()); operation.setOutMessage(outMessage); } } operations.put(operation.getId(), operation); } } } }
protected void createOperations(BpmnModel bpmnModel) { for (Interface interfaceObject : bpmnModel.getInterfaces()) { BpmnInterface bpmnInterface = new BpmnInterface(interfaceObject.getId(), interfaceObject.getName()); bpmnInterface.setImplementation(wsServiceMap.get(interfaceObject.getImplementationRef())); for (org.flowable.bpmn.model.Operation operationObject : interfaceObject.getOperations()) { if (!operationMap.containsKey(operationObject.getId())) { MessageDefinition inMessage = messageDefinitionMap.get(operationObject.getInMessageRef()); Operation operation = new Operation(operationObject.getId(), operationObject.getName(), bpmnInterface, inMessage); operation.setImplementation(wsOperationMap.get(operationObject.getImplementationRef())); if (StringUtils.isNotEmpty(operationObject.getOutMessageRef())) { if (messageDefinitionMap.containsKey(operationObject.getOutMessageRef())) { MessageDefinition outMessage = messageDefinitionMap.get(operationObject.getOutMessageRef()); operation.setOutMessage(outMessage); } } operationMap.put(operation.getId(), operation); } } } }