Class ContractRestController
- java.lang.Object
-
- org.neotropic.kuwaiba.northbound.rest.services.ContractRestController
-
- All Implemented Interfaces:
ContractRestOpenApi
@RestController @RequestMapping("/v2.1.1/contract-manager/") public class ContractRestController extends Object implements ContractRestOpenApi
Contract Manager Rest Controller.- Author:
- Mauricio Ruiz Beltrán <mauricio.ruiz@kuwaiba.org>
-
-
Constructor Summary
Constructors Constructor Description ContractRestController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
copyContractToPool(String poolId, String contractClassName, String contractId, String userName, String sessionId)
Creates a copy of a contract.String
createContract(String poolId, String contractClassName, HashMap<String,String> attributes, String userName, String sessionId)
Creates a contract.String
createContractPool(String poolName, String poolDescription, String poolClassName, String userName, String sessionId)
Creates a contract pool.void
deleteContract(String contractClassName, String contractId, String userName, String sessionId)
Deletes a contract and delete its association with the related inventory objects.void
deleteContractPool(String poolId, String poolClassName, String userName, String sessionId)
Deletes a contract pool.List<BusinessObjectLight>
getAllContracts(long page, long limit, String sessionId)
Get all contracts, without filters.BusinessObject
getContract(String contractClassName, String contractId, String sessionId)
Get contract properties.InventoryObjectPool
getContractPool(String poolId, String poolClassName, String sessionId)
Gets the contract pools properties.List<InventoryObjectPool>
getContractPools(String sessionId)
Gets the contract pools properties.List<BusinessObjectLight>
getContractResources(String contractClassName, String contractId, String sessionId)
Gets the resources related to a contract.List<BusinessObjectLight>
getContractsInPool(String poolId, int limit, String sessionId)
Gets the contracts inside a contract pool.void
moveContractToPool(String poolId, String contractClassName, String contractId, String userName, String sessionId)
Moves a contract from a pool to another pool.void
relateObjectsToContract(String contractClassName, String contractId, String[] objectsClassNames, String[] objectsIds, String userName, String sessionId)
Relates a set of objects to a contract.void
relateObjectToContract(String contractClassName, String contractId, String objectClassName, String objectId, String userName, String sessionId)
Relates an object to a contract.void
releaseObjectFromContract(String objectClassName, String objectId, String contractClassName, String contractId, String userName, String sessionId)
Releases an object from contract.void
updateContract(String contractClassName, String contractId, HashMap<String,String> attributes, String userName, String sessionId)
Updates one or many contract attributes.void
updateContractPool(String poolId, String poolClassName, String poolName, String poolDescription, String userName, String sessionId)
Updates the attributes of a contract pool.
-
-
-
Field Detail
-
PATH
public static final String PATH
Path that includes the Kuwaiba version and module- See Also:
- Constant Field Values
-
-
Method Detail
-
createContractPool
@RequestMapping(method=POST, value="createContractPool/{poolName}/{poolDescription}/{poolClassName}/{userName}/{sessionId}", produces="application/json") public String createContractPool(@PathVariable("poolName") String poolName, @PathVariable("poolDescription") String poolDescription, @PathVariable("poolClassName") String poolClassName, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Creates a contract pool.- Specified by:
createContractPool
in interfaceContractRestOpenApi
- Parameters:
poolName
- The pool name.poolDescription
- The pool description.poolClassName
- The pool class. What kind of objects can this pool contain? Must be subclass of GenericContract.userName
- The user name of the session.sessionId
- The session token id.- Returns:
- The id of the newly created contract pool.
-
updateContractPool
@RequestMapping(method=PUT, value="updateContractPool/{poolId}/{poolClassName}/{poolName}/{poolDescription}/{userName}/{sessionId}", produces="application/json") public void updateContractPool(@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 the attributes of a contract pool.- Specified by:
updateContractPool
in interfaceContractRestOpenApi
- Parameters:
poolId
- The id of the pool to be updated.poolClassName
- The pool class name.poolName
- The attribute value for pool name.poolDescription
- The attribute value for pool description.userName
- The user name of the session.sessionId
- The session token id.
-
deleteContractPool
@RequestMapping(method=DELETE, value="deleteContractPool/{poolId}/{poolClassName}/{userName}/{sessionId}", produces="application/json") public void deleteContractPool(@PathVariable("poolId") String poolId, @PathVariable("poolClassName") String poolClassName, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Deletes a contract pool.- Specified by:
deleteContractPool
in interfaceContractRestOpenApi
- Parameters:
poolId
- The pool id.poolClassName
- The pool class name.userName
- The user name of the session.sessionId
- The session token id.
-
getContractPools
@RequestMapping(method=GET, value="getContractPools/{sessionId}", produces="application/json") public List<InventoryObjectPool> getContractPools(@PathVariable("sessionId") String sessionId)
Gets the contract pools properties.- Specified by:
getContractPools
in interfaceContractRestOpenApi
- Parameters:
sessionId
- The session token id.- Returns:
- The pools properties.
-
getContractPool
@RequestMapping(method=GET, value="getContractPool/{poolId}/{poolClassName}/{sessionId}", produces="application/json") public InventoryObjectPool getContractPool(@PathVariable("poolId") String poolId, @PathVariable("poolClassName") String poolClassName, @PathVariable("sessionId") String sessionId)
Gets the contract pools properties.- Specified by:
getContractPool
in interfaceContractRestOpenApi
- Parameters:
poolId
- The pool id.poolClassName
- The pool class name.sessionId
- The session token id.- Returns:
- The pool properties.
-
createContract
@RequestMapping(method=POST, value="createContract/{poolId}/{contractClassName}/{userName}/{sessionId}", produces="application/json") public String createContract(@PathVariable("poolId") String poolId, @PathVariable("contractClassName") String contractClassName, @RequestBody(required=false) HashMap<String,String> attributes, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Creates a contract.- Specified by:
createContract
in interfaceContractRestOpenApi
- Parameters:
poolId
- The contract pool id.contractClassName
- The contract class name. Must be subclass of GenericContract.attributes
- The set of initial attributes. If no attribute name is specified, an empty string will be used.userName
- The user name of the session.sessionId
- The session token id.- Returns:
- The id of the newly created contract.
-
updateContract
@RequestMapping(method=PUT, value="updateContract/{contractClassName}/{contractId}/{userName}/{sessionId}", produces="application/json") public void updateContract(@PathVariable("contractClassName") String contractClassName, @PathVariable("contractId") String contractId, @RequestBody(required=false) HashMap<String,String> attributes, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Updates one or many contract attributes.- Specified by:
updateContract
in interfaceContractRestOpenApi
- Parameters:
contractClassName
- The contract class name.contractId
- The contract id.attributes
- The set of initial attributes. If no attribute name is specified, an empty string will be used.userName
- The user name of the session.sessionId
- The session token id.
-
deleteContract
@RequestMapping(method=DELETE, value="deleteContract/{contractClassName}/{contractId}/{userName}/{sessionId}", produces="application/json") public void deleteContract(@PathVariable("contractClassName") String contractClassName, @PathVariable("contractId") String contractId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Deletes a contract and delete its association with the related inventory objects. These objects will remain untouched.- Specified by:
deleteContract
in interfaceContractRestOpenApi
- Parameters:
contractClassName
- The contract class name.contractId
- The contract id.userName
- The user name of the session.sessionId
- The session token id.
-
getAllContracts
@RequestMapping(method=GET, value="getAllContracts/{page}/{limit}/{sessionId}", produces="application/json") public List<BusinessObjectLight> getAllContracts(@PathVariable("page") long page, @PathVariable("limit") long limit, @PathVariable("sessionId") String sessionId)
Get all contracts, without filters.- Specified by:
getAllContracts
in interfaceContractRestOpenApi
- Parameters:
page
- Page number of results to skip. Use -1 to retrieve all.limit
- Max number of results per page. Use -1 to retrieve all.sessionId
- The session token id.- Returns:
- The contracts list.
-
getContractsInPool
@RequestMapping(method=GET, value="getContractsInPool/{poolId}/{limit}/{sessionId}", produces="application/json") public List<BusinessObjectLight> getContractsInPool(@PathVariable("poolId") String poolId, @PathVariable("limit") int limit, @PathVariable("sessionId") String sessionId)
Gets the contracts inside a contract pool.- Specified by:
getContractsInPool
in interfaceContractRestOpenApi
- Parameters:
poolId
- The pool id.limit
- The results limit per page. Use -1 to retrieve all.sessionId
- The session token id.- Returns:
- The contracts list.
-
getContract
@RequestMapping(method=GET, value="getContract/{contractClassName}/{contractId}/{sessionId}", produces="application/json") public BusinessObject getContract(@PathVariable("contractClassName") String contractClassName, @PathVariable("contractId") String contractId, @PathVariable("sessionId") String sessionId)
Get contract properties.- Specified by:
getContract
in interfaceContractRestOpenApi
- Parameters:
contractClassName
- The contract class name. Must be subclass of GenericContract.contractId
- The contract id.sessionId
- The session token id.- Returns:
- The contract properties.
-
relateObjectsToContract
@RequestMapping(method=PUT, value="relateObjectsToContract/{contractClassName}/{contractId}/{objectsClassNames}/{objectsIds}/{userName}/{sessionId}", produces="application/json") public void relateObjectsToContract(@PathVariable("contractClassName") String contractClassName, @PathVariable("contractId") String contractId, @PathVariable("objectsClassNames") String[] objectsClassNames, @PathVariable("objectsIds") String[] objectsIds, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Relates a set of objects to a contract.- Specified by:
relateObjectsToContract
in interfaceContractRestOpenApi
- Parameters:
contractClassName
- The contract class name.contractId
- The contract id.objectsClassNames
- The objects class names.objectsIds
- The objects ids.userName
- The user name of the session.sessionId
- The session token id.
-
relateObjectToContract
@RequestMapping(method=PUT, value="relateObjectToContract/{contractClassName}/{contractId}/{objectClassName}/{objectId}/{userName}/{sessionId}", produces="application/json") public void relateObjectToContract(@PathVariable("contractClassName") String contractClassName, @PathVariable("contractId") String contractId, @PathVariable("objectClassName") String objectClassName, @PathVariable("objectId") String objectId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Relates an object to a contract.- Specified by:
relateObjectToContract
in interfaceContractRestOpenApi
- Parameters:
contractClassName
- The contract class name.contractId
- The contract id.objectClassName
- The object class name.objectId
- The object id.userName
- The user name of the session.sessionId
- The session token id.
-
releaseObjectFromContract
@RequestMapping(method=PUT, value="releaseObjectFromContract/{objectClassName}/{objectId}/{contractClassName}/{contractId}/{userName}/{sessionId}", produces="application/json") public void releaseObjectFromContract(@PathVariable("objectClassName") String objectClassName, @PathVariable("objectId") String objectId, @PathVariable("contractClassName") String contractClassName, @PathVariable("contractId") String contractId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Releases an object from contract.- Specified by:
releaseObjectFromContract
in interfaceContractRestOpenApi
- Parameters:
objectClassName
- The object class name.objectId
- The object id.contractClassName
- The contract class name.contractId
- The contract id.userName
- The user name of the session.sessionId
- The session token id.
-
getContractResources
@RequestMapping(method=GET, value="getContractResources/{contractClassName}/{contractId}/{sessionId}", produces="application/json") public List<BusinessObjectLight> getContractResources(@PathVariable("contractClassName") String contractClassName, @PathVariable("contractId") String contractId, @PathVariable("sessionId") String sessionId)
Gets the resources related to a contract.- Specified by:
getContractResources
in interfaceContractRestOpenApi
- Parameters:
contractClassName
- The contract class name.contractId
- The contract id.sessionId
- The session token id.- Returns:
- The contract resources list.
-
copyContractToPool
@RequestMapping(method=PUT, value="copyContractToPool/{poolId}/{contractClassName}/{contractId}/{userName}/{sessionId}", produces="application/json") public String copyContractToPool(@PathVariable("poolId") String poolId, @PathVariable("contractClassName") String contractClassName, @PathVariable("contractId") String contractId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Creates a copy of a contract.- Specified by:
copyContractToPool
in interfaceContractRestOpenApi
- Parameters:
poolId
- The pool id.contractClassName
- The contract class name.contractId
- The contract id.userName
- The user name of the session.sessionId
- The session token id.- Returns:
- The newly created contract id.
-
moveContractToPool
@RequestMapping(method=PUT, value="moveContractToPool/{poolId}/{contractClassName}/{contractId}/{userName}/{sessionId}", produces="application/json") public void moveContractToPool(@PathVariable("poolId") String poolId, @PathVariable("contractClassName") String contractClassName, @PathVariable("contractId") String contractId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Moves a contract from a pool to another pool.- Specified by:
moveContractToPool
in interfaceContractRestOpenApi
- Parameters:
poolId
- The pool id.contractClassName
- The contract class name.contractId
- The contract id.userName
- The user name of the session.sessionId
- The session token id.
-
-