public static String getAllLog(
     Connection conn,
     HttpServletRequest request,
     String companyid,
     String limit,
     String offset,
     String searchString,
     String dateString)
     throws ServiceException {
   ResultSet rs1 = null;
   String returnStr = "";
   String[] searchStrObj = new String[] {"params", "actiontext"};
   String myLikeString = StringUtil.getMySearchString(searchString, "and", searchStrObj);
   PreparedStatement pstmt = null;
   JSONObject resobj = new JSONObject();
   JSONObject tempobj = new JSONObject();
   JSONArray jarr = new JSONArray();
   try {
     int count1 = 0;
     pstmt =
         conn.prepareStatement(
             "select count(*) AS count from actionlog al inner join actions a on al.actionid = a.actionid where companyid = ?"
                 + myLikeString
                 + dateString);
     pstmt.setString(1, companyid);
     StringUtil.insertParamSearchString(2, pstmt, searchString, searchStrObj.length);
     rs1 = pstmt.executeQuery();
     if (rs1.next()) {
       count1 = rs1.getInt("count");
     }
     String query1 =
         "select logid, al.actionid, actionby, projectid, params, timestamp from actionlog al inner join actions a on al.actionid = a.actionid where companyid = ?"
             + myLikeString
             + dateString
             + " order by timestamp DESC limit ? offset ?";
     pstmt = conn.prepareStatement(query1);
     pstmt.setString(1, companyid);
     int cnt = StringUtil.insertParamSearchString(2, pstmt, searchString, searchStrObj.length);
     pstmt.setInt(cnt++, Integer.parseInt(limit));
     pstmt.setInt(cnt++, Integer.parseInt(offset));
     rs1 = pstmt.executeQuery();
     while (rs1.next()) {
       tempobj = getJsonForAction(conn, pstmt, rs1, request, "all");
       jarr.put(tempobj);
     }
     resobj.put("data", jarr);
     resobj.put("count", count1);
     returnStr = resobj.toString();
   } catch (ServiceException ex) {
     throw ServiceException.FAILURE("AuditTrail.getAllLog", ex);
   } catch (SQLException ex) {
     throw ServiceException.FAILURE("AuditTrail.getAllLog", ex);
   } finally {
     return returnStr;
   }
 }
 public static JSONObject getJsonForAction(
     Connection conn,
     PreparedStatement pstmt,
     ResultSet rs,
     HttpServletRequest request,
     String callerFlag)
     throws ServiceException {
   java.text.SimpleDateFormat sdf1 = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
   JSONObject jobj = new JSONObject();
   ResultSet rs2 = null;
   try {
     int aid = rs.getInt("actionid");
     String author = AuthHandler.getAuthor(conn, rs.getString("actionby"));
     String params = rs.getString("params");
     String userparam[] = params.split(",");
     String query2 = "select textkey from actions where actionid = ?";
     pstmt = conn.prepareStatement(query2);
     pstmt.setInt(1, aid);
     rs2 = pstmt.executeQuery();
     Object[] strParam = new Object[userparam.length];
     for (int i = 0; i < userparam.length; i++) {
       strParam[i] = userparam[i];
     }
     rs2.next();
     String action = rs2.getString("textkey");
     String useraction = MessageSourceProxy.getMessage(action, strParam, request);
     String sdtStr =
         Timezone.toCompanyTimezone(
             conn, rs.getTimestamp("timestamp").toString(), AuthHandler.getCompanyid(request));
     jobj.put("logid", rs.getInt("logid"));
     jobj.put("actionby", author);
     jobj.put("description", useraction);
     if (callerFlag.equals("all") || callerFlag.equals("projname")) {
       String projectname = "";
       String projid = rs.getString("projectid");
       if (!StringUtil.isNullOrEmpty(projid)) {
         projectname = projdb.getProjectName(conn, projid);
       }
       jobj.put("projname", projectname);
     }
     jobj.put("timestamp", sdtStr);
   } catch (ServiceException ex) {
     Logger.getLogger(AuditTrail.class.getName()).log(Level.SEVERE, null, ex);
   } catch (JSONException ex) {
     throw ServiceException.FAILURE("AuditTrail.getJsonForAction", ex);
   } catch (Exception ex) {
     throw ServiceException.FAILURE("AuditTrail.getJsonForAction", ex);
   } finally {
     return jobj;
   }
 }
  public static JSONArray getProductTypesJson(HttpServletRequest request, List list)
      throws ServiceException, SessionExpiredException {
    JSONArray jArr = new JSONArray();
    try {
      Iterator itr = list.iterator();
      while (itr.hasNext()) {
        Producttype ptype = (Producttype) itr.next();
        JSONObject obj = new JSONObject();
        obj.put("id", ptype.getID());
        obj.put("name", ptype.getName());
        jArr.put(obj);
      }

    } catch (JSONException ex) {
      throw ServiceException.FAILURE("getProductTypesJson : " + ex.getMessage(), ex);
    }
    return jArr;
  }
  /**
   * this function will return a jsonstring given a resultset in a format that is required for
   * WTF.Grid just use this inside the ur jsp file and set the url for the grid datastore as that
   * jsp file
   */
  public JSONObject GetJsonForGrid(SqlRowSet rs) {
    JSONObject jb = null;
    try {
      SqlRowSetMetaData rsmd = rs.getMetaData();
      JSONArray jArr = new JSONArray();
      while (rs.next()) {
        JSONObject jobj = new JSONObject();
        for (int i = 1; i <= rsmd.getColumnCount(); i++) {
          if (rs.getObject(i) != null) jobj.put(rsmd.getColumnName(i), rs.getObject(i));
          else jobj.put(rsmd.getColumnName(i), "");
        }
        jArr.put(jobj);
      }
      if (jArr.length() > 0) jb = new JSONObject().put("data", jArr);
    } catch (Exception ex) {
      System.out.println("exception -->" + ex);
    }

    return jb;
  }
  public ModelAndView downloadDocuments(HttpServletRequest request, HttpServletResponse response)
      throws ServletException {
    JSONObject jobj = new JSONObject();
    JSONObject myjobj = new JSONObject();
    KwlReturnObject kmsg = null;
    String details = "";
    String auditAction = "";
    try {
      String url = request.getParameter("url");
      url = StringUtil.checkForNull(url);
      String applicant = request.getParameter("applicant");
      applicant = StringUtil.checkForNull(applicant);
      Hashtable ht;
      if (applicant.equalsIgnoreCase("applicant")) {
        kmsg = hrmsExtApplDocsDAOObj.downloadDocument(url);
        ht = getExtDocumentDownloadHash(kmsg.getEntityList());
      } else {
        kmsg = documentDAOObj.downloadDocument(url);
        ht = getDocumentDownloadHash(kmsg.getEntityList());
      }

      String src = storageHandlerImplObj.GetDocStorePath();
      //            String src = "/home/trainee/";
      if (request.getParameter("mailattch") != null) {
        src = src + ht.get("svnname");
      } else {
        src = src + ht.get("userid").toString() + "/" + ht.get("svnname");
      }

      File fp = new File(src);
      byte[] buff = new byte[(int) fp.length()];
      FileInputStream fis = new FileInputStream(fp);
      int read = fis.read(buff);
      javax.activation.FileTypeMap mmap = new javax.activation.MimetypesFileTypeMap();
      response.setContentType(mmap.getContentType(src));
      response.setContentLength((int) fp.length());
      response.setHeader(
          "Content-Disposition",
          request.getParameter("dtype") + "; filename=\"" + ht.get("Name") + "\";");
      response.getOutputStream().write(buff);
      response.getOutputStream().flush();
      response.getOutputStream().close();
      String map = ht.get("relatedto").toString();
      String refid = ht.get("recid").toString();

      myjobj.put("success", true);
    } catch (Exception e) {
      System.out.println(e.getMessage());
    }
    return new ModelAndView("jsonView", "model", myjobj.toString());
  }
  public ModelAndView deleteDocuments(HttpServletRequest request, HttpServletResponse response) {
    KwlReturnObject result;
    JSONObject jobj = new JSONObject();
    JSONObject jobj1 = new JSONObject();

    // Create transaction
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setName("JE_Tx");
    def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    def.setIsolationLevel(TransactionDefinition.ISOLATION_READ_UNCOMMITTED);
    TransactionStatus status = txnManager.getTransaction(def);

    try {
      HashMap<String, Object> requestParams = new HashMap<String, Object>();
      requestParams.put("ids", request.getParameterValues("ids"));
      String applicant = request.getParameter("applicant");
      applicant = StringUtil.checkForNull(applicant);
      if (applicant.equalsIgnoreCase("applicant")) {
        result = hrmsExtApplDocsDAOObj.deleteDocuments(requestParams);
      } else {
        result = documentDAOObj.deleteDocuments(requestParams);
      }
      if (result.isSuccessFlag()) {
        jobj.put("success", true);
      } else {
        jobj.put("success", false);
      }
      jobj1.put("data", jobj.toString());
      jobj1.put("valid", true);
      txnManager.commit(status);
    } catch (Exception e) {
      System.out.println(e.getMessage());
      txnManager.rollback(status);
    } finally {
      return new ModelAndView("jsonView", "model", jobj1.toString());
    }
  }
