Class ProjectRestController
- java.lang.Object
-
- org.neotropic.kuwaiba.northbound.rest.services.ProjectRestController
-
- All Implemented Interfaces:
ProjectRestOpenApi
@RestController @RequestMapping("/v2.1.1/planning/projects/") public class ProjectRestController extends Object implements ProjectRestOpenApi
Projects Rest Controller.- Author:
- Mauricio Ruiz Beltrán <mauricio.ruiz@kuwaiba.org>
-
-
Constructor Summary
Constructors Constructor Description ProjectRestController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
copyProjectToPool(String poolId, String projectClassName, String projectId, String userName, String sessionId)
Creates a copy of a project.String
createActivity(String projectId, String projectClassName, String activityClassName, HashMap<String,String> attributes, String userName, String sessionId)
Creates an Activity inside a project.String
createProject(String projectPoolId, String projectClassName, HashMap<String,String> attributes, String userName, String sessionId)
Creates a project.String
createProjectPool(String poolName, String poolDescription, String poolClassName, String userName, String sessionId)
Creates a project pool.void
deleteActivity(String activityClassName, String activityId, boolean releaseRelationships, String userName, String sessionId)
Deletes an activity and delete its association with the related inventory objects.void
deleteProject(String projectClassName, String projectId, String userName, String sessionId)
Deletes a project and delete its association with the related inventory objects.void
deleteProjectPool(String poolId, String poolClassName, String userName, String sessionId)
Deletes a project pool.BusinessObject
getActivity(String activityClassName, String activityId, String sessionId)
Get activity properties.List<BusinessObjectLight>
getAllProjects(long page, long limit, String sessionId)
Get all projects, without filters.BusinessObject
getProject(String projectClassName, String projectId, String sessionId)
Get project properties.List<BusinessObjectLight>
getProjectActivities(String projectClassName, String projectId, String sessionId)
Gets the activities inside a project.InventoryObjectPool
getProjectPool(String poolId, String poolClassName, String sessionId)
Gets the project pools properties.List<InventoryObjectPool>
getProjectPools(String sessionId)
Retrieves the projects pool list.List<BusinessObjectLight>
getProjectResources(String projectClassName, String projectId, String sessionId)
Gets the resources related to a project.List<BusinessObjectLight>
getProjectsInPool(String poolId, int limit, String sessionId)
Gets the projects inside a project pool.List<BusinessObjectLight>
getProjectsRelatedToObject(String objectClassName, String objectId, String sessionId)
Gets the projects related to an object.List<BusinessObjectLight>
getProjectsWithFilter(HashMap<String,String> filters, long page, long limit, String sessionId)
Get the projects according to the filter value.void
moveProjectToPool(String poolId, String projectClassName, String projectId, String userName, String sessionId)
Moves a project from a pool to another pool.void
relateObjectsToProject(String projectClassName, String projectId, String[] objectsClassNames, String[] objectsIds, String userName, String sessionId)
Relates a set of objects to a project.void
relateObjectToProject(String projectClassName, String projectId, String objectClassName, String objectId, String userName, String sessionId)
Relates an object to a project.void
releaseObjectFromProject(String objectClassName, String objectId, String projectClassName, String projectId, String userName, String sessionId)
Releases an object from project.void
updateActivity(String activityClassName, String activityId, HashMap<String,String> attributes, String userName, String sessionId)
Updates one or many activity attributes.void
updateProject(String projectClassName, String projectId, HashMap<String,String> attributes, String userName, String sessionId)
Updates one or many project attributes.void
updateProjectPool(String poolId, String poolClassName, String poolName, String poolDescription, String userName, String sessionId)
Updates the attributes of a project pool.
-
-
-
Field Detail
-
PATH
public static final String PATH
Path that includes the Kuwaiba version and module- See Also:
- Constant Field Values
-
-
Method Detail
-
createProject
@RequestMapping(method=POST, value="createProject/{projectPoolId}/{projectClassName}/{userName}/{sessionId}", produces="application/json") public String createProject(@PathVariable("projectPoolId") String projectPoolId, @PathVariable("projectClassName") String projectClassName, @RequestBody(required=false) HashMap<String,String> attributes, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Creates a project.- Specified by:
createProject
in interfaceProjectRestOpenApi
- Parameters:
projectPoolId
- The project pool id.projectClassName
- The project class name. Must be subclass of GenericProject.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 project.
-
createProjectPool
@RequestMapping(method=POST, value="createProjectPool/{poolName}/{poolDescription}/{poolClassName}/{userName}/{sessionId}", produces="application/json") public String createProjectPool(@PathVariable("poolName") String poolName, @PathVariable("poolDescription") String poolDescription, @PathVariable("poolClassName") String poolClassName, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Creates a project pool.- Specified by:
createProjectPool
in interfaceProjectRestOpenApi
- Parameters:
poolName
- The pool name.poolDescription
- The pool description.poolClassName
- The pool class name. What kind of objects can this pool contain? Must be subclass of GenericProject.userName
- The user name of the session.sessionId
- The session token id.- Returns:
- The id of the newly created project pool.
-
createActivity
@RequestMapping(method=POST, value="createActivity/{projectId}/{projectClassName}/{activityClassName}/{userName}/{sessionId}", produces="application/json") public String createActivity(@PathVariable("projectId") String projectId, @PathVariable("projectClassName") String projectClassName, @PathVariable("activityClassName") String activityClassName, @RequestBody(required=false) HashMap<String,String> attributes, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Creates an Activity inside a project.- Specified by:
createActivity
in interfaceProjectRestOpenApi
- Parameters:
projectId
- The project id.projectClassName
- The project class name.activityClassName
- The activity class name. Must be subclass of GenericActivity.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 activity.
-
updateProject
@RequestMapping(method=PUT, value="updateProject/{projectClassName}/{projectId}/{userName}/{sessionId}", produces="application/json") public void updateProject(@PathVariable("projectClassName") String projectClassName, @PathVariable("projectId") String projectId, @RequestBody(required=false) HashMap<String,String> attributes, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Updates one or many project attributes.- Specified by:
updateProject
in interfaceProjectRestOpenApi
- Parameters:
projectClassName
- The project class name.projectId
- The project 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.
-
updateProjectPool
@RequestMapping(method=PUT, value="updateProjectPool/{poolId}/{poolClassName}/{poolName}/{poolDescription}/{userName}/{sessionId}", produces="application/json") public void updateProjectPool(@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 project pool.- Specified by:
updateProjectPool
in interfaceProjectRestOpenApi
- 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.
-
updateActivity
@RequestMapping(method=PUT, value="updateActivity/{activityClassName}/{activityId}/{userName}/{sessionId}", produces="application/json") public void updateActivity(@PathVariable("activityClassName") String activityClassName, @PathVariable("activityId") String activityId, @RequestBody(required=false) HashMap<String,String> attributes, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Updates one or many activity attributes.- Specified by:
updateActivity
in interfaceProjectRestOpenApi
- Parameters:
activityClassName
- The activity class name. Must be subclass of GenericActivity.activityId
- The activity 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.
-
deleteProject
@RequestMapping(method=DELETE, value="deleteProject/{projectClassName}/{projectId}/{userName}/{sessionId}", produces="application/json") public void deleteProject(@PathVariable("projectClassName") String projectClassName, @PathVariable("projectId") String projectId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Deletes a project and delete its association with the related inventory objects. These objects will remain untouched.- Specified by:
deleteProject
in interfaceProjectRestOpenApi
- Parameters:
projectClassName
- The project class name.projectId
- The project id.userName
- The user name of the session.sessionId
- The session token id.
-
deleteProjectPool
@RequestMapping(method=DELETE, value="deleteProjectPool/{poolId}/{poolClassName}/{userName}/{sessionId}", produces="application/json") public void deleteProjectPool(@PathVariable("poolId") String poolId, @PathVariable("poolClassName") String poolClassName, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Deletes a project pool.- Specified by:
deleteProjectPool
in interfaceProjectRestOpenApi
- Parameters:
poolId
- The pool id.poolClassName
- The pool class name.userName
- The user name of the session.sessionId
- The session token id.
-
deleteActivity
@RequestMapping(method=DELETE, value="deleteActivity/{activityClassName}/{activityId}/{releaseRelationships}/{userName}/{sessionId}", produces="application/json") public void deleteActivity(@PathVariable("activityClassName") String activityClassName, @PathVariable("activityId") String activityId, @PathVariable("releaseRelationships") boolean releaseRelationships, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Deletes an activity and delete its association with the related inventory objects. These objects will remain untouched.- Specified by:
deleteActivity
in interfaceProjectRestOpenApi
- Parameters:
activityClassName
- The activity class name. Must be subclass of GenericActivity.activityId
- The activity id.releaseRelationships
- Release of existing relationships.userName
- The user name of the session.sessionId
- The session token id.
-
getAllProjects
@RequestMapping(method=GET, value="getAllProjects/{page}/{limit}/{sessionId}", produces="application/json") public List<BusinessObjectLight> getAllProjects(@PathVariable("page") long page, @PathVariable("limit") long limit, @PathVariable("sessionId") String sessionId)
Get all projects, without filters.- Specified by:
getAllProjects
in interfaceProjectRestOpenApi
- 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 projects list.
-
getProjectsInPool
@RequestMapping(method=GET, value="getProjectsInPool/{poolId}/{limit}/{sessionId}", produces="application/json") public List<BusinessObjectLight> getProjectsInPool(@PathVariable("poolId") String poolId, @PathVariable("limit") int limit, @PathVariable("sessionId") String sessionId)
Gets the projects inside a project pool.- Specified by:
getProjectsInPool
in interfaceProjectRestOpenApi
- Parameters:
poolId
- The pool id.limit
- The results limit per page. Use -1 to retrieve all.sessionId
- The session token id.- Returns:
- The projects list.
-
getProjectsWithFilter
@RequestMapping(method=POST, value="getProjectsWithFilter/{page}/{limit}/{sessionId}", produces="application/json") public List<BusinessObjectLight> getProjectsWithFilter(@RequestBody HashMap<String,String> filters, @PathVariable("page") long page, @PathVariable("limit") long limit, @PathVariable("sessionId") String sessionId)
Get the projects according to the filter value.- Specified by:
getProjectsWithFilter
in interfaceProjectRestOpenApi
- 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 projects list.
-
getProjectsRelatedToObject
@RequestMapping(method=GET, value="getProjectsRelatedToObject/{objectClassName}/{objectId}/{sessionId}", produces="application/json") public List<BusinessObjectLight> getProjectsRelatedToObject(@PathVariable("objectClassName") String objectClassName, @PathVariable("objectId") String objectId, @PathVariable("sessionId") String sessionId)
Gets the projects related to an object.- Specified by:
getProjectsRelatedToObject
in interfaceProjectRestOpenApi
- Parameters:
objectClassName
- The object class name.objectId
- The object Id.sessionId
- The session token id.- Returns:
- The list projects related to an object.
-
getProjectResources
@RequestMapping(method=GET, value="getProjectResources/{projectClassName}/{projectId}/{sessionId}", produces="application/json") public List<BusinessObjectLight> getProjectResources(@PathVariable("projectClassName") String projectClassName, @PathVariable("projectId") String projectId, @PathVariable("sessionId") String sessionId)
Gets the resources related to a project.- Specified by:
getProjectResources
in interfaceProjectRestOpenApi
- Parameters:
projectClassName
- Project class name.projectId
- Project Id.sessionId
- The session token id.- Returns:
- The project resources list.
-
getProjectActivities
@RequestMapping(method=GET, value="getProjectActivities/{projectClassName}/{projectId}/{sessionId}", produces="application/json") public List<BusinessObjectLight> getProjectActivities(@PathVariable("projectClassName") String projectClassName, @PathVariable("projectId") String projectId, @PathVariable("sessionId") String sessionId)
Gets the activities inside a project.- Specified by:
getProjectActivities
in interfaceProjectRestOpenApi
- Parameters:
projectClassName
- The project class name.projectId
- The project Id.sessionId
- The session token id.- Returns:
- The activities list.
-
getProjectPools
@RequestMapping(method=GET, value="getProjectPools/{sessionId}", produces="application/json") public List<InventoryObjectPool> getProjectPools(@PathVariable("sessionId") String sessionId)
Retrieves the projects pool list.- Specified by:
getProjectPools
in interfaceProjectRestOpenApi
- Parameters:
sessionId
- The session token id.- Returns:
- The available project pools.
-
getProjectPool
@RequestMapping(method=GET, value="getProjectPool/{poolId}/{poolClassName}/{sessionId}", produces="application/json") public InventoryObjectPool getProjectPool(@PathVariable("poolId") String poolId, @PathVariable("poolClassName") String poolClassName, @PathVariable("sessionId") String sessionId)
Gets the project pools properties.- Specified by:
getProjectPool
in interfaceProjectRestOpenApi
- Parameters:
poolId
- The pool id.poolClassName
- The pool class name.sessionId
- The session token id.- Returns:
- The pool properties.
-
getProject
@RequestMapping(method=GET, value="getProject/{projectClassName}/{projectId}/{sessionId}", produces="application/json") public BusinessObject getProject(@PathVariable("projectClassName") String projectClassName, @PathVariable("projectId") String projectId, @PathVariable("sessionId") String sessionId)
Get project properties.- Specified by:
getProject
in interfaceProjectRestOpenApi
- Parameters:
projectClassName
- The project class name. Must be subclass of GenericProject.projectId
- The project id.sessionId
- The session token id.- Returns:
- The project properties.
-
getActivity
@RequestMapping(method=GET, value="getActivity/{activityClassName}/{activityId}/{sessionId}", produces="application/json") public BusinessObject getActivity(@PathVariable("activityClassName") String activityClassName, @PathVariable("activityId") String activityId, @PathVariable("sessionId") String sessionId)
Get activity properties.- Specified by:
getActivity
in interfaceProjectRestOpenApi
- Parameters:
activityClassName
- The activity class name. Must be subclass of GenericActivity.activityId
- The activity id.sessionId
- The session token id.- Returns:
- The activity properties.
-
copyProjectToPool
@RequestMapping(method=PUT, value="copyProjectToPool/{poolId}/{projectClassName}/{projectId}/{userName}/{sessionId}", produces="application/json") public String copyProjectToPool(@PathVariable("poolId") String poolId, @PathVariable("projectClassName") String projectClassName, @PathVariable("projectId") String projectId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Creates a copy of a project.- Specified by:
copyProjectToPool
in interfaceProjectRestOpenApi
- Parameters:
poolId
- The pool id.projectClassName
- The project class name.projectId
- The project id.userName
- The user name of the session.sessionId
- The session token id.- Returns:
- The newly created project id.
-
moveProjectToPool
@RequestMapping(method=PUT, value="moveProjectToPool/{poolId}/{projectClassName}/{projectId}/{userName}/{sessionId}", produces="application/json") public void moveProjectToPool(@PathVariable("poolId") String poolId, @PathVariable("projectClassName") String projectClassName, @PathVariable("projectId") String projectId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Moves a project from a pool to another pool.- Specified by:
moveProjectToPool
in interfaceProjectRestOpenApi
- Parameters:
poolId
- The pool id.projectClassName
- The project class name.projectId
- The project id.userName
- The user name of the session.sessionId
- The session token id.
-
relateObjectsToProject
@RequestMapping(method=PUT, value="relateObjectsToProject/{projectClassName}/{projectId}/{objectsClassNames}/{objectsIds}/{userName}/{sessionId}", produces="application/json") public void relateObjectsToProject(@PathVariable("projectClassName") String projectClassName, @PathVariable("projectId") String projectId, @PathVariable("objectsClassNames") String[] objectsClassNames, @PathVariable("objectsIds") String[] objectsIds, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Relates a set of objects to a project.- Specified by:
relateObjectsToProject
in interfaceProjectRestOpenApi
- Parameters:
projectClassName
- The project class name.projectId
- The project id.objectsClassNames
- The objects class names.objectsIds
- The objects ids.userName
- The user name of the session.sessionId
- The session token id.
-
relateObjectToProject
@RequestMapping(method=PUT, value="relateObjectToProject/{projectClassName}/{projectId}/{objectClassName}/{objectId}/{userName}/{sessionId}", produces="application/json") public void relateObjectToProject(@PathVariable("projectClassName") String projectClassName, @PathVariable("projectId") String projectId, @PathVariable("objectClassName") String objectClassName, @PathVariable("objectId") String objectId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Relates an object to a project.- Specified by:
relateObjectToProject
in interfaceProjectRestOpenApi
- Parameters:
projectClassName
- The project class name.projectId
- The project id.objectClassName
- The object class name.objectId
- The object id.userName
- The user name of the session.sessionId
- The session token id.
-
releaseObjectFromProject
@RequestMapping(method=PUT, value="releaseObjectFromProject/{objectClassName}/{objectId}/{projectClassName}/{projectId}/{userName}/{sessionId}", produces="application/json") public void releaseObjectFromProject(@PathVariable("objectClassName") String objectClassName, @PathVariable("objectId") String objectId, @PathVariable("projectClassName") String projectClassName, @PathVariable("projectId") String projectId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Releases an object from project.- Specified by:
releaseObjectFromProject
in interfaceProjectRestOpenApi
- Parameters:
objectClassName
- The object class name.objectId
- The object Id.projectClassName
- The project class name.projectId
- The project id.userName
- The user name of the session.sessionId
- The session token id.
-
-