Class InputValidator


  • public class InputValidator
    extends Object
    Methods used for rest API input validation
    • Constructor Detail

      • InputValidator

        public InputValidator()
    • Method Detail

      • validateRemoteServerURLNotNull

        public static void validateRemoteServerURLNotNull​(String className,
                                                          String actionDescription,
                                                          String omasServerURL)
                                                   throws InvalidParameterException
        Throw an exception if the metadata server URL (which comes from the configuration has not been supplied on the constructor.
        Parameters:
        className - - name of the class making the call.
        actionDescription - - action description
        omasServerURL - - metadata server url.
        Throws:
        InvalidParameterException - - the org.odpi.openmetadata.accessservices.subjectarea.server URL is not set
      • validateRemoteServerNameNotNull

        public static void validateRemoteServerNameNotNull​(String className,
                                                           String actionDescription,
                                                           String omasServerName)
                                                    throws InvalidParameterException
        Throw an exception if the metadata server Name (which comes from the configuration has not been supplied on the constructor.
        Parameters:
        className - - name of the class making the call.
        actionDescription - - action description
        omasServerName - - metadata server name
        Throws:
        InvalidParameterException - - the org.odpi.openmetadata.accessservices.subjectarea.server URL is not set
      • validateUserIdNotNull

        public static void validateUserIdNotNull​(String className,
                                                 String actionDescription,
                                                 String userId)
                                          throws InvalidParameterException
        Throw an exception if the supplied userId is null
        Parameters:
        className - name of the class
        actionDescription - - action description
        userId - user name to validate
        Throws:
        InvalidParameterException - the userId is null
      • validateStatusAndCheckNotDeleted

        public static Status validateStatusAndCheckNotDeleted​(String className,
                                                              String actionDescription,
                                                              String statusName)
                                                       throws InvalidParameterException
        Validate the supplied string can be converted to a Status and return that status. If it cannot be converted then null is returned.
        Parameters:
        className - - name of the class making the call.
        actionDescription - - name of the method making the call.
        statusName - - the String name to convert to a Status
        Returns:
        Status or null.
        Throws:
        InvalidParameterException - invalid status
      • validateGUIDNotNull

        public static void validateGUIDNotNull​(String className,
                                               String actionDescription,
                                               String guid,
                                               String guidParameter)
                                        throws InvalidParameterException
        Throw an exception if the supplied userId is null
        Parameters:
        className - - name of the class making the call.
        actionDescription - - name of the method making the call.
        guid - - unique identifier to validate
        guidParameter - - name of the parameter that passed the userId
        Throws:
        InvalidParameterException - - the userId is null
      • validateNameNotNull

        public static void validateNameNotNull​(String className,
                                               String actionDescription,
                                               String name,
                                               String nameParameter)
                                        throws InvalidParameterException
        Throw an exception if the supplied userId is null
        Parameters:
        className - - name of the class making the call.
        actionDescription - - name of the method making the call.
        name - - unique name to validate
        nameParameter - - name of the parameter that passed the name.
        Throws:
        InvalidParameterException - - the userId is null