com.sun.mdm.index.ops
Class TransactionMgrImpl

java.lang.Object
  extended bycom.sun.mdm.index.ops.TransactionMgrImpl
All Implemented Interfaces:
TransactionMgr

public class TransactionMgrImpl
extends java.lang.Object
implements TransactionMgr

Transaction Manager implementation


Constructor Summary
TransactionMgrImpl()
          Constructor to create transaction manager
 
Method Summary
 TMResult addEnterpriseObject(java.sql.Connection conn, EnterpriseObject eo)
          Persists a new EnterpriseObject into database: 1.
 TMResult euidMerge(java.sql.Connection conn, EnterpriseObject eo1, EnterpriseObject eo2)
          Merge two EnterpriseObjects in the database.
 TMResult euidMerge(java.sql.Connection conn, EnterpriseObject eo1, EnterpriseObject eo2, java.lang.String srcRevisionNumber, java.lang.String destRevisionNumber)
          Merge two EnterpriseObjects in the database.
 TMResult euidUnMerge(java.sql.Connection conn, EnterpriseObject eo1, EnterpriseObject eo2)
          Unmerge an EnterpriseObject in the database.
 TMResult euidUnMerge(java.sql.Connection conn, java.lang.String transactionID, EnterpriseObject eo1, EnterpriseObject eo2)
          Unmerge two EnterpriseObjects in the database.
 TransactionObject findTransactionLog(java.sql.Connection conn, java.lang.String transId)
          Find transaction logs by TransactionObject ID.
 TransactionObject[] findTransactionLogs(java.sql.Connection conn, java.lang.String euid, java.util.Date beginTS)
          Find transaction logs by EUID.
 TransactionObject[] findTransactionLogs(java.sql.Connection conn, java.lang.String euid, java.util.Date beginTS, java.util.Date endTS)
          Find transaction logs by EUID.
 TransactionObject[] findTransactionLogs(java.sql.Connection conn, java.lang.String systemcode, java.lang.String lid, java.util.Date beginTS, java.util.Date endTS)
          Find transaction objects by SystemCode, Local ID, starting time and ending time.
 TransactionObject[] findTransactionLogs(java.sql.Connection conn, TransactionObject tObj, java.util.Date beginTS, java.util.Date endTS)
          Find transaction objects by TransactionObject, starting time and ending time.
 TransactionObject[] findTransactionLogs(java.sql.Connection conn, TransactionObject tObj, java.util.Date beginTS, java.util.Date endTS, java.lang.String orderBy)
          Find transaction objects by TransactionObject, starting time and ending time.
 EnterpriseObject getBeforeImage(EnterpriseObject eo)
          Apply a delta to an EnterpriseObject to obtain the image before the update was made.
 EnterpriseObject getEnterpriseObject(java.sql.Connection conn, java.lang.String euid)
          Invokes Enterprise OPS to retrieve an EnterpriseObject by its EUID: 1.Get list of SystemCode-LID-EUID associations from SBYN_Enterprise table.
 EnterpriseObject getEnterpriseObject(java.sql.Connection conn, java.lang.String euid, java.lang.String[] epaths)
          Retrieves an EnterpriseObject by its EUID and set of Epaths.
 SystemObject getSystemObject(java.sql.Connection conn, java.lang.String systemcode, java.lang.String lid)
          Invokes SystemObject OPS to retrieve a SystemObject by its SystemCode and LocalID.
 SBR getSystemSBR(java.sql.Connection conn, java.lang.String euid)
          Invokes SystemSBR OPS to retrieve a SystemSBR by its EUID.
 TMResult lidMerge(java.sql.Connection conn, EnterpriseObject eo1, EnterpriseObject eo2, java.lang.String systemcode, java.lang.String lid1, java.lang.String lid2)
          Merge two system objects in the database.
 TMResult lidTransfer(java.sql.Connection conn, EnterpriseObject eo1, EnterpriseObject eo2, java.lang.String systemcode, java.lang.String lid)
          Transfer a SystemObject from one EnterpriseObject to another.
 TMResult lidUnMerge(java.sql.Connection conn, EnterpriseObject eo1, EnterpriseObject eo2, java.lang.String systemcode, java.lang.String lid1, java.lang.String lid2)
          Unmerge two system objects in the database.
 TMResult lidUnMerge(java.sql.Connection conn, EnterpriseObject eo1, EnterpriseObject eo2, java.lang.String transactionID, java.lang.String systemcode, java.lang.String lid1, java.lang.String lid2)
          LID unmerge: update unmerged EnterpriseObject in database and log the action in transaction facility Unmerge two system objects in the database.
 RecreateResult recreateObject(java.sql.Connection conn, java.lang.String transactionnumber)
          Recreate an object by transaction ID.
 TMResult updateEnterpriseObject(java.sql.Connection conn, EnterpriseObject eo, java.lang.String function)
          Updates an EnterpriseObject in the database.
 TMResult updateEnterpriseObject(java.sql.Connection conn, EnterpriseObject eo, java.lang.String revisionNumber, java.lang.String function)
          Updates an EnterpriseObject in the database.
 TMResult updateEnterpriseObject(java.sql.Connection conn, EnterpriseObject eo, java.lang.String sysCode, java.lang.String lid, java.lang.String function)
          Updates an EnterpriseObject in the database.
 TMResult updateEnterpriseObject(java.sql.Connection conn, EnterpriseObject eo, java.lang.String sysCode, java.lang.String lid, java.lang.String revisionNumber, java.lang.String function)
          Updates an EnterpriseObject in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionMgrImpl

