Package com.helger.dao.wal
Class AbstractMapBasedWALDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>,IMPLTYPE extends INTERFACETYPE>
java.lang.Object
com.helger.dao.AbstractDAO
com.helger.dao.wal.AbstractWALDAO<IMPLTYPE>
com.helger.dao.wal.AbstractMapBasedWALDAO<INTERFACETYPE,IMPLTYPE>
- Type Parameters:
INTERFACETYPE- Interface type to be handledIMPLTYPE- Implementation type to be handled
- All Implemented Interfaces:
com.helger.commons.lang.IHasSize,com.helger.commons.log.IHasConditionalLogger,IAutoSaveAware,IDAO,IMapBasedDAO<INTERFACETYPE>
@ThreadSafe
public abstract class AbstractMapBasedWALDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>,IMPLTYPE extends INTERFACETYPE>
extends AbstractWALDAO<IMPLTYPE>
implements IMapBasedDAO<INTERFACETYPE>
Base class for WAL based DAO that uses a simple
ICommonsMap for data
storage.- Author:
- Philip Helger
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classExtensible constructor parameter builder.Nested classes/interfaces inherited from interface com.helger.dao.IDAO
IDAO.EMode -
Field Summary
FieldsFields inherited from class com.helger.dao.wal.AbstractWALDAO
DEFAULT_WAITING_TIME, WAL_XWS, WRITE_XWSFields inherited from class com.helger.dao.AbstractDAO
CONDLOG, DEFAULT_AUTO_SAVE_ENABLED, FILENAME_EXTENSION_NEW, FILENAME_EXTENSION_PREV, m_aRWLock, RW_LOCK -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractMapBasedWALDAO(Class<IMPLTYPE> aImplClass, com.helger.commons.io.relative.IFileRelativeIO aIO, String sFilename, AbstractMapBasedWALDAO.InitSettings<IMPLTYPE> aInitSettings) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal com.helger.commons.callback.CallbackList<IDAOChangeCallback<INTERFACETYPE>>final booleancontainsAllIDs(Iterable<String> aIDs) Check if all IDs are containedfinal booleancontainsAny(Predicate<? super INTERFACETYPE> aFilter) final booleancontainsNone(Predicate<? super INTERFACETYPE> aFilter) final booleancontainsOnly(Predicate<? super INTERFACETYPE> aFilter) final booleancontainsWithID(String sID) protected com.helger.xml.microdom.IMicroDocumentCreate the XML document that should be saved to the file.final voidfindAll(Predicate<? super INTERFACETYPE> aFilter, Consumer<? super INTERFACETYPE> aConsumer) Find all items matching the filter and invoke the consumer on all matching entries.final <RETTYPE> voidfindAllMapped(Predicate<? super INTERFACETYPE> aFilter, Function<? super INTERFACETYPE, ? extends RETTYPE> aMapper, Consumer<? super RETTYPE> aConsumer) Find all contained items that match the filter, map them to a different type and invoke the consumer on all mapped items.final INTERFACETYPEfindFirst(Predicate<? super INTERFACETYPE> aFilter) Find the the first element that matches the filter.final <RETTYPE> RETTYPEfindFirstMapped(Predicate<? super INTERFACETYPE> aFilter, Function<? super INTERFACETYPE, ? extends RETTYPE> aMapper) final voidforEach(BiConsumer<? super String, ? super INTERFACETYPE> aConsumer) Iterate each entryfinal voidforEach(BiPredicate<? super String, ? super INTERFACETYPE> aFilter, BiConsumer<? super String, ? super INTERFACETYPE> aConsumer) Iterate each entryfinal voidforEachKey(Consumer<? super String> aConsumer) Iterate each keyfinal voidforEachKey(Predicate<? super String> aFilter, Consumer<? super String> aConsumer) Iterate each keyfinal voidforEachValue(Consumer<? super INTERFACETYPE> aConsumer) Iterate each valuefinal voidforEachValue(Predicate<? super INTERFACETYPE> aFilter, Consumer<? super INTERFACETYPE> aConsumer) Iterate each valuefinal com.helger.commons.collection.impl.ICommonsList<INTERFACETYPE>getAll()final com.helger.commons.collection.impl.ICommonsList<INTERFACETYPE>getAll(Predicate<? super INTERFACETYPE> aFilter) final com.helger.commons.collection.impl.ICommonsSet<String>final <RETTYPE> com.helger.commons.collection.impl.ICommonsList<RETTYPE>getAllMapped(Predicate<? super INTERFACETYPE> aFilter, Function<? super INTERFACETYPE, ? extends RETTYPE> aMapper) Get all contained items matching the provided filter and map them to something else.protected final INTERFACETYPEgetAtIndex(int nIndex) Get the item at the specified index.final intgetCount(Predicate<? super INTERFACETYPE> aFilter) final <T> com.helger.commons.collection.impl.ICommonsList<T>getNone()protected final IMPLTYPEFind the element with the provided ID.protected final booleanprotected final IMPLTYPEinternalCreateItem(IMPLTYPE aNewItem) Add an item including invoking the callback.protected final IMPLTYPEinternalCreateItem(IMPLTYPE aNewItem, boolean bInvokeCallbacks) Add an item including invoking the callback.protected final IMPLTYPEinternalDeleteItem(String sID) Delete the item by removing it from the map.protected final IMPLTYPEinternalDeleteItem(String sID, boolean bInvokeCallbacks) Delete the item by removing it from the map.protected final voidinternalForEachValue(Consumer<? super IMPLTYPE> aConsumer) protected final voidinternalForEachValue(Predicate<? super IMPLTYPE> aFilter, Consumer<? super IMPLTYPE> aConsumer) protected final com.helger.commons.collection.impl.ICommonsList<IMPLTYPE>internalGetAll(Predicate<? super IMPLTYPE> aFilter) protected final Collection<IMPLTYPE>protected final IMPLTYPEinternalGetOfID(String sID) Same asgetOfID(String)but the locking must happen on the called side.protected final voidinternalMarkItemDeleted(IMPLTYPE aItem) Mark an item as "deleted" without actually deleting it from the map.protected final voidinternalMarkItemDeleted(IMPLTYPE aItem, boolean bInvokeCallbacks) Mark an item as "deleted" without actually deleting it from the map.protected final voidMark an item as "no longer deleted" without actually adding it to the map.protected final voidinternalMarkItemUndeleted(IMPLTYPE aItem, boolean bInvokeCallbacks) Mark an item as "no longer deleted" without actually adding it to the map.protected final com.helger.commons.state.EChangeRemove all items without triggering any callback.protected final voidinternalUpdateItem(IMPLTYPE aItem) Update an existing item including invoking the callback.protected final voidinternalUpdateItem(IMPLTYPE aItem, boolean bInvokeCallbacks) Update an existing item including invoking the callback.final booleanisEmpty()final booleanprotected final voidmarkAsChanged(IMPLTYPE aModifiedElement, EDAOActionType eActionType) Deprecated.Avoid that this method is overriddenprotected com.helger.commons.state.EChangeonRead(com.helger.xml.microdom.IMicroDocument aDoc) Fill the internal structures with from the passed XML document.protected voidonRecoveryCreate(IMPLTYPE aItem) Called when a recovery is needed to create a new item.protected voidonRecoveryDelete(IMPLTYPE aItem) Called when a recovery is needed to delete an existing item.protected voidonRecoveryUpdate(IMPLTYPE aItem) Called when a recovery is needed to update an existing item.final intsize()toString()Methods inherited from class com.helger.dao.wal.AbstractWALDAO
convertNativeToWALString, convertWALStringToNative, getDataTypeClass, getFilenameProvider, getInitCount, getIO, getLastFilename, getLastInitDateTime, getLastReadDateTime, getLastWriteDateTime, getReadCount, getSafeFile, getWaitingTime, getWALXMLWriterSettings, getWriteCount, getXMLWriterSettings, initialRead, markAsChanged, modifyWriteData, onBetweenReadAndWAL, onFilenameChange, onInit, onRecoveryErrorConvertToNative, setWaitingTime, triggerExceptionHandlersRead, triggerExceptionHandlersWrite, writeToFileOnPendingChangesMethods inherited from class com.helger.dao.AbstractDAO
beginWithoutAutoSave, checkFileAccess, endWithoutAutoSave, exceptionHandlersRead, exceptionHandlersWrite, hasPendingChanges, internalHasPendingChanges, internalIsAutoSaveEnabled, internalSetPendingChanges, isAutoSaveEnabled, isSilentMode, setSilentModeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.dao.IAutoSaveAware
performWithoutAutoSave, performWithoutAutoSave, performWithoutAutoSaveThrowing, performWithoutAutoSaveThrowingMethods inherited from interface com.helger.dao.IDAO
isReloadable, reload
-
Field Details
-
ELEMENT_ROOT
- See Also:
-
ELEMENT_ITEM
- See Also:
-
-
Constructor Details
-
AbstractMapBasedWALDAO
protected AbstractMapBasedWALDAO(@Nonnull Class<IMPLTYPE> aImplClass, @Nonnull com.helger.commons.io.relative.IFileRelativeIO aIO, @Nullable String sFilename, @Nonnull AbstractMapBasedWALDAO.InitSettings<IMPLTYPE> aInitSettings) throws DAOException Default constructor. Automatically tries to read the file in the constructor (except this is changed in the init settings). WAL based classes must have a fixed filename!- Parameters:
aImplClass- Implementation class. May not benull.aIO- IO abstraction to be used. May not benull.sFilename- The filename to read and write.aInitSettings- Optional initialization settings to be used. May not benull.- Throws:
DAOException- If reading and reading fails
-
-
Method Details
-
onRecoveryCreate
Description copied from class:AbstractWALDAOCalled when a recovery is needed to create a new item.- Specified by:
onRecoveryCreatein classAbstractWALDAO<IMPLTYPE extends INTERFACETYPE>- Parameters:
aItem- The element to be created. Nevernull.
-
onRecoveryUpdate
Description copied from class:AbstractWALDAOCalled when a recovery is needed to update an existing item.- Specified by:
onRecoveryUpdatein classAbstractWALDAO<IMPLTYPE extends INTERFACETYPE>- Parameters:
aItem- The element to be updated. Nevernull.
-
onRecoveryDelete
Description copied from class:AbstractWALDAOCalled when a recovery is needed to delete an existing item.- Specified by:
onRecoveryDeletein classAbstractWALDAO<IMPLTYPE extends INTERFACETYPE>- Parameters:
aItem- The element to be deleted. Nevernull.
-
onRead
@Nonnull protected com.helger.commons.state.EChange onRead(@Nonnull com.helger.xml.microdom.IMicroDocument aDoc) Description copied from class:AbstractWALDAOFill the internal structures with from the passed XML document. This method is only called within a write lock!- Specified by:
onReadin classAbstractWALDAO<IMPLTYPE extends INTERFACETYPE>- Parameters:
aDoc- The XML document to read from. Nevernull.- Returns:
EChange.CHANGEDif reading the data changed something in the internal structures that requires a writing.
-
internalGetAllSortedByKey
@MustBeLocked(READ) @CodingStyleguideUnaware protected final Collection<IMPLTYPE> internalGetAllSortedByKey() -
createWriteData
Description copied from class:AbstractWALDAOCreate the XML document that should be saved to the file. This method is only called within a write lock!- Specified by:
createWriteDatain classAbstractWALDAO<IMPLTYPE extends INTERFACETYPE>- Returns:
- The non-
nulldocument to write to the file.
-
callbacks
@Nonnull @ReturnsMutableObject public final com.helger.commons.callback.CallbackList<IDAOChangeCallback<INTERFACETYPE>> callbacks() -
markAsChanged
@MustBeLocked(WRITE) @Deprecated @DevelopersNote("Avoid that this method is overridden") protected final void markAsChanged(@Nonnull IMPLTYPE aModifiedElement, @Nonnull EDAOActionType eActionType) Deprecated.Avoid that this method is overriddenThe super method must be called every time something changed in the DAO. It triggers the writing to a file if auto-save is active. This method must be called within a write-lock as it is not locked!- Overrides:
markAsChangedin classAbstractWALDAO<IMPLTYPE extends INTERFACETYPE>- Parameters:
aModifiedElement- The modified data element. May not benull.eActionType- The action that was performed. May not benull.
-
internalCreateItem
@MustBeLocked(WRITE) @Nonnull protected final IMPLTYPE internalCreateItem(@Nonnull IMPLTYPE aNewItem) Add an item including invoking the callback. Must only be invoked inside a write-lock.- Parameters:
aNewItem- The item to be added. May not benull.- Returns:
- The passed parameter as-is. Never
null. - Throws:
IllegalArgumentException- If an item with the same ID is already contained
-
internalCreateItem
@MustBeLocked(WRITE) @Nonnull protected final IMPLTYPE internalCreateItem(@Nonnull IMPLTYPE aNewItem, boolean bInvokeCallbacks) Add an item including invoking the callback. Must only be invoked inside a write-lock.- Parameters:
aNewItem- The item to be added. May not benull.bInvokeCallbacks-trueto invoke callbacks,falseto not do so.- Returns:
- The passed parameter as-is. Never
null. - Throws:
IllegalArgumentException- If an item with the same ID is already contained- Since:
- 9.2.1
-
internalUpdateItem
Update an existing item including invoking the callback. Must only be invoked inside a write-lock.- Parameters:
aItem- The item to be updated. May not benull.- Throws:
IllegalArgumentException- If no item with the same ID is already contained
-
internalUpdateItem
@MustBeLocked(WRITE) protected final void internalUpdateItem(@Nonnull IMPLTYPE aItem, boolean bInvokeCallbacks) Update an existing item including invoking the callback. Must only be invoked inside a write-lock.- Parameters:
aItem- The item to be updated. May not benull.bInvokeCallbacks-trueto invoke callbacks,falseto not do so.- Throws:
IllegalArgumentException- If no item with the same ID is already contained- Since:
- 9.2.1
-
internalDeleteItem
Delete the item by removing it from the map. If something was remove the onDeleteItem callback is invoked. Must only be invoked inside a write-lock.- Parameters:
sID- The ID to be removed. May benull.- Returns:
- The deleted item. If
nullno such item was found and therefore nothing was removed.
-
internalDeleteItem
@MustBeLocked(WRITE) @Nullable protected final IMPLTYPE internalDeleteItem(@Nullable String sID, boolean bInvokeCallbacks) Delete the item by removing it from the map. If something was remove the onDeleteItem callback is invoked. Must only be invoked inside a write-lock.- Parameters:
sID- The ID to be removed. May benull.bInvokeCallbacks-trueto invoke callbacks,falseto not do so.- Returns:
- The deleted item. If
nullno such item was found and therefore nothing was removed. - Since:
- 9.2.1
-
internalMarkItemDeleted
Mark an item as "deleted" without actually deleting it from the map. This method only triggers the update action but does not alter the item. Must only be invoked inside a write-lock.- Parameters:
aItem- The item that was marked as "deleted"
-
internalMarkItemDeleted
@MustBeLocked(WRITE) protected final void internalMarkItemDeleted(@Nonnull IMPLTYPE aItem, boolean bInvokeCallbacks) Mark an item as "deleted" without actually deleting it from the map. This method only triggers the update action but does not alter the item. Must only be invoked inside a write-lock.- Parameters:
aItem- The item that was marked as "deleted"bInvokeCallbacks-trueto invoke callbacks,falseto not do so.- Since:
- 9.2.1
-
internalMarkItemUndeleted
Mark an item as "no longer deleted" without actually adding it to the map. This method only triggers the update action but does not alter the item. Must only be invoked inside a write-lock.- Parameters:
aItem- The item that was marked as "no longer deleted"
-
internalMarkItemUndeleted
@MustBeLocked(WRITE) protected final void internalMarkItemUndeleted(@Nonnull IMPLTYPE aItem, boolean bInvokeCallbacks) Mark an item as "no longer deleted" without actually adding it to the map. This method only triggers the update action but does not alter the item. Must only be invoked inside a write-lock.- Parameters:
aItem- The item that was marked as "no longer deleted"bInvokeCallbacks-trueto invoke callbacks,falseto not do so.- Since:
- 9.2.1
-
internalRemoveAllItemsNoCallback
@MustBeLocked(WRITE) @Nonnull protected final com.helger.commons.state.EChange internalRemoveAllItemsNoCallback()Remove all items without triggering any callback. Must only be invoked inside a write-lock.- Returns:
EChange.CHANGEDif something was contained,EChange.UNCHANGEDotherwise.
-
getNone
@Nonnull @ReturnsMutableCopy public final <T> com.helger.commons.collection.impl.ICommonsList<T> getNone()- Specified by:
getNonein interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Type Parameters:
T- Response type.- Returns:
- An empty collection of the suitable implementation type.
-
getAll
@Nonnull @ReturnsMutableCopy @IsLocked(READ) public final com.helger.commons.collection.impl.ICommonsList<INTERFACETYPE> getAll()- Specified by:
getAllin interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Returns:
- A list of all contained items. Never
null.
-
getAll
@Nonnull @ReturnsMutableCopy @IsLocked(READ) public final com.helger.commons.collection.impl.ICommonsList<INTERFACETYPE> getAll(@Nullable Predicate<? super INTERFACETYPE> aFilter) - Specified by:
getAllin interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Parameters:
aFilter- Filter to be applied. May benull.- Returns:
- A list of all contained items matching the filter. Never
null.
-
internalDirectGetAll
-
internalGetAll
-
findAll
@IsLocked(READ) public final void findAll(@Nullable Predicate<? super INTERFACETYPE> aFilter, @Nonnull Consumer<? super INTERFACETYPE> aConsumer) Description copied from interface:IMapBasedDAOFind all items matching the filter and invoke the consumer on all matching entries.- Specified by:
findAllin interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Parameters:
aFilter- The filter to be applied. May benull.aConsumer- The consumer to be invoked for all matches. May not benull.
-
getAllMapped
@Nonnull @ReturnsMutableCopy @IsLocked(READ) public final <RETTYPE> com.helger.commons.collection.impl.ICommonsList<RETTYPE> getAllMapped(@Nullable Predicate<? super INTERFACETYPE> aFilter, @Nonnull Function<? super INTERFACETYPE, ? extends RETTYPE> aMapper) Description copied from interface:IMapBasedDAOGet all contained items matching the provided filter and map them to something else.- Specified by:
getAllMappedin interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Type Parameters:
RETTYPE- Return type to which is mapped- Parameters:
aFilter- The filter to be applied. May benull.aMapper- The mapper to be invoked. May not benull.- Returns:
- The list all matching and mapped elements. Never
null.
-
findAllMapped
@IsLocked(READ) public final <RETTYPE> void findAllMapped(@Nullable Predicate<? super INTERFACETYPE> aFilter, @Nonnull Function<? super INTERFACETYPE, ? extends RETTYPE> aMapper, @Nonnull Consumer<? super RETTYPE> aConsumer) Description copied from interface:IMapBasedDAOFind all contained items that match the filter, map them to a different type and invoke the consumer on all mapped items.- Specified by:
findAllMappedin interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Type Parameters:
RETTYPE- Return type to which is mapped- Parameters:
aFilter- The filter to be applied. May benull.aMapper- The mapper to be invoked. May not benull.aConsumer- The consumer to be invoked for all matches. May not benull.
-
findFirst
@IsLocked(READ) @Nullable public final INTERFACETYPE findFirst(@Nullable Predicate<? super INTERFACETYPE> aFilter) Description copied from interface:IMapBasedDAOFind the the first element that matches the filter.- Specified by:
findFirstin interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Parameters:
aFilter- The filter to be applied. May benull.- Returns:
- The first matching item or
null.
-
findFirstMapped
@Nullable @IsLocked(READ) public final <RETTYPE> RETTYPE findFirstMapped(@Nullable Predicate<? super INTERFACETYPE> aFilter, @Nonnull Function<? super INTERFACETYPE, ? extends RETTYPE> aMapper) - Specified by:
findFirstMappedin interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>
-
isNotEmpty
@IsLocked(READ) public final boolean isNotEmpty()- Specified by:
isNotEmptyin interfacecom.helger.commons.lang.IHasSize
-
containsAny
@IsLocked(READ) public final boolean containsAny(@Nullable Predicate<? super INTERFACETYPE> aFilter) - Specified by:
containsAnyin interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Parameters:
aFilter- The filter to be applied. May benull.- Returns:
trueif at least one item matches the filter
-
isEmpty
@IsLocked(READ) public final boolean isEmpty()- Specified by:
isEmptyin interfacecom.helger.commons.lang.IHasSize
-
containsNone
@IsLocked(READ) public final boolean containsNone(@Nullable Predicate<? super INTERFACETYPE> aFilter) - Specified by:
containsNonein interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Parameters:
aFilter- The filter to be applied. May benull.- Returns:
trueif no item matches the filter
-
containsOnly
@IsLocked(READ) public final boolean containsOnly(@Nullable Predicate<? super INTERFACETYPE> aFilter) - Specified by:
containsOnlyin interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Parameters:
aFilter- The filter to be applied. May benull.- Returns:
trueif all items match the filter
-
forEach
@IsLocked(READ) public final void forEach(@Nullable BiConsumer<? super String, ? super INTERFACETYPE> aConsumer) Description copied from interface:IMapBasedDAOIterate each entry- Specified by:
forEachin interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Parameters:
aConsumer- Consumer to use. May benull.
-
forEach
@IsLocked(READ) public final void forEach(@Nullable BiPredicate<? super String, ? super INTERFACETYPE> aFilter, @Nullable BiConsumer<? super String, ? super INTERFACETYPE> aConsumer) Description copied from interface:IMapBasedDAOIterate each entry- Specified by:
forEachin interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Parameters:
aFilter- Optional filter to limit the entries for which the consumer is called. May benull.aConsumer- Consumer to use. May benull.
-
forEachKey
Description copied from interface:IMapBasedDAOIterate each key- Specified by:
forEachKeyin interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Parameters:
aConsumer- Consumer to use. May benull.
-
forEachKey
@IsLocked(READ) public final void forEachKey(@Nullable Predicate<? super String> aFilter, @Nullable Consumer<? super String> aConsumer) Description copied from interface:IMapBasedDAOIterate each key- Specified by:
forEachKeyin interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Parameters:
aFilter- Optional filter to limit the entries for which the consumer is called. May benull.aConsumer- Consumer to use. May benull.
-
forEachValue
Description copied from interface:IMapBasedDAOIterate each value- Specified by:
forEachValuein interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Parameters:
aConsumer- Consumer to use. May benull.
-
internalForEachValue
-
forEachValue
@IsLocked(READ) public final void forEachValue(@Nullable Predicate<? super INTERFACETYPE> aFilter, @Nullable Consumer<? super INTERFACETYPE> aConsumer) Description copied from interface:IMapBasedDAOIterate each value- Specified by:
forEachValuein interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Parameters:
aFilter- Optional filter to limit the entries for which the consumer is called. May benull.aConsumer- Consumer to use. May benull.
-
internalForEachValue
-
internalGetOfID
Same asgetOfID(String)but the locking must happen on the called side.- Parameters:
sID- The ID to search. May benull.- Returns:
nullif no such item exists- Since:
- 9.1.5
-
getOfID
Find the element with the provided ID. Locking is done internally.- Parameters:
sID- The ID to search. May benull.- Returns:
nullif no such item exists
-
getAtIndex
Get the item at the specified index. This method only returns defined results if an ordered map is used for data storage.- Parameters:
nIndex- The index to retrieve. Should be ≥ 0.- Returns:
nullif an invalid index was provided.
-
internalContainsWithID
-
containsWithID
- Specified by:
containsWithIDin interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Parameters:
sID- The ID to be checked. May benull.- Returns:
trueif an item with the provided ID is contained.
-
containsAllIDs
Description copied from interface:IMapBasedDAOCheck if all IDs are contained- Specified by:
containsAllIDsin interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Parameters:
aIDs- IDs to check- Returns:
trueif all IDs are contained
-
getAllIDs
@Nonnull @ReturnsMutableCopy public final com.helger.commons.collection.impl.ICommonsSet<String> getAllIDs()- Specified by:
getAllIDsin interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Returns:
- A set with the IDs of all contained items. Never
nullbut maybe empty.
-
size
- Specified by:
sizein interfacecom.helger.commons.lang.IHasSize
-
getCount
- Specified by:
getCountin interfaceIMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>- Parameters:
aFilter- The filter to be applied. May benull.- Returns:
- The number of items matching the provided filter. Always ≥ 0.
-
toString
- Overrides:
toStringin classAbstractWALDAO<IMPLTYPE extends INTERFACETYPE>
-