All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.craftercms.commons.validation.ErrorCodes Maven / Gradle / Ivy

/*
 * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 3 as published by
 * the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see .
 */
package org.craftercms.commons.validation;

public class ErrorCodes {

    /*
     * Common errors
     */
    public static final String NOT_NULL_ERROR_CODE = "validation.error.notNull";
    public static final String INVALID_METHOD_PARAMS_ERROR_CODE = "validation.error.invalidMethodParams";
    public static final String INVALID_REQUEST_BODY_ERROR_CODE = "validation.error.invalidRequestBody";

    /*
     * Field errors
     */
    public static final String FIELD_UNRECOGNIZED_ERROR_CODE = "validation.error.rest.field.unrecognized";
    public static final String FIELD_MISSING_ERROR_CODE = "validation.error.rest.field.missing";

    /*
     * String errors
     */
    public static final String STRING_NOT_EMPTY_ERROR_CODE = "validation.error.string.notEmpty";
    public static final String STRING_NOT_BLANK_ERROR_CODE = "validation.error.string.notBlank";
    public static final String STRING_MIN_LENGTH_ERROR_CODE = "validation.error.string.minLength";
    public static final String STRING_MAX_LENGTH_ERROR_CODE = "validation.error.string.maxLength";
    public static final String STRING_REGEX_VALIDATION_FAILED_ERROR_CODE = "validation.error.string.regexMatchingFailed";

    public static final String SQL_SORT_VALIDATION_FAILED_ERROR_CODE = "validation.error.sql.sort.failed";

    /*
     * List errors
     */
    public static final String LIST_NOT_EMPTY_ERROR_CODE = "validation.error.list.notEmpty";

    /**
     * Object errors
     */
    public static final String OBJECT_FIELD_READ_ERROR_CODE = "validation.error.object.field.read";

    /*
     * Number errors
     */
    public static final String NUMBER_MIN_VALUE_ERROR = "validation.error.number.minValue";
    public static final String NUMBER_MAX_VALUE_ERROR = "validation.error.number.maxValue";

    private static final String ESAPI_URI_ERROR = "validation.error.esapi.%s";

    public static String getEsapiErrorMessageKey(final String esapiType) {
        return String.format(ESAPI_URI_ERROR, esapiType);
    }

    private ErrorCodes() {
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy