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();
View view = db.getView("Transportation");
db.updateFTIndex(true);
int count = view.FTSearch("bicycle");
// View is filtered
if (count == 0)
System.out.println("No bicycles found");
else {
System.out.println(count + " bicycle(s) found");
Document tmpdoc;
Document doc = view.getFirstDocument();
while (doc != null) {
doc.putInFolder("Two-wheeled vehicles");
tmpdoc = view.getNextDocument(doc);
doc.recycle();
doc = tmpdoc;
}
}
// Clear the full-text search
view.clear();
// View is no longer filtered
Document doc = view.getFirstDocument();
while (doc != null) {
doc.putInFolder("Vehicles");
tmpdoc = view.getNextDocument(doc);
doc.recycle();
doc = tmpdoc;
}
} catch(Exception e) {
e.printStackTrace();
}
}
}
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();
Agent agent = agentContext.getCurrentAgent();
String searchString = agent.getComment();
View view = db.getView("By Category");
db.updateFTIndex(true);
int count = view.FTSearch(searchString, 0);
if (count == 0)
System.out.println("Nothing found");
else {
System.out.println(count + " found");
Document tmpdoc;
Document doc = view.getFirstDocument();
while (doc != null) {
System.out.println(doc.getItemValueString("Subject"));
tmpdoc = view.getNextDocument(doc);
doc.recycle();
doc = tmpdoc;
}
}
} catch(Exception e) {
e.printStackTrace();
}
}
}