public Map<String, String> getPositionIdentifiers() { Map<String, String> idMap = new Hashtable<String, String>(); for (Position p : getPositions()) { idMap.put(p.getID(), p.getTitle()); } return idMap; }
public String checkCyclicPositionReference(Position position, String refID) { String result = null; List<String> hierarchy = new ArrayList<String>(); hierarchy.add(position.getTitle()); Position owner = getPosition(refID); String refName = owner.getTitle(); // title of posn attempting to add to while (owner != null) { hierarchy.add(owner.getTitle()); if (owner.equals(position)) { result = constructCyclicAttributeErrorMessage(hierarchy, "position", refName); break; } owner = owner.getReportsTo(); } return result; }
public void fillPosition(String title, Person hire) { for (Position position : this) if (position.getTitle().equals(title) && position.getPerson() == Person.NULL) { position.setPerson(hire); return; } throw new RuntimeException("Position " + title + " not available"); }
public Position getPositionByLabel(String label) { for (Position p : positionMap.values()) { if (p.getTitle().equals(label)) { return p; } } return null; }
public boolean positionAvailable(String title) { for (Position position : this) if (position.getTitle().equals(title) && position.getPerson() == Person.NULL) return true; return false; }