Skip to main content

Customer Resource in API

Customer Resource Overview

The Customer resource is a class that defines various methods to handle customer-related operations. It includes methods for creating, updating, retrieving, and deleting customer records.

Creating a Customer

The createCustomerExternal method is used to create a new customer record by accepting customer details in JSON format and processing them internally. This method ensures that customer data is properly validated and processed before interacting with the underlying data storage.

Updating a Customer

The updateCustomerExternal method allows updating an existing customer's details using their ID. This method ensures that customer data is properly validated and processed before interacting with the underlying data storage.


The updateCustomerExternal method updates an existing customer's details using their ID.

	@PUT
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response updateCustomerExternal(@PathParam(JSON_ID) Long id,
CustomerJSON customer)
{
logger.entering(this.getClass().getName(),
UPDATE_CUSTOMER_EXTERNAL + id);
Response myResponse = updateCustomerInternal(id, customer);
HBankDataAccess myHBankDataAccess = new HBankDataAccess();
myHBankDataAccess.terminate();
logger.exiting(this.getClass().getName(), UPDATE_CUSTOMER_EXTERNAL + id,
myResponse);
return myResponse;


The getCustomerExternal method retrieves a customer's details based on their ID.

	@GET
@Path("/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response getCustomerExternal(@PathParam(JSON_ID) Long id)
{
logger.entering(this.getClass().getName(), GET_CUSTOMER_EXTERNAL + id);

try
{
Response myResponse = getCustomerInternal(id);
HBankDataAccess myHBankDataAccess = new HBankDataAccess();
myHBankDataAccess.terminate();
logger.exiting(this.getClass().getName(), "getCustomerExternal",
myResponse);
return myResponse;

}
catch (Exception ex)
{
// Log the exception
logger.log(Level.WARNING,

Deleting a Customer

The deleteCustomerExternal method deletes a customer record using their ID. This method ensures that customer data is properly validated and processed before interacting with the underlying data storage.

 

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