Exemplo n.º 1
0
 /**
  * Gets the list data.
  *
  * @return null
  */
 @Override
 public String list() throws Exception {
   SearchCondition searchCondition = getSearchCondition();
   SearchResult<TargetList> result = baseService.getPaginationObjects(CLAZZ, searchCondition);
   Iterator<TargetList> targetLists = result.getResult().iterator();
   long totalRecords = result.getTotalRecords();
   getListJson(targetLists, totalRecords, null, false);
   return null;
 }
Exemplo n.º 2
0
  /**
   * Gets the list data.
   *
   * @return null
   */
  public String listFull() throws Exception {
    UserUtil.permissionCheck("view_targetList");

    Map<String, String> fieldTypeMap = new HashMap<String, String>();
    fieldTypeMap.put("created_on", Constant.DATA_TYPE_DATETIME);
    fieldTypeMap.put("updated_on", Constant.DATA_TYPE_DATETIME);

    User loginUser = UserUtil.getLoginUser();
    SearchCondition searchCondition =
        getSearchCondition(fieldTypeMap, loginUser.getScope_targetList(), loginUser);
    SearchResult<TargetList> result = baseService.getPaginationObjects(CLAZZ, searchCondition);
    Iterator<TargetList> targetLists = result.getResult().iterator();
    long totalRecords = result.getTotalRecords();
    getListJson(targetLists, totalRecords, searchCondition, true);
    return null;
  }
Exemplo n.º 3
0
  /**
   * Gets the list JSON data.
   *
   * @return list JSON data
   */
  public String list() throws Exception {

    SearchCondition searchCondition = getSearchCondition();
    SearchResult<SalesStage> result = baseService.getPaginationObjects(CLAZZ, searchCondition);
    List<SalesStage> salesStages = result.getResult();

    long totalRecords = result.getTotalRecords();

    // Constructs the JSON data
    String json = "{\"total\": " + totalRecords + ",\"rows\": [";
    int size = salesStages.size();
    for (int i = 0; i < size; i++) {
      SalesStage instance = (SalesStage) salesStages.get(i);
      Integer id = instance.getId();
      String name = instance.getName();
      int sequence = instance.getSequence();

      json +=
          "{\"id\":\""
              + id
              + "\",\"salesStage.id\":\""
              + id
              + "\",\"salesStage.name\":\""
              + name
              + "\",\"salesStage.sequence\":\""
              + sequence
              + "\"}";
      if (i < size - 1) {
        json += ",";
      }
    }
    json += "]}";

    // Returns JSON data back to page
    HttpServletResponse response = ServletActionContext.getResponse();
    response.getWriter().write(json);
    return null;
  }