JAVA/CORBA クラス


例:unlock メソッド
次の例では、選択した文書をロック解除しようとします。有効なユーザーがロック所有者である場合、ロック解除は成功します。

import lotus.domino.*;

public class JavaAgent extends AgentBase {

public void NotesMain() {

try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();

// (Your code goes here)
Database db = agentContext.getCurrentDatabase();
DocumentCollection dc = agentContext.getUnprocessedDocuments();

// Document locking must be enabled
if (db.isDocumentLockingEnabled()) {
// Get document and unlock
// Not unlocked if exception thrown
Document doc = dc.getFirstDocument();
doc.unlock();
System.out.println("document unlocked");
}
else
System.out.println("Document locking not enabled");

} catch(NotesException e) {
System.out.println(e.id + "document not unlocked");

} catch(Exception e) {
e.printStackTrace();
}
}
}

関連項目