Class ReplacementRepository
- java.lang.Object
-
- org.silverpeas.core.persistence.datasource.repository.jpa.AbstractJpaEntityRepository<E>
-
- org.silverpeas.core.persistence.datasource.repository.jpa.SilverpeasJpaEntityRepository<ReplacementImpl>
-
- org.silverpeas.core.workflow.engine.user.ReplacementRepository
-
- All Implemented Interfaces:
EntityRepository<ReplacementImpl>
,Replacement.Repository
@Repository public class ReplacementRepository extends SilverpeasJpaEntityRepository<ReplacementImpl> implements Replacement.Repository
Implementation of the business replacement repository by using JPA. This repository fires events at each modification (saving, deletion, ...) operated on the replacements so that services can be hooks on such events to perform additional treatments.- Author:
- mmoquillon
-
-
Constructor Summary
Constructors Constructor Description ReplacementRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Replacement<T>>
voiddelete(Replacement<T> replacement)
Deletes the specified replacement in this repository.List<ReplacementImpl>
findAllByIncumbentAndByWorkflow(User user, String workflowInstanceId)
Finds all the replacements by the specified replaced user and by the workflow instance identifier.List<ReplacementImpl>
findAllBySubstituteAndByWorkflow(User user, String workflowInstanceId)
Finds all the replacements by the specified substitute and by the workflow instance identifier.List<ReplacementImpl>
findAllByUsersAndByWorkflow(User incumbent, User substitute, String workflowInstanceId)
Finds all the replacements between the two specified users and created in the specified workflow instance.List<ReplacementImpl>
findAllByWorkflow(String workflowInstanceId)
Finds all the replacements created in the specified workflow instance.ReplacementImpl
findById(String replacementId)
Gets the replacement with the specified unique identifier.<T extends Replacement<T>>
Tsave(Replacement<T> replacement)
Saves or updates the specified replacement into this repository.-
Methods inherited from class org.silverpeas.core.persistence.datasource.repository.jpa.SilverpeasJpaEntityRepository
deleteByComponentInstanceId
-
Methods inherited from class org.silverpeas.core.persistence.datasource.repository.jpa.AbstractJpaEntityRepository
contains, countByCriteria, countFromJpqlString, delete, deleteById, deleteFromJpqlQuery, deleteFromNamedQuery, findByCriteria, findByNamedQuery, findFirstByNamedQuery, flush, getAll, getById, getById, getEntityClass, getEntityManager, getFromJpqlString, getFromJpqlString, getFromNamedQuery, getFromNamedQuery, getIdentifierConverter, getMaximumItemsInClause, listFromJpqlString, listFromJpqlString, listFromJpqlString, listFromJpqlString, listFromNamedQuery, listFromNamedQuery, newNamedParameters, noParameter, save, setMaximumItemsInClause, split, streamByNamedQuery, streamByNamedQuery, streamFromJpqlString, streamFromJpqlString, updateFromJpqlQuery, updateFromNamedQuery
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.silverpeas.core.persistence.datasource.repository.EntityRepository
delete, deleteById, getById, save, save
-
-
-
-
Method Detail
-
save
public <T extends Replacement<T>> T save(Replacement<T> replacement)
Description copied from interface:Replacement.Repository
Saves or updates the specified replacement into this repository.- Specified by:
save
in interfaceReplacement.Repository
- Parameters:
replacement
- the replacement to persist.- Returns:
- the persisted replacement.
-
delete
public <T extends Replacement<T>> void delete(Replacement<T> replacement)
Description copied from interface:Replacement.Repository
Deletes the specified replacement in this repository. If the replacement doesn't exist in the repository, nothing is done.- Specified by:
delete
in interfaceReplacement.Repository
- Parameters:
replacement
- the replacement to delete.
-
findAllByIncumbentAndByWorkflow
public List<ReplacementImpl> findAllByIncumbentAndByWorkflow(User user, String workflowInstanceId)
Description copied from interface:Replacement.Repository
Finds all the replacements by the specified replaced user and by the workflow instance identifier.- Specified by:
findAllByIncumbentAndByWorkflow
in interfaceReplacement.Repository
- Parameters:
user
- a user in the workflow instance.workflowInstanceId
- the unique identifier of a workflow instance.- Returns:
- a list of all persisted replacements of the specified user. If no replacements were set for the specified user in the given workflow instance, then an empty list is returned.
-
findAllBySubstituteAndByWorkflow
public List<ReplacementImpl> findAllBySubstituteAndByWorkflow(User user, String workflowInstanceId)
Description copied from interface:Replacement.Repository
Finds all the replacements by the specified substitute and by the workflow instance identifier.- Specified by:
findAllBySubstituteAndByWorkflow
in interfaceReplacement.Repository
- Parameters:
user
- a user in the workflow instance.workflowInstanceId
- the unique identifier of a workflow instance.- Returns:
- a list of all persisted replacements that will be done by the specified user. If no replacements were set with the specified user in the given workflow instance, then an empty list is returned.
-
findAllByWorkflow
public List<ReplacementImpl> findAllByWorkflow(String workflowInstanceId)
Description copied from interface:Replacement.Repository
Finds all the replacements created in the specified workflow instance.- Specified by:
findAllByWorkflow
in interfaceReplacement.Repository
- Parameters:
workflowInstanceId
- the unique identifier of a workflow instance.- Returns:
- a list of all persisted replacements that were created in the specified workflow instance. If no replacements were set in the given workflow instance, then an empty list is returned.
-
findAllByUsersAndByWorkflow
public List<ReplacementImpl> findAllByUsersAndByWorkflow(User incumbent, User substitute, String workflowInstanceId)
Description copied from interface:Replacement.Repository
Finds all the replacements between the two specified users and created in the specified workflow instance.- Specified by:
findAllByUsersAndByWorkflow
in interfaceReplacement.Repository
- Parameters:
incumbent
- the incumbent in the replacements to get.substitute
- the substitute in the replacements to get.workflowInstanceId
- the unique identifier of a workflow instance.- Returns:
- a list of all persisted replacements that were created in the specified workflow instance. If no replacements were set in the given workflow instance, then an empty list is returned.
-
findById
public ReplacementImpl findById(String replacementId)
Description copied from interface:Replacement.Repository
Gets the replacement with the specified unique identifier. The identifier of a replacement is unique among all over the workflow instances.- Specified by:
findById
in interfaceReplacement.Repository
- Parameters:
replacementId
- the unique identifier of a replacement among all of the available workflow instances.- Returns:
- a
Replacement
object or null if no such replacement exists with the specified unique identifier.
-
-