예제 #1
0
 public Map<String, String> getOrgGroupIdentifiers() {
   Map<String, String> idMap = new Hashtable<String, String>();
   for (OrgGroup o : getOrgGroups()) {
     idMap.put(o.getID(), o.getGroupName());
   }
   return idMap;
 }
예제 #2
0
 public Set<Participant> resolveParticipantsFromResourceName(String anyName) {
   Set<Participant> pSet = new HashSet<Participant>();
   Participant p = getParticipantFromUserID(anyName);
   if (p != null) {
     pSet.add(p);
     return pSet;
   }
   Role r = getRoleByName(anyName);
   if (r != null) {
     pSet.addAll(getRoleParticipants(r.getID()));
     return pSet;
   }
   Position pos = getPositionByLabel(anyName);
   if (pos != null) {
     pSet.addAll(getPositionParticipants(pos.getID()));
     return pSet;
   }
   OrgGroup o = getOrgGroupByLabel(anyName);
   if (o != null) {
     pSet.addAll(getOrgGroupParticipants(o.getID()));
     return pSet;
   }
   Capability c = getCapabilityByLabel(anyName);
   if (c != null) {
     pSet.addAll(getCapabilityParticipants(c.getID()));
   }
   return pSet;
 }
예제 #3
0
 public OrgGroup getOrgGroupByLabel(String label) {
   for (OrgGroup o : orgGroupMap.values()) {
     if (o.getGroupName().equals(label)) {
       return o;
     }
   }
   return null;
 }
예제 #4
0
  public String getOrgGroupsAsXML() {
    ArrayList<OrgGroup> oList = new ArrayList<OrgGroup>(orgGroupMap.values());
    Collections.sort(oList);

    StringBuilder xml = new StringBuilder("<orggroups>");
    for (OrgGroup o : oList) xml.append(o.toXML());
    xml.append("</orggroups>");
    return xml.toString();
  }
예제 #5
0
 public String addOrgGroup(OrgGroup o) {
   if (isDataEditable(ResUnit.OrgGroup)) {
     String newID = getDataSource(ResUnit.OrgGroup).insert(o); // persist it
     if (!hasDefaultDataSource(ResUnit.OrgGroup)) o.setID(newID);
     putOrgGroup(o); // ...and add it to the data set
     return newID;
   } else return fail("External OrgGroup dataset is read-only");
 }
예제 #6
0
  public synchronized void removeOrgGroup(OrgGroup o) {
    if (isDataEditable(ResUnit.OrgGroup)) {
      for (Position position : getPositions()) {
        OrgGroup group = position.getOrgGroup();
        if ((group != null) && group.getID().equals(o.getID())) {
          position.setOrgGroup((OrgGroup) null);
          getDataSource(ResUnit.Position).update(position);
        }
      }

      for (OrgGroup group : getOrgGroups()) {
        OrgGroup owner = group.getBelongsTo();
        if ((owner != null) && owner.getID().equals(o.getID())) {
          group.setBelongsTo((OrgGroup) null);
          getDataSource(ResUnit.OrgGroup).update(group);
        }
      }
      delOrgGroup(o);
      getDataSource(ResUnit.OrgGroup).delete(o);
    }
  }
예제 #7
0
 public String checkCyclicOrgGroupReference(OrgGroup orgGroup, String refID) {
   String result = null;
   List<String> hierarchy = new ArrayList<String>();
   hierarchy.add(orgGroup.getGroupName());
   OrgGroup owner = getOrgGroup(refID);
   String refName = owner.getGroupName(); // name of group attempting to add to
   while (owner != null) {
     hierarchy.add(owner.getGroupName());
     if (owner.equals(orgGroup)) {
       result = constructCyclicAttributeErrorMessage(hierarchy, "org group", refName);
       break;
     }
     owner = owner.getBelongsTo();
   }
   return result;
 }
예제 #8
0
 public void delOrgGroup(OrgGroup o) {
   orgGroupMap.remove(o.getID());
   setChangeStamp(ResUnit.OrgGroup);
 }
예제 #9
0
 public void putOrgGroup(OrgGroup o) {
   orgGroupMap.put(o.getID(), o);
   setChangeStamp(ResUnit.OrgGroup);
 }