[DS-707] Cleanup Map / List interface use

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5505 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Graham Triggs
2010-10-20 22:57:14 +00:00
parent 5f57216279
commit 59056cb8c2
18 changed files with 80 additions and 70 deletions

View File

@@ -43,6 +43,7 @@ import org.dspace.content.DCValue;
import org.dspace.content.Collection;
import java.util.ArrayList;
import java.util.List;
/**
* Utility class to store changes to item that may occur during a batch edit.
@@ -54,23 +55,23 @@ public class BulkEditChange
/** The item these changes relate to */
private Item item;
/** The ArrayList of hashtables with the new elements */
private ArrayList<DCValue> adds;
/** The List of hashtables with the new elements */
private List<DCValue> adds;
/** The ArrayList of hashtables with the removed elements */
private ArrayList<DCValue> removes;
/** The List of hashtables with the removed elements */
private List<DCValue> removes;
/** The ArrayList of hashtables with the unchanged elements */
private ArrayList<DCValue> constant;
/** The List of hashtables with the unchanged elements */
private List<DCValue> constant;
/** The ArrayList of the complete set of new values (constant + adds) */
private ArrayList<DCValue> complete;
/** The List of the complete set of new values (constant + adds) */
private List<DCValue> complete;
/** The Arraylist of old collections the item used to be mapped to */
private ArrayList<Collection> oldMappedCollections;
/** The list of old collections the item used to be mapped to */
private List<Collection> oldMappedCollections;
/** The Arraylist of new collections the item has been mapped into */
private ArrayList<Collection> newMappedCollections;
/** The list of new collections the item has been mapped into */
private List<Collection> newMappedCollections;
/** The old owning collection */
private Collection oldOwningCollection;
@@ -262,7 +263,7 @@ public class BulkEditChange
*
* @return the list of elements and their values that have been added.
*/
public ArrayList<DCValue> getAdds()
public List<DCValue> getAdds()
{
// Return the array
return adds;
@@ -273,7 +274,7 @@ public class BulkEditChange
*
* @return the list of elements and their values that have been removed.
*/
public ArrayList<DCValue> getRemoves()
public List<DCValue> getRemoves()
{
// Return the array
return removes;
@@ -284,7 +285,7 @@ public class BulkEditChange
*
* @return the list of unchanged values
*/
public ArrayList<DCValue> getConstant()
public List<DCValue> getConstant()
{
// Return the array
return constant;
@@ -295,7 +296,7 @@ public class BulkEditChange
*
* @return the list of all values
*/
public ArrayList<DCValue> getComplete()
public List<DCValue> getComplete()
{
// Return the array
return complete;
@@ -306,7 +307,7 @@ public class BulkEditChange
*
* @return the list of new mapped collections
*/
public ArrayList<Collection> getNewMappedCollections()
public List<Collection> getNewMappedCollections()
{
// Return the array
return newMappedCollections;
@@ -317,7 +318,7 @@ public class BulkEditChange
*
* @return the list of old mapped collections
*/
public ArrayList<Collection> getOldMappedCollections()
public List<Collection> getOldMappedCollections()
{
// Return the array
return oldMappedCollections;

View File

@@ -56,10 +56,10 @@ import java.io.*;
public class DSpaceCSV
{
/** The headings of the CSV file */
private ArrayList<String> headings;
private List<String> headings;
/** An array list of CSV lines */
private ArrayList<DSpaceCSVLine> lines;
private List<DSpaceCSVLine> lines;
/** A counter of how many CSV lines this object holds */
private int counter;
@@ -485,7 +485,7 @@ public class DSpaceCSV
*
* @return The lines
*/
public ArrayList<DSpaceCSVLine> getCSVLines()
public List<DSpaceCSVLine> getCSVLines()
{
// Return the lines
return lines;

View File

@@ -42,6 +42,7 @@ import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
/**
* Utility class to store a line from a CSV file
@@ -116,7 +117,7 @@ public class DSpaceCSVLine
* @param key The metadata key
* @return All the elements that match
*/
public ArrayList<String> get(String key)
public List<String> get(String key)
{
// Return any relevant values
return items.get(key);
@@ -139,7 +140,7 @@ public class DSpaceCSVLine
* @param headings The headings which define the order the elements must be presented in
* @return The CSV formatted String
*/
protected String toCSV(ArrayList<String> headings)
protected String toCSV(List<String> headings)
{
StringBuilder bits = new StringBuilder();
@@ -172,7 +173,7 @@ public class DSpaceCSVLine
* @param values The values to create the string from
* @return The line as a CSV formatted String
*/
private String valueToCSV(ArrayList<String> values)
private String valueToCSV(List<String> values)
{
// Check there is some content
if (values == null)

View File

@@ -47,6 +47,7 @@ import org.dspace.handle.HandleManager;
import java.util.ArrayList;
import java.sql.SQLException;
import java.util.List;
/**
* Metadata exporter to allow the batch export of metadata into a file
@@ -116,7 +117,7 @@ public class MetadataExport
* @return The list of item ids
* @throws SQLException
*/
private ArrayList buildFromCommunity(Community community, ArrayList itemIDs, int indent)
private List buildFromCommunity(Community community, List itemIDs, int indent)
throws SQLException
{
// Add all the collections

View File

@@ -55,6 +55,7 @@ import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
/**
* Metadata importer to allow the batch import of metadata from a file
@@ -67,7 +68,7 @@ public class MetadataImport
Context c;
/** The lines to import */
ArrayList<DSpaceCSVLine> toImport;
List<DSpaceCSVLine> toImport;
/** log4j logger */
private static Logger log = Logger.getLogger(MetadataImport.class);
@@ -79,7 +80,7 @@ public class MetadataImport
* @param c The context
* @param toImport An array of CSV lines to examine
*/
public MetadataImport(Context c, ArrayList<DSpaceCSVLine> toImport)
public MetadataImport(Context c, List<DSpaceCSVLine> toImport)
{
// Store the import settings
this.c = c;
@@ -98,7 +99,7 @@ public class MetadataImport
*
* @throws MetadataImportException if something goes wrong
*/
public ArrayList<BulkEditChange> runImport(boolean change,
public List<BulkEditChange> runImport(boolean change,
boolean useWorkflow,
boolean workflowNotify,
boolean useTemplate) throws MetadataImportException
@@ -127,7 +128,7 @@ public class MetadataImport
BulkEditChange whatHasChanged = new BulkEditChange(item);
// Has it moved collection?
ArrayList<String> collections = line.get("collection");
List<String> collections = line.get("collection");
if (collections != null)
{
// Sanity check we're not orphaning it
@@ -189,7 +190,7 @@ public class MetadataImport
}
// Check it has an owning collection
ArrayList<String> collections = line.get("collection");
List<String> collections = line.get("collection");
if (collections == null)
{
throw new MetadataImportException("New items must have a 'collection' assigned in the form of a handle");
@@ -412,8 +413,8 @@ public class MetadataImport
((changes.getAdds().size() > 0) || (changes.getRemoves().size() > 0)))
{
// Get the complete list of what values should now be in that element
ArrayList<DCValue> list = changes.getComplete();
ArrayList<String> values = new ArrayList<String>();
List<DCValue> list = changes.getComplete();
List<String> values = new ArrayList<String>();
for (DCValue value : list)
{
if ((qualifier == null) && (language == null))
@@ -482,7 +483,7 @@ public class MetadataImport
* @throws MetadataImportException If something goes wrong to be reported back to the user
*/
private void compare(Item item,
ArrayList<String> collections,
List<String> collections,
Collection[] actualCollections,
BulkEditChange bechange,
boolean change) throws SQLException, AuthorizeException, IOException, MetadataImportException
@@ -748,17 +749,17 @@ public class MetadataImport
* @param changed Whether or not the changes have been made
* @return The number of items that have changed
*/
private static int displayChanges(ArrayList<BulkEditChange> changes, boolean changed)
private static int displayChanges(List<BulkEditChange> changes, boolean changed)
{
// Display the changes
int changeCounter = 0;
for (BulkEditChange change : changes)
{
// Get the changes
ArrayList<DCValue> adds = change.getAdds();
ArrayList<DCValue> removes = change.getRemoves();
ArrayList<Collection> newCollections = change.getNewMappedCollections();
ArrayList<Collection> oldCollections = change.getOldMappedCollections();
List<DCValue> adds = change.getAdds();
List<DCValue> removes = change.getRemoves();
List<Collection> newCollections = change.getNewMappedCollections();
List<Collection> oldCollections = change.getOldMappedCollections();
if ((adds.size() > 0) || (removes.size() > 0) ||
(newCollections.size() > 0) || (oldCollections.size() > 0) ||
(change.getNewOwningCollection() != null) || (change.getOldOwningCollection() != null))
@@ -1037,7 +1038,7 @@ public class MetadataImport
// Perform the first import - just higlight differences
MetadataImport importer = new MetadataImport(c, csv.getCSVLines());
ArrayList<BulkEditChange> changes;
List<BulkEditChange> changes;
if (!line.hasOption('s'))
{

View File

@@ -99,24 +99,24 @@ public class DCInputsReader
* Reference to the collections to forms map, computed from the forms
* definition file
*/
private HashMap whichForms = null;
private Map whichForms = null;
/**
* Reference to the forms definitions map, computed from the forms
* definition file
*/
private HashMap formDefns = null;
private Map formDefns = null;
/**
* Reference to the forms which allow, disallow or mandate files to be
* uploaded.
*/
private HashMap formFileUploadDefns = null;
private Map formFileUploadDefns = null;
/**
* Reference to the value-pairs map, computed from the forms definition file
*/
private HashMap valuePairs = null; // Holds display/storage pairs
private Map valuePairs = null; // Holds display/storage pairs
/**
* Mini-cache of last DCInputSet requested. If submissions are not typically
@@ -481,7 +481,7 @@ public class DCInputsReader
* Check that this is the only field with the name dc-element.dc-qualifier
* If there is a duplicate, return an error message, else return null;
*/
private String checkForDups(String formName, HashMap field, List pages)
private String checkForDups(String formName, Map field, List pages)
{
int matches = 0;
String err = null;

View File

@@ -97,7 +97,7 @@ public class SubmissionConfigReader
* which collection, computed from the item submission config file
* (specifically, the 'submission-map' tag)
*/
private HashMap collectionToSubmissionConfig = null;
private Map collectionToSubmissionConfig = null;
/**
* Reference to the global submission step definitions defined in the
@@ -396,7 +396,7 @@ public class SubmissionConfigReader
"There are two step elements with the id '" + stepID + "' in 'item-submission.xml'");
}
HashMap stepInfo = processStepChildNodes("step-definition", nd);
Map stepInfo = processStepChildNodes("step-definition", nd);
stepDefns.put(stepID, stepInfo);
} // ignore any child that is not a 'step'
@@ -489,7 +489,7 @@ public class SubmissionConfigReader
// check for an 'id' attribute
String stepID = getAttribute(nStep, "id");
HashMap stepInfo;
Map stepInfo;
// if this step has an id, load its information from the
// step-definition section
@@ -567,7 +567,7 @@ public class SubmissionConfigReader
* and the value is the field value.
*
*/
private HashMap processStepChildNodes(String configSection, Node nStep)
private Map processStepChildNodes(String configSection, Node nStep)
throws SAXException, ServletException
{
// initialize the HashMap of step Info

View File

@@ -86,7 +86,7 @@ public class SubmissionInfo
* second page of Step 5) Values are the Headings to display for each step
* (e.g. "Describe")
**************************************************************************/
private HashMap progressBar = null;
private Map progressBar = null;
/** The element or element_qualifier to show more input boxes for */
private String moreBoxesFor;
@@ -583,7 +583,7 @@ public class SubmissionInfo
*
*/
private static void saveProgressBarToCache(HttpSession session,
HashMap progressBarInfo)
Map progressBarInfo)
{
// cache progress bar info to Session
session.setAttribute("submission.progressbar", progressBarInfo);
@@ -601,9 +601,9 @@ public class SubmissionInfo
* @return progressBarInfo HashMap (if found), or null (if not)
*
*/
private static HashMap loadProgressBarFromCache(HttpSession session)
private static Map loadProgressBarFromCache(HttpSession session)
{
return (HashMap) session.getAttribute("submission.progressbar");
return (Map) session.getAttribute("submission.progressbar");
}
/**

View File

@@ -132,8 +132,8 @@ public class BrowseDAOOracle implements BrowseDAO
// administrative attributes for this class
/** a cache of the actual query to be executed */
private String querySql = "";
private ArrayList queryParams = new ArrayList();
private String querySql = "";
private List queryParams = new ArrayList();
private String whereClauseOperator = "";

View File

@@ -132,8 +132,8 @@ public class BrowseDAOPostgres implements BrowseDAO
// administrative attributes for this class
/** a cache of the actual query to be executed */
private String querySql = "";
private ArrayList queryParams = new ArrayList();
private String querySql = "";
private List queryParams = new ArrayList();
/** whether the query (above) needs to be regenerated */
private boolean rebuildQuery = true;

View File

@@ -38,6 +38,7 @@
package org.dspace.browse;
import java.util.HashMap;
import java.util.Map;
import org.dspace.core.ConfigurationManager;
@@ -52,7 +53,7 @@ import org.dspace.core.ConfigurationManager;
public class CrossLinks
{
/** a map of the desired links */
private HashMap links = new HashMap();
private Map links = new HashMap();
/**
* Construct a new object which will obtain the configuration for itself

View File

@@ -41,6 +41,7 @@ import java.sql.SQLException;
import java.util.Iterator;
import java.util.ArrayList;
import java.util.List;
import org.dspace.core.Context;
import org.dspace.storage.rdbms.TableRow;
@@ -97,7 +98,7 @@ public class ItemIterator
* @param iids
* the array list to be iterated over
*/
public ItemIterator(Context context, ArrayList iids)
public ItemIterator(Context context, List iids)
{
ourContext = context;
iditr = iids.iterator();

View File

@@ -45,6 +45,7 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Logger;
import org.dspace.authorize.AuthorizeException;
@@ -80,7 +81,7 @@ public class MetadataField
private TableRow row;
// cache of field by ID (Integer)
private static HashMap id2field = null;
private static Map id2field = null;
/**

View File

@@ -45,6 +45,7 @@ import java.sql.SQLException;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.dspace.authorize.AuthorizeException;
@@ -87,10 +88,10 @@ public class MetadataSchema
private String name;
// cache of schema by ID (Integer)
private static HashMap id2schema = null;
private static Map id2schema = null;
// cache of schema by short name
private static HashMap name2schema = null;
private static Map name2schema = null;
/**

View File

@@ -48,6 +48,7 @@ import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.apache.log4j.Logger;
@@ -159,7 +160,7 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
private static XMLOutputter outputUgly = new XMLOutputter();
private static SAXBuilder builder = new SAXBuilder();
private HashMap modsMap = null;
private Map modsMap = null;
/**
* Container for crosswalk mapping: expressed as "triple" of:

View File

@@ -48,6 +48,7 @@ import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.apache.log4j.Logger;
@@ -128,10 +129,10 @@ public class QDCCrosswalk extends SelfNamedPlugin
private static Logger log = Logger.getLogger(QDCCrosswalk.class);
// map of qdc to JDOM Element
private HashMap qdc2element = new HashMap();
private Map qdc2element = new HashMap();
// map of JDOM Element to qdc DCValue
private HashMap element2qdc = new HashMap();
private Map element2qdc = new HashMap();
// the XML namespaces from config file for this name.
private Namespace namespaces[] = null;

View File

@@ -112,7 +112,7 @@ public class PluginManager
// Map of plugin class to "reusable" metric (as Boolean, must be Object)
// Key is Class, value is Boolean (true by default).
private static HashMap cacheMeCache = new HashMap();
private static Map cacheMeCache = new HashMap();
// Predicate -- whether or not to cache this class. Ironically,
// the cacheability information is itself cached.
@@ -161,7 +161,7 @@ public class PluginManager
// cache of config data for Sequence Plugins; format its
// <interface-name> -> [ <classname>.. ] (value is Array)
private static HashMap sequenceConfig = new HashMap();
private static Map sequenceConfig = new HashMap();
/**
* Returns instances of all plugins that implement the interface
@@ -206,7 +206,7 @@ public class PluginManager
}
// Map of cached (reusable) single plugin instances - class -> instance.
private static HashMap anonymousInstanceCache = new HashMap();
private static Map anonymousInstanceCache = new HashMap();
// Get possibly-cached plugin instance for un-named plugin,
// this is shared by Single and Sequence plugins.
@@ -246,10 +246,10 @@ public class PluginManager
// Map of named plugin classes, [intfc,name] -> class
// Also contains intfc -> "marker" to mark when interface has been loaded.
private static HashMap namedPluginClasses = new HashMap();
private static Map namedPluginClasses = new HashMap();
// Map of cached (reusable) named plugin instances, [class,name] -> instance
private static HashMap namedInstanceCache = new HashMap();
private static Map namedInstanceCache = new HashMap();
// load and cache configuration data for the given interface.
private static void configureNamedPlugin(String iname)

View File

@@ -75,7 +75,7 @@ public class EventManager
// Keyed FIFO Pool of event dispatchers
private static KeyedObjectPool dispatcherPool = null;
private static HashMap<String, Integer> consumerIndicies = null;
private static Map<String, Integer> consumerIndicies = null;
private static final String CONSUMER_PFX = "event.consumer.";