mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
(James Rutherford)
- SF Patch #1620700 Add Community and Sub-Community to OAI Sets git-svn-id: http://scm.dspace.org/svn/repo/trunk@2012 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -124,7 +124,8 @@ public class Harvest
|
||||
// Put together our query. Note there is no need for an
|
||||
// "in_archive=true" condition, we are using the existence of
|
||||
// Handles as our 'existence criterion'.
|
||||
String query = "SELECT handle.handle, handle.resource_id, item.withdrawn, item.last_modified FROM handle, item";
|
||||
// FIXME: I think the "DISTINCT" is redundant
|
||||
String query = "SELECT DISTINCT handle.handle, handle.resource_id, item.withdrawn, item.last_modified FROM handle, item";
|
||||
|
||||
|
||||
// We are building a complex query that may contain a variable
|
||||
|
@@ -53,6 +53,7 @@ import java.util.Vector;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.core.Context;
|
||||
@@ -234,7 +235,7 @@ public class DSpaceOAICatalog extends AbstractCatalog
|
||||
context = new Context();
|
||||
|
||||
// Get the relevant OAIItemInfo objects to make headers
|
||||
Collection scope = resolveSet(context, set);
|
||||
DSpaceObject scope = resolveSet(context, set);
|
||||
List itemInfos = Harvest.harvest(context, scope, from, until, 0, 0, // Everything
|
||||
// for
|
||||
// now
|
||||
@@ -557,7 +558,7 @@ public class DSpaceOAICatalog extends AbstractCatalog
|
||||
context = new Context();
|
||||
|
||||
// Get the relevant HarvestedItemInfo objects to make headers
|
||||
Collection scope = resolveSet(context, set);
|
||||
DSpaceObject scope = resolveSet(context, set);
|
||||
List itemInfos = Harvest.harvest(context, scope, from, until,
|
||||
offset, MAX_RECORDS, // Limit amount returned from one
|
||||
// request
|
||||
@@ -689,6 +690,30 @@ public class DSpaceOAICatalog extends AbstractCatalog
|
||||
spec.append("</set>");
|
||||
sets.add(spec.toString());
|
||||
}
|
||||
|
||||
Community[] allComs = Community.findAll(context);
|
||||
for (int i = 0; i < allComs.length; i++)
|
||||
{
|
||||
spec = new StringBuffer("<set><setSpec>hdl_");
|
||||
spec.append(allComs[i].getHandle().replace('/', '_'));
|
||||
spec.append("</setSpec>");
|
||||
String commName = allComs[i].getMetadata("name");
|
||||
if(commName != null)
|
||||
{
|
||||
spec.append("<setName>");
|
||||
spec.append(Utils.addEntities(commName));
|
||||
spec.append("</setName>");
|
||||
}
|
||||
else
|
||||
{
|
||||
spec.append("<setName />");
|
||||
// Warn that there is an error of a null set name
|
||||
log.info(LogManager.getHeader(null, "oai_error",
|
||||
"null_set_name_for_set_id_" + allComs[i].getHandle()));
|
||||
}
|
||||
spec.append("</set>");
|
||||
sets.add(spec.toString());
|
||||
}
|
||||
}
|
||||
catch (SQLException se)
|
||||
{
|
||||
@@ -753,7 +778,7 @@ public class DSpaceOAICatalog extends AbstractCatalog
|
||||
* @return the corresponding community or collection, or null if no set
|
||||
* provided
|
||||
*/
|
||||
private Collection resolveSet(Context context, String set)
|
||||
private DSpaceObject resolveSet(Context context, String set)
|
||||
throws SQLException, BadArgumentException
|
||||
{
|
||||
if (set == null)
|
||||
@@ -774,10 +799,12 @@ public class DSpaceOAICatalog extends AbstractCatalog
|
||||
o = HandleManager.resolveToObject(context, handle);
|
||||
}
|
||||
|
||||
// If it corresponds to a collection, that's the set we want
|
||||
if ((o != null) && o instanceof Collection)
|
||||
// If it corresponds to a collection or a community, that's the set we
|
||||
// want
|
||||
if ((o != null) &&
|
||||
((o instanceof Collection) || (o instanceof Community)))
|
||||
{
|
||||
return (Collection) o;
|
||||
return o;
|
||||
}
|
||||
|
||||
// Handle is either non-existent, or corresponds to a non-collection
|
||||
|
@@ -10,6 +10,7 @@
|
||||
- Fixed SF bug #1727034 Method MetadataField.unique() is incorrect for null values
|
||||
- Fixed SF bug #1614546 get rid of unused mets_bitstream_id column
|
||||
- SF Patch #1638569 for SF Bug #1638565 Database Upgrade 12 to 13 missing content on new colums
|
||||
- SF Patch #1620700 Add Community and Sub-Community to OAI Sets
|
||||
|
||||
1.4.2 beta
|
||||
===========
|
||||
|
Reference in New Issue
Block a user