例: Outline class, Alias, Comment, and Name properties, getFirst and getNext methods, OutlineEntry class, Alias, EntryClass, IsInThisDB, IsPrivate, Label, Level, and Type properties

  1. 次のエージェントは、アウトライン内のすべてのエントリのプロパティを取得します。
    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();
          Outline outline = db.getOutline("DiscOutline");
          System.out.println("*** " + outline.getName() + 
          " ***");
          System.out.println("Alias: " + outline.getAlias());
          System.out.println("Comment: " + 
          outline.getComment());
          OutlineEntry tmpentry;
          OutlineEntry entry = outline.getFirst();
          while (entry != null) {
            System.out.println(entry.getLabel());
            if (entry.getAlias().length() > 0)
              System.out.println("¥tAlias: " + 
              entry.getAlias());
            String type = null;
            switch (entry.getType()) {
              case OutlineEntry.OUTLINE_OTHER_FOLDERS_TYPE:
                type = "Other folders"; break;
              case OutlineEntry.OUTLINE_OTHER_VIEWS_TYPE:
                type = "Other views"; break;
              case OutlineEntry.OUTLINE_OTHER_UNKNOWN_TYPE:
                type = "Other unknown"; break;
              case OutlineEntry.OUTLINE_TYPE_ACTION:
                type = "Action"; break;
              case OutlineEntry.OUTLINE_TYPE_NAMEDELEMENT:
                type = "Named element"; break;
              case OutlineEntry.OUTLINE_TYPE_NOTELINK:
                type = "Note link"; break;
              case OutlineEntry.OUTLINE_TYPE_URL:
                type = "URL"; break;
              }
            System.out.println("¥tType: " + type);        
            String entryClass = null;
            switch (entry.getEntryClass()) {
              case OutlineEntry.OUTLINE_CLASS_DATABASE:
                entryClass = "Database"; break;
              case OutlineEntry.OUTLINE_CLASS_DOCUMENT:
                entryClass = "Document"; break;
              case OutlineEntry.OUTLINE_CLASS_FORM:
                entryClass = "Form"; break;
              case OutlineEntry.OUTLINE_CLASS_FOLDER:
                entryClass = "Folder"; break;
              case OutlineEntry.OUTLINE_CLASS_FRAMESET:
                entryClass = "Frame set"; break;
              case OutlineEntry.OUTLINE_CLASS_NAVIGATOR:
                entryClass = "Navigator"; break;
              case OutlineEntry.OUTLINE_CLASS_PAGE:
                entryClass = "Page"; break;
              case OutlineEntry.OUTLINE_CLASS_UNKNOWN:
                entryClass = "Unknown"; break;
              case OutlineEntry.OUTLINE_CLASS_VIEW:
                entryClass = "View"; break;
              }
            System.out.println("¥tEntry class: " + 
              entryClass);
            System.out.println("¥tLevel: " + 
              entry.getLevel());
            if (entry.isInThisDB())
              System.out.println("¥tRefers to an element in 
                this database");
            else
              System.out.println
              ("¥tDoes not refer to an element in this database");
            if (entry.isPrivate())
              System.out.println("¥tEntry is private");
            else
              System.out.println("¥tEntry is public");
            if (entry.getFrameText().length() > 0)
              System.out.println("¥tFrame text: " + 
                entry.getFrameText());
            if (entry.getImagesText().length() > 0)
              System.out.println("¥tImages text: " + 
                entry.getImagesText());
            tmpentry = outline.getNext(entry);
            entry.recycle();
            entry = tmpentry;
            }
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }
  2. 次のエージェントは、アウトラインを作成します。
    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();
          Outline outline = db.createOutline("Some 
            Documents");
          outline.setAlias("SomeDocuments");
          outline.setComment("Gives partial view of 
            database");
          outline.save();
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }