Class ProfileManager
- java.lang.Object
-
- fr.gouv.vitam.functional.administration.profile.core.ProfileManager
-
public class ProfileManager extends java.lang.Object
This class manage validation and log operation of profile service
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DUPLICATE_IN_DATABASE
static java.lang.String
EMPTY_REQUIRED_FIELD
static java.lang.String
IMPORT_KO
static java.lang.String
PROFILE_NOT_FOUND_IN_DATABASE
static java.lang.String
UPDATE_DUPLICATE_IN_DATABASE
static java.lang.String
UPDATE_KO
static java.lang.String
UPDATE_PROFILE_NOT_FOUND
static java.lang.String
UPDATE_VALUE_NOT_IN_ENUM
static java.lang.String
WRONG_FIELD_FORMAT
-
Constructor Summary
Constructors Constructor Description ProfileManager(LogbookOperationsClient logbookClient, GUID eip)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProfileValidator
checkEmptyIdentifierSlaveModeValidator()
Check if the Id of the contract already exists in databaseProfileValidator
createCheckDuplicateInDatabaseValidator()
Check if the profile identifier already exists in databaseProfileValidator
createMandatoryParamsValidator()
Validate that profile have not a missing mandatory parameterProfileValidator
createWrongFieldFormatValidator()
Set a default value if nullvoid
logFatalError(java.lang.String eventType, java.lang.String objectId, java.lang.String errorsDetails)
log fatal error (system or technical error)void
logStarted(java.lang.String eventType, java.lang.String objectId)
log start processvoid
logSuccess(java.lang.String eventType, java.lang.String objectId, java.lang.String message)
log end success processvoid
logValidationError(java.lang.String eventType, java.lang.String objectId, java.lang.String errorsDetails, java.lang.String KOEventType)
Log validation error (business error)boolean
validateProfile(ProfileModel profile, VitamError error)
boolean
validateProfileFile(ProfileModel profileModel, java.io.File file, VitamError error)
Validate if the profile file is valide XSD => is file xsd is xml valide RNG => if file rng is xml valide, rng valide, check default values if already exists in vitamboolean
validateRNG(java.io.File file, VitamError error)
TODO 1.boolean
validateXSD(java.io.File file, VitamError error)
Just check if inputStream is xml valid
-
-
-
Field Detail
-
EMPTY_REQUIRED_FIELD
public static final java.lang.String EMPTY_REQUIRED_FIELD
- See Also:
- Constant Field Values
-
WRONG_FIELD_FORMAT
public static final java.lang.String WRONG_FIELD_FORMAT
- See Also:
- Constant Field Values
-
DUPLICATE_IN_DATABASE
public static final java.lang.String DUPLICATE_IN_DATABASE
- See Also:
- Constant Field Values
-
PROFILE_NOT_FOUND_IN_DATABASE
public static final java.lang.String PROFILE_NOT_FOUND_IN_DATABASE
- See Also:
- Constant Field Values
-
IMPORT_KO
public static final java.lang.String IMPORT_KO
- See Also:
- Constant Field Values
-
UPDATE_PROFILE_NOT_FOUND
public static final java.lang.String UPDATE_PROFILE_NOT_FOUND
- See Also:
- Constant Field Values
-
UPDATE_VALUE_NOT_IN_ENUM
public static final java.lang.String UPDATE_VALUE_NOT_IN_ENUM
- See Also:
- Constant Field Values
-
UPDATE_DUPLICATE_IN_DATABASE
public static final java.lang.String UPDATE_DUPLICATE_IN_DATABASE
- See Also:
- Constant Field Values
-
UPDATE_KO
public static final java.lang.String UPDATE_KO
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ProfileManager
public ProfileManager(LogbookOperationsClient logbookClient, GUID eip)
-
-
Method Detail
-
validateProfile
public boolean validateProfile(ProfileModel profile, VitamError error)
-
validateProfileFile
public boolean validateProfileFile(ProfileModel profileModel, java.io.File file, VitamError error) throws java.lang.Exception
Validate if the profile file is valide XSD => is file xsd is xml valide RNG => if file rng is xml valide, rng valide, check default values if already exists in vitam- Parameters:
profileModel
-file
-error
-- Returns:
- boolean true/false
- Throws:
java.lang.Exception
-
validateXSD
public boolean validateXSD(java.io.File file, VitamError error) throws java.lang.Exception
Just check if inputStream is xml valid- Parameters:
file
-error
-- Returns:
- boolean true/false
- Throws:
java.lang.Exception
-
validateRNG
public boolean validateRNG(java.io.File file, VitamError error) throws java.lang.Exception
TODO 1. Validate if rng is xml valide, 2. Validate if rng is rng valide 3. Validate if data in rng is valide- Parameters:
file
-error
-- Returns:
- boolean true/false
- Throws:
java.lang.Exception
-
logValidationError
public void logValidationError(java.lang.String eventType, java.lang.String objectId, java.lang.String errorsDetails, java.lang.String KOEventType) throws VitamException
Log validation error (business error)- Parameters:
eventType
-objectId
-errorsDetails
-KOEventType
-- Throws:
VitamException
-
logFatalError
public void logFatalError(java.lang.String eventType, java.lang.String objectId, java.lang.String errorsDetails) throws VitamException
log fatal error (system or technical error)- Parameters:
errorsDetails
-- Throws:
VitamException
-
logStarted
public void logStarted(java.lang.String eventType, java.lang.String objectId) throws VitamException
log start process- Throws:
VitamException
-
logSuccess
public void logSuccess(java.lang.String eventType, java.lang.String objectId, java.lang.String message) throws VitamException
log end success process- Throws:
VitamException
-
createMandatoryParamsValidator
public ProfileValidator createMandatoryParamsValidator()
Validate that profile have not a missing mandatory parameter- Returns:
-
createWrongFieldFormatValidator
public ProfileValidator createWrongFieldFormatValidator()
Set a default value if null- Returns:
-
checkEmptyIdentifierSlaveModeValidator
public ProfileValidator checkEmptyIdentifierSlaveModeValidator()
Check if the Id of the contract already exists in database- Returns:
-
createCheckDuplicateInDatabaseValidator
public ProfileValidator createCheckDuplicateInDatabaseValidator()
Check if the profile identifier already exists in database- Returns:
-
-