Class CodesService

java.lang.Object
org.exoplatform.timetracker.service.CodesService

public class CodesService extends Object
A Service to access and store Activities
Version:
$Id: $Id
Author:
medamine
  • Constructor Details

    • CodesService

      public CodesService(CodesStorage codesStorage)

      Constructor for CodesService.

      Parameters:
      codesStorage - a CodesStorage object.
  • Method Details

    • createActivityCode

      public ActivityCode createActivityCode(ActivityCode activityCode) throws Exception
      Create new ActivityCode. If the ActivityCode already exits an EntityExistsException will be thrown.
      Parameters:
      activityCode - ActivityCode to create
      Returns:
      stored ActivityCode in datasource
      Throws:
      Exception - when ActivityCode already exists or an error occurs while creating ActivityCode or its attached image
    • updateActivityCode

      public ActivityCode updateActivityCode(ActivityCode activityCode, String username) throws Exception
      Update an existing ActivityCode on datasource. If the ActivityCode doesn't exit an EntityNotFoundException will be thrown.
      Parameters:
      activityCode - to update on store
      username - username storing ActivityCode
      Returns:
      stored ActivityCode in datasource
      Throws:
      Exception - when Exception is thrown or an error occurs while saving ActivityCode
    • deleteActivityCode

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

      public List<ActivityCode> getActivityCodesList()
      Retrieves the list of Activities with offset, limit and a keyword that can be empty
      Returns:
      List of ActivityCode that contains the list of Activities
    • createSubActivityCode

      public SubActivityCode createSubActivityCode(SubActivityCode subActivityCode) throws Exception
      Create new SubActivityCode that will be available for all users. If the SubActivityCode already exits an EntityExistsException will be thrown.
      Parameters:
      subActivityCode - SubActivityCode to create
      Returns:
      stored SubActivityCode in datasource
      Throws:
      Exception - when SubActivityCode already exists or an error occurs while creating SubActivityCode or its attached image
    • updateSubActivityCode

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

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

      public List<SubActivityCode> getSubActivityCodesList()
      Retrieves the list of Activities with offset, limit and a keyword that can be empty
      Returns:
      List of SubActivityCode that contains the list of Activities
    • createType

      public Type createType(Type type) throws Exception
      Create new Type that will be available for all users. If the Type already exits an EntityExistsException will be thrown.
      Parameters:
      type - Type to create
      Returns:
      stored Type in datasource
      Throws:
      Exception - when Type already exists or an error occurs while creating Type or its attached image
    • updateType

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

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

      public List<Type> getTypesList()
      Retrieves the list of Activities with offset, limit and a keyword that can be empty
      Returns:
      List of Type that contains the list of Activities
    • createSubType

      public SubType createSubType(SubType subType) throws Exception
      Create new SubType that will be available for all users. If the SubType already exits an EntityExistsException will be thrown.
      Parameters:
      subType - SubType to create
      Returns:
      stored SubType in datasource
      Throws:
      Exception - when SubType already exists or an error occurs while creating SubType or its attached image
    • updateSubType

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

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

      public List<SubType> getSubTypesList()
      Retrieves the list of Activities with offset, limit and a keyword that can be empty
      Returns:
      List of SubType that contains the list of Activities