JAVA/CORBA CLASSES


Examples: copyColumn method
This agent creates a view, removes any columns, and copies three columns from another view. The second parameter on the copyColumn methods could be omitted since the values given are the defaults.

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

     // Create "Topics" view and remove all columns
     View viewAll = db.getView("All Documents");
     View viewTopics = db.createView("Topics", "SELECT @All");
     while (viewTopics.getColumnCount() > 0) {
       viewTopics.removeColumn(viewTopics.getColumnCount());
     }
     
     // Copy columns 1, 2, 5 from "All Documents" to "Topics"
     ViewColumn col1 = viewTopics.copyColumn(viewAll.getColumn(1), 1);
     System.out.println(col1.getPosition() + " " + col1.getTitle());
     ViewColumn col2 = viewTopics.copyColumn(viewAll.getColumn(2), 2);
     System.out.println(col2.getPosition() + " " + col2.getTitle());
     ViewColumn col3 = viewTopics.copyColumn(viewAll.getColumn(5), 3);
     System.out.println(col3.getPosition() + " " + col3.getTitle());

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

See Also