Package org.opennms.web.services
Class FilterFavoriteService
- java.lang.Object
-
- org.opennms.web.services.FilterFavoriteService
-
public class FilterFavoriteService extends Object
Service to handle CRUD operations and such onOnmsFilterFavorite
objects.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FilterFavoriteService.FilterFavoriteException
-
Constructor Summary
Constructors Constructor Description FilterFavoriteService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OnmsFilterFavorite
createFavorite(String userName, String favoriteName, String filterString, OnmsFilterFavorite.Page page)
boolean
deleteFavorite(int favoriteId, String userName)
Deletes the favorite.boolean
deleteFavorite(String favoriteId, String username)
Deletes the given favorite, but only if the given username is allowed to delete.protected boolean
deleteFavorite(OnmsFilterFavorite favorite)
OnmsFilterFavorite
getFavorite(Integer favoriteId, String userName)
Returns the requested favorite if the favorite exists and if the given username is allowed to load the favorite.OnmsFilterFavorite
getFavorite(String favoriteId, String userName)
Returns the requested favorite if the favorite exists, the favoriteId is a valid Integer and if the given username is allowed to load the favorite.OnmsFilterFavorite
getFavorite(String favoriteId, String username, String filterString)
Returns a favorite only if the given user is allowed to see that favorite and if the given filterString matches with the stored filter criteria inside the favorite.List<OnmsFilterFavorite>
getFavorites(String userName, OnmsFilterFavorite.Page page)
Loads all favorites for the user and the given page.protected FilterFavoriteDao
getFilterFavoriteDao()
protected void
setFilterFavoriteDao(FilterFavoriteDao favoriteDao)
-
-
-
Method Detail
-
getFavorite
public OnmsFilterFavorite getFavorite(String favoriteId, String username, String filterString)
Returns a favorite only if the given user is allowed to see that favorite and if the given filterString matches with the stored filter criteria inside the favorite. If the favorite does not exist for the user or the filter criteria does not match null is return.- Parameters:
favoriteId
- The id of the favorite.username
- The username which tries to load the favorite.filterString
- The expected filter criteria.- Returns:
- The requested favorite or null.
-
deleteFavorite
public boolean deleteFavorite(String favoriteId, String username)
Deletes the given favorite, but only if the given username is allowed to delete.- Parameters:
favoriteId
-username
-- Returns:
- true if the favorite was deleted, otherwise false.
-
getFavorite
public OnmsFilterFavorite getFavorite(String favoriteId, String userName)
Returns the requested favorite if the favorite exists, the favoriteId is a valid Integer and if the given username is allowed to load the favorite.- Parameters:
favoriteId
- The id of the favorite.userName
- The user which tries to load the favorite.- Returns:
- The favorite or null if the favoriteId is not an Integer, the favorite does not exist or the given username is not allowed to see the requested favorite.
-
getFavorite
public OnmsFilterFavorite getFavorite(Integer favoriteId, String userName)
Returns the requested favorite if the favorite exists and if the given username is allowed to load the favorite.- Parameters:
favoriteId
- The id of the favorite.userName
- The user which tries to load the favorite.- Returns:
- The favorite or null if the favorite does not exist or the given username is not allowed to see the requested favorite.
-
deleteFavorite
public boolean deleteFavorite(int favoriteId, String userName)
Deletes the favorite. The deletion is only performed if the favorite exists and the given user is allowed to delete.- Parameters:
favoriteId
-userName
-- Returns:
-
getFavorites
public List<OnmsFilterFavorite> getFavorites(String userName, OnmsFilterFavorite.Page page)
Loads all favorites for the user and the given page.- Parameters:
userName
-page
-- Returns:
-
createFavorite
public OnmsFilterFavorite createFavorite(String userName, String favoriteName, String filterString, OnmsFilterFavorite.Page page) throws FilterFavoriteService.FilterFavoriteException
-
setFilterFavoriteDao
protected void setFilterFavoriteDao(FilterFavoriteDao favoriteDao)
-
getFilterFavoriteDao
protected FilterFavoriteDao getFilterFavoriteDao()
-
deleteFavorite
protected boolean deleteFavorite(OnmsFilterFavorite favorite)
-
-