use of org.activiti.engine.impl.pvm.process.ActivityImpl 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());
}
}
use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.
the class SignalEventDefinitionParseHandler method executeParse.
protected void executeParse(BpmnParse bpmnParse, SignalEventDefinition signalDefinition) {
Signal signal = null;
if (bpmnParse.getBpmnModel().containsSignalId(signalDefinition.getSignalRef())) {
signal = bpmnParse.getBpmnModel().getSignal(signalDefinition.getSignalRef());
String signalName = signal.getName();
signalDefinition.setSignalRef(signalName);
}
if (signal == null) {
return;
}
ActivityImpl activity = bpmnParse.getCurrentActivity();
if (bpmnParse.getCurrentFlowElement() instanceof StartEvent) {
activity.setProperty("type", "signalStartEvent");
EventSubscriptionDeclaration eventSubscriptionDeclaration = new EventSubscriptionDeclaration(signalDefinition.getSignalRef(), "signal");
eventSubscriptionDeclaration.setActivityId(activity.getId());
eventSubscriptionDeclaration.setStartEvent(true);
addEventSubscriptionDeclaration(bpmnParse, eventSubscriptionDeclaration, signalDefinition, bpmnParse.getCurrentScope());
} else if (bpmnParse.getCurrentFlowElement() instanceof IntermediateCatchEvent) {
activity.setProperty("type", "intermediateSignalCatch");
EventSubscriptionDeclaration eventSubscriptionDeclaration = new EventSubscriptionDeclaration(signalDefinition.getSignalRef(), "signal");
if (signal.getScope() != null) {
eventSubscriptionDeclaration.setConfiguration(signal.getScope());
}
if (getPrecedingEventBasedGateway(bpmnParse, (IntermediateCatchEvent) bpmnParse.getCurrentFlowElement()) != null) {
eventSubscriptionDeclaration.setActivityId(activity.getId());
addEventSubscriptionDeclaration(bpmnParse, eventSubscriptionDeclaration, signalDefinition, activity.getParent());
} else {
activity.setScope(true);
addEventSubscriptionDeclaration(bpmnParse, eventSubscriptionDeclaration, signalDefinition, activity);
}
} else if (bpmnParse.getCurrentFlowElement() instanceof ThrowEvent) {
ThrowEvent throwEvent = (ThrowEvent) bpmnParse.getCurrentFlowElement();
activity.setProperty("type", "intermediateSignalThrow");
EventSubscriptionDeclaration eventSubscriptionDeclaration = new EventSubscriptionDeclaration(signalDefinition.getSignalRef(), "signal");
eventSubscriptionDeclaration.setAsync(signalDefinition.isAsync());
activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createIntermediateThrowSignalEventActivityBehavior(throwEvent, signal, eventSubscriptionDeclaration));
} else if (bpmnParse.getCurrentFlowElement() instanceof BoundaryEvent) {
BoundaryEvent boundaryEvent = (BoundaryEvent) bpmnParse.getCurrentFlowElement();
boolean interrupting = boundaryEvent.isCancelActivity();
activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createBoundaryEventActivityBehavior(boundaryEvent, interrupting, activity));
activity.setProperty("type", "boundarySignal");
EventSubscriptionDeclaration eventSubscriptionDeclaration = new EventSubscriptionDeclaration(signalDefinition.getSignalRef(), "signal");
eventSubscriptionDeclaration.setActivityId(activity.getId());
if (signal.getScope() != null) {
eventSubscriptionDeclaration.setConfiguration(signal.getScope());
}
addEventSubscriptionDeclaration(bpmnParse, eventSubscriptionDeclaration, signalDefinition, activity.getParent());
if (activity.getParent() instanceof ActivityImpl) {
((ActivityImpl) activity.getParent()).setScope(true);
}
}
}
use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.
the class CallActivityParseHandler method executeParse.
protected void executeParse(BpmnParse bpmnParse, CallActivity callActivity) {
ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, callActivity, BpmnXMLConstants.ELEMENT_CALL_ACTIVITY);
activity.setScope(true);
activity.setAsync(callActivity.isAsynchronous());
activity.setExclusive(!callActivity.isNotExclusive());
activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createCallActivityBehavior(callActivity));
}
use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.
the class CompensateEventDefinitionParseHandler method executeParse.
protected void executeParse(BpmnParse bpmnParse, CompensateEventDefinition eventDefinition) {
ScopeImpl scope = bpmnParse.getCurrentScope();
if (StringUtils.isNotEmpty(eventDefinition.getActivityRef())) {
if (scope.findActivity(eventDefinition.getActivityRef()) == null) {
logger.warn("Invalid attribute value for 'activityRef': no activity with id '" + eventDefinition.getActivityRef() + "' in current scope " + scope.getId());
}
}
org.activiti.engine.impl.bpmn.parser.CompensateEventDefinition compensateEventDefinition = new org.activiti.engine.impl.bpmn.parser.CompensateEventDefinition();
compensateEventDefinition.setActivityRef(eventDefinition.getActivityRef());
compensateEventDefinition.setWaitForCompletion(eventDefinition.isWaitForCompletion());
ActivityImpl activity = bpmnParse.getCurrentActivity();
if (bpmnParse.getCurrentFlowElement() instanceof ThrowEvent) {
activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createIntermediateThrowCompensationEventActivityBehavior((ThrowEvent) bpmnParse.getCurrentFlowElement(), compensateEventDefinition));
} else if (bpmnParse.getCurrentFlowElement() instanceof BoundaryEvent) {
BoundaryEvent boundaryEvent = (BoundaryEvent) bpmnParse.getCurrentFlowElement();
boolean interrupting = boundaryEvent.isCancelActivity();
activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createBoundaryEventActivityBehavior(boundaryEvent, interrupting, activity));
activity.setProperty("type", "compensationBoundaryCatch");
} else {
// What to do?
}
}
use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.
the class EventBasedGatewayParseHandler method executeParse.
protected void executeParse(BpmnParse bpmnParse, EventGateway gateway) {
ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, gateway, BpmnXMLConstants.ELEMENT_GATEWAY_EVENT);
activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createEventBasedGatewayActivityBehavior(gateway));
activity.setAsync(gateway.isAsynchronous());
activity.setExclusive(!gateway.isNotExclusive());
activity.setScope(true);
}
Aggregations