use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.
the class BpmnParse method parseEventBasedGateway.
public ActivityImpl parseEventBasedGateway(Element eventBasedGwElement, Element parentElement, ScopeImpl scope) {
ActivityImpl activity = createActivityOnScope(eventBasedGwElement, scope);
activity.setActivityBehavior(new EventBasedGatewayActivityBehavior());
activity.setScope(true);
parseAsynchronousContinuationForActivity(eventBasedGwElement, activity);
if (activity.isAsyncAfter()) {
addError("'asyncAfter' not supported for " + eventBasedGwElement.getTagName() + " elements.", eventBasedGwElement);
}
parseExecutionListenersOnScope(eventBasedGwElement, activity);
for (BpmnParseListener parseListener : parseListeners) {
parseListener.parseEventBasedGateway(eventBasedGwElement, scope, activity);
}
// find all outgoing sequence flows:
List<Element> sequenceFlows = parentElement.elements("sequenceFlow");
// collect all siblings in a map
Map<String, Element> siblingsMap = new HashMap<String, Element>();
List<Element> siblings = parentElement.elements();
for (Element sibling : siblings) {
siblingsMap.put(sibling.attribute("id"), sibling);
}
for (Element sequenceFlow : sequenceFlows) {
String sourceRef = sequenceFlow.attribute("sourceRef");
String targetRef = sequenceFlow.attribute("targetRef");
if (activity.getId().equals(sourceRef)) {
Element sibling = siblingsMap.get(targetRef);
if (sibling != null) {
if (sibling.getTagName().equals(ActivityTypes.INTERMEDIATE_EVENT_CATCH)) {
parseIntermediateCatchEvent(sibling, scope, activity);
} else {
addError("Event based gateway can only be connected to elements of type intermediateCatchEvent", sibling);
}
}
}
}
return activity;
}
use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.
the class BpmnParse method parseProcessDefinitionStartEvent.
protected void parseProcessDefinitionStartEvent(ActivityImpl startEventActivity, Element startEventElement, Element parentElement, ScopeImpl scope) {
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) scope;
String initiatorVariableName = startEventElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "initiator");
if (initiatorVariableName != null) {
processDefinition.setProperty(PROPERTYNAME_INITIATOR_VARIABLE_NAME, initiatorVariableName);
}
// all start events share the same behavior:
startEventActivity.setActivityBehavior(new NoneStartEventActivityBehavior());
Element timerEventDefinition = startEventElement.element(TIMER_EVENT_DEFINITION);
Element messageEventDefinition = startEventElement.element(MESSAGE_EVENT_DEFINITION);
Element signalEventDefinition = startEventElement.element(SIGNAL_EVENT_DEFINITION);
Element conditionEventDefinition = startEventElement.element(CONDITIONAL_EVENT_DEFINITION);
if (timerEventDefinition != null) {
parseTimerStartEventDefinition(timerEventDefinition, startEventActivity, processDefinition);
} else if (messageEventDefinition != null) {
startEventActivity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.START_EVENT_MESSAGE);
EventSubscriptionDeclaration messageStartEventSubscriptionDeclaration = parseMessageEventDefinition(messageEventDefinition);
messageStartEventSubscriptionDeclaration.setActivityId(startEventActivity.getId());
messageStartEventSubscriptionDeclaration.setStartEvent(true);
ensureNoExpressionInMessageStartEvent(messageEventDefinition, messageStartEventSubscriptionDeclaration);
addEventSubscriptionDeclaration(messageStartEventSubscriptionDeclaration, processDefinition, startEventElement);
} else if (signalEventDefinition != null) {
startEventActivity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.START_EVENT_SIGNAL);
startEventActivity.setEventScope(scope);
parseSignalCatchEventDefinition(signalEventDefinition, startEventActivity, true);
} else if (conditionEventDefinition != null) {
startEventActivity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.START_EVENT_CONDITIONAL);
ConditionalEventDefinition conditionalEventDefinition = parseConditionalEventDefinition(conditionEventDefinition, startEventActivity);
conditionalEventDefinition.setStartEvent(true);
conditionalEventDefinition.setActivityId(startEventActivity.getId());
startEventActivity.getProperties().set(BpmnProperties.CONDITIONAL_EVENT_DEFINITION, conditionalEventDefinition);
addEventSubscriptionDeclaration(conditionalEventDefinition, processDefinition, startEventElement);
}
}
use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.
the class BpmnParse method parseIntermediateTimerEventDefinition.
protected void parseIntermediateTimerEventDefinition(Element timerEventDefinition, ActivityImpl timerActivity) {
timerActivity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.INTERMEDIATE_EVENT_TIMER);
TimerDeclarationImpl timerDeclaration = parseTimer(timerEventDefinition, timerActivity, TimerCatchIntermediateEventJobHandler.TYPE);
Element timeCycleElement = timerEventDefinition.element("timeCycle");
if (timeCycleElement != null) {
addTimeCycleWarning(timeCycleElement, "intermediate catch");
}
addTimerDeclaration(timerActivity.getEventScope(), timerDeclaration);
for (BpmnParseListener parseListener : parseListeners) {
parseListener.parseIntermediateTimerEventDefinition(timerEventDefinition, timerActivity);
}
}
use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.
the class BpmnParse method parseImports.
/**
* Parses the rootElement importing structures
*/
protected void parseImports() {
List<Element> imports = rootElement.elements("import");
for (Element theImport : imports) {
String importType = theImport.attribute("importType");
XMLImporter importer = this.getImporter(importType, theImport);
if (importer == null) {
addError("Could not import item of type " + importType, theImport);
} else {
importer.importFrom(theImport, this);
}
}
}
use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.
the class DefaultFailedJobParseListener method parseActivity.
protected void parseActivity(Element element, ActivityImpl activity) {
if (isMultiInstance(activity)) {
// in case of multi-instance, the extension elements is set according to the async attributes
// the extension for multi-instance body is set on the element of the activity
ActivityImpl miBody = activity.getParentFlowScopeActivity();
if (isAsync(miBody)) {
setFailedJobRetryTimeCycleValue(element, miBody);
}
// the extension for inner activity is set on the multiInstanceLoopCharacteristics element
if (isAsync(activity)) {
Element multiInstanceLoopCharacteristics = element.element(MULTI_INSTANCE_LOOP_CHARACTERISTICS);
setFailedJobRetryTimeCycleValue(multiInstanceLoopCharacteristics, activity);
}
} else if (isAsync(activity)) {
setFailedJobRetryTimeCycleValue(element, activity);
}
}
Aggregations