示例#1
0
        public void RunActionsForEvent(EventType eventType, long definitionObjectId, ExecutionContextImpl executionContext, DbSession dbSession)
        {
            log.Debug("processing '" + eventType + "' events for executionContext " + executionContext);

            // find all actions for definitionObject on the given eventType
            Object[] values = new Object[] { eventType, definitionObjectId };
            IType[]  types  = new IType[] { DbType.INTEGER, DbType.LONG };

            IList       actions = dbSession.Find(queryFindActionsByEventType, values, types);
            IEnumerator iter    = actions.GetEnumerator();

            log.Debug("list" + actions);
            while (iter.MoveNext())
            {
                ActionImpl action = (ActionImpl)iter.Current;
                log.Debug("action: " + action);
                delegationHelper.DelegateAction(action.ActionDelegation, executionContext);
            }
            log.Debug("ende runActionsForEvent!");
        }
示例#2
0
        public void TestDelegateAction()
        {
            DelegationHelper delegationHelper = new DelegationHelper();

            DelegationDef delegationDef = new DelegationDef();

            delegationDef.ClassName     = "ActionTest";
            delegationDef.Configuration = "<cfg>" +
                                          "<parameter name = \"to\" > previousActor </parameter>" +
                                          "<parameter name = \"subject\" > you requested a holiday </parameter>" +
                                          "<parameter name = \"message\" > you requested a holiday from ${ start date}" +
                                          "to ${ end date}" +
                                          "with comment ${ comment}</parameter>" +
                                          "</cfg> ";
            ExecutionContext context = new ExecutionContext(null, null, null);

            delegationHelper.DelegateAction(delegationDef, context);

            Assert.IsTrue(context.Configuration.ContainsKey("test"));
            Assert.AreEqual("1234", context.Configuration["test"]);
        }