Class FilterService


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

      Constructors 
      Constructor Description
      FilterService​(FilterStorage filterStorage)
      Constructor for FilterService.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      FilterModel createFilter​(FilterModel filter, java.lang.String userName)
      Create new Filter that will be available for all users.
      void deleteFilter​(java.lang.Long filterId)
      Delete Filter identified by its id and check if username has permission to delete it.
      org.json.JSONObject getFields​(long filterId)
      getFields.
      org.json.JSONArray getFiltersList​(java.lang.String userName)
      Retrieves the list of Activities with offset, limit and a keyword that can be empty
      • Methods inherited from class java.lang.Object

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

      • FilterService

        public FilterService​(FilterStorage filterStorage)

        Constructor for FilterService.

        Parameters:
        filterStorage - a FilterStorage object.
    • Method Detail

      • createFilter

        public FilterModel createFilter​(FilterModel filter,
                                        java.lang.String userName)
                                 throws java.lang.Exception
        Create new Filter that will be available for all users. If the Filter already exits an EntityExistsException will be thrown.
        Parameters:
        filter - Filter to create
        userName - a String object.
        Returns:
        stored Filter in datasource
        Throws:
        java.lang.Exception - when Filter already exists or an error occurs while creating Filter or its attached image
      • deleteFilter

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

        public org.json.JSONArray getFiltersList​(java.lang.String userName)
        Retrieves the list of Activities with offset, limit and a keyword that can be empty
        Parameters:
        userName - a String object.
        Returns:
        List of FilterModel that contains the list of Activities
      • getFields

        public org.json.JSONObject getFields​(long filterId)

        getFields.

        Parameters:
        filterId - a long.
        Returns:
        a JSONObject object.