Oracle Workflow API Reference Release 2.6.3.5 Part Number B12163-02 |
Previous | Next | Contents | Index | Glossary |
The methods are defined within the WFEngineAPI class and the WFNotificationAPI class, in the Java package 'oracle.apps.fnd.wf.engine'. If a Workflow Engine or Notification API has a corresponding Java method, its Java method syntax is displayed immediately after its PL/SQL syntax in the documentation. See: Workflow Engine APIs and Notification APIs.
Additionally, Java functions can be incorporated within Workflow processes as external Java function activities. This functionality is currently only available for the standalone version of Oracle Workflow. The custom Java classes for these activities are implemented as classes that extend the WFFunctionAPI class. The custom classes must follow a standard API format so that they can be properly executed by the Oracle Workflow Java Function Activity Agent. See: Standard API for Java Procedures Called by Function Activities, Oracle Workflow Developer's Guide and Function Activity, Oracle Workflow Developer's Guide.
The WFFunctionAPI class and the WFAttribute class also contain methods that can be called to communicate with Oracle Workflow. These classes are defined in the Java package 'oracle.apps.fnd.wf'. See: Workflow Function APIs and Workflow Attribute APIs.
Java programs that integrate with Oracle Workflow should include the following import statements to provide access to classes required by Oracle Workflow:
import java.io.*;
import java.sql.*;
import java.math.BigDecimal;
import oracle.sql.*;
import oracle.jdbc.driver.*;
import oracle.apps.fnd.common.*;
import oracle.apps.fnd.wf.engine.*;
import oracle.apps.fnd.wf.*;
WFDB myDB;
WFContext ctx;
myDB = new WFDB(m_user, m_pwd, m_jdbcStr, m_conStr);
m_charSet = System.getProperty("CHARSET");
if (m_charSet == null) { // cannot be null
m_charSet = "UTF8";
}
try {
ctx = new WFContext(myDB, m_charSet);
// m_charSet is 'UTF8' by default
if (ctx.getDB().getConnection() == null) {
// connection failed
return;
}
// We now have a connection to the database.
}
catch (Exception e) {
// exit Message for this exception
}
If you have already established a JDBC connection, you can simply set that connection into the WFContext object, as shown in the following example:
WFContext ctx;
m_charSet = System.getProperty("CHARSET");
if (m_charSet == null) { // cannot be null
m_charSet = "UTF8";
}
ctx = new WFContext(m_charSet);
// m_charSet is 'UTF8' by default
ctx.setJDBCConnection(m_conn);
// m_conn is a pre-established JDBC connection
The Oracle Workflow Java APIs can be used safely in a thread, with certain restrictions:
There is also no connection pooling in the Oracle Workflow Java APIs. For Oracle Applications, connection pooling is implemented at the AOL/J level; after you get the JDBC connection, you use the WFContext.setJDBCConnection() API to set the connection. This approach lets you manage your JDBC connection outside of the Oracle Workflow APIs.
setenv CLASSPATH
<Workflow_JAR_file_directory>/wfapi.jar:${ORACLE_HOME}/jdbc/lib/classes111.zip
setenv LD_LIBRARY_PATH ${ORACLE_HOME}/lib:${LD_LIBRARY_PATH}
Note: If you are using the standalone version of Oracle Workflow, the Workflow JAR files are located in the <ORACLE_HOME>/jlib directory. If you are using the version of Oracle Workflow embedded in Oracle Applications, the Workflow JAR files are located in the <ORACLE_HOME>/wf/java/oracle/apps/fnd/wf/jar/ directory.
To initiate the WFTest program, run Java against oracle.apps.fnd.wf.WFTest. For example, on UNIX, enter the following statement on the command line:
$java oracle.apps.fnd.wf.WFTest
The source file for this program is also included in your Oracle Workflow installation so that you can view the sample code. The source file is named WFTest.java and is located in the <ORACLE_HOME>/wf/java/oracle/apps/fnd/wf/ directory.
Previous | Next | Contents | Index | Glossary |