Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #92 from atmire/dspace3-lyncode-fix

XOAI (Moved configs and bug fix)
  • Loading branch information...
commit fdaffdc806a954f0ab33668270f894124a95c1ee 2 parents 2fb2eee + 8be71cf
@mdiggory mdiggory authored
Showing with 171 additions and 175 deletions.
  1. +6 −1 dspace-oai/pom.xml
  2. +5 −2 dspace-oai/src/main/java/org/dspace/xoai/DSpaceOAIDataProvider.java
  3. +7 −76 dspace-oai/src/main/java/org/dspace/xoai/data/DSpaceDatabaseItem.java
  4. +65 −8 dspace-oai/src/main/java/org/dspace/xoai/data/DSpaceItem.java
  5. +2 −2 dspace-oai/src/main/java/org/dspace/xoai/data/DSpaceItemDatabaseRepository.java
  6. +14 −14 dspace-oai/src/main/java/org/dspace/xoai/data/DSpaceItemRepository.java
  7. +2 −2 dspace-oai/src/main/java/org/dspace/xoai/data/DSpaceItemSolrRepository.java
  8. +2 −2 dspace-oai/src/main/java/org/dspace/xoai/data/DSpaceSetRepository.java
  9. +3 −3 dspace-oai/src/main/java/org/dspace/xoai/filter/DSpaceAtLeastOneMetadataFilter.java
  10. +11 −3 dspace-oai/src/main/java/org/dspace/xoai/filter/DSpaceAuthorizationFilter.java
  11. +9 −3 dspace-oai/src/main/java/org/dspace/xoai/filter/DSpaceFilter.java
  12. +3 −2 dspace-oai/src/main/java/org/dspace/xoai/filter/DSpaceMetadataExistsFilter.java
  13. +2 −1  dspace-oai/src/main/java/org/dspace/xoai/filter/DateFromFilter.java
  14. +2 −1  dspace-oai/src/main/java/org/dspace/xoai/filter/DateUntilFilter.java
  15. +7 −27 dspace-oai/src/main/java/org/dspace/xoai/filter/DspaceSetSpecFilter.java
  16. +30 −0 dspace-oai/src/main/java/org/dspace/xoai/util/MetadataNamePredicate.java
  17. 0  dspace/config/{modules → crosswalks}/oai/metadataFormats/didl.xsl
  18. 0  dspace/config/{modules → crosswalks}/oai/metadataFormats/dim.xsl
  19. 0  dspace/config/{modules → crosswalks}/oai/metadataFormats/etdms.xsl
  20. 0  dspace/config/{modules → crosswalks}/oai/metadataFormats/marc.xsl
  21. 0  dspace/config/{modules → crosswalks}/oai/metadataFormats/mets.xsl
  22. 0  dspace/config/{modules → crosswalks}/oai/metadataFormats/mods.xsl
  23. 0  dspace/config/{modules → crosswalks}/oai/metadataFormats/oai_dc.xsl
  24. 0  dspace/config/{modules → crosswalks}/oai/metadataFormats/ore.xsl
  25. 0  dspace/config/{modules → crosswalks}/oai/metadataFormats/qdc.xsl
  26. 0  dspace/config/{modules → crosswalks}/oai/metadataFormats/rdf.xsl
  27. 0  dspace/config/{modules → crosswalks}/oai/metadataFormats/uketd_dc.xsl
  28. 0  dspace/config/{modules → crosswalks}/oai/metadataFormats/xoai.xsl
  29. 0  dspace/config/{modules → crosswalks}/oai/transformers/driver.xsl
  30. 0  dspace/config/{modules → crosswalks}/oai/transformers/openaire.xsl
  31. 0  dspace/config/{modules → crosswalks}/oai/xoai.xml
  32. +0 −27 dspace/config/crosswalks/oaidc.properties
  33. +1 −1  dspace/config/modules/oai.cfg
