예제 #1
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);
 }