public TransactionMgrImpl()
                   throws OPSException
Constructor to create transaction manager

Method Detail

addEnterpriseObject

public TMResult addEnterpriseObject(java.sql.Connection conn,
                                    EnterpriseObject eo)
                             throws OPSException
Persists a new EnterpriseObject into database: 1. Persists SystemSBR 2. For each SystemObject: - persists into database - adds EUID-SystemCode-LocalID association

Specified by:
addEnterpriseObject in interface TransactionMgr
Parameters:
conn - JDBC connection.
eo - EnterpriseObject.
Returns:
TMResult object containing the results of the transaction.
Throws:
OPSException - if an error is encountered.

euidMerge

public TMResult euidMerge(java.sql.Connection conn,
                          EnterpriseObject eo1,
                          EnterpriseObject eo2)
                   throws OPSException,
                          DataModifiedException
Merge two EnterpriseObjects in the database.

Specified by:
euidMerge in interface TransactionMgr
Parameters:
conn - JDBC connection.
eo1 - Surviving EnterpriseObject.
eo2 - Merged EnterpriseObject.
Returns:
ret Transaction Manager result.
Throws:
OPSException - if an error other than a DataModifiedException is encountered.
DataModifiedException - if the record has been modified by another user.

euidMerge

public TMResult euidMerge(java.sql.Connection conn,
                          EnterpriseObject eo1,
                          EnterpriseObject eo2,
                          java.lang.String srcRevisionNumber,
                          java.lang.String destRevisionNumber)
                   throws OPSException,
                          DataModifiedException
Merge two EnterpriseObjects in the database.

Specified by:
euidMerge in interface TransactionMgr
Parameters:
conn - JDBC connection.
eo1 - Surviving EnterpriseObject.
eo2 - Merged EnterpriseObject.
srcRevisionNumber - The SBR revision number of the surviving EnterpriseObject.
destRevisionNumber - The SBR revision number of the merged EnterpriseObject.
Returns:
ret Transaction Manager result.
Throws:
OPSException - if an error other than a DataModifiedException is encountered.
DataModifiedException - if the record has been modified by another user.

euidUnMerge

public TMResult euidUnMerge(java.sql.Connection conn,
                            EnterpriseObject eo1,
                            EnterpriseObject eo2)
                     throws OPSException,
                            DataModifiedException
Unmerge an EnterpriseObject in the database.

Specified by:
euidUnMerge in interface TransactionMgr
Parameters:
conn - JDBC connection.
eo1 - Surviving EnterpriseObject.
eo2 - Merged EnterpriseObject.
Returns:
ret Transaction Manager result.
Throws:
OPSException - if an error other than a DataModifiedException is encountered.
DataModifiedException - if the record has been modified by another user.

euidUnMerge

public TMResult euidUnMerge(java.sql.Connection conn,
                            java.lang.String transactionID,
                            EnterpriseObject eo1,
                            EnterpriseObject eo2)
                     throws OPSException,
                            DataModifiedException
Unmerge two EnterpriseObjects in the database.

Specified by:
euidUnMerge in interface TransactionMgr
Parameters:
conn - JDBC connection.
transactionID - Transaction number of the original merge operation.
eo1 - Surviving EnterpriseObject.
eo2 - Merged EnterpriseObject.
Returns:
ret Transaction Manager result.
Throws:
OPSException - if an error other than a DataModifiedException is encountered.
DataModifiedException - if the record has been modified by another user.

