Biblioteca Java - Rev 9

Subversion Repositories:
Rev:
package com.linkscreens.inventory.validator;

import com.linkscreens.inventory.entity.InventoryItem;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

/**
 *
 */

public class ItemValidator  implements Validator {

    @Override
    public boolean supports(Class<?> paramClass) {
        return InventoryItem.class.equals(paramClass);
    }

    @Override
    public void validate(Object obj, Errors errors) {
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "nrCrt", "nrCrt.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "simbolClasaMijlocFix", "simbolClasaMijlocFix.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "mijlocFix", "mijlocFix.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "nrInventar", "nrInventar.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "cont", "cont.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "cantitate", "cantitate.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "UM", "UM.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "pret", "pret.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "valoare", "valoare.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "amortizarePrecedenta", "amortizarePrecedenta.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "amortizareCurenta", "amortizareCurenta.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "amortizareTotala", "amortizareTotala.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "valoareRamasa", "valoareRamasa.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "durataNormala", "durataNormala.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "durataRamasa", "durataRamasa.required");
    }
}