Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.ObjectMapper.createObjectNode()


    private static final Logger LOG = LoggerFactory.getLogger(Ping.class);

    public static void ping(AsyncHttpClient client, URI server, URI ourUri, String radioId) throws IOException, ExecutionException, InterruptedException {
        ObjectMapper mapper = new ObjectMapper();

        ObjectNode rootNode = mapper.createObjectNode();
        rootNode.put("rest_transport_address", ourUri.toString());

        final UriBuilder uriBuilder = UriBuilder.fromUri(server);
        uriBuilder.path("/system/radios/" + radioId + "/ping");
View Full Code Here


    }

    private JsonNode getProcessDefinitionResponse(
            ProcessDefinitionEntity processDefinition) {
        ObjectMapper mapper = new ObjectMapper();
        ObjectNode pdrJSON = mapper.createObjectNode();
        pdrJSON.put("id", processDefinition.getId());
        pdrJSON.put("name", processDefinition.getName());
        pdrJSON.put("key", processDefinition.getKey());
        pdrJSON.put("version", processDefinition.getVersion());
        pdrJSON.put("deploymentId", processDefinition.getDeploymentId());
View Full Code Here

        public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
                                            Authentication authentication) throws ServletException, IOException {
            try {
                String token = headerUtil.createAuthToken(((User) authentication.getPrincipal()).getUsername());
                ObjectMapper mapper = new ObjectMapper();
                ObjectNode node = mapper.createObjectNode().put("token", token);
                PrintWriter out = response.getWriter();
                out.print(node.toString());
                out.flush();
                out.close();
            } catch (GeneralSecurityException e) {
View Full Code Here

    public void canRunCodeTransactionally(){
        running(fakeApplication(),()->{
            try {
                ObjectMapper mapper = Json.mapper();
                String operation = "normal";
                ObjectNode node =mapper.createObjectNode();
                node.put("collection",TEST_COLLECTION);
                node.put("op",operation);

                FakeRequest req = new FakeRequest(POST,"/plugin/"+TEST_TRANSACT);
View Full Code Here

  static ObjectNode getDashboardForElasticsearch(String dashboardPath) throws IOException {
    final ObjectMapper mapper = JsonUtils.getMapper();
    final InputStream dashboardStram = RestClient.class.getClassLoader().getResourceAsStream(dashboardPath);
    final ObjectNode dashboard = (ObjectNode) mapper.readTree(dashboardStram);
    dashboard.put(TITLE, dashboard.get(TITLE).asText() + STAGEMONITOR_MAJOR_MINOR_VERSION);
    ObjectNode dashboardElasticsearchFormat = mapper.createObjectNode();
    dashboardElasticsearchFormat.put("user", "guest");
    dashboardElasticsearchFormat.put("group", "guest");
    dashboardElasticsearchFormat.set(TITLE, dashboard.get(TITLE));
    dashboardElasticsearchFormat.set("tags", dashboard.get("tags"));
    dashboardElasticsearchFormat.put("dashboard", dashboard.toString());
View Full Code Here

   *
   * @return a JSON representation of this filter
   */
  public ObjectNode toJson() {
    ObjectMapper mapper = new ObjectMapper();
    ObjectNode node = mapper.createObjectNode();
    ObjectNode attributeNode = mapper.createObjectNode();

    node.put(attribute.getCode(), attributeNode);
    attributeNode.put("op", operation.getOp());

View Full Code Here

   * @return a JSON representation of this filter
   */
  public ObjectNode toJson() {
    ObjectMapper mapper = new ObjectMapper();
    ObjectNode node = mapper.createObjectNode();
    ObjectNode attributeNode = mapper.createObjectNode();

    node.put(attribute.getCode(), attributeNode);
    attributeNode.put("op", operation.getOp());

    return node;
View Full Code Here

    @Test
    public void valueCanBeSerializedAndDeserialized() throws NoSuchMethodException, IOException, IntrospectionException, IllegalAccessException, InvocationTargetException {

        ObjectMapper objectMapper = new ObjectMapper();

        ObjectNode node = objectMapper.createObjectNode();
        node.put(propertyName, jsonValue.toString());

        Object pojo = objectMapper.treeToValue(node, classWithFormattedProperties);

        Method getter = new PropertyDescriptor(propertyName, classWithFormattedProperties).getReadMethod();
View Full Code Here

        JCodeModel codeModel = new JCodeModel();
        JPackage jpackage = codeModel._package(getClass().getPackage().getName());

        ObjectMapper mapper = new ObjectMapper();

        ObjectNode itemsNode = mapper.createObjectNode();
        itemsNode.put("type", "integer");

        ObjectNode propertyNode = mapper.createObjectNode();
        propertyNode.put("uniqueItems", true);
        propertyNode.put("items", itemsNode);
View Full Code Here

        ObjectMapper mapper = new ObjectMapper();

        ObjectNode itemsNode = mapper.createObjectNode();
        itemsNode.put("type", "integer");

        ObjectNode propertyNode = mapper.createObjectNode();
        propertyNode.put("uniqueItems", true);
        propertyNode.put("items", itemsNode);

        JClass propertyType = rule.apply("fooBars", propertyNode, jpackage, mock(Schema.class));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.