Search in sources :

Example 1 with CmmnActivity

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity 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);
                }
            }
        }
    }
}
Also used : CmmnSentryDeclaration(org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration) Sentry(org.camunda.bpm.model.cmmn.instance.Sentry) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) CamundaString(org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)

Example 2 with CmmnActivity

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity 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);
                }
            }
        }
    }
}
Also used : CmmnSentryDeclaration(org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration) Sentry(org.camunda.bpm.model.cmmn.instance.Sentry) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) CamundaString(org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)

Example 3 with CmmnActivity

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.

the class ItemHandler method handleElement.

public CmmnActivity handleElement(CmmnElement element, CmmnHandlerContext context) {
    // create a new activity
    CmmnActivity newActivity = createActivity(element, context);
    // initialize activity
    initializeActivity(element, newActivity, context);
    return newActivity;
}
Also used : CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)

Example 4 with CmmnActivity

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity 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;
}
Also used : CamundaVariableOnPart(org.camunda.bpm.model.cmmn.instance.camunda.CamundaVariableOnPart) PlanItemOnPart(org.camunda.bpm.model.cmmn.instance.PlanItemOnPart) OnPart(org.camunda.bpm.model.cmmn.instance.OnPart) CaseFileItemOnPart(org.camunda.bpm.model.cmmn.instance.CaseFileItemOnPart) PlanItemOnPart(org.camunda.bpm.model.cmmn.instance.PlanItemOnPart) CmmnSentryDeclaration(org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration) IfPart(org.camunda.bpm.model.cmmn.instance.IfPart) CamundaVariableOnPart(org.camunda.bpm.model.cmmn.instance.camunda.CamundaVariableOnPart) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)

Example 5 with CmmnActivity

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity 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);
    }
}
Also used : CmmnSentryDeclaration(org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration) PlanItem(org.camunda.bpm.model.cmmn.instance.PlanItem) CmmnOnPartDeclaration(org.camunda.bpm.engine.impl.cmmn.model.CmmnOnPartDeclaration) Sentry(org.camunda.bpm.model.cmmn.instance.Sentry) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) PlanItemTransition(org.camunda.bpm.model.cmmn.PlanItemTransition)

Aggregations

CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)325 Test (org.junit.Test)298 ConditionExpression (org.camunda.bpm.model.cmmn.instance.ConditionExpression)112 PlanItemControl (org.camunda.bpm.model.cmmn.instance.PlanItemControl)64 CaseControlRule (org.camunda.bpm.engine.impl.cmmn.CaseControlRule)47 CmmnSentryDeclaration (org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration)47 ExtensionElements (org.camunda.bpm.model.cmmn.instance.ExtensionElements)39 Sentry (org.camunda.bpm.model.cmmn.instance.Sentry)39 IfPart (org.camunda.bpm.model.cmmn.instance.IfPart)37 CasePlanModelHandler (org.camunda.bpm.engine.impl.cmmn.handler.CasePlanModelHandler)36 SentryHandler (org.camunda.bpm.engine.impl.cmmn.handler.SentryHandler)35 CallableElement (org.camunda.bpm.engine.impl.core.model.CallableElement)34 ItemControl (org.camunda.bpm.model.cmmn.instance.ItemControl)32 HumanTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.HumanTaskActivityBehavior)29 RepetitionRule (org.camunda.bpm.model.cmmn.instance.RepetitionRule)28 ParameterValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider)26 TaskDefinition (org.camunda.bpm.engine.impl.task.TaskDefinition)23 Body (org.camunda.bpm.model.cmmn.instance.Body)23 EntryCriterion (org.camunda.bpm.model.cmmn.instance.EntryCriterion)21 ExitCriterion (org.camunda.bpm.model.cmmn.instance.ExitCriterion)21