Search in sources :

Example 1 with Operation

use of org.activiti.engine.impl.bpmn.webservice.Operation in project Activiti by Activiti.

the class BpmnParse method createOperations.

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.activiti.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);
            }
        }
    }
}
Also used : MessageDefinition(org.activiti.engine.impl.bpmn.webservice.MessageDefinition) Operation(org.activiti.engine.impl.bpmn.webservice.Operation) BpmnInterface(org.activiti.engine.impl.bpmn.webservice.BpmnInterface) Interface(org.activiti.bpmn.model.Interface) BpmnInterface(org.activiti.engine.impl.bpmn.webservice.BpmnInterface)

Example 2 with Operation

use of org.activiti.engine.impl.bpmn.webservice.Operation in project Activiti by Activiti.

the class SendTaskParseHandler method executeParse.

protected void executeParse(BpmnParse bpmnParse, SendTask sendTask) {
    ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, sendTask, BpmnXMLConstants.ELEMENT_TASK_SEND);
    activity.setAsync(sendTask.isAsynchronous());
    activity.setExclusive(!sendTask.isNotExclusive());
    if (StringUtils.isNotEmpty(sendTask.getType())) {
        if (sendTask.getType().equalsIgnoreCase("mail")) {
            activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createMailActivityBehavior(sendTask));
        } else if (sendTask.getType().equalsIgnoreCase("mule")) {
            activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createMuleActivityBehavior(sendTask, bpmnParse.getBpmnModel()));
        } else if (sendTask.getType().equalsIgnoreCase("camel")) {
            activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createCamelActivityBehavior(sendTask, bpmnParse.getBpmnModel()));
        }
    // for web service
    } else if (ImplementationType.IMPLEMENTATION_TYPE_WEBSERVICE.equalsIgnoreCase(sendTask.getImplementationType()) && StringUtils.isNotEmpty(sendTask.getOperationRef())) {
        if (!bpmnParse.getOperations().containsKey(sendTask.getOperationRef())) {
            logger.warn(sendTask.getOperationRef() + " does not exist for sendTask " + sendTask.getId());
        } else {
            WebServiceActivityBehavior webServiceActivityBehavior = bpmnParse.getActivityBehaviorFactory().createWebServiceActivityBehavior(sendTask);
            Operation operation = bpmnParse.getOperations().get(sendTask.getOperationRef());
            webServiceActivityBehavior.setOperation(operation);
            if (sendTask.getIoSpecification() != null) {
                IOSpecification ioSpecification = createIOSpecification(bpmnParse, sendTask.getIoSpecification());
                webServiceActivityBehavior.setIoSpecification(ioSpecification);
            }
            for (DataAssociation dataAssociationElement : sendTask.getDataInputAssociations()) {
                AbstractDataAssociation dataAssociation = createDataInputAssociation(bpmnParse, dataAssociationElement);
                webServiceActivityBehavior.addDataInputAssociation(dataAssociation);
            }
            for (DataAssociation dataAssociationElement : sendTask.getDataOutputAssociations()) {
                AbstractDataAssociation dataAssociation = createDataOutputAssociation(bpmnParse, dataAssociationElement);
                webServiceActivityBehavior.addDataOutputAssociation(dataAssociation);
            }
            activity.setActivityBehavior(webServiceActivityBehavior);
        }
    } else {
        logger.warn("One of the attributes 'type' or 'operation' is mandatory on sendTask " + sendTask.getId());
    }
}
Also used : AbstractDataAssociation(org.activiti.engine.impl.bpmn.data.AbstractDataAssociation) ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl) DataAssociation(org.activiti.bpmn.model.DataAssociation) AbstractDataAssociation(org.activiti.engine.impl.bpmn.data.AbstractDataAssociation) IOSpecification(org.activiti.engine.impl.bpmn.data.IOSpecification) WebServiceActivityBehavior(org.activiti.engine.impl.bpmn.behavior.WebServiceActivityBehavior) Operation(org.activiti.engine.impl.bpmn.webservice.Operation)

Aggregations

Operation (org.activiti.engine.impl.bpmn.webservice.Operation)2 DataAssociation (org.activiti.bpmn.model.DataAssociation)1 Interface (org.activiti.bpmn.model.Interface)1 WebServiceActivityBehavior (org.activiti.engine.impl.bpmn.behavior.WebServiceActivityBehavior)1 AbstractDataAssociation (org.activiti.engine.impl.bpmn.data.AbstractDataAssociation)1 IOSpecification (org.activiti.engine.impl.bpmn.data.IOSpecification)1 BpmnInterface (org.activiti.engine.impl.bpmn.webservice.BpmnInterface)1 MessageDefinition (org.activiti.engine.impl.bpmn.webservice.MessageDefinition)1 ActivityImpl (org.activiti.engine.impl.pvm.process.ActivityImpl)1