Exemplo n.º 1
0
 private void setChildren(
     TreeMap<Integer, Set<ProductGroup>> parentToChild,
     Set<ProductGroup> children,
     Container container) {
   if (children != null) {
     for (Container child : children) {
       child.setContainer(container);
     }
     container.setProductGroups(children);
     setProductGroups(parentToChild, children);
   }
 }
Exemplo n.º 2
0
 /**
  * Initializes container and adds it to the parent. Also adds container to list of ProductGroup if
  * instance of ProductGroup, otherwise parent is null.
  *
  * @pre container != null
  * @param parent
  * @param container
  */
 private void addContainerToTree(Container parent, Container container) {
   assert container != null;
   container.setContainer(parent);
   // container.setId( uniqueId++ );
   if (container instanceof ProductGroup) {
     parent.addProductGroup((ProductGroup) container);
   } else {
     storageUnits.add((StorageUnit) container);
   }
   ContainerDTO containerDTO = new ContainerDTO(container);
   containerDAO.create(containerDTO);
   container.setId(containerDTO.getId());
   idToContainer.put(container.getId(), container);
   ChangeObject hint = getHintObject(container);
   setChanged();
   notifyObservers(hint);
 }