Class DcsDataRecord

java.lang.Object
org.dlese.dpc.schemedit.dcs.DcsDataRecord
All Implemented Interfaces:
Serializable

public class DcsDataRecord extends Object implements Serializable
Used to manage dcs_data that is associated with an indexed item-level record. A DcsDataRecord reads from and writes to a file on disk that is named the same as it's "source" item-level record, but in a different directory.

NOTE: the Document attribute should be implemented as a

invalid reference
org.dlese.dpc.schemedit.DocMap
!!
Author:
ostwald
See Also:
  • Constructor Details

    • DcsDataRecord

      public DcsDataRecord(File dcsDataFile, MetaDataFramework framework, CollectionConfig collectionConfig, DcsDataManager dcsDataManager)
      Constructor for DcsDataRecord.
      Parameters:
      dcsDataFile - file on disk containing xml source
      framework - this record's framework
      collectionConfig - this record's collection
      dcsDataManager - manager for all dcsDataRecords
  • Method Details

    • getCollection

      public String getCollection()
      Gets the collection attribute of the DcsDataRecord object
      Returns:
      The collection value
    • setCollectionConfig

      public void setCollectionConfig(CollectionConfig collectionConfig)
    • isFinalStatus

      public boolean isFinalStatus()
      Returns true if this record has "Final" status. A record has final status if the value of the status element in the current status entry has the form: "_|-final-{collection-key}-|_", which is referred to as the final status VALUE. The final status LABEL is a human-readable string that is configured in the collection configuration and stored internally in the collectionConfig.

      This method returns true if the status value has the pattern "_|-final-{*}-|_" and as a side effect calls "normalize" to ensure that the collection key part of the status value refers to the correct collection.

      Returns:
      true if this record has a "final" status.
    • isFinalStatus

      public boolean isFinalStatus(String value)
    • getStatusLabel

      public String getStatusLabel()
      Gets the readable representation of this record's status.
      Returns:
      status label as String
    • getStatusLabel

      public String getStatusLabel(String value)
    • normalizeStatus

      protected void normalizeStatus()
      Ensure that 1) records having a status LABEL equal to the configured final status label also have the correct status VALUE, and 2) records having a final status refer to the correct collection.
    • updateStatus

      public void updateStatus(String status, String statusNote, String editor) throws Exception
      Change the current status of this record.
      Parameters:
      status - new status for this record
      statusNote - new status note
      editor - user performing status update
      Throws:
      Exception - if status cannot be updated
    • updateStatus

      public void updateStatus(StatusEntry statusEntry) throws Exception
      Update this record's status with the provided StatusEntry object.
      Parameters:
      statusEntry - new statusEntry
      Throws:
      Exception - if unable to update
    • updateStatus

      public void updateStatus(StatusEntry statusEntry, boolean retainChangeDate) throws Exception
      Update this record's status with the provided StatusEntry object and notify event Listeners of change.
      Parameters:
      statusEntry - new statusEntry
      retainChangeDate - if true, change date is not altered
      Throws:
      Exception - if unable to update
    • getCurrentEntry

      public StatusEntry getCurrentEntry()
      Gets the current StatusEntry attribute of the DcsDataRecord object
      Returns:
      The currentEntry value
    • getEntryList

      public List getEntryList()
      Returns List of managed suggestions records. Record entry list is sorted and cashed. When new entryList are added, entryList is set to null so it will be regenerated
      Returns:
      The entryList value
    • getStatusEntry

      public StatusEntry getStatusEntry(String changeDate)
      Gets the statusEntry corresponding to provided changeDate
      Parameters:
      changeDate - key used to locate existing status entry
      Returns:
      The statusEntry value
    • replaceStatusEntry

      public void replaceStatusEntry(String changeDate, StatusEntry statusEntry) throws Exception
      Removes statusEntry corresponding to provided changeDate, and then adds new statusEntry
      Parameters:
      changeDate - key used to locate existing status entry
      statusEntry - new status entry to be added to record
      Throws:
      Exception - if unable to add status entry (no exception thrown if entry to delete does not exist)
    • deleteStatusEntry

      public void deleteStatusEntry(String changeDate) throws Exception
      Remove specified status entry from the status entry list
      Parameters:
      changeDate - key used to specify existing status entry
      Throws:
      Exception - NOT YET DOCUMENTED
    • getFramework

      public MetaDataFramework getFramework()
      Gets the metadata framework of this DcsDataRecord
      Returns:
      The framework value
    • getDocument

      public org.dom4j.Document getDocument() throws Exception
      Gets Editable (localized and ampersand-expanded) Document for this record.

      First tries to read from cache, then tries to read from disk, then creates new record.

      Returns:
      The document value
      Throws:
      Exception - Description of the Exception
    • getSource

      public File getSource()
      Gets the source attribute of the DcsDataRecord object
      Returns:
      The source value
    • setSource

      public void setSource(File source)
      Sets the source attribute of the DcsDataRecord object
      Parameters:
      source - The new source value
    • getIsValid

      public String getIsValid()
      Gets the isValid attribute of the DcsDataRecord object
      Returns:
      The isValid value
    • isValid

      public boolean isValid()
      Gets the valid attribute of the DcsDataRecord object
      Returns:
      true if the metadata record for this dcsDataRecord is valid
    • getIsValidityUnknown

      public boolean getIsValidityUnknown()
      Returns true
      Returns:
      true if the validitity of the metadata record for this dcsDataRecord is unknown
    • getValidationReportElement

      public org.dom4j.Element getValidationReportElement()
      Gets the validationReportElement attribute of the DcsDataRecord object
      Returns:
      The validationReportElement value
    • setValidationReport

      public void setValidationReport(String report)
      Sets the validationReport attribute of the DcsDataRecord object
      Parameters:
      report - The new validationReport value
    • getValidationReport

      public String getValidationReport()
      Gets the validationReport attribute of the DcsDataRecord object
      Returns:
      The validationReport value
    • getLastTouchDate

      public String getLastTouchDate()
      Gets the lastTouchDate attribute of the DcsDataRecord object, reflecting the last time the metadata was changed.
      Returns:
      The lastTouchDate value
    • setLastTouchDate

      public void setLastTouchDate(String dateString)
      Sets the lastTouchDate attribute of the DcsDataRecord object
      Parameters:
      dateString - The new lastTouchDate value
    • getLastTouchDateDate

      public Date getLastTouchDateDate()
      Gets the lastTouchDateDate attribute of the DcsDataRecord object
      Returns:
      The lastTouchDateDate value
    • getId

      public String getId()
      Gets the id attribute of the DcsDataRecord object
      Returns:
      The id value
    • setId

      public void setId(String id)
      Sets the id attribute of the DcsDataRecord object
      Parameters:
      id - The new id value
    • getLastEditor

      public String getLastEditor()
      Gets the lastEditor attribute of the DcsDataRecord object, reflecting the last time the metadata was changed.
      Returns:
      The lastEditor value
    • setLastEditor

      public void setLastEditor(String userName)
      Sets the lastEditor attribute of the DcsDataRecord object
      Parameters:
      dateString - The new lastEditor value
    • clearNdrInfo

      public void clearNdrInfo()
      Clear the ndrInfo element
    • getNdrInfo

      public org.dom4j.Element getNdrInfo()
      Gets the ndrInfo attribute of the DcsDataRecord object
      Returns:
      The ndrInfo value
    • getNdrNormalizedStatus

      public String getNdrNormalizedStatus()
    • getNdrHandle

      public String getNdrHandle()
      Gets the ndrHandle attribute of the DcsDataRecord object
      Returns:
      The ndrHandle value
    • setNdrHandle

      public void setNdrHandle(String ndrHandle)
      Sets the ndrHandle attribute of the DcsDataRecord object
      Parameters:
      ndrHandle - The new ndrHandle value
    • getMetadataProviderHandle

      public String getMetadataProviderHandle()
      Gets the ndrHandle attribute of the DcsDataRecord object
      Returns:
      The ndrHandle value
    • setMetadataProviderHandle

      public void setMetadataProviderHandle(String mdpHandle)
      Sets the ndrHandle attribute of the DcsDataRecord object
      Parameters:
      mdpHandle - The new metadataProviderHandle value
    • getNsdlItemId

      public String getNsdlItemId()
      Gets the nsdlItemId attribute of the DcsDataRecord object
      Returns:
      The nsdlItemId value
    • setNsdlItemId

      public void setNsdlItemId(String itemId)
      Sets the nsdlItemId attribute of the DcsDataRecord object
      Parameters:
      itemId - The new nsdlItemId value
    • setLastSyncDate

      public void setLastSyncDate(String dateString)
      Sets the lastSyncDate attribute of the DcsDataRecord object
      Parameters:
      dateString - The new lastSyncDate value
    • setLastSyncDate

      public void setLastSyncDate(Date date)
      Sets the lastSyncDate attribute of the DcsDataRecord object
      Parameters:
      date - The new lastSyncDate value
    • getLastSyncDate

      public String getLastSyncDate()
      Gets the lastSyncDate attribute of the DcsDataRecord object
      Returns:
      The lastSyncDate value
    • getLastSyncDateDate

      public Date getLastSyncDateDate()
      Gets the lastSyncDateDate attribute of the DcsDataRecord object
      Returns:
      The lastSyncDateDate value
    • getNdrSyncError

      public String getNdrSyncError()
      Gets the ndrHandle attribute of the DcsDataRecord object
      Returns:
      The ndrHandle value
    • hasSyncError

      public boolean hasSyncError()
      Returns true if this DcsDataRecord has a sync error
      Returns:
      NOT YET DOCUMENTED
    • getHasSyncError

      public String getHasSyncError()
      Returns "true" if there are any sync errors (errors occuring when writing to an external repository, such as the NDR).
      Returns:
      The hasSyncError value
    • setNdrSyncError

      public void setNdrSyncError(String ndrSyncError)
      Sets the ndrSyncError attribute of the DcsDataRecord object
      Parameters:
      ndrSyncError - The new ndrSyncError value
    • clearSyncErrors

      public void clearSyncErrors()
      Clear any errors associated with External repositories, such as the NDR. This method should be called before each write.
    • getSetSpec

      public String getSetSpec()
      Gets the setSpec attribute of the DcsDataRecord object (used to cache the setSpec of collections written to the NDR.
      Returns:
      The setSpec value
    • setSetSpec

      public void setSetSpec(String setSpec)
      Sets the setSpec attribute of the DcsDataRecord object
      Parameters:
      setSpec - The new setSpec value
    • getStatus

      public String getStatus()
      Gets the status attribute of the most recent StatusEntry.
      Returns:
      The status value
    • getPriorStatus

      public String getPriorStatus()
      Gets the priorStatus attribute of the DcsDataRecord object
      Returns:
      The priorStatus value
    • getStatusNote

      public String getStatusNote()
      Gets the statusNote attribute of the most recent StatusEntry.
      Returns:
      The statusNote value
    • getChangeDate

      public String getChangeDate()
      Gets the changeDate attribute of the most recent StatusEntry. This reflects the last time a status was changed.
      Returns:
      The changeDate value
    • getChangeDateDate

      public Date getChangeDateDate()
      Gets the lastChangeDate (last status update) as a Date.
      Returns:
      The lastTouchDateDate value
    • flushToDisk

      public void flushToDisk() throws Exception
      Write record to disk and then remove it from cashe so any xml processing (such as contracting ampersands) is picked up next time record is needed.
      Throws:
      Exception - If record cannot be written to disk.
    • delete

      public boolean delete() throws Exception
      Delete this record by removing it from the cache, destroying the contents, and deleting the source file from disk.
      Returns:
      Description of the Return Value
      Throws:
      Exception - NOT YET DOCUMENTED
    • getDocType

      public String getDocType()
      Gets the docType attribute of the DcsDataRecord, which is 'dcs_data'
      Returns:
      The docType, which is 'dlese_collect.'
    • destroy

      protected void destroy()
      This method is called at the conclusion of processing and may be used for tear-down.
    • setDebug

      public static void setDebug(boolean bol)
      Sets the debug attribute of the DcsDataRecord class
      Parameters:
      bol - The new debug value