psdi.configure

Class IndexElement

  • java.lang.Object
    • org.jdom2.Content
      • org.jdom2.Element
        • psdi.configure.IndexElement
  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, org.jdom2.NamespaceAware, org.jdom2.Parent, UpgConstants


    public class IndexElement
    extends org.jdom2.Element
    implements UpgConstants
    Element to represent an index (maxsysindexes and maxsyskeys) in the XML file that is output by BuildUpgMetadata and input to Upgrade. This is an extension of org.jdom.Element.

    IndexElement is instanciated by the following:

    • When writing XML (BuildUpgMetadata), instanciated from compareIndexMeta and writeOldIndexes. The constructor will populate the IndexElement object appropriately.
    • When reading XML (Upgrade), instanciated from ConfigXMLFactory, via Upgrade. The IndexElement methods getAddSql and getDropSql return sql statements for modifying the index metadata prior to running ConfigDB.
    See Also:
    psdi.upgrade.BuildUpgMetadata, psdi.upgrade.Upgrade, Serialized Form
    • Constructor Detail

      • IndexElement

        protected IndexElement()
      • IndexElement

        public IndexElement(java.lang.String name,
                            org.jdom2.Namespace namespace)
      • IndexElement

        public IndexElement(java.lang.String name)
      • IndexElement

        public IndexElement(java.lang.String name,
                            java.lang.String uri)
      • IndexElement

        public IndexElement(java.lang.String name,
                            java.lang.String prefix,
                            java.lang.String uri)
      • IndexElement

        public IndexElement(java.lang.String tbname,
                            java.lang.String ixname,
                            java.util.HashMap newIndex,
                            java.util.HashMap oldIndex)
                     throws java.lang.Exception
        This constructor is used when creating a new IndexElement for the purpose of writing out XML. It calls buildFromHashMaps.
        Parameters:
        tbname - The table name
        ixname - The index name
        newIndex - The index from the new database.
        oldIndex - The index from the old database.
        Throws:
        java.lang.Exception
        See Also:
        IndexElement.buildFromHashMaps()
    • Method Detail

      • getIndexName

        public java.lang.String getIndexName()
        Get the index name.
        Returns:
        The index name.
      • getIndexAttributes

        public java.util.List getIndexAttributes()
                                          throws java.lang.Exception
        Get the attributes for this IndexElement. Each "attribute" represents a cell from maxsysindexes, and is technically an instance of Element.
        Returns:
        List of index's attributes.
        Throws:
        java.lang.Exception
      • getKeys

        public java.util.List getKeys()
                               throws java.lang.Exception
        Get the keys for this index.
        Returns:
        List of child keys.
        Throws:
        java.lang.Exception
      • getColNames

        public java.lang.String[] getColNames()
                                       throws java.lang.Exception
        Get an array of column names that are in this index.
        Returns:
        Array of column names. If index status is OLDONLY, these are the "old" column names, else these are the "new" column names.
        Throws:
        java.lang.Exception
      • getStatus

        public java.lang.String getStatus()
        Get the value of the index's attribute value "status" (see status). This will equal OLDONLY, NEWONLY, or OLDANDNEW to indicate whether the index exists in the old database, the new database, or both.
        Returns:
        The value of the "status" attribute.
      • getNewChanged

        public java.lang.String getNewChanged()
        Get the new value for maxsysindexes.changed (newChanged).
        Returns:
        The new value for changed.
      • setNewChanged

        public void setNewChanged(java.lang.String in)
        Set the new value for maxsysindexes.changed (newChanged). Possible values on the index are:
        • N = no changes
        • D = drop index
        • Y = new (or changed) index
        Parameters:
        in - The new value for changed.
      • getSequenceName

        public java.lang.String getSequenceName(java.lang.String table,
                                                java.lang.String column)
                                         throws java.lang.Exception
        Get the name of the sequence used to populate a column. Select SequenceName from MaxSequence.
        Parameters:
        table - Name of the table
        column - Name of the column
        Returns:
        Name of the sequence; null if no sequence exists for the column
        Throws:
        java.lang.Exception
      • toHashmap

        public java.util.HashMap toHashmap(java.util.HashMap oldMap)
                                    throws java.lang.Exception
        This method can be used when reading XML to output a HashMap in the format of getIndexMeta.
        Parameters:
        oldMap - The HashMap representing the original values of the index metadata from the customer's database, before applying the XML changes. If this is a new index to be added, then this parameter will be null or empty.
        Returns:
        A HashMap like oldMap, but with the new XML changes applied to it.
        Throws:
        java.lang.Exception