Example usage for com.jgoodies.validation Severity ERROR

List of usage examples for com.jgoodies.validation Severity ERROR

Introduction

In this page you can find the example usage for com.jgoodies.validation Severity ERROR.

Prototype

Severity ERROR

To view the source code for com.jgoodies.validation Severity ERROR.

Click Source Link

Document

Indicates a problem that cannot be resumed or worked around.

Usage

From source file:gov.nih.nci.cacore.workbench.portal.panel.DeployTypeSettingsPanel.java

License:BSD License

public ValidationResult validateInput() {

    ValidationResult result = new ValidationResult();

    //Project Directory Setting Validation
    if (ValidationUtils.isBlank(this.getProjectDirField().getText())) {
        result.add(/*  w  w w .  ja  v a  2  s. c  om*/
                new SimpleValidationMessage(PROJECT_DIR + " must not be blank.", Severity.ERROR, PROJECT_DIR));
    } else {
        File file = new File(this.getProjectDirField().getText());
        if (file.exists()) {
            result.add(new SimpleValidationMessage(
                    PROJECT_DIR + " already exists.  The output directory will be overwritten.",
                    Severity.WARNING, PROJECT_DIR));
        }
    }

    //Deploy Type Setting Validation   
    String deployType = getDeployTypeComboBox().getSelectedItem().toString();

    if (deployType == null || deployType == "") {
        result.add(
                new SimpleValidationMessage(DEPLOY_TYPE + " must be selected.", Severity.ERROR, DEPLOY_TYPE));
    }

    if (deployType.equalsIgnoreCase(REMOTE)) {

        String remoteDeployEnv = getRemoteDeployEnvComboBox().getSelectedItem().toString();

        if (remoteDeployEnv == null || remoteDeployEnv == "") {
            result.add(new SimpleValidationMessage(REMOTE_DEPLOY_ENV + " must be selected.", Severity.ERROR,
                    REMOTE_DEPLOY_ENV));
        }
    }

    return result;
}

From source file:gov.nih.nci.cacore.workbench.portal.panel.LogViewerPanel.java

License:BSD License

public ValidationResult validateInput() {

    ValidationResult result = new ValidationResult();

    //Log File Validation
    if (ValidationUtils.isBlank(this.getLogFileField().getText())) {
        result.add(new SimpleValidationMessage(LOG_FILE + " must not be blank.", Severity.ERROR, LOG_FILE));
    } else {/*www  .j av a 2  s .co  m*/
        File file = new File(this.getLogFileField().getText());
        if (!file.exists()) {
            result.add(new SimpleValidationMessage(
                    LOG_FILE + " does not exist.  Please select an existing log file", Severity.WARNING,
                    LOG_FILE));
        }
    }

    return result;
}

From source file:gov.nih.nci.cacore.workbench.portal.panel.ModelSettingsPanel.java

License:BSD License

public ValidationResult validateInput() {

    ValidationResult result = new ValidationResult();

    //Model Settings Validation
    if (ValidationUtils.isBlank(this.getModelFileField().getText())) {
        result.add(new SimpleValidationMessage(MODEL_FILE_PATH + " path must not be blank.", Severity.ERROR,
                MODEL_FILE_PATH));//  w  ww. j  a v  a  2s.  co  m
    } else {
        File file = new File(this.getModelFileField().getText());
        if (!file.exists()) {
            result.add(new SimpleValidationMessage(MODEL_FILE_PATH
                    + " does not exist.  Please select or enter a valid absolute path to the model file.",
                    Severity.ERROR, MODEL_FILE_PATH));
        }

        if (!this.getModelFileField().getText().endsWith("xmi")
                && !this.getModelFileField().getText().endsWith("uml")) {
            result.add(new SimpleValidationMessage(
                    MODEL_FILE_PATH + " must refer to an XMI (*.xmi) or Argo UML (*.uml) file.", Severity.ERROR,
                    MODEL_FILE_PATH));
        }
    }

    if (ValidationUtils.isBlank(this.getLogicalModelField().getText())) {
        result.add(new SimpleValidationMessage(LOGICAL_MODEL_PACKAGE_NAME + " must not be blank.",
                Severity.ERROR, LOGICAL_MODEL_PACKAGE_NAME));
    }

    if (ValidationUtils.isBlank(this.getDataModelField().getText())) {
        result.add(new SimpleValidationMessage(DATA_MODEL_PACKAGE_NAME + " must not be blank.", Severity.ERROR,
                DATA_MODEL_PACKAGE_NAME));
    }

    if (ValidationUtils.isBlank(this.getIncludePackageField().getText())) {
        result.add(new SimpleValidationMessage(INCLUDE_PACKAGE_REGEX + " must not be blank.", Severity.ERROR,
                INCLUDE_PACKAGE_REGEX));
    }

    return result;
}

From source file:gov.nih.nci.cacore.workbench.portal.panel.ProjectDirSettingsPanel.java

License:BSD License

