home *** CD-ROM | disk | FTP | other *** search
- package lotus.notes;
-
- import java.io.IOException;
- import java.util.Vector;
-
- public class DebugAgentContext extends AgentContext {
- // $FF: renamed from: s lotus.notes.Session
- private Session field_0;
- private static String srchItem = "JavaAgentDebugSearchMarker";
- private static String srchValue = "JavaAgentDebugSearchMark";
- private static String srchFormula;
- private static String srchQuery;
- private Database CurrentDatabase;
- private Agent CurrentAgent;
- private Document DocumentContext;
- private String EffectiveUserName;
- private int LastExitStatus;
- private DateTime LastRun;
- private Document SavedData;
- private DebugDocumentCollection UnprocessedDocuments;
-
- protected DebugAgentContext(Session var1, AgentContext var2, Document var3) throws NotesException, IOException, ClassNotFoundException {
- super(var1, 1);
- this.CurrentDatabase = var2.getCurrentDatabase();
- var3.appendItemValue("CurrentDatabase_FilePath", this.CurrentDatabase.getFilePath());
- Name var4 = var1.createName(this.CurrentDatabase.getServer());
- var3.appendItemValue("CurrentDatabase_Server", var4.getAbbreviated());
- this.CurrentAgent = var2.getCurrentAgent();
- var3.appendItemValue("CurrentAgent", this.CurrentAgent.getName());
- this.DocumentContext = var2.getDocumentContext();
- var3.appendItemValue("DocumentContext", this.DocumentContext == null ? null : this.DocumentContext.getUniversalID());
- Name var5 = var1.createName(var2.getEffectiveUserName());
- var3.appendItemValue("EffectiveUserName", var5.getAbbreviated());
- var3.appendItemValue("LastExitStatus", var2.getLastExitStatus());
- var3.appendItemValue("LastRun", var2.getLastRun());
- this.SavedData = var2.getSavedData();
- var3.appendItemValue("SavedData", this.SavedData == null ? null : this.SavedData.getUniversalID());
- DocumentCollection var6 = var2.getUnprocessedDocuments();
- Vector var7 = new Vector(20, 10);
-
- for(int var8 = 1; var8 <= var6.getCount(); ++var8) {
- Document var9 = var6.getNthDocument(var8);
- var7.addElement(var9.getNoteID());
- }
-
- var3.appendItemValue("SelectedDocs", var7);
- }
-
- protected DebugAgentContext(Session var1, Document var2) throws NotesException, IOException, ClassNotFoundException {
- super(var1, 1);
- this.field_0 = var1;
- this.CurrentDatabase = var1.getDatabase(var2.getItemValueString("CurrentDatabase_Server"), var2.getItemValueString("CurrentDatabase_FilePath"));
- if (this.CurrentDatabase == null) {
- throw new NotesException("Could not restore CurrentDatabase from AgentContext document");
- } else {
- this.CurrentAgent = null;
- String var3 = var2.getItemValueString("CurrentAgent");
- Vector var4 = this.CurrentDatabase.getAgents();
-
- for(int var5 = 0; var5 < var4.size(); ++var5) {
- Agent var6 = (Agent)var4.elementAt(var5);
- if (var3.equals(var6.getName())) {
- this.CurrentAgent = var6;
- break;
- }
- }
-
- if (this.CurrentAgent == null) {
- throw new NotesException("Could not restore CurrentAgent from AgentContext document");
- } else {
- String var13 = var2.getItemValueString("DocumentContext");
- if (var13 == null) {
- this.DocumentContext = null;
- } else {
- try {
- this.DocumentContext = this.CurrentDatabase.getDocumentByUNID(var13);
- } catch (Exception var12) {
- throw new NotesException("Invalid UNID (AgentContext document - DocumentContext)");
- }
- }
-
- String var7 = var2.getItemValueString("EffectiveUserName");
- if (var7 == null) {
- throw new NotesException("Could not restore EffectiveUserName from AgentContext document");
- } else {
- Name var8 = var1.createName(var7);
- this.EffectiveUserName = var8.getCanonical();
- this.LastExitStatus = var2.getItemValueInteger("LastExitStatus");
- Vector var9 = var2.getItemValue("LastRun");
- this.LastRun = var9.isEmpty() ? null : (DateTime)var9.firstElement();
- String var10 = var2.getItemValueString("SavedData");
- if (var10 == null) {
- this.SavedData = null;
- } else {
- try {
- this.SavedData = this.CurrentDatabase.getDocumentByUNID(var10);
- } catch (Exception var11) {
- throw new NotesException("Invalid UNID (AgentContext document - SavedData)");
- }
- }
-
- this.UnprocessedDocuments = new DebugDocumentCollection(this.CurrentDatabase, var2, srchItem, srchValue, srchFormula);
- if (this.UnprocessedDocuments == null) {
- throw new NotesException("Could not restore UnprocessedDocuments from AgentContext document");
- }
- }
- }
- }
- }
-
- public Agent getCurrentAgent() throws NotesException {
- return this.CurrentAgent;
- }
-
- public Database getCurrentDatabase() throws NotesException {
- return this.CurrentDatabase;
- }
-
- public Document getDocumentContext() throws NotesException {
- return this.DocumentContext;
- }
-
- public String getEffectiveUserName() throws NotesException {
- return this.EffectiveUserName;
- }
-
- public int getLastExitStatus() throws NotesException {
- return this.LastExitStatus;
- }
-
- public DateTime getLastRun() throws NotesException {
- return this.LastRun;
- }
-
- public Document getSavedData() throws NotesException {
- return this.SavedData;
- }
-
- public DocumentCollection getUnprocessedDocuments() throws NotesException {
- return this.UnprocessedDocuments;
- }
-
- public String toString() {
- String var1;
- try {
- var1 = this.getEffectiveUserName();
- } catch (Exception var2) {
- var1 = null;
- }
-
- return var1;
- }
-
- public DocumentCollection unprocessedFTSearch(String var1, int var2) throws NotesException {
- if (var1 != null && this.UnprocessedDocuments != null) {
- this.UnprocessedDocuments.stampAll(srchItem, srchValue);
- String var3 = "(" + srchQuery + ") AND (" + var1 + ")";
- DocumentCollection var4 = this.CurrentDatabase.FTSearch(var3, var2);
- this.UnprocessedDocuments.unstampAll(srchItem);
- return var4;
- } else {
- return null;
- }
- }
-
- public DocumentCollection unprocessedFTSearch(String var1, int var2, int var3, int var4) throws NotesException {
- if (var1 != null && this.UnprocessedDocuments != null) {
- this.UnprocessedDocuments.stampAll(srchItem, srchValue);
- String var5 = "(" + srchQuery + ") AND (" + var1 + ")";
- DocumentCollection var6 = this.CurrentDatabase.FTSearch(var5, var2, var3, var4);
- this.UnprocessedDocuments.unstampAll(srchItem);
- return var6;
- } else {
- return null;
- }
- }
-
- public DocumentCollection unprocessedSearch(String var1, DateTime var2, int var3) throws NotesException {
- if (var1 != null && var2 != null && this.UnprocessedDocuments != null) {
- this.UnprocessedDocuments.stampAll(srchItem, srchValue);
- String var4 = "(" + srchFormula + ") & (" + var1 + ")";
- DocumentCollection var5 = this.CurrentDatabase.search(var4, var2, var3);
- this.UnprocessedDocuments.unstampAll(srchItem);
- return var5;
- } else {
- return null;
- }
- }
-
- public void updateProcessedDoc(Document var1) throws NotesException {
- this.UnprocessedDocuments.updateProcessedDoc(var1);
- }
-
- static {
- srchFormula = "@IsAvailable(" + srchItem + ")";
- srchQuery = "FIELD " + srchItem + " contains " + srchValue;
- }
- }
-