Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
 public BaseTaskInstanceBuilder SetRepetitionRule(string name, CMMNExpression expression)
 {
     RepetitionRule = new RepetitionRule
     {
         Condition = expression,
         Name      = name
     };
     return(this);
 }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testRepetitionRuleByDefaultPlanItemControl()
        public virtual void testRepetitionRuleByDefaultPlanItemControl()
        {
            // given
            PlanItemControl     defaultControl = createElement(stage, "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
            object rule = newActivity.getProperty(PROPERTY_REPETITION_RULE);

            assertNotNull(rule);
            assertTrue(rule is CaseControlRule);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testRepetitionRuleCustomStandardEvents()
        public virtual void testRepetitionRuleCustomStandardEvents()
        {
            // given
            ItemControl         itemControl    = createElement(planItem, "ItemControl_1", typeof(ItemControl));
            RepetitionRule      repetitionRule = createElement(itemControl, "RepititionRule_1", typeof(RepetitionRule));
            ConditionExpression expression     = createElement(repetitionRule, "Expression_1", typeof(ConditionExpression));

            expression.Text = "${true}";

            repetitionRule.CamundaRepeatOnStandardEvent = [email protected]_Fields.DISABLE;

            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(1, events.Count);
            assertTrue(events.Contains([email protected]_Fields.DISABLE));
        }
Ejemplo n.º 6
0
        private static List <BaseCasePlanItemInstance> BuildPlanItems(tStage stage, string casePlanInstanceId)
        {
            var planItems = new List <BaseCasePlanItemInstance>();

            if (stage.planItem != null)
            {
                foreach (var planItem in stage.planItem)
                {
                    var planItemDef     = stage.Items.First(i => i.id == planItem.definitionRef);
                    var flowInstanceElt = BuildPlanItem(planItem.id, planItem.name, planItemDef, casePlanInstanceId);
                    if (planItem.entryCriterion != null)
                    {
                        foreach (var entryCriterion in planItem.entryCriterion)
                        {
                            var sEntry = stage.sentry.First(s => s.id == entryCriterion.sentryRef);
                            flowInstanceElt.EntryCriterions.Add(new Criteria(entryCriterion.name)
                            {
                                SEntry = BuildSEntry(sEntry)
                            });
                        }
                    }

                    if (planItem.exitCriterion != null)
                    {
                        foreach (var exitCriteria in planItem.exitCriterion)
                        {
                            var sEntry = stage.sentry.First(s => s.id == exitCriteria.sentryRef);
                            flowInstanceElt.ExitCriterions.Add(new Criteria(exitCriteria.name)
                            {
                                SEntry = BuildSEntry(sEntry)
                            });
                        }
                    }

                    if (planItem.itemControl != null)
                    {
                        var baseTask = flowInstanceElt as BaseTaskOrStageElementInstance;
                        if (planItem.itemControl.manualActivationRule != null && baseTask != null)
                        {
                            var manualActivationRule = new ManualActivationRule(planItem.itemControl.manualActivationRule.name);
                            var condition            = planItem.itemControl.manualActivationRule.condition;
                            if (condition != null && condition.Text.Any())
                            {
                                manualActivationRule.Expression = new CMMNExpression(condition.language, condition.Text.First());
                            }

                            baseTask.ManualActivationRule = manualActivationRule;
                        }

                        if (planItem.itemControl.repetitionRule != null)
                        {
                            var repetitionRule = new RepetitionRule(planItem.itemControl.repetitionRule.name);
                            var condition      = planItem.itemControl.repetitionRule.condition;
                            if (condition != null && condition.Text.Any())
                            {
                                repetitionRule.Condition = new CMMNExpression(condition.language, condition.Text.First());
                            }

                            flowInstanceElt.RepetitionRule = repetitionRule;
                        }
                    }

                    planItems.Add(flowInstanceElt);
                }
            }

            return(planItems);
        }
Ejemplo n.º 7
0
 public void RepetitionRule(RepetitionRule rule)
 {
     Rules.Add(rule);
 }
Ejemplo n.º 8
0
 public void RepetitionRule(RepetitionRule rule)
 {
     Rules.Add(rule);
 }