use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.
the class BpmnParse method parseEscalations.
protected void parseEscalations() {
for (Element element : rootElement.elements("escalation")) {
String id = element.attribute("id");
if (id == null) {
addError("escalation must have an id", element);
} else {
Escalation escalation = createEscalation(id, element);
escalations.put(id, escalation);
}
}
}
use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.
the class BpmnParse method parseAsynchronousContinuationForActivity.
/**
* Parse async continuation of an activity and create async jobs for the activity.
* <br/> <br/>
* When the activity is marked as multi instance, then async jobs create instead for the multi instance body.
* When the wrapped activity has async characteristics in 'multiInstanceLoopCharacteristics' element,
* then async jobs create additionally for the wrapped activity.
*/
protected void parseAsynchronousContinuationForActivity(Element activityElement, ActivityImpl activity) {
// can't use #getMultiInstanceScope here to determine whether the task is multi-instance,
// since the property hasn't been set yet (cf parseActivity)
ActivityImpl parentFlowScopeActivity = activity.getParentFlowScopeActivity();
if (parentFlowScopeActivity != null && parentFlowScopeActivity.getActivityBehavior() instanceof MultiInstanceActivityBehavior && !activity.isCompensationHandler()) {
parseAsynchronousContinuation(activityElement, parentFlowScopeActivity);
Element miLoopCharacteristics = activityElement.element("multiInstanceLoopCharacteristics");
parseAsynchronousContinuation(miLoopCharacteristics, activity);
} else {
parseAsynchronousContinuation(activityElement, activity);
}
}
use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.
the class BpmnParse method parseStartAuthorization.
protected void parseStartAuthorization(Element scopeElement, ProcessDefinition definition) {
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) definition;
// parse activiti:potentialStarters
Element extentionsElement = scopeElement.element("extensionElements");
if (extentionsElement != null) {
List<Element> potentialStarterElements = extentionsElement.elementsNS(CAMUNDA_BPMN_EXTENSIONS_NS, POTENTIAL_STARTER);
for (Element potentialStarterElement : potentialStarterElements) {
parsePotentialStarterResourceAssignment(potentialStarterElement, processDefinition);
}
}
// parse activiti:candidateStarterUsers
String candidateUsersString = scopeElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, CANDIDATE_STARTER_USERS_EXTENSION);
if (candidateUsersString != null) {
List<String> candidateUsers = parseCommaSeparatedList(candidateUsersString);
for (String candidateUser : candidateUsers) {
processDefinition.addCandidateStarterUserIdExpression(expressionManager.createExpression(candidateUser.trim()));
}
}
// Candidate activiti:candidateStarterGroups
String candidateGroupsString = scopeElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, CANDIDATE_STARTER_GROUPS_EXTENSION);
if (candidateGroupsString != null) {
List<String> candidateGroups = parseCommaSeparatedList(candidateGroupsString);
for (String candidateGroup : candidateGroups) {
processDefinition.addCandidateStarterGroupIdExpression(expressionManager.createExpression(candidateGroup.trim()));
}
}
}
use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.
the class BpmnParse method parseIntermediateCatchEvent.
public ActivityImpl parseIntermediateCatchEvent(Element intermediateEventElement, ScopeImpl scopeElement, ActivityImpl eventBasedGateway) {
ActivityImpl nestedActivity = createActivityOnScope(intermediateEventElement, scopeElement);
Element timerEventDefinition = intermediateEventElement.element(TIMER_EVENT_DEFINITION);
Element signalEventDefinition = intermediateEventElement.element(SIGNAL_EVENT_DEFINITION);
Element messageEventDefinition = intermediateEventElement.element(MESSAGE_EVENT_DEFINITION);
Element linkEventDefinitionElement = intermediateEventElement.element(LINK_EVENT_DEFINITION);
Element conditionalEventDefinitionElement = intermediateEventElement.element(CONDITIONAL_EVENT_DEFINITION);
// shared by all events except for link event
IntermediateCatchEventActivityBehavior defaultCatchBehaviour = new IntermediateCatchEventActivityBehavior(eventBasedGateway != null);
parseAsynchronousContinuationForActivity(intermediateEventElement, nestedActivity);
boolean isEventBaseGatewayPresent = eventBasedGateway != null;
if (isEventBaseGatewayPresent) {
nestedActivity.setEventScope(eventBasedGateway);
nestedActivity.setActivityStartBehavior(ActivityStartBehavior.CANCEL_EVENT_SCOPE);
} else {
nestedActivity.setEventScope(nestedActivity);
nestedActivity.setScope(true);
}
nestedActivity.setActivityBehavior(defaultCatchBehaviour);
if (timerEventDefinition != null) {
parseIntermediateTimerEventDefinition(timerEventDefinition, nestedActivity);
} else if (signalEventDefinition != null) {
parseIntermediateSignalEventDefinition(signalEventDefinition, nestedActivity);
} else if (messageEventDefinition != null) {
parseIntermediateMessageEventDefinition(messageEventDefinition, nestedActivity);
} else if (linkEventDefinitionElement != null) {
if (isEventBaseGatewayPresent) {
addError("IntermediateCatchLinkEvent is not allowed after an EventBasedGateway.", intermediateEventElement);
}
nestedActivity.setActivityBehavior(new IntermediateCatchLinkEventActivityBehavior());
parseIntermediateLinkEventCatchBehavior(intermediateEventElement, nestedActivity, linkEventDefinitionElement);
} else if (conditionalEventDefinitionElement != null) {
ConditionalEventDefinition conditionalEvent = parseIntermediateConditionalEventDefinition(conditionalEventDefinitionElement, nestedActivity);
nestedActivity.setActivityBehavior(new IntermediateConditionalEventBehavior(conditionalEvent, isEventBaseGatewayPresent));
} else {
addError("Unsupported intermediate catch event type", intermediateEventElement);
}
for (BpmnParseListener parseListener : parseListeners) {
parseListener.parseIntermediateCatchEvent(intermediateEventElement, scopeElement, nestedActivity);
}
parseExecutionListenersOnScope(intermediateEventElement, nestedActivity);
return nestedActivity;
}
use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.
the class BpmnParse method parseStartEvents.
/**
* Parses the start events of a certain level in the process (process,
* subprocess or another scope).
*
* @param parentElement
* The 'parent' element that contains the start events (process,
* subprocess).
* @param scope
* The {@link ScopeImpl} to which the start events must be added.
*/
public void parseStartEvents(Element parentElement, ScopeImpl scope) {
List<Element> startEventElements = parentElement.elements("startEvent");
List<ActivityImpl> startEventActivities = new ArrayList<ActivityImpl>();
for (Element startEventElement : startEventElements) {
ActivityImpl startEventActivity = createActivityOnScope(startEventElement, scope);
parseAsynchronousContinuationForActivity(startEventElement, startEventActivity);
if (scope instanceof ProcessDefinitionEntity) {
parseProcessDefinitionStartEvent(startEventActivity, startEventElement, parentElement, scope);
startEventActivities.add(startEventActivity);
} else {
parseScopeStartEvent(startEventActivity, startEventElement, parentElement, (ActivityImpl) scope);
}
ensureNoIoMappingDefined(startEventElement);
for (BpmnParseListener parseListener : parseListeners) {
parseListener.parseStartEvent(startEventElement, scope, startEventActivity);
}
parseExecutionListenersOnScope(startEventElement, startEventActivity);
}
if (scope instanceof ProcessDefinitionEntity) {
selectInitial(startEventActivities, (ProcessDefinitionEntity) scope, parentElement);
parseStartFormHandlers(startEventElements, (ProcessDefinitionEntity) scope);
}
}
Aggregations