com.googlecode.jbp.common.repository
Interface IRepository<ID extends Serializable,DomainModel extends IIdentifiable<ID>>

Type Parameters:
DomainModel - The class of the entity's domain model.
ID - The class of the entity's identifier. Usually, this should be a java.lang.Long.

public interface IRepository<ID extends Serializable,DomainModel extends IIdentifiable<ID>>

Interface with common data access methods.

Author:
Yannick LOTH - yannick AT littlej.biz -

Method Summary
 DomainModel create(DomainModel entity)
          Persists the given entity.
 void delete(Collection<DomainModel> t)
          Deletes the specified entities.
 void delete(DomainModel t)
          Deletes the specified entity.
 void delete(ID id)
          Deletes the entity with the specified identifier.
 void deleteAll()
          Deletes all persisted entities.
 boolean exists(DomainModel entity)
          Checks for the existence of the specified entity.
 boolean exists(ID id)
          Checks if an entity with the specified identifier exists.
 List<DomainModel> retrieveAll()
          Retrieves all persisted entities.
 List<DomainModel> retrieveAll(Page pageParam)
          Retrieves persisted entities from the specified page.
 DomainModel retrieveById(ID id)
          Retrieves an entity using its identifier.
 void update(Collection<DomainModel> entities)
          Updates all given entities.
 void update(DomainModel t)
          Updates the given entity.
 

Method Detail

create

DomainModel create(DomainModel entity)
Persists the given entity.

Parameters:
entity - The entity that must be persisted. Must not be null.
Returns:
Returns the persisted entity.

retrieveAll

List<DomainModel> retrieveAll()
Retrieves all persisted entities.

Returns:
Returns a java.util.List{@code true} with all persisted entities.

retrieveById

DomainModel retrieveById(ID id)
Retrieves an entity using its identifier.

Parameters:
id - The identifier.
Returns:
The entity with the given identifier.

retrieveAll

List<DomainModel> retrieveAll(Page pageParam)
Retrieves persisted entities from the specified page.

Returns:
Returns a java.util.List with persisted entities from the specified page.

exists

boolean exists(DomainModel entity)
Checks for the existence of the specified entity.

Parameters:
entity - The entity.
Returns:
Returns true if the entity is persisted, false else.

exists

boolean exists(ID id)
Checks if an entity with the specified identifier exists.

Parameters:
id - The identifier.
Returns:
true if the entity exists, false else.

update

void update(DomainModel t)
Updates the given entity.

Parameters:
t - The entity which must be updated.

update

void update(Collection<DomainModel> entities)
Updates all given entities.

Parameters:
entities - A java.lang.Collection with all entities which must be updated. Must not be null. May be an empty.

delete

void delete(DomainModel t)
Deletes the specified entity.

Parameters:
t - The entity which must be deleted.

delete

void delete(ID id)
Deletes the entity with the specified identifier. If no entity has the specified identifier, nothing happens.

Parameters:
id - The identifier.

delete

void delete(Collection<DomainModel> t)
Deletes the specified entities.

Parameters:
t - A java.util.Collection with all entities which must be deleted.

deleteAll

void deleteAll()
Deletes all persisted entities.



Copyright © 2011. All Rights Reserved.