public class AccountDeleteHandler extends DBUHandler
Modifier and Type | Field and Description |
---|---|
private ICustomerMaintenance |
ivCustomerMaint
A reference to the Customer Maintenance Interface object.
|
private boolean |
ivFromImport
A flag indicating if the handler was invoked from import processing.
|
private java.util.ArrayList<Customer> |
ivProcessed
A collection of customers that have been processed.
|
private java.lang.String |
ivUpdateBy
The user Id of the person who intiated the delete.
|
private User |
ivUser
The object for the user being deleted.
|
private IUserMaintenance |
ivUserMaint
A reference to the User Maintenance Interface object.
|
private static long |
serialVersionUID
The class' serialization version id.
|
ivContext
Constructor and Description |
---|
AccountDeleteHandler()
Constructs a new instance of the account delete handler with a
null servlet or thread context. |
Modifier and Type | Method and Description |
---|---|
private boolean |
canDeleteCustomerBilltos(java.util.ArrayList<Customer> billtos)
Determines if the customers in the given set of bill-tos can be deleted.
|
private boolean |
canDeleteCustomerRec(Customer customer)
Determines if the record for the given customer can be deleted by checking
to see if any other users have the customer assigned as their customer or
ship-to.
|
private boolean |
canDeleteCustomerSet(Customer customer)
Determines if the set of customers (customer, bill-to, ship-tos) for the
given customer can be deleted by checking to see if any references to
the set are assigned to any users.
|
private boolean |
canDeleteCustomerShiptos(java.util.ArrayList<Customer> shiptos)
Determines if the customers in the given set of ship-tos can be deleted.
|
boolean |
deleteAccount(User user)
Deletes the given user account and its associated data (credit cards,
favorite items, customers, sales rep customers, sales rep users).
|
boolean |
deleteAccount(User user,
boolean fromImport)
Deletes the given user account and its associated data (credit cards,
favorite items, customers, sales rep customers, sales rep users).
|
private boolean |
deleteCreditCards()
Deletes the credit cards for the user being processed.
|
private boolean |
deleteCustomerBilltos(java.util.ArrayList<Customer> billtos)
Deletes the customers in the given collection of bill-tos.
|
private boolean |
deleteCustomerRec(Customer customer)
Deletes a given customer record and any associated sales rep customers.
|
private boolean |
deleteCustomerSet(Customer customer)
Deletes the set of customers (customer, bill-to, ship-tos) for the given
customer.
|
private boolean |
deleteCustomerShiptos(java.util.ArrayList<Customer> shiptos)
Deletes the customers in the given collection of ship-tos.
|
private boolean |
deleteFavoriteItems()
Deletes the favorite items for the user being processed.
|
private boolean |
deleteNotificationPrefs()
Deletes the notification preferences for the user being processed.
|
private boolean |
deletePasswordHistory()
Deletes the password history for the user being processed.
|
private boolean |
deleteSalesRepCustomers(Customer customer)
Deletes the sales rep customers for a given customer.
|
private boolean |
deleteSalesRepUser()
Deletes the sales rep user for the user being processed.
|
private boolean |
deleteUser()
Deletes the user being processed.
|
private boolean |
deleteUserCustomers()
Deletes the customers for the user being processed.
|
private boolean |
deleteUserPermits(java.lang.String deleteId)
Deletes the user permits for a given id (user id or customer id).
|
private java.util.ArrayList<Customer> |
getBilltoCustomers(Customer customer)
Returns a collection of all customers having the given customer as their
bill-to customer.
|
private java.util.ArrayList<Customer> |
getShiptoCustomers(Customer customer)
Returns a collection of all ship-to customers for the given customer.
|
private void |
log(java.lang.String msgid,
java.lang.String[] values)
A convenience method used for logging messages.
|
void |
setContext(FlashServletContext ctx)
Sets the class' servlet context (i.e.
|
getContext
private static final long serialVersionUID
private User ivUser
private java.lang.String ivUpdateBy
private ICustomerMaintenance ivCustomerMaint
private IUserMaintenance ivUserMaint
private java.util.ArrayList<Customer> ivProcessed
private boolean ivFromImport
public AccountDeleteHandler()
null
servlet or thread context.
A CONTEXT MUST BE SET BEFORE INVOKING ANY OTHER METHODS.
.public void setContext(FlashServletContext ctx)
setContext
in DBUHandler
.setContext
in interface DBUInterface
setContext
in class DBUHandler
ctx
- (FlashServletContext) The current servlet or thread context.public boolean deleteAccount(User user)
user
- (User) The user for the account that is to be deleted.true
if the account delete is
successful, otherwise false
.public boolean deleteAccount(User user, boolean fromImport)
user
- (User) The user for the account that is to be deleted.fromImport
- (boolean) true
if invoked from import
processing, otherwise false
.true
if the account delete is
successful, otherwise false
.private boolean deleteCreditCards() throws java.lang.Exception
true
if the credit card deletes are
successful, otherwise false
.java.lang.Exception
- - if an error occurs while deleting the
user's credit cards.private boolean deleteCustomerRec(Customer customer) throws java.lang.Exception
customer
- (Customer) The customer that is to be deleted.true
if the customer successfully
deletes; otherwise false
.java.lang.Exception
- - if an error occurs while deleting the
customer.private boolean deleteCustomerSet(Customer customer) throws java.lang.Exception
customer
- (Customer) The customer to be deleted.true
if the customer's set of customers
is sucessfully deleted; otherwise false
.java.lang.Exception
- - if an error occurs while deleting the
customer's set of customers.private boolean deleteCustomerBilltos(java.util.ArrayList<Customer> billtos) throws java.lang.Exception
billtos
- (ArrayList) The set of bill-tos to be deleted.true
if the customer deletes are
successful, otherwise false
.java.lang.Exception
- - if an error occurs while deleting the
customers.private boolean deleteCustomerShiptos(java.util.ArrayList<Customer> shiptos) throws java.lang.Exception
shiptos
- (ArrayList) The set of ship-tos to be deleted.true
if the customer deletes are
successful, otherwise false
.java.lang.Exception
- - if an error occurs while deleting the
customers.private boolean deleteFavoriteItems() throws java.lang.Exception
true
if the favorite item deletes are
successful, otherwise false
.java.lang.Exception
- - if an error occurs while deleting the
user's favorite items.private boolean deleteNotificationPrefs() throws java.lang.Exception
true
if the preferences deletes are
successful, otherwise false
.java.lang.Exception
- - if an error occurs while deleting the
user's notification preferences.private boolean deletePasswordHistory() throws java.lang.Exception
true
if the password history deletes
are successful, otherwise false
.java.lang.Exception
- - if an error occurs while deleting the
user's password history.private boolean deleteSalesRepCustomers(Customer customer) throws java.lang.Exception
customer
- (Customer) The customer whose sales rep customers
are to be deleted.true
if the sales rep customer delete
is successful, otherwise false
.java.lang.Exception
- - if an error occurs while deleting the
sales rep customers.private boolean deleteSalesRepUser() throws java.lang.Exception
true
if the sales rep user delete is
successful, otherwise false
.java.lang.Exception
- - if an error occurs while deleting the
sales rep user.private boolean deleteUser() throws java.lang.Exception
true
if the user delete is successful,
otherwise false
.java.lang.Exception
- - if an error occurs while deleting the
user.private boolean deleteUserCustomers() throws java.lang.Exception
true
if the customer deletes are
successful, otherwise false
.java.lang.Exception
- - if an error occurs while deleting the
user's customers.private boolean deleteUserPermits(java.lang.String deleteId) throws java.lang.Exception
deleteId
- (String) The id (user or customer) to delete.true
if the user permit delete is
successful, otherwise false
.java.lang.Exception
- - if an error occurs while deleting the
user permits.private boolean canDeleteCustomerRec(Customer customer) throws java.lang.Exception
customer
- (Customer) The customer to be checked.true
if the given customer can be
deleted; otherwise false
.java.lang.Exception
- - if an error occurs while checking the
customer.private boolean canDeleteCustomerSet(Customer customer) throws java.lang.Exception
customer
- (Customer) The customer to be checked.true
if the set of customers for the
given customer can be deleted; otherwise false
.java.lang.Exception
- - if an error occurs while checking the
customer.private boolean canDeleteCustomerBilltos(java.util.ArrayList<Customer> billtos) throws java.lang.Exception
billtos
- (ArrayList) The set of bill-tos to be processed.true
if all bill-tos in the given set
can be deleted; otherwise false
.java.lang.Exception
- - if an error occurs while processing the
set of bill-tos.private boolean canDeleteCustomerShiptos(java.util.ArrayList<Customer> shiptos) throws java.lang.Exception
shiptos
- (ArrayList) The set of ship-tos to be processed.true
if all ship-tos in the given set
can be deleted; otherwise false
.java.lang.Exception
- - if an error occurs while processing the
set of ship-tos.private java.util.ArrayList<Customer> getBilltoCustomers(Customer customer) throws java.lang.Exception
customer
- (Customer) The bill-to customer whose referenced
customers are to be retrieved.java.lang.Exception
- - if an error occurs while retrieving the
referenced customers.private java.util.ArrayList<Customer> getShiptoCustomers(Customer customer) throws java.lang.Exception
customer
- (Customer) The customer whose ship-to customers are
to be retrieved.java.lang.Exception
- - if an error occurs while retrieving the
ship-to customers.private void log(java.lang.String msgid, java.lang.String[] values) throws java.lang.Exception
msgid
- (String) The resource key for the message to retrieve.values
- (String[]) An array of values to replace in message.java.lang.Exception
- - if an error occurs while logging the
message.