Examples: Parent property (Name - Java)

This agent displays the parent user name of a Name object.

import lotus.domino.*;

public class JavaAgent extends AgentBase {

  public void NotesMain() {

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

      // (Your code goes here) 
      
      // Create a hierarchical name
      Name nam = session.createName(
        "CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US");

      // Display name and user name for parent session
      displayNames(nam);

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

  void displayNames(Name n) {
    try {
      System.out.println(
        "Received name = " + n.getCommon());
      System.out.println(
        "Current user name = " + n.getParent().getCommonUserName());
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}