Package com.ebay.sdk.attributes.model

Examples of com.ebay.sdk.attributes.model.ValidationResult


    return result;
  }

  public static ValidationResult StringLengthRule(Integer id, Integer cnt, String target, ValidationRule rule)
  {
    ValidationResult result = new ValidationResult();

    if (isValidId(id.intValue())) {
      //result.setSuccess(cnt.intValue() > 0);
      //result.setErrorMessage("Please select a valid item.");
      result.setSuccess(true);
    }
    else
    {
        int len = target.length();
        result.setSuccess(0 <= len && len <= rule.length);
        if( !result.getSuccess() )
          result.setErrorMessage("Please enter no more than [" + rule.length + "] character(s).");
    }

    return result;
  }
View Full Code Here


    return result;
  }

  public static ValidationResult ThousandsSeparatorNotAllowedRule(Integer id, Integer cnt, String target, ValidationRule rule)
  {
    ValidationResult result = new ValidationResult();
    if (isValidId(id.intValue()) && cnt.intValue() > 0) {
      result.setSuccess(true);
    }
    else if (isValid(target)) {
      result.setSuccess(target.indexOf(COMMA) == -1 && target.indexOf(DOT) == -1);
    }
    result.setErrorMessage("Please enter a number with no thousands separators.");
    return result;
  }
View Full Code Here

  }

  //TODO
  public static ValidationResult UrlValidationRule(Integer id, Integer cnt, String target, ValidationRule rule)
  {
    ValidationResult result = new ValidationResult();
    if (isValidId(id.intValue()) && cnt.intValue() > 0) {
      result.setSuccess(true);
    }
    else if (isValid(target)) {
      result.setSuccess(true);
    }
    result.setErrorMessage("UrlValidationRule violation.");
    return result;
  }
View Full Code Here

    return result;
  }

  public static ValidationResult VinValidationRule(Integer id, Integer cnt, String target, ValidationRule rule)
  {
        ValidationResult result = new ValidationResult();

        result.setSuccess(true);

        return result;
  }
View Full Code Here

    return errSet;
  }

  private Error validateAttr(Attribute attr, Node rule) {
    ValidationRule v = null;
    ValidationResult result = null;

    try {
      v = new ValidationRule(rule);
      Object [] vParams = ValidationParams.getValidationParams(attr, v);
      result = (ValidationResult)SimpleValidator.validate(v.name, vParams);
    } catch(Exception ex) {
      result = new ValidationResult();
      result.setSuccess(false);
      result.setErrorMessage(ex.getClass().getName() + ": " + ex.getMessage());
    }

    if (!result.getSuccess()) {
      Error err = new Error();
      err.setAttributeID(attr.getAttributeID());
      err.setRuleName(v.name);
      err.setMessage(result.getErrorMessage()); //SimpleValidator.getErrorMessage(v.name);
      return err;
    }

    return null;
  }
View Full Code Here

TOP

Related Classes of com.ebay.sdk.attributes.model.ValidationResult

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.