Type Parameters:
T - AccessContractModel or IngestContractModel
All Superinterfaces:
AutoCloseable, VitamAutoCloseable
All Known Implementing Classes:
AccessContractImpl, IngestContractImpl, ManagementContractImpl

public interface ContractService<T extends AbstractContractModel> extends VitamAutoCloseable
ContractService Interface declaring common methods for Contracts
  • Method Details

    • createContracts

      RequestResponse<T> createContracts(List<T> contractModelList) throws VitamException
      Create a collections of contracts After passing the validation steps. If all the contracts are valid, they are stored in the collection and indexed.
      The access contract are valid in the following situations :
      • The collection contains 2 ore many contracts having the same name
      • One or more mandatory field is missing
      • A field has an invalid format
      • One or many contracts already exist in the database
      Parameters:
      contractModelList - the list of contracts to be created
      Returns:
      RequestResponseOK if success or VitamError
      Throws:
      VitamException - if in error occurs while validating contracts
    • updateContract

      RequestResponse<T> updateContract(String id, com.fasterxml.jackson.databind.JsonNode queryDsl) throws VitamException
      Update contracts status after passing validation steps :
      Field modified :
      • - ActivationDate
      • - DesactivationDate
      • - LastUpdate
      • - Status
      Parameters:
      id - the id of the contract to be updated
      queryDsl - the given queryDsl for update
      Returns:
      RequestResponseOK if success or VitamError
      Throws:
      VitamException - if in error occurs while validating contracts
    • findByIdentifier

      T findByIdentifier(String identifier) throws ReferentialException, InvalidParseOperationException
      Find contract by identifier
      Parameters:
      identifier - the identifier of the contract
      Returns:
      T the contract corresponding to this identifier
      Throws:
      ReferentialException - thrown if the query could not be executed
      InvalidParseOperationException - thrown if the query could not be created
    • findContracts

      RequestResponseOK<T> findContracts(com.fasterxml.jackson.databind.JsonNode queryDsl) throws ReferentialException, InvalidParseOperationException
      find contract by QueryDsl
      Parameters:
      queryDsl - the query to be executed
      Returns:
      list of T
      Throws:
      ReferentialException - thrown if the query could not be executed
      InvalidParseOperationException - thrown is the query is incorrect