public String resolveParticipantIdsAsXML(String anyID) { XNode node = new XNode("participantids"); for (Participant p : resolveParticipants(anyID)) { node.addChild("id", p.getID()); } return node.toString(); }
public Set<String> resolveParticipantIds(String anyID) { Set<String> idSet = new HashSet<String>(); for (Participant p : resolveParticipants(anyID)) { idSet.add(p.getID()); } return idSet; }
private void addParticipantToDistributionSet( HashSet<Participant> distributionSet, ArrayList<String> uniqueIDs, Participant p) { if (!uniqueIDs.contains(p.getID())) { uniqueIDs.add(p.getID()); distributionSet.add(p); } }
// it was necessary to do it this way rather than using 'jsp:plugin' in the // jsf because the 'codebase' parameter does not support dynamic value setting public String getAppletHtml() { String baseURI = getApplicationBean().getResServiceBaseURI(); Participant p = _sb.getParticipant(); Dimension view = getViewSize(); StringBuilder result = new StringBuilder("<applet width=\""); result .append(view.width) .append("\" height=\"") .append(view.height) .append("\"") .append(" archive=\"visualiser.jar,javax.servlet.jar,jdom-2.0.5.jar,") .append(" resourceService.jar,saxon9.jar,log4j-1.2.16.jar,commons-codec-1.9.jar\"") .append(" codebase=\"../../visualiserApplet\"") .append(" code=\"worklist.WRKLApplet.class\" MAYSCRIPT>") .append(" <param name=\"user\" value=\"") .append(p.getUserID()) .append("\"/>") .append(" <param name=\"pass\" value=\"") .append(p.getPassword()) .append("\"/>") .append(" <param name=\"urYAWL\" value=\"") .append(baseURI) .append("\"/>") .append("</applet>"); return result.toString(); }
public Set<Participant> getOrgGroupMembers(OrgGroup o) { Set<Participant> result = new HashSet<Participant>(); for (Participant p : participantMap.values()) { if (p.isOrgGroupMember(o)) result.add(p); } return result; }
public Participant getParticipantFromUserID(String userID) { for (Participant p : getParticipants()) { if (p.getUserID().equals(userID)) { return p; } } return null; }
public String getParticipantsAsXML() { List<Participant> pList = sortFullParticipantListByName(); StringBuilder xml = new StringBuilder("<participants>"); for (Participant p : pList) xml.append(p.toXML()); xml.append("</participants>"); return xml.toString(); }
// @return a csv listing of the full name of each participant public String getParticipantNames() { List<Participant> pList = sortFullParticipantListByName(); StringBuilder csvList = new StringBuilder(); for (Participant p : pList) { if (csvList.length() > 0) csvList.append(","); csvList.append(p.getFullName()); } return csvList.toString(); }
/** ***************************************************************************** */ public String toXML() { StringBuilder xml = new StringBuilder("<offer "); xml.append("initiator=\"").append(getInitiatorString()).append("\">"); // the rest of the xml is only needed if it's system initiated if (isSystemInitiated()) { xml.append("<distributionSet>"); xml.append("<initialSet>"); if (_participants != null) { for (Participant p : _participants) { xml.append("<participant>").append(p.getID()).append("</participant>"); } } if (_roles != null) { for (Role r : _roles) { xml.append("<role>").append(r.getID()).append("</role>"); } } if (_dynParams != null) { for (DynParam p : _dynParams) { xml.append(p.toXML()); } } xml.append("</initialSet>"); if ((_filters != null) && (!_filters.isEmpty())) { xml.append("<filters>"); for (AbstractFilter filter : _filters) { xml.append(filter.toXML()); } xml.append("</filters>"); } if ((_constraints != null) && (!_constraints.isEmpty())) { xml.append("<constraints>"); for (AbstractConstraint constraint : _constraints) { xml.append(constraint.toXML()); } xml.append("</constraints>"); } xml.append("</distributionSet>"); if (_familiarParticipantTask != null) { xml.append("<familiarParticipant taskID=\""); xml.append(_familiarParticipantTask).append("\"/>"); } } xml.append("</offer>"); return xml.toString(); }
private String validateCredentials(String userid, String password) { if (userid == null) { return "No userid was specified."; } if (password == null) { return "No password was specified."; } String loggedOnUserID = sb.getUserid(); if (loggedOnUserID != null) { if (!loggedOnUserID.equals(userid)) { return "User '" + loggedOnUserID + "' is already logged on in this" + " browser instance (in another tab or window)." + " Only one user logon per browser " + " instance is possible. If you wish to view you work" + " queued items via your iGoogle Gadget, please " + " logout the currently logged on user first."; } else sb.setRssAlreadyLoggedOn(true); } else { if (rm == null) { return "Could not connect to work queue, service unavailable."; } Participant p = rm.getParticipantFromUserID(userid); if (p == null) { return "Unknown userid: " + userid; } if (!p.getPassword().equals(password)) { return "Incorrect password."; } if (!rm.hasOrgDataSource()) { msgPanel.error( "Missing or invalid organisational data source. The resource" + " service requires a connection to a valid data source" + " that contains organisational data. Please check the" + " settings of the 'OrgDataSource' parameter in the service's" + " web.xml to ensure a valid data source is set, and/or check" + " the configuration properties set for the data source."); } String handle = rm.login(userid, password, sb.getExternalSessionID()); if (!rm.successful(handle)) { return (msgPanel.format(handle)); } initSession(p, userid, handle); } return success; // successful login }
private synchronized void disconnectResources(AbstractResourceAttribute attrib) { Set<AbstractResource> resources = attrib.getResources(); // get ids to avoid ConcurrentModificationException List<String> ids = new ArrayList<String>(); for (AbstractResource resource : resources) ids.add(resource.getID()); for (String id : ids) { Participant p = getParticipant(id); if (attrib instanceof Role) p.removeRole((Role) attrib); else if (attrib instanceof Capability) p.removeCapability((Capability) attrib); else if (attrib instanceof Position) p.removePosition((Position) attrib); updateParticipant(p); } }
/** * Takes the initial distribution set of participants, then expands any roles and/or dynamic * parameters to their 'set of participants' equivalents, then applies the specified filters * and/or constraints, and returns the final distribution set of participants. * * @param wir the workitem being offered * @return the final distribution set of Participant objects */ public Set<Participant> performOffer(WorkItemRecord wir) { _distributionSet = new HashSet<Participant>(); // if familiar task specified, get the participant(s) who completed that task, // & offer this item to them - no more to do if (_familiarParticipantTask != null) { Set<Participant> pSet = _rm.getWhoCompletedTask(_familiarParticipantTask, wir); if (pSet != null) _distributionSet.addAll(pSet); } else { // make sure each participant is added only once ArrayList<String> uniqueIDs = new ArrayList<String>(); // add Participants for (Participant p : _participants) { uniqueIDs.add(p.getID()); _distributionSet.add(p); } // add roles for (Role role : _roles) { Set<Participant> pSet = _rm.getOrgDataSet().castToParticipantSet(role.getResources()); pSet.addAll(_rm.getOrgDataSet().getParticipantsInDescendantRoles(role)); for (Participant p : pSet) { addParticipantToDistributionSet(_distributionSet, uniqueIDs, p); } } // add dynamic params for (DynParam param : _dynParams) { Set<Participant> pSet = param.evaluate(wir); for (Participant p : pSet) { addParticipantToDistributionSet(_distributionSet, uniqueIDs, p); } } // apply each filter for (AbstractFilter filter : _filters) _distributionSet = (HashSet<Participant>) filter.performFilter(_distributionSet); // apply each constraint for (AbstractConstraint constraint : _constraints) _distributionSet = (HashSet<Participant>) constraint.performConstraint(_distributionSet, wir); } // ok - got our final set return _distributionSet; }
/** ********************************* */ public String addParticipant(Participant p) { if (isDataEditable(ResUnit.Participant)) { String newID = getDataSource(ResUnit.Participant).insert(p); if (!hasDefaultDataSource(ResUnit.Participant)) p.setID(newID); putParticipant(p); // add it to the data set return newID; } else return fail("External Participant dataset is read-only"); }
/** ********************************* */ public synchronized boolean removeParticipant(Participant p) { boolean editable = isDataEditable(ResUnit.Participant); if (editable) { p.removeAttributeReferences(); getDataSource(ResUnit.Participant).delete(p); delParticipant(p); } return editable; }
public void withdrawOffer(WorkItemRecord wir, HashSet<Participant> offeredSet) { if (offeredSet != null) { for (Participant p : offeredSet) { p.getWorkQueues().removeFromQueue(wir, WorkQueue.OFFERED); _rm.announceModifiedQueue(p.getID()); } } // a fired instance of a multi-instance workitem on the unoffered queue will // never have been offered, so the warning should be suppressed for those else if (!wir.getStatus().equals(WorkItemRecord.statusFired)) { _log.warn( "Workitem '" + wir.getID() + "' does not have 'Offered' status, " + "or is no longer active"); } }
private long getEarliestTime(List events, Participant p) { long result = Long.MAX_VALUE; Iterator itr = events.iterator(); while (itr.hasNext()) { ResourceEvent event = (ResourceEvent) itr.next(); if (event.get_resourceID().equals(p.getID()) && (event.get_timeStamp() < result)) result = event.get_timeStamp(); } return result; }
/** * Gets the immediate supervisor of a participant. If the participant holds multiple positions, * and therefore has multiple supervisors, one is returned as a random selection. * * @param p the participant to get the supervisor of * @return the Participant who is the supervisor of the pid passed, or null if there is no * supervisor. */ public Participant getImmediateSupervisor(Participant p) { if (p != null) { for (Position position : p.getPositions()) { Position superPosition = position.getReportsTo(); if (superPosition != null) { Set<AbstractResource> resources = superPosition.getResources(); if (!resources.isEmpty()) { return (Participant) resources.iterator().next(); } } } } return null; }
public Map<String, String> getParticipantIdentifiers(Identifier idType) { Map<String, String> idMap = new Hashtable<String, String>(); for (Participant p : getParticipants()) { String nameValue; switch (idType) { case FullName: nameValue = p.getFullName(); break; case ReverseFullName: nameValue = p.getLastName() + ", " + p.getFirstName(); break; case LastName: nameValue = p.getLastName(); break; default: nameValue = p.getUserID(); } idMap.put(p.getID(), nameValue); } return idMap; }
private String checkParticipantHasQueuedItem(Participant p, WorkItemRecord wir, int qType) { String result = success; boolean queuedItem = false; if (p != null) { QueueSet qSet = p.getWorkQueues(); if (qSet != null) { Set<WorkItemRecord> items = qSet.getQueuedWorkItems(qType); if (items != null) { queuedItem = items.contains(wir); } } if (!queuedItem) { result = "Work item '" + wir.getID() + "' is no longer in the " + "participant's queue. Please refresh your worklist."; } } else { result = "Could not locate participant with userid supplied."; } return result; }
public Set<Role> getParticipantRoles(String pid) { Participant p = participantMap.get(pid); return (p != null) ? p.getRoles() : null; }
/** * variation of the above * * @param p - the Participant object to add to the initial distribution list */ public void addParticipant(Participant p) { if (_rm.getOrgDataSet().isKnownParticipant(p)) _participants.add(p); else _log.warn("Could not add unknown Participant to Offer: " + p.getID()); }
private String participantSetToXML(Set<Participant> pSet, String header) { StringBuilder xml = new StringBuilder(header); for (Participant p : pSet) xml.append(p.toXML()); xml.append("</participants>"); return xml.toString(); }
public boolean isKnownParticipant(Participant p) { return isKnownParticipant(p.getID()); }
public Set<Position> getParticipantPositions(String pid) { Participant p = participantMap.get(pid); return (p != null) ? p.getPositions() : null; }
public String getPassword() { Participant p = _sb.getParticipant(); return (p != null) ? p.getPassword() : ""; }
/** ********************************* */ public void delParticipant(Participant p) { participantMap.remove(p.getID()); setChangeStamp(ResUnit.Participant); }
/** ********************************* */ public void putParticipant(Participant p) { participantMap.put(p.getID(), p); setChangeStamp(ResUnit.Participant); }
public String getUsername() { Participant p = _sb.getParticipant(); return (p != null) ? p.getUserID() : ""; }
public Set<Capability> getParticipantCapabilities(String pid) { Participant p = participantMap.get(pid); return (p != null) ? p.getCapabilities() : null; }