com.jp.protection.priv.pro.parser.text
Class TextOrderParser

java.lang.Object
  extended by com.jp.protection.priv.pro.parser.OrderParser
      extended by com.jp.protection.priv.pro.parser.text.TextOrderParser
All Implemented Interfaces:
java.io.Serializable

public class TextOrderParser
extends OrderParser
implements java.io.Serializable

See Also:
Serialized Form

Nested Class Summary
static class TextOrderParser.GenericProvider
           
static class TextOrderParser.IntegerFormat
           
static class TextOrderParser.PropertyInfo
           
 
Nested classes/interfaces inherited from class com.jp.protection.priv.pro.parser.OrderParser
OrderParser.Error, OrderParser.PropertyError, OrderParser.PropertyValue, OrderParser.Provider, OrderParser.ProviderRegistry
 
Field Summary
static java.lang.String FORMAT_TAG_GENERIC
           
protected  java.util.HashMap fPropertyInfoMap
           
protected  java.lang.String fSupportedFormatTag
           
(package private) static java.util.Map STATE_MAP
           
 
Fields inherited from class com.jp.protection.priv.pro.parser.OrderParser
fOrderParserListenerSupport, fStopped, PROPERTY_CUSTOMER, PROPERTY_CUSTOMER_ADDRESS, PROPERTY_CUSTOMER_CITY, PROPERTY_CUSTOMER_COMPANY, PROPERTY_CUSTOMER_COUNTRY, PROPERTY_CUSTOMER_EMAIL, PROPERTY_CUSTOMER_FIRST_NAME, PROPERTY_CUSTOMER_LAST_NAME, PROPERTY_CUSTOMER_PHONE, PROPERTY_CUSTOMER_STATE, PROPERTY_CUSTOMER_TITLE, PROPERTY_CUSTOMER_ZIP, PROPERTY_LICENSE, PROPERTY_LICENSE_NUMBER, PROPERTY_LICENSE_NUMBER_COPIES, PROPERTY_ORDER, PROPERTY_ORDER_NET_SALES, PROPERTY_ORDER_PAYMENT_TYPE, PROPERTY_ORDER_TOTAL_SALES, PROPERTY_PRODUCT, PROPERTY_PRODUCT_ALIAS
 
Constructor Summary
TextOrderParser()
           
TextOrderParser(java.lang.String aSupportedFormatTag)
           
 
Method Summary
 void addPropertyInfo(TextOrderParser.PropertyInfo aPropertyInfo)
           
protected  void checkForMandatoryProperties(java.util.Set aReadPropertySet)
           
protected  java.lang.String fixCountry(java.lang.String aTag, java.lang.String aValue)
           
protected  java.lang.String fixState(java.lang.String aTag, java.lang.String aValue)
           
 TextOrderParser.PropertyInfo getPropertyInfo(java.lang.String aTag)
           
 java.util.HashMap getPropertyInfoMap()
           
 java.lang.String getSupportedFormatTag()
           
 boolean isSupportedFormat(java.io.InputStream anInputStream)
          Tests whether this parser supports format of the passed order
protected  void onPropertyRead(java.util.Set aReadPropertySet, TextOrderParser.PropertyInfo aPropertyInfo, java.lang.String aValue, int aLine, int aColumn)
           
 void parse(java.io.InputStream anInputStream)
           Parses passed order.
 void setPropertyInfoMap(java.util.HashMap aPropertyInfoMap)
           
 void setSupportedFormatTag(java.lang.String aSupportedFormatTag)
           
 
Methods inherited from class com.jp.protection.priv.pro.parser.OrderParser
addOrderParserListener, fireError, fireParseFinished, fireParseStarted, firePropertyRead, getCustomerPropertyName, getLicensePropertyName, getProductPropertyName, isCustomerProperty, isLicenseProperty, isProductProperty, isStopped, removeOrderParserListener, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fSupportedFormatTag

protected java.lang.String fSupportedFormatTag

fPropertyInfoMap

protected java.util.HashMap fPropertyInfoMap

STATE_MAP

static final java.util.Map STATE_MAP

FORMAT_TAG_GENERIC

public static final java.lang.String FORMAT_TAG_GENERIC
See Also:
Constant Field Values
Constructor Detail

TextOrderParser

public TextOrderParser(java.lang.String aSupportedFormatTag)

TextOrderParser

public TextOrderParser()
Method Detail

getSupportedFormatTag

public java.lang.String getSupportedFormatTag()

setSupportedFormatTag

public void setSupportedFormatTag(java.lang.String aSupportedFormatTag)

getPropertyInfoMap

public java.util.HashMap getPropertyInfoMap()

setPropertyInfoMap

public void setPropertyInfoMap(java.util.HashMap aPropertyInfoMap)

addPropertyInfo

public void addPropertyInfo(TextOrderParser.PropertyInfo aPropertyInfo)

getPropertyInfo

public TextOrderParser.PropertyInfo getPropertyInfo(java.lang.String aTag)

isSupportedFormat

public boolean isSupportedFormat(java.io.InputStream anInputStream)
Description copied from class: OrderParser
Tests whether this parser supports format of the passed order

Specified by:
isSupportedFormat in class OrderParser
Parameters:
anInputStream - input stream containing an order to test
Returns:
true if this parser is capable of passed order parsing; false otherwise.

onPropertyRead

protected void onPropertyRead(java.util.Set aReadPropertySet,
                              TextOrderParser.PropertyInfo aPropertyInfo,
                              java.lang.String aValue,
                              int aLine,
                              int aColumn)

parse

public void parse(java.io.InputStream anInputStream)
Description copied from class: OrderParser

Parses passed order. Actual implementation of the method should:

  1. Notify interested parties about process start by calling fireParseStarted(...) method;
  2. Read order properties from the input stream and notify interested parties about each property which has been read by calling firePropertyRead(...) method. For any errors occurred during order parsing the fireError(...) method should be called to let interested parties log errors. Note it is strongly recommended to support reading all the properties with names starting with PROPERTY_PRODUCT_, PROPERTY_CUSTOMER_ and PROPERTY_LICENSE_;
  3. Notify interested parties about process finish by calling fireParseFinished(...) method;

Specified by:
parse in class OrderParser
Parameters:
anInputStream - input stream containing an order to parse

fixCountry

protected java.lang.String fixCountry(java.lang.String aTag,
                                      java.lang.String aValue)

fixState

protected java.lang.String fixState(java.lang.String aTag,
                                    java.lang.String aValue)

checkForMandatoryProperties

protected void checkForMandatoryProperties(java.util.Set aReadPropertySet)