示例#1
0
 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;
 }
示例#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 Capability getCapabilityByLabel(String label) {
   for (Capability c : capabilityMap.values()) {
     if (c.getCapability().equals(label)) {
       return c;
     }
   }
   return null;
 }
示例#4
0
  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();
  }
示例#5
0
 public String getParticpantsWithCapabilityAsXML(String capabilityName) {
   String result = "<participants/>";
   if (capabilityName != null) {
     Capability c = getCapabilityByLabel(capabilityName);
     if (c != null) {
       result = getCapabilityParticipantsAsXML(c.getID());
     }
   }
   return result;
 }
示例#6
0
 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/>");
 }
示例#7
0
 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;
 }
示例#8
0
 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");
 }
示例#9
0
 public void delCapability(Capability c) {
   capabilityMap.remove(c.getID());
   setChangeStamp(ResUnit.Capability);
 }
示例#10
0
 public void putCapability(Capability c) {
   capabilityMap.put(c.getID(), c);
   setChangeStamp(ResUnit.Capability);
 }
示例#11
0
 public Set<Participant> getCapabilityParticipants(String cid) {
   Capability c = capabilityMap.get(cid);
   return (c != null) ? castToParticipantSet(c.getResources()) : null;
 }