|
||||||||||
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 | |
---|---|
static java.lang.String |
DEFAULT_DOMIAN_ROOT_DIR_NAME
|
static java.lang.String |
DEFAULT_DOMIAN_ROOT_PATH
|
protected org.slf4j.Logger |
log
|
protected java.lang.Boolean |
supportsRecursiveIndexing
Flag to indicate whether or not this particualar repository instance add entity members as first class entities in the repository. |
protected Synchronizer |
synchronizer
A synchronizer used to control concurrent and exclusive access to repository methods. |
protected java.lang.Boolean |
usesNativeIndexing
Flag to indicate whether or not this particualar repository instance inhibits and uses its own mechanism for indexing entities. |
Constructor Summary | |
---|---|
AbstractRepository()
|
Method Summary | ||
---|---|---|
protected java.lang.Boolean |
contains(T entity)
|
|
|
count(Specification<V> specification)
Alias of countAllEntitiesSpecifiedBy(Specification) . |
|
|
countAll(Specification<V> specification)
Alias of countAllEntitiesSpecifiedBy(Specification) . |
|
|
countAllEntitiesSpecifiedBy(Specification<V> specification)
Counts the number of entities approved by the given specification. |
|
|
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. |
|
private static java.lang.Class[] |
getAllRelevantRepositoryInterfaces(Repository repository)
|
|
private java.lang.reflect.InvocationHandler |
getInvocationHandler()
|
|
protected Synchronizer |
getSynchronizer()
|
|
java.lang.Boolean |
isDoingNativePartitioning()
When true , the repository utilizes some sort of native partitioning mechanism, e.g. |
|
java.lang.Boolean |
isDoingRecursiveEntityAdding()
|
|
|
iterate(Specification<V> specification)
Alias of iterateAllEntitiesSpecifiedBy(Specification) . |
|
|
iterateAll(Specification<V> specification)
Alias of iterateAllEntitiesSpecifiedBy(Specification) . |
|
PartitionRepository<T> |
makePartition()
|
|
protected void |
onMakePartition()
Template method for partitioning callbacks. |
|
|
putAll(java.util.Collection<? extends V> collectionOfEntities)
Puts the given entities into this repository. |
|
|
remove(Specification<V> specification)
Alias of removeAllEntitiesSpecifiedBy(Specification) . |
|
|
removeAll(Specification<V> specification)
Alias of removeAllEntitiesSpecifiedBy(Specification) . |
|
void |
setSynchronizer(Synchronizer synchronizer)
A synchronizer used to control concurrent and exclusive access to repository methods. |
|
|
update(V entity,
CompositeSpecification<?> 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, put, remove, removeAllEntitiesSpecifiedBy, update |
Field Detail |
---|
public static final java.lang.String DEFAULT_DOMIAN_ROOT_DIR_NAME
public static final java.lang.String DEFAULT_DOMIAN_ROOT_PATH
protected final org.slf4j.Logger log
protected Synchronizer synchronizer
protected java.lang.Boolean usesNativeIndexing
false
.
protected java.lang.Boolean supportsRecursiveIndexing
false
- only aggregate root is indexed/made searchable.
Constructor Detail |
---|
public AbstractRepository()
Method Detail |
---|
protected Synchronizer getSynchronizer()
public void setSynchronizer(Synchronizer synchronizer)
Repository
setSynchronizer
in interface Repository<T extends Entity>
public java.lang.Boolean isDoingNativePartitioning()
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.
isDoingNativePartitioning
in interface Repository<T extends Entity>
true
if repository utilizes some sort of native partitioning mechanism, e.g. RDBMS indices.public java.lang.Boolean isDoingRecursiveEntityAdding()
isDoingRecursiveEntityAdding
in interface Repository<T extends Entity>
true
if member entities are stored recursively, and made searchable -
false
if only aggregate root is stored.protected java.lang.Boolean contains(T entity)
private java.lang.reflect.InvocationHandler getInvocationHandler()
public PartitionRepository<T> makePartition()
protected void onMakePartition()
public <V extends T> java.lang.Long countAllEntitiesSpecifiedBy(Specification<V> specification)
Repository
countAllEntitiesSpecifiedBy
in interface Repository<T extends Entity>
specification
- the entity specification
public final <V extends T> java.lang.Long countAll(Specification<V> specification)
Repository
countAllEntitiesSpecifiedBy(Specification)
.
countAll
in interface Repository<T extends Entity>
public final <V extends T> java.lang.Long count(Specification<V> 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 <V extends T> void putAll(java.util.Collection<? extends V> collectionOfEntities)
Repository
putAll
in interface Repository<T extends Entity>
collectionOfEntities
- the entities to be storedpublic <V extends T> void update(V entity, CompositeSpecification<?> 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>
private static java.lang.Class[] getAllRelevantRepositoryInterfaces(Repository repository)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |