List of usage examples for com.fasterxml.jackson.databind.node ObjectNode put
public ObjectNode put(String paramString1, String paramString2)
From source file:com.github.fge.jackson.JsonNumEqualsTest.java
@Test(dataProvider = "getInputs") public void numericEqualityWorksWithinObjects(final JsonNode reference, final JsonNode node) { final ObjectNode node1 = FACTORY.objectNode(); node1.put("foo", reference); final ObjectNode node2 = FACTORY.objectNode(); node2.put("foo", node); assertTrue(JsonNumEquals.getInstance().equivalent(node1, node2)); }
From source file:org.apache.taverna.scufl2.translator.t2flow.defaultdispatchstack.ParallelizeParser.java
@Override public Configuration parseConfiguration(T2FlowParser t2FlowParser, ConfigBean configBean, ParserState parserState) throws ReaderException { ParallelizeConfig parallelConfig = unmarshallConfig(t2FlowParser, configBean, "xstream", ParallelizeConfig.class); Configuration c = new Configuration(); c.setType(scufl2Uri.resolve("#Config")); BigInteger maxJobs = parallelConfig.getMaxJobs(); if (maxJobs != null && maxJobs.intValue() > 0 && maxJobs.intValue() != Defaults.maxJobs) { ObjectNode json = (ObjectNode) c.getJson(); json.put("maxJobs", maxJobs.intValue()); }//from w w w .j a v a2s.c o m return c; }
From source file:com.github.fge.jsonschema.processors.validation.ObjectSchemaDigester.java
@Override public JsonNode digest(final JsonNode schema) { final ObjectNode ret = FACTORY.objectNode(); ret.put("hasAdditional", schema.path("additionalProperties").isObject()); Set<String> set; ArrayNode node;//from w w w . ja va 2 s . c o m node = FACTORY.arrayNode(); ret.put("properties", node); set = Sets.newHashSet(schema.path("properties").fieldNames()); for (final String field : Ordering.natural().sortedCopy(set)) node.add(field); node = FACTORY.arrayNode(); ret.put("patternProperties", node); set = Sets.newHashSet(schema.path("patternProperties").fieldNames()); for (final String field : Ordering.natural().sortedCopy(set)) node.add(field); return ret; }
From source file:com.unboundid.scim2.extension.messages.consent.ScopeTest.java
/** * Tests serialization of Scope objects. * * @throws Exception if an error occurs. *///www . ja va2 s.c o m @Test public void testSerialization() throws Exception { String name = "testName"; String description = "testDescription"; String consent = Scope.CONSENT_GRANTED; ObjectNode objectNode = JsonUtils.getJsonNodeFactory().objectNode(); objectNode.put("name", name); objectNode.put("description", description); objectNode.put("consent", consent); Scope scope1 = JsonUtils.getObjectReader().forType(Scope.class).readValue(objectNode.toString()); Assert.assertEquals(name, scope1.getName()); Assert.assertEquals(description, scope1.getDescription()); Assert.assertEquals(consent, scope1.getConsent()); Scope scope2 = JsonUtils.getObjectReader().forType(Scope.class) .readValue(JsonUtils.getObjectWriter().writeValueAsString(scope1)); Assert.assertEquals(scope1, scope2); }
From source file:org.apache.taverna.activities.xpath.ui.servicedescription.XPathTemplateService.java
@Override public Configuration getActivityConfiguration() { Configuration configuration = new Configuration(); configuration.setType(ACTIVITY_TYPE.resolve("#Config")); ObjectNode json = (ObjectNode) configuration.getJson(); json.put("xpathExpression", "/"); return configuration; }
From source file:org.openlmis.fulfillment.util.CustomSortDeserializerTest.java
@Test public void shouldDeserializeArraySort() throws IOException { ObjectMapper mapper = new ObjectMapper(); ObjectNode order = mapper.createObjectNode(); order.put("direction", "DESC"); order.put("property", "startDate"); order.put("ignoreCase", false); order.put("nullHandling", "NATIVE"); order.put("ascending", false); order.put("descending", true); ArrayNode arrayNode = mapper.createArrayNode(); arrayNode.add(order);//from www .j av a 2s . co m ObjectNode testObject = mapper.createObjectNode(); testObject.set("sort", arrayNode); Sort sort = deserialize(testObject.toString()); assertEquals(Sort.Direction.DESC, sort.getOrderFor("startDate").getDirection()); }
From source file:org.lendingclub.mercator.aws.S3BucketScanner.java
private void scanBucket(Bucket b) { ObjectNode props = mapper.createObjectNode(); props.put("name", b.getName()); props.put("aws_arn", computeArn(props).orElse(null)); props.put("aws_account", getAccountId()); String cypher = "merge (b:AwsS3Bucket { aws_arn:{aws_arn} }) set b+={props}, b.updateTs=timestamp()"; getNeoRxClient().execCypher(cypher, "aws_arn", props.get("aws_arn"), "props", props).forEach(r -> { getShadowAttributeRemover().removeTagAttributes("AwsS3Bucket", props, r); });//from w w w. ja v a 2s . c o m incrementEntityCount(); cypher = "match (a:AwsAccount {aws_account:{account}}), (b:AwsS3Bucket {aws_account:{account}}) MERGE (a)-[r:OWNS]->(b) set r.updateTs=timestamp()"; getNeoRxClient().execCypher(cypher, "account", getAccountId()); }
From source file:com.enitalk.controllers.youtube.BotAware.java
public void makeButton(ArrayNode a, String name, String data) { ObjectNode o = a.addObject(); o.put("name", name); o.put("data", data); }
From source file:com.enitalk.controllers.youtube.BotAware.java
public void makeButtonHref(ArrayNode a, String name, String href) { ObjectNode o = a.addObject(); o.put("name", name); o.put("href", href); }
From source file:com.appranix.adapter.service.AdapterServiceImpl.java
@Override public int adapterCreate() throws Exception { try {/* w ww . j av a 2 s.c o m*/ ObjectMapper mapper = new ObjectMapper(); ObjectNode node = mapper.createObjectNode(); node.put("nsPath", "/"); node.put("ciClassName", "Component"); node.put("ciName", "test"); final String uri = "http://localhost:9090/adapter/rest/cm/simple/cis"; RestTemplate restTemplate = new RestTemplate(); ResponseEntity<String> result = restTemplate.postForEntity(uri, node, String.class); Map<String, Integer> map = mapper.readValue(result.getBody(), Map.class); Integer id = map.get("ciId"); return id; } catch (Exception e) { throw new Exception("Error in Write Operation"); } }