mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
[DS-707] Generify List usage
git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5611 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -198,7 +198,7 @@ public class AIPDIMCrosswalk
|
|||||||
* Fields correspond directly to Item.addMetadata() calls so
|
* Fields correspond directly to Item.addMetadata() calls so
|
||||||
* they are simply executed.
|
* they are simply executed.
|
||||||
*/
|
*/
|
||||||
public void ingest(Context context, DSpaceObject dso, List dimList)
|
public void ingest(Context context, DSpaceObject dso, List<Element> dimList)
|
||||||
throws CrosswalkException,
|
throws CrosswalkException,
|
||||||
IOException, SQLException, AuthorizeException
|
IOException, SQLException, AuthorizeException
|
||||||
{
|
{
|
||||||
|
@@ -362,7 +362,7 @@ public class AIPTechMDCrosswalk
|
|||||||
* they are simply executed.
|
* they are simply executed.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void ingest(Context context, DSpaceObject dso, List dimList)
|
public void ingest(Context context, DSpaceObject dso, List<Element> dimList)
|
||||||
throws CrosswalkException,
|
throws CrosswalkException,
|
||||||
IOException, SQLException, AuthorizeException
|
IOException, SQLException, AuthorizeException
|
||||||
{
|
{
|
||||||
@@ -374,10 +374,8 @@ public class AIPTechMDCrosswalk
|
|||||||
int bsfSupport = BitstreamFormat.KNOWN;
|
int bsfSupport = BitstreamFormat.KNOWN;
|
||||||
boolean bsfInternal = false;
|
boolean bsfInternal = false;
|
||||||
|
|
||||||
Iterator di = dimList.iterator();
|
for (Element field : dimList)
|
||||||
while (di.hasNext())
|
|
||||||
{
|
{
|
||||||
Element field = (Element)di.next();
|
|
||||||
|
|
||||||
// if we get <dim> in a list, recurse.
|
// if we get <dim> in a list, recurse.
|
||||||
if (field.getName().equals("dim") && field.getNamespace().equals(XSLTCrosswalk.DIM_NS))
|
if (field.getName().equals("dim") && field.getNamespace().equals(XSLTCrosswalk.DIM_NS))
|
||||||
|
@@ -68,25 +68,22 @@ public class DIMIngestionCrosswalk
|
|||||||
private static Logger log = Logger.getLogger(DIMIngestionCrosswalk.class);
|
private static Logger log = Logger.getLogger(DIMIngestionCrosswalk.class);
|
||||||
private static Namespace DIM_NS = Namespace.getNamespace("http://www.dspace.org/xmlns/dspace/dim");
|
private static Namespace DIM_NS = Namespace.getNamespace("http://www.dspace.org/xmlns/dspace/dim");
|
||||||
|
|
||||||
public void ingest(Context context, DSpaceObject dso, List metadata) throws CrosswalkException, IOException, SQLException, AuthorizeException {
|
public void ingest(Context context, DSpaceObject dso, List<Element> metadata) throws CrosswalkException, IOException, SQLException, AuthorizeException {
|
||||||
List<Element> elements = metadata;
|
Element first = metadata.get(0);
|
||||||
|
if (first.getName().equals("dim") && metadata.size() == 1) {
|
||||||
Element first = elements.get(0);
|
ingest(context,dso,first);
|
||||||
if (first.getName().equals("dim") && elements.size() == 1) {
|
|
||||||
ingest(context,dso,first);
|
|
||||||
}
|
}
|
||||||
else if (first.getName().equals("field") && first.getParentElement() != null) {
|
else if (first.getName().equals("field") && first.getParentElement() != null) {
|
||||||
ingest(context,dso,first.getParentElement());
|
ingest(context,dso,first.getParentElement());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Element wrapper = new Element("wrap",elements.get(0).getNamespace());
|
Element wrapper = new Element("wrap", metadata.get(0).getNamespace());
|
||||||
wrapper.addContent(elements);
|
wrapper.addContent(metadata);
|
||||||
ingest(context,dso,wrapper);
|
ingest(context,dso,wrapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ingest(Context context, DSpaceObject dso, Element root) throws CrosswalkException, IOException, SQLException, AuthorizeException {
|
public void ingest(Context context, DSpaceObject dso, Element root) throws CrosswalkException, IOException, SQLException, AuthorizeException {
|
||||||
|
|
||||||
if (dso.getType() != Constants.ITEM)
|
if (dso.getType() != Constants.ITEM)
|
||||||
{
|
{
|
||||||
throw new CrosswalkObjectNotSupported("DIMIngestionCrosswalk can only crosswalk an Item.");
|
throw new CrosswalkObjectNotSupported("DIMIngestionCrosswalk can only crosswalk an Item.");
|
||||||
|
@@ -102,7 +102,7 @@ public interface IngestionCrosswalk
|
|||||||
* @throws SQLException Database failure in services this calls
|
* @throws SQLException Database failure in services this calls
|
||||||
* @throws AuthorizeException current user not authorized for this operation.
|
* @throws AuthorizeException current user not authorized for this operation.
|
||||||
*/
|
*/
|
||||||
public void ingest(Context context, DSpaceObject dso, List metadata)
|
public void ingest(Context context, DSpaceObject dso, List<Element> metadata)
|
||||||
throws CrosswalkException, IOException, SQLException, AuthorizeException;
|
throws CrosswalkException, IOException, SQLException, AuthorizeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -405,7 +405,6 @@ public class METSRightsCrosswalk
|
|||||||
*
|
*
|
||||||
* @param context
|
* @param context
|
||||||
* @param dso
|
* @param dso
|
||||||
* @param metadata
|
|
||||||
* @throws CrosswalkException
|
* @throws CrosswalkException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws SQLException
|
* @throws SQLException
|
||||||
@@ -413,7 +412,7 @@ public class METSRightsCrosswalk
|
|||||||
* @see RoleCrosswalk
|
* @see RoleCrosswalk
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void ingest(Context context, DSpaceObject dso, List ml)
|
public void ingest(Context context, DSpaceObject dso, List<Element> ml)
|
||||||
throws CrosswalkException, IOException, SQLException, AuthorizeException
|
throws CrosswalkException, IOException, SQLException, AuthorizeException
|
||||||
{
|
{
|
||||||
// we cannot crosswalk METSRights to a SITE object
|
// we cannot crosswalk METSRights to a SITE object
|
||||||
@@ -430,11 +429,8 @@ public class METSRightsCrosswalk
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Loop through each Element in the List
|
// Loop through each Element in the List
|
||||||
Iterator mi = ml.iterator();
|
for (Element element : ml)
|
||||||
while (mi.hasNext())
|
|
||||||
{
|
{
|
||||||
Element element = (Element)mi.next();
|
|
||||||
|
|
||||||
// if we're fed a <RightsDeclarationMD> wrapper object, recurse on its guts:
|
// if we're fed a <RightsDeclarationMD> wrapper object, recurse on its guts:
|
||||||
if (element.getName().equals("RightsDeclarationMD"))
|
if (element.getName().equals("RightsDeclarationMD"))
|
||||||
{
|
{
|
||||||
|
@@ -84,7 +84,7 @@ public class NullIngestionCrosswalk
|
|||||||
outputPretty.outputString(root));
|
outputPretty.outputString(root));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ingest(Context context, DSpaceObject dso, List ml)
|
public void ingest(Context context, DSpaceObject dso, List<Element> ml)
|
||||||
throws CrosswalkException, IOException, SQLException, AuthorizeException
|
throws CrosswalkException, IOException, SQLException, AuthorizeException
|
||||||
{
|
{
|
||||||
// drop xml on the floor but mention what we're missing for debugging:
|
// drop xml on the floor but mention what we're missing for debugging:
|
||||||
|
@@ -69,10 +69,9 @@ public class OAIDCIngestionCrosswalk
|
|||||||
private static Namespace DC_NS = Namespace.getNamespace("http://www.dspace.org/xmlns/dspace/dim");
|
private static Namespace DC_NS = Namespace.getNamespace("http://www.dspace.org/xmlns/dspace/dim");
|
||||||
private static Namespace OAI_DC_NS = Namespace.getNamespace("http://www.openarchives.org/OAI/2.0/oai_dc/");
|
private static Namespace OAI_DC_NS = Namespace.getNamespace("http://www.openarchives.org/OAI/2.0/oai_dc/");
|
||||||
|
|
||||||
public void ingest(Context context, DSpaceObject dso, List metadata) throws CrosswalkException, IOException, SQLException, AuthorizeException {
|
public void ingest(Context context, DSpaceObject dso, List<Element> metadata) throws CrosswalkException, IOException, SQLException, AuthorizeException {
|
||||||
List<Element> elements = metadata;
|
Element wrapper = new Element("wrap", metadata.get(0).getNamespace());
|
||||||
Element wrapper = new Element("wrap",elements.get(0).getNamespace());
|
wrapper.addContent(metadata);
|
||||||
wrapper.addContent(elements);
|
|
||||||
|
|
||||||
ingest(context,dso,wrapper);
|
ingest(context,dso,wrapper);
|
||||||
}
|
}
|
||||||
|
@@ -100,17 +100,16 @@ public class OREIngestionCrosswalk
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void ingest(Context context, DSpaceObject dso, List metadata) throws CrosswalkException, IOException, SQLException, AuthorizeException {
|
public void ingest(Context context, DSpaceObject dso, List<Element> metadata) throws CrosswalkException, IOException, SQLException, AuthorizeException {
|
||||||
|
|
||||||
// If this list contains only the root already, just pass it on
|
// If this list contains only the root already, just pass it on
|
||||||
List<Element> elements = metadata;
|
if (metadata.size() == 1) {
|
||||||
if (elements.size() == 1) {
|
ingest(context, dso, metadata.get(0));
|
||||||
ingest(context, dso, elements.get(0));
|
|
||||||
}
|
}
|
||||||
// Otherwise, wrap them up
|
// Otherwise, wrap them up
|
||||||
else {
|
else {
|
||||||
Element wrapper = new Element("wrap",elements.get(0).getNamespace());
|
Element wrapper = new Element("wrap", metadata.get(0).getNamespace());
|
||||||
wrapper.addContent(elements);
|
wrapper.addContent(metadata);
|
||||||
|
|
||||||
ingest(context,dso,wrapper);
|
ingest(context,dso,wrapper);
|
||||||
}
|
}
|
||||||
|
@@ -102,7 +102,7 @@ public class PREMISCrosswalk
|
|||||||
ingest(context, dso, root.getChildren());
|
ingest(context, dso, root.getChildren());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ingest(Context context, DSpaceObject dso, List ml)
|
public void ingest(Context context, DSpaceObject dso, List<Element> ml)
|
||||||
throws CrosswalkException, IOException, SQLException, AuthorizeException
|
throws CrosswalkException, IOException, SQLException, AuthorizeException
|
||||||
{
|
{
|
||||||
// we only understand how to crosswalk PREMIS to a Bitstream.
|
// we only understand how to crosswalk PREMIS to a Bitstream.
|
||||||
@@ -114,11 +114,8 @@ public class PREMISCrosswalk
|
|||||||
Bitstream bitstream = (Bitstream)dso;
|
Bitstream bitstream = (Bitstream)dso;
|
||||||
String MIMEType = null;
|
String MIMEType = null;
|
||||||
String bsName = null;
|
String bsName = null;
|
||||||
Iterator mi = ml.iterator();
|
for (Element me : ml)
|
||||||
while (mi.hasNext())
|
|
||||||
{
|
{
|
||||||
Element me = (Element)mi.next();
|
|
||||||
|
|
||||||
if (me.getName().equals("premis"))
|
if (me.getName().equals("premis"))
|
||||||
{
|
{
|
||||||
// if we're fed a <premis> wrapper object, recurse on its guts:
|
// if we're fed a <premis> wrapper object, recurse on its guts:
|
||||||
|
@@ -463,7 +463,7 @@ public class QDCCrosswalk extends SelfNamedPlugin
|
|||||||
ingest(context, dso, root.getChildren());
|
ingest(context, dso, root.getChildren());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ingest(Context context, DSpaceObject dso, List ml)
|
public void ingest(Context context, DSpaceObject dso, List<Element> ml)
|
||||||
throws CrosswalkException, IOException, SQLException, AuthorizeException
|
throws CrosswalkException, IOException, SQLException, AuthorizeException
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
@@ -476,10 +476,8 @@ public class QDCCrosswalk extends SelfNamedPlugin
|
|||||||
|
|
||||||
Item item = (Item)dso;
|
Item item = (Item)dso;
|
||||||
|
|
||||||
Iterator mi = ml.iterator();
|
for (Element me : ml)
|
||||||
while (mi.hasNext())
|
|
||||||
{
|
{
|
||||||
Element me = (Element)mi.next();
|
|
||||||
String key = makeQualifiedTagName(me);
|
String key = makeQualifiedTagName(me);
|
||||||
|
|
||||||
// if the root element gets passed here, recurse:
|
// if the root element gets passed here, recurse:
|
||||||
|
@@ -285,7 +285,7 @@ public class RoleCrosswalk
|
|||||||
* @throws AuthorizeException
|
* @throws AuthorizeException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void ingest(Context context, DSpaceObject dso, List metadata)
|
public void ingest(Context context, DSpaceObject dso, List<Element> metadata)
|
||||||
throws CrosswalkException, IOException, SQLException, AuthorizeException
|
throws CrosswalkException, IOException, SQLException, AuthorizeException
|
||||||
{
|
{
|
||||||
if(!metadata.isEmpty())
|
if(!metadata.isEmpty())
|
||||||
|
@@ -91,13 +91,11 @@ public class XSLTIngestionCrosswalk
|
|||||||
}
|
}
|
||||||
|
|
||||||
// apply metadata values returned in DIM to the target item.
|
// apply metadata values returned in DIM to the target item.
|
||||||
private static void applyDim(List dimList, Item item)
|
private static void applyDim(List<Element> dimList, Item item)
|
||||||
throws MetadataValidationException
|
throws MetadataValidationException
|
||||||
{
|
{
|
||||||
Iterator di = dimList.iterator();
|
for (Element elt : dimList)
|
||||||
while (di.hasNext())
|
|
||||||
{
|
{
|
||||||
Element elt = (Element)di.next();
|
|
||||||
if ("field".equals(elt.getName()) && DIM_NS.equals(elt.getNamespace()))
|
if ("field".equals(elt.getName()) && DIM_NS.equals(elt.getNamespace()))
|
||||||
{
|
{
|
||||||
applyDimField(elt, item);
|
applyDimField(elt, item);
|
||||||
@@ -151,7 +149,7 @@ public class XSLTIngestionCrosswalk
|
|||||||
* these correspond directly to Item.addMetadata() calls so
|
* these correspond directly to Item.addMetadata() calls so
|
||||||
* they are simply executed.
|
* they are simply executed.
|
||||||
*/
|
*/
|
||||||
public void ingest(Context context, DSpaceObject dso, List metadata)
|
public void ingest(Context context, DSpaceObject dso, List<Element> metadata)
|
||||||
throws CrosswalkException,
|
throws CrosswalkException,
|
||||||
IOException, SQLException, AuthorizeException
|
IOException, SQLException, AuthorizeException
|
||||||
{
|
{
|
||||||
@@ -233,7 +231,7 @@ public class XSLTIngestionCrosswalk
|
|||||||
ingestDIM(context, dso, dim.getChildren());
|
ingestDIM(context, dso, dim.getChildren());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ingestDIM(Context context, DSpaceObject dso, List fields)
|
public static void ingestDIM(Context context, DSpaceObject dso, List<Element> fields)
|
||||||
throws CrosswalkException,
|
throws CrosswalkException,
|
||||||
IOException, SQLException, AuthorizeException
|
IOException, SQLException, AuthorizeException
|
||||||
{
|
{
|
||||||
@@ -246,10 +244,8 @@ public class XSLTIngestionCrosswalk
|
|||||||
else if (type == Constants.COLLECTION ||
|
else if (type == Constants.COLLECTION ||
|
||||||
type == Constants.COMMUNITY)
|
type == Constants.COMMUNITY)
|
||||||
{
|
{
|
||||||
Iterator di = fields.iterator();
|
for (Element field : fields)
|
||||||
while (di.hasNext())
|
|
||||||
{
|
{
|
||||||
Element field = (Element)di.next();
|
|
||||||
String schema = field.getAttributeValue("mdschema");
|
String schema = field.getAttributeValue("mdschema");
|
||||||
if ("dim".equals(field.getName()) && DIM_NS.equals(field.getNamespace()))
|
if ("dim".equals(field.getName()) && DIM_NS.equals(field.getNamespace()))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user