Class FavoriteService
- java.lang.Object
-
- fr.paris.lutece.plugins.mydashboard.modules.favorites.service.FavoriteService
-
public class FavoriteService extends java.lang.Object- Author:
- alexandre
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Favoritecreate(Favorite favorite)Create an instance of the favorite classjava.util.List<Favorite>findAllActivatedFavorites()Load all the activated favoritesjava.util.List<Favorite>findAllActivatedFavoritesByCode(java.lang.String strCode)Load all the activated favorites attached to a categoryjava.util.List<Category>findAllCategories()Return category listjava.util.List<Favorite>findAllDefaultFavorites()Return default favorite listjava.util.List<Favorite>findAllFavorites()Load all the favoritesFavoritefindByPrimaryKey(int idFavorite)Load the favorite for the given idjava.util.List<Favorite>findFavoritesByCategoryCode(java.lang.String categoryCode)Return default favorite listfr.paris.lutece.util.ReferenceListgetFavoritesWithoutCategory()Return reference list of favorites without categorystatic FavoriteServicegetInstance()Get the instance of this service singletonorg.json.simple.JSONObjectgetLastFavoritesJson(java.lang.String strGuid, int nNbFavoriteToShow)Get user favoritesvoidremoveFavorite(int nIdFavorite)Remove favorite with specific id, and delete all the users subscription to that favoriteFavoriteupdate(Favorite favorite)Update 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.
-
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 java.util.List<Favorite> findAllFavorites()
Load all the favorites- Returns:
- the list of all the favorites datas.
-
findAllActivatedFavorites
public java.util.List<Favorite> findAllActivatedFavorites()
Load all the activated favorites- Returns:
- the list of all the activated favorites datas.
-
findAllActivatedFavoritesByCode
public java.util.List<Favorite> findAllActivatedFavoritesByCode(java.lang.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 java.util.List<Favorite> findAllDefaultFavorites()
Return default favorite list- Returns:
- the default favorite list
-
findFavoritesByCategoryCode
public java.util.List<Favorite> findFavoritesByCategoryCode(java.lang.String categoryCode)
Return default favorite list- Returns:
- the default favorite list
-
findAllCategories
public java.util.List<Category> findAllCategories()
Return category list- Returns:
- the category list
-
getLastFavoritesJson
public org.json.simple.JSONObject getLastFavoritesJson(java.lang.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
-
-