public abstract class BaseScimResource extends Object implements ScimResource
The base SCIM object. This object contains all of the attributes required of SCIM objects.
BaseScimResource is used when the schema is known ahead of
time. In that case a developer can derive a class from
BaseScimResource and annotate the class. The class should
be a Java bean. This will make it easier to work with the SCIM
object since you will just have plain old getters and setters
for core attributes. Extension attributes cannot be bound to
members of the class but they can still be accessed using the
getExtensionObjectNode()
method or the getExtensionValues(java.lang.String)
,
replaceExtensionValue(java.lang.String, com.fasterxml.jackson.databind.JsonNode)
, and addExtensionValue(java.lang.String, com.fasterxml.jackson.databind.node.ArrayNode)
methods.
If you have a BaseScimResource derived object, you can always get a
GenericScimResource
by calling asGenericScimResource()
.
You could also go the other way by calling
GenericScimResource.getObjectNode()
, followed by
JsonUtils.nodeToValue(JsonNode, Class)
.
GenericScimResource
Constructor and Description |
---|
BaseScimResource()
Constructs a new BaseScimResource object, and sets the urn if
the class extending this one is annotated.
|
BaseScimResource(String id)
Constructs a new BaseScimResource object, and sets the urn if
the class extending this one is annotated.
|
Modifier and Type | Method and Description |
---|---|
void |
addExtensionValue(Path path,
com.fasterxml.jackson.databind.node.ArrayNode values)
Add new values to the extension attribute at the provided path.
|
void |
addExtensionValue(String path,
com.fasterxml.jackson.databind.node.ArrayNode values)
Add new values for the extension attribute at the provided path.
|
GenericScimResource |
asGenericScimResource()
Returns the GenericScimResource representation of this ScimResource.
|
boolean |
equals(Object o) |
protected Map<String,Object> |
getAny()
Used to get values that were deserialized from json where there was
no matching field in the class.
|
<T> T |
getExtension(Class<T> clazz)
Retrieve a SCIM extension based on the annotations of the class
provided.
|
com.fasterxml.jackson.databind.node.ObjectNode |
getExtensionObjectNode()
Gets the
ObjectNode that contains all extension attributes. |
List<com.fasterxml.jackson.databind.JsonNode> |
getExtensionValues(Path path)
Retrieve all JSON nodes of the extension attribute referenced by the
provided path.
|
List<com.fasterxml.jackson.databind.JsonNode> |
getExtensionValues(String path)
Retrieve all JSON nodes of the extension attribute referenced by the
provided path.
|
String |
getExternalId()
Gets the objects external id.
|
String |
getId()
Gets the id of the object.
|
Meta |
getMeta()
Gets metadata about the object.
|
Set<String> |
getSchemaUrns()
Gets the schema urns for this object.
|
int |
hashCode() |
<T> boolean |
removeExtension(Class<T> clazz)
Removes a SCIM extension.
|
boolean |
removeExtensionValues(Path path)
Removes values of the extension attribute at the provided path.
|
boolean |
removeExtensionValues(String path)
Removes values of the extension attribute at the provided path.
|
void |
replaceExtensionValue(Path path,
com.fasterxml.jackson.databind.JsonNode value)
Update the value of the extension attribute at the provided path.
|
void |
replaceExtensionValue(String path,
com.fasterxml.jackson.databind.JsonNode value)
Update the value of the extension attribute at the provided path.
|
protected void |
setAny(String key,
com.fasterxml.jackson.databind.JsonNode value)
This method is used during json deserialization.
|
<T> void |
setExtension(T extension)
Sets a SCIM extension to the given value based on the annotations
of the class provided.
|
void |
setExternalId(String externalId)
Sets the object's external id.
|
void |
setId(String id)
Sets the id of the object.
|
void |
setMeta(Meta meta)
Sets metadata for the object.
|
void |
setSchemaUrns(Collection<String> schemaUrns)
Sets the schema urns for this object.
|
String |
toString() |
public BaseScimResource()
public BaseScimResource(String id)
id
- The ID fo the object.public com.fasterxml.jackson.databind.node.ObjectNode getExtensionObjectNode()
ObjectNode
that contains all extension attributes.ObjectNode
.public Meta getMeta()
getMeta
in interface ScimResource
Meta
containing metadata about the object.public void setMeta(Meta meta)
setMeta
in interface ScimResource
meta
- Meta
containing metadata for the object.public String getId()
getId
in interface ScimResource
public void setId(String id)
setId
in interface ScimResource
id
- The object's id.public String getExternalId()
getExternalId
in interface ScimResource
public void setExternalId(String externalId)
setExternalId
in interface ScimResource
externalId
- The external id of the object.public Set<String> getSchemaUrns()
getSchemaUrns
in interface ScimResource
public void setSchemaUrns(Collection<String> schemaUrns)
setSchemaUrns
in interface ScimResource
schemaUrns
- a set containing the schema urns for this object.protected void setAny(String key, com.fasterxml.jackson.databind.JsonNode value) throws ScimException
key
- name of the field.value
- value of the field.ScimException
- if the key is not an extension attribute namespace
(the key name doesn't start with "urn:
").protected Map<String,Object> getAny()
public List<com.fasterxml.jackson.databind.JsonNode> getExtensionValues(String path) throws ScimException
JsonUtils.findMatchingPaths(Path, ObjectNode)
method: JsonUtils.getValues(Path.fromString(path),
getExtensionObjectNode()).
The JsonUtils.nodeToValue(JsonNode, Class)
method may be used to
bind the retrieved JSON node into specific value type instances.path
- The path to the attribute whose value to retrieve.ScimException
- If the path is invalid.public List<com.fasterxml.jackson.databind.JsonNode> getExtensionValues(Path path) throws ScimException
JsonUtils.findMatchingPaths(Path, ObjectNode)
method: JsonUtils.getValues(path, getExtensionObjectNode()).
The JsonUtils.nodeToValue(JsonNode, Class)
method may be used to
bind the retrieved JSON node into specific value type instances.path
- The path to the attribute whose value to retrieve.ScimException
- If the path is invalid.public void replaceExtensionValue(String path, com.fasterxml.jackson.databind.JsonNode value) throws ScimException
JsonUtils.replaceValue(Path, ObjectNode,
JsonNode)
method: JsonUtils.replaceValues(Path.fromString(path),
getExtensionObjectNode(), value).
The JsonUtils.valueToNode(Object)
method may be used to convert
the given value instance to a JSON node.path
- The path to the attribute whose value to set.value
- The value(s) to set.ScimException
- If the path is invalid.public void replaceExtensionValue(Path path, com.fasterxml.jackson.databind.JsonNode value) throws ScimException
JsonUtils.replaceValue(Path, ObjectNode,
JsonNode)
method: JsonUtils.replaceValues(path, getExtensionObjectNode(),
value).
The JsonUtils.valueToNode(Object)
method may be used to convert
the given value instance to a JSON node.path
- The path to the attribute whose value to set.value
- The value(s) to set.ScimException
- If the path is invalid.public <T> T getExtension(Class<T> clazz)
T
- the type of object to return.clazz
- The class used to determine the type of the object returned
and the schema of the extension.null
if no extension of
that type exists.public <T> void setExtension(T extension)
T
- the type of object.extension
- The value to set. This also is used to determine what
the extension's urn is.public <T> boolean removeExtension(Class<T> clazz)
T
- the type of the class object.clazz
- the class used to determine the schema urn.public void addExtensionValue(String path, com.fasterxml.jackson.databind.node.ArrayNode values) throws ScimException
JsonUtils.addValue(Path, ObjectNode, JsonNode)
method:
JsonUtils.addValue(Path.fromString(path), getExtensionObjectNode(),
values).
The JsonUtils.valueToNode(Object)
method may be used to convert
the given value instance to a JSON node.path
- The path to the attribute whose values to add.values
- The value(s) to add.ScimException
- If the path is invalid.public void addExtensionValue(Path path, com.fasterxml.jackson.databind.node.ArrayNode values) throws ScimException
JsonUtils.addValue(Path, ObjectNode, JsonNode)
method:
JsonUtils.addValue(path, getObjectNode(), values).
The JsonUtils.valueToNode(Object)
method may be used to convert
the given value instance to a JSON node.path
- The path to the attribute whose values to add.values
- The value(s) to add.ScimException
- If the path is invalid.public boolean removeExtensionValues(String path) throws ScimException
JsonUtils.removeValues(Path, ObjectNode)
method:
JsonUtils.removeValue(Path.fromString(path), getObjectNode(), values).path
- The path to the attribute whose values to remove.ScimException
- If the path is invalid.public boolean removeExtensionValues(Path path) throws ScimException
JsonUtils.removeValues(Path, ObjectNode)
method:
JsonUtils.removeValue(Path.fromString(path), getObjectNode(), values).path
- The path to the attribute whose values to remove.ScimException
- If the path is invalid.public GenericScimResource asGenericScimResource()
asGenericScimResource
in interface ScimResource
Copyright © 2015–2020 Ping Identity Corporation. All rights reserved.