Search in sources :

Example 1 with PlanItemTransition

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);
    }
}
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)1 CmmnOnPartDeclaration (org.camunda.bpm.engine.impl.cmmn.model.CmmnOnPartDeclaration)1 CmmnSentryDeclaration (org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration)1 PlanItemTransition (org.camunda.bpm.model.cmmn.PlanItemTransition)1 PlanItem (org.camunda.bpm.model.cmmn.instance.PlanItem)1 Sentry (org.camunda.bpm.model.cmmn.instance.Sentry)1