Class FavoriteService
- java.lang.Object
-
- fr.paris.lutece.plugins.mydashboard.modules.favorites.service.FavoriteService
-
public class FavoriteService extends Object
- Author:
- alexandre
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Favorite>findAllActivatedFavorites()Load all the activated favoritesList<Favorite>findAllActivatedFavoritesByCode(String strCode)Load all the activated favorites attached to a categoryList<Category>findAllCategories()Return category listList<Favorite>findAllDefaultFavorites()Return default favorite listList<Favorite>findAllFavorites()Load all the favoritesFavoritefindByPrimaryKey(int idFavorite)Load the favorite for the given idList<Favorite>findFavoritesByCategoryCode(String categoryCode)Return default favorite liststatic FavoriteServicegetInstance()Get the instance of this service singletonorg.json.simple.JSONObjectgetLastFavoritesJson(String strGuid, int nNbFavoriteToShow)Get user favoritesvoidremoveFavorite(int nIdFavorite)Remove favorite with specific id, and delete all the users subscription to that favorite
-
-
-
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.
-
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"}]}
-
-