Package org.opensaml.saml.saml2.metadata.impl

# Class RoleDescriptorXSAnyAdapter

java.lang.Object
org.opensaml.core.xml.AbstractXSAnyAdapter
org.opensaml.saml.saml2.metadata.impl.RoleDescriptorXSAnyAdapter

All Implemented Interfaces:
  `AttributeExtensibleXMLObject`, `XMLObject`, `XSAnyAdapter`, `SAMLObject`, `SignableSAMLObject`, `CacheableSAMLObject`, `TimeBoundSAMLObject`, `RoleDescriptor`, `SignableXMLObject`

public class RoleDescriptorXSAnyAdapter extends AbstractXSAnyAdapter implements RoleDescriptor
Component that adapts an instance of `XSAny` to the interface `RoleDescriptor`.

If the 'known' child elements which are explicitly defined on `RoleDescriptor` are mutated via the relevant setter or mutable collection, those changes will be synced back to the adapted `XSAny` instance. Do not modify such children on the adapted instance directly (via `AbstractXSAnyAdapter.getAdapted()` and `ElementExtensibleXMLObject.getUnknownXMLObjects()`). These changes can not and will not be synced back to this adapter. Other child element types specific to the adapted role descriptor sub-type can and must be mutated via calls against the adapted instance directly.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`private class`
`RoleDescriptorXSAnyAdapter.MutableChildrenList<T extends XMLObject>`
Array implementation which causes all XMLObject children of the owning instance to be synced back to the underlying adapted `XSAny` on any list mutation operations.

## Field Summary

Fields
Modifier and Type
Field
Description
`private RoleDescriptorXSAnyAdapter.MutableChildrenList<ContactPerson>`
`contactPersons`
ContactPerson children.
`private Extensions`
`extensions`
Extensions child.
`private RoleDescriptorXSAnyAdapter.MutableChildrenList<KeyDescriptor>`
`keyDescriptors`
KeyDescriptor children.
`private static final Set<QName>`
`KNOWN_CHILD_ELEMENTS`
Set of QNames which are 'known' child element names and managed internally by this implementation.
`private Organization`
`organization`
Organization child.
`private Signature`
`signature`
Signature child.

### Fields inherited from interface org.opensaml.saml.saml2.common.CacheableSAMLObject

`CACHE_DURATION_ATTRIB_NAME, CACHE_DURATION_ATTRIB_QNAME`

### Fields inherited from interface org.opensaml.saml.saml2.metadata.RoleDescriptor

`DEFAULT_ELEMENT_LOCAL_NAME, DEFAULT_ELEMENT_NAME, ERROR_URL_ATTRIB_NAME, ID_ATTRIB_NAME, PROTOCOL_ENUMERATION_ATTRIB_NAME, TYPE_LOCAL_NAME, TYPE_NAME`

### Fields inherited from interface org.opensaml.saml.saml2.common.TimeBoundSAMLObject

`VALID_UNTIL_ATTRIB_NAME, VALID_UNTIL_ATTRIB_QNAME`

## Constructor Summary

