Class FeatureService


  • public class FeatureService
    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
      Feature createFeature​(Feature feature)
      Create new Feature that will be available for all users.
      void deleteFeature​(java.lang.Long featureId, java.lang.String username)
      Delete Feature identified by its id and check if username has permission to delete it.
      java.util.List<Feature> getFeaturesList()
      Retrieves the list of Activities with offset, limit and a keyword that can be empty
      Feature updateFeature​(Feature Feature, java.lang.String username)
      Update an existing Feature on datasource.
      • Methods inherited from class java.lang.Object

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

      • FeatureService

        public FeatureService​(FeatureStorage featureStorage)

        Constructor for FeatureService.

        Parameters:
        featureStorage - a FeatureStorage object.
    • Method Detail

      • createFeature

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

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

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

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