Package net.sourceforge.stripes.validation

Examples of net.sourceforge.stripes.validation.LocalizableError


  @ValidationMethod(on="save")
  public void validateBillDate(ValidationErrors errors) {
    Log.out.debug("EditInvoice.validateBillDate()");
    if (getBillDay()>0 || getBillMonth()>0 || getBillYear()>0) {
      if (getBillDay()==0 || getBillMonth()==0 || getBillYear()==0)
        errors.add("fechaFactura", new LocalizableError("com.zesped.action.EditInvoice.invalidBillDate"));
      else if (getBillDay()>Calendar.LastDay(getBillMonth()-1, getBillYear())) {
        errors.add("fechaFactura", new LocalizableError("com.zesped.action.EditInvoice.invalidBillDate"));       
     
    }
  }
View Full Code Here


  @ValidationMethod(on="save")
  public void validateDueDate(ValidationErrors errors) {
    Log.out.debug("EditInvoice.validateDueDate()");
    if (getDueDay()>0 || getDueMonth()>0 || getDueYear()>0) {
      if (getDueDay()==0 || getDueMonth()==0 || getDueYear()==0)
        errors.add("fechaVencimiento", new LocalizableError("com.zesped.action.EditInvoice.invalidDueDate"));
      else if (getDueDay()>Calendar.LastDay(getDueMonth()-1, getDueYear())) {
        errors.add("fechaVencimiento", new LocalizableError("com.zesped.action.EditInvoice.invalidDueDate"));       
     
    }
  }
View Full Code Here

        Log.out.debug("withholding = "+getWithholding());
        Log.out.debug("total amount = "+getTotalAmount());
        BigDecimal oComputedTotal = oBasesSum.add(oVatSum).subtract(getWithholding());
        Log.out.debug("computed total = "+oComputedTotal);
        if (getTotalAmount().subtract(oComputedTotal).abs().floatValue()>0.04f) {
          errors.add("importe", new LocalizableError("com.zesped.action.EditInvoice.baseTotalVatMismatch", oBasesSum.add(oVatSum).toString(), getTotalAmount().toString()));
        }
      }       
    }
  }
View Full Code Here

  @ValidationMethod(on="save")
  public void validateCompleteness(ValidationErrors errors) {
    Log.out.debug("EditInvoice.validateCompleteness()");
    if (getProcessed() || getApproved()) {
      if (getBillerTaxPayer().length()==0 || getInvoiceNumber().length()==0 || getTotalAmount()==null)
        errors.add("proceso", new LocalizableError("com.zesped.action.EditInvoice.notComplete"));
      if (getBillDay()==0 || getBillMonth()==0 || getBillYear()==0)
        errors.add("fechaFactura", new LocalizableError("com.zesped.action.EditInvoice.invalidBillDate"));
      else if (getBillDay()>Calendar.LastDay(getBillMonth()-1, getBillYear())) {
        errors.add("fechaFactura", new LocalizableError("com.zesped.action.EditInvoice.invalidBillDate"));       
      }
    }
  }
View Full Code Here

    final String sNewPassword2 = getParam("newPassword2","");
    try {
      connect();
      User oUsr = new User(getSession(), getSessionAttribute("user_docid"));
      if (!oUsr.getPassword().equals(sFormerPassword) && sFormerPassword.length()>0)
        addError("password", new LocalizableError("com.zesped.action.SaveConfig.formerPassWordMismatch"));
      else if (!sNewPassword1.equals(sNewPassword2))
        addError("password", new LocalizableError("com.zesped.action.SaveConfig.newPassWordsMismatch"));
      else if (sNewPassword1.length()<6 && sNewPassword1.length()>0)
        addError("password", new LocalizableError("com.zesped.action.SaveConfig.newPassWordTooShort"));
      disconnect();
    } catch (Exception e) {
      Log.out.error("SaveConfig.validatePasswords( "+e.getClass().getName()+" "+e.getMessage(), e);   
    } finally {
      close();
View Full Code Here

  public void validateEmail(ValidationErrors ignore) {
    final String sEmail1 = getParam("user.email","");
    final String sEmail2 = getParam("email2","");
    try {
      if (!sEmail1.equals(sEmail2))
        addError("email", new LocalizableError("com.zesped.action.SaveConfig.emailMismatch"));
      else if (!Gadgets.checkEMail(sEmail1))
        addError("email", new LocalizableError("com.zesped.action.SaveConfig.emailSyntaxError"));
      try {
        if (!User.forEmail(sEmail1).equals(getSessionAttribute("user_docid")))
          addError("email", new LocalizableError("com.zesped.action.SaveConfig.emailAlreadyInUse"));
      } catch (ElementNotFoundException enfe) { }     
    } catch (Exception e) {
      Log.out.error("SaveConfig.validatePasswords( "+e.getClass().getName()+" "+e.getMessage(), e);   
    } finally {
      close();
View Full Code Here

        oUsr.save(getSession());         
        setSessionAttribute("fullname", oUsr.getFirstName()+" "+oUsr.getLastName());
        disconnect();
        addDataLine("id",oUsr.id());
      } catch (RecentlyUsedPasswordException rupe) {
        addError("password", new LocalizableError("com.zesped.action.SaveConfig.recentlyUsedPassword"));
      } catch (Exception xcpt) {
        Log.out.error("SaveConfig.save( "+xcpt.getClass().getName()+" "+xcpt.getMessage(), xcpt);   
      } finally {
        close();
      }
View Full Code Here

  @ValidationMethod(on="save")
  public void validateCode(ValidationErrors ignore) {
    final String sCode = getParam("accountingAccount.code");
    if (sCode==null)
      addError(new LocalizableError("com.zesped.action.SaveAccountingAccount.code.valueNotPresent"));         
    else if (sCode.length()==0)
      addError(new LocalizableError("com.zesped.action.SaveAccountingAccount.code.valueNotPresent"));         
  }
View Full Code Here

  @ValidationMethod(on="save")
  public void validateDescription(ValidationErrors ignore) {
    final String sDesc = getParam("accountingAccount.description");
    if (sDesc==null)
      addError(new LocalizableError("com.zesped.action.SaveAccountingAccount.description.valueNotPresent"));         
    else if (sDesc.length()==0)
      addError(new LocalizableError("com.zesped.action.SaveAccountingAccount.description.valueNotPresent"));         
  }
View Full Code Here

      connect(getSessionAttribute("nickname"), getSessionAttribute("password"));
      TaxPayer oTxpr = new TaxPayer(getSession().getDms(), getParam("taxPayer"));
      try {
        AccountingAccount oAaac = oTxpr.accounts(getSession()).seek(getSession(), getParam("accountingAccount.code"));
        if (!sFormerId.equals(oAaac.id()))
          addError(new LocalizableError("com.zesped.action.SaveAccountingAccount.code.valueDuplicated"));
      } catch (ElementNotFoundException enfe) { }
      disconnect();
    } catch (Exception xcpt) {
      Log.out.error(xcpt.getMessage(), xcpt);
      addError(new SimpleError(xcpt.getMessage()));
View Full Code Here

TOP

Related Classes of net.sourceforge.stripes.validation.LocalizableError

Copyright © 2018 www.massapicom. 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.