Package com.vst.webapp.validators

Source Code of com.vst.webapp.validators.CompanyLicenseValidator

package com.vst.webapp.validators;

import com.vst.model.CompanyLicense;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;

/**
* Created by IntelliJ IDEA.
* User: Администратор
* Date: 06.07.2009
* Time: 17:33:27
* To change this template use File | Settings | File Templates.
*/
public class CompanyLicenseValidator implements Validator {
    public boolean supports(Class aClass) {
        return CompanyLicense.class.isAssignableFrom(aClass);
    }

    public void validate(Object o, Errors errors) {
        CompanyLicense companyLicense = (CompanyLicense) o;
        if ((companyLicense.getPhoto() == null || companyLicense.getPhoto().getFile().length == 0) && companyLicense.getLicenseId() == null) {
            errors.rejectValue("photo", "companyLicense.error");
        }
    }
}
TOP

Related Classes of com.vst.webapp.validators.CompanyLicenseValidator

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.