public void TestFindGroupById() { IGroup group = orgComp.FindGroupById("group-rd", new Relations("memberships")); Assert.AreEqual("Research & Development", group.Name); Assert.AreEqual(6, group.Memberships.Count); }
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"); }
public Object ResolveArgumentGroup(IActor resolvedActor, String[] parameters) { if (resolvedActor == null) { if (parameters.Length != 1) { throw new SystemException("argument group expects exactly one parameter instead of " + parameters.Length); } String groupId = parameters[0]; IGroup group = null; try { group = organizationService.FindGroupById(groupId); } catch (OrganisationRuntimeException e) { throw new SystemException("can't resolve group-argument with parameter " + groupId + " : " + e.Message); } return(group); } else { if (parameters.Length != 1) { throw new SystemException("argument group expects exactly one parameter (membership-type) instead of " + parameters.Length); } IUser user = null; IGroup group = null; String membershipType = parameters[0]; try { group = organizationService.FindGroupByMembership(resolvedActor.Id, membershipType); } catch (InvalidCastException e) { throw new SystemException("can't resolve group-argument : a group must be calculated from a User, not a " + resolvedActor.GetType().FullName, e); } catch (OrganisationRuntimeException e) { throw new SystemException("can't resolve group-argument : can't find the hierarchy-memberschip of User " + user.Id + " and membership-type " + membershipType + " : " + e.Message, e); } return(group); } }
public IGroup GetGroup(String groupId) { IGroup group = null; IOrganisationService organisationComponent = null; try { organisationComponent = (IOrganisationService)serviceLocator.GetService(typeof(IOrganisationService)); group = organisationComponent.FindGroupById(groupId); } catch (Exception t) { throw new SystemException("couldn't get group '" + groupId + "' from the organisation-component : " + t.Message); } finally { serviceLocator.Release(organisationComponent); } return(group); }
private IList GetGroupTaskList(String authenticatedActorId, ArrayList groupTaskLists, String groupId, DbSession dbSession, IOrganisationService organisationComponent) { if (groupTaskLists == null) { groupTaskLists = new ArrayList(); } IGroup g = organisationComponent.FindGroupById(groupId, new Relations("parent")); IGroup gParent = g.Parent; if (gParent != null) { // scan if this group has more parent(s) GetGroupTaskList(authenticatedActorId, groupTaskLists, gParent.Id, dbSession, organisationComponent); } // no more parent IList gTaskLists = taskRepository.FindTasks(g.Id, dbSession); groupTaskLists.AddRange(gTaskLists); log.Debug("added task lists [" + gTaskLists + "] for group [" + g + "]"); return(groupTaskLists); }
private IList GetGroupTaskList(String authenticatedActorId, ArrayList groupTaskLists, String groupId, DbSession dbSession, IOrganisationService organisationComponent) { if (groupTaskLists == null) { groupTaskLists = new ArrayList(); } IGroup g = organisationComponent.FindGroupById(groupId, new Relations("parent")); IGroup gParent = g.Parent; if (gParent != null) { // scan if this group has more parent(s) GetGroupTaskList(authenticatedActorId, groupTaskLists, gParent.Id, dbSession, organisationComponent); } // no more parent IList gTaskLists = taskRepository.FindTasks(g.Id, dbSession); groupTaskLists.AddRange(gTaskLists); log.Debug("added task lists [" + gTaskLists + "] for group [" + g + "]"); return groupTaskLists; }
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"); }