Class ProfileServiceImpl
- java.lang.Object
-
- fr.gouv.vitam.functional.administration.core.profile.ProfileServiceImpl
-
- All Implemented Interfaces:
VitamAutoCloseable,ProfileService,java.lang.AutoCloseable
public class ProfileServiceImpl extends java.lang.Object implements ProfileService
The implementation of the profile servie This implementation manage creation, update, ... profiles with any given format (xsd, rng)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringOP_PROFILE_STORAGEstatic java.lang.StringPATH_SHOULD_NOT_BE_FILLEDstatic java.lang.StringPATH_UNUPDATABLEstatic java.lang.StringPROFILE_BACKUP_EVENTstatic java.lang.StringPROFILE_FORMAT_SHOULD_BE_XSD_OR_RNGstatic java.lang.StringPROFILE_IDENTIFIER_ALREADY_EXISTS_IN_DATABASEstatic java.lang.StringPROFILE_IDENTIFIER_MUST_BE_STRING
-
Constructor Summary
Constructors Constructor Description ProfileServiceImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, FunctionalBackupService functionalBackupService)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()RequestResponse<ProfileModel>createProfiles(java.util.List<ProfileModel> profileModelList)Create a collections of profile After passing the validation steps.javax.ws.rs.core.ResponsedownloadProfileFile(java.lang.String profileIdentifier)download file corresponding to profileIdentifierProfileModelfindByIdentifier(java.lang.String identifier)Find profile by identifierRequestResponseOK<ProfileModel>findProfiles(com.fasterxml.jackson.databind.JsonNode queryDsl)find Profile by QueryDslRequestResponse<ProfileModel>importProfileFile(java.lang.String profileIdentifier, java.io.InputStream profileFile)1.RequestResponse<ProfileModel>updateProfile(ProfileModel profileModel, com.fasterxml.jackson.databind.JsonNode jsonDsl)Update profileRequestResponse<ProfileModel>updateProfile(java.lang.String identifier, com.fasterxml.jackson.databind.JsonNode jsonDsl)Update profiles after passing validation steps : Field modified : - ActivationDate - DesactivationDate - LastUpdate - Status
-
-
-
Field Detail
-
OP_PROFILE_STORAGE
public static final java.lang.String OP_PROFILE_STORAGE
- See Also:
- Constant Field Values
-
PROFILE_FORMAT_SHOULD_BE_XSD_OR_RNG
public static final java.lang.String PROFILE_FORMAT_SHOULD_BE_XSD_OR_RNG
- See Also:
- Constant Field Values
-
PROFILE_IDENTIFIER_ALREADY_EXISTS_IN_DATABASE
public static final java.lang.String PROFILE_IDENTIFIER_ALREADY_EXISTS_IN_DATABASE
- See Also:
- Constant Field Values
-
PROFILE_IDENTIFIER_MUST_BE_STRING
public static final java.lang.String PROFILE_IDENTIFIER_MUST_BE_STRING
- See Also:
- Constant Field Values
-
PROFILE_BACKUP_EVENT
public static final java.lang.String PROFILE_BACKUP_EVENT
- See Also:
- Constant Field Values
-
PATH_UNUPDATABLE
public static final java.lang.String PATH_UNUPDATABLE
- See Also:
- Constant Field Values
-
PATH_SHOULD_NOT_BE_FILLED
public static final java.lang.String PATH_SHOULD_NOT_BE_FILLED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ProfileServiceImpl
public ProfileServiceImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, FunctionalBackupService functionalBackupService)
Constructor- Parameters:
mongoAccess- MongoDB clientvitamCounterService- the vitam counter servicefunctionalBackupService- the functional backup service
-
-
Method Detail
-
createProfiles
public RequestResponse<ProfileModel> createProfiles(java.util.List<ProfileModel> profileModelList) throws VitamException
Description copied from interface:ProfileServiceCreate a collections of profile After passing the validation steps. If all the profiles are valid, they are stored in the collection and indexed. The profiles are not valid in the following situations :- The collection contains 2 ore many profile having the same identifier
- One or more mandatory field is missing
- A field has an invalid format
- One or many profile already exist in the database
- Specified by:
createProfilesin interfaceProfileService- Parameters:
profileModelList- the list of profiles to be created- Returns:
- RequestResponseOK if success or VitamError
- Throws:
VitamException- if in error occurs while validating contracts
-
importProfileFile
public RequestResponse<ProfileModel> importProfileFile(java.lang.String profileIdentifier, java.io.InputStream profileFile) throws VitamException
Description copied from interface:ProfileService1. Check that the document with given id exists else return VitamError 2. Check that the document is (xsd, rng, ...) valid format else return VitamError 3. If ok, save the file is the storage with the name (the given profile id) TODO 4. In case of rng, check if RG exists ?!- Specified by:
importProfileFilein interfaceProfileService- Parameters:
profileIdentifier- the profile identifierprofileFile- the profile file as an input stream- Returns:
- RequestResponseOK if success or VitamError
- Throws:
VitamException- thrown if the profiles could not be imported
-
downloadProfileFile
public javax.ws.rs.core.Response downloadProfileFile(java.lang.String profileIdentifier) throws ProfileNotFoundException, InvalidParseOperationException, ReferentialExceptionDescription copied from interface:ProfileServicedownload file corresponding to profileIdentifier- Specified by:
downloadProfileFilein interfaceProfileService- Parameters:
profileIdentifier- the profile identifier- Returns:
- Response
- Throws:
ProfileNotFoundException- thrown if the profile could not be foundInvalidParseOperationException- thrown if the query could not be executedReferentialException- thrown if the query could not be executed
-
updateProfile
public RequestResponse<ProfileModel> updateProfile(java.lang.String identifier, com.fasterxml.jackson.databind.JsonNode jsonDsl) throws VitamException
Description copied from interface:ProfileServiceUpdate profiles after passing validation steps : Field modified :- - ActivationDate
- - DesactivationDate
- - LastUpdate
- - Status
- Specified by:
updateProfilein interfaceProfileService- Parameters:
identifier- identifier of the profile to updatejsonDsl- the given profile dsl for update- Returns:
- RequestResponseOK if success or VitamError
- Throws:
VitamException- if in error occurs while validating contracts
-
updateProfile
public RequestResponse<ProfileModel> updateProfile(ProfileModel profileModel, com.fasterxml.jackson.databind.JsonNode jsonDsl) throws VitamException
Description copied from interface:ProfileServiceUpdate profile- Specified by:
updateProfilein interfaceProfileService- Parameters:
profileModel- the updated ProfileModeljsonDsl- the query as a json- Returns:
- a response as a RequestResponse
object - Throws:
VitamException- thrown if the update could not be executed
-
findByIdentifier
public ProfileModel findByIdentifier(java.lang.String identifier) throws ReferentialException, InvalidParseOperationException
Description copied from interface:ProfileServiceFind profile by identifier- Specified by:
findByIdentifierin interfaceProfileService- Parameters:
identifier- the Profile identifier- Returns:
- ProfileModel
- Throws:
ReferentialException- thrown if the query could not be executedInvalidParseOperationException- thrown if the query could not be executed
-
findProfiles
public RequestResponseOK<ProfileModel> findProfiles(com.fasterxml.jackson.databind.JsonNode queryDsl) throws ReferentialException, InvalidParseOperationException
Description copied from interface:ProfileServicefind Profile by QueryDsl- Specified by:
findProfilesin interfaceProfileService- Parameters:
queryDsl- the query as a json to be executed- Returns:
- list of ProfileModel
- Throws:
ReferentialException- thrown if the query could not be executedInvalidParseOperationException- thrown if the query could not be executed
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceVitamAutoCloseable
-
-