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

# Class ContextServiceImpl

java.lang.Object
fr.gouv.vitam.functional.administration.core.context.ContextServiceImpl

All Implemented Interfaces:
  `VitamAutoCloseable`, `ContextService`, `AutoCloseable`

public class ContextServiceImpl extends Object implements ContextService

- ## Field Summary

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

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ContextServiceImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService)`
  Constructor
  `ContextServiceImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, ContractService<IngestContractModel> ingestContract, ContractService<AccessContractModel> accessContract, SecurityProfileService securityProfileService, FunctionalBackupService functionalBackupService)`
  Constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `RequestResponse<ContextModel>`
  `createContexts(List<ContextModel> contextModelList)`
  Create a list of contexts
  `RequestResponse<ContextModel>`
  `deleteContext(String contextId, boolean forceDelete)`
  Delete a context
  `DbRequestResult`
  `findContexts(com.fasterxml.jackson.databind.JsonNode queryDsl)`
  Search for contexts
  `ContextModel`
  `findOneContextById(String id)`
  Find a context by its id
  `boolean`
  `securityProfileIsUsedInContexts(String securityProfileId)`
  `void`
  `setSecurityProfileService(SecurityProfileService securityProfileService)`
  `RequestResponse<ContextModel>`
  `updateContext(String id, com.fasterxml.jackson.databind.JsonNode queryDsl)`
  Update a context

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

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

- ## Field Details

  - ### CONTEXTS_BACKUP_EVENT

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

- ## Constructor Details

  - ### ContextServiceImpl

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

  - ### ContextServiceImpl

    public ContextServiceImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, ContractService<IngestContractModel> ingestContract, ContractService<AccessContractModel> accessContract, SecurityProfileService securityProfileService, FunctionalBackupService functionalBackupService)
    Constructor
    Parameters:
      `mongoAccess` - MongoDB client

- ## Method Details

  - ### createContexts

    public RequestResponse<ContextModel> createContexts(List<ContextModel> contextModelList) throws VitamException
    Description copied from interface: `ContextService`
    Create a list of contexts
    Specified by:
      `createContexts` in interface `ContextService`
    Parameters:
      `contextModelList` - the context list to be created
    Returns:
      a response as a RequestResponse Object
    Throws:
      `VitamException` - thrown if operation could not be done

  - ### findContexts

    public DbRequestResult findContexts(com.fasterxml.jackson.databind.JsonNode queryDsl) throws ReferentialException
    Description copied from interface: `ContextService`
    Search for contexts
    Specified by:
      `findContexts` in interface `ContextService`
    Parameters:
      `queryDsl` - the query to be used for the search
    Returns:
      the list of contexts as a DbRequestResult
    Throws:
      `ReferentialException` - thrown if the query could not be executed

  - ### findOneContextById

    public ContextModel findOneContextById(String id) throws ReferentialException, InvalidParseOperationException
    Description copied from interface: `ContextService`
    Find a context by its id
    Specified by:
      `findOneContextById` in interface `ContextService`
    Parameters:
      `id` - the id of the context
    Returns:
      the context as a ContextModel
    Throws:
      `ReferentialException` - thrown if the context could not be found
      `InvalidParseOperationException` - thrown if the query is incorrect

  - ### deleteContext

    public RequestResponse<ContextModel> deleteContext(String contextId, boolean forceDelete) throws VitamException
    Description copied from interface: `ContextService`
    Delete a context
    Specified by:
      `deleteContext` in interface `ContextService`
    Parameters:
      `contextId` - the id of the context
      `forceDelete` -
    Returns:
      a response as a RequestResponse object
    Throws:
      `VitamException` - thrown if operation could not be done

  - ### securityProfileIsUsedInContexts

    public boolean securityProfileIsUsedInContexts(String securityProfileId) throws InvalidCreateOperationException, ReferentialException, InvalidParseOperationException
    Specified by:
      `securityProfileIsUsedInContexts` in interface `ContextService`
    Throws:
      `InvalidCreateOperationException`
      `ReferentialException`
      `InvalidParseOperationException`

  - ### updateContext

    public RequestResponse<ContextModel> updateContext(String id, com.fasterxml.jackson.databind.JsonNode queryDsl) throws VitamException
    Description copied from interface: `ContextService`
    Update a context
    Specified by:
      `updateContext` in interface `ContextService`
    Parameters:
      `id` - the id of the context
      `queryDsl` - the update command as a query
    Returns:
      a response as a RequestResponse object
    Throws:
      `VitamException` - thrown if operation could not be done

  - ### close

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

  - ### setSecurityProfileService

    public void setSecurityProfileService(SecurityProfileService securityProfileService)
    Specified by:
      `setSecurityProfileService` in interface `ContextService`