child.setStem_extension(extension); child.setDisplay_extension(displayExtension); child.setStem_name( constructName(this.getName(), extension) ); child.setDisplay_name( constructName(this.getDisplayName(), displayExtension) );  child.setParent_stem(this);  Set children  = this.getChild_stems(); children.add(child); this.setChild_stems(children);  Set objects = new LinkedHashSet(); objects.add(child); objects.add(this); HibernateHelper.save(objects); sw.stop(); EL.stemAddChildStem(this.getSession(), child.getName(), sw); _grantDefaultPrivsUponCreate(child); return child; } catch (HibernateException eH) { throw new StemAddException( "Unable to add stem " + this.getName() + ":" + extension + ": " + eH.getMessage(), eH );
child.setStem_extension(extension); child.setDisplay_extension(displayExtension); child.setStem_name( constructName(this.getName(), extension) ); child.setDisplay_name( constructName(this.getDisplayName(), displayExtension) );  child.setParent_stem(this);  Set children  = this.getChild_stems(); children.add(child); this.setChild_stems(children);  Set objects = new LinkedHashSet(); objects.add(child); objects.add(this); HibernateHelper.save(objects); sw.stop(); EL.stemAddChildStem(this.getSession(), child.getName(), sw); _grantDefaultPrivsUponCreate(child); return child; } catch (HibernateException eH) { throw new StemAddException( "Unable to add stem " + this.getName() + ":" + extension + ": " + eH.getMessage(), eH ); }
  public Stem addChildStem(String extension, String displayExtension)     throws  InsufficientPrivilegeException,            StemAddException   {    StopWatch sw = new StopWatch();    sw.start();    try {      AttributeValidator.namingValue(extension);      AttributeValidator.namingValue(displayExtension);    }    catch (ModelException eM) {      throw new StemAddException(eM.getMessage(), eM);    }    PrivilegeResolver.getInstance().canSTEM(      this.getSession(), this, this.getSession().getSubject()    );    try {      Stem ns = StemFinder.findByName(        this.getSession(), constructName(this.getName(), extension)      );      throw new StemAddException("stem already exists");    }    catch (StemNotFoundException eSNF) {      // Ignore.  This is what we want.    }    try {      _initializeChildGroupsAndStems(this);    }    catch (HibernateException eH) {      throw new StemAddException(eH.getMessage(), eH);    }    try {      Stem child = new Stem(this.getSession());      // Set naming attributes      child.setStem_extension(extension);      child.setDisplay_extension(displayExtension);      child.setStem_name(         constructName(this.getName(), extension)      );      child.setDisplay_name(         constructName(this.getDisplayName(), displayExtension)      );      // Set parent      child.setParent_stem(this);      // Add to children       Set children  = this.getChild_stems();      children.add(child);      this.setChild_stems(children);      // And save      Set objects = new LinkedHashSet();      objects.add(child);      objects.add(this);      HibernateHelper.save(objects);      sw.stop();      EL.stemAddChildStem(this.getSession(), child.getName(), sw);      _grantDefaultPrivsUponCreate(child);      return child;    }    catch (HibernateException eH) {      throw new StemAddException(        "Unable to add stem " + this.getName() + ":" + extension + ": "         + eH.getMessage(), eH      );    }  } // public Stem addChildStem(extension, displayExtension)