public class CustomerMaintenance extends ERPInterfaceAS400 implements ICustomerMaintenance
ERPInterfaceAS400.Pcml, ERPInterfaceAS400.Received
Modifier and Type | Field and Description |
---|---|
protected Customer |
ivCustomer
The supplied customer being maintained.
|
protected java.lang.String |
ivCustomerId
A WIP customer id.
|
protected java.lang.String |
ivInitId
The supplied id of the user initiating the maintenance.
|
protected char |
ivMode
The current mode being processed.
|
protected java.util.ArrayList<Customer> |
ivShiptos
A WIP collection of shiptos for a customer.
|
protected int |
ivType
The supplied type of customer being maintained (account, shipto).
|
private static long |
serialVersionUID
The class' serialization version id.
|
AS400TEXT3, ivAS400, ivConfig
ivHashCode, ivHashFlds, ivObjAttrs
ERROR_DUPLICATE, TYPE_ACCOUNT, TYPE_SHIPTO
ERROR_CONNECT, ERROR_NONE, ERROR_PROGRAM, WARN_DUPLICATE, WARN_NONE
Constructor and Description |
---|
CustomerMaintenance()
Constructs a new ERP customer maintenance interface.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
callProgram()
Calls the ERP program for execution.
|
boolean |
createCustomer(Customer customer,
int type,
java.lang.String initid)
Creates a new customer record in the ERP system.
|
boolean |
deleteCustomer(Customer customer,
java.lang.String initid)
Deletes a customer record in the ERP system.
|
protected Country |
findCountry(java.lang.String code)
Returns the country record for the given code.
|
protected State |
findState(java.lang.String code,
java.lang.String cntry)
Returns the state record for the given state code and country code.
|
Customer |
getCustomer(java.lang.String customerId)
Retrieves a customer record from the ERP system.
|
Customer |
getCustomer(java.lang.String customerId,
java.lang.String queueId)
Retrieves a customer record from the ERP system.
|
java.util.ArrayList<Customer> |
getShipForCustomers(java.lang.String customerId)
Returns a collection of customer records from the ERP system which have
shipfor id equal customer id.
|
protected Customer |
parseCustomer(ERPInterfaceAS400.Received rec)
Parses customer data from the receive data queue and returns a customer
object.
|
protected boolean |
parseQueueEntry(java.lang.String fmtid,
byte[] qbytes)
Parses a data queue entry that was received on the inbound receiving
data queue.
|
protected void |
resetVariables()
Resets the class' instance variables for the start of a new request.
|
protected void |
sendDataQueue()
Places information on the outbound sending data queue.
|
boolean |
updateCustomer(Customer customer,
java.lang.String initid)
Updates a customer record in the ERP system.
|
equals, getContext, getEncryptAESLength, getErrorType, getMixedCase, getQueueKey, getRecordFormat, getRecordFormatFieldDecimals, getRecvQueue, getSendQueue, getStoreCompany, getStoreWarehouse, getWarningType, isEncryptAES, isYes, process, readDataQueue, setContext, setErrorType, setQueueKey, setWarningType
cloneMapAttributes, formatValue, formatValue, getHashFields, getMapArrayList, getMapAttributes, getMapBigDecimal, getMapBoolean, getMapDate, getMapDouble, getMapInteger, getMapLong, getMapMapped, getMapObject, getMapShort, getMapString, getMapString, getMapStringBuffer, getMapStringBuilder, getMapTime, getMapTimestamp, getMapVector, hashCode, setHashFields, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMapAttributes, setMapObject, setMapTime, setMapTimestamp, toStringArray
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getContext, getErrorType, getWarningType, setContext, setErrorType, setWarningType
private static final long serialVersionUID
protected Customer ivCustomer
protected int ivType
protected java.lang.String ivInitId
protected char ivMode
protected java.lang.String ivCustomerId
protected java.util.ArrayList<Customer> ivShiptos
public CustomerMaintenance()
public boolean createCustomer(Customer customer, int type, java.lang.String initid)
createCustomer
in ICustomerMaintenance
.createCustomer
in interface ICustomerMaintenance
customer
- (Customer) The customer object to create. A new
customer id will be assigned and set in this customer object.type
- (int) The type of customer that is to be created. Must
be one of the predefined types (TYPE_ACCOUNT, TYPE_SHIPTO).initid
- (String) The id of the user initiating the create.true
if the customer was successfully added,
otherwise false
.public boolean updateCustomer(Customer customer, java.lang.String initid)
updateCustomer
in ICustomerMaintenance
.updateCustomer
in interface ICustomerMaintenance
customer
- (Customer) The customer object containing the new
information.initid
- (String) The id of the user initiating the update.true
if the customer was successfully updated
otherwise false
.public boolean deleteCustomer(Customer customer, java.lang.String initid)
deleteCustomer
in ICustomerMaintenance
.deleteCustomer
in interface ICustomerMaintenance
customer
- (Customer) The customer object for the customer to
delete.initid
- (String) The id of the user initiating the delete.true
if the customer was successfully deleted
otherwise false
.public Customer getCustomer(java.lang.String customerId)
getCustomer
in ICustomerMaintenance
.getCustomer
in interface ICustomerMaintenance
customerId
- (String) The id for the customer to retrieve.public Customer getCustomer(java.lang.String customerId, java.lang.String queueId)
getCustomer
in ICustomerMaintenance
.getCustomer
in interface ICustomerMaintenance
customerId
- (String) The id for the customer to retrieve.queueId
- (String) The value to use when creating the queue key,
if a value other than the current session id is desired.public java.util.ArrayList<Customer> getShipForCustomers(java.lang.String customerId)
getShipForCustomers
in ICustomerMaintenance
.getShipForCustomers
in interface ICustomerMaintenance
customerId
- (String) The shipfor id for the customers to retrieve.protected boolean callProgram() throws java.lang.Exception
process
after
any data to be placed on the send queue has been successfully placed and
sent.
Overrides callProgram
in ERPInterfaceAS400
.callProgram
in class ERPInterfaceAS400
true
if the call was successful, otherwise
false
.java.lang.Exception
- - if an error occurs with the running of
the ERP program.protected boolean parseQueueEntry(java.lang.String fmtid, byte[] qbytes) throws java.lang.Exception
readDataQueue
for each queue entry that
is read for the current queue key.
Overrides parseQueueEntry
in ERPInterfaceAS400
.parseQueueEntry
in class ERPInterfaceAS400
fmtid
- (String) The record format id of the queue entry.qbytes
- (byte[]) The data queue entry's raw data.true
to read the next entry from the receive
data queue or false
to stop reading.java.lang.Exception
- - if an error occurs with reading data on
the queue.protected void sendDataQueue() throws java.lang.Exception
process
as the first step after a connection to the ERP system
has been successfully established.
Overrides sendDataQueue
in ERPInterfaceAS400
.sendDataQueue
in class ERPInterfaceAS400
java.lang.Exception
- - if an error occurs with placing data on
the queue and sending the queue.protected Country findCountry(java.lang.String code)
code
- (String) The country code for the desired record.null
.protected State findState(java.lang.String code, java.lang.String cntry)
code
- (String) The state code for the desired record.cntry
- (String) The country code for the desired record.null
.protected Customer parseCustomer(ERPInterfaceAS400.Received rec) throws java.lang.Exception
rec
- (Received) The receive data queue data.java.lang.Exception
- - if an error occurs during the parsing of
the queue's data.protected void resetVariables()