public class RepositoryService
extends java.lang.Object
RepositoryManager
class
and provide other methods and services over the repository.Constructor and Description |
---|
RepositoryService(javax.servlet.ServletContext servletContext)
Constructor for the RepositoryService object, requiring ServletContext.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(RepositoryEventListener listener)
Adds a feature to the Listener attribute of the DcsDataRecord object
|
RecordList |
batchCopyMoveRecords(RecordList records,
java.lang.String collection)
Moves a batch of records into the specified collection.
|
RecordList |
batchDeleteRecords(RecordList records)
returns list of records that could not be deleted
|
RecordList |
batchMoveRecords(RecordList records,
java.lang.String collection)
Moves a batch of records into the specified collection.
|
RecordList |
batchStatusUpdate(RecordList records,
StatusEntry statusEntry)
Updates the status of a set of records (but does not validate or update the
lastTouchDate.
|
java.lang.String |
copyMoveRecord(java.lang.String srcRecordId,
java.lang.String destCollection)
Write a copied version of a metadata record into a destination collectioni
|
XMLDocReader |
copyRecord(java.lang.String originalId,
User user)
Create a new record within the same collection as the original.
|
void |
deleteCollection(java.lang.String collection)
Delete a collection from the repository
|
void |
deleteRecord(java.lang.String recId)
Delete a record from the repository
|
java.util.List |
getAuthorizedSets(User user,
Roles.Role requiredRole)
Gets the authorizedSets attribute of the RepositoryService object
|
RecordList |
getCollectionItemRecords(java.lang.String collection)
Gets all item records for the specified collection by performing index
query.
|
static java.lang.String |
getDateString()
Gets the dateString attribute of the RepositoryService class
|
DcsDataRecord |
getDcsDataRecord(java.lang.String recId)
Gets the dcsDataRecord attribute of the RepositoryService object
|
java.util.List |
getDups(java.lang.String url,
java.lang.String collection)
Gets the dups attribute of the RepositoryService object
|
static java.lang.String |
getRecordFormat(java.lang.String id,
RepositoryManager rm)
Gets the recordFormat attribute of the RepositoryService class
|
RepositoryWriter |
getRepositoryWriter()
Gets the repositoryWriter attribute of the RepositoryService object
|
java.util.ArrayList |
getSetInfos()
Update the list of sets.
|
java.util.List |
getSims(java.lang.String url,
java.lang.String collection)
Gets the sims attribute of the RepositoryService object
|
XMLDocReader |
getXMLDocReader(java.lang.String id)
Gets the xMLDocReader attribute of the RepositoryService object
|
static XMLDocReader |
getXMLDocReader(java.lang.String id,
RepositoryManager rm)
Gets the XMLDocReader associated with an id
|
void |
indexAnnotatedRecord(DocMap annoDocMap)
Reindexes the annotated item record of an annotation record so the
annotated item record is linked to its annotation.
|
static boolean |
indexedRecordIsStale(java.io.File sourceFile,
XMLDocReader docReader)
Test to see if record has been modified outside of DCS.
|
boolean |
indexedRecordIsStale(java.lang.String id)
NOT YET DOCUMENTED
|
boolean |
isAuthorizedSet(java.lang.String collection,
User user,
Roles.Role requiredRole)
Returns true if the specified user is authorized for the specified
collection (set).
|
java.lang.String |
moveRecord(java.lang.String recId,
java.lang.String collection)
Move record to the destination collection, returning the ID of the new
record.
|
void |
removeListener(RepositoryEventListener listener)
Description of the Method
|
void |
saveEditedRecord(java.lang.String recId,
org.dom4j.Document doc,
User user)
Save an edited record to disk and update the index accordingly.
|
void |
saveNewRecord(java.lang.String recId,
java.lang.String recordXml,
java.lang.String collection,
java.lang.String username)
Saves and indexes a newly created record.
|
void |
updateRecord(java.lang.String recId)
Updates the record by writing it to the repository.
|
void |
updateRecordStatus(java.lang.String recId,
StatusEntry statusEntry)
Update the status of a metadata record with provided statusEntry instance.
|
void |
validateRecord(java.lang.Object record,
DcsDataRecord dcsData,
java.lang.String xmlFormat)
Validate the record and update the DcsDataRecord.
|
public RepositoryService(javax.servlet.ServletContext servletContext) throws java.lang.Exception
servletContext
- java.lang.Exception
- if repositoryWriter or autoExport service cannot be
initialized.public RepositoryWriter getRepositoryWriter()
public java.util.List getDups(java.lang.String url, java.lang.String collection)
url
- NOT YET DOCUMENTEDcollection
- NOT YET DOCUMENTEDpublic java.util.List getSims(java.lang.String url, java.lang.String collection)
url
- NOT YET DOCUMENTEDcollection
- NOT YET DOCUMENTEDpublic boolean indexedRecordIsStale(java.lang.String id) throws java.lang.Exception
id
- NOT YET DOCUMENTEDjava.lang.Exception
- NOT YET DOCUMENTEDpublic static boolean indexedRecordIsStale(java.io.File sourceFile, XMLDocReader docReader)
sourceFile
- file on diskdocReader
- the docReaderpublic void indexAnnotatedRecord(DocMap annoDocMap) throws java.lang.Exception
annoDocMap
- NOT YET DOCUMENTEDjava.lang.Exception
- Description of the Exceptionpublic void updateRecordStatus(java.lang.String recId, StatusEntry statusEntry) throws java.lang.Exception
recId
- id of record to updatestatusEntry
- new status for recordjava.lang.Exception
- if record cannot be saved and indexed with provided
statuspublic void saveEditedRecord(java.lang.String recId, org.dom4j.Document doc, User user) throws java.lang.Exception
recId
- id of metadata record to be saveddoc
- metadata record as dom4j.Documentuser
- NOT YET DOCUMENTEDjava.lang.Exception
- if unable to successfully update indexpublic void saveNewRecord(java.lang.String recId, java.lang.String recordXml, java.lang.String collection, java.lang.String username) throws java.lang.Exception
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).
recId
- record idrecordXml
- record content as delocalized xml stringcollection
- collection key (e.g., "dcc")username
- NOT YET DOCUMENTEDjava.lang.Exception
- if unable to save new recordpublic void updateRecord(java.lang.String recId) throws java.lang.Exception
Called by DCSSchemEditAction.indexAnnotatedRecord() and ThreadedServices.validate().
recId
- Description of the Parameterjava.lang.Exception
- Description of the Exceptionpublic void validateRecord(java.lang.Object record, DcsDataRecord dcsData, java.lang.String xmlFormat)
dcsData
- status record corresponding to the xml record.record
- An xml record, represented either as String or FilexmlFormat
- NOT YET DOCUMENTEDpublic RecordList batchMoveRecords(RecordList records, java.lang.String collection) throws java.lang.Exception
records
- A list of records to move to collectioncollection
- collection key of the destination collectionjava.lang.Exception
- NOT YET DOCUMENTEDpublic RecordList batchCopyMoveRecords(RecordList records, java.lang.String collection) throws java.lang.Exception
records
- A list of records to move to collectioncollection
- collection key of the destination collectionjava.lang.Exception
- NOT YET DOCUMENTEDpublic RecordList batchStatusUpdate(RecordList records, StatusEntry statusEntry) throws java.lang.Exception
records
- an array of records represented as ResultDocsstatusEntry
- contains status, statusNote and editor information to
be added to each recordjava.lang.Exception
- NOT YET DOCUMENTEDpublic java.lang.String moveRecord(java.lang.String recId, java.lang.String collection) throws java.lang.Exception
Ensures that source and destination collections are different before making move, so batch moves don't have to make this check.
recId
- id of the record to be movedcollection
- Destination collection for the record to be movedjava.lang.Exception
- Description of the Exceptionpublic RecordList batchDeleteRecords(RecordList records) throws java.lang.Exception
records
- Description of the Parameterjava.lang.Exception
- NOT YET DOCUMENTEDpublic void deleteCollection(java.lang.String collection) throws java.lang.Exception
collection
- key of collection to be deletedjava.lang.Exception
- NOT YET DOCUMENTEDpublic void deleteRecord(java.lang.String recId) throws java.lang.Exception
recId
- Description of the Parameterjava.lang.Exception
- Description of the Exceptionpublic XMLDocReader copyRecord(java.lang.String originalId, User user) throws java.lang.Exception
originalId
- id of the record to be copiedjava.lang.Exception
- Description of the Exceptionpublic java.lang.String copyMoveRecord(java.lang.String srcRecordId, java.lang.String destCollection) throws java.lang.Exception
originalId
- NOT YET DOCUMENTEDdestCollection
- NOT YET DOCUMENTEDjava.lang.Exception
- NOT YET DOCUMENTEDpublic DcsDataRecord getDcsDataRecord(java.lang.String recId) throws java.lang.Exception
recId
- NOT YET DOCUMENTEDjava.lang.Exception
- NOT YET DOCUMENTEDpublic XMLDocReader getXMLDocReader(java.lang.String id) throws java.lang.Exception
id
- NOT YET DOCUMENTEDjava.lang.Exception
- NOT YET DOCUMENTEDpublic static XMLDocReader getXMLDocReader(java.lang.String id, RepositoryManager rm) throws java.lang.Exception
id
- Record IDrm
- RepositoryManagerjava.lang.Exception
- NOT YET DOCUMENTEDpublic static java.lang.String getRecordFormat(java.lang.String id, RepositoryManager rm) throws java.lang.Exception
id
- NOT YET DOCUMENTEDrm
- NOT YET DOCUMENTEDjava.lang.Exception
- NOT YET DOCUMENTEDpublic java.util.ArrayList getSetInfos()
public boolean isAuthorizedSet(java.lang.String collection, User user, Roles.Role requiredRole)
collection
- NOT YET DOCUMENTEDuser
- NOT YET DOCUMENTEDrequiredRole
- NOT YET DOCUMENTEDpublic java.util.List getAuthorizedSets(User user, Roles.Role requiredRole)
user
- NOT YET DOCUMENTEDrequiredRole
- NOT YET DOCUMENTEDpublic RecordList getCollectionItemRecords(java.lang.String collection)
collection
- collection keypublic void addListener(RepositoryEventListener listener)
listener
- The feature to be added to the Listener attributepublic void removeListener(RepositoryEventListener listener)
listener
- Description of the Parameterpublic static java.lang.String getDateString()