In order to perform virtually any and all workflow-related operations, the application must login to the Process Engine server, using the VWSession Java API class to instantiate and initialize a VWSession object and establish a Process session. Once you have a VWSession object, you can perform User Inbox, Work Performer, Step Processor, etc. operations, such as querying queues, rosters, etc.
Note All User Inbox, Step Processor, and Work Performer applications
require that a Process session first be established.
To instantiate a VWSession object you use the constructor:
public VWSession(user_name, password, router_URL)
where you specify the user name and user password (which is authenticated via LDAP) of the Process Engine user; the routerURL is the URL of the web server router, including the RMI protocol; that is: rmi:web_server_router_URL.
Tip When creating a Process Session, in the interest of optimizing your application by reducing the number of calls to the Process Engine, it is recommended that you minimize multiple logins; that is, try to avoid logging in and logging out for each method. A better general approach is to:
The following example SessionHelper class illustrates how to use a VWSession object to establish a Process session and then to logoff the session:
// -------------------------------------------------------------------------- // SessionHelper.java // -------------------------------------------------------------------------- import filenet.vw.api.*; /** * This sample class illustrates how to make use of the VWSession object. * */ public class SessionHelper extends Object { // declare variables private String m_userName = null; private String m_password = null; private String m_routerPath = null; private Logger m_logger = null; private VWSession m_vwSession = null; /** * Constructor - performs initialization * * @param user a string containing the user name * @param pw a string containing the password * @param router a string containing the router path * @param logger a Logger object. */ public SessionHelper(String user, String pw, String router, Logger logger) { m_userName = user; m_password = pw; m_routerPath = router; m_logger = logger; } /** * Creates a logon session * * @return a VWSession */ public VWSession logon() { try { // instead of using the user information that was passed in, // we could display a login dialog and allow the user to enter // the necessary information. // Establish a login session. m_vwSession = new VWSession(m_userName, m_password, m_routerPath); } catch (Exception ex) { if (m_logger != null) m_logger.log(ex); else ex.printStackTrace(); } return m_vwSession; } /** * Logs off the session * */ public void logoff() { try { // logoff the session if (m_vwSession != null) m_vwSession.logoff(); } catch (Exception ex) { if (m_logger != null) m_logger.log(ex); else ex.printStackTrace(); } finally { m_vwSession = null; } } }