|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.domian.repository.AbstractRepository<T>
public abstract class AbstractRepository<T extends Entity>
All Repository
classes should extend this abstract class.
It makes sure that all aliased methods behaves like specified in the Repository
interface.
Also, some default method implementations are included in this class.
Field Summary | |
---|---|
protected java.lang.Boolean |
supportsRecursiveIndexing
Flag to indicate whether or not this particular repository instance add entity members as first class entities in the repository. |
protected java.lang.Boolean |
usesNativePartitioningSupport
Flag to indicate whether or not this particular repository instance inhibits and uses its own mechanism for indexing entities. |
Constructor Summary | |
---|---|
AbstractRepository()
|
Method Summary | ||
---|---|---|
protected java.lang.Boolean |
contains(T entity)
|
|
java.lang.Long |
count(Specification<? extends T> specification)
Alias of countAllEntitiesSpecifiedBy(Specification) . |
|
java.lang.Long |
countAll(Specification<? extends T> specification)
Alias of countAllEntitiesSpecifiedBy(Specification) . |
|
java.lang.Long |
countAllEntitiesSpecifiedBy(Specification<? extends T> specification)
Counts the number of entities approved by the given specification. |
|
protected abstract Specification<T> |
createUniqueSpecificationFor(T entity)
Template method for creating unique specification for given entity |
|
|
find(Specification<V> specification)
Alias of findAllEntitiesSpecifiedBy(Specification) . |
|
|
findAll(Specification<V> specification)
Alias of findAllEntitiesSpecifiedBy(Specification) . |
|
|
findSingle(Specification<V> specification)
Alias of findSingleEntitySpecifiedBy(Specification) . |
|
|
findSingleEntitySpecifiedBy(Specification<V> specification)
Finds and returns one single entity approved by the given specification. |
|
java.lang.Boolean |
isIndexingEntitiesRecursively()
|
|
java.lang.Boolean |
isPartitioningNatively()
When true , the repository utilizes some sort of native partitioning mechanism, e.g. |
|
|
iterate(Specification<V> specification)
Alias of iterateAllEntitiesSpecifiedBy(Specification) . |
|
|
iterateAll(Specification<V> specification)
Alias of iterateAllEntitiesSpecifiedBy(Specification) . |
|
protected abstract void |
onMakePartition()
Template method for partitioning callbacks. |
|
void |
putAll(java.util.Collection<? extends T> collectionOfEntities)
Puts the given entities into this repository. |
|
|
remove(Specification<V> specification)
Alias of removeAllEntitiesSpecifiedBy(Specification) . |
|
|
removeAll(Specification<V> specification)
Alias of removeAllEntitiesSpecifiedBy(Specification) . |
|
|
update(V entity,
Specification<?> deltaSpecification)
Updates an entity. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sourceforge.domian.repository.Repository |
---|
findAllEntitiesSpecifiedBy, iterateAllEntitiesSpecifiedBy, makePartition, put, remove, removeAllEntitiesSpecifiedBy, update |
Field Detail |
---|
protected java.lang.Boolean usesNativePartitioningSupport
false
.
protected java.lang.Boolean supportsRecursiveIndexing
false
- only aggregate root is indexed/made searchable.
Constructor Detail |
---|
public AbstractRepository()
Method Detail |
---|
public java.lang.Boolean isPartitioningNatively()
Repository
true
, the repository utilizes some sort of native partitioning mechanism, e.g. RDBMS indices.
If true
, partition repositories may be reusing the same repository instance.
isPartitioningNatively
in interface Repository<T extends Entity>
true
if repository utilizes some sort of native partitioning mechanism, e.g. RDBMS indices.public java.lang.Boolean isIndexingEntitiesRecursively()
isIndexingEntitiesRecursively
in interface Repository<T extends Entity>
true
if member entities are stored recursively, and made searchable -
false
if only aggregate root is stored.protected abstract Specification<T> createUniqueSpecificationFor(T entity)
protected java.lang.Boolean contains(T entity)
protected abstract void onMakePartition()
public java.lang.Long countAllEntitiesSpecifiedBy(Specification<? extends T> specification)
Repository
countAllEntitiesSpecifiedBy
in interface Repository<T extends Entity>
specification
- the entity specification
public final java.lang.Long countAll(Specification<? extends T> specification)
Repository
countAllEntitiesSpecifiedBy(Specification)
.
countAll
in interface Repository<T extends Entity>
public final java.lang.Long count(Specification<? extends T> specification)
Repository
countAllEntitiesSpecifiedBy(Specification)
.
count
in interface Repository<T extends Entity>
public final <V extends T> java.util.Iterator<V> iterateAll(Specification<V> specification)
Repository
iterateAllEntitiesSpecifiedBy(Specification)
.
iterateAll
in interface Repository<T extends Entity>
public final <V extends T> java.util.Iterator<V> iterate(Specification<V> specification)
Repository
iterateAllEntitiesSpecifiedBy(Specification)
.
iterate
in interface Repository<T extends Entity>
public final <V extends T> java.util.Collection<V> findAll(Specification<V> specification)
Repository
findAllEntitiesSpecifiedBy(Specification)
.
findAll
in interface Repository<T extends Entity>
public final <V extends T> java.util.Collection<V> find(Specification<V> specification)
Repository
findAllEntitiesSpecifiedBy(Specification)
.
find
in interface Repository<T extends Entity>
public <V extends T> V findSingleEntitySpecifiedBy(Specification<V> specification)
Repository
findSingleEntitySpecifiedBy
in interface Repository<T extends Entity>
specification
- the entity specification
null
if no entity is foundpublic final <V extends T> V findSingle(Specification<V> specification)
Repository
findSingleEntitySpecifiedBy(Specification)
.
findSingle
in interface Repository<T extends Entity>
public void putAll(java.util.Collection<? extends T> collectionOfEntities)
Repository
putAll
in interface Repository<T extends Entity>
collectionOfEntities
- the entities to be storedpublic <V extends T> void update(V entity, Specification<?> deltaSpecification)
Repository
PersistenceDefinition.FILE
, and possibly PersistenceDefinition.DELEGATED
...
For all other persistence definitions, this method is redundant/not applicable.
Anyway, by applying this method in a consistent manner, an eventual repository migration will not need any code changes.
update
in interface Repository<T extends Entity>
V
- the entity typeentity
- the entitydeltaSpecification
- for optimistic locking schemes: a specification specifying the differences/added state between this update and the previously retrieved entity version
The specification should be a conjuction of field bound equality specifications only,
or null
if optimistic locking with automatic retries is completely out of scopepublic final <V extends T> java.lang.Long removeAll(Specification<V> specification)
Repository
removeAllEntitiesSpecifiedBy(Specification)
.
removeAll
in interface Repository<T extends Entity>
public final <V extends T> java.lang.Long remove(Specification<V> specification)
Repository
removeAllEntitiesSpecifiedBy(Specification)
.
remove
in interface Repository<T extends Entity>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |