JAVA/CORBA CLASSES


Examples: NotesURL property
This agent gets the Notes and HTTP URLs for a document in the current database. The agent varies the display depending on whether access is through Notes (the HTTP URL is blank) or HTTP protocols.

import lotus.domino.*;
import java.io.PrintWriter;

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 = db.getAllDocuments();
     Document doc = dc.getFirstDocument();
     
     // Get URLs
     String notesURL = doc.getNotesURL();
     String httpURL = doc.getHttpURL();
     
     // Assume local if http is blank and print info for notes
     if (httpURL.length() == 0) {
       System.out.println("NotesURL = " + notesURL);
       System.out.println("Http URL = None");
     }
     
     // If http exists print info for both assuming output to browser
     else {
       PrintWriter pw = getAgentOutput();
       pw.println("NotesURL = " + notesURL);
       pw.println("<BR>HttpURL = " + httpURL);
     }

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

See Also