Java actions API reference
The following classes and methods are supplied to be used when you are writing an action in Java™.
- ActionInstance
- All Java actions that are created must extend ActionInstance. This
class initializes the DatabaseHelper (dbHelper) and cycles through the transition objects (transitionObjElem)
calling ActionObj() on each one.
- CacheRevision getCache()
- Gets the current cache revision in use by the thread. For more information about its structure, see CacheRevision.
- IDatabaseHelper dbHelper
- Creates the database helper with the correct database schema and database type. Provided to facilitate database interaction.
- MbElement rEvent
- Reference to the input event that caused the Java action to run.
- BusinessHelper busHelper
- Provides some utility functions related to the database.
- FTMCache
- This class manages the cache revisions in Java. Normally the cache
is acquired by using the getCache() method in the ActionInstance class.
- CacheRevision getCache(IDatabaseHelper dbHelper)
- Gets the correct cache for the thread to use.
- CacheRevision getCache(AppVerId appVerId, Long revision)
- Gets the specific cache revision requested, if available. Returns null if the requested cache revision is not available.
- CacheRevision getLatestCache(AppVerId appVerId)
- Gets the most recent cache revision based on the App Version ID supplied.
- CacheRevision getCache(AppId appId)
- Gets the cache based on App ID. Use this method when the App versioning mechanism is not being used.
- IDatabaseHelper
- This interface is used for running queries and extracting the results of the query. An instance of this
interface is provided when inheriting from ActionInstance to write SQL queries for these supported database types.
- Db2®
- Oracle
- String preProcessSQL(String sql)
- Replaces "$DBSchema" in the sql string with the correct schema for the app and sets the location for the returned values.
- String preProcessSQL_WithUR(String sql)
- Does the same function as preProcessSQL but with the Uncommitted Read level of database locking.
- public List<?> doQuery(String sQuery)
- Given a basic SQL query - runs it and returns a List of MbElements.
- public List<?> doQuery(String sQuery, Parameters params)
- Replaces any '?' characters with the parameters given, runs the SQL and returns a List of MbElements.
- List<?> doQueryWithLimitedRows(String unlimitedQuery, Parameters params, int rows)
- Replaces any '?' characters with the parameters given, runs the SQL and returns a List of MbElements. The number of rows that are returned is limited by the 'rows' argument.
- boolean getFirstResult(Map<String, Object> rs)
- Returns true if the result contains a first element.
- boolean getNextResult(Map<String, Object> rs)
- Returns true if the result set contains another result.
- BusinessHelper
- This interface is used for running queries and extracting the results of the query. An instance of this
interface is provided when inheriting from ActionInstance to write SQL queries for the supported database types.
- Long getCausingObjId(ObjId iRequestTxnId)
- Gets the OBJ1_ID from the OBJ_OBJ_REL table where the OBJ2_ID is iRequestTxnId and the relationship between them is CAUSE.
- String getObjType(ObjId objId)
- Selects the 'MASTER_TYPE' for the given 'objId' from the OBJ_ID table.
- formatIdAsUID(ObjId id)
- Formats an ObjId as a unique identifier with padding.
- ElementHelper
- This class is used for accessing and manipulating items within an MbElement in Java.
- public static void delete(MbElement rContextNode, String xPath)
- Deletes the items in the rContextNode at the location that is given in the xPath.
- public static void delete(MbElement rContextNode, MbXPath xPath)
- Deletes the items in the rContextNode at the location that is given in the xPath.
- public static boolean exists(MbElement rContextNode, String xpath)
- Checks if the item exists in the rContextNode at the location that is given in the xPath.
- public static void setValue(MbElement rContextNode, String sXPath, String val)
- Sets the value val in the rContextNode at the location that is given in the xPath.
- public static void setValue(MbElement rContextNode, String sXPath, Long val)
- Sets the value val in the rContextNode at the location that is given in the xPath.
- public static void setValue(MbElement rContextNode, String sXPath, ObjId val)
- Sets the value val in the rContextNode at the location that is given in the xPath.
- public static void setValue(MbElement rContextNode, String sXPath, MbTimestamp val)
- Sets the value val in the rContextNode at the location that is given in the xPath.
- public static MbElement getElement(MbElement rContextNode, MbXPath xpath, int index)
- Gets the MbElement that is the subelement of rContextNode at the index and location that is given in the xPath.
- public static MbElement getElement(MbElement rContextNode, String xpath, int index)
- Gets the MbElement that is the subelement of rContextNode at the index and location that is given in the xPath.
- public static MbElement getOrCreateElement(MbElement rContextNode, String sXPath, int index)
- Retrieves the specified element. If the element does not exist, it is created.
- public static String getElementValueAsString(MbElement rContextNode, String xpath, int index)
- Gets the value in the rContextNode at the index and location that is given in the xPath as a String.
- public static String getElementValueAsString(MbElement rContextNode, MbXPath xpath, int index)
- Gets the value in the rContextNode at the index and location that is given in the xPath as a String.
- public static String getElementValueAsTrimmedString(MbElement rContextNode, String xpath, int index)
- Gets the value in the rContextNode at the index and location that is given in the xPath as a trimmed String.
- public static String getElementValueAsTrimmedString(MbElement rContextNode, MbXPath xpath, int index)
- Gets the value in the rContextNode at the index and location that is given in the xPath as a trimmed String.
- public static Long getElementValueAsLong(MbElement rContextNode, MbXPath xpath, int index, Long defaultVal)
- Gets the value in the rContextNode at the index and location that is given in the xPath as a Long, returning the default value if not found. Integer accessor functions deliberately committed as IBM® App Connect Enterprise INTEGERs are 8 bytes, that is, a Long in Java.
- public static Long getElementValueAsLong(MbElement rContextNode, String xpath, int index, Long defaultVal)
- Gets the value in the rContextNode at the index and location that is given in the xPath as a Long, returning the default value if not found.
- public static Object getElementValue(MbElement rContextNode, String xpath, int index)
- Gets the value in the rContextNode at the index and location that is given in the xPath as an Object.
- public static Double getElementValueAsDouble(MbElement rContextNode, String xpath, int index)
- Gets the value in the rContextNode at the index and location that is given in the xPath as a Double.
- public static Double getElementValueAsDouble(MbElement rContextNode, MbXPath xpath, int index)
- Gets the value in the rContextNode at the index and location that is given in the xPath as a Double.
- public static Boolean getElementValueAsBoolean(MbElement rContextNode, String xpath, int index)
- Gets the value in the rContextNode at the index and location that is given in the xPath as a Boolean.
- public static MbElement getChild(MbMessage mbMessage, String childName)
- Retrieves the message child with the specified name.
- public static MbElement getChild(MbElement mbElement, String childName)
- Retrieves the message child with the specified name.
- public static List getSiblings(MbElement mbElement, String siblingName)
- Retrieves the list of siblings with the specified name.
- public static List getNestedSiblings(MbElement mbElement, String siblingPath)
- Retrieves the list of siblings with the specified name.
- public static List getNestedSiblings_NOXPATH(MbElement mbElement, String siblingPath)
- Retrieves the list of siblings with the specified name.
- public static List getSiblings(MbElement mbElement, MbXPath siblingPath)
- Retrieves the message child with the specified name.
- CacheRevision
- When a cache is requested, a particular revision of the cache is returned. Up to three revisions are
maintained for each App Version ID, differentiated by the last modified time converted to a Long. The
structure of the Java cache mirrors that of the ESQL cache.
- public Long getRevisionID()
- Returns the revision ID.
- public Channels getChannels()
- Returns the cached Channels for this revision.
- public Formats getFormats()
- Returns the cached Formats for this revision.
- public Values getObjectValues()
- Returns the cached items in the Value table for this revision.
- public ServiceParticipants getServiceParticipants()
- Returns the cached ServiceParticipants for this revision.
- public Parties getParties()
- Returns the cached Parties for this revision.
- public CalendarGroups getCalendarGroups()
- Returns the cached CalendarGroups for this revision.
- public SchedulerTasks getSchedulerTasks()
- Returns the cached SchedulerTasks for this revision.
- ESQLInterface
- Maintains properties for the thread that is running the action. The following properties are available
when you are writing an action in Java.
- String getODBCRdbmsJVM()
- Returns the database type in use. For example, Db2.
- String GetODBCDatasourceJVM()
- Gets the data source name in use by the JVM.
- String GetSchemaJVM()
- Returns the database schema in use by the JVM.
- ContextData
- This class represents a context data element, for example, the "BATCH" context data for an event.
- void appendValue(ContextData val)
- Appends a value to the context data, that is, aggregates the values into a list.
- int getValueCount()
- Returns the number of values aggregated under this context data.
- Object getValue()
- Returns the value of the context data (returns a List of values if the context data is aggregate and has more than one item).
- void assertNotNull(Object o)
- Throws an IllegalArgumentException if the object o is null.
- void initFromFromMbElements(MbElement childElem)
- Initializes the Context data from the supplied MbElement.
- RaisedEvent
- All events that are created must extend this class. It contains the following public methods:
- void addContext(String name, String data)
- Adds context data to the event.
- void addContext(String name, Long data)
- Adds context data to the event.
- void addContext(String name, ObjId data)
- Adds context data to the event.
- Long removeContextAsLong(String name)
- Removes context data with the supplied name from the event.
- String removeContextAsString(String name)
- Removes context data with the supplied name from the event.
- void setBatchId(ObjId batchId)
- Sets the "BATCH" context data.
- void setTxnId(ObjId txnId)
- Sets the"TRANSACTION" context data.
- void setPtId(ObjId ptId)
- Sets the "TRANSMISSION" context data of the event.
- void setType(String type)
- Sets the type of the event.
- void setPriority(String priority)
- Sets the priority of the event.
- void setSeverity(String severity)
- Sets the severity of the event.