/** * Method for adding given properties to this object node, overriding * any existing values for those properties. * * @param properties Properties to add * * @return This node after adding/replacing property values (to allow chaining) * * @deprecated Since 2.4 use {@link #setAll(Map)}, */ @Deprecated public JsonNode putAll(Map<String,? extends JsonNode> properties) { return setAll(properties); }
/** * Method for adding all properties of the given Object, overriding * any existing values for those properties. * * @param other Object of which properties to add to this object * * @return This node (to allow chaining) * * @deprecated Since 2.4 use {@link #setAll(ObjectNode)}, */ @Deprecated public JsonNode putAll(ObjectNode other) { return setAll(other); }
private JsonNode merge(JsonNode source, JsonNode replacement) throws IOException { JsonNode replacementNodeEncoded = replacement.get(fieldName); if (replacementNodeEncoded != null) { ObjectNode decodedSource = tryDecode(source.get(fieldName), mapper.createObjectNode(), fieldName); decodedSource.setAll(tryDecode(replacement.get(fieldName), mapper.createObjectNode(), fieldName)); return TextNode.valueOf(mapper.writeValueAsString(decodedSource)); } else { return source.get(fieldName); } }
@Nonnull protected String registryConfigs(@Nonnull AuthConfigurations authConfigs) { try { final String json; final ObjectMapper objectMapper = new ObjectMapper(); final RemoteApiVersion apiVersion = dockerClientConfig.getApiVersion(); if (apiVersion.equals(UNKNOWN_VERSION)) { ObjectNode rootNode = objectMapper.valueToTree(authConfigs.getConfigs()); // all registries final ObjectNode authNodes = objectMapper.valueToTree(authConfigs); // wrapped in "configs":{} rootNode.setAll(authNodes); // merge 2 variants json = rootNode.toString(); } else if (apiVersion.isGreaterOrEqual(VERSION_1_19)) { json = objectMapper.writeValueAsString(authConfigs.getConfigs()); } else { json = objectMapper.writeValueAsString(authConfigs); } return BaseEncoding.base64Url().encode(json.getBytes()); } catch (IOException e) { throw new RuntimeException(e); } }
protected String registryConfigs(AuthConfigurations authConfigs) { try { final String json; final ObjectMapper objectMapper = new ObjectMapper(); final RemoteApiVersion apiVersion = dockerClientConfig.getApiVersion(); if (apiVersion.equals(UNKNOWN_VERSION)) { ObjectNode rootNode = objectMapper.valueToTree(authConfigs.getConfigs()); // all registries final ObjectNode authNodes = objectMapper.valueToTree(authConfigs); // wrapped in "configs":{} rootNode.setAll(authNodes); // merge 2 variants json = rootNode.toString(); } else if (apiVersion.isGreaterOrEqual(VERSION_1_19)) { json = objectMapper.writeValueAsString(authConfigs.getConfigs()); } else { json = objectMapper.writeValueAsString(authConfigs); } return BaseEncoding.base64Url().encode(json.getBytes()); } catch (IOException e) { throw new RuntimeException(e); } }
throw new ParseException("`encrypted` must be an object after decrypting."); node.setAll((ObjectNode) decrypted);
/** * Construct a JSON representation of this entity source, suitable for serialization to e.g. YAML. * * @param base The URI of the YAML file that will be generated, to generate relative URLs. * @return The JSON node. */ public JsonNode toJSON(@Nullable URI base) { Path basePath = null; if (base != null) { try { basePath = Paths.get(base).getParent(); } catch (FileSystemNotFoundException ex) { /* this is ok, just means we can't resolve the base URI */ } } JsonNodeFactory nf = JsonNodeFactory.instance; ObjectNode object = nf.objectNode(); object.put("type", "textfile"); Path path = getFile(); if (basePath != null) { path = basePath.relativize(path); } object.put("file", path.toString().replace(File.separatorChar, '/')); object.setAll(format.toJSON()); return object; }
@Test public void testChangeSchemaSetProperties() throws Exception { AbstractUserService userService = getUserService(); userService.setUserProperties(PROJECT_NAME, 4, sampleProperties); ObjectNode newProperties = JsonHelper.jsonObject() .put("test100", 1.0) .put("test200", "value") .put("test400", true); userService.setUserProperties(PROJECT_NAME, 4, newProperties); User test = userService.getUser(CONTEXT, 4).join(); assertEquals(test.id, 4); ObjectNode builder = JsonHelper.jsonObject(); builder.setAll(samplePropertiesExpected); builder.setAll(newProperties); assertEquals((Object) test.properties, builder); }
/** * Method for adding all properties of the given Object, overriding * any existing values for those properties. *<p> * NOTE: this method will be <b>deprecated</b> in 2.2; and should * be replace with {@link #setAll(ObjectNode)}. * * @param other Object of which properties to add to this object * * @return This node (to allow chaining) */ public JsonNode putAll(ObjectNode other) { return setAll(other); }
/** * Method for adding given properties to this object node, overriding * any existing values for those properties. * * @param properties Properties to add * * @return This node after adding/replacing property values (to allow chaining) * * @deprecated Since 2.4 use {@link #setAll(Map)}, */ @Deprecated public JsonNode putAll(Map<String,? extends JsonNode> properties) { return setAll(properties); }
/** * Method for adding all properties of the given Object, overriding * any existing values for those properties. * * @param other Object of which properties to add to this object * * @return This node (to allow chaining) * * @deprecated Since 2.4 use {@link #setAll(ObjectNode)}, */ @Deprecated public JsonNode putAll(ObjectNode other) { return setAll(other); }
/** * Method for adding given properties to this object node, overriding * any existing values for those properties. * * @param properties Properties to add * * @return This node after adding/replacing property values (to allow chaining) * * @deprecated Since 2.4 use {@link #setAll(Map)}, */ @Deprecated public JsonNode putAll(Map<String,? extends JsonNode> properties) { return setAll(properties); }
/** * Method for adding all properties of the given Object, overriding * any existing values for those properties. * * @param other Object of which properties to add to this object * * @return This node (to allow chaining) * * @deprecated Since 2.4 use {@link #setAll(ObjectNode)}, */ @Deprecated public JsonNode putAll(ObjectNode other) { return setAll(other); }
/** * Store the parameter list * * @param parameterList the parameterList to set */ public void setParameterList(ObjectNode parameterList) { if (parameterList != null) { getParameterList().setAll(parameterList); } }
public static ObjectNode createJsonSchema(final String title, final ObjectNode schema) { final ObjectNode schemaNode = newJsonObjectSchema(); if (title != null) { schemaNode.put("title", title); } schemaNode.setAll(schema); return schemaNode; }
/** * Sets the params. * * @param params * the new params */ public void setParams(final ObjectNode params) { final ObjectNode newParams = JOM.createObjectNode(); if (params != null) { newParams.setAll(params); } req.set(PARAMS, newParams); }
public static ObjectNode createJsonSchema(final String title, final ObjectNode schema) { final ObjectNode schemaNode = newJsonObjectSchema(); if (title != null) { schemaNode.put("title", title); } schemaNode.setAll(schema); return schemaNode; }
@Override protected ObjectNode convertMappingInfoToJson(ActivityMigrationMapping.OneToManyMapping mapping, ObjectMapper objectMapper) { ObjectNode mappingNode = objectMapper.createObjectNode(); mappingNode.put(FROM_ACTIVITY_ID_JSON_PROPERTY, mapping.getFromActivityId()); JsonNode toActivityIdsNode = objectMapper.valueToTree(mapping.getToActivityIds()); mappingNode.set(TO_ACTIVITY_IDS_JSON_PROPERTY, toActivityIdsNode); mappingNode.setAll(convertAdditionalMappingInfoToJson(mapping, objectMapper)); return mappingNode; }
@Override protected ObjectNode convertMappingInfoToJson(ActivityMigrationMapping.ManyToOneMapping mapping, ObjectMapper objectMapper) { ObjectNode mappingNode = objectMapper.createObjectNode(); JsonNode fromActivityIdsNode = objectMapper.valueToTree(mapping.getFromActivityIds()); mappingNode.set(FROM_ACTIVITY_IDS_JSON_PROPERTY, fromActivityIdsNode); mappingNode.put(TO_ACTIVITY_ID_JSON_PROPERTY, mapping.getToActivityId()); mappingNode.setAll(convertAdditionalMappingInfoToJson(mapping, objectMapper)); return mappingNode; }
@Override protected ObjectNode convertMappingInfoToJson(ActivityMigrationMapping.OneToOneMapping mapping, ObjectMapper objectMapper) { ObjectNode mappingNode = objectMapper.createObjectNode(); mappingNode.put(FROM_ACTIVITY_ID_JSON_PROPERTY, mapping.getFromActivityId()); mappingNode.put(TO_ACTIVITY_ID_JSON_PROPERTY, mapping.getToActivityId()); mappingNode.setAll(convertAdditionalMappingInfoToJson(mapping, objectMapper)); return mappingNode; }