Oracle Fusion Middleware extensions for XML based Datamodel Framework
11g Release 1 (11.1.1.6)

E22566-04

oracle.apps.fnd.applxdf.comp
Class DBObject

java.lang.Object
  extended by oracle.apps.fnd.applxdf.comp.DBObject
Direct Known Subclasses:
CommentObject, ConstraintObject, ContextObject, IndexObject, MViewObject, MVLogObject, PolicyObject, QTableObject, QueueObject, RoleObject, SequenceObject, SynonymObject, TableFKObject, TableObject, TriggerObject, ViewObject

public abstract class DBObject
extends java.lang.Object

Abstract class which contains methods to create different objects, compare the existing one with the defintition in the xml file and generate DDLs statements if possible to map the differences or throw errors

Author:
Guoqiang Su <Guoqiang.Su@oracle.com>

Field Summary
protected  boolean indexExists
           
protected  XDFLogger logger
           
protected  java.util.HashMap mapPartition
           
protected  java.util.ArrayList notToEmitAlterDDLArray
           
protected  oracle.xml.parser.v2.XMLElement objDoc
           
protected  java.lang.String objectName
           
protected  oracle.xml.parser.v2.XMLElement objElm
           
protected  Parameters param
           
 
Constructor Summary
DBObject()
          constructor.
 
Method Summary
 boolean checkTargetDBObjectExists()
          Check whether the Object exists in the target db or not.
 int executeDDLStmt(Parameters theParam, java.lang.String ddlStmt)
          Execute the DDL statement.
 java.util.ArrayList getAlterDDLArrayToExecute(oracle.xml.parser.v2.XMLDocumentFragment alterXML)
          Get multiple alter DDLs to execute from the XML.
 oracle.xml.parser.v2.XMLDocumentFragment getAlterXML(oracle.xml.parser.v2.XMLDocument xmlDiffDoc)
          Get the alter XML.
protected  java.util.Hashtable getAlterXMLParameters()
          Method to get the alter XML parameters for specific object.
protected abstract  java.lang.String getAlterXMLXSLFile()
          Abstract method to get the alter XML XSL file for specific object.
protected abstract  java.util.HashMap getClauseTypeNotToEmit()
          Abstract method to get the clause type not to emit for specific object.
protected abstract  java.util.Hashtable getCreateDDLParameters()
          Abstract method to get the create DDL parameters for the specifc object
 java.lang.String getCreateDDLToExecute(oracle.xml.parser.v2.XMLDocumentFragment inXMLDocFrgmt)
          Get the create DDL to execute from the XMLDocumentFragment
 java.lang.String getCreateDDLToExecute(oracle.xml.parser.v2.XMLElement inXmlElm)
          Get the create DDL to execute from the XMLElement
protected abstract  java.lang.String getCreateDDLXSLFile()
          Abstract method to get the create DDL XSL file for the specific object
protected abstract  void getDataFromSXML(oracle.xml.parser.v2.XMLElement inXmlDoc)
          Method to get data from the XML for specific object
protected abstract  void getDataFromTargetDB(java.sql.ResultSet rset)
          Abstract method to get the data from the target database for the specific object
 oracle.sql.CLOB getDependentDiffDocument(oracle.sql.CLOB remapCLOB, java.lang.String baseObjectName, java.lang.String baseSchemaName)
          Compare the difference of the two documents and generate the difference CLOB.
 oracle.sql.CLOB getDiffDocument(oracle.sql.CLOB remapCLOB)
          Compare the difference of the two documents and generate the difference CLOB.
 java.lang.String getObjectName()
          Returns the object name.
protected abstract  java.util.Hashtable getRemapParameters()
          Abstract method to get the remap parameters.
protected abstract  java.lang.String getRemapXSLFile()
          Abstract method to get the remap XSL file for specific object.
 java.lang.String getTableSpaceType(java.lang.String tablespaceName)
          Check whether the tablespace type of the object.
 java.lang.String getTargetTableSpaceName()
          Get the target object table space name.
 boolean isIndexExists()
          Check to see whether index exists or not.
 boolean isObjectObsolete()
          Check whether the object is obsolete.
