use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity 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);
}
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity 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.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class AddIdentityLinkForProcessDefinitionCmd method execute.
public Void execute(CommandContext commandContext) {
ProcessDefinitionEntity processDefinition = Context.getCommandContext().getProcessDefinitionManager().findLatestProcessDefinitionById(processDefinitionId);
EnsureUtil.ensureNotNull("Cannot find process definition with id " + processDefinitionId, "processDefinition", processDefinition);
processDefinition.addIdentityLink(userId, groupId);
return null;
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class GetDeployedProcessDefinitionCmd method execute.
@Override
public ProcessDefinitionEntity execute(CommandContext commandContext) {
ensureOnlyOneNotNull("either process definition id or key must be set", processDefinitionId, processDefinitionKey);
ProcessDefinitionEntity processDefinition = find(commandContext);
if (checkReadPermission) {
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadProcessDefinition(processDefinition);
}
}
return processDefinition;
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class GetDeploymentBpmnModelInstanceCmd method execute.
public BpmnModelInstance execute(CommandContext commandContext) {
ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
final DeploymentCache deploymentCache = configuration.getDeploymentCache();
ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadProcessDefinition(processDefinition);
}
BpmnModelInstance modelInstance = deploymentCache.findBpmnModelInstanceForProcessDefinition(processDefinitionId);
ensureNotNull("no BPMN model instance found for process definition id " + processDefinitionId, "modelInstance", modelInstance);
return modelInstance;
}
Aggregations