Class AccessInternalModuleImpl
- java.lang.Object
-
- fr.gouv.vitam.access.internal.core.AccessInternalModuleImpl
-
- All Implemented Interfaces:
AccessInternalModule
public class AccessInternalModuleImpl extends java.lang.Object implements AccessInternalModule
AccessModuleImpl implements AccessModule
-
-
Constructor Summary
Constructors Constructor Description AccessInternalModuleImpl()
AccessModuleImpl constructorAccessInternalModuleImpl(LogbookLifeCyclesClientFactory logbookLifeCyclesClientFactory, LogbookOperationsClientFactory logbookOperationsClientFactory, StorageClientFactory storageClientFactory, WorkspaceClientFactory workspaceClientFactory, AdminManagementClientFactory adminManagementClientFactory, MetaDataClientFactory metaDataClientFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<StatusByAccessRequest>
checkAccessRequestStatuses(java.util.List<AccessRequestReference> accessRequestReferences)
void
checkClassificationLevel(com.fasterxml.jackson.databind.JsonNode query)
check ClassificationLevel in update Unitjava.util.Optional<AccessRequestReference>
createObjectAccessRequestIfRequired(java.lang.String idObjectGroup, java.lang.String qualifier, int version)
javax.ws.rs.core.Response
findDIPByOperationId(java.lang.String id)
retrieve a DIP file according to an operationIdprotected java.lang.String
findFirstAccessibleArchiveUnitId(java.util.List<java.lang.String> archiveUnitIds)
ObjectGroupResponse
findOneObjectGroupByPersistentId(java.lang.String persistentId, com.fasterxml.jackson.databind.JsonNode query)
javax.ws.rs.core.Response
findTransferSIPByOperationId(java.lang.String id)
retrieve a SIP file according to an operationIdjavax.ws.rs.core.Response
getAccessLog(com.fasterxml.jackson.databind.JsonNode params)
Retrieve all accessLog by the concatenation of all accesslog files as InputStreamjavax.ws.rs.core.Response
getObjectByPersistentIdentifier(java.lang.String persistentIdentifier)
Gets a Response as InputStream according the founded object by persistent identifier.javax.ws.rs.core.Response
getObjectByUnitPersistentIdentifier(java.lang.String persistentIdentifier, java.lang.String qualifier, java.lang.Integer version)
javax.ws.rs.core.Response
getOneObjectFromObjectGroup(java.lang.String idObjectGroup, java.lang.String qualifier, int version, java.lang.String idUnit)
Retrieve an object as InputStream based on the associated ObjectGroupId and qualifier + version requestedvoid
removeAccessRequest(java.lang.String strategyId, java.lang.String accessRequestId)
com.fasterxml.jackson.databind.JsonNode
selectObjectGroupById(com.fasterxml.jackson.databind.JsonNode jsonQuery, java.lang.String idObjectGroup)
Retrieve an ObjectGroup by its id with results fields filtered based on given querycom.fasterxml.jackson.databind.JsonNode
selectObjects(com.fasterxml.jackson.databind.JsonNode jsonQuery)
select Objectcom.fasterxml.jackson.databind.JsonNode
selectPurgedPersistentIdentifier(java.lang.String persistentIdentifier, PurgedCollectionType type)
select purged persistent identifierscom.fasterxml.jackson.databind.JsonNode
selectUnit(com.fasterxml.jackson.databind.JsonNode jsonQuery)
select Unitcom.fasterxml.jackson.databind.JsonNode
selectUnitbyId(com.fasterxml.jackson.databind.JsonNode jsonQuery, java.lang.String idUnit)
select Unit by idcom.fasterxml.jackson.databind.JsonNode
selectUnitsWithInheritedRules(com.fasterxml.jackson.databind.JsonNode jsonQuery)
Select units by DSL and computes inherited rules for matching unitsjavax.ws.rs.core.Response
streamObjects(com.fasterxml.jackson.databind.JsonNode query)
javax.ws.rs.core.Response
streamUnits(com.fasterxml.jackson.databind.JsonNode query)
com.fasterxml.jackson.databind.JsonNode
updateUnitById(com.fasterxml.jackson.databind.JsonNode queryJson, java.lang.String idUnit, java.lang.String requestId)
update Unit by id
-
-
-
Constructor Detail
-
AccessInternalModuleImpl
public AccessInternalModuleImpl()
AccessModuleImpl constructor
-
AccessInternalModuleImpl
public AccessInternalModuleImpl(LogbookLifeCyclesClientFactory logbookLifeCyclesClientFactory, LogbookOperationsClientFactory logbookOperationsClientFactory, StorageClientFactory storageClientFactory, WorkspaceClientFactory workspaceClientFactory, AdminManagementClientFactory adminManagementClientFactory, MetaDataClientFactory metaDataClientFactory)
-
-
Method Detail
-
selectUnit
public com.fasterxml.jackson.databind.JsonNode selectUnit(com.fasterxml.jackson.databind.JsonNode jsonQuery) throws java.lang.IllegalArgumentException, InvalidParseOperationException, AccessInternalExecutionException
select Unit- Specified by:
selectUnit
in interfaceAccessInternalModule
- Parameters:
jsonQuery
- as String { $query : query}- Returns:
- the result of the select on Unit
- Throws:
InvalidParseOperationException
- Throw if json format is not correctAccessInternalExecutionException
- Throw if error occurs when send Unit to databasejava.lang.IllegalArgumentException
- if json query is null
-
selectPurgedPersistentIdentifier
public com.fasterxml.jackson.databind.JsonNode selectPurgedPersistentIdentifier(java.lang.String persistentIdentifier, @Nullable PurgedCollectionType type) throws InvalidParseOperationException, AccessInternalException
select purged persistent identifiers- Specified by:
selectPurgedPersistentIdentifier
in interfaceAccessInternalModule
- Parameters:
persistentIdentifier
- as String persistent identifiertype
- Purged collection type- Returns:
- the result of the select on persistent identifier
- Throws:
InvalidParseOperationException
- Throw if parameter is not correctAccessInternalExecutionException
- Throw if error occurs when retrieve data from databaseAccessInternalException
-
selectUnitbyId
public com.fasterxml.jackson.databind.JsonNode selectUnitbyId(com.fasterxml.jackson.databind.JsonNode jsonQuery, java.lang.String idUnit) throws InvalidParseOperationException, AccessInternalExecutionException, MetaDataNotFoundException
Description copied from interface:AccessInternalModule
select Unit by id- Specified by:
selectUnitbyId
in interfaceAccessInternalModule
- Parameters:
jsonQuery
- as String { $query : query}idUnit
- as String- Returns:
- the corresponding JsonNode
- Throws:
InvalidParseOperationException
- Throw if json format is not correctAccessInternalExecutionException
- Throw if error occurs when send Unit to databaseMetaDataNotFoundException
-
selectObjectGroupById
public com.fasterxml.jackson.databind.JsonNode selectObjectGroupById(com.fasterxml.jackson.databind.JsonNode jsonQuery, java.lang.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 interfaceAccessInternalModule
- Parameters:
jsonQuery
- the query DSL as a Json nodeidObjectGroup
- the id of the ObjectGroup as- Returns:
- the ObjectGroup metadata as a JsonNode
- Throws:
InvalidParseOperationException
- thrown if json query is not syntactically correctAccessInternalExecutionException
- in case of access failureMetaDataNotFoundException
-
getOneObjectFromObjectGroup
public javax.ws.rs.core.Response getOneObjectFromObjectGroup(java.lang.String idObjectGroup, java.lang.String qualifier, int version, java.lang.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 interfaceAccessInternalModule
- Parameters:
idObjectGroup
- The Object Group Idqualifier
- the qualifier to be retrieve (ie: Dissemination etc.)version
- the version number to getidUnit
- identifier of the parent archiveunit used to have access to the object- Returns:
- response
- Throws:
StorageNotFoundException
- If the object is not found in storageAccessInternalExecutionException
- For other technical errorsMetaDataNotFoundException
InvalidParseOperationException
- when a query is badly structuredAccessInternalUnavailableDataFromAsyncOfferException
-
getAccessLog
public javax.ws.rs.core.Response getAccessLog(com.fasterxml.jackson.databind.JsonNode params) throws AccessInternalExecutionException, StorageNotFoundException, java.text.ParseException
Description copied from interface:AccessInternalModule
Retrieve all accessLog by the concatenation of all accesslog files as InputStream- Specified by:
getAccessLog
in interfaceAccessInternalModule
- Parameters:
params
- a json containing query on StartDate or EndDate- Returns:
- the Storage response for the asked file
- Throws:
AccessInternalExecutionException
StorageNotFoundException
java.text.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 interfaceAccessInternalModule
- Parameters:
query
- query- Throws:
InvalidParseOperationException
- InvalidParseOperationException
-
findOneObjectGroupByPersistentId
public ObjectGroupResponse findOneObjectGroupByPersistentId(java.lang.String persistentId, @Nullable com.fasterxml.jackson.databind.JsonNode query) throws MetaDataNotFoundException, AccessUnauthorizedException
- Specified by:
findOneObjectGroupByPersistentId
in interfaceAccessInternalModule
- Throws:
MetaDataNotFoundException
AccessUnauthorizedException
-
getObjectByPersistentIdentifier
public javax.ws.rs.core.Response getObjectByPersistentIdentifier(java.lang.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 interfaceAccessInternalModule
- 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 java.lang.String findFirstAccessibleArchiveUnitId(java.util.List<java.lang.String> archiveUnitIds) throws AccessInternalException, MetaDataNotFoundException
-
createObjectAccessRequestIfRequired
public java.util.Optional<AccessRequestReference> createObjectAccessRequestIfRequired(java.lang.String idObjectGroup, java.lang.String qualifier, int version) throws MetaDataNotFoundException, InvalidParseOperationException, AccessInternalExecutionException
- Specified by:
createObjectAccessRequestIfRequired
in interfaceAccessInternalModule
- Throws:
MetaDataNotFoundException
InvalidParseOperationException
AccessInternalExecutionException
-
checkAccessRequestStatuses
public java.util.List<StatusByAccessRequest> checkAccessRequestStatuses(java.util.List<AccessRequestReference> accessRequestReferences) throws AccessInternalExecutionException, AccessInternalIllegalOperationException
- Specified by:
checkAccessRequestStatuses
in interfaceAccessInternalModule
- Throws:
AccessInternalExecutionException
AccessInternalIllegalOperationException
-
removeAccessRequest
public void removeAccessRequest(java.lang.String strategyId, java.lang.String accessRequestId) throws AccessInternalExecutionException, AccessInternalIllegalOperationException
- Specified by:
removeAccessRequest
in interfaceAccessInternalModule
- Throws:
AccessInternalExecutionException
AccessInternalIllegalOperationException
-
streamUnits
public javax.ws.rs.core.Response streamUnits(com.fasterxml.jackson.databind.JsonNode query) throws AccessInternalExecutionException, MetadataScrollLimitExceededException, MetadataScrollThresholdExceededException
- Specified by:
streamUnits
in interfaceAccessInternalModule
- Throws:
AccessInternalExecutionException
MetadataScrollLimitExceededException
MetadataScrollThresholdExceededException
-
streamObjects
public javax.ws.rs.core.Response streamObjects(com.fasterxml.jackson.databind.JsonNode query) throws AccessInternalExecutionException, MetadataScrollLimitExceededException, MetadataScrollThresholdExceededException
- Specified by:
streamObjects
in interfaceAccessInternalModule
- Throws:
AccessInternalExecutionException
MetadataScrollLimitExceededException
MetadataScrollThresholdExceededException
-
getObjectByUnitPersistentIdentifier
public javax.ws.rs.core.Response getObjectByUnitPersistentIdentifier(java.lang.String persistentIdentifier, java.lang.String qualifier, java.lang.Integer version) throws StorageNotFoundException, MetaDataNotFoundException, AccessInternalException
- Specified by:
getObjectByUnitPersistentIdentifier
in interfaceAccessInternalModule
- Throws:
StorageNotFoundException
MetaDataNotFoundException
AccessInternalException
-
updateUnitById
public com.fasterxml.jackson.databind.JsonNode updateUnitById(com.fasterxml.jackson.databind.JsonNode queryJson, java.lang.String idUnit, java.lang.String requestId) throws MetaDataNotFoundException, java.lang.IllegalArgumentException, InvalidParseOperationException, AccessInternalExecutionException, UpdatePermissionException, AccessInternalRuleExecutionException
Description copied from interface:AccessInternalModule
update Unit by id- Specified by:
updateUnitById
in interfaceAccessInternalModule
- Parameters:
queryJson
- json update queryidUnit
- as StringrequestId
- the request id- Returns:
- the result of the update on Unit
- Throws:
MetaDataNotFoundException
- Throw if unit is not foundjava.lang.IllegalArgumentException
- Throw if error occurs when checking argumentInvalidParseOperationException
- Throw if json format is not correctAccessInternalExecutionException
- Throw if error occurs when send Unit to databaseAccessInternalRuleExecutionException
- Throw When error occures on rules update checkUpdatePermissionException
-
findDIPByOperationId
public javax.ws.rs.core.Response findDIPByOperationId(java.lang.String id) throws AccessInternalExecutionException
Description copied from interface:AccessInternalModule
retrieve a DIP file according to an operationId- Specified by:
findDIPByOperationId
in interfaceAccessInternalModule
- Parameters:
id
- operation id- Returns:
- zip file containing a DIP
- Throws:
AccessInternalExecutionException
-
findTransferSIPByOperationId
public javax.ws.rs.core.Response findTransferSIPByOperationId(java.lang.String id) throws AccessInternalExecutionException
Description copied from interface:AccessInternalModule
retrieve a SIP file according to an operationId- Specified by:
findTransferSIPByOperationId
in interfaceAccessInternalModule
- 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 java.lang.IllegalArgumentException, InvalidParseOperationException, AccessInternalExecutionException
select Object- Specified by:
selectObjects
in interfaceAccessInternalModule
- Parameters:
jsonQuery
- as String { $query : query}- Returns:
- the result of the select on object
- Throws:
InvalidParseOperationException
- Throw if json format is not correctAccessInternalExecutionException
- Throw if error occurs when send Object to databasejava.lang.IllegalArgumentException
- if json query is null
-
selectUnitsWithInheritedRules
public com.fasterxml.jackson.databind.JsonNode selectUnitsWithInheritedRules(com.fasterxml.jackson.databind.JsonNode jsonQuery) throws java.lang.IllegalArgumentException, InvalidParseOperationException, AccessInternalExecutionException
Description copied from interface:AccessInternalModule
Select units by DSL and computes inherited rules for matching units- Specified by:
selectUnitsWithInheritedRules
in interfaceAccessInternalModule
- Parameters:
jsonQuery
- the query DSL- Returns:
- the selected units with there inherited rules
- Throws:
java.lang.IllegalArgumentException
- Throw if json format is not correctInvalidParseOperationException
AccessInternalExecutionException
- Throw if error occurs when send Unit to database
-
-