Class 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 Detail

      • WarehouseRestController

        public WarehouseRestController()
    • 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 interface WarehouseRestOpenApi
        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 interface WarehouseRestOpenApi
        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 interface WarehouseRestOpenApi
        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 interface WarehouseRestOpenApi
        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 interface WarehouseRestOpenApi
        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 interface WarehouseRestOpenApi
        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 interface WarehouseRestOpenApi
        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 interface WarehouseRestOpenApi
        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 interface WarehouseRestOpenApi
        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 interface WarehouseRestOpenApi
        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 interface WarehouseRestOpenApi
        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.