Java Code Examples for org.activiti.bpmn.model.BpmnModel#getInterfaces()

The following examples show how to use org.activiti.bpmn.model.BpmnModel#getInterfaces() . 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: WebServiceActivityBehavior.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
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.activiti.bpmn.model.Operation operationObject : interfaceObject.getOperations()) {
        
      if (operationMap.containsKey(operationObject.getId()) == false) {
        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);
      }
    }
  }
}
 
Example 2
Source File: ServiceTaskValidator.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
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");
    }

  }
}
 
Example 3
Source File: SendTaskValidator.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
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");
    }

  }
}
 
Example 4
Source File: OperationValidator.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@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");
          }
        }
      }
    }
  }
}