Package org.apache.commons.validator.routines

Examples of org.apache.commons.validator.routines.DateValidator


   * @param limit 获取多少条记录
   * @return
   */
  public List<PushRecord> getPushRecordByTopic(String topicid, int minLspri, int maxLspri,
      Boolean isImg, String startTime, String endTime, int limit) throws Exception {
    DateValidator dateValidator = DateValidator.getInstance();
    if (StringUtils.isEmpty(topicid)) {
      throw new Exception("topicid为空");
    }
    if (minLspri > 100 || minLspri < 0) {
      throw new Exception("minLspri只能在0-100之间");
    }
    if (maxLspri > 100 || maxLspri < 0) {
      throw new Exception("maxLspri只能在0-100之间");
    }
    if (limit <= 0) {
      throw new Exception("limit不能小于0");
    }
    if (!dateValidator.isValid(startTime, "yyyy-MM-dd") && StringUtils.isNotEmpty(startTime)) {
      throw new Exception("startTime需要格式yyyy-MM-dd");
    }
    if (!dateValidator.isValid(endTime, "yyyy-MM-dd") && StringUtils.isNotEmpty(endTime)) {
      throw new Exception("endTime需要格式yyyy-MM-dd");
    }
    return pushRecordService.getPushRecordByTopic(topicid, minLspri, maxLspri, isImg, startTime,
        endTime, limit);
  }
View Full Code Here

TOP

Related Classes of org.apache.commons.validator.routines.DateValidator

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.