Package com.jgoodies.validation.util

Examples of com.jgoodies.validation.util.PropertyValidationSupport


    }
    return validateSearchOrder();
  }

  private ValidationResult validateOrder() {
    PropertyValidationSupport support = new PropertyValidationSupport(
        orderModel, "Ordre");
    if (ValidationUtils.isBlank(ModelUtil.nullToString(orderModel
        .getOrderNr()))) {
      support.addError("ordrenummer", "m� settes");
    }

    if (ValidationUtils.isBlank(orderModel.getDeliveryAddress())) {
      support.addError("adresse", "m� settes");
    }

    if (ValidationUtils.isBlank(orderModel.getPostalCode())) {
      support.addError("postnummer", "m� settes");
    } else if (!ValidationUtils.isNumeric(orderModel.getPostalCode())) {
      support.addError("postnummer", "m� v�re et tall");
    } else if (orderModel.getPostalCode().length() > 4) {
      support.addError("postnummer", "kan ikke v�re mer enn 4 tall");
    }

    if (ValidationUtils.isBlank(orderModel.getPostOffice())) {
      support.addError("poststed", "m� settes");
    }
    if (orderModel.getCustomer() == null
        && (ValidationUtils.isBlank(ModelUtil.nullToString(orderModel
            .getCustomerNr()))
            || ValidationUtils
                .isBlank(ModelUtil.nullToString(orderModel
                    .getCustomerFirstName())) || ValidationUtils
            .isBlank(ModelUtil.nullToString(orderModel
                .getCustomerLastName())))) {
      support.addError("kunde", "m� settes");
    }
    if (orderModel.getConstructionType() == null) {
      support.addError("garasjetype", "m� settes");
    }

    if (orderModel.getOrderDate() == null) {
      support.addError("ordredato", "m� settes");
    }

    if (ValidationUtils.isBlank(ModelUtil.nullToString(orderModel
        .getProductArea()))) {
      support.addError("produktomr�de", "m� settes");
    }
    return support.getResult();
  }
View Full Code Here


    }
    return support.getResult();
  }

  private ValidationResult validateSearchOrder() {
    PropertyValidationSupport support = new PropertyValidationSupport(
        orderModel, "Ordre");
    boolean criteriaSet = false;
    if (!ValidationUtils.isBlank(ModelUtil.nullToString(orderModel
        .getOrderNr()))) {
      criteriaSet = true;
    }

    if (!ValidationUtils.isBlank(ModelUtil.nullToString(orderModel
        .getCustomerFirstName()))) {
      criteriaSet = true;
    }

    if (!ValidationUtils.isBlank(ModelUtil.nullToString(orderModel
        .getCustomerNr()))
        || !ValidationUtils.isBlank(ModelUtil.nullToString(orderModel
            .getCustomerFirstName()))
        || !ValidationUtils.isBlank(ModelUtil.nullToString(orderModel
            .getCustomerLastName()))
        || !ValidationUtils.isBlank(ModelUtil.nullToString(orderModel
            .getTelephoneNr()))
        || !ValidationUtils.isBlank(ModelUtil.nullToString(orderModel
            .getTelephoneNrSite()))) {
      criteriaSet = true;
    }

    if (!ValidationUtils.isBlank(orderModel.getDeliveryAddress())) {
      criteriaSet = true;
    }

    if (!ValidationUtils.isBlank(orderModel.getPostalCode())) {
      criteriaSet = true;
      if (!ValidationUtils.isNumeric(orderModel.getPostalCode())) {
        support.addError("postnummer", "m� v�re et tall");
      } else if (orderModel.getPostalCode().length() > 4) {
        support.addError("postnummer", "kan ikke v�re mer enn 4 tall");
      }
    }

    if (!ValidationUtils.isBlank(orderModel.getPostOffice())) {
      criteriaSet = true;
    }
    if (!ValidationUtils.isBlank(orderModel.getSalesman())) {
      criteriaSet = true;
    }

    if (!ValidationUtils.isBlank(ModelUtil.nullToString(orderModel
        .getProductArea()))) {
      criteriaSet = true;
    }

    if (orderModel.getOrderDate() != null) {
      criteriaSet = true;
    }

    if (orderModel.getAgreementDate() != null) {
      criteriaSet = true;
    }
    if (orderModel.getDeliveryWeek() != null) {
      criteriaSet = true;
    }

    if (orderModel.getConstructionType() != null) {
      criteriaSet = true;
    }
    if (orderModel.getTransport() != null) {
      criteriaSet = true;
    }
    if (orderModel.getInvoiceDate() != null) {
      criteriaSet = true;
    }
    if (orderModel.getPacklistReady() != null) {
      criteriaSet = true;
    }
    if (orderModel.getPaidDate() != null) {
      criteriaSet = true;
    }
    if (orderModel.getProductionDate() != null) {
      criteriaSet = true;
    }

    if (!criteriaSet) {
      support.addError("ordrenummer",
          "m� sette inn s�kekriteria i ett av feltene");
    }

    return support.getResult();
  }
