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

  1. package lotus.domino.local;
  2.  
  3. import lotus.domino.NotesException;
  4. import lotus.notes.JavaString;
  5.  
  6. public class DocumentCollection extends NotesBase implements lotus.domino.DocumentCollection {
  7.    private transient Database database;
  8.    private transient Document currDoc;
  9.  
  10.    private native int NgetFirstDocument();
  11.  
  12.    private native int NgetLastDocument();
  13.  
  14.    private native int NgetNextDocument(Document var1);
  15.  
  16.    private native int NgetPrevDocument(Document var1);
  17.  
  18.    private native int NgetNthDocument(int var1);
  19.  
  20.    private native void NFTSearch(String var1, int var2);
  21.  
  22.    private native void NremoveAll(boolean var1);
  23.  
  24.    private native void NupdateAll();
  25.  
  26.    private native void NstampAll(String var1, Object var2);
  27.  
  28.    private native void NputAllInFolder(String var1);
  29.  
  30.    private native void NremoveAllFromFolder(String var1);
  31.  
  32.    private native int NgetDocument(Document var1);
  33.  
  34.    private native void NaddDocument(Document var1);
  35.  
  36.    private native void NdeleteDocument(Document var1);
  37.  
  38.    protected DocumentCollection() throws NotesException {
  39.    }
  40.  
  41.    protected DocumentCollection(Database var1, int var2) throws NotesException {
  42.       super(var2, 11);
  43.       if (var1 == null) {
  44.          throw new NotesException(4405, JavaString.resource.getString("missing_db_object"));
  45.       } else {
  46.          this.database = var1;
  47.          var1.AddObject(this);
  48.       }
  49.    }
  50.  
  51.    protected void InternalFinalize() throws NotesException {
  52.       super.finalize();
  53.    }
  54.  
  55.    public void finalize() throws NotesException {
  56.       this.database.RemoveObject(this);
  57.       this.InternalFinalize();
  58.    }
  59.  
  60.    public void recycle() throws NotesException {
  61.       try {
  62.          this.database.RemoveObject(this);
  63.       } catch (NotesException var5) {
  64.       } finally {
  65.          super.Recycle();
  66.       }
  67.  
  68.    }
  69.  
  70.    public lotus.domino.Document getFirstDocument() throws NotesException {
  71.       ((NotesBase)this).CheckObject();
  72.       synchronized(this){}
  73.  
  74.       Document var1;
  75.       try {
  76.          Document var4 = this.database.FindOrCreateDocument(this.NgetFirstDocument());
  77.          if (var4 != null) {
  78.             this.currDoc = var4;
  79.          }
  80.  
  81.          var1 = var4;
  82.       } catch (Throwable var6) {
  83.          throw var6;
  84.       }
  85.  
  86.       return var1;
  87.    }
  88.  
  89.    public lotus.domino.Document getLastDocument() throws NotesException {
  90.       ((NotesBase)this).CheckObject();
  91.       synchronized(this){}
  92.  
  93.       Document var1;
  94.       try {
  95.          Document var4 = this.database.FindOrCreateDocument(this.NgetLastDocument());
  96.          if (var4 != null) {
  97.             this.currDoc = var4;
  98.          }
  99.  
  100.          var1 = var4;
  101.       } catch (Throwable var6) {
  102.          throw var6;
  103.       }
  104.  
  105.       return var1;
  106.    }
  107.  
  108.    public lotus.domino.Document getNextDocument(lotus.domino.Document var1) throws NotesException {
  109.       ((NotesBase)this).CheckObject();
  110.       synchronized(this){}
  111.  
  112.       Document var2;
  113.       try {
  114.          if (var1 == null) {
  115.             throw new NotesException(4406, JavaString.resource.getString("missing_document_object"));
  116.          }
  117.  
  118.          Document var5 = this.database.FindOrCreateDocument(this.NgetNextDocument((Document)var1));
  119.          if (var5 != null) {
  120.             this.currDoc = var5;
  121.          }
  122.  
  123.          var2 = var5;
  124.       } catch (Throwable var7) {
  125.          throw var7;
  126.       }
  127.  
  128.       return var2;
  129.    }
  130.  
  131.    public lotus.domino.Document getPrevDocument(lotus.domino.Document var1) throws NotesException {
  132.       ((NotesBase)this).CheckObject();
  133.       synchronized(this){}
  134.  
  135.       Document var2;
  136.       try {
  137.          if (var1 == null) {
  138.             throw new NotesException(4406, JavaString.resource.getString("missing_document_object"));
  139.          }
  140.  
  141.          Document var5 = this.database.FindOrCreateDocument(this.NgetPrevDocument((Document)var1));
  142.          if (var5 != null) {
  143.             this.currDoc = var5;
  144.          }
  145.  
  146.          var2 = var5;
  147.       } catch (Throwable var7) {
  148.          throw var7;
  149.       }
  150.  
  151.       return var2;
  152.    }
  153.  
  154.    public lotus.domino.Document getNthDocument(int var1) throws NotesException {
  155.       ((NotesBase)this).CheckObject();
  156.       synchronized(this){}
  157.  
  158.       Document var2;
  159.       try {
  160.          Document var5 = this.database.FindOrCreateDocument(this.NgetNthDocument(var1));
  161.          if (var5 != null) {
  162.             this.currDoc = var5;
  163.          }
  164.  
  165.          var2 = var5;
  166.       } catch (Throwable var7) {
  167.          throw var7;
  168.       }
  169.  
  170.       return var2;
  171.    }
  172.  
  173.    public lotus.domino.Document getNextDocument() throws NotesException {
  174.       ((NotesBase)this).CheckObject();
  175.       synchronized(this){}
  176.  
  177.       lotus.domino.Document var1;
  178.       try {
  179.          if (this.currDoc != null) {
  180.             Document var4 = this.database.FindOrCreateDocument(this.NgetNextDocument(this.currDoc));
  181.             if (var4 != null) {
  182.                this.currDoc = var4;
  183.             }
  184.  
  185.             var1 = var4;
  186.             return var1;
  187.          }
  188.  
  189.          var1 = null;
  190.       } catch (Throwable var6) {
  191.          throw var6;
  192.       }
  193.  
  194.       return var1;
  195.    }
  196.  
  197.    public lotus.domino.Document getPrevDocument() throws NotesException {
  198.       ((NotesBase)this).CheckObject();
  199.       synchronized(this){}
  200.  
  201.       lotus.domino.Document var1;
  202.       try {
  203.          if (this.currDoc != null) {
  204.             Document var4 = this.database.FindOrCreateDocument(this.NgetPrevDocument(this.currDoc));
  205.             if (var4 != null) {
  206.                this.currDoc = var4;
  207.             }
  208.  
  209.             var1 = var4;
  210.             return var1;
  211.          }
  212.  
  213.          var1 = null;
  214.       } catch (Throwable var6) {
  215.          throw var6;
  216.       }
  217.  
  218.       return var1;
  219.    }
  220.  
  221.    public lotus.domino.Document getDocument(lotus.domino.Document var1) throws NotesException {
  222.       ((NotesBase)this).CheckObject();
  223.       synchronized(this){}
  224.  
  225.       Document var2;
  226.       try {
  227.          if (var1 == null) {
  228.             throw new NotesException(4406, JavaString.resource.getString("missing_document_object"));
  229.          }
  230.  
  231.          Document var5 = this.database.FindOrCreateDocument(this.NgetDocument((Document)var1));
  232.          if (var5 != null) {
  233.             this.currDoc = var5;
  234.          }
  235.  
  236.          var2 = var5;
  237.       } catch (Throwable var7) {
  238.          throw var7;
  239.       }
  240.  
  241.       return var2;
  242.    }
  243.  
  244.    public void addDocument(lotus.domino.Document var1) throws NotesException {
  245.       ((NotesBase)this).CheckObject();
  246.       synchronized(this){}
  247.  
  248.       try {
  249.          if (var1 == null) {
  250.             throw new NotesException(4406, JavaString.resource.getString("missing_document_object"));
  251.          }
  252.  
  253.          this.NaddDocument((Document)var1);
  254.       } catch (Throwable var4) {
  255.          throw var4;
  256.       }
  257.  
  258.    }
  259.  
  260.    public void addDocument(lotus.domino.Document var1, boolean var2) throws NotesException {
  261.       this.addDocument(var1);
  262.    }
  263.  
  264.    public void deleteDocument(lotus.domino.Document var1) throws NotesException {
  265.       ((NotesBase)this).CheckObject();
  266.       synchronized(this){}
  267.  
  268.       try {
  269.          if (var1 == null) {
  270.             throw new NotesException(4406, JavaString.resource.getString("missing_document_object"));
  271.          }
  272.  
  273.          this.NdeleteDocument((Document)var1);
  274.       } catch (Throwable var4) {
  275.          throw var4;
  276.       }
  277.  
  278.    }
  279.  
  280.    public void FTSearch(String var1) throws NotesException {
  281.       this.FTSearch(var1, 0);
  282.    }
  283.  
  284.    public void FTSearch(String var1, int var2) throws NotesException {
  285.       ((NotesBase)this).CheckObject();
  286.       synchronized(this){}
  287.  
  288.       try {
  289.          this.NFTSearch(var1, var2);
  290.       } catch (Throwable var5) {
  291.          throw var5;
  292.       }
  293.  
  294.    }
  295.  
  296.    public void removeAll(boolean var1) throws NotesException {
  297.       ((NotesBase)this).CheckObject();
  298.       synchronized(this){}
  299.  
  300.       try {
  301.          Document var5;
  302.          for(Document var4 = (Document)this.getFirstDocument(); var4 != null; var4 = var5) {
  303.             var5 = (Document)this.getNextDocument(var4);
  304.             var4.finalize();
  305.          }
  306.  
  307.          this.NremoveAll(var1);
  308.       } catch (Throwable var7) {
  309.          throw var7;
  310.       }
  311.  
  312.    }
  313.  
  314.    public void updateAll() throws NotesException {
  315.       ((NotesBase)this).CheckObject();
  316.       synchronized(this){}
  317.  
  318.       try {
  319.          this.NupdateAll();
  320.       } catch (Throwable var3) {
  321.          throw var3;
  322.       }
  323.  
  324.    }
  325.  
  326.    public void stampAll(String var1, Object var2) throws NotesException {
  327.       ((NotesBase)this).CheckObject();
  328.       synchronized(this){}
  329.  
  330.       try {
  331.          this.NstampAll(var1, var2);
  332.       } catch (Throwable var5) {
  333.          throw var5;
  334.       }
  335.  
  336.    }
  337.  
  338.    public void putAllInFolder(String var1) throws NotesException {
  339.       ((NotesBase)this).CheckObject();
  340.       synchronized(this){}
  341.  
  342.       try {
  343.          this.NputAllInFolder(var1);
  344.       } catch (Throwable var4) {
  345.          throw var4;
  346.       }
  347.  
  348.    }
  349.  
  350.    public void removeAllFromFolder(String var1) throws NotesException {
  351.       ((NotesBase)this).CheckObject();
  352.       synchronized(this){}
  353.  
  354.       try {
  355.          this.NremoveAllFromFolder(var1);
  356.       } catch (Throwable var4) {
  357.          throw var4;
  358.       }
  359.  
  360.    }
  361.  
  362.    public int getCount() throws NotesException {
  363.       ((NotesBase)this).CheckObject();
  364.       synchronized(this){}
  365.  
  366.       int var1;
  367.       try {
  368.          var1 = ((NotesBase)this).PropGetInt(1330);
  369.       } catch (Throwable var5) {
  370.          throw var5;
  371.       }
  372.  
  373.       return var1;
  374.    }
  375.  
  376.    public boolean isSorted() throws NotesException {
  377.       ((NotesBase)this).CheckObject();
  378.       synchronized(this){}
  379.  
  380.       boolean var1;
  381.       try {
  382.          var1 = ((NotesBase)this).PropGetBool(1331);
  383.       } catch (Throwable var5) {
  384.          throw var5;
  385.       }
  386.  
  387.       return var1;
  388.    }
  389.  
  390.    public String getQuery() throws NotesException {
  391.       ((NotesBase)this).CheckObject();
  392.       synchronized(this){}
  393.  
  394.       String var1;
  395.       try {
  396.          var1 = ((NotesBase)this).PropGetString(1332);
  397.       } catch (Throwable var5) {
  398.          throw var5;
  399.       }
  400.  
  401.       return var1;
  402.    }
  403.  
  404.    public lotus.domino.Database getParent() throws NotesException {
  405.       ((NotesBase)this).CheckObject();
  406.       return this.database;
  407.    }
  408. }
  409.