Beispiel #1
0
 public TestAssignmentContext(ActorExpressionTest enclosingInstance, IOrganisationService organisationComponent)
 {
     orgComponent = organisationComponent;
     InitBlock(enclosingInstance);
     this.previousActor   = organisationComponent.FindActorById("ae");
     this.processInstance = new ProcessInstanceImpl();
     this.processInstance.InitiatorActorId = "pf";
     this.configuration                 = new Hashtable();
     this.attributes                    = new Hashtable();
     this.attributes["boss"]            = organisationComponent.FindActorById("cg");
     this.attributes["requester group"] = organisationComponent.FindGroupById("group-rd");
 }
Beispiel #2
0
        public Object ResolveArgumentPreviousActor(IActor resolvedActor, String[] parameters)
        {
            if (parameters.Length != 0)
            {
                throw new SystemException("argument previousActor expects exactly zero parameters instead of " + parameters.Length);
            }
            IActor actor = organizationService.FindActorById(PreviousActorId);

            if (actor == null)
            {
                throw new SystemException("argument previousActor could not be resolve because there is no previous actor");
            }
            return(actor);
        }
Beispiel #3
0
        public Object Deserialize(String text)
        {
            if (text == null)
            {
                return(null);
            }

            IActor actor = null;
            IOrganisationService organisationComponent = (IOrganisationService)serviceLocator.GetService(typeof(IOrganisationService));

            try
            {
                actor = organisationComponent.FindActorById(text);
                serviceLocator.Release(organisationComponent);
            }
            catch (Exception t)
            {
                throw new ArgumentException("couldn't deserialize " + text + " to a User : "******" : " + t.Message);
            }
            finally
            {
                serviceLocator.Release(organisationComponent);
            }

            return(actor);
        }
Beispiel #4
0
        public IProcessInstance StartProcessInstance(long processDefinitionId, IDictionary attributeValues = null, string transitionName = null, Relations relations = null)
        {
            ProcessInstanceImpl  processInstance     = null;
            IOrganisationService organisationService = null;

            using (ISession session = NHibernateHelper.OpenSession())
            {
                using (var tran = session.BeginTransaction())
                {
                    DbSession             dbSession         = new DbSession(session);
                    ProcessDefinitionImpl processDefinition = myProcessDefinitionService.GetProcessDefinition(processDefinitionId, dbSession);
                    processInstance = new ProcessInstanceImpl(ActorId, processDefinition);
                    processInstanceRepository.Save(processInstance, dbSession);//到這裏應該存了ProcessInstance,RootFlow

                    ExecutionContext executionContext = new ExecutionContext();
                    //logRepository.CreateLog();
                    processDefinition.StartState.CheckAccess(attributeValues);

                    attributeService = new AttributeService((FlowImpl)processInstance.RootFlow, dbSession);
                    attributeService.StoreAttributeValue(attributeValues);//儲存傳入的欄位值
                    attributeService.StoreRole(organisationService.FindActorById(ActorId), (ActivityStateImpl)processDefinition.StartState);

                    //flow的node推進到下一關卡
                    //flow的actor=解析出來的actor.Id
                    transitionService = new TransitionService(ActorId, dbSession);
                    TransitionImpl transitionTo = transitionService.GetTransition(transitionName, processDefinition.StartState, dbSession);
                    transitionService.ProcessTransition(transitionTo, (FlowImpl)processInstance.RootFlow, dbSession);

                    session.Flush();
                    tran.Commit();
                }
            }

            return(processInstance);
        }
Beispiel #5
0
        public IList GetTaskList(String actorId, Relations relations = null)
        {
            IList taskLists = null;
            IOrganisationService organisationComponent = null;

            try
            {
                using (ISession session = NHibernateHelper.OpenSession())
                {
                    DbSession dbSession = new DbSession(session);
                    IActor    actor     = organisationService.FindActorById(actorId);
                    taskLists = taskRepository.FindTasks(actorId, dbSession);
                }
            }
            finally
            {
                ServiceLocator.Instance.Release(organisationComponent);
            }
            return(taskLists);
        }
Beispiel #6
0
        //private const String queryFindTasks = "select flow " +
        //    "from flow in class NetBpm.Workflow.Execution.Impl.FlowImpl " +
        //    "where flow.ActorId = ?";

        public IList GetTaskList(String authenticatedActorId, String actorId, Relations relations, DbSession dbSession, IOrganisationService organisationComponent)
        {
            IList  tasks = null;
            IActor actor = organisationComponent.FindActorById(actorId);

            if (actor is IUser)
            {
                log.Debug("getting task lists for actor --> User : [" + actor + "]");
                tasks = taskRepository.FindTasks(actorId, dbSession);
            }
            else if (actor is IGroup)
            {
                log.Debug("getting task lists for actor --> Group : [" + actor + "]");
                tasks = GetGroupTaskList(authenticatedActorId, null, actorId, dbSession, organisationComponent);
            }

            if (relations != null)
            {
                relations.Resolve(tasks);
            }

            return(tasks);
        }
Beispiel #7
0
        public IActor GetActor(String actorId)
        {
            IActor actor = null;

            if ((Object)actorId != null)
            {
                IOrganisationService organisationComponent = null;
                try
                {
                    organisationComponent = (IOrganisationService)serviceLocator.GetService(typeof(IOrganisationService));
                    actor = organisationComponent.FindActorById(actorId);
                }
                catch (Exception t)
                {
                    throw new SystemException("couldn't get actor '" + actorId + "' from the organisation-component : " + t.Message);
                }
                finally
                {
                    serviceLocator.Release(organisationComponent);
                }
            }

            return(actor);
        }
Beispiel #8
0
 public virtual IActor GetPreviousActor()
 {
     return(_organisationComponent.FindActorById(_previousActorId));
 }
        //private const String queryFindTasks = "select flow " +
        //    "from flow in class NetBpm.Workflow.Execution.Impl.FlowImpl " +
        //    "where flow.ActorId = ?";
        public IList GetTaskList(String authenticatedActorId, String actorId, Relations relations, DbSession dbSession, IOrganisationService organisationComponent)
        {
            IList tasks = null;
            IActor actor = organisationComponent.FindActorById(actorId);

            if (actor is IUser)
            {
                log.Debug("getting task lists for actor --> User : [" + actor + "]");
                tasks = taskRepository.FindTasks(actorId, dbSession);
            }
            else if (actor is IGroup)
            {
                log.Debug("getting task lists for actor --> Group : [" + actor + "]");
                tasks = GetGroupTaskList(authenticatedActorId, null, actorId, dbSession, organisationComponent);
            }

            if (relations != null)
            {
                relations.Resolve(tasks);
            }

            return tasks;
        }
			public TestAssignmentContext(ActorExpressionTest enclosingInstance,IOrganisationService organisationComponent)
			{
				orgComponent = organisationComponent;
				InitBlock(enclosingInstance);
				this.previousActor = organisationComponent.FindActorById("ae");
				this.processInstance = new ProcessInstanceImpl();
				this.processInstance.InitiatorActorId = "pf";
				this.configuration = new Hashtable();
				this.attributes = new Hashtable();
				this.attributes["boss"] = organisationComponent.FindActorById("cg");
				this.attributes["requester group"] = organisationComponent.FindGroupById("group-rd");
			}
Beispiel #11
0
        public void TestFindActorById()
        {
            IActor actor = orgComp.FindActorById("ae");

            Assert.AreEqual("Albert Einstein", actor.Name);
        }