Package fr.gouv.vitam.functional.administration.core.contract

# Class AccessContractImpl

java.lang.Object
fr.gouv.vitam.functional.administration.core.contract.AccessContractImpl

All Implemented Interfaces:
  `VitamAutoCloseable`, `ContractService<AccessContractModel>`, `AutoCloseable`

public class AccessContractImpl extends Object implements ContractService<AccessContractModel>

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `protected static final class`
  `AccessContractImpl.AccessContractValidationService`
  Contract validator and logBook manager

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `CONTRACT_BACKUP_EVENT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AccessContractImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService)`
  Constructor
  `AccessContractImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, MetaDataClient metaDataClient, LogbookOperationsClient logbookClient, FunctionalBackupService functionalBackupService)`
  Constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `RequestResponse<AccessContractModel>`
  `createContracts(List<AccessContractModel> contractModelList)`
  Create a collections of contracts After passing the validation steps.
  `AccessContractModel`
  `findByIdentifier(String identifier)`
  Find contract by identifier
  `RequestResponseOK<AccessContractModel>`
  `findContracts(com.fasterxml.jackson.databind.JsonNode queryDsl)`
  find contract by QueryDsl
  `RequestResponse<AccessContractModel>`
  `updateContract(String identifier, com.fasterxml.jackson.databind.JsonNode queryDsl)`
  Update contracts status after passing validation steps : Field modified : - ActivationDate - DesactivationDate - LastUpdate - Status

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### CONTRACT_BACKUP_EVENT

    public static final String CONTRACT_BACKUP_EVENT
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### AccessContractImpl

    public AccessContractImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService)
    Constructor
    Parameters:
      `mongoAccess` - MongoDB client
      `vitamCounterService` -

  - ### AccessContractImpl

    public AccessContractImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, MetaDataClient metaDataClient, LogbookOperationsClient logbookClient, FunctionalBackupService functionalBackupService)
    Constructor
    Parameters:
      `mongoAccess` -
      `vitamCounterService` -
      `metaDataClient` -
      `logbookClient` -
      `functionalBackupService` -

- ## Method Details

  - ### createContracts

    public RequestResponse<AccessContractModel> createContracts(List<AccessContractModel> contractModelList) throws VitamException
    Description copied from interface: `ContractService`
    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
    Specified by:
      `createContracts` in interface `ContractService<AccessContractModel>`
    Parameters:
      `contractModelList` - the list of contracts to be created
    Returns:
      RequestResponseOK if success or VitamError
    Throws:
      `VitamException` - if in error occurs while validating contracts

  - ### findByIdentifier

    public AccessContractModel findByIdentifier(String identifier) throws ReferentialException, InvalidParseOperationException
    Description copied from interface: `ContractService`
    Find contract by identifier
    Specified by:
      `findByIdentifier` in interface `ContractService<AccessContractModel>`
    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

    public RequestResponseOK<AccessContractModel> findContracts(com.fasterxml.jackson.databind.JsonNode queryDsl) throws ReferentialException, InvalidParseOperationException
    Description copied from interface: `ContractService`
    find contract by QueryDsl
    Specified by:
      `findContracts` in interface `ContractService<AccessContractModel>`
    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

  - ### close

    public void close()
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `VitamAutoCloseable`

  - ### updateContract

    public RequestResponse<AccessContractModel> updateContract(String identifier, com.fasterxml.jackson.databind.JsonNode queryDsl) throws VitamException
    Description copied from interface: `ContractService`
    Update contracts status after passing validation steps : Field modified :
    - - ActivationDate
    - - DesactivationDate
    - - LastUpdate
    - - Status
    Specified by:
      `updateContract` in interface `ContractService<AccessContractModel>`
    Parameters:
      `identifier` - 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