public Map<String, String> getCapabilityIdentifiers() { Map<String, String> idMap = new Hashtable<String, String>(); for (Capability c : getCapabilities()) { idMap.put(c.getID(), c.getCapability()); } 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 Capability getCapabilityByLabel(String label) { for (Capability c : capabilityMap.values()) { if (c.getCapability().equals(label)) { return c; } } return null; }
public String getCapabilitiesAsXML() { ArrayList<Capability> cList = new ArrayList<Capability>(capabilityMap.values()); Collections.sort(cList); StringBuilder xml = new StringBuilder("<capabilities>"); for (Capability c : cList) xml.append(c.toXML()); xml.append("</capabilities>"); return xml.toString(); }
public String getParticpantsWithCapabilityAsXML(String capabilityName) { String result = "<participants/>"; if (capabilityName != null) { Capability c = getCapabilityByLabel(capabilityName); if (c != null) { result = getCapabilityParticipantsAsXML(c.getID()); } } return result; }
public String getParticipantCapabilitiesAsXML(String pid) { Set<Capability> capSet = getParticipantCapabilities(pid); if (capSet != null) { String header = String.format("<capabilities participantid=\"%s\">", pid); StringBuilder xml = new StringBuilder(header); for (Capability c : capSet) xml.append(c.toXML()); xml.append("</capabilities>"); return xml.toString(); } else return ("<capabilities/>"); }
public Set<Participant> getParticipantsWithCapability(String capabilityName) { Set<Participant> result = null; if (capabilityName != null) { Capability c = getCapabilityByLabel(capabilityName); if (c != null) { result = getCapabilityParticipants(c.getID()); } } return result; }
public String addCapability(Capability c) { if (isDataEditable(ResUnit.Capability)) { String newID = getDataSource(ResUnit.Capability).insert(c); // persist it if (!hasDefaultDataSource(ResUnit.Capability)) c.setID(newID); putCapability(c); // ...and add it to the data set return newID; } else return fail("External Capability dataset is read-only"); }
public void delCapability(Capability c) { capabilityMap.remove(c.getID()); setChangeStamp(ResUnit.Capability); }
public void putCapability(Capability c) { capabilityMap.put(c.getID(), c); setChangeStamp(ResUnit.Capability); }
public Set<Participant> getCapabilityParticipants(String cid) { Capability c = capabilityMap.get(cid); return (c != null) ? castToParticipantSet(c.getResources()) : null; }