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

      • ProjectRestController

        public ProjectRestController()
    • 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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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 interface ProjectRestOpenApi
        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.