it.amattioli.dominate.hibernate
Class CollectionHibernateRepository<I extends Serializable,T extends Entity<I>>

Show UML class diagram
java.lang.Object
  extended by it.amattioli.dominate.hibernate.AbstractHibernateRepository<I,T>
      extended by it.amattioli.dominate.hibernate.CollectionHibernateRepository<I,T>
All Implemented Interfaces:
Repository<I,T>, Cloneable

public class CollectionHibernateRepository<I extends Serializable,T extends Entity<I>>
extends AbstractHibernateRepository<I,T>


Constructor Summary
CollectionHibernateRepository(Collection<T> content)
           
 
Method Summary
 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.
<J extends Serializable,E extends Entity<J>>
Repository<J,E>
getDetailRepository(Collection<E> details)
           
 boolean isRemoveAllowed()
          Check if this repository supports object removal.
 List<T> list()
          Retrieves all the objects contained in this repository.
 List<T> list(Filter criteria)
          Retrieves the objects contained in this repository that match the specified filter.
 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 Repository.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 Repository.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.
 
Methods inherited from class it.amattioli.dominate.hibernate.AbstractHibernateRepository
addOrder, clone, getByPropertyValue, getFirst, getHibernateSession, getHqlOrder, getLast, getOrderProperty, getOrders, getSessionManager, isReverseOrder, removeLastOrder, setFirst, setLast, setOrder, setSessionManager
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionHibernateRepository

public CollectionHibernateRepository(Collection<T> content)
Method Detail

get

public T get(I id)
Description copied from interface: Repository
Retrieve an entity from this repository using its id.

Parameters:
id - the id of the entity you want to retrieve.
Returns:
the entity, contained in this repository, whose id is the same as the parameter

put

public void put(T object)
Description copied from interface: Repository
Add a new entity to this repository.

Parameters:
object - the entity you want to add

refresh

public void refresh(I objectId)
Description copied from interface: Repository
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 Repository.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.

Parameters:
objectId - the id of the object to be refreshed

refresh

public void refresh(T object)
Description copied from interface: Repository
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 Repository.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.

Parameters:
object - the object to be refreshed

isRemoveAllowed

public boolean isRemoveAllowed()
Description copied from interface: Repository
Check if this repository supports object removal.

Returns:
true if this repository supports object removal

remove

public void remove(I objectId)
Description copied from interface: Repository
Removes an object from this repository. Before calling this method clients should check id this repository supports object removal using Repository.isRemoveAllowed()

Parameters:
objectId - the id of the object to remove

remove

public void remove(T object)
Description copied from interface: Repository
Removes an object from this repository. Before calling this method clients should check id this repository supports object removal using Repository.isRemoveAllowed()

Parameters:
object - the object to remove

list

public List<T> list()
Description copied from interface: Repository
Retrieves all the objects contained in this repository. The order of the object inside the list depends on the "order" property. If "first" and "last" properties have been set only a part of the entities will be retrieved.

Returns:
all the entities contained in this repository
See Also:
#setFirst(int)}, {@link #setLast(int)}, {@link #setOrder(String, boolean)}

list

public List<T> list(Filter criteria)
Description copied from interface: Repository
Retrieves the objects contained in this repository that match the specified filter. The order of the object inside the list depends on the "order" property. If "first" and "last" properties have been set only a part of the entities will be retrieved.

Parameters:
criteria - the filter to be used
Returns:
the objects contained in this repository that match the specified filter
See Also:
#setFirst(int)}, {@link #setLast(int)}, {@link #setOrder(String, boolean)}

list

public List<T> list(Specification<T> spec)
Description copied from interface: Repository
Retrieves the objects contained in this repository that satisfied the given specification. The order of the object inside the list depends on the "order" property. If "first" and "last" properties have been set only a part of the entities will be retrieved.

Parameters:
spec - the specification that must be satisfied
Returns:
the objects contained in this repository that satisfied the given specification

getDetailRepository

public <J extends Serializable,E extends Entity<J>> Repository<J,E> getDetailRepository(Collection<E> details)

fillCollection

public void fillCollection(Filter criteria,
                           Collection<? super T>... toBeFilled)

fillCollection

public void fillCollection(Collection<? super T>... toBeFilled)


Copyright © 2011. All Rights Reserved.