예제 #1
0
 @Override
 public Role createRole(String name) {
   int maxId = 0;
   for (Role role : myRoles) {
     if (role.getID() > maxId) {
       maxId = role.getID();
     }
   }
   return createRole(name, maxId + 1);
 }
예제 #2
0
 public synchronized void removeRole(Role r) {
   if (isDataEditable(ResUnit.Role)) {
     disconnectResources(r);
     for (Role role : getRoles()) {
       Role owner = role.getOwnerRole();
       if ((owner != null) && owner.getID().equals(r.getID())) {
         role.setOwnerRole((Role) null);
         getDataSource(ResUnit.Role).update(role);
       }
     }
     delRole(r);
     getDataSource(ResUnit.Role).delete(r);
   }
 }
예제 #3
0
 void importData(RoleSet original) {
   Role[] originalRoles = original.getRoles();
   for (int i = 0; i < originalRoles.length; i++) {
     Role nextRole = originalRoles[i];
     createRole(nextRole.getName(), nextRole.getID());
   }
 }
예제 #4
0
 public Map<String, String> getRoleIdentifiers() {
   Map<String, String> idMap = new Hashtable<String, String>();
   for (Role r : getRoles()) {
     idMap.put(r.getID(), r.getName());
   }
   return idMap;
 }
예제 #5
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;
 }
예제 #6
0
 public String getParticpantsWithRoleAsXML(String roleName) {
   String result = "<participants/>";
   if (roleName != null) {
     Role r = getRoleByName(roleName);
     if (r != null) {
       result = getRoleParticipantsAsXML(r.getID());
     }
   }
   return result;
 }
예제 #7
0
 public Set<Participant> getParticipantsWithRole(String roleName) {
   Set<Participant> result = null;
   if (roleName != null) {
     Role r = getRoleByName(roleName);
     if (r != null) {
       result = getRoleParticipants(r.getID());
     }
   }
   return result;
 }
예제 #8
0
 @Override
 public Role findRole(int roleID) {
   Role result = null;
   for (int i = 0; i < myRoles.size(); i++) {
     Role next = myRoles.get(i);
     if (next.getID() == roleID) {
       result = next;
       break;
     }
   }
   return result;
 }
예제 #9
0
 public boolean isKnownRole(Role r) {
   return isKnownRole(r.getID());
 }
예제 #10
0
 public void delRole(Role r) {
   roleMap.remove(r.getID());
   setChangeStamp(ResUnit.Role);
 }
예제 #11
0
 public void putRole(Role r) {
   roleMap.put(r.getID(), r);
   setChangeStamp(ResUnit.Role);
 }