public ValidationResult validateInput() {

    ValidationResult result = new ValidationResult();

    //Project Directory Setting Validation
    if (ValidationUtils.isBlank(this.getProjectGenDirField().getText())) {
        result.add(new SimpleValidationMessage(PROJECT_GEN_DIR + " must not be blank", Severity.ERROR,
                PROJECT_GEN_DIR));// w w  w.ja  v  a  2 s  . c  o  m
    } else {
        File file = new File(this.getProjectGenDirField().getText());
        if (file.exists()) {
            result.add(new SimpleValidationMessage(
                    PROJECT_GEN_DIR + " already exists.  The output directory will be overwritten.",
                    Severity.WARNING, PROJECT_GEN_DIR));
        } else {
            result.add(new SimpleValidationMessage(
                    PROJECT_GEN_DIR
                            + " does not exist.  Please select the Home directory of an existing directory.",
                    Severity.ERROR, PROJECT_GEN_DIR));
        }
    }

    return result;
}

From source file:gov.nih.nci.cacore.workbench.portal.panel.ProjectSettingsPanel.java

License:BSD License

public ValidationResult validateInput() {

    ValidationResult result = new ValidationResult();

    //Panel Settings Validation
    if (ValidationUtils.isBlank(this.getProjectDirField().getText())) {
        result.add(/* w w  w.  j a v a  2s.c om*/
                new SimpleValidationMessage(PROJECT_DIR + " must not be blank.", Severity.ERROR, PROJECT_DIR));
    } else {
        File file = new File(this.getProjectDirField().getText());
        if (file.exists()) {
            result.add(new SimpleValidationMessage(
                    PROJECT_DIR + " already exists.  The output directory will be overwritten.",
                    Severity.WARNING, PROJECT_DIR));
        }
    }

    if (ValidationUtils.isBlank(this.getSdkInstallDirField().getText())) {
        result.add(new SimpleValidationMessage(SDK_INSTALL_DIR + " must not be blank.", Severity.ERROR,
                SDK_INSTALL_DIR));
    } else {
        File file = new File(this.getSdkInstallDirField().getText());
        if (!file.exists()) {
            result.add(new SimpleValidationMessage(SDK_INSTALL_DIR
                    + " does not exist.  Please select the Home directory of an existing SDK Installation.",
                    Severity.ERROR, SDK_INSTALL_DIR));
        }
    }

    if (ValidationUtils.isNotBlank(this.getProjectDirField().getText())
            && ValidationUtils.isNotBlank(this.getSdkInstallDirField().getText())
            && this.getProjectDirField().getText().equalsIgnoreCase(this.getSdkInstallDirField().getText())) {
        result.add(new SimpleValidationMessage(PROJECT_DIR + " and " + SDK_INSTALL_DIR + " must be different.",
                Severity.ERROR, PROJECT_DIR));
        result.add(new SimpleValidationMessage(PROJECT_DIR + " and " + SDK_INSTALL_DIR + " must be different.",
                Severity.ERROR, SDK_INSTALL_DIR));
    }

    if (ValidationUtils.isBlank(this.getProjectNameField().getText())) {
        result.add(new SimpleValidationMessage(PROJECT_NAME + " must not be blank.", Severity.ERROR,
                PROJECT_NAME));
    }

    if (ValidationUtils.isBlank(this.getNamespacePrefixField().getText())) {
        result.add(new SimpleValidationMessage(NAMESPACE_PREFIX + " must not be blank.", Severity.ERROR,
                NAMESPACE_PREFIX));
    }

    if (ValidationUtils.isBlank(this.getWebServiceNameField().getText())) {
        result.add(new SimpleValidationMessage(WEBSERVICE_NAME + " must not be blank.", Severity.ERROR,
                WEBSERVICE_NAME));
    }

    return result;
}

From source file:gov.nih.nci.cacore.workbench.portal.panel.RemoteSshSettingsPanel.java

License:BSD License

