示例#1
0
        private void GetStateAndAttributes(IList state, IList attributeRows, String indentation, IFlow flow)
        {
            // add the flow to the state
            IEnumerator iter = flow.Children.GetEnumerator();

            while (iter.MoveNext())
            {
                state.Add(iter.Current);
            }

            // add the flow-name to the attributeRows
            System.Collections.IDictionary row = new System.Collections.Hashtable();
            if (flow.IsRootFlow())
            {
                row["name"] = indentation + "rootflow <b>[</b>" + flow.Name + "<b>]</b>";
            }
            else
            {
                row["name"] = indentation + "subflow <b>[</b>" + flow.Name + "<b>]</b>";
            }
            row["value"] = "";
            attributeRows.Add(row);

            // add the flow-local attributes to the attributeRows
            iter = flow.AttributeInstances.GetEnumerator();
            while (iter.MoveNext())
            {
                IAttributeInstance attributeInstance = (IAttributeInstance)iter.Current;
                row = new Hashtable();

                log.Debug("adding attribute instance value " + attributeInstance.GetValue());
                row["name"] = indentation + "&nbsp;&nbsp;&nbsp;+-&nbsp;<b>[</b>" +
                              attributeInstance.Attribute.Name + "<b>]</b>";
                row["value"] = attributeInstance.GetValue();
                attributeRows.Add(row);
            }

            // recursively descend to the children
            iter = flow.Children.GetEnumerator();
            while (iter.MoveNext())
            {
                GetStateAndAttributes(state, attributeRows, indentation + "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;", (IFlow)iter.Current);
            }

            IProcessInstance processInstance = flow.GetSubProcessInstance();

            if (processInstance != null)
            {
                state.Add(processInstance.RootFlow);
                GetStateAndAttributes(state, attributeRows, indentation + "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;", processInstance.RootFlow);
            }
        }
示例#2
0
        public void  CheckDelegateActivity(String authenticatedActorId, Int64 flowId, String delegateActorId)
        {
            //only director can delegate an activity
            IExecutionApplicationService executionComponent = (IExecutionApplicationService)serviceLocator.GetService(typeof(IExecutionApplicationService));

            try
            {
                IFlow  flow     = executionComponent.GetFlow(flowId, new Relations("attributeInstances"));
                IActor director = null;

                ISet attributeInstances = flow.AttributeInstances;
                for (IEnumerator iter = attributeInstances.GetEnumerator(); iter.MoveNext();)
                {
                    IAttributeInstance attributeInstance = (IAttributeInstance)iter.Current;
                    if ("director".Equals(attributeInstance.Attribute.Name))
                    {
                        director = (IActor)attributeInstance.GetValue();
                    }
                }

                if (director.Id.Equals(authenticatedActorId) == false)
                {
                    throw new AuthorizationException("Only director is allowed to delegate activity");
                }
            }
            catch (AuthorizationException e)
            {
                throw e;
            }
            catch (System.Exception e)
            {
                log.Error("failed doing authorization : ", e);
                throw new System.SystemException("failed doing authorization : " + e.Message);
            }
            finally
            {
                serviceLocator.Release(executionComponent);
            }
        }
示例#3
0
        private void WriterAttributes(IFlow flow, StreamWriter xmlwriter)
        {
            //NHibernate.LazyInitializationException: Failed to lazily initialize a collection - no session
            IEnumerator iter = flow.AttributeInstances.GetEnumerator();

            while (iter.MoveNext())
            {
                IAttributeInstance attributeInstance = (IAttributeInstance)iter.Current;
                xmlwriter.WriteLine("		<attribute type=\"AT_UDA_12_"+ attributeInstance.Attribute.Name + "\">" + attributeInstance.GetValue() + "</attribute>");
            }

            // recursively descend to the children
            iter = flow.Children.GetEnumerator();
            while (iter.MoveNext())
            {
                WriterAttributes((IFlow)iter.Current, xmlwriter);
            }
        }