public class AccountCreateHandler extends DBUHandler
Modifier and Type | Field and Description |
---|---|
private boolean |
ivBackendBillto
A flag that indicates if a backend bill-to customer was created.
|
private boolean |
ivBackendShipto
A flag that indicates if a backend ship-to customer was created.
|
private boolean |
ivBackendUser
A flag that indicates if a backend user record was created.
|
private Customer |
ivBillto
The bill-to customer object for the new account.
|
private java.lang.String |
ivCreateBy
The user id that initiated the create.
|
private ICustomerMaintenance |
ivCustomerMaint
A reference to the Customer Maintenance Interface object.
|
private boolean |
ivNotificationContact
A flag that indicates if a notification framework contact record
was created.
|
private Customer |
ivShipto
The ship-to customer object for the new account.
|
private User |
ivUser
The user object for the new account.
|
private IUserMaintenance |
ivUserMaint
A reference to the User Maintenance Interface object.
|
private static long |
serialVersionUID
The class' serialization version id.
|
ivContext
Constructor and Description |
---|
AccountCreateHandler()
Constructs a new instance of the account create handler with a
null servlet or thread context. |
Modifier and Type | Method and Description |
---|---|
User |
createAccount(User user,
java.lang.String createBy)
Creates the given user account and its associated data (user, billing
customer, shipping customer).
|
private boolean |
createAccountBillto()
Creates a new account's bill-to customer.
|
private boolean |
createAccountPermits()
Creates a new account's default user permit record(s).
|
private boolean |
createAccountPermitsCustId()
Creates a new account's default user permit record(s) when the site is
configured for permits by assigned customer.
|
private boolean |
createAccountPermitsShipId()
Creates a new account's default user permit record(s) when the site is
configured for permits by ship-to customer.
|
boolean |
createAccountPermitsShipId(Customer baseon,
Customer shipto)
Creates default user permit record(s) for a ship-to customer using the
permits that exist for a based-on customer.
|
private boolean |
createAccountPermitsUserId()
Creates a new account's default user permit record(s) when the site is
configured for permits by user.
|
private boolean |
createAccountPreferences()
Creates a new account's user notification preference record(s).
|
private boolean |
createAccountShipto()
Creates a new account's ship-to customer.
|
private boolean |
createAccountUser()
Creates a new account's user.
|
private void |
deleteAccount()
Deletes the backend database records that might have been created.
|
private java.lang.String |
generateLogonId(java.lang.String custid)
Auto-generates a user logon id based on the given customer id.
|
private java.util.ArrayList<Customer> |
getAccountShiptos()
Returns a collection of all ship-to customers for the account being created.
|
private Customer |
getDefaultShipto(Customer cust)
Retrieves the default ship-to customer for the given customer based on
the given customer's shipforid.
|
private Customer |
getExistingCustomer(java.lang.String custid)
Retrieves the customer for the given customer id.
|
private boolean |
getReferencedCustomers(Customer cust)
Retrieves the customers referenced by the given customer (bill-to and all
ship-tos).
|
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.
|
boolean |
validateCustomer(java.lang.String custid)
Validates the given customer id value.
|
boolean |
validateUser(java.lang.String userid)
Validates the given user id value.
|
getContext
private static final long serialVersionUID
private User ivUser
private Customer ivBillto
private Customer ivShipto
private java.lang.String ivCreateBy
private ICustomerMaintenance ivCustomerMaint
private IUserMaintenance ivUserMaint
private boolean ivBackendBillto
private boolean ivBackendShipto
private boolean ivBackendUser
private boolean ivNotificationContact
public AccountCreateHandler()
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 User createAccount(User user, java.lang.String createBy)
When invoked and no bill-to customer id is supplied:
When invoked and a bill-to customer id is supplied (admin or sfi/csr create account only):
user
- (User) The user for the account that is to be created.createBy
- (String) The user id that initiated the create.null
if
the create failed.private boolean createAccountBillto() throws java.lang.Exception
true
if the bill-to customer creation
completed successfully, otherwise false
.java.lang.Exception
- - if an error occurs while creating the
bill-to customer.private boolean createAccountShipto() throws java.lang.Exception
true
if the ship-to customer creation
completed successfully, otherwise false
.java.lang.Exception
- - if an error occurs while creating the
ship-to customer.private boolean createAccountUser() throws java.lang.Exception
true
if the user creation completed
successfully, otherwise false
.java.lang.Exception
- - if an error occurs while creating the
user.private boolean createAccountPermits() throws java.lang.Exception
true
if the permit creation completed
successfully, otherwise false
.java.lang.Exception
- - if an error occurs while creating the
permits.private boolean createAccountPermitsCustId() throws java.lang.Exception
true
if the permit creation completed
successfully, otherwise false
.java.lang.Exception
- - if an error occurs while creating the
permits.private boolean createAccountPermitsShipId() throws java.lang.Exception
true
if the permit creation completed
successfully, otherwise false
.java.lang.Exception
- - if an error occurs while creating the
permits.public boolean createAccountPermitsShipId(Customer baseon, Customer shipto)
baseon
- (Customer) The customer on which to base the ship-to's
permits.shipto
- (Customer) The ship-to customer to process.true
if the permit creation completed
successfully, otherwise false
.private boolean createAccountPermitsUserId() throws java.lang.Exception
true
if the permit creation completed
successfully, otherwise false
.java.lang.Exception
- - if an error occurs while creating the
permits.private boolean createAccountPreferences() throws java.lang.Exception
true
if the preferences creation
completed successfully, otherwise false
.java.lang.Exception
- - if an error occurs while creating the
preferences.private void deleteAccount()
private java.lang.String generateLogonId(java.lang.String custid) throws java.lang.Exception
custid
- (String) The customer id on which to base the auto
generation.java.lang.Exception
- - if an error occurs while generating the
logon id.private java.util.ArrayList<Customer> getAccountShiptos() throws java.lang.Exception
java.lang.Exception
- - if an error occurs while retrieving the
ship-to customers.private Customer getDefaultShipto(Customer cust) throws java.lang.Exception
cust
- (Customer) The Customer
whose default
ship-to is to be retrieved.Customer
for the
given customer, or null
if the ship-to customer
could not be retrieved.java.lang.Exception
- - if an error occurs while retrieving the
customer.private Customer getExistingCustomer(java.lang.String custid) throws java.lang.Exception
custid
- (String) The id of the customer to retrieve.Customer
for the specified customer
id, or null
if the customer could not be retrieved.java.lang.Exception
- - if an error occurs while retrieving the
customer.private boolean getReferencedCustomers(Customer cust) throws java.lang.Exception
cust
- (Customer) The Customer
whose referenced
customers are to be retrieved.true
if the referenced customers could
all be retrieved, otherwise false
.java.lang.Exception
- - if an error occurs while retrieving the
referenced 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.public boolean validateCustomer(java.lang.String custid)
custid
- (String) The id of the customer to validate.true
if the customer exists in either
database, otherwise false
.public boolean validateUser(java.lang.String userid)
userid
- (String) The id of the user to validate.true
if the user does not exist in either
database, otherwise false
.