@ThreadSafe public class FavoriteManager extends AbstractWALDAO<Favorite>
Favorite objects.IDAO.EModeDEFAULT_WAITING_TIME, WAL_XWS, WRITE_XWSDEFAULT_AUTO_SAVE_ENABLED, m_aRWLock| Constructor and Description |
|---|
FavoriteManager(String sFilename) |
| Modifier and Type | Method and Description |
|---|---|
IFavorite |
addFavorite(String sUserID,
String sApplicationID,
String sMenuItemID,
String sDisplayName,
Map<String,String> aAdditionalParams)
Create a new favorite object.
|
boolean |
containsFavoritesOfUser(String sUserID)
Check if the specified user ID is contained or not.
|
protected com.helger.xml.microdom.IMicroDocument |
createWriteData()
Create the XML document that should be saved to the file.
|
com.helger.commons.collection.ext.ICommonsList<IFavorite> |
getAllFavoritesOfUser(String sUserID) |
IFavorite |
getFavorite(String sUserID,
String sApplicationID,
String sMenuItemID,
com.helger.commons.collection.ext.ICommonsMap<String,String> aAdditionalParams)
Get the favorite of the specified user ID
|
long |
getSize() |
boolean |
isEmpty() |
boolean |
isFavorite(String sUserID,
String sApplicationID,
String sMenuItemID,
com.helger.commons.collection.ext.ICommonsMap<String,String> aAdditionalParams)
Get a list favorites of the specified user ID
|
protected com.helger.commons.state.EChange |
onRead(com.helger.xml.microdom.IMicroDocument aDoc)
Fill the internal structures with from the passed XML document.
|
protected void |
onRecoveryCreate(Favorite aElement)
Called when a recovery is needed to create a new item.
|
protected void |
onRecoveryDelete(Favorite aElement)
Called when a recovery is needed to delete an existing item.
|
protected void |
onRecoveryUpdate(Favorite aElement)
Called when a recovery is needed to update an existing item.
|
void |
reload() |
com.helger.commons.state.EChange |
removeAllFavoritesOfUser(String sUserID)
Remove all contained favorites objects of an user.
|
com.helger.commons.state.EChange |
removeFavorite(String sUserID,
String sID)
Remove the favorites with the specified ID.
|
String |
toString() |
com.helger.commons.state.EChange |
updateFavorite(String sUserID,
String sID,
String sDisplayName)
Update an existing favorite object.
|
convertNativeToWALString, convertWALStringToNative, getDAOIO, getDataTypeClass, getFilenameProvider, getInitCount, getLastFilename, getLastInitDateTime, getLastReadDateTime, getLastWriteDateTime, getReadCount, getSafeFile, getWaitingTime, getWALXMLWriterSettings, getWriteCount, getXMLWriterSettings, initialRead, markAsChanged, markAsChanged, modifyWriteData, onBetweenReadAndWAL, onFilenameChange, onInit, setWaitingTime, triggerExceptionHandlersRead, triggerExceptionHandlersWrite, writeToFileOnPendingChangesbeginWithoutAutoSave, endWithoutAutoSave, getExceptionHandlersRead, getExceptionHandlersWrite, hasPendingChanges, internalHasPendingChanges, internalIsAutoSaveEnabled, internalSetPendingChanges, isAutoSaveEnabled, isDebugLogging, performWithoutAutoSave, performWithoutAutoSave, performWithoutAutoSaveThrowing, performWithoutAutoSaveThrowingpublic FavoriteManager(@Nonnull @Nonempty String sFilename) throws DAOException
DAOExceptionprotected void onRecoveryCreate(@Nonnull Favorite aElement)
AbstractWALDAOonRecoveryCreate in class AbstractWALDAO<Favorite>aElement - The element to be created. Never null.protected void onRecoveryUpdate(@Nonnull Favorite aElement)
AbstractWALDAOonRecoveryUpdate in class AbstractWALDAO<Favorite>aElement - The element to be updated. Never null.protected void onRecoveryDelete(@Nonnull Favorite aElement)
AbstractWALDAOonRecoveryDelete in class AbstractWALDAO<Favorite>aElement - The element to be deleted. Never null.@Nonnull protected com.helger.commons.state.EChange onRead(@Nonnull com.helger.xml.microdom.IMicroDocument aDoc)
AbstractWALDAOonRead in class AbstractWALDAO<Favorite>aDoc - The XML document to read from. Never null.EChange.CHANGED if reading the data changed something in
the internal structures that requires a writing.@Nonnull protected com.helger.xml.microdom.IMicroDocument createWriteData()
AbstractWALDAOcreateWriteData in class AbstractWALDAO<Favorite>null document to write to the file.public void reload()
throws DAOException
DAOException@Nonnegative public long getSize()
public boolean isEmpty()
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.ext.ICommonsList<IFavorite> getAllFavoritesOfUser(@Nullable String sUserID)
sUserID - The ID of the user.null but maybe empty.public boolean containsFavoritesOfUser(@Nullable String sUserID)
sUserID - The UserID to check. May be null.true if the passed ID is containedpublic boolean isFavorite(@Nullable String sUserID, @Nullable String sApplicationID, @Nullable String sMenuItemID, @Nullable com.helger.commons.collection.ext.ICommonsMap<String,String> aAdditionalParams)
sUserID - The ID of the user.sApplicationID - The application ID to compare to.sMenuItemID - Menu item IDaAdditionalParams - Additional params. May be null.null if no such settings are contained.@Nullable public IFavorite getFavorite(@Nullable String sUserID, @Nullable String sApplicationID, @Nullable String sMenuItemID, @Nullable com.helger.commons.collection.ext.ICommonsMap<String,String> aAdditionalParams)
sUserID - The ID of the user.sApplicationID - The application ID to compare to.sMenuItemID - Menu item IDaAdditionalParams - Additional params. May be null.null if no such settings are contained.@Nonnull public IFavorite addFavorite(@Nonnull @Nonempty String sUserID, @Nonnull @Nonempty String sApplicationID, @Nonnull @Nonempty String sMenuItemID, @Nonnull @Nonempty String sDisplayName, @Nullable Map<String,String> aAdditionalParams)
sUserID - The ID of the user. May neither be null nor empty.sApplicationID - The application ID. May neither be null nor empty.sMenuItemID - Menu item ID. May neither be null nor empty.sDisplayName - Display name of the favorite. May neither be null nor
empty.aAdditionalParams - Additional params. May be null.IFavorite object and never null.@Nullable public com.helger.commons.state.EChange updateFavorite(@Nullable String sUserID, @Nullable String sID, @Nullable String sDisplayName)
sUserID - The ID of the user of the favorite object to be updated.sID - The ID of the favorite object to be updated.sDisplayName - The display name to change.EChange.CHANGED if something was changed.@Nullable public com.helger.commons.state.EChange removeFavorite(@Nullable String sUserID, @Nullable String sID)
sUserID - The ID of the user of the favorite object to be updated.sID - The ID of the favorite object to be updated.EChange.CHANGED if a removal was performed.@Nullable public com.helger.commons.state.EChange removeAllFavoritesOfUser(@Nullable String sUserID)
sUserID - The ID of the user of the favorite objects to be updated.EChange.CHANGED if a removal was performed.public String toString()
toString in class AbstractWALDAO<Favorite>Copyright © 2014–2017 Philip Helger. All rights reserved.