Class BaseScimResource

    • Constructor Detail

      • BaseScimResource

        public BaseScimResource()
        Constructs a new BaseScimResource object, and sets the urn if the class extending this one is annotated.
      • BaseScimResource

        public BaseScimResource​(String id)
        Constructs a new BaseScimResource object, and sets the urn if the class extending this one is annotated.
        Parameters:
        id - The ID fo the object.
    • Method Detail

      • getExtensionObjectNode

        public com.fasterxml.jackson.databind.node.ObjectNode getExtensionObjectNode()
        Gets the ObjectNode that contains all extension attributes.
        Returns:
        a ObjectNode.
      • getMeta

        public Meta getMeta()
        Gets metadata about the object.
        Specified by:
        getMeta in interface ScimResource
        Returns:
        Meta containing metadata about the object.
      • setMeta

        public void setMeta​(Meta meta)
        Sets metadata for the object.
        Specified by:
        setMeta in interface ScimResource
        Parameters:
        meta - Meta containing metadata for the object.
      • setId

        public void setId​(String id)
        Sets the id of the object.
        Specified by:
        setId in interface ScimResource
        Parameters:
        id - The object's id.
      • getSchemaUrns

        public Set<StringgetSchemaUrns()
        Gets the schema urns for this object. This includes the one for the class that extends this class (taken from the annotation), as well as any that are present in the extensions.
        Specified by:
        getSchemaUrns in interface ScimResource
        Returns:
        the schema urns for this object.
      • setSchemaUrns

        public void setSchemaUrns​(Collection<String> schemaUrns)
        Sets the schema urns for this object. This set should contain all schema urns including the one for this object and all extensions. The value must not be null.
        Specified by:
        setSchemaUrns in interface ScimResource
        Parameters:
        schemaUrns - A Collection containing the schema urns for this object.
      • setAny

        protected void setAny​(String key,
                              com.fasterxml.jackson.databind.JsonNode value)
                       throws ScimException
        This method is used during json deserialization. It will be called in the event that a value is given for an field that is not defined in the class.
        Parameters:
        key - name of the field.
        value - value of the field.
        Throws:
        ScimException - if the key is not an extension attribute namespace (the key name doesn't start with "urn:").
      • getAny

        protected Map<String,​ObjectgetAny()
        Used to get values that were deserialized from json where there was no matching field in the class.
        Returns:
        the value of the field.
      • getExtension

        public <T> T getExtension​(Class<T> clazz)
        Retrieve a SCIM extension based on the annotations of the class provided. The returned value will be converted to a POJO of the type specified.
        Type Parameters:
        T - the type of object to return.
        Parameters:
        clazz - The class used to determine the type of the object returned and the schema of the extension.
        Returns:
        The matching extension object, or null if no extension of that type exists.
      • setExtension

        public <T> void setExtension​(T extension)
        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.
        Type Parameters:
        T - the type of object.
        Parameters:
        extension - The value to set. This also is used to determine what the extension's urn is.
      • removeExtension

        public <T> boolean removeExtension​(Class<T> clazz)
        Removes a SCIM extension. The extension urn is based on the annotations of the class provided.
        Type Parameters:
        T - the type of the class object.
        Parameters:
        clazz - the class used to determine the schema urn.
        Returns:
        true if the extension was removed, or false if the extension was not present.
      • removeExtensionValues

        public boolean removeExtensionValues​(String path)
                                      throws ScimException
        Removes values of the extension attribute at the provided path. Equivalent to using the JsonUtils.removeValues(Path, ObjectNode) method: JsonUtils.removeValue(Path.fromString(path), getObjectNode(), values).
        Parameters:
        path - The path to the attribute whose values to remove.
        Returns:
        Whether one or more values where removed.
        Throws:
        ScimException - If the path is invalid.
      • removeExtensionValues

        public boolean removeExtensionValues​(Path path)
                                      throws ScimException
        Removes values of the extension attribute at the provided path. Equivalent to using the JsonUtils.removeValues(Path, ObjectNode) method: JsonUtils.removeValue(Path.fromString(path), getObjectNode(), values).
        Parameters:
        path - The path to the attribute whose values to remove.
        Returns:
        Whether one or more values where removed.
        Throws:
        ScimException - If the path is invalid.
      • asGenericScimResource

        public GenericScimResource asGenericScimResource()
        Returns the GenericScimResource representation of this ScimResource. If this ScimResource is already a GenericScimResource, this same instance will be returned.
        Specified by:
        asGenericScimResource in interface ScimResource
        Returns:
        The GenericScimResource representation of this ScimResource.