次のエージェントは、現在のデータベースからすべての設計要素の DXL を生成します。
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
// Build note collection of all design elements
Database db = agentContext.getCurrentDatabase();
NoteCollection nc = db.createNoteCollection(false);
nc.selectAllDesignElements(true);
nc.buildCollection();
// Export to file
String filename = "c:¥¥dxl¥¥exportedstuff.dxl";
Stream stream = session.createStream();
if (stream.open(filename)) {
stream.truncate(); // Any existing file is erased
DxlExporter exporter = session.createDxlExporter();
System.out.println("Exported " +
stream.writeText(exporter.exportDxl(nc)) +
" bytes to c:¥¥dxl¥¥exportedstuff.dxl");
}
else
System.out.println("Cannot open " + filename);
} catch(Exception e) {
e.printStackTrace();
}
}
}