Class ProfileManager


  • public class ProfileManager
    extends java.lang.Object
    This class manage validation and log operation of profile service
    • 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
      • 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
    • Method Detail

      • 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: