mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-13 21:13:19 +00:00
[DS-707] Generify Map usage
git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5615 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -40,7 +40,8 @@ import java.io.FileWriter;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.Hashtable;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
@@ -96,10 +97,10 @@ public class StructBuilder
|
|||||||
private static org.jdom.Document xmlOutput = new org.jdom.Document(new Element("imported_structure"));
|
private static org.jdom.Document xmlOutput = new org.jdom.Document(new Element("imported_structure"));
|
||||||
|
|
||||||
/** a hashtable to hold metadata for the collection being worked on */
|
/** a hashtable to hold metadata for the collection being worked on */
|
||||||
private static Hashtable collectionMap = new Hashtable();
|
private static Map<String, String> collectionMap = new HashMap<String, String>();
|
||||||
|
|
||||||
/** a hashtable to hold metadata for the community being worked on */
|
/** a hashtable to hold metadata for the community being worked on */
|
||||||
private static Hashtable communityMap = new Hashtable();
|
private static Map<String, String> communityMap = new HashMap<String, String>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main method to be run from the command line to import a structure into
|
* Main method to be run from the command line to import a structure into
|
||||||
@@ -429,16 +430,12 @@ public class StructBuilder
|
|||||||
|
|
||||||
// now update the metadata
|
// now update the metadata
|
||||||
Node tn = communities.item(i);
|
Node tn = communities.item(i);
|
||||||
Enumeration keys = communityMap.keys();
|
for (Map.Entry<String, String> entry : communityMap.entrySet())
|
||||||
while (keys.hasMoreElements())
|
|
||||||
{
|
{
|
||||||
Node node = null;
|
NodeList nl = XPathAPI.selectNodeList(tn, entry.getKey());
|
||||||
String key = (String) keys.nextElement();
|
|
||||||
NodeList nl = XPathAPI.selectNodeList(tn, key);
|
|
||||||
if (nl.getLength() == 1)
|
if (nl.getLength() == 1)
|
||||||
{
|
{
|
||||||
node = nl.item(0);
|
community.setMetadata(entry.getValue(), getStringValue(nl.item(0)));
|
||||||
community.setMetadata((String) communityMap.get(key), getStringValue(node));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -544,16 +541,12 @@ public class StructBuilder
|
|||||||
|
|
||||||
// import the rest of the metadata
|
// import the rest of the metadata
|
||||||
Node tn = collections.item(i);
|
Node tn = collections.item(i);
|
||||||
Enumeration keys = collectionMap.keys();
|
for (Map.Entry<String, String> entry : collectionMap.entrySet())
|
||||||
while (keys.hasMoreElements())
|
|
||||||
{
|
{
|
||||||
Node node = null;
|
NodeList nl = XPathAPI.selectNodeList(tn, entry.getKey());
|
||||||
String key = (String) keys.nextElement();
|
|
||||||
NodeList nl = XPathAPI.selectNodeList(tn, key);
|
|
||||||
if (nl.getLength() == 1)
|
if (nl.getLength() == 1)
|
||||||
{
|
{
|
||||||
node = nl.item(0);
|
collection.setMetadata(entry.getValue(), getStringValue(nl.item(0)));
|
||||||
collection.setMetadata((String) collectionMap.get(key), getStringValue(node));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -691,14 +691,14 @@ public class ItemImport
|
|||||||
System.out.println("Deleting items listed in mapfile: " + mapFile);
|
System.out.println("Deleting items listed in mapfile: " + mapFile);
|
||||||
|
|
||||||
// read in the mapfile
|
// read in the mapfile
|
||||||
Map myhash = readMapFile(mapFile);
|
Map<String, String> myhash = readMapFile(mapFile);
|
||||||
|
|
||||||
// now delete everything that appeared in the mapFile
|
// now delete everything that appeared in the mapFile
|
||||||
Iterator i = myhash.keySet().iterator();
|
Iterator i = myhash.keySet().iterator();
|
||||||
|
|
||||||
while (i.hasNext())
|
while (i.hasNext())
|
||||||
{
|
{
|
||||||
String itemID = (String) myhash.get(i.next());
|
String itemID = myhash.get(i.next());
|
||||||
|
|
||||||
if (itemID.indexOf('/') != -1)
|
if (itemID.indexOf('/') != -1)
|
||||||
{
|
{
|
||||||
|
@@ -107,12 +107,6 @@ public class DCInputsReader
|
|||||||
*/
|
*/
|
||||||
private Map<String, List<List<Map<String, String>>>> formDefns = null;
|
private Map<String, List<List<Map<String, String>>>> formDefns = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* Reference to the forms which allow, disallow or mandate files to be
|
|
||||||
* uploaded.
|
|
||||||
*/
|
|
||||||
private Map formFileUploadDefns = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference to the value-pairs map, computed from the forms definition file
|
* Reference to the value-pairs map, computed from the forms definition file
|
||||||
*/
|
*/
|
||||||
|
@@ -100,7 +100,7 @@ public class SubmissionConfig implements Serializable
|
|||||||
// loop through our steps, and create SubmissionStepConfig objects
|
// loop through our steps, and create SubmissionStepConfig objects
|
||||||
for (int stepNum = 0; stepNum < steps.size(); stepNum++)
|
for (int stepNum = 0; stepNum < steps.size(); stepNum++)
|
||||||
{
|
{
|
||||||
Map stepInfo = steps.get(stepNum);
|
Map<String, String> stepInfo = steps.get(stepNum);
|
||||||
SubmissionStepConfig step = new SubmissionStepConfig(stepInfo);
|
SubmissionStepConfig step = new SubmissionStepConfig(stepInfo);
|
||||||
|
|
||||||
// Only add this step to the process if either:
|
// Only add this step to the process if either:
|
||||||
|
@@ -81,7 +81,7 @@ public class StatisticsLoggingConsumer implements Consumer
|
|||||||
updateQuery, null, null);
|
updateQuery, null, null);
|
||||||
|
|
||||||
// Get all the metadata
|
// Get all the metadata
|
||||||
Map metadataStorageInfo = SolrLogger.getMetadataStorageInfo();
|
Map<String, String> metadataStorageInfo = SolrLogger.getMetadataStorageInfo();
|
||||||
List<String> storageFieldList = new ArrayList<String>();
|
List<String> storageFieldList = new ArrayList<String>();
|
||||||
List<List<Object>> storageValuesList = new ArrayList<List<Object>>();
|
List<List<Object>> storageValuesList = new ArrayList<List<Object>>();
|
||||||
|
|
||||||
|
@@ -199,7 +199,7 @@ public class StatisticsDataGenerator {
|
|||||||
solr.deleteByQuery("*:*");
|
solr.deleteByQuery("*:*");
|
||||||
solr.commit();
|
solr.commit();
|
||||||
|
|
||||||
Map metadataStorageInfo = SolrLogger.getMetadataStorageInfo();
|
Map<String, String> metadataStorageInfo = SolrLogger.getMetadataStorageInfo();
|
||||||
|
|
||||||
String prevIp = null;
|
String prevIp = null;
|
||||||
String dbfile = ConfigurationManager.getProperty("solr.dbfile");
|
String dbfile = ConfigurationManager.getProperty("solr.dbfile");
|
||||||
|
@@ -76,7 +76,7 @@ public class StatisticsImporter
|
|||||||
private static LookupService geoipLookup;
|
private static LookupService geoipLookup;
|
||||||
|
|
||||||
/** Metadata storage information */
|
/** Metadata storage information */
|
||||||
private static Map metadataStorageInfo;
|
private static Map<String, String> metadataStorageInfo;
|
||||||
|
|
||||||
/** Whether to skip the DNS reverse lookup or not */
|
/** Whether to skip the DNS reverse lookup or not */
|
||||||
private static boolean skipReverseDNS = false;
|
private static boolean skipReverseDNS = false;
|
||||||
@@ -362,9 +362,8 @@ public class StatisticsImporter
|
|||||||
if (dso instanceof Item) {
|
if (dso instanceof Item) {
|
||||||
Item item = (Item) dso;
|
Item item = (Item) dso;
|
||||||
// Store the metadata
|
// Store the metadata
|
||||||
for (Object storedField : metadataStorageInfo.keySet()) {
|
for (String storedField : metadataStorageInfo.keySet()) {
|
||||||
String dcField = (String) metadataStorageInfo
|
String dcField = metadataStorageInfo.get(storedField);
|
||||||
.get(storedField);
|
|
||||||
|
|
||||||
DCValue[] vals = item.getMetadata(dcField.split("\\.")[0],
|
DCValue[] vals = item.getMetadata(dcField.split("\\.")[0],
|
||||||
dcField.split("\\.")[1], dcField.split("\\.")[2],
|
dcField.split("\\.")[1], dcField.split("\\.")[2],
|
||||||
|
Reference in New Issue
Block a user