Skip to main content

Exploring Customer Management

Customer Control Overview

Customer control refers to the management and handling of customer-related data and operations. It includes functionalities such as creating a new customer, viewing customer details, and managing customer records.

How to Use Customer Control

The CustomerControl class in the datainterfaces package is responsible for defining and managing customer data fields and operations. This class includes fields for customer control attributes like customer number, sort code, number of customers, and success flags. It also provides methods to get and set these attributes, ensuring proper handling and validation of customer data.

Where Customer Control is Used

Customer control is used in various parts of the application, including the Customer class in the src/webui/src/main/java/com/ibm/cics/cip/bankliberty/web/vsam/ package.

Example of Customer Control Usage

An example of customer control usage is in the Customer class where it creates a new CustomerControl instance and retrieves the last customer number.


This code snippet shows how a new CustomerControl instance is created and used to set customer control attributes and read customer data.

	{
CustomerControl myCustomerControl = new CustomerControl();
customerFile.setName(FILENAME);

myCustomerControl.setCustomerControlSortcode(0);
myCustomerControl.setCustomerControlNumber(9999999999L);

byte[] key = LAST_CUSTOMER.getBytes();

holder = new RecordHolder();

try
{
customerFile.readForUpdate(key, holder);
}
catch (LogicException | InvalidRequestException | IOErrorException
| InvalidSystemIdException | LockedException | ChangedException
| LoadingException | RecordBusyException | FileDisabledException
| DuplicateKeyException | FileNotFoundException
| ISCInvalidRequestException | NotAuthorisedException
| RecordNotFoundException | NotOpenException e)

Main Functions

There are several main functions in the CustomerControl class. Some of them are getCustomerControlNumber, setCustomerControlNumber, getNumberOfCustomers, and setNumberOfCustomers. We will dive a little into getCustomerControlNumber and setCustomerControlNumber.

getCustomerControlNumber

The getCustomerControlNumber function retrieves the customer control number from the byte buffer. It ensures that the customer control number is set before returning it.


This code snippet shows the implementation of the getCustomerControlNumber function.

	public long getCustomerControlNumber()
{
if (!customerControlNumberIsSet)
{
customerControlNumber = CUSTOMER_CONTROL_NUMBER.getLong(byteBuffer);
customerControlNumberIsSet = true;
}
return customerControlNumber;
}

setCustomerControlNumber

The setCustomerControlNumber function sets the customer control number in the byte buffer. It ensures that the new value is different from the current value before updating it.


This code snippet shows the implementation of the setCustomerControlNumber function.

	public void setCustomerControlNumber(long customerControlNumber)
{
if (customerControlNumberIsSet && CUSTOMER_CONTROL_NUMBER
.equals(this.customerControlNumber, customerControlNumber))
{
return;
}
CUSTOMER_CONTROL_NUMBER.putLong(customerControlNumber, byteBuffer);
this.customerControlNumber = customerControlNumber;
customerControlNumberIsSet = true;
}

getNumberOfCustomers

The getNumberOfCustomers function retrieves the number of customers from the byte buffer. It ensures that the number of customers is set before returning it.


This code snippet shows the implementation of the getNumberOfCustomers function.

	public long getNumberOfCustomers()
{
if (!numberOfCustomersIsSet)
{
numberOfCustomers = NUMBER_OF_CUSTOMERS.getLong(byteBuffer);
numberOfCustomersIsSet = true;
}
return numberOfCustomers;
}

setNumberOfCustomers

The setNumberOfCustomers function sets the number of customers in the byte buffer. It ensures that the new value is different from the current value before updating it.


This code snippet shows the implementation of the setNumberOfCustomers function.

	public void setNumberOfCustomers(long numberOfCustomers)
{
if (numberOfCustomersIsSet && NUMBER_OF_CUSTOMERS
.equals(this.numberOfCustomers, numberOfCustomers))
{
return;
}
NUMBER_OF_CUSTOMERS.putLong(numberOfCustomers, byteBuffer);
this.numberOfCustomers = numberOfCustomers;
numberOfCustomersIsSet = true;
}

 

This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human