ログインおよびワークフロー・システム・セッションの確立
VWSession クラスを使用して、VWSession オブジェクトをインスタンス化および初期化し、ワークフロー・システム・セッションを確立します。他のワークフロー・システム・オペレーションを実行する前に、VWSession オブジェクトを取得しておく必要があります。
VWSession オブジェクトをインスタンス化するには、VWSession(user_name, password, router_URL) コンストラクターを使用します。 パラメーター user_name と password (LDAP で認証) は、ワークフロー・システム・ユーザーの認証情報です。パラメーター router_URL は、Java™ Remote Method Invocation (RMI) でも使用される Web サーバー・ルーターの URL です。
パフォーマンス上の理由から、作成するワークフロー・システム・セッションの数は最小限に抑えます。 最も適しているのは、できる限り多くのオペレーション (ワーク・パフォーマーの呼び出し、ステップの更新、ユーザー受信トレイの照会など) に対して単一のセッションを使用することです。
次の例は、Session Helper サンプル・クラスを使用して、ワークフロー・システム・セッションを確立してから、セッションをログオフしています。
package samples.api;
import filenet.vw.api.*;
/**
* This sample class illustrates how to make use of the VWSession object.
*
* @since eProcess 4.1
*/
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 Logger オブジェクトです。
* @since eProcess 4.1
*/
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
* @since IWWS.1.0
*/
public VWSession logon()
{
try
{
// instead of using the user information that was passed in,
// we could display a logon dialog and allow the user to enter
// the necessary information.
// Establish a logon 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
*
* @since IWWS.1.0
*/
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;
}
}
}