Ejemplo n.º 1
0
 public synchronized void removePosition(Position p) {
   if (isDataEditable(ResUnit.Position)) {
     disconnectResources(p);
     for (Position position : getPositions()) {
       Position boss = position.getReportsTo();
       if ((boss != null) && boss.getID().equals(p.getID())) {
         position.setReportsTo((Position) null);
         getDataSource(ResUnit.Position).update(position);
       }
     }
     delPosition(p);
     getDataSource(ResUnit.Position).delete(p);
   }
 }
Ejemplo n.º 2
0
 /**
  * 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;
 }
Ejemplo n.º 3
0
 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;
 }