public static java.util.Map<String, TemplateDescriptor> copyDescriptors(
     java.util.Map<String, TemplateDescriptor> descriptors) {
   java.util.Map<String, TemplateDescriptor> copy = new java.util.HashMap<>();
   for (java.util.Map.Entry<String, TemplateDescriptor> p : descriptors.entrySet()) {
     copy.put(p.getKey(), ServiceTemplate.copyDescriptor(p.getValue()));
   }
   return copy;
 }
 java.util.Map<String, TemplateDescriptor> getUpdates() {
   java.util.Map<String, TemplateDescriptor> updates = new java.util.HashMap<>();
   for (TreeNodeBase p : _children) {
     ServiceTemplate t = (ServiceTemplate) p;
     if (t.getEditable().isNew() || t.getEditable().isModified()) {
       updates.put(t.getId(), (TemplateDescriptor) t.getDescriptor());
     }
   }
   return updates;
 }
  void update(java.util.Map<String, TemplateDescriptor> descriptors, String[] removeTemplates)
      throws UpdateFailedException {
    //
    // Note: _descriptors is updated by Application
    //

    //
    // One big set of removes
    //
    removeChildren(removeTemplates);

    //
    // One big set of updates, followed by inserts
    //
    java.util.List<TreeNodeBase> newChildren = new java.util.ArrayList<>();
    java.util.List<TreeNodeBase> updatedChildren = new java.util.LinkedList<>();

    for (java.util.Map.Entry<String, TemplateDescriptor> p : descriptors.entrySet()) {
      String name = p.getKey();
      TemplateDescriptor templateDescriptor = p.getValue();
      ServiceTemplate child = (ServiceTemplate) findChild(name);
      if (child == null) {
        newChildren.add(new ServiceTemplate(false, this, name, templateDescriptor));
      } else {
        child.rebuild(templateDescriptor);
        updatedChildren.add(child);
      }
    }

    childrenChanged(updatedChildren);
    insertChildren(newChildren, true);
  }