Class ServiceRestController

  • All Implemented Interfaces:
    ServiceRestOpenApi

    @RestController
    @RequestMapping("/v2.1.1/service-manager/")
    public class ServiceRestController
    extends Object
    implements ServiceRestOpenApi
    Service Manager Rest Controller.
    Author:
    Mauricio Ruiz Beltrán <mauricio.ruiz@kuwaiba.org>
    • Constructor Detail

      • ServiceRestController

        public ServiceRestController()
    • Method Detail

      • createCustomerPool

        @RequestMapping(method=POST,
                        value="createCustomerPool/{poolName}/{poolDescription}/{userName}/{sessionId}",
                        produces="application/json")
        public String createCustomerPool​(@PathVariable("poolName")
                                         String poolName,
                                         @PathVariable("poolDescription")
                                         String poolDescription,
                                         @PathVariable("userName")
                                         String userName,
                                         @PathVariable("sessionId")
                                         String sessionId)
        Creates a customer pool.
        Specified by:
        createCustomerPool in interface ServiceRestOpenApi
        Parameters:
        poolName - The pool name.
        poolDescription - The pool description.
        userName - The user name of the session.
        sessionId - The session token id.
        Returns:
        The id newly created customer pool.
      • createCustomer

        @RequestMapping(method=POST,
                        value="createCustomer/{poolId}/{customerClassName}/{userName}/{sessionId}",
                        produces="application/json")
        public String createCustomer​(@PathVariable("poolId")
                                     String poolId,
                                     @PathVariable("customerClassName")
                                     String customerClassName,
                                     @RequestBody(required=false)
                                     HashMap<String,​String> attributes,
                                     @PathVariable("userName")
                                     String userName,
                                     @PathVariable("sessionId")
                                     String sessionId)
        Creates a customer.
        Specified by:
        createCustomer in interface ServiceRestOpenApi
        Parameters:
        poolId - Parent pool id.
        customerClassName - This customer is going to be instance of.
        attributes - The list of attributes to be set initially. The values are serialized objects.
        userName - The user name of the session.
        sessionId - The session token id.
        Returns:
        The id newly created customer.
      • createServicePool

        @RequestMapping(method=POST,
                        value="createServicePool/{customerClassName}/{customerId}/{poolName}/{poolDescription}/{userName}/{sessionId}",
                        produces="application/json")
        public String createServicePool​(@PathVariable("customerClassName")
                                        String customerClassName,
                                        @PathVariable("customerId")
                                        String customerId,
                                        @PathVariable("poolName")
                                        String poolName,
                                        @PathVariable("poolDescription")
                                        String poolDescription,
                                        @PathVariable("userName")
                                        String userName,
                                        @PathVariable("sessionId")
                                        String sessionId)
        Creates a service pool.
        Specified by:
        createServicePool in interface ServiceRestOpenApi
        Parameters:
        customerClassName - Customer class name.
        customerId - Customer id.
        poolName - The service pool name.
        poolDescription - The service pool description.
        userName - The user name of the session.
        sessionId - The session token id.
        Returns:
        The id newly created service pool.
      • createService

        @RequestMapping(method=POST,
                        value="createService/{poolId}/{serviceClassName}/{userName}/{sessionId}",
                        produces="application/json")
        public String createService​(@PathVariable("poolId")
                                    String poolId,
                                    @PathVariable("serviceClassName")
                                    String serviceClassName,
                                    @RequestBody(required=false)
                                    HashMap<String,​String> attributes,
                                    @PathVariable("userName")
                                    String userName,
                                    @PathVariable("sessionId")
                                    String sessionId)
        Creates a service.
        Specified by:
        createService in interface ServiceRestOpenApi
        Parameters:
        poolId - Parent pool id.
        serviceClassName - This service is going to be instance of.
        attributes - The list of attributes to be set initially. The values are serialized objects.
        userName - The user name of the session.
        sessionId - The session token id.
        Returns:
        The id newly created service.
      • updateCustomerPool

        @RequestMapping(method=PUT,
                        value="updateCustomerPool/{poolId}/{poolClassName}/{poolName}/{poolDescription}/{userName}/{sessionId}",
                        produces="application/json")
        public void updateCustomerPool​(@PathVariable("poolId")
                                       String poolId,
                                       @PathVariable("poolClassName")
                                       String poolClassName,
                                       @PathVariable("poolName")
                                       String poolName,
                                       @PathVariable("poolDescription")
                                       String poolDescription,
                                       @PathVariable("userName")
                                       String userName,
                                       @PathVariable("sessionId")
                                       String sessionId)
        Updates a customer pool.
        Specified by:
        updateCustomerPool in interface ServiceRestOpenApi
        Parameters:
        poolId - The pool id.
        poolClassName - The pool class name.
        poolName - The pool name.
        poolDescription - The pool description.
        userName - The user name of the session.
        sessionId - The session token id.
      • updateCustomer

        @RequestMapping(method=PUT,
                        value="updateCustomer/{customerClassName}/{customerId}/{userName}/{sessionId}",
                        produces="application/json")
        public void updateCustomer​(@PathVariable("customerClassName")
                                   String customerClassName,
                                   @PathVariable("customerId")
                                   String customerId,
                                   @RequestBody(required=false)
                                   HashMap<String,​String> attributes,
                                   @PathVariable("userName")
                                   String userName,
                                   @PathVariable("sessionId")
                                   String sessionId)
        Updates a customer.
        Specified by:
        updateCustomer in interface ServiceRestOpenApi
        Parameters:
        customerClassName - Customer class name.
        customerId - Customer id.
        attributes - The attributes to be updated (the key is the attribute name, the value is and array with the value -or values in case of MANY TO MANY list type attributes-).
        userName - The user name of the session.
        sessionId - The session token id.
      • updateServicePool

        @RequestMapping(method=PUT,
                        value="updateServicePool/{poolId}/{poolClassName}/{poolName}/{poolDescription}/{userName}/{sessionId}",
                        produces="application/json")
        public void updateServicePool​(@PathVariable("poolId")
                                      String poolId,
                                      @PathVariable("poolClassName")
                                      String poolClassName,
                                      @PathVariable("poolName")
                                      String poolName,
                                      @PathVariable("poolDescription")
                                      String poolDescription,
                                      @PathVariable("userName")
                                      String userName,
                                      @PathVariable("sessionId")
                                      String sessionId)
        Updates a service pool.
        Specified by:
        updateServicePool in interface ServiceRestOpenApi
        Parameters:
        poolId - The pool id.
        poolClassName - The pool class name.
        poolName - The pool name.
        poolDescription - The pool description.
        userName - The user name of the session.
        sessionId - The session token id.
      • updateService

        @RequestMapping(method=PUT,
                        value="updateService/{serviceClassName}/{serviceId}/{userName}/{sessionId}",
                        produces="application/json")
        public void updateService​(@PathVariable("serviceClassName")
                                  String serviceClassName,
                                  @PathVariable("serviceId")
                                  String serviceId,
                                  @RequestBody(required=false)
                                  HashMap<String,​String> attributes,
                                  @PathVariable("userName")
                                  String userName,
                                  @PathVariable("sessionId")
                                  String sessionId)
        Updates a service.
        Specified by:
        updateService in interface ServiceRestOpenApi
        Parameters:
        serviceClassName - Service class name.
        serviceId - Service id.
        attributes - The attributes to be updated (the key is the attribute name, the value is and array with the value -or values in case of MANY TO MANY list type attributes-).
        userName - The user name of the session.
        sessionId - The session token id.
      • deleteCustomerPool

        @RequestMapping(method=DELETE,
                        value="deleteCustomerPool/{poolId}/{poolClassName}/{userName}/{sessionId}",
                        produces="application/json")
        public void deleteCustomerPool​(@PathVariable("poolId")
                                       String poolId,
                                       @PathVariable("poolClassName")
                                       String poolClassName,
                                       @PathVariable("userName")
                                       String userName,
                                       @PathVariable("sessionId")
                                       String sessionId)
        Deletes a customer pool.
        Specified by:
        deleteCustomerPool in interface ServiceRestOpenApi
        Parameters:
        poolId - The pool id.
        poolClassName - The pool class name.
        userName - The user name of the session.
        sessionId - The session token id.
      • deleteCostumer

        @RequestMapping(method=DELETE,
                        value="deleteCostumer/{customerClassName}/{customerId}/{userName}/{sessionId}",
                        produces="application/json")
        public void deleteCostumer​(@PathVariable("customerClassName")
                                   String customerClassName,
                                   @PathVariable("customerId")
                                   String customerId,
                                   @PathVariable("userName")
                                   String userName,
                                   @PathVariable("sessionId")
                                   String sessionId)
        Deletes a customer.
        Specified by:
        deleteCostumer in interface ServiceRestOpenApi
        Parameters:
        customerClassName - Customer class name.
        customerId - Customer id.
        userName - The user name of the session.
        sessionId - The session token id.
      • deleteServicePool

        @RequestMapping(method=DELETE,
                        value="deleteServicePool/{poolId}/{poolClassName}/{userName}/{sessionId}",
                        produces="application/json")
        public void deleteServicePool​(@PathVariable("poolId")
                                      String poolId,
                                      @PathVariable("poolClassName")
                                      String poolClassName,
                                      @PathVariable("userName")
                                      String userName,
                                      @PathVariable("sessionId")
                                      String sessionId)
        Deletes a service pool.
        Specified by:
        deleteServicePool in interface ServiceRestOpenApi
        Parameters:
        poolId - The pool id.
        poolClassName - The pool class name.
        userName - The user name of the session.
        sessionId - The session token id.
      • deleteService

        @RequestMapping(method=DELETE,
                        value="deleteService/{serviceClassName}/{serviceId}/{userName}/{sessionId}",
                        produces="application/json")
        public void deleteService​(@PathVariable("serviceClassName")
                                  String serviceClassName,
                                  @PathVariable("serviceId")
                                  String serviceId,
                                  @PathVariable("userName")
                                  String userName,
                                  @PathVariable("sessionId")
                                  String sessionId)
        Deletes a service.
        Specified by:
        deleteService in interface ServiceRestOpenApi
        Parameters:
        serviceClassName - Service class name.
        serviceId - Service id.
        userName - The user name of the session.
        sessionId - The session token id.
      • getCustomerPools

        @RequestMapping(method=GET,
                        value="getCustomerPools/{sessionId}",
                        produces="application/json")
        public List<InventoryObjectPool> getCustomerPools​(@PathVariable("sessionId")
                                                          String sessionId)
        Retrieves the list of customer pools.
        Specified by:
        getCustomerPools in interface ServiceRestOpenApi
        Parameters:
        sessionId - The session token id.
        Returns:
        A set of customer pools.
      • getCustomerPool

        @RequestMapping(method=GET,
                        value="getCustomerPool/{poolId}/{poolClassName}/{sessionId}",
                        produces="application/json")
        public InventoryObjectPool getCustomerPool​(@PathVariable("poolId")
                                                   String poolId,
                                                   @PathVariable("poolClassName")
                                                   String poolClassName,
                                                   @PathVariable("sessionId")
                                                   String sessionId)
        Gets a customer pool.
        Specified by:
        getCustomerPool in interface ServiceRestOpenApi
        Parameters:
        poolId - The pool id.
        poolClassName - The pool class name.
        sessionId - The session token id.
        Returns:
        The pool as a Pool object.
      • getAllCustomers

        @RequestMapping(method=POST,
                        value="getAllCustomers/{page}/{limit}/{sessionId}",
                        produces="application/json")
        public List<BusinessObjectLight> getAllCustomers​(@RequestBody(required=false)
                                                         HashMap<String,​String> filters,
                                                         @PathVariable("page")
                                                         long page,
                                                         @PathVariable("limit")
                                                         long limit,
                                                         @PathVariable("sessionId")
                                                         String sessionId)
        Gets all the customer.
        Specified by:
        getAllCustomers in interface ServiceRestOpenApi
        Parameters:
        filters - Map of filters key: attribute name, value: attribute value.
        page - Page or number of elements to skip.
        limit - Max count of child per page.
        sessionId - The session token id.
        Returns:
        The customers list.
      • getCustomersInPool

        @RequestMapping(method=GET,
                        value="getCustomersInPool/{poolId}/{customerClassName}/{page}/{limit}/{sessionId}",
                        produces="application/json")
        public List<BusinessObjectLight> getCustomersInPool​(@PathVariable("poolId")
                                                            String poolId,
                                                            @PathVariable("customerClassName")
                                                            String customerClassName,
                                                            @PathVariable("page")
                                                            int page,
                                                            @PathVariable("limit")
                                                            int limit,
                                                            @PathVariable("sessionId")
                                                            String sessionId)
        Retrieves the list of customers from a pool.
        Specified by:
        getCustomersInPool in interface ServiceRestOpenApi
        Parameters:
        poolId - Parent pool id.
        customerClassName - A given className to retrieve a set of objects of that className form the pool used when the pool is a Generic class and could have objects of different class. Use "null" to get all.
        page - The number of values of the result to skip or the page 0 to avoid.
        limit - The results limit. Per page 0 to avoid the limit.
        sessionId - The session token id.
        Returns:
        The list of customers inside the pool.
      • getCustomer

        @RequestMapping(method=GET,
                        value="getCustomer/{customerClassName}/{customerId}/{sessionId}",
                        produces="application/json")
        public BusinessObject getCustomer​(@PathVariable("customerClassName")
                                          String customerClassName,
                                          @PathVariable("customerId")
                                          String customerId,
                                          @PathVariable("sessionId")
                                          String sessionId)
        Gets the detailed information about a customer.
        Specified by:
        getCustomer in interface ServiceRestOpenApi
        Parameters:
        customerClassName - Customer class name.
        customerId - Customer id.
        sessionId - The session token id.
        Returns:
        A detailed representation of the requested customer.
      • getServicePoolsInCostumer

        @RequestMapping(method=GET,
                        value="getServicePoolsInCostumer/{customerClassName}/{customerId}/{servicePoolClassName}/{sessionId}",
                        produces="application/json")
        public List<InventoryObjectPool> getServicePoolsInCostumer​(@PathVariable("customerClassName")
                                                                   String customerClassName,
                                                                   @PathVariable("customerId")
                                                                   String customerId,
                                                                   @PathVariable("servicePoolClassName")
                                                                   String servicePoolClassName,
                                                                   @PathVariable("sessionId")
                                                                   String sessionId)
        Retrieves the pools associated to a particular customer.
        Specified by:
        getServicePoolsInCostumer in interface ServiceRestOpenApi
        Parameters:
        customerClassName - The parent customer class name.
        customerId - The parent customer id.
        servicePoolClassName - The class name used to filter the results.
        sessionId - The session token id.
        Returns:
        A set of service pools.
      • getServicePool

        @RequestMapping(method=GET,
                        value="getServicePool/{poolId}/{poolClassName}/{sessionId}",
                        produces="application/json")
        public InventoryObjectPool getServicePool​(@PathVariable("poolId")
                                                  String poolId,
                                                  @PathVariable("poolClassName")
                                                  String poolClassName,
                                                  @PathVariable("sessionId")
                                                  String sessionId)
        Gets a service pool.
        Specified by:
        getServicePool in interface ServiceRestOpenApi
        Parameters:
        poolId - The pool id.
        poolClassName - The pool class name.
        sessionId - The session token id.
        Returns:
        The pool as a Pool object.
      • getAllServices

        @RequestMapping(method=POST,
                        value="getAllServices/{page}/{limit}/{sessionId}",
                        produces="application/json")
        public List<BusinessObjectLight> getAllServices​(@RequestBody(required=false)
                                                        HashMap<String,​String> filters,
                                                        @PathVariable("page")
                                                        long page,
                                                        @PathVariable("limit")
                                                        long limit,
                                                        @PathVariable("sessionId")
                                                        String sessionId)
        Gets all the services.
        Specified by:
        getAllServices in interface ServiceRestOpenApi
        Parameters:
        filters - Map of filters key: attribute name, value: attribute value.
        page - Page or number of elements to skip.
        limit - Max count of child per page.
        sessionId - The session token id.
        Returns:
        The services list.
      • getServicesInPool

        @RequestMapping(method=GET,
                        value="getServicesInPool/{poolId}/{serviceClassName}/{page}/{limit}/{sessionId}",
                        produces="application/json")
        public List<BusinessObjectLight> getServicesInPool​(@PathVariable("poolId")
                                                           String poolId,
                                                           @PathVariable("serviceClassName")
                                                           String serviceClassName,
                                                           @PathVariable("page")
                                                           int page,
                                                           @PathVariable("limit")
                                                           int limit,
                                                           @PathVariable("sessionId")
                                                           String sessionId)
        Retrieves the list of services from a pool.
        Specified by:
        getServicesInPool in interface ServiceRestOpenApi
        Parameters:
        poolId - Parent pool id.
        serviceClassName - A given className to retrieve a set of objects of that className form the pool used when the pool is a Generic class and could have objects of different class. Use "null" to get all.
        page - The number of values of the result to skip or the page 0 to avoid.
        limit - The results limit. Per page 0 to avoid the limit.
        sessionId - The session token id.
        Returns:
        The list of services inside the pool.
      • getService

        @RequestMapping(method=GET,
                        value="getService/{serviceClassName}/{serviceId}/{sessionId}",
                        produces="application/json")
        public BusinessObject getService​(@PathVariable("serviceClassName")
                                         String serviceClassName,
                                         @PathVariable("serviceId")
                                         String serviceId,
                                         @PathVariable("sessionId")
                                         String sessionId)
        Gets the detailed information about a service.
        Specified by:
        getService in interface ServiceRestOpenApi
        Parameters:
        serviceClassName - Service class name.
        serviceId - Service id.
        sessionId - The session token id.
        Returns:
        A detailed representation of the requested service.
      • getObjectsRelatedToService

        @RequestMapping(method=GET,
                        value="getObjectsRelatedToService/{serviceClassName}/{serviceId}/{sessionId}",
                        produces="application/json")
        public List<BusinessObjectLight> getObjectsRelatedToService​(@PathVariable("serviceClassName")
                                                                    String serviceClassName,
                                                                    @PathVariable("serviceId")
                                                                    String serviceId,
                                                                    @PathVariable("sessionId")
                                                                    String sessionId)
        Retrieves the objects related to service.
        Specified by:
        getObjectsRelatedToService in interface ServiceRestOpenApi
        Parameters:
        serviceClassName - The service class name.
        serviceId - The service id.
        sessionId - The session token id.
        Returns:
        A list of objects related to service.
      • relateObjectToService

        @RequestMapping(method=PUT,
                        value="relateObjectToService/{objectClassName}/{objectId}/{serviceClassName}/{serviceId}/{userName}/{sessionId}",
                        produces="application/json")
        public void relateObjectToService​(@PathVariable("objectClassName")
                                          String objectClassName,
                                          @PathVariable("objectId")
                                          String objectId,
                                          @PathVariable("serviceClassName")
                                          String serviceClassName,
                                          @PathVariable("serviceId")
                                          String serviceId,
                                          @PathVariable("userName")
                                          String userName,
                                          @PathVariable("sessionId")
                                          String sessionId)
        Relates an inventory object (resource) to a service.
        Specified by:
        relateObjectToService in interface ServiceRestOpenApi
        Parameters:
        objectClassName - The class name of the object.
        objectId - The id of the object.
        serviceClassName - The class name of the service.
        serviceId - The id of the service.
        userName - The user name of the session.
        sessionId - The session token id.
      • relateObjectsToService

        @RequestMapping(method=PUT,
                        value="relateObjectsToService/{objectsClassNames}/{objectsIds}/{serviceClassName}/{serviceId}/{userName}/{sessionId}",
                        produces="application/json")
        public void relateObjectsToService​(@PathVariable("objectsClassNames")
                                           String[] objectsClassNames,
                                           @PathVariable("objectsIds")
                                           String[] objectsIds,
                                           @PathVariable("serviceClassName")
                                           String serviceClassName,
                                           @PathVariable("serviceId")
                                           String serviceId,
                                           @PathVariable("userName")
                                           String userName,
                                           @PathVariable("sessionId")
                                           String sessionId)
        Relates inventory objects (resources) to a service.
        Specified by:
        relateObjectsToService in interface ServiceRestOpenApi
        Parameters:
        objectsClassNames - The class names of the objects.
        objectsIds - The ids of the objects.
        serviceClassName - The class name of the service.
        serviceId - The id of the service.
        userName - The user name of the session.
        sessionId - The session token id.
      • releaseObjectFromService

        @RequestMapping(method=PUT,
                        value="releaseObjectFromService/{serviceClassName}/{serviceId}/{objectId}/{userName}/{sessionId}",
                        produces="application/json")
        public void releaseObjectFromService​(@PathVariable("serviceClassName")
                                             String serviceClassName,
                                             @PathVariable("serviceId")
                                             String serviceId,
                                             @PathVariable("objectId")
                                             String objectId,
                                             @PathVariable("userName")
                                             String userName,
                                             @PathVariable("sessionId")
                                             String sessionId)
        Releases an inventory object from a service.
        Specified by:
        releaseObjectFromService in interface ServiceRestOpenApi
        Parameters:
        serviceClassName - The class name of the service.
        serviceId - The id of the service.
        objectId - The id of the object.
        userName - The user name of the session.
        sessionId - The session token id.