Ejemplo n.º 1
0
 /**
  * ファイル一覧 Ajax ファイル情報加工 (BeanMap版)
  *
  * <ul>
  *   <li>HTMLタグ無効化
  * </ul>
  *
  * @param results 検索結果
  */
 public void setFileDecoration(BeanMap results) {
   // nullの場合nullという文字がでるのでその対策
   if (results.get("name") == null) {
     results.put("viewName", "");
   } else {
     results.put("viewName", setSanitizing(results.get("name")));
   }
   results.put("viewEmail", setSanitizing(results.get("email")));
 }
  /**
   * 比較を行います.
   *
   * @param o1 比較対象1
   * @param o2 比較対象2
   * @return 比較結果
   * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
   */
  public int compare(BeanMap o1, BeanMap o2) {
    Timestamp t1 = (Timestamp) o1.get("updDatetm");
    Timestamp t2 = (Timestamp) o2.get("updDatetm");
    if (!t1.equals(t2)) {
      return t1.before(t2) ? -1 : 1;
    }

    int key1 = ((Integer) o1.get("sortKey")).intValue();
    int key2 = ((Integer) o2.get("sortKey")).intValue();

    return key1 < key2 ? -1 : 1;
  }
  /**
   * 検索条件を指定して結果リストを返します.
   *
   * @param params 検索条件
   * @return 結果リスト
   * @throws ServiceException
   */
  public List<BeanMap> getSearchResult(BeanMap params) throws ServiceException {
    try {

      String searchTarget = (String) params.get(Param.SEARCH_TARGET);

      if (Constants.SEARCH_TARGET.VALUE_SLIP.equals(searchTarget)) {
        return findSlipByCondition(params);
      } else if (Constants.SEARCH_TARGET.VALUE_LINE.equals(searchTarget)) {
        return findSlipLineByCondition(params);
      }

      return null;
    } catch (ServiceException e) {
      throw e;
    } catch (Exception e) {
      throw new ServiceException(e);
    }
  }
  /**
   * 検索条件を指定して結果件数を返します.
   *
   * @param params 検索条件
   * @return 結果件数
   * @throws ServiceException
   */
  public Integer getSearchResultCount(BeanMap params) throws ServiceException {
    try {
      Integer count = Integer.valueOf(0);

      String searchTarget = (String) params.get(Param.SEARCH_TARGET);

      if (Constants.SEARCH_TARGET.VALUE_SLIP.equals(searchTarget)) {
        count = findSlipCntByCondition(params);
      } else if (Constants.SEARCH_TARGET.VALUE_LINE.equals(searchTarget)) {
        count = findSlipLineCntByCondition(params);
      }

      return count;
    } catch (ServiceException e) {
      throw e;
    } catch (Exception e) {
      throw new ServiceException(e);
    }
  }