예제 #1
0
 public String publicList() {
   PagingBean pb = getInitPagingBean();
   String strFolderId = getRequest().getParameter("folderId");
   String path = null;
   if (StringUtils.isNotEmpty(strFolderId)) {
     Long folderId = new Long(strFolderId);
     if (folderId.longValue() > 0L) {
       path = (this.docFolderService.get(new Long(strFolderId))).getPath();
     }
   }
   List<Document> list =
       this.documentService.findByPublic(
           path, this.document, this.from, this.to, ContextUtil.getCurrentUser(), pb);
   Type type = new TypeToken<List<Document>>() {}.getType();
   StringBuffer buff =
       new StringBuffer("{success:true,'totalCounts':")
           .append(pb.getTotalItems())
           .append(",result:");
   Gson gson =
       new GsonBuilder()
           .excludeFieldsWithoutExposeAnnotation()
           .setDateFormat("yyyy-MM-dd")
           .create();
   buff.append(gson.toJson(list, type));
   buff.append("}");
   this.jsonString = buff.toString();
   return "success";
 }
예제 #2
0
 public String shareList() {
   PagingBean pb = getInitPagingBean();
   AppUser appUser = ContextUtil.getCurrentUser();
   Set<AppRole> appRoles = appUser.getRoles();
   Long depId = null;
   if (!appUser.getUserId().equals(AppUser.SUPER_USER)) {
     Department dep = appUser.getDepartment();
     depId = dep.getDepId();
   }
   Iterator<AppRole> it = appRoles.iterator();
   ArrayList<Long> arrayList = new ArrayList<Long>();
   while (it.hasNext()) {
     arrayList.add((it.next()).getRoleId());
   }
   List<Document> list =
       this.documentService.findByIsShared(
           this.document, this.from, this.to, appUser.getUserId(), arrayList, depId, pb);
   Type type = new TypeToken<List<Document>>() {}.getType();
   StringBuffer buff =
       new StringBuffer("{success:true,'totalCounts':")
           .append(pb.getTotalItems())
           .append(",result:");
   Gson gson =
       new GsonBuilder()
           .excludeFieldsWithoutExposeAnnotation()
           .setDateFormat("yyyy-MM-dd")
           .create();
   buff.append(gson.toJson(list, type));
   buff.append("}");
   setJsonString(buff.toString());
   return "success";
 }
예제 #3
0
 public String search() {
   PagingBean pb = getInitPagingBean();
   String content = getRequest().getParameter("content");
   AppUser appUser = ContextUtil.getCurrentUser();
   List<Document> list = this.documentService.searchDocument(appUser, content, pb);
   Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
   Type type = new TypeToken<List<Document>>() {}.getType();
   StringBuffer buff =
       new StringBuffer("{success:true,'totalCounts':")
           .append(pb.getTotalItems())
           .append(",result:");
   buff.append(gson.toJson(list, type));
   buff.append("}");
   this.jsonString = buff.toString();
   return "success";
 }