コード例 #1
0
 public String checkCyclicOrgGroupReference(OrgGroup orgGroup, String refID) {
   String result = null;
   List<String> hierarchy = new ArrayList<String>();
   hierarchy.add(orgGroup.getGroupName());
   OrgGroup owner = getOrgGroup(refID);
   String refName = owner.getGroupName(); // name of group attempting to add to
   while (owner != null) {
     hierarchy.add(owner.getGroupName());
     if (owner.equals(orgGroup)) {
       result = constructCyclicAttributeErrorMessage(hierarchy, "org group", refName);
       break;
     }
     owner = owner.getBelongsTo();
   }
   return result;
 }
コード例 #2
0
  public synchronized void removeOrgGroup(OrgGroup o) {
    if (isDataEditable(ResUnit.OrgGroup)) {
      for (Position position : getPositions()) {
        OrgGroup group = position.getOrgGroup();
        if ((group != null) && group.getID().equals(o.getID())) {
          position.setOrgGroup((OrgGroup) null);
          getDataSource(ResUnit.Position).update(position);
        }
      }

      for (OrgGroup group : getOrgGroups()) {
        OrgGroup owner = group.getBelongsTo();
        if ((owner != null) && owner.getID().equals(o.getID())) {
          group.setBelongsTo((OrgGroup) null);
          getDataSource(ResUnit.OrgGroup).update(group);
        }
      }
      delOrgGroup(o);
      getDataSource(ResUnit.OrgGroup).delete(o);
    }
  }