findTransactionLog

public TransactionObject findTransactionLog(java.sql.Connection conn,
                                            java.lang.String transId)
                                     throws OPSException
Find transaction logs by TransactionObject ID.

Specified by:
findTransactionLog in interface TransactionMgr
Parameters:
conn - JDBC connection.
transId - Transaction ID.
Returns:
TransactionLog instance.
Throws:
OPSException - if an error is encountered.

findTransactionLogs

public TransactionObject[] findTransactionLogs(java.sql.Connection conn,
                                               java.lang.String euid,
                                               java.util.Date beginTS)
                                        throws OPSException
Find transaction logs by EUID. If the starting time is specified, it is added to the search criteria.

Parameters:
conn - JDBC connection.
euid - EUID
beginTS - start timestamp
Returns:
array of TransactionLogs
Throws:
OPSException - if an error is encountered.

findTransactionLogs

public TransactionObject[] findTransactionLogs(java.sql.Connection conn,
                                               java.lang.String euid,
                                               java.util.Date beginTS,
                                               java.util.Date endTS)
                                        throws OPSException
Find transaction logs by EUID. If the starting time or ending time are specified, they are added to the search criteria.

Specified by:
findTransactionLogs in interface TransactionMgr
Parameters:
conn - JDBC connection.
euid - EUID.
beginTS - Starting timestamp.
endTS - Ending timestamp.
Returns:
array of TransactionLogs
Throws:
OPSException - if an error is encountered.

findTransactionLogs

public TransactionObject[] findTransactionLogs(java.sql.Connection conn,
                                               java.lang.String systemcode,
                                               java.lang.String lid,
                                               java.util.Date beginTS,
                                               java.util.Date endTS)
                                        throws OPSException
Find transaction objects by SystemCode, Local ID, starting time and ending time.

Specified by:
findTransactionLogs in interface TransactionMgr
Parameters:
conn - JDBC connection.
systemcode - System code.
lid - Local ID.
beginTS - Starting timestamp.
endTS - Ending timestamp.
Returns:
array of TransactionObject instances..
Throws:
OPSException - if an error is encountered.

findTransactionLogs

public TransactionObject[] findTransactionLogs(java.sql.Connection conn,
                                               TransactionObject tObj,
                                               java.util.Date beginTS,
                                               java.util.Date endTS)
                                        throws OPSException
Find transaction objects by TransactionObject, starting time and ending time.

Specified by:
findTransactionLogs in interface TransactionMgr
Parameters:
conn - JDBC connection.
tObj - TransactionObject.
beginTS - Starting timestamp.
endTS - Ending timestamp.
Returns:
array of TransactionObject instances.
Throws:
OPSException - if an error is encountered.

findTransactionLogs

public TransactionObject[] findTransactionLogs(java.sql.Connection conn,
                                               TransactionObject tObj,
                                               java.util.Date beginTS,
                                               java.util.Date endTS,
                                               java.lang.String orderBy)
                                        throws OPSException
Find transaction objects by TransactionObject, starting time and ending time. Ordering can be specified.

Specified by:
findTransactionLogs in interface TransactionMgr
Parameters:
conn - JDBC connection.
tObj - TransactionObject.
beginTS - Starting timestamp.
endTS - Ending timestamp.
orderBy - Order by clause.
Returns:
array of TransactionObject instances.
Throws:
OPSException - if an error is encountered.

getBeforeImage

public EnterpriseObject getBeforeImage(EnterpriseObject eo)
                                throws OPSException
Apply a delta to an EnterpriseObject to obtain the image before the update was made.

Specified by:
getBeforeImage in interface TransactionMgr
Parameters:
eo - EnterpriseObject to which the delta is applied.
Returns:
image of the EnterpriseObject before the update was made.
Throws:
OPSException - if an error is encountered.

getEnterpriseObject

public EnterpriseObject getEnterpriseObject(java.sql.Connection conn,
                                            java.lang.String euid)
                                     throws OPSException
Invokes Enterprise OPS to retrieve an EnterpriseObject by its EUID: 1.Get list of SystemCode-LID-EUID associations from SBYN_Enterprise table. 2. For the EUID, retrieve the SystemSBR record. 3. For each SystemCode-LID pair, retrieve the SystemObject record 4. Construct the EnterpriseObject. 5. Return the EnterpriseObject.

Specified by:
getEnterpriseObject in interface TransactionMgr
Parameters:
conn - JDBC connection.
euid - EUID.
Returns:
EnterpriseObject.
Throws:
OPSException - if an error is encountered.

getEnterpriseObject

public EnterpriseObject getEnterpriseObject(java.sql.Connection conn,
                                            java.lang.String euid,
                                            java.lang.String[] epaths)
                                     throws OPSException
Retrieves an EnterpriseObject by its EUID and set of Epaths. The set of Epaths specify what objects are retrieved to compose EO.

Specified by:
getEnterpriseObject in interface TransactionMgr
Parameters:
conn - JDBC connection.
euid - EUID
epaths - list of Epaths
Returns:
EnterpriseObject
Throws:
OPSException - if an error is encountered.

getSystemObject

public SystemObject getSystemObject(java.sql.Connection conn,
                                    java.lang.String systemcode,
                                    java.lang.String lid)
                             throws OPSException
Invokes SystemObject OPS to retrieve a SystemObject by its SystemCode and LocalID.

Specified by:
getSystemObject in interface TransactionMgr
Parameters:
conn - JDBC connection.
systemcode - System code.
lid - Local ID.
Returns:
SystemObject
Throws:
OPSException - if an error is encountered.

getSystemSBR

public SBR getSystemSBR(java.sql.Connection conn,
                        java.lang.String euid)
                 throws OPSException
Invokes SystemSBR OPS to retrieve a SystemSBR by its EUID.

Specified by:
getSystemSBR in interface TransactionMgr
Parameters:
conn - JDBC connection.
euid - EUID.
Returns:
SystemSBR.
Throws:
OPSException - if an error is encountered.

lidMerge

public TMResult lidMerge(java.sql.Connection conn,
                         EnterpriseObject eo1,
                         EnterpriseObject eo2,
                         java.lang.String systemcode,
                         java.lang.String lid1,
                         java.lang.String lid2)
                  throws OPSException,
                         DataModifiedException
Merge two system objects in the database.

Specified by:
lidMerge in interface TransactionMgr
Parameters:
conn - JDBC connection.
eo1 - Surviving EnterpriseObject.
eo2 - Merged EnterpriseObject.
systemcode - System code for both SystemObjects.
lid1 - Surviving SystemObject.
lid2 - Merged SystemObject.
Returns:
ret Transaction Manager Result.
Throws:
OPSException - if an error other than a DataModifiedException is encountered.
DataModifiedException - if the record has been modified by another user.

lidTransfer

public TMResult lidTransfer(java.sql.Connection conn,
                            EnterpriseObject eo1,
                            EnterpriseObject eo2,
                            java.lang.String systemcode,
                            java.lang.String lid)
                     throws OPSException,
                            DataModifiedException
Transfer a SystemObject from one EnterpriseObject to another.

Specified by:
lidTransfer in interface TransactionMgr
Parameters:
conn - JDBC connection.
eo1 - Surviving EnterpriseObject.
eo2 - Merged EnterpriseObject.
systemcode - System code for both SystemObjects.
lid - Local ID of the transferred SystemObject.
Returns:
ret Transaction Manager Result.
Throws:
OPSException - if an error other than a DataModifiedException is encountered.
DataModifiedException - if the record has been modified by another user.

lidUnMerge

public TMResult lidUnMerge(java.sql.Connection conn,
                           EnterpriseObject eo1,
                           EnterpriseObject eo2,
                           java.lang.String systemcode,
                           java.lang.String lid1,
                           java.lang.String lid2)
                    throws OPSException,
                           DataModifiedException
Unmerge two system objects in the database.

Specified by:
lidUnMerge in interface TransactionMgr
Parameters:
conn - JDBC connection.
eo1 - Surviving EnterpriseObject.
eo2 - Merged EnterpriseObject.
systemcode - System code for both SystemObjects.
lid1 - Surviving SystemObject.
lid2 - Merged SystemObject.
Returns:
ret Transaction Manager Result.
Throws:
OPSException - if an error other than a DataModifiedException is encountered.
DataModifiedException - if the record has been modified by another user.

lidUnMerge

public TMResult lidUnMerge(java.sql.Connection conn,
                           EnterpriseObject eo1,
                           EnterpriseObject eo2,
                           java.lang.String transactionID,
                           java.lang.String systemcode,
                           java.lang.String lid1,
                           java.lang.String lid2)
                    throws OPSException,
                           DataModifiedException
LID unmerge: update unmerged EnterpriseObject in database and log the action in transaction facility Unmerge two system objects in the database.

Specified by:
lidUnMerge in interface TransactionMgr
Parameters:
conn - JDBC connection.
eo1 - Surviving EnterpriseObject.
eo2 - Merged EnterpriseObject.
transactionID - Transaction ID of the original merge operation.
systemcode - System code for both SystemObjects.
lid1 - Surviving SystemObject.
lid2 - Merged SystemObject.
Returns:
ret Transaction Manager Result.
Throws:
OPSException - if an error other than a DataModifiedException is encountered.
DataModifiedException - if the record has been modified by another user.

recreateObject

public RecreateResult recreateObject(java.sql.Connection conn,
                                     java.lang.String transactionnumber)
                              throws OPSException
Recreate an object by transaction ID.

Specified by:
recreateObject in interface TransactionMgr
Parameters:
conn - JDBC connection.
transactionnumber - Transaction ID.
Returns:
RecreateResult object containing the results of the operation.
Throws:
OPSException - if an error is encountered.

updateEnterpriseObject

public TMResult updateEnterpriseObject(java.sql.Connection conn,
                                       EnterpriseObject eo,
                                       java.lang.String function)
                                throws OPSException,
                                       DataModifiedException
Updates an EnterpriseObject in the database.

Specified by:
updateEnterpriseObject in interface TransactionMgr
Parameters:
conn - JDBC connection.
eo - EnterpriseObject to update.
function - This is the update function: "Update", "euidActivate", "euidDeactivate", "lidActivate", or "lidDeactivate".
Returns:
TMResult object containing the results of the transaction.
Throws:
OPSException - if an error other than a DataModifiedException is encountered.
DataModifiedException - if the record has been modified by another user.

updateEnterpriseObject

public TMResult updateEnterpriseObject(java.sql.Connection conn,
                                       EnterpriseObject eo,
                                       java.lang.String revisionNumber,
                                       java.lang.String function)
                                throws OPSException,
                                       DataModifiedException
Updates an EnterpriseObject in the database.

Specified by:
updateEnterpriseObject in interface TransactionMgr
Parameters:
conn - JDBC connection.
eo - EnterpriseObject to update.
revisionNumber - The revision number of the SBR of the associated EO.
function - This is the update function: "Update", "euidActivate", "euidDeactivate", "lidActivate", or "lidDeactivate".
Returns:
TMResult object containing the results of the transaction.
Throws:
OPSException - if an error other than a DataModifiedException is encountered.
DataModifiedException - if the record has been modified by another user.

updateEnterpriseObject

public TMResult updateEnterpriseObject(java.sql.Connection conn,
                                       EnterpriseObject eo,
                                       java.lang.String sysCode,
                                       java.lang.String lid,
                                       java.lang.String function)
                                throws OPSException,
                                       DataModifiedException
Updates an EnterpriseObject in the database.

Specified by:
updateEnterpriseObject in interface TransactionMgr
Parameters:
conn - JDBC connection.
eo - EnterpriseObject to update.
sysCode - System code of the SystemObject causing the update.
lid - Local ID of the SystemObject causing the update.
function - This is the update function: "Update", "euidActivate", "euidDeactivate", "lidActivate", or "lidDeactivate".
Returns:
TMResult object containing the results of the transaction.
Throws:
OPSException - if an error other than a DataModifiedException is encountered.
DataModifiedException - if the record has been modified by another user.

updateEnterpriseObject

public TMResult updateEnterpriseObject(java.sql.Connection conn,
                                       EnterpriseObject eo,
                                       java.lang.String sysCode,
                                       java.lang.String lid,
                                       java.lang.String revisionNumber,
                                       java.lang.String function)
                                throws OPSException,
                                       DataModifiedException
Updates an EnterpriseObject in the database.

Specified by:
updateEnterpriseObject in interface TransactionMgr
Parameters:
conn - JDBC connection.
eo - EnterpriseObject to update.
sysCode - System code of the SystemObject causing the update.
lid - Local ID of the SystemObject causing the update.
revisionNumber - The revision number of the SBR of the associated EO.
function - This is the update function: "Update", "euidActivate", "euidDeactivate", "lidActivate", or "lidDeactivate".
Returns:
TMResult object containing the results of the transaction.
Throws:
OPSException - if an error other than a DataModifiedException is encountered.
DataModifiedException - if the record has been modified by another user.


Sun Microsystems, Inc.