use of org.camunda.bpm.model.cmmn.PlanItemTransition in project camunda-bpm-platform by camunda.
the class SentryHandler method initializeOnPart.
protected void initializeOnPart(PlanItemOnPart onPart, Sentry sentry, CmmnHandlerContext context) {
CmmnActivity parent = context.getParent();
String sentryId = sentry.getId();
CmmnSentryDeclaration sentryDeclaration = parent.getSentry(sentryId);
PlanItem source = onPart.getSource();
PlanItemTransition standardEvent = onPart.getStandardEvent();
if (source != null && standardEvent != null) {
CmmnOnPartDeclaration onPartDeclaration = new CmmnOnPartDeclaration();
// initialize standardEvent
String standardEventName = standardEvent.name();
onPartDeclaration.setStandardEvent(standardEventName);
// initialize sourceRef
String sourceId = source.getId();
CmmnActivity sourceActivity = parent.findActivity(sourceId);
if (sourceActivity != null) {
onPartDeclaration.setSource(sourceActivity);
}
// initialize sentryRef
Sentry sentryRef = onPart.getSentry();
if (sentryRef != null) {
String sentryRefId = sentryRef.getId();
CmmnSentryDeclaration sentryRefDeclaration = parent.getSentry(sentryRefId);
onPartDeclaration.setSentry(sentryRefDeclaration);
}
// add onPartDeclaration to sentryDeclaration
sentryDeclaration.addOnPart(onPartDeclaration);
}
}
Aggregations