atg.commerce.expression
Class ProcPropertyRestriction

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

public class ProcPropertyRestriction
extends GenericService
implements PipelineProcessor

This processor returns the value in the returnValueForTrueEvaluation or returnValueForFalseEvaluation based on whether or not a restriction on the user's rule passed or failed. If the evaluation results in true, then the error message in the errorMessage property will be added to the pipelineResult object keyed by the string in the pipelineResultErrorMessageKey property. If the expressionParser property is null then this processor will create a new instance of the atg.commerce.expression.ExpressionParser class for its own use. If the ruleEvaluator property is null then this processor will create a new instance of the atg.commerce.expression.RuleEvaluator class for its own use.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.service.pipeline.PipelineProcessor
STOP_CHAIN_EXECUTION, STOP_CHAIN_EXECUTION_AND_COMMIT, STOP_CHAIN_EXECUTION_AND_ROLLBACK
 
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
ProcPropertyRestriction()
           
 
Method Summary
protected  void addErrorMessageToPipelineResult(PipelineResult pResult, java.lang.String pErrorMessage)
          This method adds the given error message to the given PipelineResult object.
 void doStartService()
          This is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values.
 boolean getAddErrorToResultOnTrueEval()
          Returns property AddErrorToResultOnTrueEval
 java.lang.String getErrorMessage()
          Returns property errorMessage
 ExpressionParser getExpressionParser()
          Returns property ExpressionParser
 java.lang.String getPipelineResultErrorMessageKey()
          Returns property pipelineResultErrorMessageKey
 int[] getRetCodes()
          Returns the valid return codes 1 - The processor completed successfully 2 - The processor failed
 int getReturnValueForFalseEvaluation()
          Returns property returnValueForFalseEvaluation
 int getReturnValueForTrueEvaluation()
          Returns property returnValueForTrueEvaluation
 Rule getRule()
          Returns property rule
 RuleEvaluator getRuleEvaluator()
          Returns property RuleEvaluator
 java.lang.String getRuleExpression()
          Returns property ruleExpression
static void main(java.lang.String[] args)
           
 int runProcess(java.lang.Object pParam, PipelineResult pResult)
          Evaluates the ruleExpression and if true, will add the string in the errorMessage property to the PipelineResult object keyed by the string in the pipelineResultErrorMessageKey property.
 void setAddErrorToResultOnTrueEval(boolean pAddErrorToResultOnTrueEval)
          Sets property AddErrorToResultOnTrueEval
 void setErrorMessage(java.lang.String pErrorMessage)
          Sets property errorMessage
 void setExpressionParser(ExpressionParser pExpressionParser)
          Sets property ExpressionParser
 void setPipelineResultErrorMessageKey(java.lang.String pPipelineResultErrorMessageKey)
          Sets property pipelineResultErrorMessageKey
 void setReturnValueForFalseEvaluation(int pReturnValueForFalseEvaluation)
          Sets property returnValueForFalseEvaluation
 void setReturnValueForTrueEvaluation(int pReturnValueForTrueEvaluation)
          Sets property returnValueForTrueEvaluation
 void setRule(Rule pRule)
          Sets property rule
 void setRuleEvaluator(RuleEvaluator pRuleEvaluator)
          Sets property RuleEvaluator
 void setRuleExpression(java.lang.String pRuleExpression)
          Sets property ruleExpression
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, 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 java.lang.String CLASS_VERSION
Class version string

Constructor Detail

ProcPropertyRestriction

public ProcPropertyRestriction()
Method Detail

getRetCodes

public int[] getRetCodes()
Returns the valid return codes 1 - The processor completed successfully 2 - The processor failed

Specified by:
getRetCodes in interface PipelineProcessor
Returns:
an integer array of the valid return codes.

getExpressionParser

public ExpressionParser getExpressionParser()
Returns property ExpressionParser

Returns:
returns property ExpressionParser

setExpressionParser

public void setExpressionParser(ExpressionParser pExpressionParser)
Sets property ExpressionParser

Parameters:
pExpressionParser - the value to set for property ExpressionParser

getRuleEvaluator

public RuleEvaluator getRuleEvaluator()
Returns property RuleEvaluator

Returns:
returns property RuleEvaluator

setRuleEvaluator