View
7 dspace-oai/pom.xml
@@ -75,7 +75,7 @@
<dependency>
<groupId>com.lyncode</groupId>
<artifactId>xoai</artifactId>
- <version>2.2.0</version>
+ <version>2.2.5</version>
</dependency>
<dependency>
<groupId>org.dspace</groupId>
@@ -101,6 +101,11 @@
<artifactId>slf4j-api</artifactId>
<version>1.5.6</version>
</dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>13.0</version>
+ </dependency>
</dependencies>
View
7 dspace-oai/src/main/java/org/dspace/xoai/DSpaceOAIDataProvider.java
@@ -60,12 +60,15 @@ public void init()
}
catch (com.lyncode.xoai.dataprovider.exceptions.ConfigurationException e)
{
- System.out.println("Unable to configure XOAI (OAI 2.0 Core)");
+ System.out.println("Unable to configure XOAI (XOAI 2.0 Core)");
e.printStackTrace();
}
catch (SolrServerException e)
{
- System.out.println("Unable to configure XOAI (OAI 2.0 Core)");
+ System.out.println("Unable to connect to Solr Server");
+ e.printStackTrace();
+ } catch (Exception e) {
+ System.out.println("Unable to initialize XOAI.");
e.printStackTrace();
}
}
View
83 dspace-oai/src/main/java/org/dspace/xoai/data/DSpaceDatabaseItem.java
@@ -9,7 +9,6 @@
import java.sql.SQLException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.regex.Pattern;
@@ -19,14 +18,18 @@
import org.dspace.content.Collection;
import org.dspace.content.Community;
import org.dspace.content.Item;
+import org.dspace.xoai.util.MetadataNamePredicate;
import org.dspace.xoai.util.XOAICacheManager;
import org.dspace.xoai.util.XOAIDatabaseManager;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
import com.lyncode.xoai.dataprovider.core.ItemMetadata;
import com.lyncode.xoai.dataprovider.core.ReferenceSet;
import com.lyncode.xoai.dataprovider.data.AbstractAbout;
import com.lyncode.xoai.dataprovider.exceptions.MetadataBindException;
import com.lyncode.xoai.dataprovider.xml.xoai.Element;
+import com.lyncode.xoai.dataprovider.xml.xoai.Element.Field;
/**
*
@@ -35,7 +38,9 @@
public class DSpaceDatabaseItem extends DSpaceItem
{
private static Logger log = LogManager.getLogger(DSpaceDatabaseItem.class);
-
+
+
+
private static List<ReferenceSet> getSets(Item item)
{
List<ReferenceSet> sets = new ArrayList<ReferenceSet>();
@@ -127,80 +132,6 @@ public ItemMetadata getMetadata()
return metadata;
}
- private List<String> getMetadata(List<Element> elems, String[] parts)
- {
- List<String> list = new ArrayList<String>();
- if (parts.length > 1)
- {
- if (parts[0].equals("*"))
- {
- for (Element e : elems)
- {
- if (e.getElement() != null)
- list.addAll(this.getMetadata(e.getElement(),
- Arrays.copyOfRange(parts, 1, parts.length)));
- }
- }
- else
- {
- Element e = getElement(elems, parts[0]);
- if (e != null)
- list.addAll(this.getMetadata(e.getElement(),
- Arrays.copyOfRange(parts, 1, parts.length)));
- }
- }
- else if (parts.length == 1)
- {
- // Here we could have reached our target (named fields)
- for (Element e : elems)
- {
- for (Element.Field f : e.getField())
- {
- if (parts[0].equals("*"))
- list.add(f.getValue());
- else if (parts[0].equals(f.getName()))
- list.add(f.getValue());
- }
- }
-
- if (parts[0].equals("*"))
- {
- for (Element e : elems)
- {
- if (e.getElement() != null)
- list.addAll(this.getMetadata(e.getElement(),
- Arrays.copyOfRange(parts, 1, parts.length)));
- }
- }
- else
- {
- Element e = getElement(elems, parts[0]);
- if (e != null)
- list.addAll(this.getMetadata(e.getElement(),
- Arrays.copyOfRange(parts, 1, parts.length)));
- }
- }
- else
- {
- // Here we have reached our target (unnamed fields)
- for (Element e : elems)
- {
- for (Element.Field f : e.getField())
- {
- if (f.getName() == null || f.getName().equals(""))
- list.add(f.getValue());
- }
- }
- }
- return list;
- }
-
- public List<String> getMetadata(String field)
- {
- String[] parts = field.split(Pattern.quote("."));
- return getMetadata(this.getMetadata().getMetadata().getElement(), parts);
- }
-
public Item getItem()
{
return item;
View
73 dspace-oai/src/main/java/org/dspace/xoai/data/DSpaceItem.java
@@ -9,11 +9,17 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.regex.Pattern;
import org.dspace.core.ConfigurationManager;
+import org.dspace.xoai.util.MetadataNamePredicate;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
import com.lyncode.xoai.dataprovider.data.AbstractAbout;
import com.lyncode.xoai.dataprovider.data.AbstractItem;
+import com.lyncode.xoai.dataprovider.xml.xoai.Element;
+import com.lyncode.xoai.dataprovider.xml.xoai.Element.Field;
/**
*
@@ -21,7 +27,65 @@
*/
public abstract class DSpaceItem extends AbstractItem
{
+ private static List<Element> filter (List<Element> input, String name) {
+ return Lists.newArrayList(Collections2.filter(input, new MetadataNamePredicate(name)));
+ }
+
+ private static List<Element> flat (List<Element> input) {
+ List<Element> elems = new ArrayList<Element>();
+ for (Element e : input) {
+ if (e.getElement() != null) {
+ elems.addAll(e.getElement());
+ }
+ }
+ return elems;
+ }
+
+ private static List<String> values (List<Element> input) {
+ List<String> elems = new ArrayList<String>();
+ for (Element e : input)
+ if (e.getElement() != null && !e.getElement().isEmpty() && e.getElement().get(0).getField() != null)
+ for (Field f : e.getElement().get(0).getField())
+ if (f.getName() != null && f.getName().equals("value"))
+ elems.add(f.getValue());
+ return elems;
+ }
+
+
+ private List<String> getMetadata (String schema, String element) {
+ List<Element> metadata = this.getMetadata().getMetadata().getElement();
+ return values(filter(flat(filter(metadata, schema)), element));
+ }
+
+ private List<String> getMetadata (String schema, String element, String qualifier) {
+ List<Element> metadata = this.getMetadata().getMetadata().getElement();
+ return values(filter(flat(filter(flat(filter(metadata, schema)), element)), qualifier));
+ }
+
+ private static String _prefix = null;
+ public static String buildIdentifier (String handle) {
+ if (_prefix == null)
+ {
+ _prefix = ConfigurationManager.getProperty("oai",
+ "identifier.prefix");
+ }
+ return "oai:" + _prefix + ":" + handle;
+ }
+ public static String parseHandle (String oaiIdentifier) {
+ String[] parts = oaiIdentifier.split(Pattern.quote(":"));
+ if (parts.length > 0) return parts[parts.length - 1];
+ else return null; // Contract
+ }
+
+ public List<String> getMetadata(String field)
+ {
+ String[] parts = field.split(Pattern.quote("."));
+ if (parts.length == 2) return this.getMetadata(parts[0], parts[1]);
+ else if (parts.length == 3) return this.getMetadata(parts[0], parts[1], parts[2]);
+ else return new ArrayList<String>();
+ }
+
@Override
public List<AbstractAbout> getAbout()
{
@@ -29,17 +93,10 @@
}
protected abstract String getHandle ();
-
- private String _prefix = null;
@Override
public String getIdentifier()
{
- if (_prefix == null)
- {
- _prefix = ConfigurationManager.getProperty("oai",
- "identifier.prefix");
- }
- return "oai:" + _prefix + ":" + this.getHandle();
+ return buildIdentifier(getHandle());
}
}
View
4 dspace-oai/src/main/java/org/dspace/xoai/data/DSpaceItemDatabaseRepository.java
@@ -153,7 +153,7 @@ private ListItemsResults getResult(String query, String countQuery, List<Object>
}
@Override
- protected ListItemsResults getItems(List<Filter> filters, int offset,
+ public ListItemsResults getItems(List<Filter> filters, int offset,
int length)
{
List<Object> parameters = new ArrayList<Object>();
@@ -207,7 +207,7 @@ protected ListItemsResults getItems(List<Filter> filters, int offset,
}
@Override
- protected ListItemIdentifiersResult getItemIdentifiers(
+ public ListItemIdentifiersResult getItemIdentifiers(
List<Filter> filters, int offset, int length)
{
List<Object> parameters = new ArrayList<Object>();
View
28 dspace-oai/src/main/java/org/dspace/xoai/data/DSpaceItemRepository.java
@@ -30,7 +30,7 @@
// private static Logger log =
// LogManager.getLogger(DSpaceItemRepository.class);
@Override
- protected ListItemIdentifiersResult getItemIdentifiers(
+ public ListItemIdentifiersResult getItemIdentifiers(
List<Filter> filters, int offset, int length, Date from)
{
filters.add(new Filter(new DateFromFilter(from), FilterScope.Query));
@@ -38,7 +38,7 @@ protected ListItemIdentifiersResult getItemIdentifiers(
}
@Override
- protected ListItemIdentifiersResult getItemIdentifiers(
+ public ListItemIdentifiersResult getItemIdentifiers(
List<Filter> filters, int offset, int length, String setSpec)
{
filters.add(new Filter(new DspaceSetSpecFilter(setSpec),
@@ -47,7 +47,7 @@ protected ListItemIdentifiersResult getItemIdentifiers(
}
@Override
- protected ListItemIdentifiersResult getItemIdentifiers(
+ public ListItemIdentifiersResult getItemIdentifiers(
List<Filter> filters, int offset, int length, Date from, Date until)
{
filters.add(new Filter(new DateFromFilter(from), FilterScope.Query));
@@ -56,7 +56,7 @@ protected ListItemIdentifiersResult getItemIdentifiers(
}
@Override
- protected ListItemIdentifiersResult getItemIdentifiers(
+ public ListItemIdentifiersResult getItemIdentifiers(
List<Filter> filters, int offset, int length, String setSpec,
Date from)
{
@@ -67,7 +67,7 @@ protected ListItemIdentifiersResult getItemIdentifiers(
}
@Override
- protected ListItemIdentifiersResult getItemIdentifiers(
+ public ListItemIdentifiersResult getItemIdentifiers(
List<Filter> filters, int offset, int length, String setSpec,
Date from, Date until)
{
@@ -79,7 +79,7 @@ protected ListItemIdentifiersResult getItemIdentifiers(
}
@Override
- protected ListItemIdentifiersResult getItemIdentifiersUntil(
+ public ListItemIdentifiersResult getItemIdentifiersUntil(
List<Filter> filters, int offset, int length, Date until)
{
filters.add(new Filter(new DateUntilFilter(until), FilterScope.Query));
@@ -87,7 +87,7 @@ protected ListItemIdentifiersResult getItemIdentifiersUntil(
}
@Override
- protected ListItemIdentifiersResult getItemIdentifiersUntil(
+ public ListItemIdentifiersResult getItemIdentifiersUntil(
List<Filter> filters, int offset, int length, String setSpec,
Date until)
{
@@ -98,7 +98,7 @@ protected ListItemIdentifiersResult getItemIdentifiersUntil(
}
@Override
- protected ListItemsResults getItems(List<Filter> filters, int offset,
+ public ListItemsResults getItems(List<Filter> filters, int offset,
int length, Date from)
{
filters.add(new Filter(new DateFromFilter(from), FilterScope.Query));
@@ -106,7 +106,7 @@ protected ListItemsResults getItems(List<Filter> filters, int offset,
}
@Override
- protected ListItemsResults getItems(List<Filter> filters, int offset,
+ public ListItemsResults getItems(List<Filter> filters, int offset,
int length, String setSpec)
{
filters.add(new Filter(new DspaceSetSpecFilter(setSpec),
@@ -115,7 +115,7 @@ protected ListItemsResults getItems(List<Filter> filters, int offset,
}
@Override
- protected ListItemsResults getItems(List<Filter> filters, int offset,
+ public ListItemsResults getItems(List<Filter> filters, int offset,
int length, Date from, Date until)
{
filters.add(new Filter(new DateFromFilter(from), FilterScope.Query));
@@ -124,7 +124,7 @@ protected ListItemsResults getItems(List<Filter> filters, int offset,
}
@Override
- protected ListItemsResults getItems(List<Filter> filters, int offset,
+ public ListItemsResults getItems(List<Filter> filters, int offset,
int length, String setSpec, Date from)
{
filters.add(new Filter(new DateFromFilter(from), FilterScope.Query));
@@ -134,7 +134,7 @@ protected ListItemsResults getItems(List<Filter> filters, int offset,
}
@Override
- protected ListItemsResults getItems(List<Filter> filters, int offset,
+ public ListItemsResults getItems(List<Filter> filters, int offset,
int length, String setSpec, Date from, Date until)
{
filters.add(new Filter(new DateFromFilter(from), FilterScope.Query));
@@ -145,7 +145,7 @@ protected ListItemsResults getItems(List<Filter> filters, int offset,
}
@Override
- protected ListItemsResults getItemsUntil(List<Filter> filters, int offset,
+ public ListItemsResults getItemsUntil(List<Filter> filters, int offset,
int length, Date until)
{
filters.add(new Filter(new DateUntilFilter(until), FilterScope.Query));
@@ -153,7 +153,7 @@ protected ListItemsResults getItemsUntil(List<Filter> filters, int offset,
}
@Override
- protected ListItemsResults getItemsUntil(List<Filter> filters, int offset,
+ public ListItemsResults getItemsUntil(List<Filter> filters, int offset,
int length, String setSpec, Date from)
{
filters.add(new Filter(new DateFromFilter(from), FilterScope.Query));
View
4 dspace-oai/src/main/java/org/dspace/xoai/data/DSpaceItemSolrRepository.java
@@ -64,7 +64,7 @@ public AbstractItem getItem(String identifier)
}
@Override
- protected ListItemIdentifiersResult getItemIdentifiers(
+ public ListItemIdentifiersResult getItemIdentifiers(
List<Filter> filters, int offset, int length)
{
List<String> whereCond = new ArrayList<String>();
@@ -92,7 +92,7 @@ protected ListItemIdentifiersResult getItemIdentifiers(
}
@Override
- protected ListItemsResults getItems(List<Filter> filters, int offset,
+ public ListItemsResults getItems(List<Filter> filters, int offset,
int length)
{
List<String> whereCond = new ArrayList<String>();
View
4 dspace-oai/src/main/java/org/dspace/xoai/data/DSpaceSetRepository.java
@@ -158,7 +158,7 @@ private int getCollectionCount()
}
@Override
- protected ListSetsResult retrieveSets(int offset, int length)
+ public ListSetsResult retrieveSets(int offset, int length)
{
// Only database sets (virtual sets are added by lyncode common library)
log.debug("Quering sets. Offset: " + offset + " - Length: " + length);
@@ -198,7 +198,7 @@ public boolean supportSets()
}
@Override
- protected boolean exists(String setSpec)
+ public boolean exists(String setSpec)
{
if (setSpec.startsWith("col_"))
{
View
6 dspace-oai/src/main/java/org/dspace/xoai/filter/DSpaceAtLeastOneMetadataFilter.java
@@ -17,7 +17,7 @@
import org.apache.log4j.Logger;
import org.apache.solr.client.solrj.util.ClientUtils;
import org.dspace.core.Context;
-import org.dspace.xoai.data.DSpaceDatabaseItem;
+import org.dspace.xoai.data.DSpaceItem;
import org.dspace.xoai.exceptions.InvalidMetadataFieldException;
import org.dspace.xoai.filter.data.DSpaceMetadataFilterOperator;
import org.dspace.xoai.util.MetadataFieldManager;
@@ -101,11 +101,11 @@ public DatabaseFilterResult getWhere(Context context)
}
@Override
- public boolean isShown(DSpaceDatabaseItem item)
+ public boolean isShown(DSpaceItem item)
{
if (this.getField() == null)
return true;
- List<String> values = item.getMetadata(this.getField()+".*");
+ List<String> values = item.getMetadata(this.getField());
for (String praticalValue : values)
{
for (String theoreticValue : this.getValues())
View
14 dspace-oai/src/main/java/org/dspace/xoai/filter/DSpaceAuthorizationFilter.java
@@ -11,6 +11,7 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
+
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.dspace.authorize.AuthorizeException;
@@ -19,7 +20,8 @@
import org.dspace.content.Item;
import org.dspace.core.Constants;
import org.dspace.core.Context;
-import org.dspace.xoai.data.DSpaceDatabaseItem;
+import org.dspace.handle.HandleManager;
+import org.dspace.xoai.data.DSpaceItem;
/**
*
@@ -44,12 +46,14 @@ public DatabaseFilterResult getWhere(Context context)
}
@Override
- public boolean isShown(DSpaceDatabaseItem item)
+ public boolean isShown(DSpaceItem item)
{
try
{
Context ctx = super.getContext();
- Item dsitem = item.getItem();
+ String handle = DSpaceItem.parseHandle(item.getIdentifier());
+ if (handle == null) return false;
+ Item dsitem = (Item) HandleManager.resolveToObject(ctx, handle);
AuthorizeManager.authorizeAction(ctx, dsitem, Constants.READ);
for (Bundle b : dsitem.getBundles())
AuthorizeManager.authorizeAction(ctx, b, Constants.READ);
@@ -63,6 +67,10 @@ public boolean isShown(DSpaceDatabaseItem item)
{
log.error(ex.getMessage());
}
+ catch (Exception ex)
+ {
+ log.error(ex.getMessage());
+ }
return false;
}
View
12 dspace-oai/src/main/java/org/dspace/xoai/filter/DSpaceFilter.java
@@ -7,8 +7,11 @@
*/
package org.dspace.xoai.filter;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
import org.dspace.core.Context;
import org.dspace.xoai.data.DSpaceDatabaseItem;
+import org.dspace.xoai.data.DSpaceItem;
import com.lyncode.xoai.dataprovider.data.AbstractItemIdentifier;
import com.lyncode.xoai.dataprovider.filter.AbstractFilter;
@@ -19,6 +22,7 @@
*/
public abstract class DSpaceFilter extends AbstractFilter
{
+ private static Logger log = LogManager.getLogger(DSpaceFilter.class);
private Context _ctx = null;
public void initialize(Context ctx)
@@ -42,14 +46,16 @@ public Context getContext()
public abstract SolrFilterResult getQuery();
- public abstract boolean isShown(DSpaceDatabaseItem item);
+ public abstract boolean isShown(DSpaceItem item);
@Override
public boolean isItemShown(AbstractItemIdentifier item)
{
- if (item instanceof DSpaceDatabaseItem)
+ if (item instanceof DSpaceItem)
{
- return this.isShown((DSpaceDatabaseItem) item);
+ boolean value = this.isShown((DSpaceItem) item);
+ if (!value) log.debug("Item "+item.getIdentifier()+" not shown because of filter "+this.getClass().getName());
+ return value;
}
return false;
}
View
5 dspace-oai/src/main/java/org/dspace/xoai/filter/DSpaceMetadataExistsFilter.java
@@ -13,6 +13,7 @@
import org.apache.log4j.Logger;
import org.dspace.core.Context;
import org.dspace.xoai.data.DSpaceDatabaseItem;
+import org.dspace.xoai.data.DSpaceItem;
import org.dspace.xoai.exceptions.InvalidMetadataFieldException;
import org.dspace.xoai.util.MetadataFieldManager;
@@ -57,9 +58,9 @@ public DatabaseFilterResult getWhere(Context context)
}
@Override
- public boolean isShown(DSpaceDatabaseItem item)
+ public boolean isShown(DSpaceItem item)
{
- if (item.getMetadata(this.getField()+".*").size() > 0)
+ if (item.getMetadata(this.getField()).size() > 0)
return true;
return false;
View
3  dspace-oai/src/main/java/org/dspace/xoai/filter/DateFromFilter.java
@@ -12,6 +12,7 @@
import org.apache.solr.client.solrj.util.ClientUtils;
import org.dspace.core.Context;
import org.dspace.xoai.data.DSpaceDatabaseItem;
+import org.dspace.xoai.data.DSpaceItem;
import org.dspace.xoai.util.DateUtils;
/**
@@ -35,7 +36,7 @@ public DatabaseFilterResult getWhere(Context context)
}
@Override
- public boolean isShown(DSpaceDatabaseItem item)
+ public boolean isShown(DSpaceItem item)
{
if (item.getDatestamp().compareTo(_date) >= 0)
return true;
View
3  dspace-oai/src/main/java/org/dspace/xoai/filter/DateUntilFilter.java
@@ -13,6 +13,7 @@
import org.dspace.core.Context;
import org.dspace.xoai.data.DSpaceDatabaseItem;
+import org.dspace.xoai.data.DSpaceItem;
/**
*
@@ -35,7 +36,7 @@ public DatabaseFilterResult getWhere(Context context)
}
@Override
- public boolean isShown(DSpaceDatabaseItem item)
+ public boolean isShown(DSpaceItem item)
{
if (item.getDatestamp().compareTo(_date) <= 0)
return true;
View
34 dspace-oai/src/main/java/org/dspace/xoai/filter/DspaceSetSpecFilter.java
@@ -22,8 +22,11 @@
import org.dspace.content.Item;
import org.dspace.handle.HandleManager;
import org.dspace.xoai.data.DSpaceDatabaseItem;
+import org.dspace.xoai.data.DSpaceItem;
import org.dspace.xoai.util.XOAIDatabaseManager;
+import com.lyncode.xoai.dataprovider.core.ReferenceSet;
+
/**
*
* @author Lyncode Development Team <dspace@lyncode.com>
@@ -79,34 +82,11 @@ else if (_setSpec.startsWith("com_"))
}
@Override
- public boolean isShown(DSpaceDatabaseItem item)
+ public boolean isShown(DSpaceItem item)
{
- try
- {
- Item dsitem = item.getItem();
- if (_setSpec.startsWith("col_"))
- {
- String handle = _setSpec.replace("col_", "");
- for (Collection c : dsitem.getCollections())
- if (c.getHandle().replace('/', '_').equals(handle))
- return true;
- return false;
- }
- else if (_setSpec.startsWith("com_"))
- {
- String handle = _setSpec.replace("com_", "");
- for (Community c : XOAIDatabaseManager
- .flatParentCommunities(dsitem))
- if (c.getHandle().replace('/', '_').equals(handle))
- return true;
- return false;
- }
- }
- catch (SQLException ex)
- {
- log.error(ex.getMessage(), ex);
- }
-
+ for (ReferenceSet s : item.getSets())
+ if (s.getSetSpec().equals(_setSpec))
+ return true;
return false;
}
View
30 dspace-oai/src/main/java/org/dspace/xoai/util/MetadataNamePredicate.java
@@ -0,0 +1,30 @@
+/**
+ * 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.util;
+
+import org.dspace.content.Item;
+
+import com.google.common.base.Predicate;
+import com.lyncode.xoai.dataprovider.xml.xoai.Element;
+
+public class MetadataNamePredicate implements Predicate<Element> {
+ private String name;
+
+ public MetadataNamePredicate (String n) {
+ name = n;
+ }
+
+ @Override
+ public boolean apply(Element arg0) {
+ if (name == null) return false;
+ else if (name.equals(Item.ANY)) return true;
+ else return (name.toLowerCase().equals(arg0.getName().toLowerCase()));
+ }
+
+
+}
View
0  ...nfig/modules/oai/metadataFormats/didl.xsl → ...g/crosswalks/oai/metadataFormats/didl.xsl
File renamed without changes
View
0  ...onfig/modules/oai/metadataFormats/dim.xsl → ...ig/crosswalks/oai/metadataFormats/dim.xsl
File renamed without changes
View
0  ...fig/modules/oai/metadataFormats/etdms.xsl → .../crosswalks/oai/metadataFormats/etdms.xsl
File renamed without changes
View
0  ...nfig/modules/oai/metadataFormats/marc.xsl → ...g/crosswalks/oai/metadataFormats/marc.xsl
File renamed without changes
View
0  ...nfig/modules/oai/metadataFormats/mets.xsl → ...g/crosswalks/oai/metadataFormats/mets.xsl
File renamed without changes
View
0  ...nfig/modules/oai/metadataFormats/mods.xsl → ...g/crosswalks/oai/metadataFormats/mods.xsl
File renamed without changes
View
0  ...ig/modules/oai/metadataFormats/oai_dc.xsl → ...crosswalks/oai/metadataFormats/oai_dc.xsl
File renamed without changes
View
0  ...onfig/modules/oai/metadataFormats/ore.xsl → ...ig/crosswalks/oai/metadataFormats/ore.xsl
File renamed without changes
View
0  ...onfig/modules/oai/metadataFormats/qdc.xsl → ...ig/crosswalks/oai/metadataFormats/qdc.xsl
File renamed without changes
View
0  ...onfig/modules/oai/metadataFormats/rdf.xsl → ...ig/crosswalks/oai/metadataFormats/rdf.xsl
File renamed without changes
View
0  .../modules/oai/metadataFormats/uketd_dc.xsl → ...osswalks/oai/metadataFormats/uketd_dc.xsl
File renamed without changes
View
0  ...nfig/modules/oai/metadataFormats/xoai.xsl → ...g/crosswalks/oai/metadataFormats/xoai.xsl
File renamed without changes
View
0  ...onfig/modules/oai/transformers/driver.xsl → ...ig/crosswalks/oai/transformers/driver.xsl
File renamed without changes
View
0  ...fig/modules/oai/transformers/openaire.xsl → .../crosswalks/oai/transformers/openaire.xsl
File renamed without changes
View
0  dspace/config/modules/oai/xoai.xml → dspace/config/crosswalks/oai/xoai.xml
File renamed without changes
View
27 dspace/config/crosswalks/oaidc.properties
@@ -1,27 +0,0 @@
-# <schema>.<element>.(<qualifier|*>) = element oai_dc
-# you can map more then one metadata to the same oai_dc element,
-# see for example (dc.contributor.editor, dc.contributor.advisor, etc.)
-dc.title.* = title
-dc.contributor.author = creator
-dc.contributor = contributor
-dc.contributor.editor = contributor
-dc.contributor.advisor = contributor
-dc.contributor.illustrator = contributor
-dc.contributor.other = contributor
-dc.date.* = date
-dc.description = description
-dc.description.abstract = description
-dc.description.sponsorship = description
-dc.description.statementofresponsibility = description
-dc.description.tableofcontents = description
-dc.description.uri = description
-dc.identifier.* = identifier
-dc.language.* = language
-dc.publisher.* = publisher
-dc.relation.* = relation
-dc.rights.* = rights
-dc.subject.* = subject
-dc.format.* = format
-dc.source.* = source
-dc.coverage.* = coverage
-dc.type.* = type
View
2  dspace/config/modules/oai.cfg
@@ -16,7 +16,7 @@ identifier.prefix = ${dspace.hostname}
bitstream.baseUrl = ${dspace.url}
# Base Configuration Directory
-config.dir = ${dspace.dir}/config/modules/oai
+config.dir = ${dspace.dir}/config/crosswalks/oai
# Cache enabled?
cache.enabled = true
Please sign in to comment.
Something went wrong with that request. Please try again.