From 08d0fdd5d3d4b00248ec7aea278d698c20f90606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Melo?= Date: Sun, 19 Jan 2014 21:30:48 +0000 Subject: [PATCH] Using default filter. --- dspace-oai/pom.xml | 4 +- .../xoai/filter/DspaceSetSpecFilter.java | 119 ------ dspace/config/crosswalks/oai/xoai.xml | 403 +++++++++--------- 3 files changed, 194 insertions(+), 332 deletions(-) delete mode 100644 dspace-oai/src/main/java/org/dspace/xoai/filter/DspaceSetSpecFilter.java diff --git a/dspace-oai/pom.xml b/dspace-oai/pom.xml index 3fd86cb9f0..9741a0cc2e 100644 --- a/dspace-oai/pom.xml +++ b/dspace-oai/pom.xml @@ -18,7 +18,7 @@ ${basedir}/.. 3.2.3.RELEASE 3.2.5 - 1.0.2 + 2.0.0 @@ -114,7 +114,7 @@ com.lyncode - jtwig + jtwig-spring ${jtwig.version} diff --git a/dspace-oai/src/main/java/org/dspace/xoai/filter/DspaceSetSpecFilter.java b/dspace-oai/src/main/java/org/dspace/xoai/filter/DspaceSetSpecFilter.java deleted file mode 100644 index 8d4eabfccf..0000000000 --- a/dspace-oai/src/main/java/org/dspace/xoai/filter/DspaceSetSpecFilter.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * The contents of this file are subject to the license and copyright - * detailed in the LICENSE and NOTICE files at the root of the source - * tree and available online at - * - * http://www.dspace.org/license/ - */ -package org.dspace.xoai.filter; - -import com.lyncode.xoai.dataprovider.core.ReferenceSet; -import org.apache.commons.lang.StringUtils; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; -import org.apache.solr.client.solrj.util.ClientUtils; -import org.dspace.content.DSpaceObject; -import org.dspace.core.Context; -import org.dspace.xoai.data.DSpaceItem; -import org.dspace.xoai.filter.results.DatabaseFilterResult; -import org.dspace.xoai.filter.results.SolrFilterResult; -import org.dspace.xoai.services.api.database.CollectionsService; -import org.dspace.xoai.services.api.database.HandleResolver; - -import java.util.List; - -/** - * - * @author Lyncode Development Team - */ -public class DSpaceSetSpecFilter extends DSpaceFilter -{ - private static Logger log = LogManager.getLogger(DSpaceSetSpecFilter.class); - - private String setSpec; - private HandleResolver handleResolver; - private CollectionsService collectionsService; - - public DSpaceSetSpecFilter(CollectionsService collectionsService, HandleResolver handleResolver, String spec) - { - this.collectionsService = collectionsService; - this.handleResolver = handleResolver; - setSpec = spec; - } - - @Override - public DatabaseFilterResult buildDatabaseQuery(Context context) - { - if (setSpec.startsWith("col_")) - { - try - { - DSpaceObject dso = handleResolver.resolve(setSpec.replace("col_", "")); - return new DatabaseFilterResult( - "EXISTS (SELECT tmp.* FROM collection2item tmp WHERE tmp.item_id=i.item_id AND collection_id = ?)", - dso.getID()); - } - catch (Exception ex) - { - log.error(ex.getMessage(), ex); - } - } - else if (setSpec.startsWith("com_")) - { - try - { - DSpaceObject dso = handleResolver.resolve(setSpec.replace("com_", "")); - List list = collectionsService.getAllSubCollections(dso.getID()); - String subCollections = StringUtils.join(list.iterator(), ","); - return new DatabaseFilterResult( - "EXISTS (SELECT tmp.* FROM collection2item tmp WHERE tmp.item_id=i.item_id AND collection_id IN (" - + subCollections + "))"); - } - catch (Exception e) - { - log.error(e.getMessage(), e); - } - } - return new DatabaseFilterResult(); - } - - @Override - public boolean isShown(DSpaceItem item) - { - for (ReferenceSet s : item.getSets()) - if (s.getSetSpec().equals(setSpec)) - return true; - return false; - } - - @Override - public SolrFilterResult buildSolrQuery() - { - if (setSpec.startsWith("col_")) - { - try - { - return new SolrFilterResult("item.collections:" - + ClientUtils.escapeQueryChars(setSpec)); - } - catch (Exception ex) - { - log.error(ex.getMessage(), ex); - } - } - else if (setSpec.startsWith("com_")) - { - try - { - return new SolrFilterResult("item.communities:" - + ClientUtils.escapeQueryChars(setSpec)); - } - catch (Exception e) - { - log.error(e.getMessage(), e); - } - } - return new SolrFilterResult(); - } - -} diff --git a/dspace/config/crosswalks/oai/xoai.xml b/dspace/config/crosswalks/oai/xoai.xml index 3e3a6203a9..8a91ef0d8e 100644 --- a/dspace/config/crosswalks/oai/xoai.xml +++ b/dspace/config/crosswalks/oai/xoai.xml @@ -10,201 +10,201 @@ Developed by DSpace @ Lyncode --> + maxListSetsSize="100" stylesheet="static/style.xsl" + xmlns="http://www.lyncode.com/XOAIConfiguration"> - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + This is the default context of the DSpace data provider. - - - - - - + + + + + + - - - - - - - + + + + + + + This contexts complains with Driver rules. - - - - - - + + + + + + - - - - - - + + + + + + This contexts complains with OpenAIRE rules. - - - - - - - oai_dc - metadataFormats/oai_dc.xsl - http://www.openarchives.org/OAI/2.0/oai_dc/ - http://www.openarchives.org/OAI/2.0/oai_dc.xsd - - - mets - metadataFormats/mets.xsl - http://www.loc.gov/METS/ - http://www.loc.gov/standards/mets/mets.xsd - - - - xoai - metadataFormats/xoai.xsl - http://www.lyncode.com/xoai - http://www.lyncode.com/schemas/xoai.xsd - - - didl - metadataFormats/didl.xsl - urn:mpeg:mpeg21:2002:02-DIDL-NS - http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-21_schema_files/did/didl.xsd - - - dim - metadataFormats/dim.xsl - http://www.dspace.org/xmlns/dspace/dim - http://www.dspace.org/schema/dim.xsd - - - ore - metadataFormats/ore.xsl - http://www.w3.org/2005/Atom - http://tweety.lanl.gov/public/schemas/2008-06/atom-tron.sch - - - rdf - metadataFormats/rdf.xsl - http://www.openarchives.org/OAI/2.0/rdf/ - http://www.openarchives.org/OAI/2.0/rdf.xsd - - - etdms - metadataFormats/etdms.xsl - http://www.ndltd.org/standards/metadata/etdms/1.0/ - http://www.ndltd.org/standards/metadata/etdms/1.0/etdms.xsd - - - mods - metadataFormats/mods.xsl - http://www.loc.gov/mods/v3 - http://www.loc.gov/standards/mods/v3/mods-3-1.xsd - - - qdc - metadataFormats/qdc.xsl - http://purl.org/dc/terms/ - http://dublincore.org/schemas/xmls/qdc/2006/01/06/dcterms.xsd - - - marc - metadataFormats/marc.xsl - http://www.loc.gov/MARC21/slim - http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd - - - uketd_dc - metadataFormats/uketd_dc.xsl - http://naca.central.cranfield.ac.uk/ethos-oai/2.0/ - http://naca.central.cranfield.ac.uk/ethos-oai/2.0/uketd_dc.xsd -<<<<<<< HEAD - -======= - ->>>>>>> 7c0f545... OAI 2.1 - + + + + + + + oai_dc + metadataFormats/oai_dc.xsl + http://www.openarchives.org/OAI/2.0/oai_dc/ + http://www.openarchives.org/OAI/2.0/oai_dc.xsd + + + mets + metadataFormats/mets.xsl + http://www.loc.gov/METS/ + http://www.loc.gov/standards/mets/mets.xsd + + + + xoai + metadataFormats/xoai.xsl + http://www.lyncode.com/xoai + http://www.lyncode.com/schemas/xoai.xsd + + + didl + metadataFormats/didl.xsl + urn:mpeg:mpeg21:2002:02-DIDL-NS + http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-21_schema_files/did/didl.xsd + + + + dim + metadataFormats/dim.xsl + http://www.dspace.org/xmlns/dspace/dim + http://www.dspace.org/schema/dim.xsd + + + ore + metadataFormats/ore.xsl + http://www.w3.org/2005/Atom + http://tweety.lanl.gov/public/schemas/2008-06/atom-tron.sch + + + rdf + metadataFormats/rdf.xsl + http://www.openarchives.org/OAI/2.0/rdf/ + http://www.openarchives.org/OAI/2.0/rdf.xsd + + + etdms + metadataFormats/etdms.xsl + http://www.ndltd.org/standards/metadata/etdms/1.0/ + http://www.ndltd.org/standards/metadata/etdms/1.0/etdms.xsd + + + mods + metadataFormats/mods.xsl + http://www.loc.gov/mods/v3 + http://www.loc.gov/standards/mods/v3/mods-3-1.xsd + + + qdc + metadataFormats/qdc.xsl + http://purl.org/dc/terms/ + http://dublincore.org/schemas/xmls/qdc/2006/01/06/dcterms.xsd + + + marc + metadataFormats/marc.xsl + http://www.loc.gov/MARC21/slim + http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd + + + uketd_dc + metadataFormats/uketd_dc.xsl + http://naca.central.cranfield.ac.uk/ethos-oai/2.0/ + http://naca.central.cranfield.ac.uk/ethos-oai/2.0/uketd_dc.xsd + + junii2 metadataFormats/junii2.xsl http://irdb.nii.ac.jp/oai http://irdb.nii.ac.jp/oai/junii2-3_0.xsd - - - - - transformers/driver.xsl - - - transformers/openaire.xsl - - - + - + + + transformers/driver.xsl + + + transformers/openaire.xsl + + + + + - + - + - + - + - + @@ -220,20 +220,20 @@ - + - + - + - + @@ -243,7 +243,13 @@ - + + + + + + + @@ -270,8 +276,8 @@ - - org.dspace.xoai.filter.DSpaceAtLeastOneMetadataFilter + + org.dspace.xoai.filter.DSpaceAtLeastOneMetadataFilter dc.type ends_with @@ -294,10 +300,10 @@ other - + - - org.dspace.xoai.filter.DSpaceAtLeastOneMetadataFilter + + org.dspace.xoai.filter.DSpaceAtLeastOneMetadataFilter dc.rights contains @@ -306,57 +312,32 @@ openAccess - + - - org.dspace.xoai.filter.DSpaceAuthorizationFilter - + + org.dspace.xoai.filter.DSpaceAuthorizationFilter + - - org.dspace.xoai.filter.DSpaceAtLeastOneMetadataFilter -<<<<<<< HEAD - - dc.relation - - - starts_with - - - info:eu-repo/grantAgreement/EC/FP - - - - org.dspace.xoai.filter.DSpaceAtLeastOneMetadataFilter - - dc.type - - - contains - - - Thesis - - -======= + + org.dspace.xoai.filter.DSpaceAtLeastOneMetadataFilter dc.relation starts_with info:eu-repo/grantAgreement/EC/FP - ->>>>>>> 7c0f545... OAI 2.1 - - - - - driver - Open Access DRIVERset - - - - ec_fundedresources - EC_fundedresources set - - - + + + + + + driver + Open Access DRIVERset + + + + ec_fundedresources + EC_fundedresources set + + +