public void testProps() {
   ObjectMapper m = new ObjectMapper();
   // should have default factory
   assertNotNull(m.getNodeFactory());
   JsonNodeFactory nf = JsonNodeFactory.instance;
   m.setNodeFactory(nf);
   assertNull(m.getInjectableValues());
   assertSame(nf, m.getNodeFactory());
 }
예제 #2
0
  @RequestMapping(value = "/getGRNFromOderId", method = RequestMethod.GET)
  public void getGRNFromOderId(
      HttpServletResponse httpservletResponse,
      @RequestParam String oderId,
      @RequestParam String status) {

    try {
      List<GrnVO> valueObj = grnManager.getGRNFromOderId(oderId, status);
      if (valueObj != null && valueObj.size() > 0) {
        ObjectMapper mapper = new ObjectMapper();
        ObjectNode objectNode = new ObjectNode(mapper.getNodeFactory());
        JsonObjectUtil<GrnVO> jsonUtil = new JsonObjectUtil<GrnVO>();
        String m = jsonUtil.getJsonObjectDataDetail(valueObj, 1);
        ArrayNode node = mapper.readValue(m, ArrayNode.class);
        objectNode.put("Data", node);
        objectNode.put("success", true);
        writeJson(httpservletResponse, objectNode, mapper);
      } else {
        writeJsonString(httpservletResponse, "{\"Data\":\"Empty\",\"success\":false}");
      }
    } catch (Exception e) {
      getLogger().error(e.getMessage());
      writeJsonString(
          httpservletResponse, "{\"Data\":\"" + e.getMessage() + "\",\"success\":false}");
    }
  }