Пример #1
0
        private SOARolePropertyRowCollection MergeExternalMatrix(SOARolePropertyRowCollection matrixRows, IEnumerable <SOARolePropertiesQueryParam> queryParams)
        {
            if (this.ExternalMatrixID.IsNotEmpty())
            {
                IWfMatrixContainer externalMatrix = this.GetExternalMatrix();

                SOARoleContext.DoNewContextAction(externalMatrix.PropertyDefinitions, this.ProcessInstance, (context) =>
                {
                    if (externalMatrix.PropertyDefinitions.MatrixType == WfMatrixType.ApprovalMatrix)
                    {
                        SOARolePropertyRowCollection approvalRows = externalMatrix.Rows.QueryWithoutCondition(context.QueryParams, true);

                        matrixRows.SortActivitySN();
                        matrixRows.MergeApprovalMatrix(this.PropertyDefinitions, approvalRows, externalMatrix.PropertyDefinitions);
                    }
                    else
                    {
                        SOARolePropertyRowCollection approvalRows = externalMatrix.Rows.QueryWithoutCondition(context.QueryParams, false);

                        matrixRows.SortActivitySN();
                        matrixRows.MergeActivityMatrix(this.PropertyDefinitions, approvalRows, externalMatrix.PropertyDefinitions);
                    }
                });

                matrixRows = matrixRows.FilterByConditionColumn();
            }

            return(matrixRows);
        }
        public void Fill(WfCreateActivityParamCollection capc, PropertyDefineCollection definedProperties)
        {
            definedProperties.NullCheck("definedProperties");

            if (this._Role != null)
            {
                SOARoleContext.DoAction(this._Role, this.ProcessInstance, (context) =>
                                        ((SOARole)(this._Role)).FillCreateActivityParams(capc, definedProperties)
                                        );
            }
        }
Пример #3
0
        public void AllReservedColumnsActivityMatrixQueryParamTest()
        {
            IWfProcessDescriptor processDesp = ProcessHelper.GetDynamicProcessDesp(ActivityMatrixHelper.PrepareReservedActivityMatrixResourceDescriptor());

            IWfProcess process = ProcessHelper.StartupProcess(processDesp, new Dictionary <string, object>());

            IWfActivityDescriptor normalActDesp         = processDesp.Activities["NormalActivity"];
            WfActivityMatrixResourceDescriptor resource = (WfActivityMatrixResourceDescriptor)normalActDesp.Resources[0];

            SOARoleContext context = SOARoleContext.CreateContext(resource.PropertyDefinitions, process);

            context.QueryParams.Output();
        }
Пример #4
0
 protected internal override void FillUsers(OguDataCollection <IUser> users)
 {
     if (this._Role != null)
     {
         SOARoleContext.DoAction(this._Role, this.ProcessInstance, (context) =>
         {
             foreach (IOguObject obj in this._Role.ObjectsInRole)
             {
                 FillObjectToUsers(users, obj);
             }
         });
     }
 }
Пример #5
0
        public void Fill(WfCreateActivityParamCollection capc, PropertyDefineCollection definedProperties)
        {
            SOARoleContext.DoAction(this.PropertyDefinitions, this.ProcessInstance, (context) =>
            {
                SOARolePropertyRowCollection matchedRows = this.Rows.QueryWithoutCondition(context.QueryParams);

                matchedRows = matchedRows.ExtractMatrixRows();

                matchedRows = this.MergeExternalMatrix(matchedRows, context.QueryParams);

                matchedRows = matchedRows.FilterByConditionColumn();

                matchedRows.FillCreateActivityParams(capc, this.PropertyDefinitions, definedProperties);
            });
        }
Пример #6
0
        public void DoCurrentRoleAction(IWfProcess process, Action <SOARole, string> action)
        {
            if (action != null)
            {
                string auCodeName = GetCurrentAdministrativeUnitCodeName(process);

                SOARole role = this.GetSOARole(auCodeName);

                if (role != null)
                {
                    SOARoleContext.DoAction(role, process, (context) =>
                                            action(role, auCodeName)
                                            );
                }
            }
        }
