private Path computeDiffPath( final Path parentPath, final String sourceKey, final JsonNode sourceNode) { return parentPath.isRoot() && SchemaUtils.isUrn(sourceKey) ? Path.root(sourceKey) : parentPath.attribute(sourceKey); }
Path path = parentPath.attribute(field.getKey()); if(path.size() > 1 || path.getSchemaUrn() == null)
private Path computeDiffPath( final Path parentPath, final String sourceKey, final JsonNode sourceNode) { return parentPath.isRoot() && SchemaUtils.isUrn(sourceKey) ? Path.root(sourceKey) : parentPath.attribute(sourceKey); }
private void buildAttributeNotationMap( final Path parentPath, final Collection<AttributeDefinition> attributes) { for(AttributeDefinition attribute : attributes) { Path path = parentPath.attribute(attribute.getName()); attributeNotationMap.put(path, attribute); if(attribute.getSubAttributes() != null) { buildAttributeNotationMap(path, attribute.getSubAttributes()); } } }
/** * Normalize a path by removing the schema URN for core attributes. * * @param path The path to normalize. * @return The normalized path. */ public Path normalizePath(final Path path) { if(path.getSchemaUrn() != null && coreSchema != null && path.getSchemaUrn().equalsIgnoreCase(coreSchema.getId())) { return Path.root().attribute(path); } return path; }
path = parentPath.attribute(field.getKey());
Path valuePath = parentPath.attribute( path.getElement(path.size() - 1).getAttribute() + "[" + i + "]"); checkAttributeValue(prefix, value, valuePath, attribute, results,
Path.root().attribute("attr") }, new Object[] { "urn:extension:attr", Path.root("urn:extension").attribute("attr") }, new Object[] { "attr.subAttr", Path.root().attribute("attr").attribute("subAttr") }, new Object[] { "attr[subAttr eq \"78750\"].subAttr", Path.root().attribute("attr", eq("subAttr", "78750")). attribute("subAttr") }, new Object[] { "attr.$ref", Path.root().attribute("attr").attribute("$ref") }, new Object[] { "attr[$ref eq \"/Users/xxx\"]", Path.root().attribute("attr", eq("$ref", "/Users/xxx")) }, new Object[] { "urn:extension:attr[subAttr eq \"78750\"].subAttr", Path.root("urn:extension").attribute("attr", eq("subAttr", "78750")).attribute("subAttr") }, new Object[] { "urn:ietf:params:scim:schemas:extension:" + "enterprise:2.0:User:employeeNumber", Path.root("urn:ietf:params:scim:schemas:extension:" + "enterprise:2.0:User").attribute("employeeNumber") }, new Object[] { "urn:pingidentity:schemas:sample:profile:1.0:" + "topicPreferences[(id eq " + "\"2015-10-12T14:57:36.494Z\")]", Path.root("urn:pingidentity:schemas:sample:profile:1.0"). attribute("topicPreferences", Filter.and(Filter.eq("id", "urn:X-UnboundID:topic:clothing:shoes"), "subAttr[subSub pr].this.is.crazy[type eq \"good\"].deep",
Path.root().attribute("title")))); ObjectNode replaceValue = JsonUtils.getJsonNodeFactory().objectNode(); replaceValue.put("userType", "manager");
assertEquals(d.size(), 4); assertTrue(d.contains(PatchOperation.remove( Path.root().attribute("userName")))); assertTrue(d.contains(PatchOperation.remove( Path.root().attribute("nickName")))); assertTrue(d.contains(PatchOperation.remove( Path.root().attribute("title")))); assertTrue(d.contains(PatchOperation.remove( Path.root().attribute("userType"))));
final Path fullPath = parentPath.attribute(path); final AttributeDefinition attribute = resourceType.getAttributeDefinition(fullPath);
Path.root(EnterpriseUserExtension.class).attribute("employeeNumber")) .get(0).textValue(), "1234");
patchOps.add(PatchOperation.remove(Path.root().attribute("schemas", Filter.eq("value", "urn:ietf:params:scim:schemas:core:2.0:User")))); patchOps.add(PatchOperation.remove(Path.root().attribute("schemas", Filter.eq("value", "urn:id:extWithReqAttr")))); patchOps.add(PatchOperation.replace(Path.root().attribute("schemas", Filter.eq("value", "urn:ietf:params:scim:schemas:core:2.0:User")), TextNode.valueOf("urn:id:extWithOptAttr"))); patchOps.add(PatchOperation.replace(Path.root().attribute("schemas", Filter.eq("value", "urn:id:extWithReqAttr")), TextNode.valueOf("urn:id:extWithOptAttr"))); patchOps.add(PatchOperation.add(Path.root().attribute("schemas"), JsonUtils.getJsonNodeFactory().arrayNode().add("urn:id:undefined")));
gso.getObjectNode()).get(3), String.class), "new"); gso.replaceValue(Path.root("urn:some:extension").attribute("attribute"), JsonUtils.valueToNode("extensionValue")); assertEquals(JsonUtils.nodeToValue(JsonUtils.findMatchingPaths( Path.root("urn:some:extension").attribute("attribute"), gso.getObjectNode()).get(0), String.class), "extensionValue");
ArrayValue[].class)[1], value1[0]); gso.replaceValue(Path.root("urn:some:extension").attribute("attribute"), JsonUtils.valueToNode(new ArrayValue[]{meta1, meta2})); assertEquals(JsonUtils.nodeToValue(JsonUtils.findMatchingPaths( Path.root("urn:some:extension").attribute("attribute"), gso.getObjectNode()).get(0), ArrayValue[].class), values);