protected abstract  java.lang.String prepareObjectQuery(java.util.ArrayList arguments)
          Abstract method to prepare the sql query statement for the specifc object.
 oracle.xml.parser.v2.XMLDocument readInputSXML()
          Read the data into XMLElement for the object from the input xml file.
 oracle.xml.parser.v2.XMLDocumentFragment remapSXML(oracle.xml.parser.v2.XMLElement inXmlElm)
          Remap the schema, tablespace etc in the XML document.
protected  void setObjDoc(oracle.xml.parser.v2.XMLDocument xmlDoc)
           
 void setObjectName(java.lang.String objectName)
          Set the Object Name
protected  void setObjElm(oracle.xml.parser.v2.XMLElement xmlElm)
           
 oracle.xml.parser.v2.XMLElement stripRowTag(oracle.xml.parser.v2.XMLDocument inDoc)
          Extract object element from object xml file.
abstract  oracle.xml.parser.v2.XMLDocumentFragment validateDDL(oracle.xml.parser.v2.XMLDocumentFragment ddlXMLDoc)
          Abstract method to validate the DDL for specific object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

param

protected Parameters param

logger

protected XDFLogger logger

objectName

protected java.lang.String objectName

mapPartition

protected java.util.HashMap mapPartition

objElm

protected oracle.xml.parser.v2.XMLElement objElm

objDoc

protected oracle.xml.parser.v2.XMLElement objDoc

indexExists

protected boolean indexExists

notToEmitAlterDDLArray

protected java.util.ArrayList notToEmitAlterDDLArray
Constructor Detail

DBObject

public DBObject()
constructor.

Method Detail

getObjectName

public java.lang.String getObjectName()
Returns the object name.

Returns:
the name of the object

readInputSXML

public oracle.xml.parser.v2.XMLDocument readInputSXML()
Read the data into XMLElement for the object from the input xml file.

Returns:
XMLElement for the object

stripRowTag

public oracle.xml.parser.v2.XMLElement stripRowTag(oracle.xml.parser.v2.XMLDocument inDoc)
Extract object element from object xml file.

Parameters:
inDoc - input xml document
Returns:
the tripped xml document

getDataFromSXML

protected abstract void getDataFromSXML(oracle.xml.parser.v2.XMLElement inXmlDoc)
Method to get data from the XML for specific object

Parameters:
inXmlDoc -

checkTargetDBObjectExists

public boolean checkTargetDBObjectExists()
Check whether the Object exists in the target db or not.

Returns:
true if object exists in target db. Otherwise false.
Throws:
java.lang.Exception - when the statement or connection is closed

getTableSpaceType

public java.lang.String getTableSpaceType(java.lang.String tablespaceName)
Check whether the tablespace type of the object.

Parameters:
tablespaceName - table space name
Returns:
String containing type.
Throws:
java.lang.Exception

getTargetTableSpaceName

public java.lang.String getTargetTableSpaceName()
Get the target object table space name.

Returns:
table space name

prepareObjectQuery

protected abstract java.lang.String prepareObjectQuery(java.util.ArrayList arguments)
Abstract method to prepare the sql query statement for the specifc object.

Parameters:
arguments - arguments associated with the prepared sql statement
Returns:
query statement for the specific object

getDataFromTargetDB

protected abstract void getDataFromTargetDB(java.sql.ResultSet rset)
Abstract method to get the data from the target database for the specific object

Parameters:
rset - resultset passed to the method

remapSXML

public oracle.xml.parser.v2.XMLDocumentFragment remapSXML(oracle.xml.parser.v2.XMLElement inXmlElm)
Remap the schema, tablespace etc in the XML document.

Parameters:
inXmlElm - the input XMLElement
Returns:
XMLDocuemntFragment after remapping

getRemapXSLFile

protected abstract java.lang.String getRemapXSLFile()
Abstract method to get the remap XSL file for specific object.

Returns:
remap XSL file

getRemapParameters

protected abstract java.util.Hashtable getRemapParameters()
Abstract method to get the remap parameters.

Returns:
remap parameters hashtable

getCreateDDLToExecute

public java.lang.String getCreateDDLToExecute(oracle.xml.parser.v2.XMLDocumentFragment inXMLDocFrgmt)
Get the create DDL to execute from the XMLDocumentFragment

Parameters:
inXMLDocFrgmt - XMLDocumentFragment to extract the create DDL
Returns:
create DDL string

