コード例 #1
0
  public void saveDocumentMapping(JSONObject jobj) throws ServiceException {
    try {
      Docmap docMap = new Docmap();

      if (jobj.has("docid") && !StringUtil.isNullOrEmpty(jobj.getString("docid"))) {
        Docs doc = (Docs) hibernateTemplate.get(Docs.class, jobj.getString("docid"));
        docMap.setDocid(doc);
        if (jobj.has("companyid") && !StringUtil.isNullOrEmpty(jobj.getString("companyid"))) {
          Company company =
              (Company) hibernateTemplate.get(Company.class, jobj.getString("companyid"));
          doc.setCompany(company);
        }
        if (jobj.has("userid") && !StringUtil.isNullOrEmpty(jobj.getString("userid"))) {
          User user = (User) hibernateTemplate.get(User.class, jobj.getString("userid"));
          doc.setUserid(user);
        }
      }
      if (jobj.has("refid")) {
        docMap.setRecid(jobj.getString("refid"));
      }
      if (jobj.has("map")) {
        docMap.setRelatedto(jobj.getString("map"));
      }
      hibernateTemplate.save(docMap);
    } catch (Exception ex) {
      throw ServiceException.FAILURE("documentDAOImpl.saveDocumentMapping", ex);
    }
  }
コード例 #2
0
  public Hashtable getDocumentDownloadHash(List ll) {
    Hashtable<String, String> ht = new Hashtable<String, String>();
    try {
      Iterator ite = ll.iterator();
      while (ite.hasNext()) {
        com.krawler.common.admin.Docmap cDocMap = (com.krawler.common.admin.Docmap) ite.next();
        ht.put("relatedto", cDocMap.getRelatedto());
        ht.put("recid", cDocMap.getRecid());

        com.krawler.common.admin.Docs t = cDocMap.getDocid();
        ht.put("docid", t.getDocid());
        ht.put("Name", t.getDocname());
        ht.put("Size", t.getDocsize());
        ht.put("Type", t.getDoctype());
        ht.put("svnname", t.getStorename());
        ht.put("storeindex", String.valueOf(t.getStorageindex()));
      }
    } catch (Exception e) {
      System.out.println(e.getMessage());
    }
    return ht;
  }
コード例 #3
0
  public ModelAndView getDocs(HttpServletRequest request, HttpServletResponse response) {
    JSONObject jobj = new JSONObject();
    JSONObject jobj1 = new JSONObject();
    KwlReturnObject kmsg = null;
    KwlReturnObject result = null;
    try {

      HashMap<String, Object> requestParams = new HashMap<String, Object>();
      ArrayList filter_names = new ArrayList(), filter_values = new ArrayList();
      JSONArray jarr = new JSONArray();
      String userid = "";
      int start, limit;

      userid = request.getParameter("userid");
      String currentuser = AuthHandler.getUserid(request);
      String ss = request.getParameter("ss");
      if (request.getParameter("start") == null) {
        start = 0;
        limit = 15;
      } else {
        start = Integer.parseInt(request.getParameter("start"));
        limit = Integer.parseInt(request.getParameter("limit"));
      }

      if (request.getParameter("applicant").equalsIgnoreCase("applicant")) {

        filter_names.add("recid");
        filter_values.add(userid);

        filter_names.add("docid.deleted");
        filter_values.add(false);

        filter_names.add("docid.referenceid");
        filter_values.add(userid);

        requestParams.put("filter_names", filter_names);
        requestParams.put("filter_values", filter_values);
        requestParams.put("ss", ss);
        requestParams.put("searchcol", new String[] {"docid.docname", "docid.docdesc"});
        requestParams.put("start", start);
        requestParams.put("limit", limit);
        requestParams.put("allflag", false);
        result = hrmsExtApplDocsDAOObj.getDocs(requestParams);

        Iterator ite = result.getEntityList().iterator();
        while (ite.hasNext()) {
          HrmsDocmap docs = (HrmsDocmap) ite.next();
          JSONObject tmpObj = new JSONObject();
          tmpObj.put("docid", docs.getDocid().getDocid());
          tmpObj.put("docname", docs.getDocid().getDocname());
          tmpObj.put("docdesc", docs.getDocid().getDocdesc());
          tmpObj.put("uploadedby", docs.getDocid().getUploadedby());
          Float dsize = Math.max(0, Float.parseFloat(docs.getDocid().getDocsize()) / 1024);
          tmpObj.put("docsize", String.valueOf(dsize));
          tmpObj.put(
              "uploaddate",
              AuthHandler.getDateFormatter(request).format(docs.getDocid().getUploadedon()));
          jarr.put(tmpObj);
        }

      } else {
        filter_names.add("recid");
        filter_values.add(userid);

        filter_names.add("docid.deleteflag");
        filter_values.add(0);

        requestParams.put("filter_names", filter_names);
        requestParams.put("filter_values", filter_values);
        requestParams.put("ss", ss);
        requestParams.put("searchcol", new String[] {"docid.docname", "docid.docdesc"});
        requestParams.put("start", start);
        requestParams.put("limit", limit);
        requestParams.put("allflag", false);

        result = documentDAOObj.getDocs(requestParams);

        Iterator ite = result.getEntityList().iterator();
        while (ite.hasNext()) {
          Docmap docs = (Docmap) ite.next();
          JSONObject tmpObj = new JSONObject();
          tmpObj.put("docid", docs.getDocid().getDocid());
          tmpObj.put("docname", docs.getDocid().getDocname());
          tmpObj.put("docdesc", docs.getDocid().getDocdesc());
          tmpObj.put(
              "uploadedby",
              docs.getDocid().getUserid().getFirstName()
                  + " "
                  + docs.getDocid().getUserid().getLastName());
          Float dsize = Math.max(0, Float.parseFloat(docs.getDocid().getDocsize()) / 1024);
          tmpObj.put("docsize", String.valueOf(dsize));
          tmpObj.put(
              "uploaddate",
              AuthHandler.getDateFormatter(request).format(docs.getDocid().getUploadedon()));
          jarr.put(tmpObj);
        }
      }
      jobj.put("data", jarr);
      jobj.put("count", result.getRecordTotalCount());
      jobj1.put("data", jobj.toString());
      jobj1.put("valid", true);
    } catch (Exception e) {
      System.out.println(e.getMessage());
    }
    return new ModelAndView("jsonView", "model", jobj1.toString());
  }