/** * {@inheritDoc} */ @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } PatchRequest that = (PatchRequest) o; if (!operations.equals(that.operations)) { return false; } return true; }
/** * {@inheritDoc} */ @Override public int hashCode() { int result = super.hashCode(); result = 31 * result + operations.hashCode(); return result; } }
/** * Constructs a new BaseScimResource object, and sets the urn if * the class extending this one is annotated. * * @param id The ID fo the object. */ public BaseScimResource(final String id) { this.id = id; addMyUrn(); }
/** * Sets a SCIM extension to the given value based on the annotations * of the class provided. The value will be set for an extension named * based on the annotations of the class supplied. * * @param extension The value to set. This also is used to determine what * the extension's urn is. * @param <T> the type of object. */ @JsonIgnore public <T> void setExtension(final T extension) { String schemaUrn = getSchemaUrnOrThrowException(extension.getClass()); extensionObjectNode.set(schemaUrn, JsonUtils.valueToNode(extension)); schemaUrns.add(schemaUrn); }
/** * Removes values of the extension attribute at the provided path. Equivalent * to using the {@link JsonUtils#removeValues(Path, ObjectNode)} method: * JsonUtils.removeValue(Path.fromString(path), getObjectNode(), values). * * @param path The path to the attribute whose values to remove. * @return Whether one or more values where removed. * @throws ScimException If the path is invalid. */ public boolean removeExtensionValues(final String path) throws ScimException { return removeExtensionValues(Path.fromString(path)); }
/** * Adds the urn of this class to the list of schemas for this object. * This is taken from the schema annotation of a class that extends * this class. If the class has no schema annotation, no schema urn * will be added. */ private void addMyUrn() { String mySchema = SchemaUtils.getSchemaUrn(this.getClass()); if((mySchema != null) && (!mySchema.isEmpty())) { getSchemaUrns().add(mySchema); } }
/** * Update the value of the extension attribute at the provided path. * Equivalent to using the {@link JsonUtils#replaceValue(Path, ObjectNode, * JsonNode)} method: JsonUtils.replaceValues(Path.fromString(path), * getExtensionObjectNode(), value). * * The {@link JsonUtils#valueToNode(Object)} method may be used to convert * the given value instance to a JSON node. * * @param path The path to the attribute whose value to set. * @param value The value(s) to set. * @throws ScimException If the path is invalid. */ public void replaceExtensionValue(final String path, final JsonNode value) throws ScimException { replaceExtensionValue(Path.fromString(path), value); }
/** * Add new values for the extension attribute at the provided path. Equivalent * to using the {@link JsonUtils#addValue(Path, ObjectNode, JsonNode)} method: * JsonUtils.addValue(Path.fromString(path), getExtensionObjectNode(), * values). * * The {@link JsonUtils#valueToNode(Object)} method may be used to convert * the given value instance to a JSON node. * * @param path The path to the attribute whose values to add. * @param values The value(s) to add. * @throws ScimException If the path is invalid. */ public void addExtensionValue(final String path, final ArrayNode values) throws ScimException { addExtensionValue(Path.fromString(path), values); }
/** * Retrieve all JSON nodes of the extension attribute referenced by the * provided path. Equivalent to using the * {@link JsonUtils#findMatchingPaths(Path, ObjectNode)} * method: JsonUtils.getValues(Path.fromString(path), * getExtensionObjectNode()). * * The {@link JsonUtils#nodeToValue(JsonNode, Class)} method may be used to * bind the retrieved JSON node into specific value type instances. * * @param path The path to the attribute whose value to retrieve. * * @return List of all JSON nodes referenced by the provided path. * @throws ScimException If the path is invalid. */ public List<JsonNode> getExtensionValues(final String path) throws ScimException { return getExtensionValues(Path.fromString(path)); }
/** * Sets a SCIM extension to the given value based on the annotations * of the class provided. The value will be set for an extension named * based on the annotations of the class supplied. * * @param extension The value to set. This also is used to determine what * the extension's urn is. * @param <T> the type of object. */ @JsonIgnore public <T> void setExtension(final T extension) { String schemaUrn = getSchemaUrnOrThrowException(extension.getClass()); extensionObjectNode.set(schemaUrn, JsonUtils.valueToNode(extension)); schemaUrns.add(schemaUrn); }
/** * Removes values of the extension attribute at the provided path. Equivalent * to using the {@link JsonUtils#removeValues(Path, ObjectNode)} method: * JsonUtils.removeValue(Path.fromString(path), getObjectNode(), values). * * @param path The path to the attribute whose values to remove. * @return Whether one or more values where removed. * @throws ScimException If the path is invalid. */ public boolean removeExtensionValues(final String path) throws ScimException { return removeExtensionValues(Path.fromString(path)); }
/** * Adds the urn of this class to the list of schemas for this object. * This is taken from the schema annotation of a class that extends * this class. If the class has no schema annotation, no schema urn * will be added. */ private void addMyUrn() { String mySchema = SchemaUtils.getSchemaUrn(this.getClass()); if((mySchema != null) && (!mySchema.isEmpty())) { getSchemaUrns().add(mySchema); } }
/** * Update the value of the extension attribute at the provided path. * Equivalent to using the {@link JsonUtils#replaceValue(Path, ObjectNode, * JsonNode)} method: JsonUtils.replaceValues(Path.fromString(path), * getExtensionObjectNode(), value). * * The {@link JsonUtils#valueToNode(Object)} method may be used to convert * the given value instance to a JSON node. * * @param path The path to the attribute whose value to set. * @param value The value(s) to set. * @throws ScimException If the path is invalid. */ public void replaceExtensionValue(final String path, final JsonNode value) throws ScimException { replaceExtensionValue(Path.fromString(path), value); }
/** * Add new values for the extension attribute at the provided path. Equivalent * to using the {@link JsonUtils#addValue(Path, ObjectNode, JsonNode)} method: * JsonUtils.addValue(Path.fromString(path), getExtensionObjectNode(), * values). * * The {@link JsonUtils#valueToNode(Object)} method may be used to convert * the given value instance to a JSON node. * * @param path The path to the attribute whose values to add. * @param values The value(s) to add. * @throws ScimException If the path is invalid. */ public void addExtensionValue(final String path, final ArrayNode values) throws ScimException { addExtensionValue(Path.fromString(path), values); }
/** * Retrieve all JSON nodes of the extension attribute referenced by the * provided path. Equivalent to using the * {@link JsonUtils#findMatchingPaths(Path, ObjectNode)} * method: JsonUtils.getValues(Path.fromString(path), * getExtensionObjectNode()). * * The {@link JsonUtils#nodeToValue(JsonNode, Class)} method may be used to * bind the retrieved JSON node into specific value type instances. * * @param path The path to the attribute whose value to retrieve. * * @return List of all JSON nodes referenced by the provided path. * @throws ScimException If the path is invalid. */ public List<JsonNode> getExtensionValues(final String path) throws ScimException { return getExtensionValues(Path.fromString(path)); }
/** * {@inheritDoc} */ @Override public int hashCode() { int result = super.hashCode(); result = 31 * result + operations.hashCode(); return result; } }
/** * {@inheritDoc} */ @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } PatchRequest that = (PatchRequest) o; if (!operations.equals(that.operations)) { return false; } return true; }
/** * Removes a SCIM extension. The extension urn is based on the annotations * of the class provided. * * @param clazz the class used to determine the schema urn. * @param <T> the type of the class object. * * @return true if the extension was removed, or false if the extension * was not present. */ public <T> boolean removeExtension(final Class<T> clazz) { String schemaUrn = getSchemaUrnOrThrowException(clazz); if(extensionObjectNode.remove(schemaUrn) == null) { return false; } else { schemaUrns.remove(schemaUrn); return true; } }
/** * Constructs a new BaseScimResource object, and sets the urn if * the class extending this one is annotated. * * @param id The ID fo the object. */ public BaseScimResource(final String id) { this.id = id; addMyUrn(); }
/** * {@inheritDoc} */ @Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (scimType != null ? scimType.hashCode() : 0); result = 31 * result + (detail != null ? detail.hashCode() : 0); result = 31 * result + status; return result; } }