Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testSentryWithOnPart()
        public virtual void testSentryWithOnPart()
        {
            // given
            CmmnActivity casePlanModelActivity = (new CasePlanModelHandler()).handleElement(casePlanModel, context);

            context.Parent = casePlanModelActivity;

            CmmnSentryDeclaration sentryDeclaration = sentryHandler.handleElement(sentry, context);
            CmmnActivity          source            = taskItemHandler.handleElement(planItem, context);

            // when
            sentryHandler.initializeOnParts(sentry, context);

            // then
            assertNotNull(sentryDeclaration);

            IList <CmmnOnPartDeclaration> onParts = sentryDeclaration.OnParts;

            assertNotNull(onParts);
            assertFalse(onParts.Count == 0);
            assertEquals(1, onParts.Count);

            IList <CmmnOnPartDeclaration> onPartsAssociatedWithSource = sentryDeclaration.getOnParts(source.Id);

            assertNotNull(onPartsAssociatedWithSource);
            assertFalse(onPartsAssociatedWithSource.Count == 0);
            assertEquals(1, onParts.Count);

            CmmnOnPartDeclaration onPartDeclaration = onPartsAssociatedWithSource[0];

            assertNotNull(onPartDeclaration);
            // source
            assertEquals(source, onPartDeclaration.Source);
            assertEquals(onPart.Source.Id, onPartDeclaration.Source.Id);
            // standardEvent
            assertEquals(onPart.StandardEvent.name(), onPartDeclaration.StandardEvent);
            // sentry
            assertNull(onPartDeclaration.Sentry);

            assertNull(sentryDeclaration.IfPart);
        }
Exemple #2
0
        protected internal virtual void transformSentryOnParts(Stage stage)
        {
            ICollection <Sentry> sentries = stage.Sentrys;

            if (sentries != null && sentries.Count > 0)
            {
                SentryHandler handler = SentryHandler;
                foreach (Sentry sentry in sentries)
                {
                    handler.initializeOnParts(sentry, context);
                    // sentry fully transformed -> call transform listener
                    CmmnSentryDeclaration sentryDeclaration = context.Parent.getSentry(sentry.Id);
                    foreach (CmmnTransformListener transformListener in transformListeners)
                    {
                        transformListener.transformSentry(sentry, sentryDeclaration);
                    }
                }
            }
        }