use of org.activiti.bpmn.model.ErrorEventDefinition in project Activiti by Activiti.
the class ErrorEventDefinitionParseHandler method executeParse.
protected void executeParse(BpmnParse bpmnParse, ErrorEventDefinition eventDefinition) {
ErrorEventDefinition modelErrorEvent = (ErrorEventDefinition) eventDefinition;
if (bpmnParse.getBpmnModel().containsErrorRef(modelErrorEvent.getErrorCode())) {
String errorCode = bpmnParse.getBpmnModel().getErrors().get(modelErrorEvent.getErrorCode());
modelErrorEvent.setErrorCode(errorCode);
}
ScopeImpl scope = bpmnParse.getCurrentScope();
ActivityImpl activity = bpmnParse.getCurrentActivity();
if (bpmnParse.getCurrentFlowElement() instanceof StartEvent) {
if (scope.getProperty(PROPERTYNAME_INITIAL) == null) {
scope.setProperty(PROPERTYNAME_INITIAL, activity);
// the scope of the event subscription is the parent of the event
// subprocess (subscription must be created when parent is initialized)
ScopeImpl catchingScope = ((ActivityImpl) scope).getParent();
createErrorStartEventDefinition(modelErrorEvent, activity, catchingScope);
}
} else if (bpmnParse.getCurrentFlowElement() instanceof BoundaryEvent) {
BoundaryEvent boundaryEvent = (BoundaryEvent) bpmnParse.getCurrentFlowElement();
// non-interrupting not yet supported
boolean interrupting = true;
activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createBoundaryEventActivityBehavior(boundaryEvent, interrupting, activity));
ActivityImpl parentActivity = scope.findActivity(boundaryEvent.getAttachedToRefId());
createBoundaryErrorEventDefinition(modelErrorEvent, interrupting, parentActivity, activity);
}
}
use of org.activiti.bpmn.model.ErrorEventDefinition in project Activiti by Activiti.
the class ErrorEventDefinitionParseHandler method createBoundaryErrorEventDefinition.
public void createBoundaryErrorEventDefinition(ErrorEventDefinition errorEventDefinition, boolean interrupting, ActivityImpl activity, ActivityImpl nestedErrorEventActivity) {
nestedErrorEventActivity.setProperty("type", "boundaryError");
ScopeImpl catchingScope = nestedErrorEventActivity.getParent();
((ActivityImpl) catchingScope).setScope(true);
org.activiti.engine.impl.bpmn.parser.ErrorEventDefinition definition = new org.activiti.engine.impl.bpmn.parser.ErrorEventDefinition(nestedErrorEventActivity.getId());
definition.setErrorCode(errorEventDefinition.getErrorCode());
addErrorEventDefinition(definition, catchingScope);
}
use of org.activiti.bpmn.model.ErrorEventDefinition in project Activiti by Activiti.
the class BoundaryEventXMLConverter method convertXMLToElement.
@Override
protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception {
BoundaryEvent boundaryEvent = new BoundaryEvent();
BpmnXMLUtil.addXMLLocation(boundaryEvent, xtr);
if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_BOUNDARY_CANCELACTIVITY))) {
String cancelActivity = xtr.getAttributeValue(null, ATTRIBUTE_BOUNDARY_CANCELACTIVITY);
if (ATTRIBUTE_VALUE_FALSE.equalsIgnoreCase(cancelActivity)) {
boundaryEvent.setCancelActivity(false);
}
}
boundaryEvent.setAttachedToRefId(xtr.getAttributeValue(null, ATTRIBUTE_BOUNDARY_ATTACHEDTOREF));
parseChildElements(getXMLElementName(), boundaryEvent, model, xtr);
// Explicitly set cancel activity to false for error boundary events
if (boundaryEvent.getEventDefinitions().size() == 1) {
EventDefinition eventDef = boundaryEvent.getEventDefinitions().get(0);
if (eventDef instanceof ErrorEventDefinition) {
boundaryEvent.setCancelActivity(false);
}
}
return boundaryEvent;
}
use of org.activiti.bpmn.model.ErrorEventDefinition in project Activiti by Activiti.
the class BaseBpmnJsonConverter method convertJsonToErrorDefinition.
protected void convertJsonToErrorDefinition(JsonNode objectNode, Event event) {
String errorRef = getPropertyValueAsString(PROPERTY_ERRORREF, objectNode);
ErrorEventDefinition eventDefinition = new ErrorEventDefinition();
eventDefinition.setErrorCode(errorRef);
event.getEventDefinitions().add(eventDefinition);
}
use of org.activiti.bpmn.model.ErrorEventDefinition in project Activiti by Activiti.
the class EndEventJsonConverter method getStencilId.
protected String getStencilId(BaseElement baseElement) {
EndEvent endEvent = (EndEvent) baseElement;
List<EventDefinition> eventDefinitions = endEvent.getEventDefinitions();
if (eventDefinitions.size() != 1) {
return STENCIL_EVENT_END_NONE;
}
EventDefinition eventDefinition = eventDefinitions.get(0);
if (eventDefinition instanceof ErrorEventDefinition) {
return STENCIL_EVENT_END_ERROR;
} else if (eventDefinition instanceof CancelEventDefinition) {
return STENCIL_EVENT_END_CANCEL;
} else if (eventDefinition instanceof TerminateEventDefinition) {
return STENCIL_EVENT_END_TERMINATE;
} else {
return STENCIL_EVENT_END_NONE;
}
}
Aggregations