getCreateDDLToExecute

public java.lang.String getCreateDDLToExecute(oracle.xml.parser.v2.XMLElement inXmlElm)
Get the create DDL to execute from the XMLElement

Parameters:
inXmlElm - XMLElement to extract the create DDL
Returns:
create DDL string

getCreateDDLXSLFile

protected abstract java.lang.String getCreateDDLXSLFile()
Abstract method to get the create DDL XSL file for the specific object

Returns:
create DDL XSL file string

getCreateDDLParameters

protected abstract java.util.Hashtable getCreateDDLParameters()
Abstract method to get the create DDL parameters for the specifc object

Returns:
create DDL parameters hashtable

getDiffDocument

public oracle.sql.CLOB getDiffDocument(oracle.sql.CLOB remapCLOB)
                                throws java.lang.Exception
Compare the difference of the two documents and generate the difference CLOB.

Parameters:
remapCLOB - CLOB to be compared to the target DB
Returns:
the CLOB of the differences of the two documents
Throws:
java.lang.Exception - when closing the statement

getDependentDiffDocument

public oracle.sql.CLOB getDependentDiffDocument(oracle.sql.CLOB remapCLOB,
                                                java.lang.String baseObjectName,
                                                java.lang.String baseSchemaName)
                                         throws java.lang.Exception
Compare the difference of the two documents and generate the difference CLOB. This is for the dependent object.

Parameters:
remapCLOB - CLOB to be compared to the target DB
baseObjectName - base object name
baseSchemaName - base schema name
Returns:
the CLOB of the differences of the two documents.
Throws:
java.lang.Exception - when the statement is closed

getAlterXML

public oracle.xml.parser.v2.XMLDocumentFragment getAlterXML(oracle.xml.parser.v2.XMLDocument xmlDiffDoc)
Get the alter XML.

Parameters:
xmlDiffDoc - xmlDiffDoc to be processed
Returns:
alter XMLDocumentFragment

getAlterXMLXSLFile

protected abstract java.lang.String getAlterXMLXSLFile()
Abstract method to get the alter XML XSL file for specific object.

Returns:
alter XML XSL file

getAlterXMLParameters

protected java.util.Hashtable getAlterXMLParameters()
Method to get the alter XML parameters for specific object.

Returns:
alter XML parameters hashtable

validateDDL

public abstract oracle.xml.parser.v2.XMLDocumentFragment validateDDL(oracle.xml.parser.v2.XMLDocumentFragment ddlXMLDoc)
Abstract method to validate the DDL for specific object.

Parameters:
ddlXMLDoc - XMLDocumentFragment to be validated
Returns:
XMLDocumentFragment that has been validated

getAlterDDLArrayToExecute

public java.util.ArrayList getAlterDDLArrayToExecute(oracle.xml.parser.v2.XMLDocumentFragment alterXML)
Get multiple alter DDLs to execute from the XML.

Parameters:
alterXML - XMLDocumentFragment to extract the alter DDLs
Returns:
the alter DDLs arraylist

getClauseTypeNotToEmit

protected abstract java.util.HashMap getClauseTypeNotToEmit()
Abstract method to get the clause type not to emit for specific object.

Returns:
clause type hashtype

executeDDLStmt

public int executeDDLStmt(Parameters theParam,
                          java.lang.String ddlStmt)
Execute the DDL statement.

Parameters:
theParam - Parameters instance
ddlStmt - DDL statement to be execute
Returns:
0 for success; otherwise failure

setObjectName

public void setObjectName(java.lang.String objectName)
Set the Object Name

Parameters:
objectName - object name

isIndexExists

public boolean isIndexExists()
Check to see whether index exists or not.

Returns:
true if existing

isObjectObsolete

public boolean isObjectObsolete()
Check whether the object is obsolete.

Returns:
true -if the object is obsolete.

setObjElm

protected void setObjElm(oracle.xml.parser.v2.XMLElement xmlElm)

setObjDoc

protected void setObjDoc(oracle.xml.parser.v2.XMLDocument xmlDoc)

Oracle Fusion Middleware extensions for XML based Datamodel Framework
11g Release 1 (11.1.1.6)

E22566-04

Copyright © 2012 Oracle. All Rights Reserved.