Class WarehousesService
- java.lang.Object
-
- com.neotropic.kuwaiba.modules.commercial.whman.persistence.WarehousesService
-
@Service public class WarehousesService extends Object
Service to manage warehouses- Author:
- Johny Andres Ortega Ruiz <johny.ortega@kuwaiba.org>
-
-
Field Summary
Fields Modifier and Type Field Description static String
RELATIONSHIP_WAREHOUSE_HAS
Relationship used to assign a Warehouse or VirtualWarehouse to a GenericLocation
-
Constructor Summary
Constructors Constructor Description WarehousesService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
createPoolInWarehouse(String parentClassname, String parentId, String name, String description, String instancesOfClass, int type)
Creates a pool inside a warehouseString
createWarehouse(String poolId, String className, HashMap<String,String> attributes, String templateId)
Creates a warehouse inside a poolvoid
deleteWarehouse(String warehouseClass, String warehouseId)
Deletes a warehouse and delete its association with the related inventory objects.List<BusinessObjectLight>
getObjectsInSparePool(String poolId, int limit)
Get the objects of a poolList<InventoryObjectPool>
getPoolsInWarehouse(String objectClassName, String objectId)
Get the pools of a warehousesList<InventoryObjectPool>
getWarehouseRootPools()
Gets the Warehouse Module Root PoolsList<BusinessObjectLight>
getWarehousesInPool(String poolId, int limit)
Get the warehouses of a poolvoid
init()
-
-
-
Field Detail
-
RELATIONSHIP_WAREHOUSE_HAS
public static final String RELATIONSHIP_WAREHOUSE_HAS
Relationship used to assign a Warehouse or VirtualWarehouse to a GenericLocation- See Also:
- Constant Field Values
-
-
Method Detail
-
init
@PostConstruct public void init()
-
getWarehouseRootPools
public List<InventoryObjectPool> getWarehouseRootPools() throws MetadataObjectNotFoundException, InvalidArgumentException
Gets the Warehouse Module Root Pools- Returns:
- A list of root pools
- Throws:
MetadataObjectNotFoundException
- If the classes Warehouse or VirtualWarehouse could not be found.InvalidArgumentException
- If any pool does not have uuid
-
getWarehousesInPool
public List<BusinessObjectLight> getWarehousesInPool(String poolId, int limit) throws ApplicationObjectNotFoundException, InvalidArgumentException
Get the warehouses of a pool- Parameters:
poolId
- Root pool idlimit
- Result limit. -1 To return all- Returns:
- List of warehouses
- Throws:
ApplicationObjectNotFoundException
- If the pool id provided is not validInvalidArgumentException
- If any warehouse does not have uuid
-
getPoolsInWarehouse
public List<InventoryObjectPool> getPoolsInWarehouse(String objectClassName, String objectId) throws BusinessObjectNotFoundException, InvalidArgumentException, MetadataObjectNotFoundException
Get the pools of a warehouses- Parameters:
objectClassName
- Warehouse class nameobjectId
- Warehouse id- Returns:
- List of spare pools
- Throws:
BusinessObjectNotFoundException
- If the parent object can not be foundInvalidArgumentException
- If pool warehouse does not have uuiMetadataObjectNotFoundException
- If the classes could not be found.
-
getObjectsInSparePool
public List<BusinessObjectLight> getObjectsInSparePool(String poolId, int limit) throws ApplicationObjectNotFoundException, InvalidArgumentException
Get the objects of a pool- Parameters:
poolId
- Root pool idlimit
- Result limit. -1 To return all- Returns:
- List of objects
- Throws:
ApplicationObjectNotFoundException
- If the pool id provided is not validInvalidArgumentException
- If any object does not have uuid
-
createWarehouse
public String createWarehouse(String poolId, String className, HashMap<String,String> attributes, String templateId) throws ApplicationObjectNotFoundException, InvalidArgumentException, MetadataObjectNotFoundException
Creates a warehouse inside a pool- Parameters:
poolId
- Parent pool idclassName
- Class this object is going to be instance ofattributes
- The list of attributes to be set initially. The values are serialized objects.templateId
- The id of the template to be used to create this object. This id was probably retrieved by {@link ApplicationEntityManager.getTemplatesForClass(String)} before. Use a null or empty string to not use a template.- Returns:
- the id of the newly created warehouse
- Throws:
ApplicationObjectNotFoundException
- If the parent pool can't be foundInvalidArgumentException
- If any of the attributes or its type is invalidMetadataObjectNotFoundException
- If the class name could not be found
-
createPoolInWarehouse
public String createPoolInWarehouse(String parentClassname, String parentId, String name, String description, String instancesOfClass, int type) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException
Creates a pool inside a warehouse- Parameters:
parentClassname
- Class name of the parent objectparentId
- Id of the parent objectname
- Pool namedescription
- Pool descriptioninstancesOfClass
- What kind of objects can this pool contain?type
- Type of pool. For possible values see ApplicationManager.POOL_TYPE_XXX- Returns:
- The id of the new pool
- Throws:
MetadataObjectNotFoundException
- If instancesOfClass is not a valid subclass of InventoryObjectBusinessObjectNotFoundException
- If the parent object can not be found
-
deleteWarehouse
public void deleteWarehouse(String warehouseClass, String warehouseId) throws ApplicationObjectNotFoundException, MetadataObjectNotFoundException
Deletes a warehouse and delete its association with the related inventory objects. These objects will remain untouched.- Parameters:
warehouseClass
- The class of the warehouse.warehouseId
- The id of the warehouse- Throws:
ApplicationObjectNotFoundException
- If the warehouse could not be found.MetadataObjectNotFoundException
- If the warehouse class could not be found.
-
-