Package org.dlese.dpc.schemedit.dcs
Class DcsDataRecord
java.lang.Object
org.dlese.dpc.schemedit.dcs.DcsDataRecord
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionDcsDataRecord(File dcsDataFile, MetaDataFramework framework, CollectionConfig collectionConfig, DcsDataManager dcsDataManager) Constructor for DcsDataRecord. -
Method Summary
Modifier and TypeMethodDescriptionvoidClear the ndrInfo elementvoidClear any errors associated with External repositories, such as the NDR.booleandelete()Delete this record by removing it from the cache, destroying the contents, and deleting the source file from disk.voiddeleteStatusEntry(String changeDate) Remove specified status entry from the status entry listprotected voiddestroy()This method is called at the conclusion of processing and may be used for tear-down.voidWrite 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.Gets the changeDate attribute of the most recent StatusEntry.Gets the lastChangeDate (last status update) as a Date.Gets the collection attribute of the DcsDataRecord objectGets the current StatusEntry attribute of the DcsDataRecord objectGets the docType attribute of the DcsDataRecord, which is 'dcs_data'org.dom4j.DocumentGets Editable (localized and ampersand-expanded) Document for this record.Returns List of managed suggestions records.Gets the metadata framework of this DcsDataRecordReturns "true" if there are any sync errors (errors occuring when writing to an external repository, such as the NDR).getId()Gets the id attribute of the DcsDataRecord objectGets the isValid attribute of the DcsDataRecord objectbooleanReturns trueGets the lastEditor attribute of the DcsDataRecord object, reflecting the last time the metadata was changed.Gets the lastSyncDate attribute of the DcsDataRecord objectGets the lastSyncDateDate attribute of the DcsDataRecord objectGets the lastTouchDate attribute of the DcsDataRecord object, reflecting the last time the metadata was changed.Gets the lastTouchDateDate attribute of the DcsDataRecord objectGets the ndrHandle attribute of the DcsDataRecord objectGets the ndrHandle attribute of the DcsDataRecord objectorg.dom4j.ElementGets the ndrInfo attribute of the DcsDataRecord objectGets the ndrHandle attribute of the DcsDataRecord objectGets the nsdlItemId attribute of the DcsDataRecord objectGets the priorStatus attribute of the DcsDataRecord objectGets the setSpec attribute of the DcsDataRecord object (used to cache the setSpec of collections written to the NDR.Gets the source attribute of the DcsDataRecord objectGets the status attribute of the most recent StatusEntry.getStatusEntry(String changeDate) Gets the statusEntry corresponding to provided changeDateGets the readable representation of this record's status.getStatusLabel(String value) Gets the statusNote attribute of the most recent StatusEntry.Gets the validationReport attribute of the DcsDataRecord objectorg.dom4j.ElementGets the validationReportElement attribute of the DcsDataRecord objectbooleanReturns true if this DcsDataRecord has a sync errorbooleanReturns true if this record has "Final" status.booleanisFinalStatus(String value) booleanisValid()Gets the valid attribute of the DcsDataRecord objectprotected voidEnsure 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.voidreplaceStatusEntry(String changeDate, StatusEntry statusEntry) Removes statusEntry corresponding to provided changeDate, and then adds new statusEntryvoidsetCollectionConfig(CollectionConfig collectionConfig) static voidsetDebug(boolean bol) Sets the debug attribute of the DcsDataRecord classvoidSets the id attribute of the DcsDataRecord objectvoidsetLastEditor(String userName) Sets the lastEditor attribute of the DcsDataRecord objectvoidsetLastSyncDate(String dateString) Sets the lastSyncDate attribute of the DcsDataRecord objectvoidsetLastSyncDate(Date date) Sets the lastSyncDate attribute of the DcsDataRecord objectvoidsetLastTouchDate(String dateString) Sets the lastTouchDate attribute of the DcsDataRecord objectvoidsetMetadataProviderHandle(String mdpHandle) Sets the ndrHandle attribute of the DcsDataRecord objectvoidsetNdrHandle(String ndrHandle) Sets the ndrHandle attribute of the DcsDataRecord objectvoidsetNdrSyncError(String ndrSyncError) Sets the ndrSyncError attribute of the DcsDataRecord objectvoidsetNsdlItemId(String itemId) Sets the nsdlItemId attribute of the DcsDataRecord objectvoidsetSetSpec(String setSpec) Sets the setSpec attribute of the DcsDataRecord objectvoidSets the source attribute of the DcsDataRecord objectvoidsetValidationReport(String report) Sets the validationReport attribute of the DcsDataRecord objectvoidupdateStatus(String status, String statusNote, String editor) Change the current status of this record.voidupdateStatus(StatusEntry statusEntry) Update this record's status with the provided StatusEntry object.voidupdateStatus(StatusEntry statusEntry, boolean retainChangeDate) Update this record's status with the provided StatusEntry object and notify event Listeners of change.
-
Constructor Details
-
DcsDataRecord
public DcsDataRecord(File dcsDataFile, MetaDataFramework framework, CollectionConfig collectionConfig, DcsDataManager dcsDataManager) Constructor for DcsDataRecord.- Parameters:
dcsDataFile- file on disk containing xml sourceframework- this record's frameworkcollectionConfig- this record's collectiondcsDataManager- manager for all dcsDataRecords
-
-
Method Details
-
getCollection
Gets the collection attribute of the DcsDataRecord object- Returns:
- The collection value
-
setCollectionConfig
-
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
-
getStatusLabel
Gets the readable representation of this record's status.- Returns:
- status label as String
-
getStatusLabel
-
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
Change the current status of this record.- Parameters:
status- new status for this recordstatusNote- new status noteeditor- user performing status update- Throws:
Exception- if status cannot be updated
-
updateStatus
Update this record's status with the provided StatusEntry object.- Parameters:
statusEntry- new statusEntry- Throws:
Exception- if unable to update
-
updateStatus
Update this record's status with the provided StatusEntry object and notify event Listeners of change.- Parameters:
statusEntry- new statusEntryretainChangeDate- if true, change date is not altered- Throws:
Exception- if unable to update
-
getCurrentEntry
Gets the current StatusEntry attribute of the DcsDataRecord object- Returns:
- The currentEntry value
-
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
Gets the statusEntry corresponding to provided changeDate- Parameters:
changeDate- key used to locate existing status entry- Returns:
- The statusEntry value
-
replaceStatusEntry
Removes statusEntry corresponding to provided changeDate, and then adds new statusEntry- Parameters:
changeDate- key used to locate existing status entrystatusEntry- 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
Remove specified status entry from the status entry list- Parameters:
changeDate- key used to specify existing status entry- Throws:
Exception- NOT YET DOCUMENTED
-
getFramework
Gets the metadata framework of this DcsDataRecord- Returns:
- The framework value
-
getDocument
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
Gets the source attribute of the DcsDataRecord object- Returns:
- The source value
-
setSource
Sets the source attribute of the DcsDataRecord object- Parameters:
source- The new source value
-
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
Sets the validationReport attribute of the DcsDataRecord object- Parameters:
report- The new validationReport value
-
getValidationReport
Gets the validationReport attribute of the DcsDataRecord object- Returns:
- The validationReport value
-
getLastTouchDate
Gets the lastTouchDate attribute of the DcsDataRecord object, reflecting the last time the metadata was changed.- Returns:
- The lastTouchDate value
-
setLastTouchDate
Sets the lastTouchDate attribute of the DcsDataRecord object- Parameters:
dateString- The new lastTouchDate value
-
getLastTouchDateDate
Gets the lastTouchDateDate attribute of the DcsDataRecord object- Returns:
- The lastTouchDateDate value
-
getId
Gets the id attribute of the DcsDataRecord object- Returns:
- The id value
-
setId
Sets the id attribute of the DcsDataRecord object- Parameters:
id- The new id value
-
getLastEditor
Gets the lastEditor attribute of the DcsDataRecord object, reflecting the last time the metadata was changed.- Returns:
- The lastEditor value
-
setLastEditor
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
-
getNdrHandle
Gets the ndrHandle attribute of the DcsDataRecord object- Returns:
- The ndrHandle value
-
setNdrHandle
Sets the ndrHandle attribute of the DcsDataRecord object- Parameters:
ndrHandle- The new ndrHandle value
-
getMetadataProviderHandle
Gets the ndrHandle attribute of the DcsDataRecord object- Returns:
- The ndrHandle value
-
setMetadataProviderHandle
Sets the ndrHandle attribute of the DcsDataRecord object- Parameters:
mdpHandle- The new metadataProviderHandle value
-
getNsdlItemId
Gets the nsdlItemId attribute of the DcsDataRecord object- Returns:
- The nsdlItemId value
-
setNsdlItemId
Sets the nsdlItemId attribute of the DcsDataRecord object- Parameters:
itemId- The new nsdlItemId value
-
setLastSyncDate
Sets the lastSyncDate attribute of the DcsDataRecord object- Parameters:
dateString- The new lastSyncDate value
-
setLastSyncDate
Sets the lastSyncDate attribute of the DcsDataRecord object- Parameters:
date- The new lastSyncDate value
-
getLastSyncDate
Gets the lastSyncDate attribute of the DcsDataRecord object- Returns:
- The lastSyncDate value
-
getLastSyncDateDate
Gets the lastSyncDateDate attribute of the DcsDataRecord object- Returns:
- The lastSyncDateDate value
-
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
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
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
Gets the setSpec attribute of the DcsDataRecord object (used to cache the setSpec of collections written to the NDR.- Returns:
- The setSpec value
-
setSetSpec
Sets the setSpec attribute of the DcsDataRecord object- Parameters:
setSpec- The new setSpec value
-
getStatus
Gets the status attribute of the most recent StatusEntry.- Returns:
- The status value
-
getPriorStatus
Gets the priorStatus attribute of the DcsDataRecord object- Returns:
- The priorStatus value
-
getStatusNote
Gets the statusNote attribute of the most recent StatusEntry.- Returns:
- The statusNote value
-
getChangeDate
Gets the changeDate attribute of the most recent StatusEntry. This reflects the last time a status was changed.- Returns:
- The changeDate value
-
getChangeDateDate
Gets the lastChangeDate (last status update) as a Date.- Returns:
- The lastTouchDateDate value
-
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.- Throws:
Exception- If record cannot be written to disk.
-
delete
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
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
-