View Full Code Here

     * Validates this Validator's Order and returns the result as an instance of
     * {@link ValidationResult}.
     * @return the ValidationResult of the order validation
     */
    public final ValidationResult validate() {
        PropertyValidationSupport support = new PropertyValidationSupport(
                infoModel, "Informasjon");

        if (ValidationUtils.isBlank(ModelUtil.nullToString(infoModel
                .getDateFrom()))) {
            support.addError("fra dato", "m� settes");
        }
        if (ValidationUtils.isBlank(ModelUtil.nullToString(infoModel
                .getDateTo()))) {
            support.addError("til dato", "m� settes");
        }
        if (ValidationUtils.isBlank(ModelUtil.nullToString(infoModel
                .getInfoText()))) {
            support.addError("informasjonstekst", "m� settes");
        }

        return support.getResult();
    }
View Full Code Here

     * Validates this Validator's Order and returns the result as an instance of
     * {@link ValidationResult}.
     * @return the ValidationResult of the order validation
     */
    public final ValidationResult validate() {
        PropertyValidationSupport support = new PropertyValidationSupport(
                attributeChoiceModel, "Valg");

        if (ValidationUtils.isBlank(ModelUtil.nullToString(attributeChoiceModel
                .getChoiceValue()))) {
            support.addError("valg", "m� settes");
        }
       

        return support.getResult();
    }
View Full Code Here

     * Validates this Validator's Order and returns the result as an instance of
     * {@link ValidationResult}.
     * @return the ValidationResult of the order validation
     */
    public final ValidationResult validate() {
        PropertyValidationSupport support = new PropertyValidationSupport(
                jobFunctionModel, "Funksjon");

        if (ValidationUtils.isBlank(ModelUtil.nullToString(jobFunctionModel
                .getJobFunctionName()))) {
            support.addError("navn", "m� settes");
        }

        return support.getResult();
    }
View Full Code Here

     * Validates this Validator's Order and returns the result as an instance of
     * {@link ValidationResult}.
     * @return the ValidationResult of the order validation
     */
    public final ValidationResult validate() {
        PropertyValidationSupport support = new PropertyValidationSupport(
                externalOrderModel, "Bestilling");

        if (externalOrderModel.getSupplier() == null) {
            support.addError("leverand�r", "m� settes");
        }

        return support.getResult();
    }
View Full Code Here

    /**
     * @see com.jgoodies.validation.Validator#validate()
     */
    public final ValidationResult validate() {
        PropertyValidationSupport support = new PropertyValidationSupport(
                articleTypeModel, "Artikkeltype");

        if (ValidationUtils.isBlank(ModelUtil.nullToString(articleTypeModel
                .getArticleTypeName()))) {
            support.addError("navn", "m� settes");
        }
       
        if(!ValidationUtils.isNumeric(ModelUtil.nullToString(articleTypeModel
                .getProdCatNo()))){
            support.addError("produktkategori", "m� v�re tall");
        }

        return support.getResult();
    }
View Full Code Here

    /**
     * @see com.jgoodies.validation.Validator#validate()
     */
    public final ValidationResult validate() {
        PropertyValidationSupport support = new PropertyValidationSupport(
                commentModel, "Kommentar");

        if(ValidationUtils.isEmpty(commentModel.getComment())){
          support.addError("kommentar", "kan ikke v�re tom");
        }
        if (ModelUtil.nullToString(commentModel.getComment()).length() >= ICommentModel.MAX_COMMENT_LENGTH) {
            support.addError("kommentar", "kan ikke v�re lengre enn "
                    + ICommentModel.MAX_COMMENT_LENGTH);
        }

        return support.getResult();
    }
View Full Code Here

     * Validates this Validator's Order and returns the result as an instance of
     * {@link ValidationResult}.
     * @return the ValidationResult of the order validation
     */
    public final ValidationResult validate() {
        PropertyValidationSupport support = new PropertyValidationSupport(
                attributes, "Artikkel");

        if (attributes != null) {
            int count = 1;

            for (IArticleAttribute attribute : attributes) {
                validateAttribute(support, attribute);
                count++;
            }
        }

        return support.getResult();
    }
View Full Code Here

     * Validates this Validator's Order and returns the result as an instance of
     * {@link ValidationResult}.
     * @return the ValidationResult of the order validation
     */
    public final ValidationResult validate() {
        PropertyValidationSupport support = new PropertyValidationSupport(
                costTypeModel, "Kostnadstype");

        if (ValidationUtils.isBlank(costTypeModel.getCostTypeName())) {
            support.addError("navn", "m� settes");
        }

        return support.getResult();
    }
View Full Code Here

TOP

Related Classes of com.jgoodies.validation.util.PropertyValidationSupport

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.