Class HALMConnection.DescriptorImpl

    • Constructor Detail

      • DescriptorImpl

        public DescriptorImpl()
        Constructor
    • Method Detail

      • doFillCredentialsIDItems

        public ListBoxModel doFillCredentialsIDItems​(@AncestorInPath
                                                     Item context,
                                                     @QueryParameter
                                                     String remote)
        Fills the 'Credentials' dropdown.
        Parameters:
        context - - used to determine if the user can get a list of users
        remote - - the remote server in question
        Returns:
        Returns the list of items to put into the Credentials dropdown.
      • doFillCredentialTypeValueItems

        public ListBoxModel doFillCredentialTypeValueItems()
        Populates the 'credentialType' dropdown with appropriate values.
        Returns:
        Credential Type dropdown list values.
      • doCheckAddress

        @POST
        public FormValidation doCheckAddress​(@QueryParameter("value")
                                             String halmAPIAddress)
        Validates that the address provided by the user is valid. This is called when the HALM address field loses focus after text is entered. It is an ajax call defined in the config.jelly which calls this function. The @POST just above the function is recommended in the dev docs for Jenkins. It is not required, but is included for security concerns: https://www.jenkins.io/doc/developer/security/form-validation/
        Parameters:
        halmAPIAddress - HALM REST API address
        Returns:
        Form validation status.
      • doCheckConnectionName

        @POST
        public FormValidation doCheckConnectionName​(@QueryParameter("connectionName")
                                                    String connectionName)
        Verifies that the connection name is not blank.
        Parameters:
        connectionName - Connection name to verify
        Returns:
        FormValidation.Ok if the connection name is not blank.
      • doCheckCredentialsID

        @POST
        public FormValidation doCheckCredentialsID​(@QueryParameter("credentialsID")
                                                   String credentialsID)
        Checks that the credentials ID has been set.
        Parameters:
        credentialsID - The selection in the credentials dropdown
        Returns:
        Returns Ok if there is something selected, an error otherwise.
      • doTestConnection

        @POST
        public FormValidation doTestConnection​(@QueryParameter("connectionUUID")
                                               String connectionUUID,
                                               @QueryParameter("connectionName")
                                               String connectionName,
                                               @QueryParameter("halmAPIAddress")
                                               String halmAPIAddress,
                                               @QueryParameter("credentialTypeValue")
                                               String credentialTypeValue,
                                               @QueryParameter("credentialsID")
                                               String credentialsID,
                                               @QueryParameter("acceptSSLCertificates")
                                               boolean acceptSSLCertificates)
        Validates that the provided HALM connection information settings are valid. This is called when the 'Test Connection' button is pressed. The @POST just above the function is recommended in the dev docs for Jenkins. It is not required, but is included for security concerns: https://www.jenkins.io/doc/developer/security/form-validation/
        Parameters:
        connectionUUID - the connection's UUID, if it exists.
        connectionName - the connection's name from the field
        halmAPIAddress - HALM REST API address
        credentialTypeValue - Basic vs Auth from the dropdown
        credentialsID - Credential ID from Credentials plugin
        acceptSSLCertificates - Should this accept invalid certs?
        Returns:
        Form validation status.
      • encodeInputAsValidFilename

        public static String encodeInputAsValidFilename​(String input)
                                                 throws UnsupportedEncodingException
        Returns an encoded version of the given string that will be a valid filename.
        Parameters:
        input - The input string to encode
        Returns:
        See description
        Throws:
        UnsupportedEncodingException - File must be UTF-8 encoded
      • compareVersions

        public static FormValidation compareVersions​(int[] minimumVersion,
                                                     String versionToCheck)
        Compares a string based version (ex: "2022.2.0" vs a numeric based minimum version, ex: [2022, 2, 0] to determine if the string based version is equal to, or newer than, the minimum version.
        Parameters:
        minimumVersion - Minimum supported version, as a numeric array: Ex: [2022, 2, 0]
        versionToCheck - Current version, as text. Ex: "2022.2.0"
        Returns:
        FormValidation.OK on success, a FormValidation error otherwise.