예제 #7
0
  @Override
  public KwlReturnObject saveAccountProject(JSONObject jobj1) throws ServiceException {
    JSONObject jobj = new JSONObject();
    List ll = new ArrayList();
    try {
      String companyid = jobj1.getString("companyid");
      String userid = jobj1.getString("userid");
      String projectName = jobj1.getString("projectName");
      String accId = jobj1.getString("accId");
      jobj.put("projectname", projectName);
      jobj.put("companyid", companyid);
      jobj.put("userid", userid);
      jobj.put("remoteapikey", ConfigReader.getinstance().get("remoteapikey"));

      jobj = apiCallHandlerService.callApp(jobj1.getString("appURL"), jobj, companyid, "12", true);
      if (jobj.has("success") && jobj.getBoolean("success")) {
        jobj = jobj.getJSONObject("data");
        String projectId = jobj.getString("projectid");
        String nickName = jobj.getString("nickname");

        AccountProject ap = new AccountProject();

        if (!StringUtil.isNullOrEmpty(accId)) {
          ap.setAccountId((CrmAccount) get(CrmAccount.class, accId));
        }
        if (!StringUtil.isNullOrEmpty(nickName)) {
          ap.setNickName(nickName);
        }
        if (!StringUtil.isNullOrEmpty(projectId)) {
          ap.setProjectId(projectId);
        }
        if (!StringUtil.isNullOrEmpty(projectName)) {
          ap.setProjectName(projectName);
        }

        save(ap);
        jobj = new JSONObject();
        jobj.put("projectid", ap.getProjectId());
      } else {
        String errorCode = jobj.getString("errorcode");
        jobj = new JSONObject();
        jobj.put("errorcode", errorCode);
      }
      ll.add(jobj);
    } catch (JSONException e) {
      logger.warn(e.getMessage(), e);
      throw ServiceException.FAILURE("crmAccountDAOImpl.saveAccountProject : " + e.getMessage(), e);
    } catch (HibernateException e) {
      logger.warn(e.getMessage(), e);
      throw ServiceException.FAILURE("crmAccountDAOImpl.saveAccountProject : " + e.getMessage(), e);
    } catch (Exception e) {
      logger.warn(e.getMessage(), e);
      throw ServiceException.FAILURE("crmAccountDAOImpl.saveAccountProject : " + e.getMessage(), e);
    }
    return new KwlReturnObject(true, KWLErrorMsgs.S01, "", ll, 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());
  }
  public ModelAndView addDocuments(HttpServletRequest request, HttpServletResponse response)
      throws ServletException {
    JSONObject jobj = new JSONObject();
    JSONObject myjobj = new JSONObject();
    List fileItems = null;
    KwlReturnObject kmsg = null;
    String auditAction = "";
    boolean applicant = false;
    String id = java.util.UUID.randomUUID().toString();
    PrintWriter out = null;
    // Create transaction
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setName("JE_Tx");
    def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    def.setIsolationLevel(TransactionDefinition.ISOLATION_READ_UNCOMMITTED);
    TransactionStatus status = txnManager.getTransaction(def);
    try {
      response.setContentType("text/html;charset=UTF-8");
      out = response.getWriter();
      String userid = sessionHandlerImplObj.getUserid(request);
      String map = request.getParameter("mapid");
      HashMap<String, String> arrParam = new HashMap<String, String>();
      boolean fileUpload = false;
      String docdesc;
      ArrayList<FileItem> fi = new ArrayList<FileItem>();
      if (request.getParameter("fileAdd") != null) {
        DiskFileUpload fu = new DiskFileUpload();
        fileItems = fu.parseRequest(request);
        documentDAOObj.parseRequest(fileItems, arrParam, fi, fileUpload);
        arrParam.put("IsIE", request.getParameter("IsIE"));
        if (arrParam.get("applicantid").equalsIgnoreCase("applicant")) {
          applicant = true;
          userid = arrParam.get("refid");
        }
        if (StringUtil.isNullOrEmpty((String) arrParam.get("docdesc")) == false) {
          docdesc = (String) arrParam.get("docdesc");
        }
      }
      for (int cnt = 0; cnt < fi.size(); cnt++) {
        String docID;
        if (applicant) {
          kmsg =
              hrmsExtApplDocsDAOObj.uploadFile(
                  fi.get(cnt),
                  userid,
                  arrParam,
                  profileHandlerDAOObj.getUserFullName(sessionHandlerImplObj.getUserid(request)));
          HrmsDocs doc = (HrmsDocs) kmsg.getEntityList().get(0);
          docID = doc.getDocid();
        } else {
          kmsg = documentDAOObj.uploadFile(fi.get(cnt), userid, arrParam);
          Docs doc = (Docs) kmsg.getEntityList().get(0);
          docID = doc.getDocid();
        }

        String companyID = sessionHandlerImplObj.getCompanyid(request);
        String userID = sessionHandlerImplObj.getUserid(request);
        String refid = arrParam.get("refid");
        jobj.put("userid", userID);
        jobj.put("docid", docID);
        jobj.put("companyid", companyID);
        jobj.put("id", id);
        jobj.put("map", map);
        jobj.put("refid", refid);
        if (arrParam.get("applicantid").equalsIgnoreCase("applicant")) {
          hrmsExtApplDocsDAOObj.saveDocumentMapping(jobj);
        } else {
          documentDAOObj.saveDocumentMapping(jobj);
        }
      }
      myjobj.put("ID", id);
      txnManager.commit(status);
    } catch (Exception e) {
      System.out.println(e.getMessage());
      txnManager.rollback(status);
    } finally {
      out.close();
    }
    return new ModelAndView("jsonView", "model", myjobj.toString());
  }
