Examples: getItemValueCustomData method

This agent gets custom data in the current document. The custom data is in an item named IntIntStringItem and was given a type name of IntIntStringType when it was written. The data is defined by the class IntIntString.

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)
      Document doc = agentContext.getDocumentContext();
      if (doc.hasItem("IntIntStringItem")) {
        IntIntString iis = (IntIntString) doc.getItemValueCustomData(
        "IntIntStringItem", "IntIntStringType");
        iis.show();
      }
      else
      {
        System.out.println("No item IntIntStringItem in document");
      }

    } 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);
  }
}