@Transactional(readOnly = true)
 public SorPerson findByPersonIdAndSorIdentifier(
     final Long personId, final String sorSourceIdentifier) {
   try {
     return this.personRepository.findByPersonIdAndSorIdentifier(personId, sorSourceIdentifier);
   } catch (final Exception e) {
     logger.debug(e.getMessage(), e);
     return null;
   }
 }
Ejemplo n.º 2
0
 protected void writeResponse(
     final HttpServletResponse httpServletResponse,
     final SimpleStatusResponse simpleStatusResponse) {
   Gson gson = new Gson();
   try {
     httpServletResponse.setContentType("application/json; charset=utf-8");
     _log.debug("Serializing: " + simpleStatusResponse);
     final PrintWriter writer = httpServletResponse.getWriter();
     gson.toJson(simpleStatusResponse.getResponseStatus(), writer);
     writer.flush();
     writer.close();
   } catch (Exception e) {
     _log.error("Error while writing response: " + e.getMessage(), e);
   }
 }
Ejemplo n.º 3
0
 protected void writeResponseGenericWithDate(
     final HttpServletResponse httpServletResponse,
     final Date lastModified,
     final int expirationTime,
     final Object object) {
   Gson gson = new Gson();
   try {
     httpServletResponse.setContentType("application/json; charset=utf-8");
     if (lastModified != null) {
       httpServletResponse.addHeader("Expires", createDateHeader(expirationTime));
       httpServletResponse.addHeader("Last-Modified", toHttpDate(lastModified));
     }
     _log.debug("Serializing: " + object);
     final PrintWriter writer = httpServletResponse.getWriter();
     gson.toJson(object, writer);
     writer.flush();
     writer.close();
   } catch (Exception e) {
     _log.error("Error while writing response: " + e.getMessage(), e);
   }
 }
  /**
   * Handler
   *
   * @param
   * @return
   */
  @RequestMapping(value = "/AssetDtlsMon", method = RequestMethod.GET)
  public ModelAndView getAsseDetails(HttpServletRequest request, HttpServletResponse response) {
    String oper = request.getParameter("oper");
    logger.info(" In getAssetDetails. Oper=" + oper);

    String url = request.getHeader("host");
    String[] urlarr = url.split(":");
    List<RoleDsp> rle = mastersservice.getLogUserRole();
    is_sslport = rle.get(0).getNwcportsecure() + "";
    is_port = rle.get(0).getNwcport() + "";
    if (request.isSecure()) {
      is_url = "https://" + urlarr[0] + ":" + is_sslport;
    } else {
      is_url = "http://" + urlarr[0] + ":" + is_port;
    }
    Map<String, Object> myModel = new HashMap<String, Object>();
    myModel.put("is_url", is_url);
    myModel.put("precision", precision);
    if (oper.contains("mon")) {
      String frm = request.getParameter("frm");
      if (frm == null || frm == "") {
        frm = "main";
      }
      String parid_s = request.getParameter("parid");
      logger.info(" In getAssetDetails. oper=mon. ParentId=" + parid_s);
      int parid = Integer.valueOf(parid_s);

      MeterDsp mtr = metertagmngr.getSecMeterList(parid).get(0);
      // MeterDsp mtr = metertagmngr.getAssetMeterList(parid, "asset").get(0);
      myModel.put("assetdtls", mtr);
      myModel.put("secid", parid_s);
      myModel.put("displaytype", "monitordtls");
      myModel.put("frm", frm);
      ModelAndView model = new ModelAndView("assetmtrdtls", "model", myModel);
      return model;
    } else if (oper.contains("trend")) {
      ObjectMapper mapper = new ObjectMapper();
      String stagid = request.getParameter("tagid");
      String chartno = request.getParameter("chartno");
      String pright = request.getParameter("pright");
      String pbottom = request.getParameter("pbottom");
      String mname = request.getParameter("mname");
      String prevnames = request.getParameter("prevnames");
      logger.info(" In getAssetDetails. chartno=" + chartno);

      logger.info("Oper = trend, tagid=" + request.getParameter("tagid"));
      myModel.put("tagid", request.getParameter("tagid"));
      myModel.put("typ", "log");
      myModel.put("chartno", chartno);
      myModel.put("pright", pright);
      myModel.put("pbottom", pbottom);
      myModel.put("mname", mname);
      myModel.put("prevnames", prevnames);
      String[] strarr = metertagmngr.getTagTrend(Integer.parseInt(stagid));
      //			logger.info("strarr "+strarr.length);

      String json = "";
      try {
        json = mapper.writeValueAsString(strarr);
      } catch (Exception e) {
        e.printStackTrace();
      }

      myModel.put("meterlog", json);
      return new ModelAndView("chart", "model", myModel);
    } else {
      logger.info(
          "**ERROR condition. AssetDtlsMon called with undefined operation string :" + oper);
      return null;
    }
  }