List of usage examples for com.fasterxml.jackson.databind.node ArrayNode add
public ArrayNode add(JsonNode paramJsonNode)
From source file:org.unl.cse.netgroup.rest.OpenSecWebResource.java
/** * Gets the current available networks./* w w w.j a v a 2 s . com*/ * * @return 200 OK with available networks inforamtion. */ @GET @Produces(MediaType.APPLICATION_JSON) @Path("topology/networks") public Response getNetworks() { ObjectNode mapper = mapper().createObjectNode(); ArrayNode node = mapper.putArray("Networks Available"); Set<String> networks = get(NetworkService.class).getNetworks(); for (String network : networks) { node.add(network); } return ok(mapper).build(); }
From source file:org.waarp.openr66.protocol.http.rest.handler.HttpRestServerR66Handler.java
protected ArrayNode getDetailedAllow() { ArrayNode node = JsonHandler.createArrayNode(); if (this.methods.contains(METHOD.PUT)) { ShutdownOrBlockJsonPacket node3 = new ShutdownOrBlockJsonPacket(); node3.setComment("Shutdown Or Block request (PUT)"); node3.setKey("Key".getBytes()); ObjectNode node2;//from w w w . ja va 2 s .c o m ArrayNode node1 = JsonHandler.createArrayNode(); try { node1.add(node3.createObjectNode()); node2 = RestArgument.fillDetailedAllow(METHOD.PUT, this.path, ACTIONS_TYPE.ShutdownOrBlock.name(), node3.createObjectNode(), node1); node.add(node2); } catch (OpenR66ProtocolPacketException e1) { } } if (this.methods.contains(METHOD.GET)) { ArrayNode node1 = JsonHandler.createArrayNode(); node1.add(Configuration.configuration.monitoring.exportAsJson(true)); ObjectNode node2 = RestArgument.fillDetailedAllow(METHOD.GET, this.path, ACTIONS_TYPE.GetStatus.name(), null, node1); node.add(node2); } ObjectNode node2 = RestArgument.fillDetailedAllow(METHOD.OPTIONS, this.path, COMMAND_TYPE.OPTIONS.name(), null, null); node.add(node2); return node; }
From source file:com.redhat.lightblue.DataError.java
/** * converts this object to json representation */// w ww . ja v a 2 s . co m @Override public JsonNode toJson() { ObjectNode node = getFactory().objectNode(); if (entityData != null) { node.set("data", entityData); } if (errors != null && !errors.isEmpty()) { ArrayNode arr = getFactory().arrayNode(); node.set("errors", arr); for (Error x : errors) { arr.add(x.toJson()); } } return node; }
From source file:managers.nodes.OutputStringManager.java
protected JsonNode toJSON(JsonNode properties) { ArrayNode tokens = JsonNodeFactory.instance.arrayNode(); String content = properties.get("content").asText(); String[] contentTokens = content.split(" "); for (String token : contentTokens) { tokens.add(token); }//from www .j a v a 2 s. c om ((ObjectNode) properties).put("tokens", tokens); return properties; }
From source file:com.baifendian.swordfish.execserver.job.impexp.Args.PostgreWriterArg.java
public PostgreWriterArg(PostgreWriter postgreWriter) { ObjectNode connObject = JsonUtil.createObjectNode(); List<String> tableList = Arrays.asList(postgreWriter.getTable()); if (CollectionUtils.isNotEmpty(tableList)) { ArrayNode tableJsonList = connObject.putArray("table"); for (String table : tableList) { tableJsonList.add(table); }//from w w w . j a v a 2 s .com } preSql = CommonUtil.sqlSplit(postgreWriter.getPreSql()); postSql = CommonUtil.sqlSplit(postgreWriter.getPostSql()); column = postgreWriter.getColumn(); session = postgreWriter.getSession(); batchSize = postgreWriter.getBatchSize(); writeMode = postgreWriter.getWriteMode(); connection.add(connObject); }
From source file:com.unboundid.scim2.common.messages.PatchOperation.java
/** * Create a new add patch operation./*from w ww .j av a2 s . co m*/ * * @param path The path targeted by this patch operation. The path * must not be {@code null}. * @param values The values to add. * * @return The new add patch operation. */ public static PatchOperation addURIValues(final Path path, final List<URI> values) { ArrayNode arrayNode = JsonUtils.getJsonNodeFactory().arrayNode(); for (URI value : values) { arrayNode.add(value.toString()); } return add(path, arrayNode); }
From source file:com.unboundid.scim2.common.messages.PatchOperation.java
/** * Create a new add patch operation./* w w w . j a va 2 s . c o m*/ * * @param path The path targeted by this patch operation. The path * must not be {@code null}. * @param values The values to add. * * @return The new add patch operation. */ public static PatchOperation addLongValues(final Path path, final List<Long> values) { ArrayNode arrayNode = JsonUtils.getJsonNodeFactory().arrayNode(); for (Long value : values) { arrayNode.add(value); } return add(path, arrayNode); }
From source file:com.unboundid.scim2.common.messages.PatchOperation.java
/** * Create a new add patch operation./*from w w w . jav a 2s . c o m*/ * * @param path The path targeted by this patch operation. The path * must not be {@code null}. * @param values The values to add. * * @return The new add patch operation. * @throws ScimException if an error occurs. */ public static PatchOperation addDateValues(final Path path, final List<Date> values) throws ScimException { ArrayNode arrayNode = JsonUtils.getJsonNodeFactory().arrayNode(); for (Date value : values) { arrayNode.add(GenericScimResource.getDateJsonNode(value).textValue()); } return add(path, arrayNode); }
From source file:fr.gouv.vitam.cases.ResultRedis.java
/** * To be called before save to database/*from ww w .j a v a2 s .c o m*/ */ public void putBeforeSave() { if (!currentDaip.isEmpty()) { ArrayNode array = node.putArray(CURRENTDAIP); for (String string : currentDaip) { array.add(string); } } node.put(MINLEVEL, minLevel); node.put(MAXLEVEL, maxLevel); node.put(NBSUBNODES, nbSubNodes); }
From source file:org.gravidence.gravifon.db.ScrobblesDBClient.java
/** * Retrieves a number of scrobbles that belong to user and match applied optional filter params * (page [particular scrobble to start from] and/or date range). * //from ww w . jav a2 s . c o m * @param userId user identifier * @param scrobbleStartDatetime scrobble datetime to start from * @param start opening bound of date range * @param end closing bound of date range * @param ascending retrieve direction * @param limit max number of scrobbles to retrieve * @return list of scrobble details documents */ public List<ScrobbleDocument> retrieveScrobblesByUserID(String userId, String scrobbleStartDatetime, DateTime start, DateTime end, boolean ascending, Long limit) { ArrayNode key = SharedInstanceHolder.OBJECT_MAPPER.getNodeFactory().arrayNode(); key.add(userId); JsonNode scrobbleStart; if (scrobbleStartDatetime != null) { try { scrobbleStart = SharedInstanceHolder.OBJECT_MAPPER.readTree(scrobbleStartDatetime); } catch (IOException ex) { throw new JsonException(ex); } } else { scrobbleStart = null; } JsonNode subKeyStart; if (ascending && scrobbleStart != null) { subKeyStart = scrobbleStart; } else { subKeyStart = DateTimeUtils.dateTimeToArrayNode(start); } JsonNode subKeyEnd; if (!ascending && scrobbleStart != null) { subKeyEnd = scrobbleStart; } else { subKeyEnd = DateTimeUtils.dateTimeToArrayNode(end); } return retrievePage(viewMainAllUserScrobblesTarget, key, subKeyStart, subKeyEnd, ascending, limit, ScrobbleDocument.class); }