Example #1
0
 /** Recursive into children! Will add the attributes as well and grab an id for this instance. */
 public void addToDatabase(Project project) {
   this.project = project;
   this.id = project.getLoader().getNextId();
   super.addToDatabase();
   if (null == al_children || al_children.isEmpty()) return;
   for (final TemplateThing child : al_children) {
     child.addToDatabase(project);
   }
 }
Example #2
0
 /** Recursive into children: clones the whole tree from this node downward. */
 public TemplateThing clone(final Project pr, final boolean copy_id) {
   final long nid = copy_id ? this.id : pr.getLoader().getNextId();
   final TemplateThing copy = new TemplateThing(this.type, pr, nid);
   copy.project = pr;
   copy.addToDatabase();
   // clone children
   if (null == al_children) return copy;
   for (final TemplateThing child : al_children) {
     copy.addChild(child.clone(pr, copy_id));
   }
   return copy;
 }