ApplicationValidator.java :  » Report » openi » org » openi » web » validation » admin » Java Open Source

Java Open Source » Report » openi 
openi » org » openi » web » validation » admin » ApplicationValidator.java
/*********************************************************************************
 * The contents of this file are subject to the OpenI Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the
 * License. You may obtain a copy of the License at
 * http://www.openi.org/docs/LICENSE.txt
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 *
 * The Original Code is: OpenI Open Source
 *
 * The Initial Developer of the Original Code is Loyalty Matrix, Inc.
 * Portions created by Loyalty Matrix, Inc. are
 * Copyright (C) 2005 Loyalty Matrix, Inc.; All Rights Reserved.
 *
 * Contributor(s): ______________________________________.
 *
 ********************************************************************************/
package org.openi.web.validation.admin;

import org.openi.application.Application;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;


/**
 * @author Uddhab Pant <br>
 * @version $Revision: 1.6 $ $Date: 2006/05/30 20:30:55 $ <br>
 *
 * Validates application form.
 * Contributor: i18n : Pedro Casals Fradera (2006/05/15)
 */
public class ApplicationValidator implements Validator {
    /**
     * Return whether or not this object can validate objects
     * of the given class.
     * @param _class Class
     * @return boolean
     */
    public boolean supports(Class _class) {
        return Application.class.isAssignableFrom(_class);
    }

    /**
     * Validate an object, which must be of a class for which
     * the supports() method returned true.
     *
     * @param object Object
     * @param errors Errors
     */
    public void validate(Object object, Errors errors) {
        // application title and logon image are required.
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "applicationTitle",
            "common.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "logonImageName",
            "common.required");
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.