Class FavoriteService


  • public class FavoriteService
    extends Object
    Author:
    alexandre
    • Method Detail

      • getInstance

        public static FavoriteService getInstance()
        Get the instance of this service singleton
        Returns:
        the singleton of this service
      • findByPrimaryKey

        public Favorite findByPrimaryKey​(int idFavorite)
        Load the favorite for the given id
        Parameters:
        idFavorite - the id of the favorite to get
        Returns:
        the favorite data corresponding to the provided id.
      • create

        public Favorite create​(Favorite favorite)
        Create an instance of the favorite class
        Parameters:
        favorite - The instance of the Favorite which contains the informations to store
        Returns:
        The instance of favorite which has been created with its primary key.
      • update

        public Favorite update​(Favorite favorite)
        Update favorite
        Parameters:
        favorite -
        Returns:
        an updated favorite
      • findAllFavorites

        public List<Favorite> findAllFavorites()
        Load all the favorites
        Returns:
        the list of all the favorites datas.
      • findAllActivatedFavorites

        public List<Favorite> findAllActivatedFavorites()
        Load all the activated favorites
        Returns:
        the list of all the activated favorites datas.
      • findAllActivatedFavoritesByCode

        public List<Favorite> findAllActivatedFavoritesByCode​(String strCode)
        Load all the activated favorites attached to a category
        Returns:
        the list of all the activated favorites datas attached to a category.
      • removeFavorite

        public void removeFavorite​(int nIdFavorite)
        Remove favorite with specific id, and delete all the users subscription to that favorite
        Parameters:
        nIdFavorite - the id of the favorite to delete
      • findAllDefaultFavorites

        public List<Favorite> findAllDefaultFavorites()
        Return default favorite list
        Returns:
        the default favorite list
      • findFavoritesByCategoryCode

        public List<Favorite> findFavoritesByCategoryCode​(String categoryCode)
        Return default favorite list
        Returns:
        the default favorite list
      • findAllCategories

        public List<Category> findAllCategories()
        Return category list
        Returns:
        the category list
      • getLastFavoritesJson

        public org.json.simple.JSONObject getLastFavoritesJson​(String strGuid,
                                                               int nNbFavoriteToShow)
        Get user favorites
        Parameters:
        strGuid -
        nbFavoriteToShow -
        Returns:
        json {favorites:[{"order":1,"label":"test","url":"url"}],[{"order":2,"label":"test2","url":"url"}]}
      • getFavoritesWithoutCategory

        public fr.paris.lutece.util.ReferenceList getFavoritesWithoutCategory()
        Return reference list of favorites without category
        Returns:
        the reference list of favorites without category