public class ColumnElement extends org.jdom.Element implements UpgConstants
org.jdom.Element.
ColumnElement is instanciated by the following:
compareColumns and
addOneColumnSet
The constructor will populate the ColumnElement object appropriately.
ConfigXMLFactory, via
TableElement.
The ColumnElement returns sql statements
for modifying the column metadata prior to running ConfigDB.
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.
| Attribute Name | Description |
|---|---|
| forcedrop | When performing the Upgrade, if column is being dropped, and it contains data,
this class will mark it as user-defined rather than actually dropping it.
However, if the UpgCodes XML file that is input
to BuildUpgMetadata provides a column attribute named "forcedrop" with any value
other than N or NO, the column will be dropped regardless of whether it contains data.
This would be done if, for example, a column is being moved from one table to another.
If this were the case, we would not actually lose any data by dropping it from the
first table.
For example:
|
psdi.upgrade.BuildUpgMetadata,
psdi.upgrade.Upgrade,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static char |
DC3 |
static char |
END_OF_MEDIUM |
DB2, doNotUpdateACTION, doNotUpdateALNDOMAIN, doNotUpdateAPPLICATIONAUTH, doNotUpdateAUTOKEY, doNotUpdateCONDITION, doNotUpdateCONTRACTPROPERTY, doNotUpdateCONTRACTTYPE, doNotUpdateCROSSOVERDOMAIN, doNotUpdateDOCTYPES, doNotUpdateLANGUAGE, doNotUpdateMAXAPPS, doNotUpdateMAXCONDDETAIL, doNotUpdateMAXCONTROLVALUE, doNotUpdateMAXDOMAIN, doNotUpdateMAXLOGAPPENDER, doNotUpdateMAXLOGGER, doNotUpdateMAXMENU, doNotUpdateMAXMESSAGES, doNotUpdateMAXMODULES, doNotUpdateMAXPROP, doNotUpdateMAXPROPVALUE, doNotUpdateMAXROLE, doNotUpdateMAXSEQUENCE, doNotUpdateMAXSERSECURITY, doNotUpdateMAXSERVICE, doNotUpdateMAXTABLEDOMAIN, doNotUpdateMAXVARS, doNotUpdateMAXVARTYPE, doNotUpdateMXCOLLAB, doNotUpdateMXCOLLABREF, doNotUpdateNUMERICDOMAIN, doNotUpdateNUMRANGEDOMAIN, doNotUpdatePORTLET, doNotUpdatePRICALC, doNotUpdateSECURITYRESTRICT, doNotUpdateSIGOPTION, doNotUpdateSYNONYMDOMAIN, doNotUpdateTAXTYPE, doNotUpdateWORKPRIORITY, doNotUpdateWORKTYPE, doNotUpdateWPEDITSETTING, messageCache, NEWONLY, OLDANDNEW, OLDONLY, ORACLE, SQLINET, SQLMICROSOFT, SQLSERVER, SYSDATATABLES, SYSTEMTABLES, UNKNOWN| Constructor and Description |
|---|
ColumnElement(java.lang.String name,
org.jdom.Namespace namespace,
java.lang.String dir) |
ColumnElement(java.lang.String name,
java.lang.String dir) |
ColumnElement(java.lang.String name,
java.lang.String uri,
java.lang.String dir) |
ColumnElement(java.lang.String name,
java.lang.String prefix,
java.lang.String uri,
java.lang.String dir) |
ColumnElement(TableElement tableElement,
java.lang.String name,
java.util.HashMap newCol,
java.util.HashMap oldCol)
This constructor is used when creating a new TableElement for the purpose
of writing out XML.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.ArrayList |
addAutoSelectColumn(java.lang.String tableName,
Util util)
AutoSelect views must reference every column on the base table.
|
java.util.ArrayList |
addUserColumn(java.lang.String baseTable)
For any table that becomes a view, all user-defined columns must be
created on the new base table of the view.
|
java.util.ArrayList |
addUserColumn(java.lang.String tableName,
java.util.HashMap column)
For any table that becomes a view, all user-defined columns must be
created on the new base table of the view.
|
java.util.ArrayList |
addViewColumn(java.lang.String tableName,
Util util)
AutoSelect views must reference every column on the base table.
|
java.util.ArrayList |
adjustViewRequired(Util util)
If a column is required, any view of the column must also be required.
|
boolean |
customClassExists(java.lang.String className)
When a column was dropped from the new release and we're changing it to user-defined,
see if the old customclassname still exists as a class.
|
boolean |
forceDrop()
Determine whether the column must be dropped.
|
java.util.ArrayList |
getAddSql(java.lang.String tbname,
java.lang.String name,
java.sql.Connection con,
Util util,
java.util.HashMap oldCol,
TableElement tableElement)
When reading XML, this method outputs the Sql to update the customer's metadata
in preparation for running
ConfigDB. |
java.lang.String |
getAmountLength()
Get the defined length of AMOUNT columns.
|
java.lang.String |
getAmountScale()
Get the defined scale of AMOUNT columns.
|
org.jdom.Element |
getColumnAttribute(java.lang.String attrName)
Get a particular attribute element for this ColumnElement.
|
java.util.List |
getColumnAttributes()
Get the attributes for this ColumnElement.
|
java.util.HashMap |
getColumnMeta(java.lang.String tableName,
java.lang.String columnName)
Get the column metadata (from MaxAttribute) for a column.
|
java.lang.String |
getColumnName()
Get the column name.
|
java.lang.String |
getGLLength()
Calculate the length of GL columns.
|
java.lang.String |
getNewChanged()
Get the new value for MaxAttributeCfg.Changed (
newChanged). |
java.util.HashMap |
getNewHashmap(java.util.HashMap oldMap,
boolean rebuild)
This method can be used when reading XML to output a HashMap in the format
of
getAttributeMeta. |
java.lang.String |
getStatus()
Get the value of the column's attribute value "status" (see
status). |
java.lang.String |
getTableName()
Get the name of the table that owns this column.
|
int |
getUpdateCount()
When validating the XML against the database, determine the number of column attributes
that are being updated in MaxAttribute and MaxViewColumn.
|
java.util.ArrayList |
getUpdateSql(java.lang.String tbname,
java.lang.String name,
java.sql.Connection con,
Util util,
java.util.HashMap oldCol,
TableElement tableElement)
When reading XML, this method outputs the Sql to update the customer's metadata
in preparation for running
ConfigDB. |
boolean |
isCharType(org.jdom.Element attr)
Determine if the column is a character datatype
|
boolean |
isCharType(java.lang.String maxtype)
Determine if a maximo datatype (MaxType) is a character datatype
|
void |
setNewChanged(java.lang.String value)
Set the new value for maxobjectcfg.changed (
newChanged). |
java.util.HashMap |
toHashmap(java.util.HashMap oldMap)
This method can be used when reading XML to output a HashMap in the format
of
getAttributeMeta. |
boolean |
viewColumnExists()
AutoSelect views must reference every column on the base table.
|
addContent, addContent, addContent, addContent, addContent, addNamespaceDeclaration, clone, cloneContent, getAdditionalNamespaces, getAttribute, getAttribute, getAttributes, 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, getNamespaceURI, getQualifiedName, getText, getTextNormalize, getTextTrim, getValue, indexOf, isAncestor, isRootElement, removeAttribute, removeAttribute, removeAttribute, removeChild, removeChild, removeChildren, removeChildren, removeContent, removeContent, removeContent, removeContent, removeNamespaceDeclaration, setAttribute, setAttribute, setAttribute, setAttributes, setAttributes, setContent, setContent, setContent, setContent, setName, setNamespace, setText, toStringpublic static final char END_OF_MEDIUM
public static final char DC3
public ColumnElement(java.lang.String name,
org.jdom.Namespace namespace,
java.lang.String dir)
public ColumnElement(java.lang.String name,
java.lang.String dir)
public ColumnElement(java.lang.String name,
java.lang.String uri,
java.lang.String dir)
public ColumnElement(java.lang.String name,
java.lang.String prefix,
java.lang.String uri,
java.lang.String dir)
public ColumnElement(TableElement tableElement, java.lang.String name, java.util.HashMap newCol, java.util.HashMap oldCol) throws java.lang.Exception
buildFromHashMaps.tableElement - The parent TableElementname - The column namenewCol - The column from the new database.oldCol - The column from the old database.java.lang.ExceptionbuildFromHashMaps()public java.lang.String getColumnName()
public java.lang.String getTableName()
public java.lang.String getStatus()
status).
This will equal OLDONLY, NEWONLY, or OLDANDNEW to indicate
whether the column exists in the old database, the new database, or both.public java.lang.String getNewChanged()
newChanged).public void setNewChanged(java.lang.String value)
newChanged).public java.util.List getColumnAttributes()
To get a particular attribute without explicitly iterating through the list,
call getColumnAttribute.
java.lang.Exceptionpublic org.jdom.Element getColumnAttribute(java.lang.String attrName)
To get a list of all attributes, call getColumnAttributes.
attrName - The attribute name (case sensitive), for example COLUMNTITLE, DEFAULTVALUE, etc.java.lang.Exceptionpublic java.util.ArrayList getAddSql(java.lang.String tbname,
java.lang.String name,
java.sql.Connection con,
Util util,
java.util.HashMap oldCol,
TableElement tableElement)
throws java.lang.Exception
ConfigDB.tbname - The table name.name - The column name.con - The connection to the database being upgraded.util - Reference to the Util class.oldCol - The current attributes for the column, before being upgraded.tableElement - The table that owns this columnjava.lang.ExceptiongetNewHashmap(java.util.HashMap, boolean),
addColumnCfg(),
updateColumnCfg(java.util.HashMap),
getFormatValue(java.lang.String, java.lang.String),
customClassExists(java.lang.String)public java.util.ArrayList getUpdateSql(java.lang.String tbname,
java.lang.String name,
java.sql.Connection con,
Util util,
java.util.HashMap oldCol,
TableElement tableElement)
throws java.lang.Exception
ConfigDB.tbname - The table name.name - The column name.con - The connection to the database being upgraded.util - Reference to the Util class.oldCol - The current attributes for the column, before being upgraded.tableElement - The table that owns this columnjava.lang.ExceptiongetNewHashmap(java.util.HashMap, boolean),
addColumnCfg(),
updateColumnCfg(java.util.HashMap),
getFormatValue(java.lang.String, java.lang.String),
customClassExists(java.lang.String)public boolean customClassExists(java.lang.String className)
className - The name of the classpublic java.util.HashMap getColumnMeta(java.lang.String tableName,
java.lang.String columnName)
throws java.lang.Exception
tableName - name of the tablecolumnName - name of the columnjava.lang.ExceptionUtil.getAttributeMeta(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String)public java.util.HashMap getNewHashmap(java.util.HashMap oldMap,
boolean rebuild)
throws java.lang.Exception
getAttributeMeta.
If the "rebuild" parameter is True, this also calls
reEvaluateAttributeChanged,
updates the "CHANGED" value in the map, and updates the "newChanged" variable.
It is important that this method be called for every column somewhere from
getSql, because after the columns are processed, the
TableElement uses the columns' new maps to determine the correct value for
maxobjectcfg "changed".
oldMap - The HashMap representing the original values of the column metadata
from the customer's database, before applying the XML changes.
If this is a new column to be added, then this parameter will be null or empty.
If the "rebuild" parameter is False, this can be null.rebuild - True to rebuild the map. When True,
reEvaluateAttributeChanged
is called and lastNewMap is replaced.
False to return the most recently built map
(lastNewMap).
java.lang.ExceptionUtil.reEvaluateAttributeChanged(java.lang.String, java.util.HashMap, java.util.HashMap, java.lang.String, boolean)public java.util.HashMap toHashmap(java.util.HashMap oldMap)
throws java.lang.Exception
getAttributeMeta.oldMap - The HashMap representing the original values of the column metadata
from the customer's database, before applying the XML changes.
If this is a new column to be added, then this parameter will be null or empty.java.lang.Exceptionpublic java.lang.String getGLLength()
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String getAmountLength()
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String getAmountScale()
throws java.lang.Exception
java.lang.Exceptionpublic boolean isCharType(org.jdom.Element attr)
attr - MaxType elementtrue if the element is a charater data typepublic boolean isCharType(java.lang.String maxtype)
maxtype - Maximo datatypetrue if the maxtype is a charater data typepublic boolean forceDrop()
true is FORCEDROP was specified in UpgCodes.public java.util.ArrayList addUserColumn(java.lang.String baseTable)
throws java.lang.Exception
baseTable - Name of the table that is extended by the viewjava.lang.Exceptionpublic java.util.ArrayList addUserColumn(java.lang.String tableName,
java.util.HashMap column)
throws java.lang.Exception
tableName - Name of the table that is extended by the viewcolumn - HashMap of the column definition to clonejava.lang.Exceptionpublic java.util.ArrayList addAutoSelectColumn(java.lang.String tableName,
Util util)
throws java.lang.Exception
tableName - Name of the base table that contains the columnjava.lang.Exceptionpublic java.util.ArrayList addViewColumn(java.lang.String tableName,
Util util)
throws java.lang.Exception
tableName - Name of the base table that contains the columnjava.lang.Exceptionpublic java.util.ArrayList adjustViewRequired(Util util) throws java.lang.Exception
java.lang.Exceptionpublic boolean viewColumnExists()
throws java.lang.Exception
java.lang.Exceptionpublic int getUpdateCount()
throws java.lang.Exception
validateColumns.java.lang.Exception