use of org.mycore.oai.pmh.IdDoesNotExistException in project mycore by MyCoRe-Org.
the class MCROAIAdapter method getRecord.
/*
* (non-Javadoc)
* @see org.mycore.oai.pmh.dataprovider.OAIAdapter#getRecord(java.lang.String, org.mycore.oai.pmh.MetadataFormat)
*/
@Override
public Record getRecord(String identifier, MetadataFormat format) throws CannotDisseminateFormatException, IdDoesNotExistException {
// Update set for response header
getSetManager().getDirectList();
Optional<Record> possibleRecord = getSearchManager().getHeader(identifier).map(h -> objectManager.getRecord(h, format));
if (possibleRecord.isPresent()) {
return possibleRecord.get();
}
if (!objectManager.exists(identifier)) {
DeletedRecordPolicy rP = getIdentify().getDeletedRecordPolicy();
if (DeletedRecordPolicy.Persistent.equals(rP)) {
// get deleted item
Record deletedRecord = objectManager.getDeletedRecord(objectManager.getMyCoReId(identifier));
if (deletedRecord != null) {
return deletedRecord;
}
}
}
throw new IdDoesNotExistException(identifier);
}
Aggregations