use of org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration in project camunda-bpm-platform by camunda.
the class ItemHandler method initializeEntryCriterias.
protected void initializeEntryCriterias(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
Collection<Sentry> entryCriterias = getEntryCriterias(element);
if (!entryCriterias.isEmpty()) {
CmmnActivity parent = activity.getParent();
if (parent != null) {
for (Sentry sentry : entryCriterias) {
String sentryId = sentry.getId();
CmmnSentryDeclaration sentryDeclaration = parent.getSentry(sentryId);
if (sentryDeclaration != null) {
activity.addEntryCriteria(sentryDeclaration);
}
}
}
}
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration in project camunda-bpm-platform by camunda.
the class ItemHandler method initializeExitCriterias.
protected void initializeExitCriterias(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
Collection<Sentry> exitCriterias = getExitCriterias(element);
if (!exitCriterias.isEmpty()) {
CmmnActivity parent = activity.getParent();
if (parent != null) {
for (Sentry sentry : exitCriterias) {
String sentryId = sentry.getId();
CmmnSentryDeclaration sentryDeclaration = parent.getSentry(sentryId);
if (sentryDeclaration != null) {
activity.addExitCriteria(sentryDeclaration);
}
}
}
}
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration in project camunda-bpm-platform by camunda.
the class SentryHandler method handleElement.
public CmmnSentryDeclaration handleElement(Sentry element, CmmnHandlerContext context) {
String id = element.getId();
Collection<OnPart> onParts = element.getOnParts();
IfPart ifPart = element.getIfPart();
List<CamundaVariableOnPart> variableOnParts = queryExtensionElementsByClass(element, CamundaVariableOnPart.class);
if ((ifPart == null || ifPart.getConditions().isEmpty()) && variableOnParts.isEmpty()) {
if (onParts == null || onParts.isEmpty()) {
LOG.ignoredSentryWithMissingCondition(id);
return null;
} else {
boolean atLeastOneOnPartsValid = false;
for (OnPart onPart : onParts) {
if (onPart instanceof PlanItemOnPart) {
PlanItemOnPart planItemOnPart = (PlanItemOnPart) onPart;
if (planItemOnPart.getSource() != null && planItemOnPart.getStandardEvent() != null) {
atLeastOneOnPartsValid = true;
break;
}
}
}
if (!atLeastOneOnPartsValid) {
LOG.ignoredSentryWithInvalidParts(id);
return null;
}
}
}
CmmnSentryDeclaration sentryDeclaration = new CmmnSentryDeclaration(id);
// the ifPart will be initialized immediately
initializeIfPart(ifPart, sentryDeclaration, context);
// the variableOnParts will be initialized immediately as it does not have any dependency
initializeVariableOnParts(element, sentryDeclaration, context, variableOnParts);
// ...whereas the onParts will be initialized later because the
// the reference to the plan items (sourceRef) and the reference
// to the sentry (sentryRef) cannot be set in this step. To set
// the corresponding reference (sourceRef or sentryRef) on the
// transformed sentry all planned items and all sentries inside
// the current stage should be already transformed.
CmmnActivity parent = context.getParent();
if (parent != null) {
parent.addSentry(sentryDeclaration);
}
return sentryDeclaration;
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration 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);
}
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration in project camunda-bpm-platform by camunda.
the class CmmnTransform method transformSentryOnParts.
protected void transformSentryOnParts(Stage stage) {
Collection<Sentry> sentries = stage.getSentrys();
if (sentries != null && !sentries.isEmpty()) {
SentryHandler handler = getSentryHandler();
for (Sentry sentry : sentries) {
handler.initializeOnParts(sentry, context);
// sentry fully transformed -> call transform listener
CmmnSentryDeclaration sentryDeclaration = context.getParent().getSentry(sentry.getId());
for (CmmnTransformListener transformListener : transformListeners) {
transformListener.transformSentry(sentry, sentryDeclaration);
}
}
}
}
Aggregations