public void setRuleEvaluator(RuleEvaluator pRuleEvaluator)
Sets property RuleEvaluator

Parameters:
pRuleEvaluator - the value to set for property RuleEvaluator

getRule

public Rule getRule()
Returns property rule

Returns:
returns property rule

setRule

public void setRule(Rule pRule)
Sets property rule

Parameters:
pRule - the value to set for property rule

getRuleExpression

public java.lang.String getRuleExpression()
Returns property ruleExpression

Returns:
returns property ruleExpression

setRuleExpression

public void setRuleExpression(java.lang.String pRuleExpression)
Sets property ruleExpression

Parameters:
pRuleExpression - the value to set for property ruleExpression

getAddErrorToResultOnTrueEval

public boolean getAddErrorToResultOnTrueEval()
Returns property AddErrorToResultOnTrueEval

Returns:
returns property AddErrorToResultOnTrueEval

setAddErrorToResultOnTrueEval

public void setAddErrorToResultOnTrueEval(boolean pAddErrorToResultOnTrueEval)
Sets property AddErrorToResultOnTrueEval

Parameters:
pAddErrorToResultOnTrueEval - the value to set for property AddErrorToResultOnTrueEval

getPipelineResultErrorMessageKey

public java.lang.String getPipelineResultErrorMessageKey()
Returns property pipelineResultErrorMessageKey

Returns:
returns property pipelineResultErrorMessageKey

setPipelineResultErrorMessageKey

public void setPipelineResultErrorMessageKey(java.lang.String pPipelineResultErrorMessageKey)
Sets property pipelineResultErrorMessageKey

Parameters:
pPipelineResultErrorMessageKey - the value to set for property pipelineResultErrorMessageKey

getErrorMessage

public java.lang.String getErrorMessage()
Returns property errorMessage

Returns:
returns property errorMessage

setErrorMessage

public void setErrorMessage(java.lang.String pErrorMessage)
Sets property errorMessage

Parameters:
pErrorMessage - the value to set for property errorMessage

getReturnValueForTrueEvaluation

public int getReturnValueForTrueEvaluation()
Returns property returnValueForTrueEvaluation

Returns:
returns property returnValueForTrueEvaluation

setReturnValueForTrueEvaluation

public void setReturnValueForTrueEvaluation(int pReturnValueForTrueEvaluation)
Sets property returnValueForTrueEvaluation

Parameters:
pReturnValueForTrueEvaluation - the value to set for property returnValueForTrueEvaluation

getReturnValueForFalseEvaluation

public int getReturnValueForFalseEvaluation()
Returns property returnValueForFalseEvaluation

Returns:
returns property returnValueForFalseEvaluation

setReturnValueForFalseEvaluation

public void setReturnValueForFalseEvaluation(int pReturnValueForFalseEvaluation)
Sets property returnValueForFalseEvaluation

Parameters:
pReturnValueForFalseEvaluation - the value to set for property returnValueForFalseEvaluation

doStartService

public void doStartService()
                    throws ServiceException
This is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values.

Overrides:
doStartService in class GenericService
Throws:
ServiceException - if the Service had a problem starting up

runProcess

public int runProcess(java.lang.Object pParam,
                      PipelineResult pResult)
               throws java.lang.Exception
Evaluates the ruleExpression and if true, will add the string in the errorMessage property to the PipelineResult object keyed by the string in the pipelineResultErrorMessageKey property.

Specified by:
runProcess in interface PipelineProcessor
Parameters:
pParam - a HashMap which must contain the objects to satisfy the rules
pResult - a PipelineResult object which stores any information which must be returned from this method invokation
Returns:
an integer specifying the processor's return code
Throws:
java.lang.Exception - throws any exception back to the caller
See Also:
PipelineProcessor.runProcess(Object, PipelineResult)

addErrorMessageToPipelineResult

protected void addErrorMessageToPipelineResult(PipelineResult pResult,
                                               java.lang.String pErrorMessage)
This method adds the given error message to the given PipelineResult object. If the pipelineResultErrorMessageKey is not null, then it is used as the value to reference into the map to store and retrieve the error message. If pErrorMessage is null then no message is added to the result object.

Parameters:
pResult - the PipelineResult object to store the error message in
pErrorMessage - the error message to store
See Also:
PipelineResult

main

public static void main(java.lang.String[] args)