Class SchemaAttribute

java.lang.Object
com.fasterxml.jackson.databind.JsonSerializable.Base
com.fasterxml.jackson.databind.JsonNode
com.fasterxml.jackson.databind.node.BaseJsonNode
com.fasterxml.jackson.databind.node.ContainerNode<com.fasterxml.jackson.databind.node.ObjectNode>
com.fasterxml.jackson.databind.node.ObjectNode
de.captaingoldfish.scim.sdk.common.resources.base.ScimObjectNode
de.captaingoldfish.scim.sdk.common.schemas.SchemaAttribute
All Implemented Interfaces:
com.fasterxml.jackson.core.TreeNode, com.fasterxml.jackson.databind.JsonSerializable, com.fasterxml.jackson.databind.node.JsonNodeCreator, ScimNode, Serializable, Iterable<com.fasterxml.jackson.databind.JsonNode>

public final class SchemaAttribute extends ScimObjectNode
holds the data of an attribute definition from a schema type document
See Also:
  • Constructor Details

    • SchemaAttribute

      public SchemaAttribute()
      this constructor is necessary for the SCIM-SDK-client. It is used if the meta-config-data of a SCIM provider is loaded and evaluated
    • SchemaAttribute

      public SchemaAttribute(SchemaAttribute parent, String resourceUri, String namePrefix)
      a constructor used for unit tests only to create schema-attribute instances for testing
    • SchemaAttribute

      protected SchemaAttribute(com.fasterxml.jackson.databind.JsonNode attributeDefinition)
    • SchemaAttribute

      protected SchemaAttribute(Schema schema, String resourceUri, SchemaAttribute parent, com.fasterxml.jackson.databind.JsonNode jsonNode, String namePrefix)
    • SchemaAttribute

      public SchemaAttribute(Schema schema, String resourceUri, SchemaAttribute parent, com.fasterxml.jackson.databind.JsonNode jsonNode)
  • Method Details

    • getSubAttribute

      public SchemaAttribute getSubAttribute(String attributeName)
      gets the attribute with the given name from this schemaAttribute
      Parameters:
      attributeName - the simple name of the sub-attribute e.g. "value" or "primary"
      Returns:
      the attribute if it does exist as child of this attribute
    • isComplexAttribute

      public boolean isComplexAttribute()
      Returns:
      true if this attribute is of type complex
    • isMultivaluedComplexAttribute

      public boolean isMultivaluedComplexAttribute()
      Returns:
      true if this attribute is of type complex and multivalued
    • isChildOfComplexAttribute

      public boolean isChildOfComplexAttribute()
      Returns:
      true if this attribute has a parent
    • isChildOfMultivaluedComplexAttribute

      public boolean isChildOfMultivaluedComplexAttribute()
      Returns:
      true if this attribute has a parent and the parent is multivalued
    • isReadOnly

      public boolean isReadOnly()
      Returns:
      true if this is a readOnly attribute
    • isImmutable

      public boolean isImmutable()
      Returns:
      true if this is an immutable attribute
    • isReadWrite

      public boolean isReadWrite()
      Returns:
      true if this is a read-write attribute
    • isWriteOnly

      public boolean isWriteOnly()
      Returns:
      true if this is a writeOnly attribute
    • isComplexBulkCandidate

      public boolean isComplexBulkCandidate()
      Returns:
      if this attribute is a complex bulk candidate e.g. enterprise.user.manger. A complex bulk-candidate is a complex attribute that contains a value a type and a $ref attribute. The $ref attribute must be of type "reference" and "referenceType=resource"
    • isSimpleValueBulkCandidate

      public boolean isSimpleValueBulkCandidate()
      if this attribute is a simple bulk candidate. This is a custom feature not defined in the SCIM specification. A simple bulk candidate must fulfill the following conditions:
      1. be of type "reference"
      2. have as one and only "referenceType" the value "resource"
      3. define the custom attribute "resourceType" that references the name of resource-type.json file
               {
                 "name": "userId",
                 "type": "reference",
                 "referenceTypes": [
                   "resource"
                 ]
                 "resourceType": "User"
               }
       
    • getFullResourceName

      public String getFullResourceName()
      Returns:
      the full resource node name e.g. User.name.givenName or Group.member.value
    • getScimNodeName

      public String getScimNodeName()
      Returns:
      the name scim node name of this attribute e.g. "name.givenName"
    • getNamePrefix

      public String getNamePrefix()
      See Also:
      • namePrefix
    • getName

      public String getName()
      The attribute's name.
    • setName

      public void setName(String name)
      The attribute's name.
    • getType

      public Type getType()
      The attribute's data type. Valid values are "string", "boolean", "decimal", "integer", "dateTime", "reference", and "complex". When an attribute is of type "complex", there SHOULD be a corresponding schema attribute "subAttributes" defined, listing the sub-attributes of the attribute.
    • setType

      public void setType(Type type)
      The attribute's data type. Valid values are "string", "boolean", "decimal", "integer", "dateTime", "reference", and "complex". When an attribute is of type "complex", there SHOULD be a corresponding schema attribute "subAttributes" defined, listing the sub-attributes of the attribute.
    • getDescription

      public String getDescription()
      The attribute's human-readable description. When applicable, service providers MUST specify the description.
    • setDescription

      public void setDescription(String description)
      The attribute's human-readable description. When applicable, service providers MUST specify the description.
    • getMutability

      public Mutability getMutability()
      A single keyword indicating the circumstances under which the value of the attribute can be (re)defined: readOnly The attribute SHALL NOT be modified. readWrite The attribute MAY be updated and read at any time. This is the default value. immutable The attribute MAY be defined at resource creation (e.g., POST) or at record replacement via a request (e.g., a PUT). The attribute SHALL NOT be updated. writeOnly The attribute MAY be updated at any time. Attribute values SHALL NOT be returned (e.g., because the value is a stored hash). Note: An attribute with a mutability of "writeOnly" usually also has a returned setting of "never".
      Returns:
      the mutability value of this node
    • setMutability

      public void setMutability(Mutability mutability)
      A single keyword indicating the circumstances under which the value of the attribute can be (re)defined: readOnly The attribute SHALL NOT be modified. readWrite The attribute MAY be updated and read at any time. This is the default value. immutable The attribute MAY be defined at resource creation (e.g., POST) or at record replacement via a request (e.g., a PUT). The attribute SHALL NOT be updated. writeOnly The attribute MAY be updated at any time. Attribute values SHALL NOT be returned (e.g., because the value is a stored hash). Note: An attribute with a mutability of "writeOnly" usually also has a returned setting of "never".
    • getReturned

      public Returned getReturned()
      A single keyword that indicates when an attribute and associated values are returned in response to a GET request or in response to a PUT, POST, or PATCH request. Valid keywords are as follows: always The attribute is always returned, regardless of the contents of the "attributes" parameter. For example, "id" is always returned to identify a SCIM resource. never The attribute is never returned. This may occur because the original attribute value (e.g., a hashed value) is not retained by the service provider. A service provider MAY allow attributes to be used in a search filter. default The attribute is returned by default in all SCIM operation responses where attribute values are returned. If the GET request "attributes" parameter is specified, attribute values are only returned if the attribute is named in the "attributes" parameter. DEFAULT. request The attribute is returned in response to any PUT, POST, or PATCH operations if the attribute was specified by the client (for example, the attribute was modified). The attribute is returned in a SCIM query operation only if specified in the "attributes" parameter.
      Returns:
      the returned value of this node
    • setReturned

      public void setReturned(Returned returned)
      A single keyword that indicates when an attribute and associated values are returned in response to a GET request or in response to a PUT, POST, or PATCH request. Valid keywords are as follows: always The attribute is always returned, regardless of the contents of the "attributes" parameter. For example, "id" is always returned to identify a SCIM resource. never The attribute is never returned. This may occur because the original attribute value (e.g., a hashed value) is not retained by the service provider. A service provider MAY allow attributes to be used in a search filter. default The attribute is returned by default in all SCIM operation responses where attribute values are returned. If the GET request "attributes" parameter is specified, attribute values are only returned if the attribute is named in the "attributes" parameter. DEFAULT. request The attribute is returned in response to any PUT, POST, or PATCH operations if the attribute was specified by the client (for example, the attribute was modified). The attribute is returned in a SCIM query operation only if specified in the "attributes" parameter.
    • getUniqueness

      public Uniqueness getUniqueness()
      A single keyword value that specifies how the service provider enforces uniqueness of attribute values. A server MAY reject an invalid value based on uniqueness by returning HTTP response code 400 (Bad Request). A client MAY enforce uniqueness on the client side to a greater degree than the service provider enforces. For example, a client could make a value unique while the server has uniqueness of "none". Valid keywords are as follows: none The values are not intended to be unique in any way. DEFAULT. server The value SHOULD be unique within the context of the current SCIM endpoint (or tenancy) and MAY be globally unique (e.g., a "username", email address, or other server-generated key or counter). No two resources on the same server SHOULD possess the same value. global The value SHOULD be globally unique (e.g., an email address, a GUID, or other value). No two resources on any server SHOULD possess the same value.
      Returns:
      the uniqueness value of this node
    • setUniqueness

      public void setUniqueness(Uniqueness uniqueness)
      A single keyword value that specifies how the service provider enforces uniqueness of attribute values. A server MAY reject an invalid value based on uniqueness by returning HTTP response code 400 (Bad Request). A client MAY enforce uniqueness on the client side to a greater degree than the service provider enforces. For example, a client could make a value unique while the server has uniqueness of "none". Valid keywords are as follows: none The values are not intended to be unique in any way. DEFAULT. server The value SHOULD be unique within the context of the current SCIM endpoint (or tenancy) and MAY be globally unique (e.g., a "username", email address, or other server-generated key or counter). No two resources on the same server SHOULD possess the same value. global The value SHOULD be globally unique (e.g., an email address, a GUID, or other value). No two resources on any server SHOULD possess the same value.
    • isMultiValued

      public boolean isMultiValued()
      A Boolean value indicating the attribute's plurality.
      Returns:
      if this node is an ArrayNode or not
    • setMultiValued

      public void setMultiValued(boolean multiValued)
      A Boolean value indicating the attribute's plurality.
    • isRequired

      public boolean isRequired()
      A Boolean value that specifies whether or not the attribute is required.
      Returns:
      if this node is a required value in the resource
    • setRequired

      public void setRequired(boolean required)
      A Boolean value that specifies whether or not the attribute is required.
    • isCaseExact

      public boolean isCaseExact()
      A Boolean value that specifies whether or not a string attribute is case sensitive. The server SHALL use case sensitivity when evaluating filters. For attributes that are case exact, the server SHALL preserve case for any value submitted. If the attribute is case insensitive, the server MAY alter case for a submitted value. Case sensitivity also impacts how attribute values MAY be compared against filter values (see Section 3.4.2.2 of [RFC7644]).
      Returns:
      if the value of this node must be handled case exact or case insensitive
    • setCaseExact

      public void setCaseExact(boolean caseExact)
      A Boolean value that specifies whether or not a string attribute is case sensitive. The server SHALL use case sensitivity when evaluating filters. For attributes that are case exact, the server SHALL preserve case for any value submitted. If the attribute is case insensitive, the server MAY alter case for a submitted value. Case sensitivity also impacts how attribute values MAY be compared against filter values (see Section 3.4.2.2 of [RFC7644]).
    • getCanonicalValues

      public List<String> getCanonicalValues()
      A collection of suggested canonical values that MAY be used (e.g., "work" and "home"). In some cases, service providers MAY choose to ignore unsupported values. OPTIONAL.
      Returns:
      the canonical values of this node
    • setCanonicalValues

      public void setCanonicalValues(List<String> canonicalValues)
      A collection of suggested canonical values that MAY be used (e.g., "work" and "home"). In some cases, service providers MAY choose to ignore unsupported values. OPTIONAL.
    • getReferenceTypes

      public List<ReferenceTypes> getReferenceTypes()
      A multi-valued array of JSON strings that indicate the SCIM resource types that may be referenced. Valid values are as follows: + A SCIM resource type (e.g., "User" or "Group"), + "external" - indicating that the resource is an external resource (e.g., a photo), or + "uri" - indicating that the reference is to a service endpoint or an identifier (e.g., a schema URN). This attribute is only applicable for attributes that are of type "reference" (Section 2.3.7).
      Returns:
      the reference types that are valid for this node. Only important if the ScimNode.getValueType() method returns the value Type.REFERENCE
    • setReferenceTypes

      public void setReferenceTypes(List<ReferenceTypes> referenceTypes)
      A multi-valued array of JSON strings that indicate the SCIM resource types that may be referenced. Valid values are as follows: + A SCIM resource type (e.g., "User" or "Group"), + "external" - indicating that the resource is an external resource (e.g., a photo), or + "uri" - indicating that the reference is to a service endpoint or an identifier (e.g., a schema URN). This attribute is only applicable for attributes that are of type "reference" (Section 2.3.7).
    • getResourceTypeReferenceName

      public Optional<String> getResourceTypeReferenceName()
      Only usable in combination with 'type=reference' and 'resourceTypes=['resource']'. It will bind the attribute to the ID of a specific resource. The value must match the name of a registered 'resourceType' not a 'resource'-name! In case of the /Me endpoint use the value 'Me' not the value 'User'
    • setResourceTypeReferenceName

      public void setResourceTypeReferenceName(String resourceTypeReferenceName)
      Only usable in combination with 'type=reference' and 'resourceTypes=['resource']'. It will bind the attribute to the ID of a specific resource. The value must match the name of a registered 'resourceType' not a 'resource'-name! In case of the /Me endpoint use the value 'Me' not the value 'User'
    • getMultipleOf

      public Optional<Double> getMultipleOf()
      The value of "multipleOf" MUST be a number, strictly greater than 0. A numeric instance is valid only if division by this keyword's value results in an integer.
    • setMultipleOf

      public void setMultipleOf(double multipleOf)
      The value of "multipleOf" MUST be a number, strictly greater than 0. A numeric instance is valid only if division by this keyword's value results in an integer.
    • getMinimum

      public Optional<Double> getMinimum()
      The value of "minimum" MUST be a number, representing an inclusive lower limit for a numeric instance. If the instance is a number, then this keyword validates only if the instance is greater than or exactly equal to "minimum".
    • setMinimum

      public void setMinimum(double minimum)
      The value of "minimum" MUST be a number, representing an inclusive lower limit for a numeric instance. If the instance is a number, then this keyword validates only if the instance is greater than or exactly equal to "minimum".
    • getMaximum

      public Optional<Double> getMaximum()
      The value of "maximum" MUST be a number, representing an inclusive upper limit for a numeric instance. If the instance is a number, then this keyword validates only if the instance is less than or exactly equal to "maximum".
    • setMaximum

      public void setMaximum(double maximum)
      The value of "maximum" MUST be a number, representing an inclusive upper limit for a numeric instance. If the instance is a number, then this keyword validates only if the instance is less than or exactly equal to "maximum".
    • getMaxLength

      public Optional<Long> getMaxLength()
      The value of this keyword MUST be a non-negative integer. A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword. The length of a string instance is defined as the number of its characters as defined by RFC 8259 [RFC8259].
    • setMaxLength

      public void setMaxLength(Long maxLength)
      The value of this keyword MUST be a non-negative integer. A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword. The length of a string instance is defined as the number of its characters as defined by RFC 8259 [RFC8259].
    • getMinLength

      public Optional<Long> getMinLength()
      The value of this keyword MUST be a non-negative integer. A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword. The length of a string instance is defined as the number of its characters as defined by RFC 8259 [RFC8259]. Omitting this keyword has the same behavior as a value of 0.
    • setMinLength

      public void setMinLength(Long minLength)
      The value of this keyword MUST be a non-negative integer. A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword. The length of a string instance is defined as the number of its characters as defined by RFC 8259 [RFC8259]. Omitting this keyword has the same behavior as a value of 0.
    • getPattern

      public Optional<Pattern> getPattern()
      The value of this keyword MUST be a string. This string SHOULD be a valid regular expression, according to the Java regular expression dialect. A string instance is considered valid if the regular expression matches the instance successfully. Recall: regular expressions are not implicitly anchored.
    • setPattern

      public void setPattern(String pattern)
      The value of this keyword MUST be a string. This string SHOULD be a valid regular expression, according to the Java regular expression dialect. A string instance is considered valid if the regular expression matches the instance successfully. Recall: regular expressions are not implicitly anchored.
    • getMinItems

      public Optional<Integer> getMinItems()
      The value of this keyword MUST be a non-negative integer. An array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword. Omitting this keyword has the same behavior as a value of 0.
    • setMinItems

      public void setMinItems(Integer minItems)
      The value of this keyword MUST be a non-negative integer. An array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword. Omitting this keyword has the same behavior as a value of 0.
    • getMaxItems

      public Optional<Integer> getMaxItems()
      The value of this keyword MUST be a non-negative integer. An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword.
    • setMaxItems

      public void setMaxItems(Integer maxItems)
      The value of this keyword MUST be a non-negative integer. An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword.
    • getNotBefore

      public Optional<Instant> getNotBefore()
      a dateTime validation attribute that must not be before the value of this attribute
    • setNotBefore

      public void setNotBefore(String notBefore)
      a dateTime validation attribute that must not be before the value of this attribute
    • setNotBefore

      public void setNotBefore(Instant notBefore)
      a dateTime validation attribute that must not be before the value of this attribute
    • setNotBefore

      public void setNotBefore(LocalDateTime notBefore)
      a dateTime validation attribute that must not be before the value of this attribute
    • setNotBefore

      public void setNotBefore(OffsetDateTime notBefore)
      a dateTime validation attribute that must not be before the value of this attribute
    • getNotAfter

      public Optional<Instant> getNotAfter()
      a dateTime validation attribute that must not be after the value of this attribute
    • setNotAfter

      public void setNotAfter(String notAfter)
      a dateTime validation attribute that must not be after the value of this attribute
    • setNotAfter

      public void setNotAfter(Instant notAfter)
      a dateTime validation attribute that must not be after the value of this attribute
    • setNotAfter

      public void setNotAfter(LocalDateTime notAfter)
      a dateTime validation attribute that must not be after the value of this attribute
    • setNotAfter

      public void setNotAfter(OffsetDateTime notAfter)
      a dateTime validation attribute that must not be after the value of this attribute
    • getDefaultValue

      public String getDefaultValue()
      A default value that is set if the attribute has no value
    • setDefaultValue

      public void setDefaultValue(String defaultValue)
      A default value that is set if the attribute has no value
    • getSubAttributes

      public List<SchemaAttribute> getSubAttributes()
      When an attribute is of type "complex", "subAttributes" defines a set of sub-attributes. "subAttributes" has the same schema sub-attributes as "attributes".
    • getParentHierarchy

      public List<SchemaAttribute> getParentHierarchy()
      gets the attributes in an upside down list with its parents on index 0 until index n which is the leaf node
    • getSchema

      public Schema getSchema()
      a reference to the parent schema that holds this schema attribute
    • getParent

      public SchemaAttribute getParent()
      is used in case of subAttributes
    • getResourceUri

      public String getResourceUri()
      the uri of the resource to which this attribute belongs e.g.: urn:ietf:params:scim:schemas:core:2.0:User
    • equals

      public boolean equals(Object o)
      Description copied from class: ScimObjectNode
      the equals method was overridden because long and integer-nodes might otherwise get comparison failures even if the value is identical
      Overrides:
      equals in class ScimObjectNode
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class com.fasterxml.jackson.databind.node.ObjectNode