com.ibm.tivoli.maximo.dbmanage.statement

Class AttributeStorageDefinition

  • java.lang.Object
    • com.ibm.tivoli.maximo.dbmanage.statement.AttributeStorageDefinition


  • public class AttributeStorageDefinition
    extends java.lang.Object
    Defines the attribute names and storage class of an AttributeStorage.
    See Also:
    AttributeStorage
    • Constructor Detail

      • AttributeStorageDefinition

        public AttributeStorageDefinition(java.lang.String[] names,
                                          AttributeClass[] storage)
        Constructor
        Parameters:
        names - The names of the attributes
        storage - How to store the attribute values. If this parameter is null, all the attributes are assumed to be Strings.
      • AttributeStorageDefinition

        public AttributeStorageDefinition(java.lang.String[] names)
        Helper Constructor to use when all the attributes are Strings.
        Parameters:
        names - The names of the attributes
    • Method Detail

      • getStorageClass

        public AttributeClass getStorageClass(java.lang.String attrName)
        Gets the storage class for an attribute and also validates that the attribute name is recognized.
        Parameters:
        attrName - The Name of the attribute.
        Returns:
        The storage class of the attribute.
        Throws:
        java.lang.RuntimeException - If attribute named doesn't exist.
      • hasAttribute

        public boolean hasAttribute(java.lang.String attrName)
        Is there an attribute defined with this name?
        Parameters:
        attrName - The name of the attribute to check for.
        Returns:
        true if the attribute is defined.
      • getNameIterator

        public java.util.Iterator getNameIterator()
        Return a Iterator through the attribute names.
        Returns:
        an Iterator
      • getNames

        public java.lang.String[] getNames()
        Returns:
      • addDefinition

        public void addDefinition(java.lang.String name,
                                  AttributeClass storage)
        Add another attribute name, storage definition pair
        Parameters:
        name - Name of the attribute
        storage - Storage Class
      • getSelectColumns

        public java.lang.String getSelectColumns()
        Gives the list of column names defined, separated by commas & ready for a select statement
        Returns:
        The columns names formatted with commas.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • expand

        public static AttributeStorageDefinition expand(AttributeStorageDefinition asd,
                                                        java.lang.String addCol,
                                                        AttributeClass addClass)
        Create a new ASD from existing ASD. If the column already exists in the ASD, the original ASD is returned.
        Parameters:
        asd - The ASD to build from. This can be null.
        addCol - The column to add to the ASD
        addClass - The class of the column added
        Returns:
        The ASD with the added column.
      • reduce

        public static AttributeStorageDefinition reduce(AttributeStorageDefinition asd,
                                                        java.lang.String[] removeAttrs)
        Create a new ASD from an existing ASD without the named attributes.

        No error if any attribute name isn't found.

        Parameters:
        asd - The original ASD
        removeAttrs - The attributes to not include in the new ASD.
        Returns:
        The new ASD.
      • equals

        public boolean equals(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • getTableASD

        public static AttributeStorageDefinition getTableASD(java.sql.Connection con,
                                                             java.lang.String tablename)
                                                      throws java.sql.SQLException
        Get the persistent attributes of the named table and their AttributeClass. Ignores attributes that have a maxtype that is not supported by AttributeStorage, like CRYPTO. Ignores nonpersistent attributes.
        Parameters:
        tablename -
        Returns:
        The ASD or null if the table isn't found in MaxAttribute.
        Throws:
        java.sql.SQLException
      • createTableSubsetDefinition

        public AttributeStorageDefinition createTableSubsetDefinition(java.util.List wantedColumns)
        Create an ASD from subset of columns in this ASD.
        Parameters:
        wantedColumns - List of columns to include in the ASD
        Returns:
        The new ASD with just the wanted columns.