Example #1
0
  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);
  }
Example #2
0
 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;
 }
Example #3
0
  ServiceTemplates(Root parent, java.util.Map<String, TemplateDescriptor> descriptors)
      throws UpdateFailedException {
    super(parent, "Service templates");

    _descriptors = descriptors;

    for (java.util.Map.Entry<String, TemplateDescriptor> p : _descriptors.entrySet()) {
      insertChild(new ServiceTemplate(false, this, p.getKey(), p.getValue()), false);
    }
  }