Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2008 BEA Systems, Inc. All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.campaign
Class ScenarioHelper

    java.lang.Object
      com.bea.campaign.ScenarioHelper

    public class ScenarioHelper

extends Object

Utility helper class for campaigns and scenarios.

Field Summary
`static int` | `FALSE` Database indicator for false in NUMBER columns.
`static long` | `GOAL_CHECK_TIME` Deprecated Use CampaignServiceMBean.getGoalCheckTime() instead.
`static String` | `LOG_APP_NAME` The logging application name.
`static boolean` | `LOG_VERBOSE` Deprecated Use Debug instead.
`static int` | `TRUE` Database indicator for true in NUMBER columns.

Constructor Summary
`ScenarioHelper()`

Method Summary
`static String` | `checkAttribute(Element e, String name, String val)` Check if the value of the element's required attribute is the desired value.
`static String` | `checkAttribute(Element e, String name, String[] vals)` Check if the value of the element's required attribute is in the list of possible values.
`static String` | `checkAttribute(Element e, String name, String val1, String val2)` Check if the value of the element's required attribute is one of the desired values.
`static void` | `close(Connection con)` Close a connection, ignoring any errors.
`static void` | `close(ResultSet rs)` Close a result set, ignoring any errors.
`static void` | `close(Statement stmt)` Close a statement, ignoring any errors.
`static String` | `getAttribute(Element e, String name)` Get the value of an element's required attribute.
`static boolean` | `getBoolean(ResultSet rs, int index)` Get a boolean from a numeric column.
`static String` | `getCampaignId(Event evt)` Get the campaign id from an Event.
`static String` | `getCharacterData(Element e)` Get the character data contained in the element.
`static String` | `getDataId(Element e)` Get the value of an element's data:id (http://www.bea.com/servers/p13n/xsd/data-sync/document-link/1.0.1)
`static DocumentBuilder` | `getDocumentBuilder()` Get a default DocumentBuilder.
`static DocumentBuilder` | `getDocumentBuilder(boolean validate)` Get an either validating or non-validating DocumentBuilder.
`static Timestamp` | `getISO8601Date(Element e)` Get a date from a the ISO 8601 formatted character data contained in an element.
`static String` | `getNodeType(Node n)` Get the node's type as a string.
`static String` | `getNodeType(short type)` Get a string describing the Node type.
`static Request` | `getRequestFromEvent(Event evt)` Get the request from the event.
`static Session` | `getSessionFromEvent(Event evt)` Get the session from the event.
`static String` | `getTagName(Element e)` Get the non-namespace-prefixed tag name of an element.
`static String` | `getUserId(Event evt)` Get the user id from an Event.
`static ProfileWrapper` | `getUserProfileWrapper(String userId, javax.servlet.http.HttpServletRequest req)` Get a user profile wrapper for the given user id from the given request.
`static String[]` | `isTrackedUserRegistration(Event evt)` Determine if the specified event represent a tracked user registration.
`static void` | `log(int level, String mesg, Throwable ex)` Deprecated Use WLS logging instead
`static void` | `logDebug(String mesg)` Deprecated Use Debug instead
`static void` | `logDebug(String mesg, Throwable ex)` Deprecated Use Debug instead
`static void` | `logError(String mesg)` Deprecated Use WLS logging instead
`static void` | `logError(String mesg, Throwable ex)` Deprecated Use WLS logging instead
`static void` | `logInfo(String mesg)` Deprecated Use WLS logging instead
`static void` | `logInfo(String mesg, Throwable ex)` Deprecated Use WLS logging instead
`static void` | `logVerbose(String mesg)` Deprecated Use Debug instead
`static void` | `logVerbose(String mesg, Throwable ex)` Deprecated Use Debug instead
`static void` | `logWarning(String mesg)` Deprecated Use WLS logging instead
`static void` | `logWarning(String mesg, Throwable ex)` Deprecated Use WLS logging instead
`static Document` | `parse(DocumentBuilder parser, InputSource src)` Parse an input source, using the `DefaultEntityResolver`.
`static Document` | `parse(InputSource src)` Parse an input source, using the `DefaultEntityResolver`.
`static Document` | `parse(InputSource src, boolean validate)` Parse an input source, using the `DefaultEntityResolver`.
`static Document` | `parse(Reader in)` Parse an input stream, using the `DefaultEntityResolver`.
`static Document` | `parse(Reader in, boolean validate)` Parse an input stream, using the `DefaultEntityResolver`.
`static void` | `setBoolean(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

### LOG_APP_NAME

    public static final String LOG_APP_NAME

  The logging application name.

  See Also
    Constants Summary

### TRUE

    public static final int TRUE

  Database indicator for true in NUMBER columns.

  See Also
    Constants Summary

### FALSE

    public static final int FALSE

  Database indicator for false in NUMBER columns.

  See Also
    Constants Summary

### LOG_VERBOSE

    public static final boolean LOG_VERBOSE

  Deprecated Use Debug instead.
  Does this log verbose messages.

  This is always initialized to false now.

  See Also
    `Debug`, Constants Summary

### GOAL_CHECK_TIME

    public static final long GOAL_CHECK_TIME

  Deprecated Use CampaignServiceMBean.getGoalCheckTime() instead.
  How often should the campaign service check campaign goals, in milliseconds.

  This is always set to 300,000ms (5 minutes).

  See Also
    Constants Summary

Constructor Detail

### ScenarioHelper

    public ScenarioHelper()

Method Detail

### getUserProfileWrapper

    public static ProfileWrapper getUserProfileWrapper(String userId,
                                                       javax.servlet.http.HttpServletRequest req)
                                                throws ProfileNotFoundException,
                                                       RemoteException

  Get a user profile wrapper for the given user id from the given request.

  This will first try the profile in the request/session, then it will attempt to retrieve a profile.

  Throws
    `ProfileNotFoundException`
    `RemoteException`
  See Also
    `SessionHelper`

### getRequestFromEvent

    public static Request getRequestFromEvent(Event evt)

  Get the request from the event.

### getSessionFromEvent

    public static Session getSessionFromEvent(Event evt)

  Get the session from the event.

### getUserId

    public static String getUserId(Event evt)

  Get the user id from an Event.

  This checks the following event attributes, in this order:

  1. username of the profile identity of a profile in the request in the event
  2. user-id
  3. user_id
  4. userId
  5. userid
  6. USERID

### getCampaignId

    public static String getCampaignId(Event evt)

  Get the campaign id from an Event.

  This checks the following event attributes, in this order:

  1. campaign-id
  2. campaign_id
  3. campaignId
  4. campaignid
  5. CAMPAIGNID

### isTrackedUserRegistration

    public static String[] isTrackedUserRegistration(Event evt)

  Determine if the specified event represent a tracked user registration.

  Returns
    { trackingId, userId } if is tracked user registration, null if not.

### getDocumentBuilder

    public static DocumentBuilder getDocumentBuilder()
                                              throws SAXException

  Get a default DocumentBuilder.

  Throws
    `SAXException`

### getDocumentBuilder

    public static DocumentBuilder getDocumentBuilder(boolean validate)
                                              throws SAXException

  Get an either validating or non-validating DocumentBuilder.

  Throws
    `SAXException`

### parse

    public static Document parse(DocumentBuilder parser,
                                 InputSource src)
                          throws SAXException,
                                 IOException

  Parse an input source, using the `DefaultEntityResolver`.

  Parameters
    `parser` - the document builder to use.
    `src` - the input source.
  Returns
    a DOM Document of the XML.
  Throws
    `SAXException` - thrown on a parse error.
    `IOException` - thrown on an error reading the input source.

### parse

    public static Document parse(InputSource src,
                                 boolean validate)
                          throws SAXException,
                                 IOException

  Parse an input source, using the `DefaultEntityResolver`.

  Parameters
    `src` - the input source.
    `validate` - true to validate, false to not.
  Returns
    a DOM Document of the XML.
  Throws
    `SAXException` - thrown on a parse error.
    `IOException` - thrown on an error reading the input source.

### parse

    public static Document parse(InputSource src)
                          throws SAXException,
                                 IOException

  Parse an input source, using the `DefaultEntityResolver`.

  Parameters
    `src` - the input source.
  Returns
    a DOM Document of the XML.
  Throws
    `SAXException` - thrown on a parse error.
    `IOException` - thrown on an error reading the input source.

### parse

    public static Document parse(Reader in,
                                 boolean validate)
                          throws SAXException,
                                 IOException

  Parse an input stream, using the `DefaultEntityResolver`.

  Parameters
    `in` - the input stream.
    `validate` - true to validate, false to not.
  Returns
    a DOM Document of the XML.
  Throws
    `SAXException` - thrown on a parse error.
    `IOException` - thrown on an error reading the input source.

### parse

    public static Document parse(Reader in)
                          throws SAXException,
                                 IOException

  Parse an input stream, using the `DefaultEntityResolver`.

  Parameters
    `in` - the input stream.
    `validate` - true to validate, false to not.
  Returns
    a DOM Document of the XML.
  Throws
    `SAXException` - thrown on a parse error.
    `IOException` - thrown on an error reading the input source.

### getTagName

    public static String getTagName(Element e)

  Get the non-namespace-prefixed tag name of an element.

  See Also
    `DomHelper.getTagName(org.w3c.dom.Element)`

### getAttribute

    public static String getAttribute(Element e,
                                      String name)
                               throws IllegalArgumentException

  Get the value of an element's required attribute.

  Parameters
    `e` - the element.
    `name` - the attribute name.
  Returns
    the attribute value.
  Throws
    `IllegalArgumentException` - thrown if the attribute is not set.

### getDataId

    public static String getDataId(Element e)

  Get the value of an element's data:id (http://www.bea.com/servers/p13n/xsd/data-sync/document-link/1.0.1)

  Returns
    the id or null if not set

### checkAttribute

    public static String checkAttribute(Element e,
                                        String name,
                                        String[] vals)
                                 throws IllegalArgumentException

  Check if the value of the element's required attribute is in the list of possible values.

  Parameters
    `e` - the element.
    `name` - the attribute name.
    `vals` - the possible values.
  Returns
    the attribute value.
  Throws
    `IllegalArgumentException` - thrown if the attribute is not set or it's value is not one of the possible values.

### checkAttribute

    public static String checkAttribute(Element e,
                                        String name,
                                        String val)
                                 throws IllegalArgumentException

  Check if the value of the element's required attribute is the desired value.

  Parameters
    `e` - the element.
    `name` - the attribute name.
    `val` - the desired value.
  Returns
    the attribute value.
  Throws
    `IllegalArgumentException` - thrown if the attribute is not set or it's value is not the desired value.

### checkAttribute

    public static String checkAttribute(Element e,
                                        String name,
                                        String val1,
                                        String val2)
                                 throws IllegalArgumentException

  Check if the value of the element's required attribute is one of the desired values.

  Parameters
    `e` - the element.
    `name` - the attribute name.
    `val1` - the 1st desired value.
    `val2` - the 2st desired value.
  Returns
    the attribute value.
  Throws
    `IllegalArgumentException` - thrown if the attribute is not set or it's value is not one of the desired values.

### getCharacterData

    public static String getCharacterData(Element e)
                                   throws IllegalArgumentException

  Get the character data contained in the element.

  If the character data is a CDATA section, it will be returned intact. Otherwise, it will be trimmed of leading and trailing whitespace.

  Parameters
    `e` - the element.
  Returns
    the character data.
  Throws
    `IllegalArgumentException` - thrown if the element does not contain only character data.

### getISO8601Date

    public static Timestamp getISO8601Date(Element e)
                                    throws IllegalArgumentException

  Get a date from a the ISO 8601 formatted character data contained in an element.

  Throws
    `IllegalArgumentException` - thrown on an error.
  See Also
    `XMLDateTimeUtil`

### getNodeType

    public static String getNodeType(Node n)

  Get the node's type as a string.

### getNodeType

    public static String getNodeType(short type)

  Get a string describing the Node type.

### close

    public static void close(Connection con)

  Close a connection, ignoring any errors.

  See Also
    `JdbcHelper.close(java.sql.Connection)`

### close

    public static void close(Statement stmt)

  Close a statement, ignoring any errors.

  See Also
    `JdbcHelper.close(java.sql.Statement)`

### close

    public static void close(ResultSet rs)

  Close a result set, ignoring any errors.

  See Also
    `JdbcHelper.close(java.sql.ResultSet)`

### getBoolean

    public static boolean getBoolean(ResultSet rs,
                                     int index)
                              throws SQLException

  Get a boolean from a numeric column.

  Throws
    `SQLException`
  See Also
    `TRUE`, `FALSE`

### setBoolean

    public static void setBoolean(PreparedStatement stmt,
                                  int index,
                                  boolean b)
                           throws SQLException

  Set a boolean in a numeric column.

  Throws
    `SQLException`
  See Also
    `TRUE`, `FALSE`

### logVerbose

    public static void logVerbose(String mesg,
                                  Throwable ex)

  Deprecated Use Debug instead

  Log a verbose campaign/scenario message.

  See Also
    `Debug`

### logVerbose

    public static void logVerbose(String mesg)

  Deprecated Use Debug instead

  Log a verbose campaign/scenario message.

  See Also
    `Debug`

### logDebug

    public static void logDebug(String mesg,
                                Throwable ex)

  Deprecated Use Debug instead

  Log a debug campaign/scenario message.

  See Also
    `Debug`

### logDebug

    public static void logDebug(String mesg)

  Deprecated Use Debug instead

  Log a debug campaign/scenario message.

  See Also
    `Debug`

### logInfo

    public static void logInfo(String mesg,
                               Throwable ex)

  Deprecated Use WLS logging instead

  Log an informational campaign/scenario message.

### logInfo

    public static void logInfo(String mesg)

  Deprecated Use WLS logging instead

  Log an informational campaign/scenario message.

### logWarning

    public static void logWarning(String mesg,
                                  Throwable ex)

  Deprecated Use WLS logging instead

  Log a warning campaign/scenario message.

### logWarning

    public static void logWarning(String mesg)

  Deprecated Use WLS logging instead

  Log a warning campaign/scenario message.

### logError

    public static void logError(String mesg,
                                Throwable ex)

  Deprecated Use WLS logging instead

  Log an error campaign/scenario message.

### logError

    public static void logError(String mesg)

  Deprecated Use WLS logging instead

  Log an error campaign/scenario message.

### log

    public static void log(int level,
                           String mesg,
                           Throwable ex)

  Deprecated Use WLS logging instead

  Log a verbose campaign/scenario message.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008 BEA Systems, Inc. All Rights Reserved