atg.commerce.expression
Class ExpressionParser

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.expression.ExpressionParser
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class ExpressionParser
extends GenericService

This class parses an expression and generates the Rule tree. The Rule tree is represented via a Rule object and its contained sub objects. The supported operations are =, !=, <, >, <=, >=, contains, and containskey. An expression has a left and right side which can be a String, a constant number (integer or real), a bean value, a collection or array element, or a map or dictionary keyed value. Below are examples of expressions:
6 = 6 (This compares two constants)
Order.priceInfo.amount>1000.0 (This compares the amount of the order to 1000.0)
Order.priceInfo.amount>Profile.allowedAmount (This compares the amount of the order to a property called allowedAmount in the Profile)
Order.commerceItems[2].quantity > Profile.maxAllowedQuantity (This compares the commerce item's quantity in location 2 to the Profile's maxAllowQuantity property)
Order.specialInstructions.allow = true (This compares the specialInstruction whose key is "allow" to the boolean value true)
Reserved expressions are true, false, null. Supported operators are =, !=, <, <=, >, >=, contains, containskey Expressions can be a string of digits to represent a number (ex. - 45) Expressions can be Strings which should be enclosed in double quotes (ex.- "string") Expressions can be characters which should be enclosed in single quotes (ex.- 'c') Expressions can be bean strings such as bean.bean.property Expressions can be collection or array elements and should be an expression similar to collection[0] or collection[0].elementProperty Expressions can contain map or dictionary keys and should be an expression similar to map.key or map.key.elementProperty


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected static java.util.ResourceBundle sResourceBundle
          Resource Bundle
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
ExpressionParser()
           
 
Method Summary
 java.lang.String getLoggingIdentifier()
          Returns property LoggingIdentifier
 Rule parseExpression(java.lang.String pExpression)
          This method parses an expression and generates a Rule tree.
 void setLoggingIdentifier(java.lang.String pLoggingIdentifier)
          Sets property LoggingIdentifier
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values

sResourceBundle

protected static java.util.ResourceBundle sResourceBundle
Resource Bundle

Constructor Detail

ExpressionParser

public ExpressionParser()
Method Detail

setLoggingIdentifier

public void setLoggingIdentifier(java.lang.String pLoggingIdentifier)
Sets property LoggingIdentifier


getLoggingIdentifier

public java.lang.String getLoggingIdentifier()
Returns property LoggingIdentifier


parseExpression

public Rule parseExpression(java.lang.String pExpression)
                     throws java.text.ParseException
This method parses an expression and generates a Rule tree.

Parameters:
pExpression - the expression to parse
Throws:
java.text.ParseException - thrown if a parsing error occurs