edu.ucsb.nceas.metacat.harvesterClient

## Class HarvestDocument

- java.lang.Object
- - edu.ucsb.nceas.metacat.harvesterClient.HarvestDocument

-     public class HarvestDocument
      extends java.lang.Object

  HarvestDocument manages operations and data for a single document to be harvested.
  Author:
    costa

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HarvestDocument(Harvester harvester, HarvestSiteSchedule harvestSiteSchedule, java.lang.String scope, int identifier, int revision, java.lang.String documentType, java.lang.String documentURL)` Creates a new instance of HarvestDocument.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.io.StringReader` | `getSiteDocument()` Retrieve the document from the site using its value.
    `void` | `harvestDocument()` Harvest the document from the site.
    `int` | `metacatHighestRevision()` Determines the highest revision that Metacat has for this document.
    `void` | `prettyPrint(java.io.PrintStream out)` Print the document URL following by its scope.identifier.revision.
    `void` | `printOutput(java.io.PrintStream out)` Print the data fields and values in this HarvestDocument object.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### HarvestDocument

          public HarvestDocument(Harvester harvester,
                                 HarvestSiteSchedule harvestSiteSchedule,
                                 java.lang.String scope,
                                 int identifier,
                                 int revision,
                                 java.lang.String documentType,
                                 java.lang.String documentURL)

      Creates a new instance of HarvestDocument. Initialized with the data that was read from a single element in site document list.
      Parameters:
        `harvester` - the parent Harvester object
        `harvestSiteSchedule` - the parent HarvestSiteSchedule object
        `scope` - the value of the element
        `identifier` - the value of the element
        `revision` - the value of the element
        `documentType` - the value of the element
        `documentURL` - the value of the element

  - ### Method Detail

    - #### getSiteDocument

          public java.io.StringReader getSiteDocument()

      Retrieve the document from the site using its value.
      Returns:
        A StringReader containing the document string.

    - #### harvestDocument

          public void harvestDocument()

      Harvest the document from the site. Unless Metacat already has the document, retrieve the document from the site and put (insert or update) it to Metacat. If Metacat already has the document, determine the highest revision stored in Metacat so that this can be reported back to the user.

    - #### metacatHighestRevision

          public int metacatHighestRevision()

      Determines the highest revision that Metacat has for this document.
      Returns:
        int representing the highest revision for this document in Metacat. Returns -1 if Metacat does not currently hold the document.

    - #### printOutput

          public void printOutput(java.io.PrintStream out)

      Print the data fields and values in this HarvestDocument object.
      Parameters:
        `out` - the PrintStream to write to

    - #### prettyPrint

          public void prettyPrint(java.io.PrintStream out)

      Print the document URL following by its scope.identifier.revision. Used for report generation.
      Parameters:
        `out` - the PrintStream to write to

Copyright © 2020 Regents of the University of California. All Rights Reserved.