Hi @all,
hier kommt noch der JavaAgent:
---snip---
import lotus.domino.*;
import java.util.Vector;
import java.io.*;
import jregex.*;
// von
http://jregex.sourceforge.net//import java.util.regex.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
Database db = agentContext.getCurrentDatabase();
Agent agent = agentContext.getCurrentAgent();
Document doc = db.getDocumentByID(agent.getParameterDocID());
String strServer = doc.getItemValueString("MailServer");
String strSearch = doc.getItemValueString("TrackText");
String strForm = doc.getItemValueString("Event");
String strLine = "========================================================================";
String strDays = doc.getItemValueString("Days");
int intDays = Integer.valueOf(strDays).intValue();
intDays = intDays * -1;
DateTime dtToday = session.createDateTime("Today");
DateTime dtNow = session.createDateTime("Today");
DateTime dtEvent = session.createDateTime("Today");
dtToday.setNow();
dtNow.setNow();
dtToday.adjustDay(intDays, true);
DbDirectory dir = session.getDbDirectory( strServer );
Database dbLog = dir.openDatabase("log.nsf");
doc.removeItem( "LogOutput" );
RichTextItem rtitem = doc.createRichTextItem("LogOutput");
RichTextStyle header = session.createRichTextStyle();
header.setBold(RichTextStyle.YES);
header.setColor(RichTextStyle.COLOR_BLACK);
header.setEffects(RichTextStyle.EFFECTS_NONE);
header.setFont(RichTextStyle.FONT_COURIER);
header.setFontSize(
;
rtitem.appendStyle(header);
rtitem.appendText(strLine);
rtitem.addNewLine();
rtitem.appendText("Suchabfrage vom: " + dtNow.getLocalTime());
rtitem.addNewLine();
rtitem.appendText(strLine);
rtitem.addNewLine();
rtitem.appendText("Server.........: " + strServer);
rtitem.addNewLine();
rtitem.appendText("Suchstring.....: " + strSearch);
rtitem.addNewLine();
rtitem.appendText("Suchabfrage ab.: " + dtToday.getLocalTime());
rtitem.addNewLine();
rtitem.appendText(strLine);
rtitem.addNewLine();
View view = db.getView("MailRoutingEvents");
String strGetSearch = "Form = \"" + strForm + "\"";
DocumentCollection dc = dbLog.search(strGetSearch, dtToday);
rtitem.appendText("Log-Einträge...: " + dc.getCount());
rtitem.addNewLine();
rtitem.appendText(strLine);
rtitem.addNewLine();
rtitem.appendText("Get Search Str.: " + strGetSearch);
rtitem.addNewLine();
rtitem.appendText(strLine);
rtitem.addNewLine();
Vector iM;
String strEvent;
int count = 0;
Pattern pSearch = new Pattern(".*" + strSearch + ".*", "i");
Document docLog = dc.getFirstDocument();
while (docLog != null) {
iM = docLog.getItemValue("EventList");
for (int i=0; i<iM.size(); i++) {
strEvent = (String)iM.elementAt(i);
Matcher mSearch = pSearch.matcher(strEvent);
if (mSearch.matches()) {
count++;
rtitem.appendText(strEvent);
rtitem.addNewLine();
}
}
docLog = dc.getNextDocument();
}
dtNow.setNow();
rtitem.appendText(strLine);
rtitem.addNewLine();
rtitem.appendText("Suchabfrage END: " + dtNow.getLocalTime());
rtitem.addNewLine();
doc.appendItemValue("SearchResults", count);
doc.save(true, true);
} catch(Exception e) {
e.printStackTrace();
}
}
}
---snap---
Meine Weiterentwicklung basiert auf dem SearchLog aus der Sandbox (Link s.o.)
Gruss Jofa