public ValidationResult validateInput() {

    ValidationResult result = new ValidationResult();

    if (parentContainer.isRemoteDeployment()) {

        if (ValidationUtils.isBlank(this.getSshServerUsernameField().getText())) {
            result.add(new SimpleValidationMessage(SSH_SERVER_USERNAME + " must not be blank.", Severity.ERROR,
                    SSH_SERVER_USERNAME));
        }//from  www. j a  va2 s.  c  o m

        if (ValidationUtils.isBlank(this.getSshServerHostnameField().getText())) {
            result.add(new SimpleValidationMessage(SSH_SERVER_HOSTNAME + " must not be blank.", Severity.ERROR,
                    SSH_SERVER_HOSTNAME));
        }

        String sshPort = getSshPortField().getText();
        if (ValidationUtils.isBlank(this.getSshPortField().getText())) {
            result.add(new SimpleValidationMessage(SSH_PORT + " must not be blank.", Severity.ERROR, SSH_PORT));
        }

        if (!ValidationUtils.isNumeric(sshPort)) {
            result.add(new SimpleValidationMessage(SSH_PORT + " must be numeric.", Severity.ERROR, SSH_PORT));
        }

        if (ValidationUtils.isBlank(this.getSshKeyFileField().getText())) {
            result.add(new SimpleValidationMessage(SSH_KEY_FILE + " must not be blank.", Severity.ERROR,
                    SSH_KEY_FILE));
        } else {
            File file = new File(this.getSshKeyFileField().getText());
            if (!file.exists()) {
                result.add(new SimpleValidationMessage(
                        SSH_KEY_FILE
                                + " does not exist.  Please select or enter a valid absolute path to the file.",
                        Severity.ERROR, SSH_KEY_FILE));
            }
        }

        if (ValidationUtils.isBlank(this.getSshTempDirField().getText())) {
            result.add(new SimpleValidationMessage(SSH_TEMP_DIR + " must not be blank.", Severity.ERROR,
                    SSH_TEMP_DIR));
        } else {
            // Cannot validate if it is a valid directory as it is remote.
            //             File file = new File(this.getSshTempDirField().getText());
            //             if(!file.exists()){
            //                result.add(new SimpleValidationMessage(SSH_TEMP_DIR + " does not exist.  Please select or enter a valid absolute path to the directory.", Severity.ERROR, SSH_TEMP_DIR));
            //             }
        }
    }

    return result;
}

From source file:gov.nih.nci.cacore.workbench.portal.panel.SdkInstallSettingsPanel.java

License:BSD License

public ValidationResult validateInput() {

    ValidationResult result = new ValidationResult();

    //Sdk Install Panel Settings Validation

    if (ValidationUtils.isBlank(this.getSdkInstallDirField().getText())) {
        result.add(new SimpleValidationMessage(SDK_INSTALL_DIR + " must not be blank.", Severity.ERROR,
                SDK_INSTALL_DIR));//  w  w  w .j  a v  a  2s .com
    } else {
        File file = new File(this.getSdkInstallDirField().getText());
        if (!file.exists()) {
            result.add(new SimpleValidationMessage(SDK_INSTALL_DIR
                    + " does not exist.  Please select the Home directory of an existing SDK Installation.",
                    Severity.ERROR, SDK_INSTALL_DIR));
        }
    }

    return result;
}

From source file:gov.nih.nci.cacore.workbench.portal.panel.SecuritySettingsPanel.java

License:BSD License

public ValidationResult validateInput() {

    ValidationResult result = new ValidationResult();

    //Security setting Validation
    if (getEnableSecurityCheckBox().isSelected()) {

        if (ValidationUtils.isBlank(this.getCsmProjectNameField().getText())) {
            result.add(new SimpleValidationMessage(CSM_PROJECT_NAME + " must not be blank.", Severity.ERROR,
                    CSM_PROJECT_NAME));/*from  ww  w . j a  v  a2 s  .  com*/
        }

        //caGrid Auth Setting Validation
        if (getEnableCaGridLoginModuleCheckBox().isSelected()) {

            if (ValidationUtils.isBlank(this.getCaGridLoginModuleNameField().getText())) {
                result.add(new SimpleValidationMessage(CAGRID_LOGIN_MODULE_NAME + " must not be blank.",
                        Severity.ERROR, CAGRID_LOGIN_MODULE_NAME));
            }

            if (ValidationUtils.isBlank(this.getSdkGridLoginSvcNameField().getText())) {
                result.add(new SimpleValidationMessage(SDK_GRID_LOGIN_SERVICE_NAME + " must not be blank.",
                        Severity.ERROR, SDK_GRID_LOGIN_SERVICE_NAME));
            }
        }
    }

    return result;
}

From source file:gov.nih.nci.cacore.workbench.portal.panel.WritableApiSettingsPanel.java

License:BSD License

public ValidationResult validateInput() {

    ValidationResult result = new ValidationResult();

    //Writable API Settings Validation
    if (getEnableWritableApiExtensionCheckBox().isSelected()) {

        if (ValidationUtils.isBlank(this.getIdentityGeneratorTagField().getText())) {
            result.add(new SimpleValidationMessage(IDENTITY_GENERATOR_TAG + " must not be blank.",
                    Severity.ERROR, IDENTITY_GENERATOR_TAG));
        }//from  w w w  .j a va 2s .c  om

        if (getEnableCommonLoggingModuleCheckBox().isSelected()) {
            if (ValidationUtils.isBlank(this.getClmProjectNameField().getText())) {
                result.add(new SimpleValidationMessage(CLM_PROJECT_NAME + " must not be blank.", Severity.ERROR,
                        CLM_PROJECT_NAME));
            }
        }
    }

    return result;
}

From source file:org.archiviststoolkit.util.ATPropertyValidationSupport.java

License:Open Source License

public void addSimpleError(String text) {
    getResult().add(new SimpleValidationMessage(text, Severity.ERROR));
}