psdi.configure

Class SysDataElement

  • java.lang.Object
    • org.jdom2.Content
      • org.jdom2.Element
        • psdi.configure.SysDataElement
  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, org.jdom2.NamespaceAware, org.jdom2.Parent, UpgConstants
    Direct Known Subclasses:
    SysDataElementALNDOMAIN, SysDataElementMAXAPPS, SysDataElementMAXMENU, SysDataElementMAXMESSAGES, SysDataElementMAXPROP, SysDataElementMAXRELATIONSHIP, SysDataElementMAXVARTYPE, SysDataElementSYNONYMDOMAIN


    public class SysDataElement
    extends org.jdom2.Element
    implements UpgConstants
    Element to represent a system data table (maxapps, sigoption, maxvars, etc.) in the XML file that is output by BuildUpgMetadata and input to Upgrade. This is an extension of org.jdom.Element.

    SysDataElement is instanciated by the following:

    • When writing XML (BuildUpgMetadata), instanciated from compareSystemData. The constructor will populate the SysDataElement object appropriately.
    • When reading XML (Upgrade), instanciated from ConfigXMLFactory, via Upgrade. The SysDataElement method getSql returns sql statements for populating the data tables appropriately, after having run ConfigDB.

    This class can be extended if special processing is required for any of these tables (such as an override to the getSql method). If this is extended, the class name should be SysDataElement + tbname so that ConfigXMLFactory can find the class -- for example, SysDataElementMYTABLE. If so named, the ConfigXMLFactory will find the appropriate class dynamically. Otherwise, you must modify ConfigXMLFactory.

    This class contains some very minimal special processing for tables SIGOPTION, MAXAPPS, MXCOLLAB, and MXCOLLABREF. If more extensive special processing is anticipated for any table, it would be preferable to extend this class class specifically for that table. The names of the tables processed by this class are stored in SYSDATATABLES.

    Multisite functionality is handled by the presence or absence of siteid/orgid in the primary unique index.

    The default processing in SysDataElement presumes that the columns in the primary unique index have not changed from the old to the new database. If the index has changed, this class will have to be extended, with the new instance residing in the subdirectory with the old database name. For example, if the key to the MaxVars table has changed, you will need a class psdi.configure.V520.SysDataElementMAXVARS. The extension can then perform the processing needed to support the key structure conversion between specific releases.

    This class supports the following special codes during the Upgrade. If any additional codes are supported in the future, they should be documented here and in the UpgCodes file in PVCS. Also see comments in BuildUpgMetadata.

    Table NameAttribute NameDescription
    SIGOPTIONoptionvalueWhen upgrading the SIGOPTION table, if rows are being inserted, then NO rows are automatically inserted into ApplicationAuth. If a different optionvalue is desired for these inserted rows, the value can be specified in the UpgCodes XML file that is input to BuildUpgMetadata. The value would be specified under SIGOPTION KEY, with attribute named "optionvalue". For example:

    <SIGOPTION tbname="SIGOPTION">
    <
    KEY key="PO|DUPLICATE" APP="PO" OPTIONNAME="DUPLICATE" optionvalue = "1">
    <
    /KEY>
    <
    /SIGOPTION>

    See Also:
    psdi.configure.BuildUpgMetadata, psdi.configure.Upgrade, UpgConstants.SYSDATATABLES, Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.jdom2.Content

        org.jdom2.Content.CType
    • Constructor Summary

      Constructors 
      Constructor and Description
      SysDataElement() 
      SysDataElement(java.lang.String name) 
      SysDataElement(java.lang.String name, org.jdom2.Namespace namespace) 
      SysDataElement(java.lang.String name, java.lang.String uri) 
      SysDataElement(java.lang.String name, java.lang.String prefix, java.lang.String uri) 
      SysDataElement(java.lang.String tbname, java.util.TreeMap newCol, java.util.TreeMap oldCol, java.util.TreeMap newData, java.util.TreeMap oldData, java.util.TreeMap newDataOldKeys, java.util.TreeMap keyCols, java.io.File codefile)
      This constructor is used when creating a new Element for the purpose of writing out XML.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addCodes(org.jdom2.Element row, java.lang.String key)
      Get the element from UpgCodes.xml, add any special codes from the row header to this XML output.
      org.jdom2.Element addCodesExtension(org.jdom2.Element row, org.jdom2.Element codeEl)
      This class is called from addCodes when generating XML.
      void addOneRow(java.lang.String key, java.util.HashMap newVals)
      When generating XML, and the column exists only in the new database, this method is used to add its attributes.
      void buildFromHashMaps()
      When generating XML, given the TreeMaps newData and oldData, build the elements needed to be output from BuildUpgMetadata.
      boolean canUpdateColumn(java.lang.String name)
      Called from compareRows and updateRow to determine whether a particular column should be identified in the XML output and can be updated during the Upgrade.
      java.util.ArrayList compareRows(org.jdom2.Element row, java.util.TreeMap colsColno)
      When reading XML, this method determines what updates or inserts are needed.
      void compareRows(java.lang.String key, java.util.HashMap newVals, java.util.HashMap oldVals)
      When generating XML, and the key exists both the new and old database, this method is used to compare and add its attributes to this SysDataElement, when the values are different.
      java.util.ArrayList deleteRow(org.jdom2.Element row)
      When reading XML, and the row needs to be deleted from the customer's database, return the sql statement for deleting the row.
      java.util.ArrayList deleteRowExtension(org.jdom2.Element row, java.util.ArrayList list)
      This class is called from deleteRow when reading XML.
      boolean domainInUse(java.lang.String domainID)
      Determine if a domain is referenced by any objects.
      void executeQuery(java.lang.String sql) 
      org.jdom2.Element getAttribute(org.jdom2.Element row, java.lang.String attrName)
      Get a particular attribute element for this ColumnElement.
      java.util.ArrayList getChunkUpdates(org.jdom2.Element row, java.lang.String colName, java.lang.String colValue, int chunkSize)
      Called from insertRow when data exceeds a specified length.
      java.util.ArrayList getDeleteSql(java.lang.String tbname, java.sql.Connection con, Util util, java.util.TreeMap oldCol, java.util.TreeMap keyCols)
      When reading XML, return a series of sql statements to update the customer's database.
      java.util.List getKeys()
      Get the keys for this SysDataElement.
      long getMaxReserved(org.jdom2.Element row)
      Get the current highest value for the column referenced by this sequence.
      int getNextVal(java.lang.String tableName, java.lang.String columnName)
      Get the next sequential value for a column.
      java.lang.String getSequenceName(java.lang.String tableName, java.lang.String columnName)
      Get the name of the sequence that corresponds to this table and column.
      java.util.ArrayList getSql(java.lang.String tbname, java.sql.Connection con, Util util, java.util.TreeMap oldCol, java.util.TreeMap keyCols)
      When reading XML, return a series of sql statements to update the customer's database.
      java.lang.String getStatus()
      Get the value of the column's attribute value "status" (see status).
      java.lang.String getTableName()
      Get the table name.
      org.jdom2.Element getUpgCodesElement(java.lang.String key)
      Assuming the UpgCodes.xml file has been defined via setUpgCodes, find the element that has the specified key value.
      java.lang.String getWhereClause(org.jdom2.Element row, boolean useSiteOrg, java.lang.String siteid, java.lang.String orgid)
      When reading XML, generate the Where clause to use in a Sql statement (for delete or update).
      boolean haveDup(org.jdom2.Element checkEl)
      When generating XML, before adding an element, check to see if we already have a duplicate.
      void initSequence(java.lang.String tableName)
      Initialize static variable uniqueValue.
      java.util.ArrayList insertRow(org.jdom2.Element row, java.lang.String siteid, java.lang.String orgid)
      When reading XML, and the row needs to be added to the customer's database, this method returns the Sql statement for inserting the row.
      java.util.ArrayList insertRowExtension(org.jdom2.Element row, java.lang.String siteid, java.lang.String orgid, java.util.ArrayList list)
      This class is called from insertRow when reading XML.
      boolean isUniqueColumnID(java.lang.String columnName)
      Detertmine if this column is the unique column id for the table.
      void loadDoNotUpdateCols()
      Called from the constructor and getSql, this loads doNotUpdateCols with the appropriate value from UpgConstants.
      void removeOneRow(java.lang.String key, java.util.HashMap oldVals)
      When generating XML, and the column exists only in the old database, this method is used to indicate its removal.
      void scanKeyCols()
      Determine whether the unique index to this table contains siteid and/or orgid.
      void setKeyAttributes(org.jdom2.Element row, java.util.HashMap rowValues)
      When generating XML, create attributes where name = column name and value = column value, for each column in the primary unique index.
      void setStatus(java.lang.String status)
      Set value for the attribute "status" and assign that value to the status variable.
      void setTableName(java.lang.String tableName)
      Set value for the attribute "tbname" and assign that value to the tbname variable.
      void setUpgCodes(java.io.File codefile)
      When creating XML, this should be called to point to the file UpgCodes.xml, where special codes can be retrieved.
      java.util.ArrayList updateRow(org.jdom2.Element row, java.util.HashMap currentData, java.lang.String siteid, java.lang.String orgid)
      When reading XML, and the row needs to be updated on the customer's database, this method returns the Sql statement for updating the row.
      java.util.ArrayList updateRowExtension(org.jdom2.Element row, java.util.HashMap currentData, java.lang.String siteid, java.lang.String orgid, java.util.ArrayList list)
      This class is called from updateRow when reading XML.
      • Methods inherited from class org.jdom2.Element

        addContent, addContent, addContent, addContent, addContent, addNamespaceDeclaration, canContainContent, clone, cloneContent, coalesceText, detach, getAdditionalNamespaces, getAttribute, getAttribute, getAttributes, getAttributesSize, getAttributeValue, getAttributeValue, getAttributeValue, getAttributeValue, getChild, getChild, getChildren, getChildren, getChildren, getChildText, getChildText, getChildTextNormalize, getChildTextNormalize, getChildTextTrim, getChildTextTrim, getContent, getContent, getContent, getContentSize, getDescendants, getDescendants, getName, getNamespace, getNamespace, getNamespacePrefix, getNamespacesInherited, getNamespacesInScope, getNamespacesIntroduced, getNamespaceURI, getQualifiedName, getText, getTextNormalize, getTextTrim, getValue, getXMLBaseURI, hasAdditionalNamespaces, hasAttributes, indexOf, isAncestor, isRootElement, removeAttribute, removeAttribute, removeAttribute, removeChild, removeChild, removeChildren, removeChildren, removeContent, removeContent, removeContent, removeContent, removeNamespaceDeclaration, setAttribute, setAttribute, setAttribute, setAttributes, setContent, setContent, setContent, setContent, setName, setNamespace, setText, sortAttributes, sortChildren, sortContent, sortContent, toString
      • Methods inherited from class org.jdom2.Content

        equals, getCType, getDocument, getParent, getParentElement, hashCode, setParent
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.jdom2.Parent

        getDocument, getParent
    • Constructor Detail

      • SysDataElement

        public SysDataElement()
      • SysDataElement

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

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

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

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

        public SysDataElement(java.lang.String tbname,
                              java.util.TreeMap newCol,
                              java.util.TreeMap oldCol,
                              java.util.TreeMap newData,
                              java.util.TreeMap oldData,
                              java.util.TreeMap newDataOldKeys,
                              java.util.TreeMap keyCols,
                              java.io.File codefile)
                       throws java.lang.Exception
        This constructor is used when creating a new Element for the purpose of writing out XML. It calls buildFromHashMaps.
        Parameters:
        tbname - The name of the table. See tbname.
        newCol - The column metadata on this table, from the new database. See newCol.
        oldCol - The column metadata on this table, from the old database. See oldCol.
        newData - The data from the new database. See newData.
        oldData - The data from the old database. See oldData.
        keyCols - Key columns for this table. See keyCols.
        codefile - The file UpgCodes.xml that may contain special codes for rows in this table. There is no error if this is null.
        Throws:
        java.lang.Exception
        See Also:
        SysDataElement.scanKeyCols(), SysDataElement.loadDoNotUpdateCols(), SysDataElement.setUpgCodes(java.io.File), SysDataElement.buildFromHashMaps()
    • Method Detail

      • loadDoNotUpdateCols

        public void loadDoNotUpdateCols()
                                 throws java.lang.Exception
        Called from the constructor and getSql, this loads doNotUpdateCols with the appropriate value from UpgConstants.
        Throws:
        java.lang.Exception
      • getTableName

        public java.lang.String getTableName()
        Get the table name.
        Returns:
        The table name.
      • setTableName

        public void setTableName(java.lang.String tableName)
        Set value for the attribute "tbname" and assign that value to the tbname variable.
      • setKeyAttributes

        public void setKeyAttributes(org.jdom2.Element row,
                                     java.util.HashMap rowValues)
                              throws java.lang.Exception
        When generating XML, create attributes where name = column name and value = column value, for each column in the primary unique index. This uses keyCols.
        Parameters:
        row - The Element representing a particular row in a table.
        rowValues - The HashMap of the data values for this row.
        Throws:
        java.lang.Exception
      • haveDup

        public boolean haveDup(org.jdom2.Element checkEl)
                        throws java.lang.Exception
        When generating XML, before adding an element, check to see if we already have a duplicate. This could occur if we have a multisite database. For example, if we want to add doctype "ABC" our database may have it for site 1 and site 2. We would want to add only one element specifying to add doctype "ABC". Such duplicates may be found only when the key includes siteid or orgid. If the key does not contain siteid or orgid, this method will always return False.
        Parameters:
        checkEl - The element that we've constructed but not yet added.
        Returns:
        True if this element is a duplicate, else False. This will always return False when the key does not contain siteid or orgid.
        Throws:
        java.lang.Exception
      • getKeys

        public java.util.List getKeys()
                               throws java.lang.Exception
        Get the keys for this SysDataElement. Each "key" represents a row from this table, and is technically an instance of Element. Each key contains the following:
        • Attribute "key", value = key column values for this row delimited by "|". Format for key is also described in getData.
        • Attribute "status", value = NEWONLY, OLDONLY, or OLDANDNEW. This identifies whether the row existed in the old database, the new database, or both.
        • Attributes where name = column name (uppercase) and value = column value, for each column in the primary unique index for this row.
        • Child elements named ATTRIBUTE for each column on the table, each containing the column name ("name"), value from new database ("new") and/or value from old database ("old").
        • Other optional attributes copied from UpgCodes.xml by the BuildUpgMetadata program.
        Returns:
        List of key elements.
        Throws:
        java.lang.Exception
      • getAttribute

        public org.jdom2.Element getAttribute(org.jdom2.Element row,
                                              java.lang.String attrName)
                                       throws java.lang.Exception
        Get a particular attribute element for this ColumnElement.
        Parameters:
        attrName - The attribute name (case sensitive), for example COLUMNTITLE, DEFAULTVALUE, etc.
        Returns:
        The element that represents that attribute.
        Throws:
        java.lang.Exception
      • getSql

        public java.util.ArrayList getSql(java.lang.String tbname,
                                          java.sql.Connection con,
                                          Util util,
                                          java.util.TreeMap oldCol,
                                          java.util.TreeMap keyCols)
                                   throws java.lang.Exception
        When reading XML, return a series of sql statements to update the customer's database.
        • For any other XML status
          • If the row does not currently exist, it will be added.
          • If the row DOES exist, the values will be compared, and any old value not equal to the XML new value will be updated.

        If different update logic is needed for a particular table, this class can be extended and this method overridden.

        Parameters:
        tbname - The table name. See tbname.
        con - The connection to the database being upgraded. See con.
        util - Reference to the Util class. See util.
        oldCol - TreeMap of the data structure for the columns on this table (key = column name). (This is retrieved AFTER ConfigDB may have updated the format.) See oldCol.
        keyCols - The key columns for this table. See keyCols.
        Returns:
        Series of sql statements
        Throws:
        java.lang.Exception
        See Also:
        SysDataElement.loadDoNotUpdateCols(), SysDataElement.scanKeyCols(), SysDataElement.compareRows(Element, TreeMap)
      • getDeleteSql

        public java.util.ArrayList getDeleteSql(java.lang.String tbname,
                                                java.sql.Connection con,
                                                Util util,
                                                java.util.TreeMap oldCol,
                                                java.util.TreeMap keyCols)
                                         throws java.lang.Exception
        When reading XML, return a series of sql statements to update the customer's database.
        • If the XML status is OLDONLY, the sql will delete from table for that row.

        If different update logic is needed for a particular table, this class can be extended and this method overridden.

        Parameters:
        tbname - The table name. See tbname.
        con - The connection to the database being upgraded. See con.
        util - Reference to the Util class. See util.
        oldCol - TreeMap of the data structure for the columns on this table (key = column name). (This is retrieved AFTER ConfigDB may have updated the format.) See oldCol.
        keyCols - The key columns for this table. See keyCols.
        Returns:
        Series of sql statements
        Throws:
        java.lang.Exception
        See Also:
        SysDataElement.loadDoNotUpdateCols(), SysDataElement.scanKeyCols(), SysDataElement.deleteRow(org.jdom2.Element)
      • getWhereClause

        public java.lang.String getWhereClause(org.jdom2.Element row,
                                               boolean useSiteOrg,
                                               java.lang.String siteid,
                                               java.lang.String orgid)
                                        throws java.lang.Exception
        When reading XML, generate the Where clause to use in a Sql statement (for delete or update). This uses keyCols to identify the names of the key columns.
        Parameters:
        row - The Element representing a row in the database.
        useSiteOrg - If the primary key includes siteid and/or orgid, and this param is True, then the value or siteid/orgid will be included in the Where clause. If this param is False, or the primary key does not contain siteid/orgid, then the Where clause will not have any constraint for siteid/orgid.
        siteid - If this is null, and the Where clause includes siteid, the method uses the siteid from the row Element, otherwise it uses the value of this param. If this equals the empty string (""), the Where clause will specify "siteid is null".
        orgid - If this is null, and the Where clause includes orgid, the method uses the orgid from the row Element, otherwise it uses the value of this param. If this equals the empty string (""), the Where clause will specify "orgid is null".
        Returns:
        The Where clause (not including the word "where").
        Throws:
        java.lang.Exception
      • getStatus

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

        public void setStatus(java.lang.String status)
        Set value for the attribute "status" and assign that value to the status variable.
      • deleteRow

        public java.util.ArrayList deleteRow(org.jdom2.Element row)
                                      throws java.lang.Exception
        When reading XML, and the row needs to be deleted from the customer's database, return the sql statement for deleting the row. Called from getSql.

        If this is SIGOPTION, also delete from APPLICATIONAUTH. If this is MXCOLLABREF, also delete from MXCOLLAB.

        Parameters:
        row - The element from the input XML representing a row in this table. This is an ArrayList so that extensions of this class can provide more than one Sql statement if needed, e.g. for parent/child tables.
        Returns:
        A "delete from..." sql statement. There will be no siteid/orgid condition, so it may delete multiple rows.
        Throws:
        java.lang.Exception
        See Also:
        SysDataElement.deleteRowExtension(org.jdom2.Element, java.util.ArrayList)
      • deleteRowExtension

        public java.util.ArrayList deleteRowExtension(org.jdom2.Element row,
                                                      java.util.ArrayList list)
                                               throws java.lang.Exception
        This class is called from deleteRow when reading XML. It is a placeholder so that extensions of SysDataElement have a ready-made method in which to code additional delete logic. In SysDataElement, it does nothing.
        Parameters:
        row - The XML element representing the deletion.
        list - The array of Sql statements which may already contain entries from deleteRow, and which may be modified here.
        Returns:
        The (potentially modified) list.
        Throws:
        java.lang.Exception
      • updateRow

        public java.util.ArrayList updateRow(org.jdom2.Element row,
                                             java.util.HashMap currentData,
                                             java.lang.String siteid,
                                             java.lang.String orgid)
                                      throws java.lang.Exception
        When reading XML, and the row needs to be updated on the customer's database, this method returns the Sql statement for updating the row. It does NOT update any value for LDKEY, SITEID or ORGID (for tables having those columns). Called from compareRows.

        If this is MXCOLLAB or APPLICATIONAUTH, does not do any updates. We do not want to change whatever value the customer may have specified for their default.

        Parameters:
        row - The element from the input XML representing a row in this table.
        currentData - The data currently on the customer's database (one row).
        siteid - The siteid to use in the Where clause (if any).
        orgid - The orgid to use in the Where clause (if any).
        Returns:
        An "update ..." sql statement for updating one row. If no columns need to be updated, this will be an empty string. This is an ArrayList so that extensions of this class can provide more than one Sql statement if needed, e.g. for parent/child tables.
        Throws:
        java.lang.Exception
        See Also:
        SysDataElement.updateRowExtension(org.jdom2.Element, java.util.HashMap, java.lang.String, java.lang.String, java.util.ArrayList), SysDataElement.canUpdateColumn(java.lang.String)
      • canUpdateColumn

        public boolean canUpdateColumn(java.lang.String name)
                                throws java.lang.Exception
        Called from compareRows and updateRow to determine whether a particular column should be identified in the XML output and can be updated during the Upgrade. Uses doNotUpdateCols array.
        Parameters:
        name - The column name to be evaluated.
        Returns:
        True if this column can be updated, False if it cannot be updated. This class always assumes that SiteID, OrgID, LDKEY, and key columns are never updated, even if they are not present in the doNotUpdateCols array.
        Throws:
        java.lang.Exception
      • updateRowExtension

        public java.util.ArrayList updateRowExtension(org.jdom2.Element row,
                                                      java.util.HashMap currentData,
                                                      java.lang.String siteid,
                                                      java.lang.String orgid,
                                                      java.util.ArrayList list)
                                               throws java.lang.Exception
        This class is called from updateRow when reading XML. It is a placeholder so that extensions of SysDataElement have a ready-made method in which to code additional update logic. In SysDataElement, it does nothing.
        Parameters:
        row - The XML element representing the update.
        currentData - Current data for the row.
        siteid - Site ID.
        orgid - Org ID.
        list - The array of Sql statements which may already contain entries from updateRow, and which may be modified here.
        Returns:
        The (potentially modified) list.
        Throws:
        java.lang.Exception
      • insertRow

        public java.util.ArrayList insertRow(org.jdom2.Element row,
                                             java.lang.String siteid,
                                             java.lang.String orgid)
                                      throws java.lang.Exception
        When reading XML, and the row needs to be added to the customer's database, this method returns the Sql statement for inserting the row. It does NOT insert any value for LDKEY (for tables having that column). Called from compareRows.

        If this is SIGOPTION, and an optionvalue is specified in UpgCodes.xml via an "optionvalue" attribute for this row, then insert into applicationauth. For example:
        <KEY key="PO|RUNREPORTS" optionvalue="1">
        If not specified in UpgCodes, this method will use an optionvalue of 0.

        Parameters:
        row - The element from the input XML representing a row in this table.
        siteid - The siteid to use in the Insert statement (if any).
        orgid - The orgid to use in the Insert statement (if any).
        Returns:
        An "insert into..." sql statement for inserting one row. This is an ArrayList so that extensions of this class can provide more than one Sql statement if needed, e.g. for parent/child tables.
        Throws:
        java.lang.Exception
        See Also:
        SysDataElement.insertRowExtension(org.jdom2.Element, java.lang.String, java.lang.String, java.util.ArrayList)
      • insertRowExtension

        public java.util.ArrayList insertRowExtension(org.jdom2.Element row,
                                                      java.lang.String siteid,
                                                      java.lang.String orgid,
                                                      java.util.ArrayList list)
                                               throws java.lang.Exception
        This class is called from insertRow when reading XML. It is a placeholder so that extensions of SysDataElement have a ready-made method in which to code additional insert logic. In SysDataElement, it does nothing.
        Parameters:
        row - The XML element representing the insert.
        siteid - Site ID.
        orgid - Org ID.
        list - The array of Sql statements which may already contain entries from insertRow, and which may be modified here.
        Returns:
        The (potentially modified) list.
        Throws:
        java.lang.Exception
      • getChunkUpdates

        public java.util.ArrayList getChunkUpdates(org.jdom2.Element row,
                                                   java.lang.String colName,
                                                   java.lang.String colValue,
                                                   int chunkSize)
                                            throws java.lang.Exception
        Called from insertRow when data exceeds a specified length. Sql statements will need to be broken up into an "insert" statement (from the calling method) and a series of "update" statements that append to the db value. This is a simplified version of getChunkUpdates.
        Parameters:
        row -
        colName -
        colValue - The entire string to be stored in this table/column.
        chunkSize - Size of each chunk. (Maximum size of total statement is 2500 for SQLPlus.)
        Returns:
        List of update statements that append to the db value
        Throws:
        java.lang.Exception
      • setUpgCodes

        public void setUpgCodes(java.io.File codefile)
                         throws java.lang.Exception
        When creating XML, this should be called to point to the file UpgCodes.xml, where special codes can be retrieved.
        Parameters:
        codefile - The file UpgCodes.xml
        Throws:
        java.lang.Exception
      • addCodes

        public void addCodes(org.jdom2.Element row,
                             java.lang.String key)
                      throws java.lang.Exception
        Get the element from UpgCodes.xml, add any special codes from the row header to this XML output. For this method, a special code is anything whose attribute name is not "key", "status", or the uppercase name of a key field.
        Parameters:
        row - The XML element that will be eventually be output, which need special codes added here.
        key - The "key" attribute value, representing the primary key to this table. This value will be matched to UpgCodes.xml to find the appropriate code element.
        Throws:
        java.lang.Exception
        See Also:
        SysDataElement.getUpgCodesElement(java.lang.String), SysDataElement.addCodesExtension(org.jdom2.Element, org.jdom2.Element)
      • addCodesExtension

        public org.jdom2.Element addCodesExtension(org.jdom2.Element row,
                                                   org.jdom2.Element codeEl)
                                            throws java.lang.Exception
        This class is called from addCodes when generating XML. It is a placeholder so that extensions of SysDataElement have a ready-made method in which to code additional code-related (UpgCodes.xml) logic. In SysDataElement, it does nothing.
        Parameters:
        row - The XML element that will be eventually be output, which need special codes added here.
        codeEl - The XML element in the file UpgCodes.xml that may contain additional codes to be added.
        Returns:
        The (potentially modified) row.
        Throws:
        java.lang.Exception
      • getUpgCodesElement

        public org.jdom2.Element getUpgCodesElement(java.lang.String key)
                                             throws java.lang.Exception
        Assuming the UpgCodes.xml file has been defined via setUpgCodes, find the element that has the specified key value. This element has the same basic format as the element in MetaDoc.xml. Called from addCodes.
        Parameters:
        key - The value of the "key" attribute.
        Returns:
        The element from UpgCodes.xml whose key value equals the input param.
        Throws:
        java.lang.Exception
      • getSequenceName

        public java.lang.String getSequenceName(java.lang.String tableName,
                                                java.lang.String columnName)
                                         throws java.lang.Exception
        Get the name of the sequence that corresponds to this table and column. The sequence is used to populate the column with unique values. Called from insertRow to populate the unique column id.
        Parameters:
        tableName - Name of table for which we are seeking a sequence.
        columnName - Name of the column that is populated by the sequence.
        Returns:
        Name of the MAXSEQUENCE if one exists, else null.
        Throws:
        java.lang.Exception
        See Also:
        SysDataElement.isUniqueColumnID(java.lang.String)
      • isUniqueColumnID

        public boolean isUniqueColumnID(java.lang.String columnName)
                                 throws java.lang.Exception
        Detertmine if this column is the unique column id for the table. Query the MaxTableCfg entry for this table for its UniqueColumnName. Unique column ids are populated from MaxSequence, not from any value in the MetaDoc.xml.
        Parameters:
        columnName - the name of the column
        Returns:
        true if the column is a unique column id.
        Throws:
        java.lang.Exception
        See Also:
        SysDataElement.getSequenceName(java.lang.String, java.lang.String)
      • initSequence

        public void initSequence(java.lang.String tableName)
                          throws java.lang.Exception
        Initialize static variable uniqueValue. Set uniqueValue to the highest value in use for the table. Also sets static variable uniqueTable.
        Parameters:
        tableName - Name of the table that owns the sequence.
        Throws:
        java.lang.Exception
      • getMaxReserved

        public long getMaxReserved(org.jdom2.Element row)
                            throws java.lang.Exception
        Get the current highest value for the column referenced by this sequence.
        Parameters:
        row - The element from the input XML representing a row in MaxSequence
        Returns:
        The highest current value for the column referenced by this sequence. 0 if the column does not exist, is empty, or is not numeric.
        Throws:
        java.lang.Exception
      • domainInUse

        public boolean domainInUse(java.lang.String domainID)
                            throws java.lang.Exception
        Determine if a domain is referenced by any objects. Columns (MaxAttribute) and classes (ClassSpec) can reference domains.
        Parameters:
        domainID - ID of the domain to seek.
        Returns:
        true if the domain is referenced.
        Throws:
        java.lang.Exception
      • getNextVal

        public int getNextVal(java.lang.String tableName,
                              java.lang.String columnName)
                       throws java.lang.Exception
        Get the next sequential value for a column. Get the current highest value and add 1.
        Parameters:
        tableName - Name of the table
        columnName - Name of the column
        Returns:
        The next value to be assigned to the column.
        Throws:
        java.lang.Exception
      • executeQuery

        public void executeQuery(java.lang.String sql)
                          throws java.lang.Exception
        Throws:
        java.lang.Exception