Package fr.gouv.vitam.functional.administration.core.profile

# Class ProfileServiceImpl

java.lang.Object
fr.gouv.vitam.functional.administration.core.profile.ProfileServiceImpl

All Implemented Interfaces:
  `VitamAutoCloseable`, `ProfileService`, `AutoCloseable`

public class ProfileServiceImpl extends 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 final String`
  `OP_PROFILE_STORAGE`
  `static final String`
  `PATH_SHOULD_NOT_BE_FILLED`
  `static final String`
  `PATH_UNUPDATABLE`
  `static final String`
  `PROFILE_BACKUP_EVENT`
  `static final String`
  `PROFILE_FORMAT_SHOULD_BE_XSD_OR_RNG`
  `static final String`
  `PROFILE_IDENTIFIER_ALREADY_EXISTS_IN_DATABASE`
  `static final String`
  `PROFILE_IDENTIFIER_MUST_BE_STRING`
  `static final String`
  `PROFILE_SEDAVERSION_SHOULD_BE_VALID`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ProfileServiceImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, FunctionalBackupService functionalBackupService)`
  Constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `RequestResponse<ProfileModel>`
  `createProfiles(List<CreateProfileModel> createProfileModels)`
  Create a collections of profile After passing the validation steps.
  `jakarta.ws.rs.core.Response`
  `downloadProfileFile(String profileIdentifier)`
  download file corresponding to profileIdentifier
  `ProfileModel`
  `findByIdentifier(String identifier)`
  Find profile by identifier
  `RequestResponseOK<ProfileModel>`
  `findProfiles(com.fasterxml.jackson.databind.JsonNode queryDsl)`
  find Profile by QueryDsl
  `RequestResponse<ProfileModel>`
  `importProfileFile(String profileIdentifier, InputStream profileFile)`
  1.
  `RequestResponse<ProfileModel>`
  `updateProfile(ProfileModel profileModel, com.fasterxml.jackson.databind.JsonNode jsonDsl)`
  Update profile
  `RequestResponse<ProfileModel>`
  `updateProfile(String identifier, com.fasterxml.jackson.databind.JsonNode jsonDsl)`
  Update profiles after passing validation steps : Field modified : - ActivationDate - DesactivationDate - LastUpdate - Status

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

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

- ## Field Details

  - ### OP_PROFILE_STORAGE

    public static final String OP_PROFILE_STORAGE
    See Also:
      - Constant Field Values

  - ### PROFILE_FORMAT_SHOULD_BE_XSD_OR_RNG

    public static final String PROFILE_FORMAT_SHOULD_BE_XSD_OR_RNG
    See Also:
      - Constant Field Values

  - ### PROFILE_SEDAVERSION_SHOULD_BE_VALID

    public static final String PROFILE_SEDAVERSION_SHOULD_BE_VALID
    See Also:
      - Constant Field Values

  - ### PROFILE_IDENTIFIER_ALREADY_EXISTS_IN_DATABASE

    public static final String PROFILE_IDENTIFIER_ALREADY_EXISTS_IN_DATABASE
    See Also:
      - Constant Field Values

  - ### PROFILE_IDENTIFIER_MUST_BE_STRING

    public static final String PROFILE_IDENTIFIER_MUST_BE_STRING
    See Also:
      - Constant Field Values

  - ### PROFILE_BACKUP_EVENT

    public static final String PROFILE_BACKUP_EVENT
    See Also:
      - Constant Field Values

  - ### PATH_UNUPDATABLE

    public static final String PATH_UNUPDATABLE
    See Also:
      - Constant Field Values

  - ### PATH_SHOULD_NOT_BE_FILLED

    public static final String PATH_SHOULD_NOT_BE_FILLED
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### ProfileServiceImpl

    public ProfileServiceImpl(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, FunctionalBackupService functionalBackupService)
    Constructor
    Parameters:
      `mongoAccess` - MongoDB client
      `vitamCounterService` - the vitam counter service
      `functionalBackupService` - the functional backup service

- ## Method Details

  - ### createProfiles

    public RequestResponse<ProfileModel> createProfiles(List<CreateProfileModel> createProfileModels) throws VitamException
    Description copied from interface: `ProfileService`
    Create 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:
      `createProfiles` in interface `ProfileService`
    Parameters:
      `createProfileModels` - 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(String profileIdentifier, InputStream profileFile) throws VitamException
    Description copied from interface: `ProfileService`
    1. 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:
      `importProfileFile` in interface `ProfileService`
    Parameters:
      `profileIdentifier` - the profile identifier
      `profileFile` - 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 jakarta.ws.rs.core.Response downloadProfileFile(String profileIdentifier) throws ProfileNotFoundException, InvalidParseOperationException, ReferentialException
    Description copied from interface: `ProfileService`
    download file corresponding to profileIdentifier
    Specified by:
      `downloadProfileFile` in interface `ProfileService`
    Parameters:
      `profileIdentifier` - the profile identifier
    Returns:
      Response
    Throws:
      `ProfileNotFoundException` - thrown if the profile could not be found
      `InvalidParseOperationException` - thrown if the query could not be executed
      `ReferentialException` - thrown if the query could not be executed

  - ### updateProfile

    public RequestResponse<ProfileModel> updateProfile(String identifier, com.fasterxml.jackson.databind.JsonNode jsonDsl) throws VitamException
    Description copied from interface: `ProfileService`
    Update profiles after passing validation steps : Field modified :
    - - ActivationDate
    - - DesactivationDate
    - - LastUpdate
    - - Status
    Specified by:
      `updateProfile` in interface `ProfileService`
    Parameters:
      `identifier` - identifier of the profile to update
      `jsonDsl` - 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: `ProfileService`
    Update profile
    Specified by:
      `updateProfile` in interface `ProfileService`
    Parameters:
      `profileModel` - the updated ProfileModel
      `jsonDsl` - 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(String identifier) throws ReferentialException, InvalidParseOperationException
    Description copied from interface: `ProfileService`
    Find profile by identifier
    Specified by:
      `findByIdentifier` in interface `ProfileService`
    Parameters:
      `identifier` - the Profile identifier
    Returns:
      ProfileModel
    Throws:
      `ReferentialException` - thrown if the query could not be executed
      `InvalidParseOperationException` - 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: `ProfileService`
    find Profile by QueryDsl
    Specified by:
      `findProfiles` in interface `ProfileService`
    Parameters:
      `queryDsl` - the query as a json to be executed
    Returns:
      list of ProfileModel
    Throws:
      `ReferentialException` - thrown if the query could not be executed
      `InvalidParseOperationException` - thrown if the query could not be executed

  - ### close

    public void close()
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `VitamAutoCloseable`