JAVA/CORBA CLASSES


Examples: replaceItemValueCustomData method
This agent creates or replaces an item in the current document and assigns it the serialized value of an object.

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

public class JavaAgent extends AgentBase {

 public void NotesMain() {

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

     // (Your code goes here)
     
     // Create custom data object
     IntIntString iis = new IntIntString();
     iis.setData(1, 2, "String1");

     // Store custom data as item
     Document doc = agentContext.getDocumentContext();
     doc.replaceItemValueCustomData("IntIntStringItem",
     "IntIntStringType", iis);
     doc.save();

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

// Define custom data
class IntIntString implements Serializable {
 int int1;
 int int2;
 String string1;
 
 void setData(int i1, int i2, String s1) {
   int1 = i1;
   int2 = i2;
   string1 = s1;
 }
 
 void show() {
   System.out.println("Int1 = " + int1);
   System.out.println("Int2 = " + int2);
   System.out.println("String1 = " + string1);
 }
}

See Also