Package net.sourceforge.stripes.validation

Examples of net.sourceforge.stripes.validation.LocalizableError


        disconnect();
      } catch (StorageException ignore) { }

      Log.out.warn("Captch mismatch: signature "+oMD5.asHex()+" for text "+getCaptcha()+" does not match session signature "+getSessionAttribute("captcha_key"));

      errors.add("captcha", new LocalizableError("com.zesped.action.SignUpForm.captchaMismatch"));      

    } else {
   
      try {
        User.forEmail(user.getEmail());
        errors.add("email", new LocalizableError("com.zesped.action.SignUpForm.emailAlreadyExists"));
      } catch (Exception e) { }
      try {
        CustomerAccount.forBusinessName(getBusinessName());
        errors.add("business_name", new LocalizableError("com.zesped.action.SignUpForm.businessNameAlreadyExists"));
      } catch (Exception e) { }
    } // fi
  }
View Full Code Here


  }
 
  @ValidationMethod(on="save")
  public void validatePassw(ValidationErrors errors) {
    if (!user.getPassword().equals(getPassword2()))
      errors.add("password", new LocalizableError("com.zesped.action.SignUpForm.passwMismatch"));
  }
View Full Code Here

  @ValidationMethod(on="save")
  public void validateEmail(ValidationErrors errors) {
    final String sEmail = getTaxPayer().getEmail();
    if (sEmail!=null)
          if (sEmail.length()>0 && !Gadgets.checkEMail(sEmail))
            errors.add("email", new LocalizableError("com.zesped.action.SaveClient.invalidEmail"));
  }
View Full Code Here

  @ValidationMethod(on="save")
  public void validateId(ValidationErrors errors) {
    final String sId = getTaxPayer().getId();
    if (sId==null) {
      Log.out.error("ActivateTaxPayer.validateId() TaxPayer id is null");
      errors.add("Id", new LocalizableError("com.zesped.action.ActivateTaxPayer.id.valueNotPresent"));
    } else if (sId.length()==0) {
      Log.out.error("ActivateTaxPayer.validateId() TaxPayer id is empty");
        errors.add("Id", new LocalizableError("com.zesped.action.ActivateTaxPayer.id.valueNotPresent"));
    }
  }
View Full Code Here

  @ValidationMethod(on="save")
  public void validateTaxId(ValidationErrors errors) {
    final String sTaxId = getTaxPayer().getTaxId();
    if (sTaxId!=null)
          if (sTaxId.trim().length()==0)
            errors.add("CIF", new LocalizableError("com.zesped.action.ActivateTaxPayer.taxId.valueNotPresent"));
  }
View Full Code Here

    final String sBusinessName = getTaxPayer().getBusinessName().toUpperCase();
    final String sTaxId = getTaxPayer().getTaxId();
    final String sFormerId = getTaxPayer().getId();
    Log.out.debug("Validating TaxPayer with business name "+sBusinessName+" and tax id. "+sTaxId+" for former id "+sFormerId);
    if (sBusinessName==null) {
      errors.add("business name", new LocalizableError("com.zesped.action.SaveClient.businessName.valueNotPresent"));
    } else if (sBusinessName.length()==0) {
      errors.add("business name", new LocalizableError("com.zesped.action.SaveClient.businessName.valueNotPresent"));
    } else {
      try {
        connect();
        CustomerAccount oAcc = new CustomerAccount(getSession().getDms(), getSessionAttribute("customer_account_docid"));
        TaxPayer oFoundTaxPayer = oAcc.taxpayers(getSession()).seek(getSession(), sBusinessName);
        if (!oFoundTaxPayer.id().equals(sFormerId))
          errors.add("business name", new LocalizableError("com.zesped.action.SaveClient.businessNameAlreadyExists"));
        oFoundTaxPayer = oAcc.taxpayers(getSession()).seek(getSession(), sTaxId);
        if (!oFoundTaxPayer.id().equals(sFormerId))
          errors.add("business name", new LocalizableError("com.zesped.action.SaveClient.taxIdAlreadyExists"));
      } catch (ElementNotFoundException clientnotfound) {
      } catch (Exception e) {
        Log.out.error("ActivateTaxPayer.validateBusinessName("+sBusinessName+") "+e.getClass().getName()+" "+e.getMessage(), e);
      } finally {
        close();
View Full Code Here

        int nAdminCount = 0;
        for (User oUsr : oAcc.getAdmins(getSession())) {
          if (!oUsr.id().equals(sFormerId)) nAdminCount++;
        }
        if (nAdminCount==0)
          addError(new LocalizableError("com.zesped.action.SaveUser.atLeastOneAdminIsRequired"));
        disconnect();
      } catch (Exception xcpt) {
        Log.out.error(xcpt.getMessage(), xcpt);
        addError(new SimpleError(xcpt.getClass().getName()+" "+xcpt.getMessage()));
      } finally {
View Full Code Here

  @ValidationMethod(on="save")
  public void validateRole(ValidationErrors ignore) {
    final String sRole = getParam("role","");
    if (sRole.length()==0)
      addError(new LocalizableError("com.zesped.action.SaveUser.role.valueNotPresent"));
  }
View Full Code Here

  public void validateUserData(ValidationErrors ignore) {
    final String s1stName = getParam("user.firstName","");
    final String s2ndName = getParam("user.lastName","");
    final String sEmail = getParam("user.email","");
    if (s1stName.length()==0)
      addError(new LocalizableError("com.zesped.action.SaveUser.user.firstName.valueNotPresent"));
    if (s2ndName.length()==0)
      addError(new LocalizableError("com.zesped.action.SaveUser.user.lastName.valueNotPresent"));
    if (s1stName.length()>64)
      addError(new LocalizableError("com.zesped.action.SaveUser.user.firstName.valueTooLong"));
    if (s2ndName.length()>64)
      addError(new LocalizableError("com.zesped.action.SaveUser.user.lastName.valueTooLong"));
    if (sEmail.length()==0)
      addError(new LocalizableError("com.zesped.action.SaveUser.user.email.valueNotPresent"));
    if (!Gadgets.checkEMail(sEmail))
      addError(new LocalizableError("com.zesped.action.SaveUser.user.email.invalidEmail"));
  }
View Full Code Here

    final String sEmpId = getParam("employee.employeeId","");
    final String sTxpr = getParam("taxPayer","");
    final String sPerms = getParam("permissions","all");
    final String sSelected = getParam("selectedTaxPayers","");
    if (sTaxId.length()>20)
      addError(new LocalizableError("com.zesped.action.SaveUser.employee.taxId.valueTooLong"));
    if (sEmpId.length()>20)
      addError(new LocalizableError("com.zesped.action.SaveUser.employee.employeeId.valueTooLong"));
    if (sPerms.equals("deny") && sSelected.length()>0) {
      if (Gadgets.search(sSelected.split("###"), sTxpr)>=0)
        addError(new LocalizableError("com.zesped.action.SaveUser.cannotDenyAccessToEmployee"));
    }
  } 
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.