Class ContextServiceImpl
- java.lang.Object
-
- fr.gouv.vitam.functional.administration.core.context.ContextServiceImpl
-
- All Implemented Interfaces:
VitamAutoCloseable
,ContextService
,java.lang.AutoCloseable
public class ContextServiceImpl extends java.lang.Object implements ContextService
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CONTEXTS_BACKUP_EVENT
-
Constructor Summary
Constructors Constructor Description ContextServiceImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService)
ConstructorContextServiceImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, ContractService<IngestContractModel> ingestContract, ContractService<AccessContractModel> accessContract, SecurityProfileService securityProfileService, FunctionalBackupService functionalBackupService)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
RequestResponse<ContextModel>
createContexts(java.util.List<ContextModel> contextModelList)
Create a list of contextsRequestResponse<ContextModel>
deleteContext(java.lang.String contextId, boolean forceDelete)
Delete a contextDbRequestResult
findContexts(com.fasterxml.jackson.databind.JsonNode queryDsl)
Search for contextsContextModel
findOneContextById(java.lang.String id)
Find a context by its idboolean
securityProfileIsUsedInContexts(java.lang.String securityProfileId)
void
setSecurityProfileService(SecurityProfileService securityProfileService)
RequestResponse<ContextModel>
updateContext(java.lang.String id, com.fasterxml.jackson.databind.JsonNode queryDsl)
Update a context
-
-
-
Field Detail
-
CONTEXTS_BACKUP_EVENT
public static final java.lang.String CONTEXTS_BACKUP_EVENT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
createContexts
public RequestResponse<ContextModel> createContexts(java.util.List<ContextModel> contextModelList) throws VitamException
Description copied from interface:ContextService
Create a list of contexts- Specified by:
createContexts
in interfaceContextService
- 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 interfaceContextService
- 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(java.lang.String id) throws ReferentialException, InvalidParseOperationException
Description copied from interface:ContextService
Find a context by its id- Specified by:
findOneContextById
in interfaceContextService
- Parameters:
id
- the id of the context- Returns:
- the context as a ContextModel
- Throws:
ReferentialException
- thrown if the context could not be foundInvalidParseOperationException
- thrown if the query is incorrect
-
deleteContext
public RequestResponse<ContextModel> deleteContext(java.lang.String contextId, boolean forceDelete) throws VitamException
Description copied from interface:ContextService
Delete a context- Specified by:
deleteContext
in interfaceContextService
- Parameters:
contextId
- the id of the context- Returns:
- a response as a RequestResponse
object - Throws:
VitamException
- thrown if operation could not be done
-
securityProfileIsUsedInContexts
public boolean securityProfileIsUsedInContexts(java.lang.String securityProfileId) throws InvalidCreateOperationException, ReferentialException, InvalidParseOperationException
- Specified by:
securityProfileIsUsedInContexts
in interfaceContextService
- Throws:
InvalidCreateOperationException
ReferentialException
InvalidParseOperationException
-
updateContext
public RequestResponse<ContextModel> updateContext(java.lang.String id, com.fasterxml.jackson.databind.JsonNode queryDsl) throws VitamException
Description copied from interface:ContextService
Update a context- Specified by:
updateContext
in interfaceContextService
- Parameters:
id
- the id of the contextqueryDsl
- 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 interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceVitamAutoCloseable
-
setSecurityProfileService
public void setSecurityProfileService(SecurityProfileService securityProfileService)
- Specified by:
setSecurityProfileService
in interfaceContextService
-
-