public List<MetadataFormat> formatFor(FilterResolver resolver, ItemIdentifier item) { List<MetadataFormat> result = new ArrayList<MetadataFormat>(); for (MetadataFormat format : this.metadataFormats) if (!format.hasCondition() || format.getCondition().getFilter(resolver).isItemShown(item)) result.add(format); return result; } }
public List<Set> getSets(Context context, FilterResolver resolver) { List<Set> result = new ArrayList<Set>(); for (Set set : context.getSets()) if (set.getCondition().getFilter(resolver).isItemShown(item)) result.add(set); result.addAll(item.getSets()); return result; } }
private boolean canDisseminate(ItemIdentifier itemIdentifier, MetadataFormat format) { return !format.hasCondition() || format.getCondition().getFilter(getRepository().getFilterResolver()).isItemShown(itemIdentifier); } }
@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; }
private Header createHeader(OAICompiledRequest parameters, ItemIdentifier itemIdentifier) throws BadArgumentException, OAIException, NoMetadataFormatsException { MetadataFormat format = getContext().formatForPrefix(parameters .getMetadataPrefix()); if (!itemIdentifier.isDeleted() && !canDisseminate(itemIdentifier, format)) throw new InternalOAIException("The item repository is currently providing items which cannot be disseminated with format "+format.getPrefix()); Header header = new Header(); header.withDatestamp(itemIdentifier.getDatestamp()); header.withIdentifier(itemIdentifier.getIdentifier()); if (itemIdentifier.isDeleted()) header.withStatus(Header.Status.DELETED); for (Set set : getContext().getSets()) if (set.getCondition().getFilter(getRepository().getFilterResolver()).isItemShown(itemIdentifier)) header.withSetSpec(set.getSpec()); for (Set set : itemIdentifier.getSets()) header.withSetSpec(set.getSpec()); return header; }
!getContext().getCondition().getFilter(getRepository().getFilterResolver()).isItemShown(item)) throw new IdDoesNotExistException("This context does not include this item"); !format.getCondition().getFilter(getRepository().getFilterResolver()).isItemShown(item)) throw new CannotDisseminateRecordException("Format not applicable to this item"); if (set.getCondition().getFilter(getRepository().getFilterResolver()).isItemShown(item)) header.withSetSpec(set.getSpec());