edu.ucsb.nceas.metacat.harvesterClient
Class HarvestLog

java.lang.Object
  extended byedu.ucsb.nceas.metacat.harvesterClient.HarvestLog

public class HarvestLog
extends java.lang.Object

Manages log entries to be inserted to the HARVEST_LOG table.

Author:
costa

Constructor Summary
HarvestLog(Harvester harvester, java.sql.Connection conn, int harvestLogID, java.util.Date harvestDate, int status, java.lang.String message, java.lang.String harvestOperationCode, int siteScheduleID)
          Creates a new instance of HarvestLog.
HarvestLog(Harvester harvester, java.sql.Connection conn, int harvestLogID, int detailLogID, java.util.Date harvestDate, int status, java.lang.String message, java.lang.String harvestOperationCode, int siteScheduleID, HarvestDocument harvestDocument, java.lang.String errorMessage)
          Creates a new instance of HarvestLog and inserts this entry to the HARVEST_LOG table.
 
Method Summary
 int getCodeLevelValue(java.lang.String codeLevel)
          Maps each code level to an integer value.
 java.lang.String getExplanation(java.lang.String harvestOperationCode)
          Returns an explanation string based on the value of a harvestOperationCode string.
 java.lang.String getHarvestOperationCodeLevel(java.lang.String harvestOperationCode)
          Returns a code level string based on a harvestOperationCode string.
 void printOutput(java.io.PrintStream out, java.lang.String maxLevel)
          Prints the contents of this HarvestLog object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HarvestLog

public HarvestLog(Harvester harvester,
                  java.sql.Connection conn,
                  int harvestLogID,
                  java.util.Date harvestDate,
                  int status,
                  java.lang.String message,
                  java.lang.String harvestOperationCode,
                  int siteScheduleID)
Creates a new instance of HarvestLog. This constructor is used when creating log entries that do not involve an error on a harvest document. (For that type of log entry, use the alternate constructor below.)

Parameters:
harvester - the parent Harvester object
conn - the database connection
harvestLogID - the primary key in the HARVEST_LOG table
harvestDate - the date of this harvest
status - the status of the harvest operation
message - the message text of the harvest operation
harvestOperationCode - the harvest operation code
siteScheduleID - the siteScheduleID for which this operation was performed. 0 indicates that the operation did not involve a particular harvest site.

HarvestLog

public HarvestLog(Harvester harvester,
                  java.sql.Connection conn,
                  int harvestLogID,
                  int detailLogID,
                  java.util.Date harvestDate,
                  int status,
                  java.lang.String message,
                  java.lang.String harvestOperationCode,
                  int siteScheduleID,
                  HarvestDocument harvestDocument,
                  java.lang.String errorMessage)
Creates a new instance of HarvestLog and inserts this entry to the HARVEST_LOG table. This version of the constructor also instantiates a HarvestDetailLog object and inserts it to the HARVEST_DETAIL_LOG table.

Parameters:
harvester - the parent Harvester object
conn - the database connection
harvestLogID - the primary key in the HARVEST_LOG table
detailLogID - the primary key in the HARVEST_DETAIL_LOG table
harvestDate - the date of this harvest
status - the status of the harvest operation
message - the message text of the harvest operation
harvestOperationCode - the harvest operation code
siteScheduleID - the siteScheduleID for which this operation was performed. 0 indicates that the operation did not involve a particular harvest site.
harvestDocument - the HarvestDocument involved in this operation
errorMessage - the error message generated by this operation
Method Detail

getCodeLevelValue

public int getCodeLevelValue(java.lang.String codeLevel)
Maps each code level to an integer value.

Parameters:
codeLevel - the code level: "error", "warning", "notice", "info", or "debug"
Returns:
codeLevelValue the corresponding code level value

getExplanation

public java.lang.String getExplanation(java.lang.String harvestOperationCode)
Returns an explanation string based on the value of a harvestOperationCode string. The explanation string is a description of the harvest operation specified by the harvestOperationCode.

Parameters:
harvestOperationCode - string value of the harvest operation code
Returns:
the explanation for this harvest operation, a String

getHarvestOperationCodeLevel

public java.lang.String getHarvestOperationCodeLevel(java.lang.String harvestOperationCode)
Returns a code level string based on a harvestOperationCode string. The code level string is one of a set of possible code levels: "error", "warning", "notice", "info", or "debug".

Parameters:
harvestOperationCode - string value of the harvest operation code
Returns:
the code level value, a String, one of the following: "error", "warning", "notice", "info", or "debug"

printOutput

public void printOutput(java.io.PrintStream out,
                        java.lang.String maxLevel)
Prints the contents of this HarvestLog object. Used in generating reports.

Parameters:
out - the PrintStream to write to
maxLevel - the maximum code level to output. If this log entry has a higher code level than the maxLevel, no output is issued. For example, if the maxLevel is "error" (level 1), then anything lower ("warning", "notice", etc.) will not generate any output.


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.