Class AccessContractImpl
- java.lang.Object
-
- fr.gouv.vitam.functional.administration.contract.core.AccessContractImpl
-
- All Implemented Interfaces:
VitamAutoCloseable
,ContractService<AccessContractModel>
,java.lang.AutoCloseable
public class AccessContractImpl extends java.lang.Object implements ContractService<AccessContractModel>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AccessContractImpl.AccessContractValidationService
Contract validator and logBook manager
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CONTRACT_BACKUP_EVENT
-
Constructor Summary
Constructors Constructor Description AccessContractImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService)
ConstructorAccessContractImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, MetaDataClient metaDataClient, LogbookOperationsClient logbookClient, FunctionalBackupService functionalBackupService)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
RequestResponse<AccessContractModel>
createContracts(java.util.List<AccessContractModel> contractModelList)
Create a collections of contracts After passing the validation steps.AccessContractModel
findByIdentifier(java.lang.String identifier)
Find contract by identifierRequestResponseOK<AccessContractModel>
findContracts(com.fasterxml.jackson.databind.JsonNode queryDsl)
find contract by QueryDslRequestResponse<AccessContractModel>
updateContract(java.lang.String identifier, com.fasterxml.jackson.databind.JsonNode queryDsl)
Update contracts status after passing validation steps : Field modified : - ActivationDate - DesactivationDate - LastUpdate - Status
-
-
-
Field Detail
-
CONTRACT_BACKUP_EVENT
public static final java.lang.String CONTRACT_BACKUP_EVENT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AccessContractImpl
public AccessContractImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService)
Constructor- Parameters:
mongoAccess
- MongoDB clientvitamCounterService
-
-
AccessContractImpl
public AccessContractImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, MetaDataClient metaDataClient, LogbookOperationsClient logbookClient, FunctionalBackupService functionalBackupService)
Constructor- Parameters:
mongoAccess
-vitamCounterService
-metaDataClient
-logbookClient
-functionalBackupService
-
-
-
Method Detail
-
createContracts
public RequestResponse<AccessContractModel> createContracts(java.util.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 interfaceContractService<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(java.lang.String identifier) throws ReferentialException, InvalidParseOperationException
Description copied from interface:ContractService
Find contract by identifier- Specified by:
findByIdentifier
in interfaceContractService<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 executedInvalidParseOperationException
- 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 interfaceContractService<AccessContractModel>
- Parameters:
queryDsl
- the query to be executed- Returns:
- list of T
- Throws:
ReferentialException
- thrown if the query could not be executedInvalidParseOperationException
- thrown is the query is incorrect
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceVitamAutoCloseable
-
updateContract
public RequestResponse<AccessContractModel> updateContract(java.lang.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 interfaceContractService<AccessContractModel>
- Parameters:
identifier
- the id of the contract to be updatedqueryDsl
- the given queryDsl for update- Returns:
- RequestResponseOK if success or VitamError
- Throws:
VitamException
- if in error occurs while validating contracts
-
-