Package org.opencms.ui.favorites
Class CmsFavoriteDAO
- java.lang.Object
-
- org.opencms.ui.favorites.CmsFavoriteDAO
-
public class CmsFavoriteDAO extends java.lang.Object
Loads/saves favorites.When loading favorites, the individual entries are validated by trying to read the resources/projects they reference. If this fails, the entries are discareded from the returned list.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ADDINFO_KEY
The additional info key under which the favorites for a user are saved.static java.lang.String
BASE_KEY
The main key in the JSON object containing the favorites.
-
Constructor Summary
Constructors Constructor Description CmsFavoriteDAO(CmsObject cms)
Creates a new instance.CmsFavoriteDAO(CmsObject cms, java.lang.String userName)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<CmsFavoriteEntry>
loadFavorites()
Loads the favorite list.void
saveFavorites(java.util.List<CmsFavoriteEntry> favorites)
Saves the favorites.
-
-
-
Field Detail
-
ADDINFO_KEY
public static final java.lang.String ADDINFO_KEY
The additional info key under which the favorites for a user are saved.- See Also:
- Constant Field Values
-
BASE_KEY
public static final java.lang.String BASE_KEY
The main key in the JSON object containing the favorites.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsFavoriteDAO
public CmsFavoriteDAO(CmsObject cms) throws CmsException
Creates a new instance.- Parameters:
cms
- the CMS Context- Throws:
CmsException
- if something goes wrong
-
CmsFavoriteDAO
public CmsFavoriteDAO(CmsObject cms, java.lang.String userName) throws CmsException
Creates a new instance.- Parameters:
cms
- the CMS ContextuserName
- the name of the user in whose additional infos the bookmarks are stored- Throws:
CmsException
- if something goes wrong
-
-
Method Detail
-
loadFavorites
public java.util.List<CmsFavoriteEntry> loadFavorites() throws CmsException
Loads the favorite list.- Returns:
- the list of favorites
- Throws:
CmsException
- if something goes wrong
-
saveFavorites
public void saveFavorites(java.util.List<CmsFavoriteEntry> favorites) throws CmsException
Saves the favorites.- Parameters:
favorites
- the list of favorites to save- Throws:
CmsException
- if something goes wrong
-
-