|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Repository<I extends Serializable,T extends Entity<I>>
A repository is an object that encapsulate access to a group of entities. You can add new entities to the group, retrieve an entity by id, retrieve all the entities contained in this repository or filter them.
| Method Summary | ||
|---|---|---|
void |
addOrder(String property,
boolean reverse)
Add an order property for the lists retrieved using list() and list(Specification). |
|
void |
fillCollection(Collection<? super T>... toBeFilled)
|
|
void |
fillCollection(Filter criteria,
Collection<? super T>... toBeFilled)
|
|
T |
get(I id)
Retrieve an entity from this repository using its id. |
|
T |
getByPropertyValue(String propertyName,
Object value)
Retrieves the object contained in this repository that has a specified property equals to a certain value. |
|
|
getDetailRepository(Collection<E> details)
|
|
int |
getFirst()
Retrieves the index of the first object that will be retrieved by list() e list(Filter). |
|
int |
getLast()
Retrieves the index of the last object that will be retrieved by list() e list(Specification). |
|
String |
getOrderProperty()
Retrieves the name of the property used for ordering the result of the list() and list(Specification) methods. |
|
boolean |
isRemoveAllowed()
Check if this repository supports object removal. |
|
boolean |
isReverseOrder()
Returns true if the order of the result of the list() and
list(Specification) methods is ascending, false otherwise. |
|
List<T> |
list()
Retrieves all the objects contained in this repository. |
|
List<T> |
list(Filter criteria)
Deprecated. |
|
List<T> |
list(Specification<T> spec)
Retrieves the objects contained in this repository that satisfied the given specification. |
|
void |
put(T object)
Add a new entity to this repository. |
|
void |
refresh(I objectId)
If this repository is associated to an external data source (i.e a relational database) this method delete an object from the repository local cache so that a get(Serializable) will retrieve a fresh
one from the data source. |
|
void |
refresh(T object)
If this repository is associated to an external data source (i.e a relational database) this method delete an object from the repository local cache so that a get(Serializable) will retrieve a fresh
one from the data source. |
|
void |
remove(I objectId)
Removes an object from this repository. |
|
void |
remove(T object)
Removes an object from this repository. |
|
void |
removeLastOrder()
Remove the last added order property. |
|
void |
setFirst(int first)
Set the index of the first object that will be retrieved by list() and list(Filter) when value 0 has been
set for 'first' in the filter. |
|
void |
setLast(int last)
Set the index of the last object that will be retrieved by list() e list(Filter) when value 0 has been
set for 'first' in the filter. |
|
void |
setOrder(String property,
boolean reverse)
Set the order for the lists retrieved using list() and list(Specification). |
|
| Method Detail |
|---|
T get(I id)
id - the id of the entity you want to retrieve.
void put(T object)
object - the entity you want to addvoid refresh(T object)
get(Serializable) will retrieve a fresh
one from the data source.
If the repository is not associated to an external data source or it
has no local cache this method will have no effect.
object - the object to be refreshedvoid refresh(I objectId)
get(Serializable) will retrieve a fresh
one from the data source.
If the repository is not associated to an external data source or it
has no local cache this method will have no effect.
objectId - the id of the object to be refreshedboolean isRemoveAllowed()
void remove(T object)
isRemoveAllowed()
object - the object to remove
UnsupportedOperationException - if this repository does not support
object removalvoid remove(I objectId)
isRemoveAllowed()
objectId - the id of the object to remove
UnsupportedOperationException - if this repository does not support
object removalList<T> list()
#setFirst(int)}, {@link #setLast(int)}, {@link #setOrder(String, boolean)}@Deprecated List<T> list(Filter criteria)
criteria - the filter to be used
#setFirst(int)}, {@link #setLast(int)}, {@link #setOrder(String, boolean)}
T getByPropertyValue(String propertyName,
Object value)
This method makes sense only if the specified property has distinct values for each entity.
If there is no entity in this repository that has the specified value, null is returned.
if there is more than one entity in this repository that has the specified value, one of them is returned.
propertyName - the name of the propertyvalue - the property value
List<T> list(Specification<T> spec)
spec - the specification that must be satisfied
void fillCollection(Collection<? super T>... toBeFilled)
void fillCollection(Filter criteria,
Collection<? super T>... toBeFilled)
void setFirst(int first)
list() and list(Filter) when value 0 has been
set for 'first' in the filter.The value in the filter, if different than 0, will always superseed this value.
first - the index of the first object that will be retrieved by
list() e list(Filter)int getFirst()
list() e list(Filter).
list() e list(Filter)void setLast(int last)
list() e list(Filter) when value 0 has been
set for 'first' in the filter.The value in the filter, if different than 0, will always superseed this value.
If the repository contains less objects than the indicated index, all the objects will be retrieved.
last - the index of the last object that will be retrieved by
list() and list(Specification)int getLast()
list() e list(Specification).
This method will retrieve the same number that has been set using
setLast(int) independently of the repository content size.
list() and list(Filter)
void setOrder(String property,
boolean reverse)
list() and list(Specification).
If a previous order property was set it will be replaced.
property - the name of the property that will be used to order
the listsreverse - if this parameter is true the order will be ascendant,
otherwise it will be descendant
void addOrder(String property,
boolean reverse)
list() and list(Specification).
If a previous order property was set it will remain in place
and the new property will be added to the list.
property - the name of the property that will be used to order
the listsreverse - if this parameter is true the order will be ascendant,
otherwise it will be descendantvoid removeLastOrder()
String getOrderProperty()
list() and list(Specification) methods.
boolean isReverseOrder()
list() and
list(Specification) methods is ascending, false otherwise.
<J extends Serializable,E extends Entity<J>> Repository<J,E> getDetailRepository(Collection<E> details)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||