Examples: createCopy method

  1. This agent makes a local copy of the local database names.nsf.
    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 = session.getDatabase(null, "names");
          String title = db.getTitle();
          Database db2 = db.createCopy(null, "names2");
          db2.setTitle("Copy of names");
          System.out.println
          ("Database \"" + title + "\" copied locally");
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }
  2. This agent makes a local copy of the local database names.nsf and sets the maxsize to 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 = session.getDatabase(null, "names");
          String title = db.getTitle();
          Database db2 = db.createCopy(null, "names2",2);
          db2.setTitle("Copy of names");
          System.out.println
          ("Database \"" + title + "\" copied locally");
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }