* <p>
* @param transactionMode Type: int
*/
public void beforeOperation(int transactionMode) {
if (transactionMode < 0 || transactionMode > 3) {
throw new Error(Error.CC_ILLEGAL_TRANS_MODE, "BeforeOperation", this, new IntegerData(transactionMode), Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1).getException();
}
if ((this.getConcurrencyMode()&ConcurrencyMgr.CO_MASK_DB) > 0) {
if ((transactionMode&ConcurrencyMgr.TR_START) > 0) {
TransactionMgr.beginIndependentTransaction();
}
else if (!(TransactionMgr.isActive())) {
throw new Error(Error.CM_NO_TRANSACTION, "BeforeOperation", this, new IntegerData(this.getClientID()), Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1).getException();
}
}
else {
// (use for none and optimisic) if (ConcurrencyMode = ConcurrencyMgr.CO_OPT_VERIFY) then
if ((transactionMode&ConcurrencyMgr.TR_START) > 0) {
if (this.transState == ConcurrencyMgr.TS_ACTIVE) {
throw new Error(Error.CM_TRANSACTION_IN_PROGRESS, "BeforeOperation", this, new IntegerData(this.getClientID()), Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1).getException();
}
else {
//
// We don't do this because the ConcurrencyMgr will figure it out
// when he first hears from us (which he will shortly)
//
// if (ConcurrencyMgr <> NIL) then
// ConcurrencyMgr.StartTrans(clientID=ClientID, transactionMode=ConcurrencyMgr.TR_START);
// end if;
this.transState = ConcurrencyMgr.TS_ACTIVE;
}
}
else if (this.transState == ConcurrencyMgr.TS_INACTIVE) {
throw new Error(Error.CM_NO_TRANSACTION, "BeforeOperation", this, new IntegerData(this.getClientID()), Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1).getException();
}
}
}