Class AttributeContainer

java.lang.Object
com.tivoli.am.fim.trustserver.sts.uuser.AttributeContainer
Direct Known Subclasses:
AttributeList, AttributeStatement, ContextAttributes, Group, Principal, RequestSecurityToken

public abstract class AttributeContainer extends Object
Container for Attributes. Used as a base class for STS Universal User types that hold attributes.
Version:
@VERSION@
  • Field Details

  • Constructor Details

    • AttributeContainer

      public AttributeContainer()
      Constructs an AttributeContainer object.
    • AttributeContainer

      public AttributeContainer(Attribute[] attributes)
      Constructs an AttributeContainer using an array of Attribute objects.
      Parameters:
      attributes - an array of Attribute objects
  • Method Details

    • getAttributes

      public Attribute[] getAttributes()
      Returns an Attribute array containing this AttributeContainers Attribute objects.
      Returns:
      an Attribute array containing this AttributeContainers Attribute objects.
    • setAttributes

      public final void setAttributes(Attribute[] attributes)
      Sets the attributes in this AttributeContainer using the supplied Attribute array.
      Parameters:
      attributes - an Attribute[] of Attributes to be added to this AttributeContainer.
    • getAttributeValueByName

      public String getAttributeValueByName(String attributeName)
      Return the first attribute value as a String based on the attribute name String provided.
      Parameters:
      attributeName - the name of an attribute
      Returns:
      the first attribute value, as a String, of the attribute name provided. Returns null if the attribute name is not present in this AttributeContainer.
    • getAttributeValueByNameAndType

      public String getAttributeValueByNameAndType(String attributeName, String attributeType)
      Return the first attribute value as a String based on the attribute name and type provided.
      Parameters:
      attributeName - the name of an attribute
      attributeType - the type of the attribute
      Returns:
      the first attribute value, as a String, of the attribute name provided. Returns null if the attribute name is not present in this AttributeContainer.
    • getAttributeValuesByName

      public String[] getAttributeValuesByName(String attributeName)
      Returns a String array of attribute values based on the attribute name String provided.
      Parameters:
      attributeName - the name of an attribute
      Returns:
      a String array of attribute values based on the attribute name String provided. Returns null if the attribute name is not present in this AttributeContainer.
    • getAttributeByName

      public Attribute getAttributeByName(String attributeName)
      Returns an Attribute from this AttributeContainer based on the AttributeName string provided.
      Parameters:
      attributeName - the name of an attribute
      Returns:
      the Attribute from this AttributeContainer based on the attribute name String provided. Returns null if the attribute name is not present in this AttributeContainer.
    • getAttributesByType

      public Attribute[] getAttributesByType(String attributeType)
      Returns an array of attributes from this AttributeContainer based on the specified attribute type
      Parameters:
      attributeType - the type of the attribute(s) to be returned
      Returns:
      An array of attributes from this AttributeContainer based on the specified attribute type. provided. Returns null if no matching attributes present in this AttributeContainer.
    • getAttributeByNameAndType

      public Attribute getAttributeByNameAndType(String name, String type)
      Returns an Attribute from this AttributeContainer based on the name string and type string provided.
      Parameters:
      name - the name of an Attribute
      type - the type of Attribute
      Returns:
      the Attribute from this AttributeContainer based on the attribute name string and type string provided. Returns null if the attribute name and type is not present in this AttributeContainer.
    • getAttributeValuesByNameAndType

      public String[] getAttributeValuesByNameAndType(String name, String type)
      Returns Attribute values as a String array from this AttributeContainer based on the name string and type string provided.
      Parameters:
      name - the name of an Attribute
      type - the type of Attribute
      Returns:
      the attribute values as a String array from this AttributeContainer based on the attribute name string and type string provided. Returns null if the attribute name and type is not present in this AttributeContainer.
    • removeAttributeByNameAndType

      public String[] removeAttributeByNameAndType(String name, String type)
      Removes an Attribute from this AttributeContainer based on the name string and type string provided. Returns the Attribute values as a String array the Attribute was found in this AttributeContainer.
      Parameters:
      name - the name of an Attribute
      type - the type of Attribute
      Returns:
      the attribute values as a String array from this AttributeContainer based on the attribute name string and type string provided. Returns null if the attribute name and type is not present in this AttributeContainer.
    • removeAttribute

      public boolean removeAttribute(Attribute attr)
      Removes an Attribute from this AttributeContainer based on the Attribute provided (Matches on the name and type). Returns true if the attribute was found and removed, otherwise returns false.
      Parameters:
      attr - the Attribute to remove from this AttributeContainer.
      Returns:
      true if the attribute was found and removed, otherwise returns false.
    • setAttribute

      public String[] setAttribute(String name, String type, String[] values)
      Sets an Attribute in this AttributeContainer based on the name, type and String array of values provided.
      Parameters:
      name - the name of the attribute
      type - the Attribute type
      values - a String array of attribute values
      Returns:
      the values as a String array of the Attribute
    • setAttribute

      public String[] setAttribute(String name, String type, String nickname, String[] values)
      Sets an Attribute in this AttributeContainer based on the name, type and String array of values provided.
      Parameters:
      name - the name of the Attribute to be added to this AttributeContainer
      type - the Attribute type
      nickname - the nickname of the Attribute to be added to this AttributeContainer
      values - a String array of attribute values
      Returns:
      the values as a String array of the Attribute added to or modified in this AttributeContainer.
    • setAttribute

      public Node[] setAttribute(String name, String type, Node[] values)
      Set attributes in this AttributeContainer based on the name, type and Node array values provided.
      Parameters:
      name - the Attribute name
      type - the type of Attribute
      values - the values of the Attribute to be added to this AttributeContainer as an array of Nodes.
      Returns:
      a Node array of the values of the Attribute added to this AttributeContainer.
    • setAttribute

      public void setAttribute(String name, String type, String nickname, String[] values, Node[] nodes)
      Set attributes in this AttributeContainer based on the name, type and Node array values provided.
      Parameters:
      name - the Attribute name to be set in the AttributeContainer
      type - the type of Attribute to be set in the AttributeContainer
      nickname - the nickname of the Attribute to be set in the AttributeContainer
      values - the values of the Attribute to be added to this AttributeContainer as an array of Strings.
      nodes - the values of the Attribute to be added to this AttributeContainer as an array of Nodes.
    • setAttribute

      public Node[] setAttribute(String name, String type, String nickname, Node[] values)
      Set attributes in this AttributeContainer based on the name, type, nickname and Node array values provided.
      Parameters:
      name - the Attribute name
      type - the type of Attribute
      nickname - the nickname of the Attribute
      values - the values of the Attribute to be added to this AttributeContainer as an array of Nodes.
      Returns:
      a Node array of the values of the Attribute added to this AttributeContainer.
    • setAttribute

      public Attribute setAttribute(Attribute attr)
      Sets an attribute in this AttributeContainer based on the Attribute provided.
      Parameters:
      attr - the Attribute to set in this AttributeContainer.
      Returns:
      the Attribute set in this AttributeContainer.
    • getAttributeIterator

      public Iterator getAttributeIterator()
      Returns an Iterator over the values in this Attribute container.
      Returns:
      an Iterator over the values in this Attribute container.
    • getNumberOfAttributes

      public int getNumberOfAttributes()
      Returns the number of Attributes in this AttributeContainer.
      Returns:
      the number of Attributes in this AttributeContainer.
    • clear

      public void clear()
      Clears this AttributeContainer.
    • removeAttributes

      public int removeAttributes(String name, String type)
      Return attributes that match name and type. If either input is null, it'll match any value. Effectively name = null invalid input: '&'invalid input: '&' type = null is clear()
      Parameters:
      name - The name to match or null to match all
      type - The type to match or null to match all
      Returns:
      The number of attributes removed.
    • attributesFromXml

      public static Attribute[] attributesFromXml(Element element)
      Adds the Attributes from the Element to this AttributeContainer.
      Parameters:
      element - the element which contains attributes to add to this AttributeContainer.
      Returns:
      an array of Attributes added to this AttributeContainer or null if element is null.
    • toXml

      public Element toXml(Document owner)
      Converts this AttributeContainer to XML in the form of an org.w3c.dom.Element object.
      Parameters:
      owner - owner XML Document
      Returns:
      the XML in the form of an org.w3c.dom.Element object.