Package fr.gouv.vitam.access.internal.core

# Class AccessInternalModuleImpl

java.lang.Object
fr.gouv.vitam.access.internal.core.AccessInternalModuleImpl

All Implemented Interfaces:
  `AccessInternalModule`

public class AccessInternalModuleImpl extends Object implements AccessInternalModule
AccessModuleImpl implements AccessModule

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AccessInternalModuleImpl()`
  AccessModuleImpl constructor
  `AccessInternalModuleImpl(LogbookLifeCyclesClientFactory logbookLifeCyclesClientFactory, LogbookOperationsClientFactory logbookOperationsClientFactory, StorageClientFactory storageClientFactory, WorkspaceClientFactory workspaceClientFactory, AdminManagementClientFactory adminManagementClientFactory, MetaDataClientFactory metaDataClientFactory)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<StatusByAccessRequest>`
  `checkAccessRequestStatuses(List<AccessRequestReference> accessRequestReferences)`
  `void`
  `checkClassificationLevel(com.fasterxml.jackson.databind.JsonNode query)`
  check ClassificationLevel in update Unit
  `Optional<AccessRequestReference>`
  `createObjectAccessRequestIfRequired(String idObjectGroup, String qualifier, int version)`
  `jakarta.ws.rs.core.Response`
  `findDIPByOperationId(String id)`
  retrieve a DIP file according to an operationId
  `protected String`
  `findFirstAccessibleArchiveUnitId(List<String> archiveUnitIds)`
  `ObjectGroupResponse`
  `findOneObjectGroupByPersistentId(String persistentId, com.fasterxml.jackson.databind.JsonNode query)`
  `jakarta.ws.rs.core.Response`
  `findTransferSIPByOperationId(String id)`
  retrieve a SIP file according to an operationId
  `jakarta.ws.rs.core.Response`
  `getAccessLog(com.fasterxml.jackson.databind.JsonNode params)`
  Retrieve all accessLog by the concatenation of all accesslog files as InputStream
  `jakarta.ws.rs.core.Response`
  `getObjectByPersistentIdentifier(String persistentIdentifier)`
  Gets a Response as InputStream according the founded object by persistent identifier.
  `jakarta.ws.rs.core.Response`
  `getObjectByUnitPersistentIdentifier(String persistentIdentifier, String qualifier, Integer version)`
  `jakarta.ws.rs.core.Response`
  `getOneObjectFromObjectGroup(String idObjectGroup, String qualifier, int version, String idUnit)`
  Retrieve an object as InputStream based on the associated ObjectGroupId and qualifier + version requested
  `void`
  `removeAccessRequest(String strategyId, String accessRequestId)`
  `com.fasterxml.jackson.databind.JsonNode`
  `selectObjectGroupById(com.fasterxml.jackson.databind.JsonNode jsonQuery, String idObjectGroup)`
  Retrieve an ObjectGroup by its id with results fields filtered based on given query
  `com.fasterxml.jackson.databind.JsonNode`
  `selectObjects(com.fasterxml.jackson.databind.JsonNode jsonQuery)`
  select Object
  `com.fasterxml.jackson.databind.JsonNode`
  `selectPurgedPersistentIdentifier(String persistentIdentifier, PurgedCollectionType type)`
  select purged persistent identifiers
  `com.fasterxml.jackson.databind.JsonNode`
  `selectUnit(com.fasterxml.jackson.databind.JsonNode jsonQuery)`
  select Unit
  `com.fasterxml.jackson.databind.JsonNode`
  `selectUnitbyId(com.fasterxml.jackson.databind.JsonNode jsonQuery, String idUnit)`
  select Unit by id
  `com.fasterxml.jackson.databind.JsonNode`
  `selectUnitsWithInheritedRules(com.fasterxml.jackson.databind.JsonNode jsonQuery)`
  Select units by DSL and computes inherited rules for matching units
  `jakarta.ws.rs.core.Response`
  `streamObjects(com.fasterxml.jackson.databind.JsonNode query)`
  `jakarta.ws.rs.core.Response`
  `streamUnits(com.fasterxml.jackson.databind.JsonNode query)`
  `com.fasterxml.jackson.databind.JsonNode`
  `updateUnitById(com.fasterxml.jackson.databind.JsonNode queryJson, String idUnit, String requestId)`
  update Unit by id

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

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

- ## Constructor Details

  - ### AccessInternalModuleImpl

    public AccessInternalModuleImpl()
    AccessModuleImpl constructor

  - ### AccessInternalModuleImpl

    public AccessInternalModuleImpl(LogbookLifeCyclesClientFactory logbookLifeCyclesClientFactory, LogbookOperationsClientFactory logbookOperationsClientFactory, StorageClientFactory storageClientFactory, WorkspaceClientFactory workspaceClientFactory, AdminManagementClientFactory adminManagementClientFactory, MetaDataClientFactory metaDataClientFactory)

- ## Method Details

  - ### selectUnit

    public com.fasterxml.jackson.databind.JsonNode selectUnit(com.fasterxml.jackson.databind.JsonNode jsonQuery) throws IllegalArgumentException, InvalidParseOperationException, AccessInternalExecutionException
    select Unit
    Specified by:
      `selectUnit` in interface `AccessInternalModule`
    Parameters:
      `jsonQuery` - as String { $query : query}
    Returns:
      the result of the select on Unit
    Throws:
      `InvalidParseOperationException` - Throw if json format is not correct
      `AccessInternalExecutionException` - Throw if error occurs when send Unit to database
      `IllegalArgumentException` - if json query is null

  - ### selectPurgedPersistentIdentifier

    public com.fasterxml.jackson.databind.JsonNode selectPurgedPersistentIdentifier(String persistentIdentifier, @Nullable PurgedCollectionType type) throws InvalidParseOperationException, AccessInternalException
    select purged persistent identifiers
    Specified by:
      `selectPurgedPersistentIdentifier` in interface `AccessInternalModule`
    Parameters:
      `persistentIdentifier` - as String persistent identifier
      `type` - Purged collection type
    Returns:
      the result of the select on persistent identifier
    Throws:
      `InvalidParseOperationException` - Throw if parameter is not correct
      `AccessInternalException`

  - ### selectUnitbyId

    public com.fasterxml.jackson.databind.JsonNode selectUnitbyId(com.fasterxml.jackson.databind.JsonNode jsonQuery, String idUnit) throws InvalidParseOperationException, AccessInternalExecutionException, MetaDataNotFoundException
    Description copied from interface: `AccessInternalModule`
    select Unit by id
    Specified by:
      `selectUnitbyId` in interface `AccessInternalModule`
    Parameters:
      `jsonQuery` - as String { $query : query}
      `idUnit` - as String
    Returns:
      the corresponding JsonNode
    Throws:
      `InvalidParseOperationException` - Throw if json format is not correct
      `AccessInternalExecutionException` - Throw if error occurs when send Unit to database
      `MetaDataNotFoundException`

  - ### selectObjectGroupById

    public com.fasterxml.jackson.databind.JsonNode selectObjectGroupById(com.fasterxml.jackson.databind.JsonNode jsonQuery, String idObjectGroup) throws InvalidParseOperationException, AccessInternalExecutionException, MetaDataNotFoundException
    Description copied from interface: `AccessInternalModule`
    Retrieve an ObjectGroup by its id with results fields filtered based on given query
    Specified by:
      `selectObjectGroupById` in interface `AccessInternalModule`
    Parameters:
      `jsonQuery` - the query DSL as a Json node
      `idObjectGroup` - the id of the ObjectGroup as
    Returns:
      the ObjectGroup metadata as a JsonNode
    Throws:
      `InvalidParseOperationException` - thrown if json query is not syntactically correct
      `AccessInternalExecutionException` - in case of access failure
      `MetaDataNotFoundException`

  - ### getOneObjectFromObjectGroup

    public jakarta.ws.rs.core.Response getOneObjectFromObjectGroup(String idObjectGroup, String qualifier, int version, String idUnit) throws StorageNotFoundException, AccessInternalExecutionException, MetaDataNotFoundException, InvalidParseOperationException, AccessInternalUnavailableDataFromAsyncOfferException
    Description copied from interface: `AccessInternalModule`
    Retrieve an object as InputStream based on the associated ObjectGroupId and qualifier + version requested
    Specified by:
      `getOneObjectFromObjectGroup` in interface `AccessInternalModule`
    Parameters:
      `idObjectGroup` - The Object Group Id
      `qualifier` - the qualifier to be retrieve (ie: Dissemination etc.)
      `version` - the version number to get
      `idUnit` - identifier of the parent archiveunit used to have access to the object
    Returns:
      response
    Throws:
      `StorageNotFoundException` - If the object is not found in storage
      `AccessInternalExecutionException` - For other technical errors
      `MetaDataNotFoundException`
      `InvalidParseOperationException` - when a query is badly structured
      `AccessInternalUnavailableDataFromAsyncOfferException`

  - ### getAccessLog

    public jakarta.ws.rs.core.Response getAccessLog(com.fasterxml.jackson.databind.JsonNode params) throws AccessInternalExecutionException, StorageNotFoundException, ParseException
    Description copied from interface: `AccessInternalModule`
    Retrieve all accessLog by the concatenation of all accesslog files as InputStream
    Specified by:
      `getAccessLog` in interface `AccessInternalModule`
    Parameters:
      `params` - a json containing query on StartDate or EndDate
    Returns:
      the Storage response for the asked file
    Throws:
      `AccessInternalExecutionException`
      `StorageNotFoundException`
      `ParseException`

  - ### checkClassificationLevel

    public void checkClassificationLevel(com.fasterxml.jackson.databind.JsonNode query) throws InvalidParseOperationException
    Description copied from interface: `AccessInternalModule`
    check ClassificationLevel in update Unit
    Specified by:
      `checkClassificationLevel` in interface `AccessInternalModule`
    Parameters:
      `query` - query
    Throws:
      `InvalidParseOperationException` - InvalidParseOperationException

  - ### findOneObjectGroupByPersistentId

    public ObjectGroupResponse findOneObjectGroupByPersistentId(String persistentId, @Nullable com.fasterxml.jackson.databind.JsonNode query) throws MetaDataNotFoundException, AccessUnauthorizedException
    Specified by:
      `findOneObjectGroupByPersistentId` in interface `AccessInternalModule`
    Throws:
      `MetaDataNotFoundException`
      `AccessUnauthorizedException`

  - ### getObjectByPersistentIdentifier

    public jakarta.ws.rs.core.Response getObjectByPersistentIdentifier(String persistentIdentifier) throws MetaDataNotFoundException, StorageNotFoundException, AccessInternalException, AccessUnauthorizedException
    Description copied from interface: `AccessInternalModule`
    Gets a Response as InputStream according the founded object by persistent identifier.
    Specified by:
      `getObjectByPersistentIdentifier` in interface `AccessInternalModule`
    Parameters:
      `persistentIdentifier` - The object persistent identifier.
    Returns:
      Response with InputStream.
    Throws:
      `MetaDataNotFoundException` - when persistent identifier not found in metadata database.
      `StorageNotFoundException`
      `AccessInternalException`
      `AccessUnauthorizedException`

  - ### findFirstAccessibleArchiveUnitId

    protected String findFirstAccessibleArchiveUnitId(List<String> archiveUnitIds) throws AccessInternalException, MetaDataNotFoundException
    Throws:
      `AccessInternalException`
      `MetaDataNotFoundException`

  - ### createObjectAccessRequestIfRequired

    public Optional<AccessRequestReference> createObjectAccessRequestIfRequired(String idObjectGroup, String qualifier, int version) throws MetaDataNotFoundException, InvalidParseOperationException, AccessInternalExecutionException
    Specified by:
      `createObjectAccessRequestIfRequired` in interface `AccessInternalModule`
    Throws:
      `MetaDataNotFoundException`
      `InvalidParseOperationException`
      `AccessInternalExecutionException`

  - ### checkAccessRequestStatuses

    public List<StatusByAccessRequest> checkAccessRequestStatuses(List<AccessRequestReference> accessRequestReferences) throws AccessInternalExecutionException, AccessInternalIllegalOperationException
    Specified by:
      `checkAccessRequestStatuses` in interface `AccessInternalModule`
    Throws:
      `AccessInternalExecutionException`
      `AccessInternalIllegalOperationException`

  - ### removeAccessRequest

    public void removeAccessRequest(String strategyId, String accessRequestId) throws AccessInternalExecutionException, AccessInternalIllegalOperationException
    Specified by:
      `removeAccessRequest` in interface `AccessInternalModule`
    Throws:
      `AccessInternalExecutionException`
      `AccessInternalIllegalOperationException`

  - ### streamUnits

    public jakarta.ws.rs.core.Response streamUnits(com.fasterxml.jackson.databind.JsonNode query) throws AccessInternalExecutionException, MetadataScrollLimitExceededException, MetadataScrollThresholdExceededException
    Specified by:
      `streamUnits` in interface `AccessInternalModule`
    Throws:
      `AccessInternalExecutionException`
      `MetadataScrollLimitExceededException`
      `MetadataScrollThresholdExceededException`

  - ### streamObjects

    public jakarta.ws.rs.core.Response streamObjects(com.fasterxml.jackson.databind.JsonNode query) throws AccessInternalExecutionException, MetadataScrollLimitExceededException, MetadataScrollThresholdExceededException
    Specified by:
      `streamObjects` in interface `AccessInternalModule`
    Throws:
      `AccessInternalExecutionException`
      `MetadataScrollLimitExceededException`
      `MetadataScrollThresholdExceededException`

  - ### getObjectByUnitPersistentIdentifier

    public jakarta.ws.rs.core.Response getObjectByUnitPersistentIdentifier(String persistentIdentifier, String qualifier, Integer version) throws StorageNotFoundException, MetaDataNotFoundException, AccessInternalException
    Specified by:
      `getObjectByUnitPersistentIdentifier` in interface `AccessInternalModule`
    Throws:
      `StorageNotFoundException`
      `MetaDataNotFoundException`
      `AccessInternalException`

  - ### updateUnitById

    public com.fasterxml.jackson.databind.JsonNode updateUnitById(com.fasterxml.jackson.databind.JsonNode queryJson, String idUnit, String requestId) throws MetaDataNotFoundException, IllegalArgumentException, InvalidParseOperationException, AccessInternalExecutionException, UpdatePermissionException, AccessInternalRuleExecutionException
    Description copied from interface: `AccessInternalModule`
    update Unit by id
    Specified by:
      `updateUnitById` in interface `AccessInternalModule`
    Parameters:
      `queryJson` - json update query
      `idUnit` - as String
      `requestId` - the request id
    Returns:
      the result of the update on Unit
    Throws:
      `MetaDataNotFoundException` - Throw if unit is not found
      `IllegalArgumentException` - Throw if error occurs when checking argument
      `InvalidParseOperationException` - Throw if json format is not correct
      `AccessInternalExecutionException` - Throw if error occurs when send Unit to database
      `AccessInternalRuleExecutionException` - Throw When error occures on rules update check
      `UpdatePermissionException`

  - ### findDIPByOperationId

    public jakarta.ws.rs.core.Response findDIPByOperationId(String id) throws AccessInternalExecutionException
    Description copied from interface: `AccessInternalModule`
    retrieve a DIP file according to an operationId
    Specified by:
      `findDIPByOperationId` in interface `AccessInternalModule`
    Parameters:
      `id` - operation id
    Returns:
      zip file containing a DIP
    Throws:
      `AccessInternalExecutionException`

  - ### findTransferSIPByOperationId

    public jakarta.ws.rs.core.Response findTransferSIPByOperationId(String id) throws AccessInternalExecutionException
    Description copied from interface: `AccessInternalModule`
    retrieve a SIP file according to an operationId
    Specified by:
      `findTransferSIPByOperationId` in interface `AccessInternalModule`
    Parameters:
      `id` - operation id
    Returns:
      zip file containing a SIP
    Throws:
      `AccessInternalExecutionException`

  - ### selectObjects

    public com.fasterxml.jackson.databind.JsonNode selectObjects(com.fasterxml.jackson.databind.JsonNode jsonQuery) throws IllegalArgumentException, InvalidParseOperationException, AccessInternalExecutionException
    select Object
    Specified by:
      `selectObjects` in interface `AccessInternalModule`
    Parameters:
      `jsonQuery` - as String { $query : query}
    Returns:
      the result of the select on object
    Throws:
      `InvalidParseOperationException` - Throw if json format is not correct
      `AccessInternalExecutionException` - Throw if error occurs when send Object to database
      `IllegalArgumentException` - if json query is null

  - ### selectUnitsWithInheritedRules

    public com.fasterxml.jackson.databind.JsonNode selectUnitsWithInheritedRules(com.fasterxml.jackson.databind.JsonNode jsonQuery) throws IllegalArgumentException, InvalidParseOperationException, AccessInternalExecutionException
    Description copied from interface: `AccessInternalModule`
    Select units by DSL and computes inherited rules for matching units
    Specified by:
      `selectUnitsWithInheritedRules` in interface `AccessInternalModule`
    Parameters:
      `jsonQuery` - the query DSL
    Returns:
      the selected units with there inherited rules
    Throws:
      `IllegalArgumentException` - Throw if json format is not correct
      `InvalidParseOperationException`
      `AccessInternalExecutionException` - Throw if error occurs when send Unit to database