Constructors
Constructor
Description
`RoleDescriptorXSAnyAdapter(XSAny xsAny)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`void`
`addSupportedProtocol(String protocol)`
Adds a protocol to the list of supported protocols for this role.
`private List<String>`
`fetchSupportedProtocols()`
Internal method for fetching the supported protocols as a list.
`Duration`
`getCacheDuration()`
Gets the maximum time that this descriptor should be cached.
`List<ContactPerson>`
`getContactPersons()`
Gets list of `ContactPerson`s for this role.
`List<Endpoint>`
`getEndpoints()`
Gets immutable list of endpoints for this role.
`List<Endpoint>`
`getEndpoints(QName type)`
Gets a read-only list of endpoints for this role for the given type.
`String`
`getErrorURL()`
Gets the URI users should be sent to in the event of an error.
`Extensions`
`getExtensions()`
Gets the Extensions child of this object.
`String`
`getID()`
Gets the ID of this role descriptor.
`List<KeyDescriptor>`
`getKeyDescriptors()`
Gets the key descriptors for this role.
`Organization`
`getOrganization()`
Gets the organization responsible for this role.
`Signature`
`getSignature()`
Gets the Signature XMLObject.
`String`
`getSignatureReferenceID()`
Gets the value of the ID attribute for this SAML object which will be used as its signature reference.
`List<String>`
`getSupportedProtocols()`
Gets an immutable list of protocol URIs supported by this role.
`AttributeMap`
`getUnknownAttributes()`
Gets a mutable map of the attributes.
`Instant`
`getValidUntil()`
Gets the date until which this descriptor is valid.
`boolean`
`isSigned()`
Checks to see if the element has been signed.
`boolean`
`isSupportedProtocol(String protocol)`
Chckes to see if the given protocol is supported by this role.
`boolean`
`isValid()`
Checks to see if the current time is past the validUntil time.
`void`
`removeAllSupportedProtocols()`
Removes all the supported protocols from this role.
`void`
`removeSupportedProtocol(String protocol)`
Removes a protocol to the list of supported protocols for this role.
`void`
`removeSupportedProtocols(Collection<String> protocolsToRemove)`
Removes a list of protocols to the list of supported protocols for this role.
`void`
`setCacheDuration(Duration duration)`
Sets the maximum time that this descriptor should be cached.
`void`
`setErrorURL(String errorURL)`
Sets the URI users should be sent to in the event of an error.
`void`
`setExtensions(Extensions newExtensions)`
Sets the Extensions child of this object.
`void`
`setID(String newID)`
Sets the ID of this role descriptor.
`void`
`setOrganization(Organization newOrganization)`
Sets the organization responsible for this role.
`void`
`setSignature(Signature newSignature)`
Sets the Signature XMLObject.
`void`
`setValidUntil(Instant validUntil)`
Sets the date until which this descriptor is valid.
`private void`
`storeSupportedProtocols(List<String> protocols)`
Internal method for storing the list of supported protocols as a string.
`private void`
`syncChildren()`
Synchronize the instance's local child element storage back to the adapted instance of `XSAny`.

### Methods inherited from class org.opensaml.core.xml.AbstractXSAnyAdapter

`detach, ensureDOM, getAdapted, getDOM, getElementQName, getIDIndex, getNamespaceManager, getNamespaces, getNoNamespaceSchemaLocation, getObjectMetadata, getOrderedChildren, getParent, getSchemaLocation, getSchemaType, hasChildren, hasParent, isNil, isNilXSBoolean, releaseChildrenDOM, releaseDOM, releaseParentDOM, resolveID, resolveIDFromRoot, setDOM, setNil, setNil, setNoNamespaceSchemaLocation, setParent, setSchemaLocation`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.opensaml.core.xml.XMLObject

`detach, ensureDOM, getDOM, getElementQName, getIDIndex, getNamespaceManager, getNamespaces, getNoNamespaceSchemaLocation, getObjectMetadata, getOrderedChildren, getParent, getSchemaLocation, getSchemaType, hasChildren, hasParent, isNil, isNilXSBoolean, releaseChildrenDOM, releaseDOM, releaseParentDOM, resolveID, resolveIDFromRoot, setDOM, setNil, setNil, setNoNamespaceSchemaLocation, setParent, setSchemaLocation`

## Field Details

### KNOWN_CHILD_ELEMENTS

private static final Set<QName> KNOWN_CHILD_ELEMENTS
Set of QNames which are 'known' child element names and managed internally by this implementation.

### signature

@Nullable private Signature signature
Signature child.

### extensions

@Nullable private Extensions extensions
Extensions child.

### organization

@Nullable private Organization organization
Organization child.

### keyDescriptors

@Nonnull private RoleDescriptorXSAnyAdapter.MutableChildrenList<KeyDescriptor> keyDescriptors
KeyDescriptor children.

### contactPersons

@Nonnull private RoleDescriptorXSAnyAdapter.MutableChildrenList<ContactPerson> contactPersons
ContactPerson children.

## Constructor Details

### RoleDescriptorXSAnyAdapter

public RoleDescriptorXSAnyAdapter(@Nonnull XSAny xsAny)
Constructor.

Parameters:
  `xsAny` - the instance to adapt

## Method Details

### getSignatureReferenceID

@Nullable public String getSignatureReferenceID()
Gets the value of the ID attribute for this SAML object which will be used as its signature reference.

Specified by:
  `getSignatureReferenceID` in interface `SignableSAMLObject`
Returns:
  the value of this SAMLObject ID attribute

### isSigned

public boolean isSigned()
Checks to see if the element has been signed.

Specified by:
  `isSigned` in interface `SignableXMLObject`
Returns:
  true iff this element is signed

### getSignature

@Nullable public Signature getSignature()
Gets the Signature XMLObject.

Specified by:
  `getSignature` in interface `SignableXMLObject`
Returns:
  the Signature XMLObject

### setSignature

public void setSignature(@Nullable Signature newSignature)
Sets the Signature XMLObject.

Specified by:
  `setSignature` in interface `SignableXMLObject`
Parameters:
  `newSignature` - the Signature XMLObject

### isValid

public boolean isValid()
Checks to see if the current time is past the validUntil time.

Specified by:
  `isValid` in interface `TimeBoundSAMLObject`
Returns:
  true of this descriptor is still valid otherwise false

### getValidUntil

public Instant getValidUntil()
Gets the date until which this descriptor is valid.

Specified by:
  `getValidUntil` in interface `TimeBoundSAMLObject`
Returns:
  the date until which this descriptor is valid

### setValidUntil

public void setValidUntil(@Nullable Instant validUntil)
Sets the date until which this descriptor is valid.

Specified by:
  `setValidUntil` in interface `TimeBoundSAMLObject`
Parameters:
  `validUntil` - the date until which this descriptor is valid

### getCacheDuration

public Duration getCacheDuration()
Gets the maximum time that this descriptor should be cached.

Specified by:
  `getCacheDuration` in interface `CacheableSAMLObject`
Returns:
  the maximum time that this descriptor should be cached

### setCacheDuration

public void setCacheDuration(@Nullable Duration duration)
Sets the maximum time that this descriptor should be cached.

Specified by:
  `setCacheDuration` in interface `CacheableSAMLObject`
Parameters:
  `duration` - the maximum time that this descriptor should be cached

### getUnknownAttributes

@Nonnull public AttributeMap getUnknownAttributes()
Gets a mutable map of the attributes. The map key is the namespace qualified name of the attribute, the map value is the value of the attribute.

Specified by:
  `getUnknownAttributes` in interface `AttributeExtensibleXMLObject`
Returns:
  a map of the attributes

### getID

@Nullable public String getID()
Gets the ID of this role descriptor.

Specified by:
  `getID` in interface `RoleDescriptor`
Returns:
  the ID of this role descriptor

### setID

public void setID(@Nullable String newID)
Sets the ID of this role descriptor.

Specified by:
  `setID` in interface `RoleDescriptor`
Parameters:
  `newID` - the ID of this role descriptor

### fetchSupportedProtocols

@Nonnull private List<String> fetchSupportedProtocols()
Internal method for fetching the supported protocols as a list.

Returns:
  the list, possibly empty

### storeSupportedProtocols

private void storeSupportedProtocols(@Nonnull List<String> protocols)
Internal method for storing the list of supported protocols as a string.

Parameters:
  `protocols` - the list of protocols

### getSupportedProtocols

@Nonnull @Unmodifiable @NotLive public List<String> getSupportedProtocols()
Gets an immutable list of protocol URIs supported by this role.

Specified by:
  `getSupportedProtocols` in interface `RoleDescriptor`
Returns:
  list of protocol URIs supported by this role

### isSupportedProtocol

public boolean isSupportedProtocol(@Nonnull String protocol)
Chckes to see if the given protocol is supported by this role.

Specified by:
  `isSupportedProtocol` in interface `RoleDescriptor`
Parameters:
  `protocol` - the protocol
Returns:
  true if the protocol is supported, false if not

### addSupportedProtocol

public void addSupportedProtocol(@Nonnull String protocol)
Adds a protocol to the list of supported protocols for this role.

Specified by:
  `addSupportedProtocol` in interface `RoleDescriptor`
Parameters:
  `protocol` - the protocol

### removeSupportedProtocol

public void removeSupportedProtocol(@Nonnull String protocol)
Removes a protocol to the list of supported protocols for this role.

Specified by:
  `removeSupportedProtocol` in interface `RoleDescriptor`
Parameters:
  `protocol` - the protocol

### removeSupportedProtocols

public void removeSupportedProtocols(@Nonnull Collection<String> protocolsToRemove)
Removes a list of protocols to the list of supported protocols for this role.

Specified by:
  `removeSupportedProtocols` in interface `RoleDescriptor`
Parameters:
  `protocolsToRemove` - the protocol

### removeAllSupportedProtocols

public void removeAllSupportedProtocols()
Removes all the supported protocols from this role.

Specified by:
  `removeAllSupportedProtocols` in interface `RoleDescriptor`

### getErrorURL

@Nullable public String getErrorURL()
Gets the URI users should be sent to in the event of an error.

Specified by:
  `getErrorURL` in interface `RoleDescriptor`
Returns:
  the URI users should be sent to in the event of an error

### setErrorURL

public void setErrorURL(@Nullable String errorURL)
Sets the URI users should be sent to in the event of an error.

Specified by:
  `setErrorURL` in interface `RoleDescriptor`
Parameters:
  `errorURL` - the URI users should be sent to in the event of an error

### getExtensions

@Nullable public Extensions getExtensions()
Gets the Extensions child of this object.

Specified by:
  `getExtensions` in interface `RoleDescriptor`
Returns:
  the Extensions child of this object

### setExtensions

public void setExtensions(@Nullable Extensions newExtensions)
Sets the Extensions child of this object.

Specified by:
  `setExtensions` in interface `RoleDescriptor`
Parameters:
  `newExtensions` - the Extensions child of this object

### getOrganization

@Nullable public Organization getOrganization()
Gets the organization responsible for this role.

Specified by:
  `getOrganization` in interface `RoleDescriptor`
Returns:
  the organization responsible for this role

### setOrganization

public void setOrganization(@Nullable Organization newOrganization)
Sets the organization responsible for this role.

Specified by:
  `setOrganization` in interface `RoleDescriptor`
Parameters:
  `newOrganization` - the organization responsible for this role

### getKeyDescriptors

@Nonnull @Live public List<KeyDescriptor> getKeyDescriptors()
Gets the key descriptors for this role.

Specified by:
  `getKeyDescriptors` in interface `RoleDescriptor`
Returns:
  the key descriptors for this role

### getContactPersons

@Nonnull @Live public List<ContactPerson> getContactPersons()
Gets list of `ContactPerson`s for this role.

Specified by:
  `getContactPersons` in interface `RoleDescriptor`
Returns:
  list of `ContactPerson`s for this role

### getEndpoints

@Nonnull @NotLive @Unmodifiable public List<Endpoint> getEndpoints()
Gets immutable list of endpoints for this role.

Specified by:
  `getEndpoints` in interface `RoleDescriptor`
Returns:
  immutable list of endpoints for this role

### getEndpoints

@Nonnull @NotLive @Unmodifiable public List<Endpoint> getEndpoints(@Nonnull QName type)
Gets a read-only list of endpoints for this role for the given type.

Specified by:
  `getEndpoints` in interface `RoleDescriptor`
Parameters:
  `type` - the type of endpoints to retrieve
Returns:
  immutable list of endpoints for this role

### syncChildren

private void syncChildren()
Synchronize the instance's local child element storage back to the adapted instance of `XSAny`.