Class RepositoryService
java.lang.Object
org.dlese.dpc.schemedit.repository.RepositoryService
Methods to wrap the
RepositoryManager class
and provide other methods and services over the repository.- Author:
- ostwald
-
Constructor Summary
ConstructorsConstructorDescriptionRepositoryService(ServletContext servletContext) Constructor for the RepositoryService object, requiring ServletContext. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(RepositoryEventListener listener) Adds a feature to the Listener attribute of the DcsDataRecord objectbatchCopyMoveRecords(RecordList records, String collection) Moves a batch of records into the specified collection.batchDeleteRecords(RecordList records) returns list of records that could not be deletedbatchMoveRecords(RecordList records, String collection) Moves a batch of records into the specified collection.batchStatusUpdate(RecordList records, StatusEntry statusEntry) Updates the status of a set of records (but does not validate or update the lastTouchDate.copyMoveRecord(String srcRecordId, String destCollection) Write a copied version of a metadata record into a destination collectionicopyRecord(String originalId, User user) Create a new record within the same collection as the original.voiddeleteCollection(String collection) Delete a collection from the repositoryvoiddeleteRecord(String recId) Delete a record from the repositorygetAuthorizedSets(User user, Roles.Role requiredRole) Gets the authorizedSets attribute of the RepositoryService objectgetCollectionItemRecords(String collection) Gets all item records for the specified collection by performing index query.static StringGets the dateString attribute of the RepositoryService classgetDcsDataRecord(String recId) Gets the dcsDataRecord attribute of the RepositoryService objectGets the dups attribute of the RepositoryService objectstatic StringgetRecordFormat(String id, RepositoryManager rm) Gets the recordFormat attribute of the RepositoryService classGets the repositoryWriter attribute of the RepositoryService objectUpdate the list of sets.Gets the sims attribute of the RepositoryService objectGets the xMLDocReader attribute of the RepositoryService objectstatic XMLDocReadergetXMLDocReader(String id, RepositoryManager rm) Gets the XMLDocReader associated with an idvoidindexAnnotatedRecord(DocMap annoDocMap) Reindexes the annotated item record of an annotation record so the annotated item record is linked to its annotation.static booleanindexedRecordIsStale(File sourceFile, XMLDocReader docReader) Test to see if record has been modified outside of DCS.booleanNOT YET DOCUMENTEDbooleanisAuthorizedSet(String collection, User user, Roles.Role requiredRole) Returns true if the specified user is authorized for the specified collection (set).moveRecord(String recId, String collection) Move record to the destination collection, returning the ID of the new record.voidremoveListener(RepositoryEventListener listener) Description of the MethodvoidsaveEditedRecord(String recId, org.dom4j.Document doc, User user) Save an edited record to disk and update the index accordingly.voidsaveNewRecord(String recId, String recordXml, String collection, String username) Saves and indexes a newly created record.voidupdateRecord(String recId) Updates the record by writing it to the repository.voidupdateRecordStatus(String recId, StatusEntry statusEntry) Update the status of a metadata record with provided statusEntry instance.voidvalidateRecord(Object record, DcsDataRecord dcsData, String xmlFormat) Validate the record and update the DcsDataRecord.
-
Constructor Details
-
RepositoryService
Constructor for the RepositoryService object, requiring ServletContext.- Parameters:
servletContext-- Throws:
Exception- if repositoryWriter or autoExport service cannot be initialized.
-
-
Method Details
-
getRepositoryWriter
Gets the repositoryWriter attribute of the RepositoryService object- Returns:
- The repositoryWriter value
-
getDups
Gets the dups attribute of the RepositoryService object- Parameters:
url- NOT YET DOCUMENTEDcollection- NOT YET DOCUMENTED- Returns:
- The dups value
-
getSims
Gets the sims attribute of the RepositoryService object- Parameters:
url- NOT YET DOCUMENTEDcollection- NOT YET DOCUMENTED- Returns:
- The sims value
-
indexedRecordIsStale
NOT YET DOCUMENTED- Parameters:
id- NOT YET DOCUMENTED- Returns:
- NOT YET DOCUMENTED
- Throws:
Exception- NOT YET DOCUMENTED
-
indexedRecordIsStale
Test to see if record has been modified outside of DCS.- Parameters:
sourceFile- file on diskdocReader- the docReader- Returns:
- true if file has changed on disk
-
indexAnnotatedRecord
Reindexes the annotated item record of an annotation record so the annotated item record is linked to its annotation.- Parameters:
annoDocMap- NOT YET DOCUMENTED- Throws:
Exception- Description of the Exception
-
updateRecordStatus
Update the status of a metadata record with provided statusEntry instance.- Parameters:
recId- id of record to updatestatusEntry- new status for record- Throws:
Exception- if record cannot be saved and indexed with provided status
-
saveEditedRecord
Save an edited record to disk and update the index accordingly.- Parameters:
recId- id of metadata record to be saveddoc- metadata record as dom4j.Documentuser- NOT YET DOCUMENTED- Throws:
Exception- if unable to successfully update index
-
saveNewRecord
public void saveNewRecord(String recId, String recordXml, String collection, String username) throws Exception Saves and indexes a newly created record. New records cannot be found in the index, so recId,recordXml, and collection must be passed as parameters, rather than derived from a docReader.Callers of this method are controllers who collect key information from user and create an item-level metadata record outside of the metadata editor (currently only CreateADNRecordAction.handleNewRecordRequest does this).
- Parameters:
recId- record idrecordXml- record content as delocalized xml stringcollection- collection key (e.g., "dcc")username- NOT YET DOCUMENTED- Throws:
Exception- if unable to save new record
-
updateRecord
Updates the record by writing it to the repository. NOTE: Does NOT affect the metadata but updates the indexed record, which includes DcsDataRecord information. Therefore, this method is appropriate for indexing updated DcsDataRecord information, but it is not appropriate for updating changes to metadata content.Called by DCSSchemEditAction.indexAnnotatedRecord() and ThreadedServices.validate().
- Parameters:
recId- Description of the Parameter- Throws:
Exception- Description of the Exception
-
validateRecord
Validate the record and update the DcsDataRecord. NOTE: DcsDataRecord is not saved here - it must be saved (flushed to disk) by the caller.- Parameters:
record- An xml record, represented either as String or FiledcsData- status record corresponding to the xml record.xmlFormat- NOT YET DOCUMENTED
-
batchMoveRecords
Moves a batch of records into the specified collection.- Parameters:
records- A list of records to move to collectioncollection- collection key of the destination collection- Returns:
- returns list of records that could not be moved, if any
- Throws:
Exception- NOT YET DOCUMENTED
-
batchCopyMoveRecords
Moves a batch of records into the specified collection.- Parameters:
records- A list of records to move to collectioncollection- collection key of the destination collection- Returns:
- returns list of records that could not be moved, if any
- Throws:
Exception- NOT YET DOCUMENTED
-
batchStatusUpdate
Updates the status of a set of records (but does not validate or update the lastTouchDate.- Parameters:
records- an array of records represented as ResultDocsstatusEntry- contains status, statusNote and editor information to be added to each record- Returns:
- a list of records that could not be updated
- Throws:
Exception- NOT YET DOCUMENTED
-
moveRecord
Move record to the destination collection, returning the ID of the new record. Status and lastTouchDate are updated in the DcsDataRecord, but the metadata is not re-validated.Ensures that source and destination collections are different before making move, so batch moves don't have to make this check.
- Parameters:
recId- id of the record to be movedcollection- Destination collection for the record to be moved- Returns:
- id of the moved record
- Throws:
Exception- Description of the Exception
-
batchDeleteRecords
returns list of records that could not be deleted- Parameters:
records- Description of the Parameter- Returns:
- Description of the Return Value
- Throws:
Exception- NOT YET DOCUMENTED
-
deleteCollection
Delete a collection from the repository- Parameters:
collection- key of collection to be deleted- Throws:
Exception- NOT YET DOCUMENTED
-
deleteRecord
Delete a record from the repository- Parameters:
recId- Description of the Parameter- Throws:
Exception- Description of the Exception
-
copyRecord
Create a new record within the same collection as the original. A new DcsDataRecord is created with a status of "Uknown" and statusNote signifying it is copied. Validation is not performed - the new record gets the isValid attribute of the original.- Parameters:
originalId- id of the record to be copied- Returns:
- XMLDocReader for the new record
- Throws:
Exception- Description of the Exception
-
copyMoveRecord
Write a copied version of a metadata record into a destination collectioni- Parameters:
destCollection- NOT YET DOCUMENTEDoriginalId- NOT YET DOCUMENTED- Returns:
- NOT YET DOCUMENTED
- Throws:
Exception- NOT YET DOCUMENTED
-
getDcsDataRecord
Gets the dcsDataRecord attribute of the RepositoryService object- Parameters:
recId- NOT YET DOCUMENTED- Returns:
- The dcsDataRecord value
- Throws:
Exception- NOT YET DOCUMENTED
-
getXMLDocReader
Gets the xMLDocReader attribute of the RepositoryService object- Parameters:
id- NOT YET DOCUMENTED- Returns:
- The xMLDocReader value
- Throws:
Exception- NOT YET DOCUMENTED
-
getXMLDocReader
Gets the XMLDocReader associated with an id- Parameters:
id- Record IDrm- RepositoryManager- Returns:
- XMLDocReader or null if not found
- Throws:
Exception- NOT YET DOCUMENTED
-
getRecordFormat
Gets the recordFormat attribute of the RepositoryService class- Parameters:
id- NOT YET DOCUMENTEDrm- NOT YET DOCUMENTED- Returns:
- The recordFormat value
- Throws:
Exception- NOT YET DOCUMENTED
-
getSetInfos
Update the list of sets.- Returns:
- The sets value
-
isAuthorizedSet
Returns true if the specified user is authorized for the specified collection (set).- Parameters:
collection- NOT YET DOCUMENTEDuser- NOT YET DOCUMENTEDrequiredRole- NOT YET DOCUMENTED- Returns:
- The authorizedSet value
-
getAuthorizedSets
Gets the authorizedSets attribute of the RepositoryService object- Parameters:
user- NOT YET DOCUMENTEDrequiredRole- NOT YET DOCUMENTED- Returns:
- The authorizedSets value
-
getCollectionItemRecords
Gets all item records for the specified collection by performing index query.- Parameters:
collection- collection key- Returns:
- RecordList containing IDs of item records
-
addListener
Adds a feature to the Listener attribute of the DcsDataRecord object- Parameters:
listener- The feature to be added to the Listener attribute
-
removeListener
Description of the Method- Parameters:
listener- Description of the Parameter
-
getDateString
Gets the dateString attribute of the RepositoryService class- Returns:
- The dateString value
-