Beispiel #1
0
 /**
  * Compares storage name with Set<StorageUnit> for uniqueness.
  *
  * @pre container != null
  * @param container
  * @return boolean true if container.name == Unique, otherwise false.
  */
 private boolean isUniqueStorageUnitName(Container container) {
   assert container != null;
   for (StorageUnit storageUnit : storageUnits) {
     if (container.getName().equals(storageUnit.getName())) {
       return false;
     }
   }
   return true;
 }
Beispiel #2
0
 private void setProductGroups(
     TreeMap<Integer, Set<ProductGroup>> parentToChild, Set<ProductGroup> containers) {
   if (containers == null) {
     for (StorageUnit storageUnit : storageUnits) {
       Set<ProductGroup> children = parentToChild.get(storageUnit.getId());
       setChildren(parentToChild, children, storageUnit);
     }
   } else {
     for (Container container : containers) {
       Set<ProductGroup> children = parentToChild.get(container.getId());
       setChildren(parentToChild, children, container);
     }
   }
 }
Beispiel #3
0
 public void load() {
   Collection<ContainerDTO> productContainers = containerDAO.readAll();
   TreeMap<Integer, Set<ProductGroup>> parentToChild = new TreeMap<Integer, Set<ProductGroup>>();
   for (ContainerDTO containerDTO : productContainers) {
     if (containerDTO.getContainerId() == -1) {
       StorageUnit storageUnit = new StorageUnit().storageUnitConverter(containerDTO);
       storageUnits.add(storageUnit);
       idToContainer.put(storageUnit.getId(), storageUnit);
     } else {
       addToMap(containerDTO, parentToChild);
     }
   }
   setProductGroups(parentToChild, null);
 }
Beispiel #4
0
 /** @param args */
 public static void main(String[] args) {
   Barcode.Test();
   Item.Test();
   Product.Test();
   StorageUnit.Test();
   ProductContainer.Test();
   ProductGroup.Test();
   ProductList.Test();
   ItemList.Test();
   ProductContainerList.Test();
   ItemFilter.Test();
   ProductFilter.Test();
   ItemManager.Test();
   ProductManager.Test();
   //		Size.Test();
   StorageUnitManager.Test();
   System.out.println("All tests passed.");
 }