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
|
||||
* 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,
|
||||
IOException, SQLException, AuthorizeException
|
||||
{
|
||||
|
@@ -362,7 +362,7 @@ public class AIPTechMDCrosswalk
|
||||
* they are simply executed.
|
||||
*/
|
||||
@Override
|
||||
public void ingest(Context context, DSpaceObject dso, List dimList)
|
||||
public void ingest(Context context, DSpaceObject dso, List<Element> dimList)
|
||||
throws CrosswalkException,
|
||||
IOException, SQLException, AuthorizeException
|
||||
{
|
||||
@@ -374,10 +374,8 @@ public class AIPTechMDCrosswalk
|
||||
int bsfSupport = BitstreamFormat.KNOWN;
|
||||
boolean bsfInternal = false;
|
||||
|
||||
Iterator di = dimList.iterator();
|
||||
while (di.hasNext())
|
||||
for (Element field : dimList)
|
||||
{
|
||||
Element field = (Element)di.next();
|
||||
|
||||
// if we get <dim> in a list, recurse.
|
||||
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 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 {
|
||||
List<Element> elements = metadata;
|
||||
|
||||
Element first = elements.get(0);
|
||||
if (first.getName().equals("dim") && elements.size() == 1) {
|
||||
ingest(context,dso,first);
|
||||
public void ingest(Context context, DSpaceObject dso, List<Element> metadata) throws CrosswalkException, IOException, SQLException, AuthorizeException {
|
||||
Element first = metadata.get(0);
|
||||
if (first.getName().equals("dim") && metadata.size() == 1) {
|
||||
ingest(context,dso,first);
|
||||
}
|
||||
else if (first.getName().equals("field") && first.getParentElement() != null) {
|
||||
ingest(context,dso,first.getParentElement());
|
||||
ingest(context,dso,first.getParentElement());
|
||||
}
|
||||
else {
|
||||
Element wrapper = new Element("wrap",elements.get(0).getNamespace());
|
||||
wrapper.addContent(elements);
|
||||
ingest(context,dso,wrapper);
|
||||
Element wrapper = new Element("wrap", metadata.get(0).getNamespace());
|
||||
wrapper.addContent(metadata);
|
||||
ingest(context,dso,wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
public void ingest(Context context, DSpaceObject dso, Element root) throws CrosswalkException, IOException, SQLException, AuthorizeException {
|
||||
|
||||
if (dso.getType() != Constants.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 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;
|
||||
|
||||
/**
|
||||
|
@@ -405,7 +405,6 @@ public class METSRightsCrosswalk
|
||||
*
|
||||
* @param context
|
||||
* @param dso
|
||||
* @param metadata
|
||||
* @throws CrosswalkException
|
||||
* @throws IOException
|
||||
* @throws SQLException
|
||||
@@ -413,7 +412,7 @@ public class METSRightsCrosswalk
|
||||
* @see RoleCrosswalk
|
||||
*/
|
||||
@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
|
||||
{
|
||||
// we cannot crosswalk METSRights to a SITE object
|
||||
@@ -430,11 +429,8 @@ public class METSRightsCrosswalk
|
||||
}
|
||||
|
||||
// Loop through each Element in the List
|
||||
Iterator mi = ml.iterator();
|
||||
while (mi.hasNext())
|
||||
for (Element element : ml)
|
||||
{
|
||||
Element element = (Element)mi.next();
|
||||
|
||||
// if we're fed a <RightsDeclarationMD> wrapper object, recurse on its guts:
|
||||
if (element.getName().equals("RightsDeclarationMD"))
|
||||
{
|
||||
|
@@ -84,7 +84,7 @@ public class NullIngestionCrosswalk
|
||||
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
|
||||
{
|
||||
// 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 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 {
|
||||
List<Element> elements = metadata;
|
||||
Element wrapper = new Element("wrap",elements.get(0).getNamespace());
|
||||
wrapper.addContent(elements);
|
||||
public void ingest(Context context, DSpaceObject dso, List<Element> metadata) throws CrosswalkException, IOException, SQLException, AuthorizeException {
|
||||
Element wrapper = new Element("wrap", metadata.get(0).getNamespace());
|
||||
wrapper.addContent(metadata);
|
||||
|
||||
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
|
||||
List<Element> elements = metadata;
|
||||
if (elements.size() == 1) {
|
||||
ingest(context, dso, elements.get(0));
|
||||
if (metadata.size() == 1) {
|
||||
ingest(context, dso, metadata.get(0));
|
||||
}
|
||||
// Otherwise, wrap them up
|
||||
else {
|
||||
Element wrapper = new Element("wrap",elements.get(0).getNamespace());
|
||||
wrapper.addContent(elements);
|
||||
Element wrapper = new Element("wrap", metadata.get(0).getNamespace());
|
||||
wrapper.addContent(metadata);
|
||||
|
||||
ingest(context,dso,wrapper);
|
||||
}
|
||||
|
@@ -102,7 +102,7 @@ public class PREMISCrosswalk
|
||||
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
|
||||
{
|
||||
// we only understand how to crosswalk PREMIS to a Bitstream.
|
||||
@@ -114,11 +114,8 @@ public class PREMISCrosswalk
|
||||
Bitstream bitstream = (Bitstream)dso;
|
||||
String MIMEType = null;
|
||||
String bsName = null;
|
||||
Iterator mi = ml.iterator();
|
||||
while (mi.hasNext())
|
||||
for (Element me : ml)
|
||||
{
|
||||
Element me = (Element)mi.next();
|
||||
|
||||
if (me.getName().equals("premis"))
|
||||
{
|
||||
// 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());
|
||||
}
|
||||
|
||||
public void ingest(Context context, DSpaceObject dso, List ml)
|
||||
public void ingest(Context context, DSpaceObject dso, List<Element> ml)
|
||||
throws CrosswalkException, IOException, SQLException, AuthorizeException
|
||||
{
|
||||
init();
|
||||
@@ -476,10 +476,8 @@ public class QDCCrosswalk extends SelfNamedPlugin
|
||||
|
||||
Item item = (Item)dso;
|
||||
|
||||
Iterator mi = ml.iterator();
|
||||
while (mi.hasNext())
|
||||
for (Element me : ml)
|
||||
{
|
||||
Element me = (Element)mi.next();
|
||||
String key = makeQualifiedTagName(me);
|
||||
|
||||
// if the root element gets passed here, recurse:
|
||||
|
@@ -285,7 +285,7 @@ public class RoleCrosswalk
|
||||
* @throws AuthorizeException
|
||||
*/
|
||||
@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
|
||||
{
|
||||
if(!metadata.isEmpty())
|
||||
|
@@ -91,13 +91,11 @@ public class XSLTIngestionCrosswalk
|
||||
}
|
||||
|
||||
// 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
|
||||
{
|
||||
Iterator di = dimList.iterator();
|
||||
while (di.hasNext())
|
||||
for (Element elt : dimList)
|
||||
{
|
||||
Element elt = (Element)di.next();
|
||||
if ("field".equals(elt.getName()) && DIM_NS.equals(elt.getNamespace()))
|
||||
{
|
||||
applyDimField(elt, item);
|
||||
@@ -151,7 +149,7 @@ public class XSLTIngestionCrosswalk
|
||||
* these correspond directly to Item.addMetadata() calls so
|
||||
* 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,
|
||||
IOException, SQLException, AuthorizeException
|
||||
{
|
||||
@@ -233,7 +231,7 @@ public class XSLTIngestionCrosswalk
|
||||
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,
|
||||
IOException, SQLException, AuthorizeException
|
||||
{
|
||||
@@ -246,10 +244,8 @@ public class XSLTIngestionCrosswalk
|
||||
else if (type == Constants.COLLECTION ||
|
||||
type == Constants.COMMUNITY)
|
||||
{
|
||||
Iterator di = fields.iterator();
|
||||
while (di.hasNext())
|
||||
for (Element field : fields)
|
||||
{
|
||||
Element field = (Element)di.next();
|
||||
String schema = field.getAttributeValue("mdschema");
|
||||
if ("dim".equals(field.getName()) && DIM_NS.equals(field.getNamespace()))
|
||||
{
|
||||
|
Reference in New Issue
Block a user