JAVA/CORBA CLASSES
Examples: Aliases property
1. This agent displays the name and aliases for each view.
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 = agentContext.getCurrentDatabase();
Vector views = db.getViews();
for (int i=0; i<views.size(); i++) {
View view = (View)views.elementAt(i);
Vector aliases = view.getAliases();
if (aliases.size() == 0)
System.out.println
(view.getName() + " has no aliases");
else if (aliases.size() == 1)
System.out.println
(view.getName() + " has 1 alias");
else
System.out.println
(view.getName() + " has " +
aliases.size() + " aliases");
for (int j=0; j<aliases.size(); j++)
System.out.println
("\t" + aliases.elementAt(j)); }
} catch(Exception e) {
e.printStackTrace();
}
}
}
2. This agent sets the aliases for the "By Category" view to "ByCat" and "BC."
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 = agentContext.getCurrentDatabase();
View view = db.getView("By Category");
Vector aliases = new Vector();
aliases.addElement("ByCat");
aliases.addElement("BC");
view.setAliases(aliases);
} catch(Exception e) {
e.printStackTrace();
}
}
}
See Also
Aliases property
Glossary
Feedback on
Help
or
Product Usability
?
Help on Help
All Help Contents
Glossary