Class WarehouseRestController
- java.lang.Object
-
- org.neotropic.kuwaiba.northbound.rest.services.WarehouseRestController
-
- All Implemented Interfaces:
WarehouseRestOpenApi
@RestController @RequestMapping("/v2.1.1/warehouse-manager/") public class WarehouseRestController extends Object implements WarehouseRestOpenApi
Warehouses Manager Rest Controller.- Author:
- Mauricio Ruiz Beltrán <mauricio.ruiz@kuwaiba.org>
-
-
Constructor Summary
Constructors Constructor Description WarehouseRestController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copyObjectToWarehouse(String poolId, String objectClassName, String objectId, boolean recursive, String userName, String sessionId)
Creates a copy of an object in a warehouse.String
createPoolInWarehouse(String warehouseClassName, String warehouseId, String poolName, String poolDescription, String instancesOfClassName, String userName, String sessionId)
Creates a pool inside a warehouse.String
createSparePart(String poolId, String className, HashMap<String,String> attributes, String templateId, String userName, String sessionId)
Creates a spare part inside a pool.String
createWarehouse(String poolId, String poolClassName, HashMap<String,String> attributes, String templateId, String userName, String sessionId)
Creates a warehouse inside a pool.void
deleteSparePool(String poolId, String poolClassName, String userName, String sessionId)
Deletes a spare pool.void
deleteWarehouse(String warehouseClassName, String warehouseId, String userName, String sessionId)
Deletes a warehouse and delete its association with the related inventory objects.List<BusinessObjectLight>
getObjectsInSparePool(String poolId, int limit, String sessionId)
Get the objects of a pool.List<InventoryObjectPool>
getPoolsInWarehouse(String objectClassName, String objectId, String sessionId)
Get the pools of a warehouses.List<InventoryObjectPool>
getWarehouseRootPools(String sessionId)
Gets the Warehouse Module Root Pools.List<BusinessObjectLight>
getWarehousesInPool(String poolId, int limit, String sessionId)
Get the warehouses of a pool.void
moveObjectToWarehouse(String poolId, String objectClassName, String objectId, String userName, String sessionId)
Moves an object from a warehouse to another warehouse.
-
-
-
Field Detail
-
PATH
public static final String PATH
Path that includes the Kuwaiba version and module- See Also:
- Constant Field Values
-
-
Method Detail
-
createWarehouse
@RequestMapping(method=POST, value="createWarehouse/{poolId}/{poolClassName}/{templateId}/{userName}/{sessionId}", produces="application/json") public String createWarehouse(@PathVariable("poolId") String poolId, @PathVariable("poolClassName") String poolClassName, @RequestBody(required=false) HashMap<String,String> attributes, @PathVariable("templateId") String templateId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Creates a warehouse inside a pool.- Specified by:
createWarehouse
in interfaceWarehouseRestOpenApi
- Parameters:
poolId
- Parent pool id.poolClassName
- Class this warehouse is going to be instance of.attributes
- 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 "null" as string or empty string to not use a template.userName
- The user name of the session.sessionId
- The session token id.- Returns:
- The id of the newly created warehouse.
-
createPoolInWarehouse
@RequestMapping(method=POST, value="createPoolInWarehouse/{warehouseClassName}/{warehouseId}/{poolName}/{poolDescription}/{instancesOfClassName}/{userName}/{sessionId}", produces="application/json") public String createPoolInWarehouse(@PathVariable("warehouseClassName") String warehouseClassName, @PathVariable("warehouseId") String warehouseId, @PathVariable("poolName") String poolName, @PathVariable("poolDescription") String poolDescription, @PathVariable("instancesOfClassName") String instancesOfClassName, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Creates a pool inside a warehouse.- Specified by:
createPoolInWarehouse
in interfaceWarehouseRestOpenApi
- Parameters:
warehouseClassName
- Class name of the parent warehouse.warehouseId
- Id of the parent object.poolName
- Pool name.poolDescription
- Pool description.instancesOfClassName
- What kind of objects can this pool contain?userName
- The user name of the session.sessionId
- The session token id.- Returns:
- The id of the new pool.
-
createSparePart
@RequestMapping(method=POST, value="createSparePart/{poolId}/{className}/{templateId}/{userName}/{sessionId}", produces="application/json") public String createSparePart(@PathVariable("poolId") String poolId, @PathVariable("className") String className, @RequestBody(required=false) HashMap<String,String> attributes, @PathVariable("templateId") String templateId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Creates a spare part inside a pool.- Specified by:
createSparePart
in interfaceWarehouseRestOpenApi
- Parameters:
poolId
- Spare pool id.className
- Class this spare part is going to be instance of.attributes
- 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 "null" as string or empty string to not use a template.userName
- The user name of the session.sessionId
- The session token id.- Returns:
- The id of the newly created spare part.
-
deleteWarehouse
@RequestMapping(method=DELETE, value="deleteWarehouse/{warehouseClassName}/{warehouseId}/{userName}/{sessionId}", produces="application/json") public void deleteWarehouse(@PathVariable("warehouseClassName") String warehouseClassName, @PathVariable("warehouseId") String warehouseId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Deletes a warehouse and delete its association with the related inventory objects. These objects will remain untouched.- Specified by:
deleteWarehouse
in interfaceWarehouseRestOpenApi
- Parameters:
warehouseClassName
- The class name of the warehouse.warehouseId
- The id of the warehouse.userName
- The user name of the session.sessionId
- The session token id.
-
deleteSparePool
@RequestMapping(method=DELETE, value="deleteSparePool/{poolId}/{poolClassName}/{userName}/{sessionId}", produces="application/json") public void deleteSparePool(@PathVariable("poolId") String poolId, @PathVariable("poolClassName") String poolClassName, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Deletes a spare pool.- Specified by:
deleteSparePool
in interfaceWarehouseRestOpenApi
- Parameters:
poolId
- The spare pool id.poolClassName
- The spare pool class name.userName
- The user name of the session.sessionId
- The session token id.
-
getWarehouseRootPools
@RequestMapping(method=GET, value="getWarehouseRootPools/{sessionId}", produces="application/json") public List<InventoryObjectPool> getWarehouseRootPools(@PathVariable("sessionId") String sessionId)
Gets the Warehouse Module Root Pools.- Specified by:
getWarehouseRootPools
in interfaceWarehouseRestOpenApi
- Parameters:
sessionId
- The session token id.- Returns:
- A list of root pools.
-
getWarehousesInPool
@RequestMapping(method=GET, value="getWarehousesInPool/{poolId}/{limit}/{sessionId}", produces="application/json") public List<BusinessObjectLight> getWarehousesInPool(@PathVariable("poolId") String poolId, @PathVariable("limit") int limit, @PathVariable("sessionId") String sessionId)
Get the warehouses of a pool.- Specified by:
getWarehousesInPool
in interfaceWarehouseRestOpenApi
- Parameters:
poolId
- Root pool id.limit
- Result limit. -1 To return all.sessionId
- The session token id.- Returns:
- List of warehouses.
-
getPoolsInWarehouse
@RequestMapping(method=GET, value="getPoolsInWarehouse/{objectClassName}/{objectId}/{sessionId}", produces="application/json") public List<InventoryObjectPool> getPoolsInWarehouse(@PathVariable("objectClassName") String objectClassName, @PathVariable("objectId") String objectId, @PathVariable("sessionId") String sessionId)
Get the pools of a warehouses.- Specified by:
getPoolsInWarehouse
in interfaceWarehouseRestOpenApi
- Parameters:
objectClassName
- Warehouse class name.objectId
- Warehouse id.sessionId
- The session token id.- Returns:
- List of spare pools.
-
getObjectsInSparePool
@RequestMapping(method=GET, value="getObjectsInSparePool/{poolId}/{limit}/{sessionId}", produces="application/json") public List<BusinessObjectLight> getObjectsInSparePool(@PathVariable("poolId") String poolId, @PathVariable("limit") int limit, @PathVariable("sessionId") String sessionId)
Get the objects of a pool.- Specified by:
getObjectsInSparePool
in interfaceWarehouseRestOpenApi
- Parameters:
poolId
- Root pool id.limit
- Result limit. -1 To return all.sessionId
- The session token id.- Returns:
- List of objects.
-
copyObjectToWarehouse
@RequestMapping(method=PUT, value="copyObjectToWarehouse/{poolId}/{objectClassName}/{objectId}/{recursive}/{userName}/{sessionId}", produces="application/json") public void copyObjectToWarehouse(@PathVariable("poolId") String poolId, @PathVariable("objectClassName") String objectClassName, @PathVariable("objectId") String objectId, @PathVariable("recursive") boolean recursive, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Creates a copy of an object in a warehouse. And optionally its children objects.- Specified by:
copyObjectToWarehouse
in interfaceWarehouseRestOpenApi
- Parameters:
poolId
- The spare pool id.objectClassName
- The object class name.objectId
- The object id.recursive
- If this operation should also copy the children objects recursively.userName
- The user name of the session.sessionId
- The session token id.
-
moveObjectToWarehouse
@RequestMapping(method=PUT, value="moveObjectToWarehouse/{poolId}/{objectClassName}/{objectId}/{userName}/{sessionId}", produces="application/json") public void moveObjectToWarehouse(@PathVariable("poolId") String poolId, @PathVariable("objectClassName") String objectClassName, @PathVariable("objectId") String objectId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Moves an object from a warehouse to another warehouse.- Specified by:
moveObjectToWarehouse
in interfaceWarehouseRestOpenApi
- Parameters:
poolId
- The spare pool id.objectClassName
- The object class name.objectId
- The object id.userName
- The user name of the session.sessionId
- The session token id.
-
-