Interface Replacement.Repository

  • All Known Implementing Classes:
    ReplacementRepository
    Enclosing interface:
    Replacement<T extends Replacement<T>>

    public static interface Replacement.Repository
    Repository storing the replacements and backing the actual used data source of such replacements. This repository shouldn't be used directly; it is dedicated to the Replacement objects for use.
    • Method Detail

      • save

        <T extends Replacement<T>> T save​(Replacement<T> replacement)
        Saves or updates the specified replacement into this repository.
        Parameters:
        replacement - the replacement to persist.
        Returns:
        the persisted replacement.
      • delete

        <T extends Replacement<T>> void delete​(Replacement<T> replacement)
        Deletes the specified replacement in this repository. If the replacement doesn't exist in the repository, nothing is done.
        Parameters:
        replacement - the replacement to delete.
      • findAllByIncumbentAndByWorkflow

        <T extends Replacement<T>> List<T> findAllByIncumbentAndByWorkflow​(User user,
                                                                           String workflowInstanceId)
        Finds all the replacements by the specified replaced user and by the workflow instance identifier.
        Type Parameters:
        T - the class implementing the Replacement interface.
        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

        <T extends Replacement<T>> List<T> findAllBySubstituteAndByWorkflow​(User user,
                                                                            String workflowInstanceId)
        Finds all the replacements by the specified substitute and by the workflow instance identifier.
        Type Parameters:
        T - the class implementing the Replacement interface.
        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

        <T extends Replacement<T>> List<T> findAllByWorkflow​(String workflowInstanceId)
        Finds all the replacements created in the specified workflow instance.
        Type Parameters:
        T - the class implementing the Replacement interface.
        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

        <T extends Replacement<T>> List<T> findAllByUsersAndByWorkflow​(User incumbent,
                                                                       User substitute,
                                                                       String workflowInstanceId)
        Finds all the replacements between the two specified users and created in the specified workflow instance.
        Type Parameters:
        T - the class implementing the Replacement interface.
        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

        <T extends Replacement<T>> T findById​(String replacementId)
        Gets the replacement with the specified unique identifier. The identifier of a replacement is unique among all over the workflow instances.
        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.