@Override public ListMetadataFormats handle(OAICompiledRequest params) throws OAIException, HandlerException { ListMetadataFormats result = new ListMetadataFormats(); if (params.hasIdentifier()) { Item item = itemRepositoryHelper.getItem(params.getIdentifier()); List<MetadataFormat> metadataFormats = getContext().formatFor(getRepository().getFilterResolver(), item); if (metadataFormats.isEmpty()) throw new NoMetadataFormatsException(); for (MetadataFormat metadataFormat : metadataFormats) { com.lyncode.xoai.model.oaipmh.MetadataFormat format = new com.lyncode.xoai.model.oaipmh.MetadataFormat() .withMetadataPrefix(metadataFormat.getPrefix()) .withMetadataNamespace(metadataFormat.getNamespace()) .withSchema(metadataFormat.getSchemaLocation()); result.withMetadataFormat(format); } } else { for (MetadataFormat metadataFormat : getContext().getMetadataFormats()) { com.lyncode.xoai.model.oaipmh.MetadataFormat format = new com.lyncode.xoai.model.oaipmh.MetadataFormat() .withMetadataPrefix(metadataFormat.getPrefix()) .withMetadataNamespace(metadataFormat.getNamespace()) .withSchema(metadataFormat.getSchemaLocation()); result.withMetadataFormat(format); } } return result; }