Creating a New Account Flow
In this document, we will explain the process of creating a new account. The process involves receiving account details, processing these details, and inserting the new account information into the database.
The flow starts with receiving the account details in JSON format. These details are then processed to ensure they are correct and complete. After processing, the account information is inserted into the database. If the insertion is successful, a confirmation response is sent back; otherwise, an error response is returned.
Flow drill down
writeCreateAccountExternal
writeCreateAccountExternal
First, the writeCreateAccountExternal
writeCreateAccountInternal
@POST
@Produces("application/json")
@Consumes(MediaType.APPLICATION_JSON)
@Path("/createAccount")
public Response writeCreateAccountExternal(
ProcessedTransactionAccountJSON myCreatedAccount)
{
Response myResponse = writeCreateAccountInternal(myCreatedAccount);
HBankDataAccess myHBankDataAccess = new HBankDataAccess();
myHBankDataAccess.terminate();
return myResponse;
}
writeCreateAccountInternal
writeCreateAccountInternal
Next, the writeCreateAccountInternal
writeCreateAccount
public Response writeCreateAccountInternal(
ProcessedTransactionAccountJSON myCreatedAccount)
{
com.ibm.cics.cip.bankliberty.web.db2.ProcessedTransaction myProcessedTransactionDB2 = new com.ibm.cics.cip.bankliberty.web.db2.ProcessedTransaction();
if (myProcessedTransactionDB2.writeCreateAccount(
myCreatedAccount.getSortCode(),
myCreatedAccount.getAccountNumber(),
myCreatedAccount.getActualBalance(),
myCreatedAccount.getLastStatement(),
myCreatedAccount.getNextStatement(),
myCreatedAccount.getCustomerNumber(),
myCreatedAccount.getType()))
{
return Response.ok().build();
}
else
{
return Response.serverError().build();
}
}
writeCreateAccount
writeCreateAccount
Then, the writeCreateAccount
public boolean writeCreateAccount(String sortCode2, String accountNumber,
BigDecimal actualBalance, Date lastStatement, Date nextStatement,
String customerNumber, String accountType)
{
logger.entering(this.getClass().getName(), WRITE_CREATE_ACCOUNT);
sortOutDateTimeTaskString();
PROCTRAN myPROCTRAN = new PROCTRAN();
Calendar myCalendar = Calendar.getInstance();
myCalendar.setTime(lastStatement);
myPROCTRAN.setProcDescDelaccLastDd(myCalendar.get(Calendar.DATE));
myPROCTRAN.setProcDescDelaccLastMm(myCalendar.get(Calendar.MONTH) + 1);
myPROCTRAN.setProcDescDelaccLastYyyy(myCalendar.get(Calendar.YEAR));
myCalendar.setTime(nextStatement);
myPROCTRAN.setProcDescDelaccNextDd(myCalendar.get(Calendar.DATE));
myPROCTRAN.setProcDescDelaccNextMm(myCalendar.get(Calendar.MONTH) + 1);
myPROCTRAN.setProcDescDelaccNextYyyy(myCalendar.get(Calendar.YEAR));
openConnection
openConnection
Going into 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 "
openConnectionInternal
openConnectionInternal
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