0

documentum ** コード 2** でエクスポート操作を処理するアクション ハンドラ コードで問題が発生しています。ここで、コード 1は Jbuttons と Jtext のコードで、コード 3はエクスポート操作のコードです。ここで問題を引き起こしているセクションで: -

jLabel_messages.setText(te.exportExample(sessionManager,repository,docId,targetLocalDirectory));、最初のパラメーターsessionMangerに対して、 「sessionManager を解決できません」というエラー メッセージが表示されます。次のようなコードでsessionManagerもインスタンス化しようとしましたIDFsessionManager sessionManager = null;が、問題は解決せず、エラーは引き続き発生しました。

誰かが私を助けたり、この問題を修正するために以下のコードに必要な変更を提案したりできますか?

Code1: アクションイベントを呼び出すエクスポートのボタン

jTextField_localDirectory.setBounds(new Rectangle(470, 49, 85, 20));
    jLabel_exportFolder.setText("Export Documents: ");
    jLabel_exportFolder.setBounds(new Rectangle(365, 55, 85, 15));
    jLabel_exportFolder.setHorizontalAlignment(SwingConstants.LEFT);
    jButton_export.setText("Export Files");
    jButton_export.setBounds(new Rectangle(560, 45, 125, 20));
    jButton_export.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    jButton_export_actionPerformed(e);
                }
            });

コード 2: エクスポート操作のアクション ハンドラー コード:

private void jButton_export_actionPerformed(ActionEvent e)
{

String repository = jTextField_repositoryName.getText();
String docId =m_fileIDs.elementAt(list_id.getSelectedIndex()).toString();
String targetLocalDirectory = jTextField_localDirectory.getText();
TutorialExport te = new TutorialExport(); jLabel_messages.setText(te.exportExample(sessionManager,repository,docId,targetLocalDirectory));
}

コード 3: 輸出コード:

import com.documentum.com.DfClientX;
import com.documentum.com.IDfClientX;
import com.documentum.fc.client.IDfDocument;
import com.documentum.fc.client.IDfFormat;
import com.documentum.fc.client.IDfSession;
import com.documentum.fc.client.IDfSessionManager;
import com.documentum.fc.client.IDfSysObject;
import com.documentum.fc.common.DfId;
import com.documentum.fc.common.IDfId;
import com.documentum.operations.IDfExportNode;
import com.documentum.operations.IDfExportOperation;
public class TutorialExport
{
public TutorialExport()
{}
public String exportExample(
IDfSessionManager sessionManager,
String repository,
String docId,
String targetLocalDirectory
)
{
    IDfSession mySession = null;
    StringBuffer sb = new StringBuffer("");
    try
    {
    mySession = sessionManager.getSession(repository);
    IDfId idObj =
    mySession.getIdByQualification(
    "dm_sysobject where r_object_id='" + docId + "'"
    );
    IDfSysObject sysObj = (IDfSysObject) mySession.getObject(idObj);
    IDfClientX clientx = new DfClientX();
    IDfExportOperation eo = clientx.getExportOperation();
    IDfDocument doc =(IDfDocument) mySession.getObject(new DfId(docId));
    IDfExportNode node = (IDfExportNode) eo.add(doc);
    IDfFormat format = doc.getFormat();
    if (targetLocalDirectory.lastIndexOf("/") !=
    targetLocalDirectory.length() - 1
    &&
    targetLocalDirectory.lastIndexOf("\\") !=
    targetLocalDirectory.length()- 1 )
    {
    targetLocalDirectory += "/";
    }
    node.setFilePath(targetLocalDirectory + doc.getObjectName() + "." +
    format.getDOSExtension());

    if (eo.execute())
    {
    return "Export operation successful." + "\n" + sb.toString();
    }
    else
    {
    return "Export operation failed.";
    }
    }
    catch (Exception ex)
    {
    ex.printStackTrace();
    return "Exception has been thrown: " + ex;
    }

    finally
    {
    sessionManager.release(mySession);
    }
    }
    }
4

1 に答える 1

0

あなたは多くの詳細を提供しませんでした.Java Swingの経験はあまりありませんが、インスタンス化する前に変数sessionManagerを使用しようとしているようです.

DFC を介してカスタム アプリで Documentum セッション マネージャーをインスタンス化するためのコードは、次のようなものです。

//instantiating client
IDfClient myClient = DfClient.getLocalClient();
// create login info
IDfLoginInfo myLoginInfo = new DfLoginInfo();
myLoginInfo.setUser("user");
myLoginInfo.setPassword("pwd");
// create session manager
IDfSessionManager mySessionManager = myClient.newSessionManager();
mySessionManager.setIdentity("repositoryName", myLoginInfo);
于 2014-05-28T22:33:24.410 に答える