JAVA/CORBA CLASSES
Examples: View class
1. This agent finds the "By Category" view in a database and gets the first document in the view.
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
("FrenchFry", "NotesUA\\progwork");
View view = db.getView("By Category");
Document doc = view.getFirstDocument();
System.out.println
(doc.getItemValueString("Subject"));
} catch(Exception e) {
e.printStackTrace();
}
}
}
2. This agent finds the "($All)" hidden view in a database and gets the first document in the view.
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
("FrenchFry", "NotesUA\\progwork");
View view = db.getView("($All)");
Document doc = view.getFirstDocument();
System.out.println
(doc.getItemValueString("Subject"));
} catch(Exception e) {
e.printStackTrace();
}
}
}
3. This agent finds the default view in a database.
import lotus.domino.*;
import java.util.Vector;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext =
session.getAgentContext();
// (Your code goes here)
Database db = session.getDatabase
("FrenchFry", "NotesUA\\progwork");
Vector views = db.getViews();
View view = null;
for (int i=0; i<views.size(); i++) {
view = (View)views.elementAt(i);
if (view.isDefaultView()) break; }
System.out.println
(view.getName() + " is the default view");
} catch(Exception e) {
e.printStackTrace();
}
}
}
Véase también
View class
Glosario
¿Desea opinar sobre la Ayuda?
Ayuda sobre la Ayuda
Abrir la Ayuda en pantalla completa
Glosario
¿Desea opinar sobre la Ayuda?
Ayuda sobre la Ayuda
Abrir la Ayuda en pantalla completa