Examples of CPFValidator


Examples of br.com.caelum.stella.validation.CPFValidator

import br.com.caelum.stella.validation.CPFValidator;

public class SimpleExample {
  public static void main(String[] args) {
    String cpf = "867.554.707-24";
    List<ValidationMessage> messages = new CPFValidator().invalidMessagesFor(cpf);
    for (ValidationMessage error : messages) {
      System.out.println(error.getMessage());
    }

    new CPFValidator().assertValid("867.554.707-24");
  }
View Full Code Here

Examples of br.com.caelum.stella.validation.CPFValidator

    public void validate(FacesContext facesContext, UIComponent uiComponent, Object value) throws ValidatorException {
      if (value == null || "".equals(value)) return;
     
        ResourceBundle bundle = resourceBundleFinder.getForCurrentLocale(facesContext);
        ResourceBundleMessageProducer producer = new ResourceBundleMessageProducer(bundle);
        CPFValidator validator = new CPFValidator(producer, formatted);

        try {
            validator.assertValid(value.toString());
        } catch (InvalidStateException e) {
            List<ValidationMessage> messages = e.getInvalidMessages();
            String firstErrorMessage = messages.remove(0).getMessage();
            registerAllMessages(facesContext, uiComponent, messages);
            throw new ValidatorException(new FacesMessage(firstErrorMessage));
View Full Code Here

Examples of br.com.caelum.stella.validation.CPFValidator

  private CPFValidator stellaValidator;

  @Override
  public void initialize(CPF cpf) {
    AnnotationMessageProducer messageProducer = new AnnotationMessageProducer(cpf);
    stellaValidator = new CPFValidator(messageProducer, cpf.formatted(),cpf.ignoreRepeated());
  }
View Full Code Here

Examples of br.com.caelum.stella.validation.CPFValidator

    /**
     * @see org.hibernate.validator.Validator#initialize(java.lang.annotation.Annotation)
     */
    public void initialize(CPF cpf) {
        AnnotationMessageProducer messageProducer = new AnnotationMessageProducer(cpf);
        stellaValidator = new CPFValidator(messageProducer, cpf.formatted());
    }
View Full Code Here

Examples of br.com.caelum.stella.validation.CPFValidator

import br.com.caelum.stella.validation.CPFValidator;

public class SimpleExample {
    public static void main(String[] args) {
        String cpf = "867.554.707-24";
        for (ValidationMessage error : new CPFValidator().invalidMessagesFor(cpf)) {
            System.out.println(error.getMessage());
        }

        new CPFValidator().assertValid("867.554.707-24");

    }
View Full Code Here

Examples of br.com.visualmidia.ui.validator.CPFValidator

    protected Collection<Validator> validators() {
        Collection<Validator> validators = new ArrayList<Validator>();

        validators.add(new EmptyValidator(nameText, screenMessageLabel, Validator.ERROR_REQUIRED_NAME));
        validators.add(new EmptyValidator(personalInfo.getBirthdateText(), screenMessageLabel, Validator.ERROR_REQUIRED_BIRTHDATE));
        validators.add(new CPFValidator(personalInfo.getCPFText(), screenMessageLabel, Validator.ERROR_REQUIRED_CPF));
        validators.add(new EmptyValidator(addressInfo.getStreetText(), screenMessageLabel, Validator.ERROR_REQUIRED_STREET));
        validators.add(new EmptyValidator(addressInfo.getStreetNumberText(), screenMessageLabel, Validator.ERROR_REQUIRED_STREETNUMBER));
        validators.add(new EmptyValidator(addressInfo.getStreetCEPText(), screenMessageLabel, Validator.ERROR_REQUIRED_CEP));
        validators.add(new EmptyValidator(addressInfo.getCityText(), screenMessageLabel, Validator.ERROR_REQUIRED_CITY));
//        validators.add(new EmptyValidator(employmentData.getPaymentDayCombo(), screenMessageLabel, Validator.ERROR_REQUIRED_PAYMENTDAY));
        validators.add(new ResponsableValidator(responsableInfo.getResponsableText(), personalInfo.getBirthdateText(), screenMessageLabel, Validator.ERROR_REQUIRED_RESPONSABLENAME));
        validators.add(new CPFValidator(responsableInfo.getCPFText(), screenMessageLabel, Validator.ERROR_REQUIRED_CPF));

        validators.add(new EmptyValidator(employmentData.getBeginDateText(), screenMessageLabel, Validator.ERROR_REQUIRED_BEGINDATE));
        validators.add(new EmptyValidator(employmentData.getPositionCombo(), screenMessageLabel, Validator.ERROR_REQUIRED_POSITION));
    validators.add(new TransactionDateValidator(screenMessageLabel,Validator.ERROR_REQUIRED_DATA_TRANSACTION_INVALID));
      
View Full Code Here

Examples of br.com.visualmidia.ui.validator.CPFValidator

  protected Collection<Validator> validators() {
    Collection<Validator> validators = new ArrayList<Validator>();

    validators.add(new EmptyValidator(nameText, screenMessageLabel, Validator.ERROR_REQUIRED_NAME));
    validators.add(new EmptyValidator(personalInfo.getBirthdateText(), screenMessageLabel, Validator.ERROR_REQUIRED_BIRTHDATE));
    validators.add(new CPFValidator(personalInfo.getCPFText(), screenMessageLabel, Validator.ERROR_REQUIRED_CPF));
    validators.add(new EmptyValidator(addressInfo.getStreetText(),screenMessageLabel, Validator.ERROR_REQUIRED_STREET));
    validators.add(new EmptyValidator(addressInfo.getStreetNumberText(),screenMessageLabel, Validator.ERROR_REQUIRED_STREETNUMBER));
    validators.add(new EmptyValidator(addressInfo.getStreetCEPText(), screenMessageLabel, Validator.ERROR_REQUIRED_CEP));
    validators.add(new EmptyValidator(addressInfo.getCityText(), screenMessageLabel, Validator.ERROR_REQUIRED_CITY));
    validators.add(new ResponsableValidator(responsableInfo.getResponsableText(), personalInfo.getBirthdateText(),screenMessageLabel, Validator.ERROR_REQUIRED_RESPONSABLENAME));
    validators.add(new CPFValidator(responsableInfo.getCPFText(),screenMessageLabel, Validator.ERROR_REQUIRED_CPF));
    validators.add(new AttendanceValidator(resourceInfo.getHowDoYouKnowVisualMidiaCombo(), screenMessageLabel,Validator.ERROR_REQUIRED_HOW_DO_YOU_KNOW_VISUAL_MIDIA));
    validators.add(new AttendanceValidator(attendanceInfo.getAttendanceResponsableCombo(), screenMessageLabel,Validator.ERROR_REQUIRED_ATTENDANCENAME));
    validators.add(new TransactionDateValidator(screenMessageLabel,Validator.ERROR_REQUIRED_DATA_TRANSACTION_INVALID));
    return validators;
  }
View Full Code Here
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.