|
© 2001 BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.bea.commerce.campaign.ScenarioHelper
Utility helper class for campaigns and scenarios.
Field Summary | |
static int |
FALSE
Database indicator for false in NUMBER columns. |
static long |
GOAL_CHECK_TIME
How often should the campaign service check campaign goals, in milliseconds. |
static java.lang.String |
LOG_APP_NAME
The logging application name. |
static boolean |
LOG_VERBOSE
Does this log verbose messages. |
static int |
TRUE
Database indicator for true in NUMBER columns. |
Constructor Summary | |
ScenarioHelper()
|
Method Summary | |
static java.lang.String |
checkAttribute(org.w3c.dom.Element e,
java.lang.String name,
java.lang.String val)
Check if the value of the element's required attribute is the desired value. |
static java.lang.String |
checkAttribute(org.w3c.dom.Element e,
java.lang.String name,
java.lang.String[] vals)
Check if the value of the element's required attribute is in the list of possible values. |
static java.lang.String |
checkAttribute(org.w3c.dom.Element e,
java.lang.String name,
java.lang.String val1,
java.lang.String val2)
Check if the value of the element's required attribute is one of the desired values. |
static void |
close(java.sql.Connection con)
Close a connection, ignoring any errors. |
static void |
close(java.sql.ResultSet rs)
Close a result set, ignoring any errors. |
static void |
close(java.sql.Statement stmt)
Close a statement, ignoring any errors. |
static java.lang.String |
getAttribute(org.w3c.dom.Element e,
java.lang.String name)
Get the value of an element's required attribute. |
static boolean |
getBoolean(java.sql.ResultSet rs,
int index)
Get a boolean from a numeric column. |
static java.lang.String |
getCampaignId(Event evt)
Get the campaign id from an Event. |
static java.lang.String |
getCharacterData(org.w3c.dom.Element e)
Get the character data contained in the element. |
static java.sql.Timestamp |
getISO8601Date(org.w3c.dom.Element e)
Get a date from a the ISO 8601 formatted character data contained in an element. |
static java.lang.String |
getNodeType(org.w3c.dom.Node n)
Get the node's type as a string. |
static java.lang.String |
getNodeType(short type)
Get a string describing the Node type. |
static java.lang.String |
getTagName(org.w3c.dom.Element e)
Get the non-namespace-prefixed tag name of an element. |
static java.lang.String |
getUserId(Event evt)
Get the user id from an Event. |
static ProfileWrapper |
getUserProfileWrapper(java.lang.String userId,
javax.servlet.http.HttpServletRequest req)
Get a user profile wrapper for the given user id from the given request. |
static void |
log(int level,
java.lang.String mesg,
java.lang.Throwable ex)
Log a verbose campaign/scenario message. |
static void |
logDebug(java.lang.String mesg)
Log a debug campaign/scenario message. |
static void |
logDebug(java.lang.String mesg,
java.lang.Throwable ex)
Log a debug campaign/scenario message. |
static void |
logError(java.lang.String mesg)
Log an error campaign/scenario message. |
static void |
logError(java.lang.String mesg,
java.lang.Throwable ex)
Log an error campaign/scenario message. |
static void |
logInfo(java.lang.String mesg)
Log an informational campaign/scenario message. |
static void |
logInfo(java.lang.String mesg,
java.lang.Throwable ex)
Log an informational campaign/scenario message. |
static void |
logVerbose(java.lang.String mesg)
Log a verbose campaign/scenario message. |
static void |
logVerbose(java.lang.String mesg,
java.lang.Throwable ex)
Log a verbose campaign/scenario message. |
static void |
logWarning(java.lang.String mesg)
Log a warning campaign/scenario message. |
static void |
logWarning(java.lang.String mesg,
java.lang.Throwable ex)
Log a warning campaign/scenario message. |
static org.w3c.dom.Document |
parse(org.xml.sax.InputSource src)
Parse an input source, using the P13NEntityResolver . |
static org.w3c.dom.Document |
parse(org.xml.sax.InputSource src,
boolean validate)
Parse an input source, using the P13NEntityResolver . |
static org.w3c.dom.Document |
parse(java.io.Reader in)
Parse an input stream, using the P13NEntityResolver . |
static org.w3c.dom.Document |
parse(java.io.Reader in,
boolean validate)
Parse an input stream, using the P13NEntityResolver . |
static void |
setBoolean(java.sql.PreparedStatement stmt,
int index,
boolean b)
Set a boolean in a numeric column. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String LOG_APP_NAME
public static final int TRUE
public static final int FALSE
public static final boolean LOG_VERBOSE
This will be initialized via the "campaign.debug.log.verbose" property in the weblogiccommerce.properties file or in the system properties.
public static final long GOAL_CHECK_TIME
This will be initialized via the "campaign.goals.checkTime" property in the weblogiccommerce.properties file. A value of 0 or less means check every time. It default to 5 minutes (300,000ms.)
Constructor Detail |
public ScenarioHelper()
Method Detail |
public static ProfileWrapper getUserProfileWrapper(java.lang.String userId, javax.servlet.http.HttpServletRequest req) throws UserManagementException
This will first try the profile in the request/session, then it will attempt to retrieve a profile.
public static java.lang.String getUserId(Event evt)
This checks the following event attributes, in this order:
public static java.lang.String getCampaignId(Event evt)
This checks the following event attributes, in this order:
public static org.w3c.dom.Document parse(org.xml.sax.InputSource src, boolean validate) throws org.xml.sax.SAXException, java.io.IOException
P13NEntityResolver
.src
- the input source.validate
- true to validate, false to not.org.xml.sax.SAXException
- thrown on a parse error.java.io.IOException
- thrown on an error reading the input source.public static org.w3c.dom.Document parse(org.xml.sax.InputSource src) throws org.xml.sax.SAXException, java.io.IOException
P13NEntityResolver
.src
- the input source.org.xml.sax.SAXException
- thrown on a parse error.java.io.IOException
- thrown on an error reading the input source.public static org.w3c.dom.Document parse(java.io.Reader in, boolean validate) throws org.xml.sax.SAXException, java.io.IOException
P13NEntityResolver
.in
- the input stream.validate
- true to validate, false to not.org.xml.sax.SAXException
- thrown on a parse error.java.io.IOException
- thrown on an error reading the input source.public static org.w3c.dom.Document parse(java.io.Reader in) throws org.xml.sax.SAXException, java.io.IOException
P13NEntityResolver
.in
- the input stream.validate
- true to validate, false to not.org.xml.sax.SAXException
- thrown on a parse error.java.io.IOException
- thrown on an error reading the input source.public static java.lang.String getTagName(org.w3c.dom.Element e)
DOMHelper.getTagName(org.w3c.dom.Element)
public static java.lang.String getAttribute(org.w3c.dom.Element e, java.lang.String name) throws java.lang.IllegalArgumentException
e
- the element.name
- the attribute name.java.lang.IllegalArgumentException
- thrown if the attribute is not set.public static java.lang.String checkAttribute(org.w3c.dom.Element e, java.lang.String name, java.lang.String[] vals) throws java.lang.IllegalArgumentException
e
- the element.name
- the attribute name.vals
- the possible values.java.lang.IllegalArgumentException
- thrown if the attribute is not set or
it's value is not one of the possible values.public static java.lang.String checkAttribute(org.w3c.dom.Element e, java.lang.String name, java.lang.String val) throws java.lang.IllegalArgumentException
e
- the element.name
- the attribute name.val
- the desired value.java.lang.IllegalArgumentException
- thrown if the attribute is not set or
it's value is not the desired value.public static java.lang.String checkAttribute(org.w3c.dom.Element e, java.lang.String name, java.lang.String val1, java.lang.String val2) throws java.lang.IllegalArgumentException
e
- the element.name
- the attribute name.val1
- the 1st desired value.val2
- the 2st desired value.java.lang.IllegalArgumentException
- thrown if the attribute is not set or
it's value is not one of the desired values.public static java.lang.String getCharacterData(org.w3c.dom.Element e) throws java.lang.IllegalArgumentException
If the character data is a CDATA section, it will be returned intact. Otherwise, it will be trimmed of leading and trailing whitespace.
e
- the element.java.lang.IllegalArgumentException
- thrown if the element does not contain
only character data.public static java.sql.Timestamp getISO8601Date(org.w3c.dom.Element e) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- thrown on an error.XMLDateTimeUtil
public static java.lang.String getNodeType(org.w3c.dom.Node n)
public static java.lang.String getNodeType(short type)
public static void close(java.sql.Connection con)
JdbcHelper.close(java.sql.Connection)
public static void close(java.sql.Statement stmt)
JdbcHelper.close(java.sql.Statement)
public static void close(java.sql.ResultSet rs)
JdbcHelper.close(java.sql.ResultSet)
public static boolean getBoolean(java.sql.ResultSet rs, int index) throws java.sql.SQLException
TRUE
,
FALSE
public static void setBoolean(java.sql.PreparedStatement stmt, int index, boolean b) throws java.sql.SQLException
TRUE
,
FALSE
public static void logVerbose(java.lang.String mesg, java.lang.Throwable ex)
public static void logVerbose(java.lang.String mesg)
public static void logDebug(java.lang.String mesg, java.lang.Throwable ex)
public static void logDebug(java.lang.String mesg)
public static void logInfo(java.lang.String mesg, java.lang.Throwable ex)
public static void logInfo(java.lang.String mesg)
public static void logWarning(java.lang.String mesg, java.lang.Throwable ex)
public static void logWarning(java.lang.String mesg)
public static void logError(java.lang.String mesg, java.lang.Throwable ex)
public static void logError(java.lang.String mesg)
public static void log(int level, java.lang.String mesg, java.lang.Throwable ex)
|
© 2001 BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |