org.silverpeas.persistence.repository
Interface EntityRepository<ENTITY extends Entity<ENTITY,ENTITY_IDENTIFIER_TYPE>,ENTITY_IDENTIFIER_TYPE>

Type Parameters:
ENTITY - specify the class name of the entity which is handled by the repository manager.
ENTITY_IDENTIFIER_TYPE - the identifier class name used by ENTITY for its primary key definition.
All Known Implementing Classes:
PersistentResourceDateReminderRepository, SilverpeasJpaEntityManager

public interface EntityRepository<ENTITY extends Entity<ENTITY,ENTITY_IDENTIFIER_TYPE>,ENTITY_IDENTIFIER_TYPE>

This interface must be implemented by all repositories handling Silverpeas entities that have to be persisted.

It provides common entity query methods.

Author:
Yohann Chastagnier

Method Summary
 void delete(ENTITY... entity)
          Deletes entities.
 void delete(List<ENTITY> entities)
          Deletes entities.
 long deleteById(Collection<String> ids)
          Deletes entities by their ids.
 long deleteById(String... ids)
          Deletes entities by their ids.
 List<ENTITY> getAll()
          Gets all persisted entities.
 List<ENTITY> getById(Collection<String> ids)
          Gets persisted entities by their ids.
 List<ENTITY> getById(String... ids)
          Gets persisted entities by their ids.
 ENTITY getById(String id)
          Gets a persisted entity by its id.
 List<ENTITY> save(OperationContext context, ENTITY... entities)
          Persists entities : create (if id is null or empty) or update.
 ENTITY save(OperationContext context, ENTITY entity)
          Persists entity : create (if id is null or empty) or update.
 List<ENTITY> save(OperationContext context, List<ENTITY> entities)
          Persists entities : create (if id is null or empty) or update.
 

Method Detail

getAll

List<ENTITY> getAll()
Gets all persisted entities. (It is recommended to not use this method on huge persitent containers)

Returns:

getById

ENTITY getById(String id)
Gets a persisted entity by its id.

Returns:

getById

List<ENTITY> getById(String... ids)
Gets persisted entities by their ids.

Returns:

getById

List<ENTITY> getById(Collection<String> ids)
Gets persisted entities by their ids.

Returns:

save

ENTITY save(OperationContext context,
            ENTITY entity)
Persists entity : create (if id is null or empty) or update.

Parameters:
context - the context of the save operation (containing the user saver for example).
entity - the entity to save.
Returns:
the created or updated entity.

save

List<ENTITY> save(OperationContext context,
                  ENTITY... entities)
Persists entities : create (if id is null or empty) or update.

Parameters:
context - the context of the save operation (containing the user saver for example).
entities - the entities to save.
Returns:

save

List<ENTITY> save(OperationContext context,
                  List<ENTITY> entities)
Persists entities : create (if id is null or empty) or update.

Parameters:
context - the context of the save operation (containing the user saver for example).
entities - the entities to save.
Returns:

delete

void delete(ENTITY... entity)
Deletes entities.


delete

void delete(List<ENTITY> entities)
Deletes entities.


deleteById

long deleteById(String... ids)
Deletes entities by their ids.

Parameters:
ids -
Returns:
number of deleted entities.

deleteById

long deleteById(Collection<String> ids)
Deletes entities by their ids.

Parameters:
ids -
Returns:
number of deleted entities.


Copyright © 2016 Silverpeas. All Rights Reserved.