/** * Remove all values of the attribute specified by the path. * * @param path The path to the attribute whose value to remove. * @return This patch operation request. * @throws ScimException If the path is invalid. */ public T removeValues(final String path) throws ScimException { return removeValues(Path.fromString(path)); }
final List<String> messages) if(path.size() > 1) if(resourceType.getAttributeDefinition(path.subPath(1)) == null) "Attribute " + path.getElement(0)+ " in path " + path.toString() + " is undefined"); "Sub-attribute " + path.getElement(1)+ " in path " + path.toString() + " is undefined"); "Attribute " + path.getElement(0)+ " in path " + path.toString() + " is undefined");
/** * 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; }
JsonUtils.findMatchingPaths(Path.fromString("string"), gso.getObjectNode()).get(0), String.class), "new"); Path.fromString("array.string"), gso.getObjectNode()).get(0), String.class), "new"); assertEquals(JsonUtils.nodeToValue(JsonUtils.findMatchingPaths( Path.fromString("array.string"), gso.getObjectNode()).get(1), String.class), "new"); assertEquals(JsonUtils.nodeToValue(JsonUtils.findMatchingPaths( Path.fromString("complex.array.array.string"), gso.getObjectNode()).get(0), String.class), "string"); assertEquals(JsonUtils.nodeToValue(JsonUtils.findMatchingPaths( Path.fromString("complex.array.array.string"), gso.getObjectNode()).get(1), String.class), "new"); assertEquals(JsonUtils.nodeToValue(JsonUtils.findMatchingPaths( Path.fromString("complex.array.array.string"), gso.getObjectNode()).get(2), String.class), "string"); assertEquals(JsonUtils.nodeToValue(JsonUtils.findMatchingPaths( Path.fromString("complex.array.array.string"), 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");
return Path.root(); if(trimmedPathString.isEmpty()) return Path.root(); Path path = Path.root(); StringReader reader = new StringReader(trimmedPathString); if(SchemaUtils.isUrn(trimmedPathString)) try path = Path.root(schemaUrn); if(path.isRoot() || path.getElement(path.size()-1).getValueFilter() == null) path = path.attribute(attributeName, valueFilter);
/** * Trim attributes of the object node to return. * * @param objectNode The object node to return. * @return The trimmed object node ready to return to the client. */ public ObjectNode trimObjectNode(final ObjectNode objectNode) { return trimObjectNode(objectNode, Path.root()); }
if (parentPath.isRoot() && parentPath.getSchemaUrn() == null && SchemaUtils.isUrn(field.getKey())) path = Path.root(field.getKey()); path = parentPath.attribute(field.getKey()); if(path.isRoot() || shouldReturn(path))
Path path = parentPath.attribute((attribute.getName())); if(parentPath.size() == 0) else if(parentPath.isRoot() && parentPath.getSchemaUrn() != null) parentPath.getSchemaUrn());
final Path fullPath = parentPath.attribute(path); final AttributeDefinition attribute = resourceType.getAttributeDefinition(fullPath); if (path.getElement(0).getAttribute().equalsIgnoreCase("value")) "Sub-attribute " + path.getElement(0) + " in value filter for path " + parentPath.toString() + " is undefined");
Path path = parentPath.attribute(field.getKey()); if(path.size() > 1 || path.getSchemaUrn() == null)
Filter valueFilter = path == null ? null : path.getElement(path.size() - 1).getValueFilter(); AttributeDefinition attribute = path == null ? null : resourceType.getAttributeDefinition(path); "Attribute " + path.getElement(0)+ " in path " + path.toString() + " must not have a value selection filter " + "because it is not multi-valued"); path.withoutFilters(), valueFilter, resourceType, this, enabledOptions, results);
/** * {@inheritDoc} */ @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PresentFilter that = (PresentFilter) o; if (!filterAttribute.equals(that.filterAttribute)) { return false; } return true; }
int pathDepth = path.size(); if(path.getSchemaUrn() != null) Path.Element element = path.getElement(index - 1); field = element.getAttribute(); valueFilter = element.getValueFilter(); field = path.getSchemaUrn(); else if(path.size() > 0) Path.Element element = path.getElement(index); field = element.getAttribute(); valueFilter = element.getValueFilter();
Path.fromString(attribute)).withoutFilters(); Path.fromString(attribute)).withoutFilters();
/** * Create a new patch operation. * * @param path The path targeted by this patch operation. * @throws ScimException If an value is not valid. */ PatchOperation(final Path path) throws ScimException { if(path != null) { if(path.size() > 2) { throw BadRequestException.invalidPath( "Path can not target sub-attributes more than one level deep"); } if(path.size() == 2) { Filter valueFilter = path.getElement(1).getValueFilter(); // Allow use of the special case "value" path to reference the value itself. // Any other value filter is for a sub-attribute, which is not permitted. if (valueFilter != null && !valueFilter.getAttributePath().getElement(0).getAttribute().equals("value")) { throw BadRequestException.invalidPath( "Path can not include a value filter on sub-attributes"); } } } this.path = path; }
Path path = Path.root(); if(patchOperation.getPath() != null) withoutFilters(); paths.add(path);