-
Notifications
You must be signed in to change notification settings - Fork 34
Using the API: Agents
The process for upgrading an agent from the legacy lotus.domino API to the org.openntf.domino API is very straightforward.
First, make the org.openntf.domino JAR file available to the agent, either by adding it to the JVM of the client and server, by adding it to a Java script library, or via the Import -> Archive action in the agent itself.
Once you have the API available, the only change you need to make in your agent is to change the "import lotus.domino." line to "import org.openntf.domino." line (and maybe add "import lotus.domino.NotesException" if you're using that class by name... for now). Here's the default structure of a converted agent:
import org.openntf.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
} catch(Exception e) {
e.printStackTrace();
}
}
}
That's all there is to it! Your existing code will continue to work as well or better than before, and you'll immediately be able to experience the joys of removing your recycle() lines, converting your loops to for-alls, and storing near-arbitrary objects in documents.