Search in sources :

Example 1 with CannotDisseminateRecordException

use of com.lyncode.xoai.dataprovider.exceptions.CannotDisseminateRecordException in project dataverse by IQSS.

the class XgetRecordHandler method handle.

@Override
public GetRecord handle(OAICompiledRequest parameters) throws OAIException, HandlerException {
    MetadataFormat format = getContext().formatForPrefix(parameters.getMetadataPrefix());
    Item item = getRepository().getItemRepository().getItem(parameters.getIdentifier());
    if (getContext().hasCondition() && !getContext().getCondition().getFilter(getRepository().getFilterResolver()).isItemShown(item))
        throw new IdDoesNotExistException("This context does not include this item");
    if (format.hasCondition() && !format.getCondition().getFilter(getRepository().getFilterResolver()).isItemShown(item))
        throw new CannotDisseminateRecordException("Format not applicable to this item");
    Xrecord record = this.createRecord(parameters, item);
    GetRecord result = new XgetRecord(record);
    return result;
}
Also used : Item(com.lyncode.xoai.dataprovider.model.Item) MetadataFormat(com.lyncode.xoai.dataprovider.model.MetadataFormat) IdDoesNotExistException(com.lyncode.xoai.dataprovider.exceptions.IdDoesNotExistException) CannotDisseminateRecordException(com.lyncode.xoai.dataprovider.exceptions.CannotDisseminateRecordException)

Aggregations

CannotDisseminateRecordException (com.lyncode.xoai.dataprovider.exceptions.CannotDisseminateRecordException)1 IdDoesNotExistException (com.lyncode.xoai.dataprovider.exceptions.IdDoesNotExistException)1 Item (com.lyncode.xoai.dataprovider.model.Item)1 MetadataFormat (com.lyncode.xoai.dataprovider.model.MetadataFormat)1