Пример #1
0
        protected internal virtual void initializeRepetitionRule(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context)
        {
            PlanItemControl itemControl    = getItemControl(element);
            PlanItemControl defaultControl = getDefaultControl(element);

            RepetitionRule repetitionRule = null;

            if (itemControl != null)
            {
                repetitionRule = itemControl.RepetitionRule;
            }
            if (repetitionRule == null && defaultControl != null)
            {
                repetitionRule = defaultControl.RepetitionRule;
            }

            if (repetitionRule != null)
            {
                ConditionExpression condition = repetitionRule.Condition;
                CaseControlRule     caseRule  = initializeCaseControlRule(condition, context);
                activity.setProperty(PROPERTY_REPETITION_RULE, caseRule);

                IList <string> events = Arrays.asList(TERMINATE, COMPLETE);
                string         repeatOnStandardEvent = repetitionRule.CamundaRepeatOnStandardEvent;
                if (!string.ReferenceEquals(repeatOnStandardEvent, null) && repeatOnStandardEvent.Length > 0)
                {
                    events = Arrays.asList(repeatOnStandardEvent);
                }
                activity.Properties.set(CmmnProperties.REPEAT_ON_STANDARD_EVENTS, events);
            }
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testRequiredRuleByDefaultPlanItemControl()
        public virtual void testRequiredRuleByDefaultPlanItemControl()
        {
            // given
            PlanItemControl     defaultControl = createElement(decisionTask, "ItemControl_1", typeof(DefaultControl));
            RequiredRule        requiredRule   = createElement(defaultControl, "RequiredRule_1", typeof(RequiredRule));
            ConditionExpression expression     = createElement(requiredRule, "Expression_1", typeof(ConditionExpression));

            expression.Text = "${true}";

            Cmmn.validateModel(modelInstance);

            // when
            CmmnActivity newActivity = handler.handleElement(planItem, context);

            // then
            object rule = newActivity.getProperty(PROPERTY_REQUIRED_RULE);

            assertNotNull(rule);
            assertTrue(rule is CaseControlRule);
        }
Пример #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testManualActivationRuleByDefaultPlanItemControl()
        public virtual void testManualActivationRuleByDefaultPlanItemControl()
        {
            // given
            PlanItemControl      defaultControl       = createElement(stage, "ItemControl_1", typeof(DefaultControl));
            ManualActivationRule manualActivationRule = createElement(defaultControl, "ManualActivationRule_1", typeof(ManualActivationRule));
            ConditionExpression  expression           = createElement(manualActivationRule, "Expression_1", typeof(ConditionExpression));

            expression.Text = "${true}";

            Cmmn.validateModel(modelInstance);

            // when
            CmmnActivity newActivity = handler.handleElement(planItem, context);

            // then
            object rule = newActivity.getProperty(PROPERTY_MANUAL_ACTIVATION_RULE);

            assertNotNull(rule);
            assertTrue(rule is CaseControlRule);
        }
Пример #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testRepetitionRuleStandardEventsByDefaultPlanItemControl()
        public virtual void testRepetitionRuleStandardEventsByDefaultPlanItemControl()
        {
            // given
            PlanItemControl     defaultControl = createElement(decisionTask, "DefaultControl_1", typeof(DefaultControl));
            RepetitionRule      repetitionRule = createElement(defaultControl, "RepititionRule_1", typeof(RepetitionRule));
            ConditionExpression expression     = createElement(repetitionRule, "Expression_1", typeof(ConditionExpression));

            expression.Text = "${true}";

            Cmmn.validateModel(modelInstance);

            // when
            CmmnActivity newActivity = handler.handleElement(planItem, context);

            // then
            IList <string> events = newActivity.Properties.get(CmmnProperties.REPEAT_ON_STANDARD_EVENTS);

            assertNotNull(events);
            assertEquals(2, events.Count);
            assertTrue(events.Contains([email protected]_Fields.COMPLETE));
            assertTrue(events.Contains([email protected]_Fields.TERMINATE));
        }
Пример #5
0
        protected internal virtual void initializeManualActivationRule(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context)
        {
            PlanItemControl itemControl    = getItemControl(element);
            PlanItemControl defaultControl = getDefaultControl(element);

            ManualActivationRule manualActivationRule = null;

            if (itemControl != null)
            {
                manualActivationRule = itemControl.ManualActivationRule;
            }
            if (manualActivationRule == null && defaultControl != null)
            {
                manualActivationRule = defaultControl.ManualActivationRule;
            }

            if (manualActivationRule != null)
            {
                CaseControlRule caseRule = initializeCaseControlRule(manualActivationRule.Condition, context);
                activity.setProperty(PROPERTY_MANUAL_ACTIVATION_RULE, caseRule);
            }
        }
Пример #6
0
        protected internal virtual void initializeRequiredRule(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context)
        {
            PlanItemControl itemControl    = getItemControl(element);
            PlanItemControl defaultControl = getDefaultControl(element);

            RequiredRule requiredRule = null;

            if (itemControl != null)
            {
                requiredRule = itemControl.RequiredRule;
            }
            if (requiredRule == null && defaultControl != null)
            {
                requiredRule = defaultControl.RequiredRule;
            }

            if (requiredRule != null)
            {
                CaseControlRule caseRule = initializeCaseControlRule(requiredRule.Condition, context);
                activity.setProperty(PROPERTY_REQUIRED_RULE, caseRule);
            }
        }