예제 #10
0
 public static JSONArray getProductsJson(HttpServletRequest request, List list)
     throws JSONException, ServiceException {
   Iterator itr = list.iterator();
   JSONArray jArr = new JSONArray();
   Producttype producttype = new Producttype();
   String productid = request.getParameter("productid");
   Boolean nonSaleInventory = Boolean.parseBoolean((String) request.getParameter("loadInventory"));
   while (itr.hasNext()) {
     Object[] row = (Object[]) itr.next();
     Product product = (Product) row[0];
     Product parentProduct = product.getParent();
     if (product.getID().equals(productid)) continue;
     ProductCyclecount pcObject = (ProductCyclecount) row[8];
     JSONObject obj = new JSONObject();
     obj.put("productid", product.getID());
     obj.put("productname", product.getName());
     obj.put("desc", product.getDescription());
     UnitOfMeasure uom = product.getUnitOfMeasure();
     obj.put("uomid", uom == null ? "" : uom.getID());
     obj.put("uomname", uom == null ? "" : uom.getName());
     obj.put("precision", uom == null ? 0 : (Integer) uom.getAllowedPrecision());
     obj.put("leadtime", product.getLeadTimeInDays());
     obj.put("syncable", product.isSyncable());
     obj.put("reorderlevel", product.getReorderLevel());
     obj.put("reorderquantity", product.getReorderQuantity());
     obj.put(
         "purchaseaccountid",
         (product.getPurchaseAccount() != null ? product.getPurchaseAccount().getID() : ""));
     obj.put(
         "salesaccountid",
         (product.getSalesAccount() != null ? product.getSalesAccount().getID() : ""));
     obj.put(
         "purchaseretaccountid",
         (product.getPurchaseReturnAccount() != null
             ? product.getPurchaseReturnAccount().getID()
             : ""));
     obj.put(
         "salesretaccountid",
         (product.getSalesReturnAccount() != null ? product.getSalesReturnAccount().getID() : ""));
     obj.put("vendor", (product.getVendor() != null ? product.getVendor().getID() : ""));
     obj.put("vendornameid", (product.getVendor() != null ? product.getVendor().getName() : ""));
     obj.put(
         "producttype",
         (product.getProducttype() != null ? product.getProducttype().getID() : ""));
     obj.put(
         "vendorphoneno",
         (product.getVendor() != null ? product.getVendor().getContactNumber() : ""));
     obj.put("vendoremail", (product.getVendor() != null ? product.getVendor().getEmail() : ""));
     obj.put("type", (product.getProducttype() != null ? product.getProducttype().getName() : ""));
     obj.put("pid", product.getProductid());
     obj.put("parentuuid", parentProduct == null ? "" : parentProduct.getID());
     obj.put("parentid", parentProduct == null ? "" : parentProduct.getProductid());
     obj.put("parentname", parentProduct == null ? "" : parentProduct.getName());
     obj.put("level", row[1]);
     obj.put("leaf", row[2]);
     obj.put("purchaseprice", row[3]);
     obj.put("saleprice", row[4]);
     obj.put("quantity", (row[5] == null ? 0 : row[5]));
     obj.put("initialquantity", (row[6] == null ? 0 : row[6]));
     obj.put("initialprice", (row[7] == null ? 0 : row[7]));
     obj.put("salespricedatewise", (row[9] == null ? 0 : row[9]));
     obj.put("purchasepricedatewise", (row[10] == null ? 0 : row[10]));
     obj.put("initialsalesprice", (row[11] == null ? 0 : row[11]));
     obj.put("ccountinterval", pcObject != null ? pcObject.getCountInterval() : "");
     obj.put("ccounttolerance", pcObject != null ? pcObject.getTolerance() : "");
     SimpleDateFormat sdf = new SimpleDateFormat("MMMM d, yyyy hh:mm:ss aa");
     //  obj.put("createdon", (row[12]==null?"":sdf.format(row[12])));
     //            jArr.put(obj);
     if (nonSaleInventory && obj.get("producttype").equals(producttype.Inventory_Non_Sales)) {
       // Do Nothing
     } else {
       jArr.put(obj);
     }
   }
   return jArr;
 }
 public static String getActionLog(Connection conn, HttpServletRequest request)
     throws ServiceException {
   ResultSet rs = null;
   String returnStr = "";
   PreparedStatement pstmt = null;
   String searchString = request.getParameter("ss");
   String limit = request.getParameter("limit");
   String offset = request.getParameter("start");
   JSONObject resobj = new JSONObject();
   JSONObject tempobj = new JSONObject();
   JSONArray jarr = new JSONArray();
   String likeClause = "";
   try {
     String companyid = AuthHandler.getCompanyid(request);
     String loginid = AuthHandler.getUserid(request);
     String[] searchStrObj = new String[] {"params", "actiontext"};
     String myLikeString = StringUtil.getMySearchString(searchString, "and", searchStrObj);
     String flag = "";
     int count1 = 0;
     String type = request.getParameter("type");
     String dateSting = getDateString(conn, request, loginid);
     if (StringUtil.isNullOrEmpty(type)) {
       flag = "no";
       returnStr = getAllLog(conn, request, companyid, limit, offset, searchString, dateSting);
     } else {
       switch (Integer.parseInt(type)) {
         case 0:
           flag = "projname";
           returnStr =
               getLog(conn, request, companyid, limit, offset, searchString, dateSting, flag);
           flag = "no";
           break;
         case 1:
           String admintype = request.getParameter("admintype");
           if (admintype.equals("0")) {
             likeClause = "and al.actionid like '31%' ";
           } else if (admintype.equals("1")) {
             likeClause = "and al.actionid like '32%' ";
           } else {
             likeClause = "and al.actionid like '33%' or al.actionid like '40%' ";
           }
           flag = "admin";
           break;
         case 2:
           flag = "doc";
           likeClause = "and al.actionid like '21%' ";
           break;
         case 3:
           flag = "all";
           likeClause = "and projectid != '' ";
           break;
         case 4:
           flag = "admin";
           likeClause =
               "and (al.actionid like '31%' or al.actionid like '32?' or al.actionid like '33?' or al.actionid like '40%')";
           break;
         case 5:
           flag = "all";
           likeClause = "and (al.actionid like '41%')";
           break;
       }
     }
     if (!flag.equals("no")) {
       count1 =
           getCountQuery(
               conn,
               pstmt,
               companyid,
               likeClause,
               myLikeString,
               searchStrObj,
               searchString,
               dateSting);
       String query =
           "select logid, al.actionid, actionby, params, timestamp, projectid from actionlog al inner join actions a on al.actionid = a.actionid where companyid = ? "
               + likeClause
               + myLikeString
               + dateSting
               + " order by timestamp DESC limit ? offset ?";
       pstmt = conn.prepareStatement(query);
       pstmt.setString(1, companyid);
       int cnt = StringUtil.insertParamSearchString(2, pstmt, searchString, searchStrObj.length);
       pstmt.setInt(cnt++, Integer.parseInt(limit));
       pstmt.setInt(cnt++, Integer.parseInt(offset));
       rs = pstmt.executeQuery();
       while (rs.next()) {
         tempobj = getJsonForAction(conn, pstmt, rs, request, flag);
         jarr.put(tempobj);
       }
       resobj.put("data", jarr);
       resobj.append("count", count1);
       returnStr = resobj.toString();
     }
   } catch (ServiceException ex) {
     Logger.getLogger(AuditTrail.class.getName()).log(Level.SEVERE, null, ex);
   } catch (Exception ex) {
     throw ServiceException.FAILURE("AuditTrail.getActionLog :" + ex.getMessage(), ex);
   } finally {
     return returnStr;
   }
 }