@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); }
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); } }
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()); } }
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; }
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; }
public String getParticpantsWithRoleAsXML(String roleName) { String result = "<participants/>"; if (roleName != null) { Role r = getRoleByName(roleName); if (r != null) { result = getRoleParticipantsAsXML(r.getID()); } } return result; }
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; }
@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; }
public boolean isKnownRole(Role r) { return isKnownRole(r.getID()); }
public void delRole(Role r) { roleMap.remove(r.getID()); setChangeStamp(ResUnit.Role); }
public void putRole(Role r) { roleMap.put(r.getID(), r); setChangeStamp(ResUnit.Role); }