/** * private methode, that counts the desired creditCards */ private void computeValidators(){ if(isAmex()){ this._initSum= org.apache.commons.validator.CreditCardValidator.AMEX + _initSum; } if(isVisa()){ this._initSum= org.apache.commons.validator.CreditCardValidator.VISA+ _initSum; } if(isMastercard()){ this._initSum= org.apache.commons.validator.CreditCardValidator.MASTERCARD+ _initSum; } if(isDiscover()){ this._initSum= org.apache.commons.validator.CreditCardValidator.DISCOVER+ _initSum; } }
/** * <p>initializes the desired validator.</p> */ private void initValidator() { if(isNone()){ //no cardtypes are allowed creditCardValidator = new org.apache.commons.validator.CreditCardValidator(org.apache.commons.validator.CreditCardValidator.NONE); } else{ computeValidators(); creditCardValidator = new org.apache.commons.validator.CreditCardValidator(_initSum); } }
/** * */ public void validate( FacesContext facesContext, UIComponent uiComponent, Object value) throws ValidatorException { if (facesContext == null) throw new NullPointerException("facesContext"); if (uiComponent == null) throw new NullPointerException("uiComponent"); if (value == null) { return; } initValidator(); if (!this.creditCardValidator.isValid(value.toString())){ Object[] args = {value.toString()}; throw new ValidatorException(getFacesMessage(CREDITCARD_MESSAGE_ID, args)); } }
public void restoreState(FacesContext facesContext, Object state) { Object[] values = (Object[])state; super.restoreState(facesContext,values[0]); _amex = ((Boolean) values[1]).booleanValue(); _amexSet = ((Boolean) values[2]).booleanValue(); _discover = ((Boolean) values[3]).booleanValue(); _discoverSet = ((Boolean) values[4]).booleanValue(); _mastercard = ((Boolean) values[5]).booleanValue(); _mastercardSet = ((Boolean) values[6]).booleanValue(); _none = ((Boolean) values[7]).booleanValue(); _noneSet = ((Boolean) values[8]).booleanValue(); _visa = ((Boolean) values[9]).booleanValue(); _visaSet = ((Boolean) values[10]).booleanValue(); } }
public Object saveState(FacesContext facesContext) { Object[] values = new Object[11]; values[0] = super.saveState(facesContext); values[1] = Boolean.valueOf(_amex); values[2] = Boolean.valueOf(_amexSet); values[3] = Boolean.valueOf(_discover); values[4] = Boolean.valueOf(_discoverSet); values[5] = Boolean.valueOf(_mastercard); values[6] = Boolean.valueOf(_mastercardSet); values[7] = Boolean.valueOf(_none); values[8] = Boolean.valueOf(_noneSet); values[9] = Boolean.valueOf(_visa); values[10] = Boolean.valueOf(_visaSet); return values; }
/** * <p>initializes the desired validator.</p> */ private void initValidator() { if(isNone()){ //no cardtypes are allowed creditCardValidator = new org.apache.commons.validator.CreditCardValidator(org.apache.commons.validator.CreditCardValidator.NONE); } else{ computeValidators(); creditCardValidator = new org.apache.commons.validator.CreditCardValidator(_initSum); } }
/** * */ public void validate( FacesContext facesContext, UIComponent uiComponent, Object value) throws ValidatorException { if (facesContext == null) throw new NullPointerException("facesContext"); if (uiComponent == null) throw new NullPointerException("uiComponent"); if (value == null) { return; } initValidator(); if (!this.creditCardValidator.isValid(value.toString())){ Object[] args = {value.toString()}; throw new ValidatorException(getFacesMessage(CREDITCARD_MESSAGE_ID, args)); } }
public void restoreState(FacesContext facesContext, Object state) { Object[] values = (Object[])state; super.restoreState(facesContext,values[0]); _amex = ((Boolean) values[1]).booleanValue(); _amexSet = ((Boolean) values[2]).booleanValue(); _discover = ((Boolean) values[3]).booleanValue(); _discoverSet = ((Boolean) values[4]).booleanValue(); _mastercard = ((Boolean) values[5]).booleanValue(); _mastercardSet = ((Boolean) values[6]).booleanValue(); _none = ((Boolean) values[7]).booleanValue(); _noneSet = ((Boolean) values[8]).booleanValue(); _visa = ((Boolean) values[9]).booleanValue(); _visaSet = ((Boolean) values[10]).booleanValue(); } }
public Object saveState(FacesContext facesContext) { Object[] values = new Object[11]; values[0] = super.saveState(facesContext); values[1] = Boolean.valueOf(_amex); values[2] = Boolean.valueOf(_amexSet); values[3] = Boolean.valueOf(_discover); values[4] = Boolean.valueOf(_discoverSet); values[5] = Boolean.valueOf(_mastercard); values[6] = Boolean.valueOf(_mastercardSet); values[7] = Boolean.valueOf(_none); values[8] = Boolean.valueOf(_noneSet); values[9] = Boolean.valueOf(_visa); values[10] = Boolean.valueOf(_visaSet); return values; }
/** * private methode, that counts the desired creditCards */ private void computeValidators(){ if(isAmex()){ this._initSum= org.apache.commons.validator.CreditCardValidator.AMEX + _initSum; } if(isVisa()){ this._initSum= org.apache.commons.validator.CreditCardValidator.VISA+ _initSum; } if(isMastercard()){ this._initSum= org.apache.commons.validator.CreditCardValidator.MASTERCARD+ _initSum; } if(isDiscover()){ this._initSum= org.apache.commons.validator.CreditCardValidator.DISCOVER+ _initSum; } }
/** * <p>initializes the desired validator.</p> */ private void initValidator() { if(isNone()) { //no cardtypes are allowed creditCardValidator = new org.apache.commons.validator.CreditCardValidator( org.apache.commons.validator.CreditCardValidator.NONE); } else { computeValidators(); creditCardValidator = new org.apache.commons.validator.CreditCardValidator(_initSum); } }
/** * */ public void validate( FacesContext facesContext, UIComponent uiComponent, Object value) throws ValidatorException { if (facesContext == null) { throw new NullPointerException("facesContext"); } if (uiComponent == null) { throw new NullPointerException("uiComponent"); } if (value == null) { return; } initValidator(); if (!this.creditCardValidator.isValid(value.toString())) { Object[] args = {value.toString()}; throw new ValidatorException(getFacesMessage(CREDITCARD_MESSAGE_ID, args)); } }
/** * private methode, that counts the desired creditCards */ private void computeValidators() { if(isAmex()) { this._initSum= org.apache.commons.validator.CreditCardValidator.AMEX + _initSum; } if(isVisa()) { this._initSum= org.apache.commons.validator.CreditCardValidator.VISA+ _initSum; } if(isMastercard()) { this._initSum= org.apache.commons.validator.CreditCardValidator.MASTERCARD+ _initSum; } if(isDiscover()) { this._initSum= org.apache.commons.validator.CreditCardValidator.DISCOVER+ _initSum; } }