Class ServiceManagerService
- java.lang.Object
-
- org.neotropic.kuwaiba.modules.optional.serviceman.ServiceManagerService
-
@Service public class ServiceManagerService extends Object
Service to manage services.- Author:
- Mauricio Ruiz Beltran <mauricio.ruiz@kuwaiba.org>
-
-
Constructor Summary
Constructors Constructor Description ServiceManagerService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
associateObjectToService(String objectClass, String objectId, String serviceClass, String serviceId, String userName)
Associates an inventory object to a service.String
createCustomer(String poolId, String customerClass, HashMap<String,String> attributes, String userName)
Creates a customer.String
createCustomerPool(String poolName, String poolDescription, String userName)
Creates a customer pool.String
createService(String poolId, String serviceClass, HashMap<String,String> attributes, String userName)
Creates a service.String
createServicePool(String customerClass, String customerId, String poolName, String poolDescription, String userName)
Creates a service pool.void
deleteCostumer(String customerClass, String customerId, String userName)
Deletes a customervoid
deleteCustomerPool(String poolId, String poolClass, String userName)
Deletes a customer pool.void
deleteService(String serviceClass, String serviceId, String userName)
Deletes a service.void
deleteServicePool(String poolId, String poolClass, String userName)
Deletes a service pool.List<BusinessObjectLight>
getAllCustomers(HashMap<String,String> filters, long page, long limit)
Gets all the customer.List<BusinessObjectLight>
getAllServices(HashMap<String,String> filters, long page, long limit)
Gets all the services.BusinessObject
getCustomer(String customerClass, String customerId)
Gets the detailed information about a customer.InventoryObjectPool
getCustomerPool(String poolId, String poolClass)
Gets a customer poolList<InventoryObjectPool>
getCustomerPools()
Retrieves the list of customer pools.List<BusinessObjectLight>
getCustomersInPool(String poolId, String className, int page, int limit)
Retrieves the list of customers from a poolList<BusinessObjectLight>
getObjectsRelatedToService(String serviceClass, String serviceId)
Retrieves the objects related to serviceBusinessObject
getService(String serviceClass, String serviceId)
Gets the detailed information about a service.InventoryObjectPool
getServicePool(String poolId, String poolClass)
Gets a service pool.List<InventoryObjectPool>
getServicePoolsInCostumer(String customerClass, String customerId, String servicePoolClass)
Retrieves the pools associated to a particular customerList<BusinessObjectLight>
getServicesInPool(String poolId, String className, int page, int limit)
Retrieves the list of services from a poolvoid
releaseObjectFromService(String serviceClass, String serviceId, String objectId, String userName)
Releases an inventory object from a service.void
updateCustomer(String customerClass, String customerId, HashMap<String,String> attributes, String userName)
Updates a customer.void
updateCustomerPool(String poolId, String poolClass, String poolName, String poolDescription, String userName)
Updates a customer pool.void
updateService(String serviceClass, String serviceId, HashMap<String,String> attributes, String userName)
Updates a service.void
updateServicePool(String poolId, String poolClass, String poolName, String poolDescription, String userName)
Updates a service pool.
-
-
-
Method Detail
-
createCustomerPool
public String createCustomerPool(String poolName, String poolDescription, String userName) throws MetadataObjectNotFoundException, ApplicationObjectNotFoundException, BusinessObjectNotFoundException
Creates a customer pool.- Parameters:
poolName
- The pool name.poolDescription
- The pool description.userName
- The user name of the session.- Returns:
- The id newly created customer pool.
- Throws:
MetadataObjectNotFoundException
- If instancesOfClass is not a valid subclass of InventoryObjectApplicationObjectNotFoundException
- If the object activity log could no be foundBusinessObjectNotFoundException
-
getCustomerPools
public List<InventoryObjectPool> getCustomerPools() throws InvalidArgumentException
Retrieves the list of customer pools.- Returns:
- A set of customer pools.
- Throws:
InvalidArgumentException
- If a customer pool does not have the uuid.
-
getCustomerPool
public InventoryObjectPool getCustomerPool(String poolId, String poolClass) throws ApplicationObjectNotFoundException, InvalidArgumentException
Gets a customer pool- Parameters:
poolId
- The pool id.poolClass
- The pool class.- Returns:
- The pool as a Pool object
- Throws:
ApplicationObjectNotFoundException
- If the pool could not be foundInvalidArgumentException
- If the pool id is null or the result pool does not have uuid
-
updateCustomerPool
public void updateCustomerPool(String poolId, String poolClass, String poolName, String poolDescription, String userName) throws ApplicationObjectNotFoundException
Updates a customer pool.- Parameters:
poolId
- The pool id.poolClass
- The pool class.poolName
- The pool name.poolDescription
- The pool description.userName
- The user name of the session.- Throws:
ApplicationObjectNotFoundException
- If any of the pools to be updated couldn't be found.
-
deleteCustomerPool
public void deleteCustomerPool(String poolId, String poolClass, String userName) throws ApplicationObjectNotFoundException, OperationNotPermittedException
Deletes a customer pool.- Parameters:
poolId
- The pool id.poolClass
- The pool class.userName
- The user name of the session.- Throws:
ApplicationObjectNotFoundException
- If any of the pools to be deleted couldn't be found.OperationNotPermittedException
- If any of the objects in the pool can not be deleted because it's not a business related instance (it's more a security restriction).
-
createCustomer
public String createCustomer(String poolId, String customerClass, HashMap<String,String> attributes, String userName) throws ApplicationObjectNotFoundException, InvalidArgumentException, MetadataObjectNotFoundException
Creates a customer.- Parameters:
poolId
- Parent pool id.customerClass
- This customer is going to be instance ofattributes
- The list of attributes to be set initially. The values are serialized objects.userName
- The user name of the session.- Returns:
- The id newly created customer.
- Throws:
ApplicationObjectNotFoundException
- If the parent pool can't be found.InvalidArgumentException
- If any of the attributes or its type is invalid.MetadataObjectNotFoundException
- If the class name could not be found.
-
getAllCustomers
public List<BusinessObjectLight> getAllCustomers(HashMap<String,String> filters, long page, long limit) throws InvalidArgumentException, MetadataObjectNotFoundException
Gets all the customer.- Parameters:
filters
- map of filters key: attribute name, value: attribute valuepage
- page or number of elements to skiplimit
- max count of child per page- Returns:
- The customers list.
- Throws:
InvalidArgumentException
- If the class name is nullMetadataObjectNotFoundException
- If the provided class name doesn't exists
-
getCustomersInPool
public List<BusinessObjectLight> getCustomersInPool(String poolId, String className, int page, int limit) throws ApplicationObjectNotFoundException, InvalidArgumentException
Retrieves the list of customers from a pool- Parameters:
poolId
- Parent pool idclassName
- 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 classpage
- the number of values of the result to skip or the page 0 to avoidlimit
- the results limit. per page 0 to avoid the limit- Returns:
- The list of customers inside the pool
- Throws:
ApplicationObjectNotFoundException
- If the pool id provided is not validInvalidArgumentException
- If the pool item is an inventory object and it does not have the uuid
-
getCustomer
public BusinessObject getCustomer(String customerClass, String customerId) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Gets the detailed information about a customer.- Parameters:
customerClass
- Customer class name.customerId
- Customer id.- Returns:
- A detailed representation of the requested customer.
- Throws:
MetadataObjectNotFoundException
- If the className class can't be found.BusinessObjectNotFoundException
- If the requested object can't be found.InvalidArgumentException
- If the object id can not be found.
-
updateCustomer
public void updateCustomer(String customerClass, String customerId, HashMap<String,String> attributes, String userName) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, OperationNotPermittedException, InvalidArgumentException, ApplicationObjectNotFoundException
Updates a customer.- Parameters:
customerClass
- 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.- Throws:
MetadataObjectNotFoundException
- If the object class can't be found.BusinessObjectNotFoundException
- If the object can't be found.OperationNotPermittedException
- If the update can't be performed due a business rule or because the object is blocked.InvalidArgumentException
- If any of the names provided does not exist or can't be set using this method or of the value.ApplicationObjectNotFoundException
- If the log root node could not be found.
-
deleteCostumer
public void deleteCostumer(String customerClass, String customerId, String userName) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, OperationNotPermittedException, InvalidArgumentException, ApplicationObjectNotFoundException
Deletes a customer- Parameters:
customerClass
- Customer class name.customerId
- Customer id.userName
- The user name of the session.- Throws:
BusinessObjectNotFoundException
- If the object couldn't be found.MetadataObjectNotFoundException
- If the class could not be found.OperationNotPermittedException
- If the object could not be deleted because there's some business rules that avoids it or it has incoming relationships.InvalidArgumentException
- If the id is null.ApplicationObjectNotFoundException
- If the log root node could not be found.
-
createServicePool
public String createServicePool(String customerClass, String customerId, String poolName, String poolDescription, String userName) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, ApplicationObjectNotFoundException
Creates a service pool.- Parameters:
customerClass
- Customer class name.customerId
- Customer id.poolName
- The service pool name.poolDescription
- The service pool description.userName
- The user name of the session.- Returns:
- The id newly created service pool.
- Throws:
MetadataObjectNotFoundException
- If instancesOfClass is not a valid subclass of InventoryObject.BusinessObjectNotFoundException
- If the parent object can not be found.ApplicationObjectNotFoundException
- If the log root node could not be found.
-
getServicePoolsInCostumer
public List<InventoryObjectPool> getServicePoolsInCostumer(String customerClass, String customerId, String servicePoolClass) throws BusinessObjectNotFoundException, InvalidArgumentException, MetadataObjectNotFoundException, ApplicationObjectNotFoundException
Retrieves the pools associated to a particular customer- Parameters:
customerClass
- The parent customer class namecustomerId
- The parent customer idservicePoolClass
- The class name used to filter the results.- Returns:
- A set of service pools
- Throws:
BusinessObjectNotFoundException
InvalidArgumentException
MetadataObjectNotFoundException
ApplicationObjectNotFoundException
-
getServicePool
public InventoryObjectPool getServicePool(String poolId, String poolClass) throws ApplicationObjectNotFoundException, InvalidArgumentException
Gets a service pool.- Parameters:
poolId
- The pool id.poolClass
- The pool class.- Returns:
- The pool as a Pool object.
- Throws:
ApplicationObjectNotFoundException
- If the pool could not be found.InvalidArgumentException
- If the pool id is null or the result pool does not have uuid.
-
updateServicePool
public void updateServicePool(String poolId, String poolClass, String poolName, String poolDescription, String userName) throws ApplicationObjectNotFoundException
Updates a service pool.- Parameters:
poolId
- The pool id.poolClass
- The pool class.poolName
- The pool name.poolDescription
- The pool description.userName
- The user name of the session.- Throws:
ApplicationObjectNotFoundException
- If any of the pools to be updated couldn't be found.
-
deleteServicePool
public void deleteServicePool(String poolId, String poolClass, String userName) throws ApplicationObjectNotFoundException, OperationNotPermittedException
Deletes a service pool.- Parameters:
poolId
- The pool id.poolClass
- The pool class.userName
- The user name of the session.- Throws:
ApplicationObjectNotFoundException
- If any of the pools to be deleted couldn't be found.OperationNotPermittedException
- If any of the objects in the pool can not be deleted because it's not a business related instance (it's more a security restriction).
-
createService
public String createService(String poolId, String serviceClass, HashMap<String,String> attributes, String userName) throws ApplicationObjectNotFoundException, InvalidArgumentException, MetadataObjectNotFoundException
Creates a service.- Parameters:
poolId
- Parent pool id.serviceClass
- This service is going to be instance ofattributes
- The list of attributes to be set initially. The values are serialized objects.userName
- The user name of the session.- Returns:
- The id newly created service.
- Throws:
ApplicationObjectNotFoundException
- If the parent pool can't be found.InvalidArgumentException
- If any of the attributes or its type is invalid.MetadataObjectNotFoundException
- If the class name could not be found.
-
getAllServices
public List<BusinessObjectLight> getAllServices(HashMap<String,String> filters, long page, long limit) throws InvalidArgumentException, MetadataObjectNotFoundException
Gets all the services.- Parameters:
filters
- map of filters key: attribute name, value: attribute valuepage
- page or number of elements to skiplimit
- max count of child per page- Returns:
- The services list.
- Throws:
InvalidArgumentException
- If the class name is nullMetadataObjectNotFoundException
- If the provided class name doesn't exists
-
getServicesInPool
public List<BusinessObjectLight> getServicesInPool(String poolId, String className, int page, int limit) throws ApplicationObjectNotFoundException, InvalidArgumentException
Retrieves the list of services from a pool- Parameters:
poolId
- Parent pool idclassName
- 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 classpage
- the number of values of the result to skip or the page 0 to avoidlimit
- the results limit. per page 0 to avoid the limit- Returns:
- The list of services inside the pool
- Throws:
ApplicationObjectNotFoundException
- If the pool id provided is not validInvalidArgumentException
- If the pool item is an inventory object and it does not have the uuid
-
getService
public BusinessObject getService(String serviceClass, String serviceId) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Gets the detailed information about a service.- Parameters:
serviceClass
- Service class name.serviceId
- Service id.- Returns:
- A detailed representation of the requested customer.
- Throws:
MetadataObjectNotFoundException
- If the className class can't be found.BusinessObjectNotFoundException
- If the requested object can't be found.InvalidArgumentException
- If the object id can not be found.
-
updateService
public void updateService(String serviceClass, String serviceId, HashMap<String,String> attributes, String userName) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, OperationNotPermittedException, InvalidArgumentException, ApplicationObjectNotFoundException
Updates a service.- Parameters:
serviceClass
- 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.- Throws:
MetadataObjectNotFoundException
- If the object class can't be found.BusinessObjectNotFoundException
- If the object can't be found.OperationNotPermittedException
- If the update can't be performed due a business rule or because the object is blocked.InvalidArgumentException
- If any of the names provided does not exist or can't be set using this method or of the value.ApplicationObjectNotFoundException
- If the log root node could not be found.
-
deleteService
public void deleteService(String serviceClass, String serviceId, String userName) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, OperationNotPermittedException, InvalidArgumentException, ApplicationObjectNotFoundException
Deletes a service.- Parameters:
serviceClass
- Service class name.serviceId
- Service id.userName
- The user name of the session.- Throws:
BusinessObjectNotFoundException
- If the object couldn't be found.MetadataObjectNotFoundException
- If the class could not be found.OperationNotPermittedException
- If the object could not be deleted because there's some business rules that avoids it or it has incoming relationships.InvalidArgumentException
- If the id is null.ApplicationObjectNotFoundException
- If the log root node could not be found.
-
associateObjectToService
public void associateObjectToService(String objectClass, String objectId, String serviceClass, String serviceId, String userName) throws BusinessObjectNotFoundException, OperationNotPermittedException, MetadataObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Associates an inventory object to a service.- Parameters:
objectClass
- The class of the object.objectId
- The id of the object.serviceClass
- The class of the service.serviceId
- The id of the service.userName
- The user name of the session.- Throws:
BusinessObjectNotFoundException
- If any of the objects can't be foundOperationNotPermittedException
- if any of the objects involved can't be connected (i.e. if it's not an inventory object)MetadataObjectNotFoundException
- if any of the classes provided can not be foundInvalidArgumentException
- If the a/b Object Id are nullApplicationObjectNotFoundException
- If the object activity log could no be found.
-
releaseObjectFromService
public void releaseObjectFromService(String serviceClass, String serviceId, String objectId, String userName) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Releases an inventory object from a service.- Parameters:
serviceClass
- The class of the service.serviceId
- The id of the service.objectId
- The id of the object.userName
- The user name of the session.- Throws:
BusinessObjectNotFoundException
- If the object can not be found.MetadataObjectNotFoundException
- If the class can not be found.InvalidArgumentException
- If serviceId or objectId are null.ApplicationObjectNotFoundException
- If the object activity log could no be found.
-
getObjectsRelatedToService
public List<BusinessObjectLight> getObjectsRelatedToService(String serviceClass, String serviceId) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Retrieves the objects related to service- Parameters:
serviceClass
- The service class nameserviceId
- The service id- Returns:
- A list of objects related to service
- Throws:
BusinessObjectNotFoundException
- If the service can not be foundMetadataObjectNotFoundException
- If either the service class or the attribute can not be foundInvalidArgumentException
- If the service id is null
-
-