JAVA/CORBA クラス


例:lockProvisional メソッド
次のエージェントは、「Guys」グループのメンバー全員について選択した文書をロックします。文書がまだロックされていない場合、またはロックされていても有効なユーザーが「Guys」のメンバーの場合は、ロックが行われます。暫定ロックが行われます。

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 lock
// Not locked if return is false or exception thrown
Document doc = dc.getFirstDocument();
if (doc.lockProvisional("Guys"))
System.out.println("Document locked");
else
System.out.println("Document not locked");
}
else
System.out.println("Document locking not enabled");

} catch(NotesException e) {
if (e.id == NotesError.NOTES_ERR_LOCKED)
System.out.println("Document not locked (exception)");
else
e.printStackTrace();

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

関連項目