DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.dcs
Class DcsDataRecord

java.lang.Object
  extended by 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 org.dlese.dpc.schemedit.DocMap!!

Author:
ostwald
See Also:
Serialized Form

Constructor Summary
DcsDataRecord(File dcsDataFile, MetaDataFramework framework, CollectionConfig collectionConfig, DcsDataManager dcsDataManager)
          Constructor for DcsDataRecord.
 
Method Summary
 void clearNdrInfo()
          Clear the ndrInfo element
 void clearSyncErrors()
          Clear any errors associated with External repositories, such as the NDR.
 boolean delete()
          Delete this record by removing it from the cache, destroying the contents, and deleting the source file from disk.
 void deleteStatusEntry(String changeDate)
          Remove specified status entry from the status entry list
protected  void destroy()
          This method is called at the conclusion of processing and may be used for tear-down.
 void flushToDisk()
          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.
 String getChangeDate()
          Gets the changeDate attribute of the most recent StatusEntry.
 Date getChangeDateDate()
          Gets the lastChangeDate (last status update) as a Date.
 String getCollection()
          Gets the collection attribute of the DcsDataRecord object
 StatusEntry getCurrentEntry()
          Gets the current StatusEntry attribute of the DcsDataRecord object
 String getDocType()
          Gets the docType attribute of the DcsDataRecord, which is 'dcs_data'
 Document getDocument()
          Gets Editable (localized and ampersand-expanded) Document for this record.
 List getEntryList()
          Returns List of managed suggestions records.
 MetaDataFramework getFramework()
          Gets the metadata framework of this DcsDataRecord
 String getHasSyncError()
          Returns "true" if there are any sync errors (errors occuring when writing to an external repository, such as the NDR).
 String getId()
          Gets the id attribute of the DcsDataRecord object
 String getIsValid()
          Gets the isValid attribute of the DcsDataRecord object
 boolean getIsValidityUnknown()
          Returns true
 String getLastEditor()
          Gets the lastEditor attribute of the DcsDataRecord object, reflecting the last time the metadata was changed.
 String getLastSyncDate()
          Gets the lastSyncDate attribute of the DcsDataRecord object
 Date getLastSyncDateDate()
          Gets the lastSyncDateDate attribute of the DcsDataRecord object
 String getLastTouchDate()
          Gets the lastTouchDate attribute of the DcsDataRecord object, reflecting the last time the metadata was changed.
 Date getLastTouchDateDate()
          Gets the lastTouchDateDate attribute of the DcsDataRecord object
 String getMetadataProviderHandle()
          Gets the ndrHandle attribute of the DcsDataRecord object
 String getNdrHandle()
          Gets the ndrHandle attribute of the DcsDataRecord object
 Element getNdrInfo()
          Gets the ndrInfo attribute of the DcsDataRecord object
 String getNdrNormalizedStatus()
           
 String getNdrSyncError()
          Gets the ndrHandle attribute of the DcsDataRecord object
 String getNsdlItemId()
          Gets the nsdlItemId attribute of the DcsDataRecord object
 String getPriorStatus()
          Gets the priorStatus attribute of the DcsDataRecord object
 String getSetSpec()
          Gets the setSpec attribute of the DcsDataRecord object (used to cache the setSpec of collections written to the NDR.
 File getSource()
          Gets the source attribute of the DcsDataRecord object
 String getStatus()
          Gets the status attribute of the most recent StatusEntry.
 StatusEntry getStatusEntry(String changeDate)
          Gets the statusEntry corresponding to provided changeDate
 String getStatusLabel()
          Gets the readable representation of this record's status.
 String getStatusLabel(String value)
           
 String getStatusNote()
          Gets the statusNote attribute of the most recent StatusEntry.
 String getValidationReport()
          Gets the validationReport attribute of the DcsDataRecord object
 Element getValidationReportElement()
          Gets the validationReportElement attribute of the DcsDataRecord object
 boolean hasSyncError()
          Returns true if this DcsDataRecord has a sync error
 boolean isFinalStatus()
          Returns true if this record has "Final" status.
 boolean isFinalStatus(String value)
           
 boolean isValid()
          Gets the valid attribute of the DcsDataRecord object
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.
 void replaceStatusEntry(String changeDate, StatusEntry statusEntry)
          Removes statusEntry corresponding to provided changeDate, and then adds new statusEntry
 void setCollectionConfig(CollectionConfig collectionConfig)
           
static void setDebug(boolean bol)
          Sets the debug attribute of the DcsDataRecord class
 void setId(String id)
          Sets the id attribute of the DcsDataRecord object
 void setLastEditor(String userName)
          Sets the lastEditor attribute of the DcsDataRecord object
 void setLastSyncDate(Date date)
          Sets the lastSyncDate attribute of the DcsDataRecord object
 void setLastSyncDate(String dateString)
          Sets the lastSyncDate attribute of the DcsDataRecord object
 void setLastTouchDate(String dateString)
          Sets the lastTouchDate attribute of the DcsDataRecord object
 void setMetadataProviderHandle(String mdpHandle)
          Sets the ndrHandle attribute of the DcsDataRecord object
 void setNdrHandle(String ndrHandle)
          Sets the ndrHandle attribute of the DcsDataRecord object
 void setNdrSyncError(String ndrSyncError)
          Sets the ndrSyncError attribute of the DcsDataRecord object
 void setNsdlItemId(String itemId)
          Sets the nsdlItemId attribute of the DcsDataRecord object
 void setSetSpec(String setSpec)
          Sets the setSpec attribute of the DcsDataRecord object
 void setSource(File source)
          Sets the source attribute of the DcsDataRecord object
 void setValidationReport(String report)
          Sets the validationReport attribute of the DcsDataRecord object
 void updateStatus(StatusEntry statusEntry)
          Update this record's status with the provided StatusEntry object.
 void updateStatus(StatusEntry statusEntry, boolean retainChangeDate)
          Update this record's status with the provided StatusEntry object and notify event Listeners of change.
 void updateStatus(String status, String statusNote, String editor)
          Change the current status of this record.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

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 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 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 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

DLESE Tools
v1.6.0