Пример #7
0
        public void ActivityMatrixQueryParamMismatchProcessTest()
        {
            IWfProcessDescriptor processDesp = ProcessHelper.GetDynamicProcessDesp();

            IWfProcess process = ProcessHelper.StartupProcess(processDesp, new Dictionary <string, object>());

            IWfActivityDescriptor normalActDesp         = processDesp.Activities["NormalActivity"];
            WfActivityMatrixResourceDescriptor resource = (WfActivityMatrixResourceDescriptor)normalActDesp.Resources[0];

            SOARoleContext context = SOARoleContext.CreateContext(resource.PropertyDefinitions, process);

            context.QueryParams.Output();

            Assert.AreEqual(3, context.QueryParams.Count);
            Assert.IsNull(context.QueryParams[0].QueryValue);
            Assert.IsNull(context.QueryParams[1].QueryValue);
            Assert.IsNull(context.QueryParams[2].QueryValue);
        }
        private static SOARoleContext PrepareRoleContext(IRole role, object callerContext)
        {
            SOARoleContext result = null;

            if (callerContext is WfConditionDescriptor)
            {
                WfConditionDescriptor condition = (WfConditionDescriptor)callerContext;
                IWfProcess            process   = null;

                if (condition.Owner != null)
                {
                    process = condition.Owner.ProcessInstance;
                }

                result = SOARoleContext.CreateContext(role, process);
            }

            return(result);
        }
        private static bool IsInSOARole(IUser user, IRole role, object callerContext)
        {
            bool result = false;

            SOARoleContext context = PrepareRoleContext(role, callerContext);

            try
            {
                result = role.ObjectsInRole.Contains(user, new OguObjectIDEqualityComparer <IOguObject>());
            }
            finally
            {
                if (context != null)
                {
                    context.Dispose();
                }
            }

            return(result);
        }
Пример #10
0
        public void ApprovalMatrixQueryParamMismatchProcessTest()
        {
            WfApprovalMatrix approvalMatrix = ApprovalMatrixHelper.PrepareApprovalMatrix();

            WfApprovalMatrixAdapter.Instance.Update(approvalMatrix);

            IWfProcessDescriptor processDesp = ProcessHelper.GetDynamicProcessDesp(approvalMatrix.ID);

            IWfProcess process = ProcessHelper.StartupProcess(processDesp, new Dictionary <string, object>()
            {
                { "PayMethod", "1" },
                { "Age", 30 }
            });

            SOARoleContext context = SOARoleContext.CreateContext(approvalMatrix.PropertyDefinitions, process);

            context.QueryParams.Output();

            Assert.AreEqual(1, context.QueryParams.Count);
            Assert.IsNull(context.QueryParams[0].QueryValue);
        }
Пример #11
0
        protected internal override void FillUsers(OguDataCollection <IUser> users)
        {
            SOARoleContext.DoAction(this.PropertyDefinitions, this.ProcessInstance, (context) =>
            {
                SOARolePropertyRowCollection matchedRows = this.Rows.QueryWithoutCondition(context.QueryParams);

                matchedRows = matchedRows.ExtractMatrixRows();

                matchedRows = this.MergeExternalMatrix(matchedRows, context.QueryParams);

                matchedRows = matchedRows.FilterByConditionColumn();

                foreach (SOARolePropertyRowUsers rowUsers in matchedRows.GenerateRowsUsers())
                {
                    foreach (IUser user in rowUsers.Users)
                    {
                        if (users.Contains(user) == false)
                        {
                            users.Add(user);
                        }
                    }
                }
            });
        }
        protected internal override void FillUsers(OguDataCollection <IUser> users)
        {
            if (this._Role != null)
            {
                bool includeMatrixUsers = ServiceBrokerContext.Current.Context.GetValue("includeMatrixUsers", true);

                try
                {
                    ServiceBrokerContext.Current.Context["includeMatrixUsers"] = false;

                    SOARoleContext.DoAction(this._Role, this.ProcessInstance, (context) =>
                    {
                        foreach (IOguObject obj in this._Role.ObjectsInRole)
                        {
                            FillObjectToUsers(users, obj);
                        }
                    });
                }
                finally
                {
                    ServiceBrokerContext.Current.Context["includeMatrixUsers"] = includeMatrixUsers;
                }
            }
        }