Esempio n. 1
0
 @Override
 public ActionForward execute(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   LoginUser loginUser = preprocess(mapping, request, response);
   ActionData actionData = new ActionData();
   fillFilters(request, actionData);
   List<UserListInfo> list =
       userService.getAllUserInfoListByFilter(
           loginUser.getPrjid(),
           actionData.getTargetFilter(),
           actionData.getProductFilter(),
           actionData.getRoleFilter(),
           actionData.getTeamFilter(),
           actionData.getHasCaseFilter(),
           actionData.getStatusFilter());
   if (list.size() > 0) {
     response.getWriter().write(outputList(request, loginUser, list));
   }
   return null;
 }
Esempio n. 2
0
  public String outputList(
      HttpServletRequest request, LoginUser loginUser, List<UserListInfo> list) {
    UserDisplay userDisplay;
    StringBuilder sb = new StringBuilder();
    sb.append("<table id=\"userInfoList\" style=\"width:100%\"><thead><tr class=\"thead\">")
        .append("<th>")
        .append(getMessage(request, Messages.KEY_COMMON_TH_NAME))
        .append("</th><th>")
        .append(getMessage(request, Messages.KEY_COMMON_TH_ROLE))
        .append("</th><th>")
        .append(getMessage(request, Messages.KEY_COMMON_TH_COUNTRY))
        .append("</th><th>")
        .append(getMessage(request, Messages.KEY_COMMON_TH_TEAMS))
        .append("</th><th nowrap>")
        .append(getMessage(request, Messages.KEY_COMMON_TH_OPENCASES))
        .append("</th><th>")
        .append(getMessage(request, Messages.KEY_COMMON_TH_ASSIGNEDCONTENT))
        .append("</th></tr></thead><tbody>");
    if (list != null) {
      for (int i = 0, size = list.size(); i < size; ++i) {
        UserListInfo userListInfo = list.get(i);
        userDisplay =
            viewPermisssionService.getUserDisplayOfProject(
                loginUser.getPrjid(),
                Constants.DEFAULT_VIEW_MATRIX_ID,
                loginUser.getUid(),
                userListInfo.getId());
        if (userDisplay.getPermission() == 0) {
          sb.append("<tr><td>").append(userDisplay.getDisplayUsername()).append("</td>");
        } else {
          sb.append("<tr><td><a href=\"profile.do?targetUid=")
              .append(userDisplay.getUserId())
              .append("\">")
              .append(userDisplay.getDisplayUsername())
              .append("</a></td>");
        }
        sb.append("<td>").append(userListInfo.getRole()).append("</td><td>");

        if (userListInfo.getTargets() != null) {
          for (Target tar : userListInfo.getTargets()) {
            sb.append(tar.getName()).append(", ");
          }
        }
        if (sb.charAt(sb.length() - 2) == ',') {
          sb.setLength(sb.length() - 2);
        }
        sb.append("</td><td>");

        if (userListInfo.getTeams() != null) {
          for (Team team : userListInfo.getTeams()) {
            sb.append(team.getTeamName()).append(", ");
          }
        }
        if (sb.charAt(sb.length() - 2) == ',') {
          sb.setLength(sb.length() - 2);
        }
        sb.append("</td><td>");

        if (userListInfo.getOpenCases() != null) {
          for (Cases cases : userListInfo.getOpenCases()) {
            sb.append("<a href=\"casedetail.do?caseid=")
                .append(cases.getId())
                .append("\"># ")
                .append(cases.getId())
                .append("</a>, ");
          }
        }
        if (sb.charAt(sb.length() - 2) == ',') {
          sb.setLength(sb.length() - 2);
        }
        sb.append("</td><td>");

        if (userListInfo.getAssignedTaskDisplay() != null) {
          for (AssignedTaskDisplay atd : userListInfo.getAssignedTaskDisplay()) {
            if (atd.getHorseId() == -1) {
              sb.append(atd.getContent()).append(", ");
            } else {
              if (atd.getContentType() == Constants.CONTENT_TYPE_JOURNAL) {
                sb.append("<a href=\"notebook.do?action=display&horseid=")
                    .append(atd.getHorseId())
                    .append("\">")
                    .append(atd.getContent())
                    .append("</a>, ");
              } else if (atd.getContentType() == Constants.CONTENT_TYPE_SURVEY) {
                sb.append("<a href=\"surveyDisplay.do?action=display&horseid=")
                    .append(atd.getHorseId())
                    .append("\">")
                    .append(atd.getContent())
                    .append("</a>, ");
              }
            }
          }
        }
        if (sb.charAt(sb.length() - 2) == ',') {
          sb.setLength(sb.length() - 2);
        }
        sb.append("</td></tr>");
      }
    }
    sb.append("</tbody></table>");
    return sb.toString();
  }