if ( attr.equals("displayExtension") || attr.equals("displayName") || attr.equals("extension") || attr.equals("name") ) { GrouperLog.debug(LOG, this.s, msg + "cannot delete '" + attr + "'"); throw new GroupModifyException(msg + "cannot delete '" + attr + "'"); }
  public void deleteAttribute(String attr)     throws  AttributeNotFoundException,            GroupModifyException,             InsufficientPrivilegeException  {    // TODO This needs some refactoring.  Definitely some duplicate    //      code between here and setAttribute() if nothing else.    StopWatch sw = new StopWatch();    sw.start();    String  val = new String(); // For logging    String  msg = "deleteAttribute: ";    if ( (attr == null) || (attr.equals("")) ) {      GrouperLog.debug(LOG, this.s, msg + "no attr");      throw new GroupModifyException(msg + "no attr");    }    // TODO Yuck    if (      attr.equals("displayExtension")      || attr.equals("displayName")      || attr.equals("extension")      || attr.equals("name")    )    {      GrouperLog.debug(LOG, this.s, msg + "cannot delete '" + attr + "'");      throw new GroupModifyException(msg + "cannot delete '" + attr + "'");    }    try {      Field f = FieldFinder.find(attr);      PrivilegeResolver.getInstance().canPrivDispatch(        this.s, this, this.s.getSubject(), f.getWritePriv()      );      Set       saves   = new LinkedHashSet();      Set       deletes = new LinkedHashSet();      Set       attrs   = new LinkedHashSet();      boolean   found   = false;      Iterator  iter    = this.getGroup_attributes().iterator();      while (iter.hasNext()) {        Attribute a = (Attribute) iter.next();        if (a.getField().equals(f)) {          val = a.getValue();          GrouperLog.debug(LOG, this.s, msg + "will delete '" + attr + "'");          deletes.add(a);          found = true;        }        else {          GrouperLog.debug(            LOG, this.s, msg + "will preserve '" + a.getField().getName() + "'"          );          attrs.add(a);        }      }      if (found == true) {        this.setModified();        this.setGroup_attributes(attrs);        saves.add(this);        HibernateHelper.saveAndDelete(saves, deletes);        GrouperLog.debug(LOG, this.s, msg + "deleted '" + attr + "'");      }      else {        msg += "does not have '" + attr + "'";        GrouperLog.debug(LOG, this.s, msg);         throw new AttributeNotFoundException(msg);      }    }    catch (HibernateException eH) {      GrouperLog.debug(LOG, this.s, msg + eH.getMessage());      throw new GroupModifyException(msg + eH.getMessage());    }    catch (SchemaException eS) {      GrouperLog.debug(LOG, this.s, msg + eS.getMessage());      throw new AttributeNotFoundException(msg + eS.getMessage());    }    sw.stop();    EL.groupDelAttr(this.s, this.getName(), attr, val, sw);  } // public void deleteAttribute(attr)