Transaction Data Retrieval and Processing Flow
In this document, we will explain the process of retrieving and processing transaction data. The process involves initiating the retrieval, handling core logic, executing an SQL query, and ensuring a database connection.
The flow starts by calling a method to initiate the retrieval of transaction data. This method then calls another method to handle the core logic, which includes setting default values and fetching the transaction data. The data is retrieved by executing an SQL query, and each transaction is processed and formatted. Finally, the database connection is ensured to be open and properly managed throughout the process.
Flow drill down
Retrieving and processing transaction data
First, the getProcessedTransactionExternal
getProcessedTransactionInternal
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getProcessedTransactionExternal(
@QueryParam(LIMIT) Integer limit,
@QueryParam(OFFSET) Integer offset)
{
Response myResponse = getProcessedTransactionInternal(limit, offset);
HBankDataAccess myHBankDataAccess = new HBankDataAccess();
myHBankDataAccess.terminate();
return myResponse;
}
Next, the getProcessedTransactionInternal
getProcessedTransactions
public Response getProcessedTransactionInternal(
@QueryParam(LIMIT) Integer limit,
@QueryParam(OFFSET) Integer offset)
{
if (offset == null)
{
offset = 0;
}
if (limit == null)
{
limit = 250000;
}
JSONObject response = new JSONObject();
JSONArray processedTransactionsJSON = null;
int numberOfProcessedTransactions = 0;
Integer sortCode = this.getSortCode();
com.ibm.cics.cip.bankliberty.web.db2.ProcessedTransaction myProcessedTransaction = new com.ibm.cics.cip.bankliberty.web.db2.ProcessedTransaction();
com.ibm.cics.cip.bankliberty.web.db2.ProcessedTransaction[] processedTransactions = null;
Then, the getProcessedTransactions
ProcessedTransaction
public ProcessedTransaction[] getProcessedTransactions(int sortCode,
Integer limit, Integer offset)
{
logger.entering(this.getClass().getName(), GET_PROCESSED_TRANSACTIONS);
ProcessedTransaction[] temp = new ProcessedTransaction[limit];
this.offset = offset.intValue();
this.limit = limit.intValue();
StringBuilder myStringBuilder = new StringBuilder();
for (int i = Integer.toString(sortCode).length(); i < SORT_CODE_LENGTH; i++)
{
myStringBuilder.append('0');
}
myStringBuilder.append(Integer.toString(sortCode));
String sortCodeString = myStringBuilder.toString();
openConnection();
Moving to the openConnection
DB2
openConnectionInternal
protected void openConnection()
{
// Open a connection to the DB2 database
logger.entering(this.getClass().getName(), "openConnection()");
Integer taskNumberInteger = Task.getTask().getTaskNumber();
String db2ConnString = DB2CONN.concat(taskNumberInteger.toString());
logger.log(Level.FINE,
() -> "Attempting to get DB2CONN for task number "
+ taskNumberInteger.toString());
this.conn = (Connection) cornedBeef.get(db2ConnString);
if (this.conn == null)
{
HBankDataAccess.incrementConnCount();
logger.log(Level.FINE,
() -> "Attempting to create DB2CONN for task number "
+ taskNumberInteger.toString());
// Attempt to open a connection
openConnectionInternal();
logger.log(Level.FINE,
() -> "Creation succcessful for DB2CONN for task number "
Finally, the openConnectionInternal
@SuppressWarnings("unchecked")
void openConnectionInternal()
{
logger.entering(this.getClass().getName(), "openConnectionInternal");
String jndiString = "jdbc/defaultCICSDataSource";
Context ctx;
try
{
ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup(jndiString);
logger.log(Level.FINE, () -> "jndi string is " + jndiString);
// If there is no current connection
if (this.conn == null)
{
logger.log(Level.FINE,
() -> "About to attempt to get DB2 connection");
// Try and get a connection
this.conn = ds.getConnection();
this.conn.setTransactionIsolation(
Connection.TRANSACTION_READ_UNCOMMITTED);
This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human