home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / Notes.jar / lotus / notes / DebugAgentContext.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-15  |  6.2 KB  |  199 lines

  1. package lotus.notes;
  2.  
  3. import java.io.IOException;
  4. import java.util.Vector;
  5.  
  6. public class DebugAgentContext extends AgentContext {
  7.    // $FF: renamed from: s lotus.notes.Session
  8.    private Session field_0;
  9.    private static String srchItem = "JavaAgentDebugSearchMarker";
  10.    private static String srchValue = "JavaAgentDebugSearchMark";
  11.    private static String srchFormula;
  12.    private static String srchQuery;
  13.    private Database CurrentDatabase;
  14.    private Agent CurrentAgent;
  15.    private Document DocumentContext;
  16.    private String EffectiveUserName;
  17.    private int LastExitStatus;
  18.    private DateTime LastRun;
  19.    private Document SavedData;
  20.    private DebugDocumentCollection UnprocessedDocuments;
  21.  
  22.    protected DebugAgentContext(Session var1, AgentContext var2, Document var3) throws NotesException, IOException, ClassNotFoundException {
  23.       super(var1, 1);
  24.       this.CurrentDatabase = var2.getCurrentDatabase();
  25.       var3.appendItemValue("CurrentDatabase_FilePath", this.CurrentDatabase.getFilePath());
  26.       Name var4 = var1.createName(this.CurrentDatabase.getServer());
  27.       var3.appendItemValue("CurrentDatabase_Server", var4.getAbbreviated());
  28.       this.CurrentAgent = var2.getCurrentAgent();
  29.       var3.appendItemValue("CurrentAgent", this.CurrentAgent.getName());
  30.       this.DocumentContext = var2.getDocumentContext();
  31.       var3.appendItemValue("DocumentContext", this.DocumentContext == null ? null : this.DocumentContext.getUniversalID());
  32.       Name var5 = var1.createName(var2.getEffectiveUserName());
  33.       var3.appendItemValue("EffectiveUserName", var5.getAbbreviated());
  34.       var3.appendItemValue("LastExitStatus", var2.getLastExitStatus());
  35.       var3.appendItemValue("LastRun", var2.getLastRun());
  36.       this.SavedData = var2.getSavedData();
  37.       var3.appendItemValue("SavedData", this.SavedData == null ? null : this.SavedData.getUniversalID());
  38.       DocumentCollection var6 = var2.getUnprocessedDocuments();
  39.       Vector var7 = new Vector(20, 10);
  40.  
  41.       for(int var8 = 1; var8 <= var6.getCount(); ++var8) {
  42.          Document var9 = var6.getNthDocument(var8);
  43.          var7.addElement(var9.getNoteID());
  44.       }
  45.  
  46.       var3.appendItemValue("SelectedDocs", var7);
  47.    }
  48.  
  49.    protected DebugAgentContext(Session var1, Document var2) throws NotesException, IOException, ClassNotFoundException {
  50.       super(var1, 1);
  51.       this.field_0 = var1;
  52.       this.CurrentDatabase = var1.getDatabase(var2.getItemValueString("CurrentDatabase_Server"), var2.getItemValueString("CurrentDatabase_FilePath"));
  53.       if (this.CurrentDatabase == null) {
  54.          throw new NotesException("Could not restore CurrentDatabase from AgentContext document");
  55.       } else {
  56.          this.CurrentAgent = null;
  57.          String var3 = var2.getItemValueString("CurrentAgent");
  58.          Vector var4 = this.CurrentDatabase.getAgents();
  59.  
  60.          for(int var5 = 0; var5 < var4.size(); ++var5) {
  61.             Agent var6 = (Agent)var4.elementAt(var5);
  62.             if (var3.equals(var6.getName())) {
  63.                this.CurrentAgent = var6;
  64.                break;
  65.             }
  66.          }
  67.  
  68.          if (this.CurrentAgent == null) {
  69.             throw new NotesException("Could not restore CurrentAgent from AgentContext document");
  70.          } else {
  71.             String var13 = var2.getItemValueString("DocumentContext");
  72.             if (var13 == null) {
  73.                this.DocumentContext = null;
  74.             } else {
  75.                try {
  76.                   this.DocumentContext = this.CurrentDatabase.getDocumentByUNID(var13);
  77.                } catch (Exception var12) {
  78.                   throw new NotesException("Invalid UNID (AgentContext document - DocumentContext)");
  79.                }
  80.             }
  81.  
  82.             String var7 = var2.getItemValueString("EffectiveUserName");
  83.             if (var7 == null) {
  84.                throw new NotesException("Could not restore EffectiveUserName from AgentContext document");
  85.             } else {
  86.                Name var8 = var1.createName(var7);
  87.                this.EffectiveUserName = var8.getCanonical();
  88.                this.LastExitStatus = var2.getItemValueInteger("LastExitStatus");
  89.                Vector var9 = var2.getItemValue("LastRun");
  90.                this.LastRun = var9.isEmpty() ? null : (DateTime)var9.firstElement();
  91.                String var10 = var2.getItemValueString("SavedData");
  92.                if (var10 == null) {
  93.                   this.SavedData = null;
  94.                } else {
  95.                   try {
  96.                      this.SavedData = this.CurrentDatabase.getDocumentByUNID(var10);
  97.                   } catch (Exception var11) {
  98.                      throw new NotesException("Invalid UNID (AgentContext document - SavedData)");
  99.                   }
  100.                }
  101.  
  102.                this.UnprocessedDocuments = new DebugDocumentCollection(this.CurrentDatabase, var2, srchItem, srchValue, srchFormula);
  103.                if (this.UnprocessedDocuments == null) {
  104.                   throw new NotesException("Could not restore UnprocessedDocuments from AgentContext document");
  105.                }
  106.             }
  107.          }
  108.       }
  109.    }
  110.  
  111.    public Agent getCurrentAgent() throws NotesException {
  112.       return this.CurrentAgent;
  113.    }
  114.  
  115.    public Database getCurrentDatabase() throws NotesException {
  116.       return this.CurrentDatabase;
  117.    }
  118.  
  119.    public Document getDocumentContext() throws NotesException {
  120.       return this.DocumentContext;
  121.    }
  122.  
  123.    public String getEffectiveUserName() throws NotesException {
  124.       return this.EffectiveUserName;
  125.    }
  126.  
  127.    public int getLastExitStatus() throws NotesException {
  128.       return this.LastExitStatus;
  129.    }
  130.  
  131.    public DateTime getLastRun() throws NotesException {
  132.       return this.LastRun;
  133.    }
  134.  
  135.    public Document getSavedData() throws NotesException {
  136.       return this.SavedData;
  137.    }
  138.  
  139.    public DocumentCollection getUnprocessedDocuments() throws NotesException {
  140.       return this.UnprocessedDocuments;
  141.    }
  142.  
  143.    public String toString() {
  144.       String var1;
  145.       try {
  146.          var1 = this.getEffectiveUserName();
  147.       } catch (Exception var2) {
  148.          var1 = null;
  149.       }
  150.  
  151.       return var1;
  152.    }
  153.  
  154.    public DocumentCollection unprocessedFTSearch(String var1, int var2) throws NotesException {
  155.       if (var1 != null && this.UnprocessedDocuments != null) {
  156.          this.UnprocessedDocuments.stampAll(srchItem, srchValue);
  157.          String var3 = "(" + srchQuery + ") AND (" + var1 + ")";
  158.          DocumentCollection var4 = this.CurrentDatabase.FTSearch(var3, var2);
  159.          this.UnprocessedDocuments.unstampAll(srchItem);
  160.          return var4;
  161.       } else {
  162.          return null;
  163.       }
  164.    }
  165.  
  166.    public DocumentCollection unprocessedFTSearch(String var1, int var2, int var3, int var4) throws NotesException {
  167.       if (var1 != null && this.UnprocessedDocuments != null) {
  168.          this.UnprocessedDocuments.stampAll(srchItem, srchValue);
  169.          String var5 = "(" + srchQuery + ") AND (" + var1 + ")";
  170.          DocumentCollection var6 = this.CurrentDatabase.FTSearch(var5, var2, var3, var4);
  171.          this.UnprocessedDocuments.unstampAll(srchItem);
  172.          return var6;
  173.       } else {
  174.          return null;
  175.       }
  176.    }
  177.  
  178.    public DocumentCollection unprocessedSearch(String var1, DateTime var2, int var3) throws NotesException {
  179.       if (var1 != null && var2 != null && this.UnprocessedDocuments != null) {
  180.          this.UnprocessedDocuments.stampAll(srchItem, srchValue);
  181.          String var4 = "(" + srchFormula + ") & (" + var1 + ")";
  182.          DocumentCollection var5 = this.CurrentDatabase.search(var4, var2, var3);
  183.          this.UnprocessedDocuments.unstampAll(srchItem);
  184.          return var5;
  185.       } else {
  186.          return null;
  187.       }
  188.    }
  189.  
  190.    public void updateProcessedDoc(Document var1) throws NotesException {
  191.       this.UnprocessedDocuments.updateProcessedDoc(var1);
  192.    }
  193.  
  194.    static {
  195.       srchFormula = "@IsAvailable(" + srchItem + ")";
  196.       srchQuery = "FIELD " + srchItem + " contains " + srchValue;
  197.    }
  198. }
  199.