Class ProjectService


  • public class ProjectService
    extends java.lang.Object
    A Service to access and store Activities
    Version:
    $Id: $Id
    Author:
    medamine
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Project createProject​(Project project)
      Create new Project that will be available for all users.
      void deleteProject​(java.lang.Long projectId, java.lang.String username)
      Delete Project identified by its id and check if username has permission to delete it.
      java.util.List<Project> getProjectsList()
      Retrieves the list of Activities with offset, limit and a keyword that can be empty
      Project updateProject​(Project Project, java.lang.String username)
      Update an existing Project on datasource.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ProjectService

        public ProjectService​(ProjectStorage projectStorage)

        Constructor for ProjectService.

        Parameters:
        projectStorage - a ProjectStorage object.
    • Method Detail

      • createProject

        public Project createProject​(Project project)
                              throws java.lang.Exception
        Create new Project that will be available for all users. If the Project already exits an EntityExistsException will be thrown.
        Parameters:
        project - Project to create
        Returns:
        stored Project in datasource
        Throws:
        java.lang.Exception - when Project already exists or an error occurs while creating Project or its attached image
      • updateProject

        public Project updateProject​(Project Project,
                                     java.lang.String username)
                              throws java.lang.Exception
        Update an existing Project on datasource. If the Project doesn't exit an EntityNotFoundException will be thrown.
        Parameters:
        Project - dto to update on store
        username - username storing Project
        Returns:
        stored Project in datasource
        Throws:
        java.lang.Exception - when Exception is thrown or an error occurs while saving Project
      • deleteProject

        public void deleteProject​(java.lang.Long projectId,
                                  java.lang.String username)
                           throws javax.persistence.EntityNotFoundException,
                                  java.lang.IllegalAccessException
        Delete Project identified by its id and check if username has permission to delete it.
        Parameters:
        projectId - technical identifier of Project
        username - user currently deleting Project
        Throws:
        javax.persistence.EntityNotFoundException - if Project wasn't found
        java.lang.IllegalAccessException - if user is not allowed to delete Project
      • getProjectsList

        public java.util.List<Project> getProjectsList()
        Retrieves the list of Activities with offset, limit and a keyword that can be empty
        Returns:
        List of Project that contains the list of Activities