Package net.sourceforge.stripes.validation

Examples of net.sourceforge.stripes.validation.SimpleError


    /** A divide event that validates that we're not dividing by zero. */
    @HandlesEvent("divide")
    public Resolution divide() {
        if (rhs == 0) {
            getContext().getValidationErrors().add("rhs", new SimpleError("Rhs may not be zero"));
            return getContext().getSourcePageResolution();
        }

        this.result = lhs / rhs;
        getContext().getRequest().setAttribute("integerResult", (int) this.result);
View Full Code Here


  public ValidationError addError(SimpleError e) {
    return addError(e.getFieldName(), e, null);
  }

  public ValidationError addError(String f, LocalizableError l, ValidationErrors v) {
    SimpleError e = new SimpleError(l.getMessage(getContext().getLocale()), l.getReplacementParameters());
    if (l.getFieldName()!=null) e.setFieldName(l.getFieldName());
    if (l.getFieldValue()!=null) e.setFieldValue(l.getFieldValue());
    return addError(f, e, v);
  }
View Full Code Here

    if (l.getFieldValue()!=null) e.setFieldValue(l.getFieldValue());
    return addError(f, e, v);
  }
 
  public ValidationError addError(LocalizableError l, ValidationErrors v) {
    SimpleError e = new SimpleError(l.getMessage(getContext().getLocale()), l.getReplacementParameters());
    if (l.getFieldName()!=null) e.setFieldName(l.getFieldName());
    if (l.getFieldValue()!=null) e.setFieldValue(l.getFieldValue());
    return addError(e, v);
  }
View Full Code Here

      oSes.disconnect();
      oSes.close();
      oSes = null;
      if (null==oTxpr) {
        Log.out.error("No tax payer with id "+sTaxPayerId+" was found");
        conversionErrors.add(new SimpleError("No tax payer with id "+sTaxPayerId+" was found"));
      }
    } catch (Exception exc) {
      Log.out.error(exc.getClass().getName()+" TaxPayer.convert("+sTaxPayerId+") "+exc.getMessage());
      conversionErrors.add(new SimpleError(exc.getMessage()));
    }
    Log.out.debug("End TaxPayer.convert("+sTaxPayerId+") : " + oTxpr);
    return oTxpr;
  }
View Full Code Here

  @ValidationMethod(on="save")
  public void validateId(ValidationErrors ignore) {
    final String sFormerId = getParam("taxPayer.id");
    if (sFormerId==null)
          addError("id", new SimpleError("Parameter taxPayer.id is required"));
  }
View Full Code Here

          addDataLine("id",oTxpr.id());
          if (getSessionAttribute("taxpayer_docid").equals(oTxpr.getId()))
            setSessionAttribute("businessname", oTxpr.getBusinessName());
      } catch (Exception xcpt) {
        Log.out.error(xcpt.getMessage(), xcpt);
        addError(new SimpleError(xcpt.getMessage()));
      } finally {
        close();
      }
      try {
        Cache.deleteEntry(getSessionAttribute("customer_account_docid")+"acctaxpayers");
View Full Code Here

        disconnect();
          addDataLine("uuid",oEmpl.getUuid());
          addDataLine("id",oEmpl.id());
      } catch (Exception xcpt) {
        Log.out.error(xcpt.getMessage(), xcpt);
        addError(new SimpleError(xcpt.getMessage()));
      } finally {
        close();
      }
    }
      return AjaxResponseResolution();
View Full Code Here

  @ValidationMethod(on="save")
  public void validateId(ValidationErrors ignore) {
    final String sFormerId = getParam("client.id");
    if (sFormerId==null)
          addError("id", new SimpleError("Parameter client.id is required"));
  }
View Full Code Here

        saveRequest(oClnt);
        disconnect();
          addDataLine("id",oClnt.id());
      } catch (Exception xcpt) {
        Log.out.error(xcpt.getMessage(), xcpt);
        addError(new SimpleError(xcpt.getMessage()));
      } finally {
        close();
      }
      try {
        Cache.deleteEntry(getSessionAttribute("customer_account_docid")+"clients");
View Full Code Here

        oMsg.archive(getSession());
        disconnect();
          addDataLine("id",oMsg.id());
      } catch (Exception xcpt) {
        Log.out.error(xcpt.getMessage(), xcpt);
        addError(new SimpleError(xcpt.getMessage()));
      } finally {
        close();
      }
    }
      return AjaxResponseResolution();
View Full Code Here

TOP

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

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.