private List<ScopedFilter> getScopedFilters(Context context, String metadataPrefix) throws CannotDisseminateFormatException { List<ScopedFilter> filters = new ArrayList<ScopedFilter>(); if (context.hasCondition()) filters.add(new ScopedFilter(context.getCondition(), Scope.Context)); MetadataFormat metadataFormat = context.formatForPrefix(metadataPrefix); if (metadataFormat.hasCondition()) filters.add(new ScopedFilter(metadataFormat.getCondition(), Scope.MetadataFormat)); return filters; }
@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; }
!getContext().getCondition().getFilter(getRepository().getFilterResolver()).isItemShown(item)) throw new IdDoesNotExistException("This context does not include this item");