Examples: ParentDocumentUNID property (Document - Java)

This agent gets the parent documents of response documents in a database through their UNIDs.

import lotus.domino.*;
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();
      String parentUNID = null;
      Document parentDoc = null;
      Document doc = dc.getFirstDocument();
      while (doc != null) {
        if (doc.isResponse()) {
          System.out.println(
                 doc.getItemValueString("Subject"));
          parentUNID = doc.getParentDocumentUNID();
          parentDoc = db.getDocumentByUNID(parentUNID);
          System.out.println("\tParent is \"" +
          parentDoc.getItemValueString("Subject") + "\"");
          }
        doc = dc.getNextDocument(doc);
        }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}