public abstract class ERPInterfaceAS400 extends MappedAttributesObject implements ERPInterface
Modifier and Type | Class and Description |
---|---|
protected class |
ERPInterfaceAS400.Pcml
Inner class for facilitating PCML processing.
|
protected class |
ERPInterfaceAS400.Received
Inner class for facilitating received data queue record parsing.
|
Modifier and Type | Field and Description |
---|---|
protected static com.ibm.as400.access.AS400Text |
AS400TEXT3
An AS400 text field of length 3.
|
protected com.ibm.as400.access.AS400 |
ivAS400
The current AS400 connection to the ERP system.
|
protected java.util.Properties |
ivConfig
A subset of
Profile that contains only the keys and values
which specifically pertain to the implementing class. |
private static long |
serialVersionUID
The class' serialization version id.
|
ivHashCode, ivHashFlds, ivObjAttrs
ERROR_CONNECT, ERROR_NONE, ERROR_PROGRAM, WARN_DUPLICATE, WARN_NONE
Modifier | Constructor and Description |
---|---|
protected |
ERPInterfaceAS400()
The constructor for the abstract AS400 interface.
|
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
callProgram()
Calls the ERP program for execution.
|
boolean |
equals(java.lang.Object obj)
Compares the given object to this object and determines if the two are
equal.
|
FlashServletContext |
getContext()
Returns the ERP interface's servlet context (i.e.
|
protected int |
getEncryptAESLength(java.lang.String fldname)
Returns the forced length for a string to be encrypted for the given ERP
properties field name.
|
int |
getErrorType()
Returns the type of error encountered during processing.
|
protected java.lang.String |
getMixedCase(java.lang.String s)
Returns a mixed case string for the given string.
|
protected byte[] |
getQueueKey()
Returns the data queue key.
|
protected com.ibm.as400.access.RecordFormat |
getRecordFormat(java.lang.String fmtname)
Returns a record format for a record format file name.
|
protected int |
getRecordFormatFieldDecimals(com.ibm.as400.access.RecordFormat recfmt,
java.lang.String fldname)
Returns the number of decimals positions for a field based on the field's
definition in the record format.
|
protected com.ibm.as400.access.KeyedDataQueue |
getRecvQueue()
Returns a reference to the inbound receiving data queue.
|
protected com.ibm.as400.access.KeyedDataQueue |
getSendQueue()
Returns a reference to the outbound sending data queue.
|
protected java.lang.String |
getStoreCompany()
Returns the configured store company id.
|
protected java.lang.String |
getStoreWarehouse()
Returns the configured store warehouse id.
|
int |
getWarningType()
Returns the type of warning encountered during processing.
|
protected boolean |
isEncryptAES()
Answers if the configured encrypt AES flag is true.
|
protected boolean |
isYes(java.lang.String key)
Answers if a configured value in
ivConfig is yes ("Y" or "y"). |
protected abstract boolean |
parseQueueEntry(java.lang.String fmtid,
byte[] qbytes)
Parses a data queue entry that was received on the inbound receiving
data queue.
|
protected boolean |
process()
Controls the processing of an ERP interface request.
|
protected void |
readDataQueue()
Reads information placed on the inbound receiving data queue by the
called ERP program.
|
protected abstract void |
sendDataQueue()
Places information on the outbound sending data queue.
|
void |
setContext(FlashServletContext ctx)
Sets the ERP interface's servlet context (i.e.
|
void |
setErrorType(int type)
Sets the type of error encountered during processing.
|
protected void |
setQueueKey(java.lang.String seed)
Sets the data queue key.
|
void |
setWarningType(int type)
Sets the type of warning encountered during processing.
|
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
private static final long serialVersionUID
protected static final com.ibm.as400.access.AS400Text AS400TEXT3
protected java.util.Properties ivConfig
Profile
that contains only the keys and values
which specifically pertain to the implementing class. The subset keys
do not include the implementing class' prefix. Example:
In Profile:
erp.CustomerMaintenance.pcml
erp.CustomerMaintenance.prepay.default
erp.CustomerMaintenance.useMixedCase
erp.CustomerMaintenance.forceUpperCase.send
In ivConfig:
pcml
prepay.default
useMixedCase
forceUpperCase.send
protected com.ibm.as400.access.AS400 ivAS400
protected ERPInterfaceAS400()
public FlashServletContext getContext()
getContext
in ERPInterface
.getContext
in interface ERPInterface
public void setContext(FlashServletContext ctx)
setContext
in ERPInterface
.setContext
in interface ERPInterface
ctx
- (FlashServletContext) The current servlet or thread context.public int getErrorType()
getErrorType
in ERPInterface
.getErrorType
in interface ERPInterface
public void setErrorType(int type)
setErrorType
in ERPInterface
.setErrorType
in interface ERPInterface
type
- (int) The error type.public int getWarningType()
getWarningType
in ERPInterface
.getWarningType
in interface ERPInterface
public void setWarningType(int type)
setWarningType
in ERPInterface
.setWarningType
in interface ERPInterface
type
- (int) The warning type.public boolean equals(java.lang.Object obj)
equals
in MappedAttributesObject
.equals
in class MappedAttributesObject
obj
- (Object) The object to compare with this object.true
if the specified object is equal to
this object, otherwise false
.protected int getEncryptAESLength(java.lang.String fldname)
fldname
- (String) The name of a field as defined in the ERP
properties file. The value "erp.encrypt.aes.len." is prepended
to the given value prior to looking up the defined length.AS400StringEncrypter
.protected java.lang.String getMixedCase(java.lang.String s)
WordFix
corrections to the result.
This is a shortcut convenience method for
getContext().getController(WordFixController.class).getMixedCase()
.s
- (String) The string to process.protected byte[] getQueueKey()
protected void setQueueKey(java.lang.String seed)
seed
- (String) The value on which to base the key.protected com.ibm.as400.access.RecordFormat getRecordFormat(java.lang.String fmtname) throws java.lang.Exception
fmtname
- (String) The name of a record format file. If necessary
the name is prepended with a forward slash (/) and appended with
".properties".java.lang.Exception
- - if an error occurs during processing.protected int getRecordFormatFieldDecimals(com.ibm.as400.access.RecordFormat recfmt, java.lang.String fldname)
recfmt
- (RecordFormat) The record format containing the field.fldname
- (String) The name of the desired field.protected com.ibm.as400.access.KeyedDataQueue getRecvQueue() throws java.lang.Exception
java.lang.Exception
- - if an error occurs during processing.protected com.ibm.as400.access.KeyedDataQueue getSendQueue() throws java.lang.Exception
java.lang.Exception
- - if an error occurs during processing.protected java.lang.String getStoreCompany()
protected java.lang.String getStoreWarehouse()
protected boolean isEncryptAES()
true
if true, otherwise false
.protected boolean isYes(java.lang.String key)
ivConfig
is yes ("Y" or "y").key
- (String) The key for the configured value to check.true
if yes, otherwise false
.protected boolean process()
sendDataQueue
,
runProgram
and readDataQueue
abstract methods.true
if processing the request is successful,
otherwise false
.protected void readDataQueue() throws java.lang.Exception
process
after a successful
call to the ERP program. Iterates through the received queue entries for
the current queue key, determines each queue entry's record format id,
and then invokes the parseQueueEntry
method.java.lang.Exception
- - if an error occurs with reading data on
the queue.protected abstract boolean callProgram() throws java.lang.Exception
process
after
any data to be placed on the send queue has been successfully placed and
sent.true
if the call was successful, otherwise
false
.java.lang.Exception
- - if an error occurs with the running of
the ERP program.protected abstract 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.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 abstract void sendDataQueue() throws java.lang.Exception
process
as the first step after a connection to the ERP system
has been successfully established.java.lang.Exception
- - if an error occurs with placing data on
the queue and sending the queue.