[DS-707] Use valueOf instead of Number constructor

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5500 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Graham Triggs
2010-10-20 22:01:15 +00:00
parent c17cbc0029
commit a1d59de77b
16 changed files with 45 additions and 47 deletions

View File

@@ -294,7 +294,7 @@ public class MetadataExporter
if (mdSchema != null) if (mdSchema != null)
{ {
name = mdSchema.getName(); name = mdSchema.getName();
schemaMap.put(new Integer(mdSchema.getSchemaID()), name); schemaMap.put(Integer.valueOf(mdSchema.getSchemaID()), name);
} }
else else
{ {

View File

@@ -226,11 +226,10 @@ public class IPAuthentication implements AuthenticationMethod
if (group != null) if (group != null)
{ {
// Add ID so we won't have to do lookup again // Add ID so we won't have to do lookup again
ipMatcherGroupIDs.put(ipm, new Integer(group ipMatcherGroupIDs.put(ipm, Integer.valueOf(group.getID()));
.getID()));
ipMatcherGroupNames.remove(ipm); ipMatcherGroupNames.remove(ipm);
groupIDs.add(new Integer(group.getID())); groupIDs.add(Integer.valueOf(group.getID()));
} }
else else
{ {
@@ -273,11 +272,10 @@ public class IPAuthentication implements AuthenticationMethod
if (group != null) if (group != null)
{ {
// Add ID so we won't have to do lookup again // Add ID so we won't have to do lookup again
ipMatcherGroupIDs.put(ipm, new Integer(group ipMatcherGroupIDs.put(ipm, Integer.valueOf(group.getID()));
.getID()));
ipMatcherGroupNames.remove(ipm); ipMatcherGroupNames.remove(ipm);
groupIDs.remove(new Integer(group.getID())); groupIDs.remove(Integer.valueOf(group.getID()));
} }
else else
{ {

View File

@@ -316,11 +316,11 @@ public class ShibAuthentication implements AuthenticationMethod
log.warn(LogManager.getHeader(context, dspaceGroup log.warn(LogManager.getHeader(context, dspaceGroup
+ " group is not found!! Admin needs to create one!", + " group is not found!! Admin needs to create one!",
"requiredGroup=" + dspaceGroup)); "requiredGroup=" + dspaceGroup));
groups.add(new Integer(0)); groups.add(Integer.valueOf(0));
} }
else else
{ {
groups.add(new Integer(g.getID())); groups.add(Integer.valueOf(g.getID()));
} }
log.info("Mapping group: " + dspaceGroup + " to groupID: " log.info("Mapping group: " + dspaceGroup + " to groupID: "
+ (g == null ? 0 : g.getID())); + (g == null ? 0 : g.getID()));

View File

@@ -520,7 +520,7 @@ public class X509Authentication implements AuthenticationMethod
Group group = Group.findByName(context, groupName); Group group = Group.findByName(context, groupName);
if (group != null) if (group != null)
{ {
groupIDs.add(new Integer(group.getID())); groupIDs.add(Integer.valueOf(group.getID()));
} }
else else
{ {

View File

@@ -522,7 +522,7 @@ public final class BitstreamInfoDAO extends DAOSupport
while (rs.next()) while (rs.next())
{ {
ids.add(new Integer(rs.getInt(1))); ids.add(Integer.valueOf(rs.getInt(1)));
} }
} }
@@ -565,7 +565,7 @@ public final class BitstreamInfoDAO extends DAOSupport
while (rs.next()) while (rs.next())
{ {
ids.add(new Integer(rs.getInt(1))); ids.add(Integer.valueOf(rs.getInt(1)));
} }
} }
@@ -608,7 +608,7 @@ public final class BitstreamInfoDAO extends DAOSupport
while (rs.next()) while (rs.next())
{ {
ids.add(new Integer(rs.getInt(1))); ids.add(Integer.valueOf(rs.getInt(1)));
} }
} }

View File

@@ -133,7 +133,7 @@ public class HandleDispatcher implements BitstreamDispatcher
switch (dsoType) switch (dsoType)
{ {
case Constants.BITSTREAM: case Constants.BITSTREAM:
ids.add(new Integer(id)); ids.add(Integer.valueOf(id));
break; break;
case Constants.ITEM: case Constants.ITEM:

View File

@@ -214,7 +214,7 @@ public final class ResultsPruner
*/ */
public void addInterested(String result, long duration) public void addInterested(String result, long duration)
{ {
interests.put(result, new Long(duration)); interests.put(result, Long.valueOf(duration));
} }
/** /**
@@ -261,7 +261,7 @@ public final class ResultsPruner
String code = (String) iter.next(); String code = (String) iter.next();
if (!interests.containsKey(code)) if (!interests.containsKey(code))
{ {
interests.put(code, new Long(defaultDuration)); interests.put(code, Long.valueOf(defaultDuration));
} }
} }

View File

@@ -226,7 +226,7 @@ public class ItemComparator implements Comparator
if (value != null) if (value != null)
{ {
values.put(value, new Integer(i)); values.put(value, Integer.valueOf(i));
} }
} }

View File

@@ -626,7 +626,7 @@ public class MetadataField
} }
// 'sanity check' first. // 'sanity check' first.
Integer iid = new Integer(id); Integer iid = Integer.valueOf(id);
if (!id2field.containsKey(iid)) if (!id2field.containsKey(iid))
return null; return null;
@@ -662,7 +662,7 @@ public class MetadataField
{ {
TableRow row = tri.next(); TableRow row = tri.next();
int fieldID = row.getIntColumn("metadata_field_id"); int fieldID = row.getIntColumn("metadata_field_id");
new_id2field.put(new Integer(fieldID), new MetadataField(row)); new_id2field.put(Integer.valueOf(fieldID), new MetadataField(row));
} }
} }
finally finally

View File

@@ -541,7 +541,7 @@ public class MetadataSchema
initCache(context); initCache(context);
} }
Integer iid = new Integer(id); Integer iid = Integer.valueOf(id);
// sanity check // sanity check
if (!id2schema.containsKey(iid)) if (!id2schema.containsKey(iid))
@@ -609,7 +609,7 @@ public class MetadataSchema
TableRow row = tri.next(); TableRow row = tri.next();
MetadataSchema s = new MetadataSchema(row); MetadataSchema s = new MetadataSchema(row);
new_id2schema.put(new Integer(s.schemaID), s); new_id2schema.put(Integer.valueOf(s.schemaID), s);
new_name2schema.put(s.name, s); new_name2schema.put(s.name, s);
} }
} }

View File

@@ -139,7 +139,7 @@ public class MetadataAuthorityManager
// get minConfidence level for this field if any // get minConfidence level for this field if any
int mci = readConfidence("authority.minconfidence."+field); int mci = readConfidence("authority.minconfidence."+field);
if (mci >= Choices.CF_UNSET) if (mci >= Choices.CF_UNSET)
minConfidence.put(fkey, new Integer(mci)); minConfidence.put(fkey, Integer.valueOf(mci));
log.debug("Authority Control: For schema="+schema+", elt="+element+", qual="+qualifier+", controlled="+ctl+", required="+req); log.debug("Authority Control: For schema="+schema+", elt="+element+", qual="+qualifier+", controlled="+ctl+", required="+req);
} }
} }

View File

@@ -354,7 +354,7 @@ public class EPerson extends DSpaceObject
int_param = Integer.valueOf(query); int_param = Integer.valueOf(query);
} }
catch (NumberFormatException e) { catch (NumberFormatException e) {
int_param = new Integer(-1); int_param = Integer.valueOf(-1);
} }
// Create the parameter array, including limit and offset if part of the query // Create the parameter array, including limit and offset if part of the query
@@ -424,7 +424,7 @@ public class EPerson extends DSpaceObject
int_param = Integer.valueOf(query); int_param = Integer.valueOf(query);
} }
catch (NumberFormatException e) { catch (NumberFormatException e) {
int_param = new Integer(-1); int_param = Integer.valueOf(-1);
} }
// Get all the epeople that match the query // Get all the epeople that match the query
@@ -436,11 +436,11 @@ public class EPerson extends DSpaceObject
// use getIntColumn for Oracle count data // use getIntColumn for Oracle count data
if ("oracle".equals(ConfigurationManager.getProperty("db.name"))) if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
{ {
count = new Long(row.getIntColumn("epcount")); count = Long.valueOf(row.getIntColumn("epcount"));
} }
else //getLongColumn works for postgres else //getLongColumn works for postgres
{ {
count = new Long(row.getLongColumn("epcount")); count = Long.valueOf(row.getLongColumn("epcount"));
} }
return count.intValue(); return count.intValue();

View File

@@ -462,7 +462,7 @@ public class Group extends DSpaceObject
int childID = row.getIntColumn("eperson_group_id"); int childID = row.getIntColumn("eperson_group_id");
groupIDs.add(new Integer(childID)); groupIDs.add(Integer.valueOf(childID));
} }
} }
finally finally
@@ -482,12 +482,12 @@ public class Group extends DSpaceObject
Group[] specialGroups = c.getSpecialGroups(); Group[] specialGroups = c.getSpecialGroups();
for(Group special : specialGroups) for(Group special : specialGroups)
{ {
groupIDs.add(new Integer(special.getID())); groupIDs.add(Integer.valueOf(special.getID()));
} }
} }
// all the users are members of the anonymous group // all the users are members of the anonymous group
groupIDs.add(new Integer(0)); groupIDs.add(Integer.valueOf(0));
// now we have all owning groups, also grab all parents of owning groups // now we have all owning groups, also grab all parents of owning groups
// yes, I know this could have been done as one big query and a union, // yes, I know this could have been done as one big query and a union,
@@ -505,7 +505,7 @@ public class Group extends DSpaceObject
{ {
int groupID = (i.next()).intValue(); int groupID = (i.next()).intValue();
parameters[idx++] = new Integer(groupID); parameters[idx++] = Integer.valueOf(groupID);
groupQuery.append("child_id= ? "); groupQuery.append("child_id= ? ");
if (i.hasNext()) if (i.hasNext())
@@ -527,7 +527,7 @@ public class Group extends DSpaceObject
int parentID = row.getIntColumn("parent_id"); int parentID = row.getIntColumn("parent_id");
groupIDs.add(new Integer(parentID)); groupIDs.add(Integer.valueOf(parentID));
} }
} }
finally finally
@@ -603,7 +603,7 @@ public class Group extends DSpaceObject
int childID = row.getIntColumn("child_id"); int childID = row.getIntColumn("child_id");
groupIDs.add(new Integer(childID)); groupIDs.add(Integer.valueOf(childID));
} }
} }
finally finally
@@ -622,7 +622,7 @@ public class Group extends DSpaceObject
Iterator<Integer> i = groupIDs.iterator(); Iterator<Integer> i = groupIDs.iterator();
// don't forget to add the current group to this query! // don't forget to add the current group to this query!
parameters[idx++] = new Integer(g.getID()); parameters[idx++] = Integer.valueOf(g.getID());
StringBuilder epersonQuery = new StringBuilder(); StringBuilder epersonQuery = new StringBuilder();
epersonQuery.append("SELECT * FROM epersongroup2eperson WHERE "); epersonQuery.append("SELECT * FROM epersongroup2eperson WHERE ");
@@ -634,7 +634,7 @@ public class Group extends DSpaceObject
while (i.hasNext()) while (i.hasNext())
{ {
int groupID = (i.next()).intValue(); int groupID = (i.next()).intValue();
parameters[idx++] = new Integer(groupID); parameters[idx++] = Integer.valueOf(groupID);
epersonQuery.append("eperson_group_id= ? "); epersonQuery.append("eperson_group_id= ? ");
if (i.hasNext()) if (i.hasNext())
@@ -656,7 +656,7 @@ public class Group extends DSpaceObject
int epersonID = row.getIntColumn("eperson_id"); int epersonID = row.getIntColumn("eperson_id");
epeopleIDs.add(new Integer(epersonID)); epeopleIDs.add(Integer.valueOf(epersonID));
} }
} }
finally finally
@@ -674,7 +674,7 @@ public class Group extends DSpaceObject
{ {
Set<Integer> groupIDs = Group.allMemberGroupIDs(c, e); Set<Integer> groupIDs = Group.allMemberGroupIDs(c, e);
return groupIDs.contains(new Integer(groupID)); return groupIDs.contains(Integer.valueOf(groupID));
} }
/** /**
@@ -891,7 +891,7 @@ public class Group extends DSpaceObject
int_param = Integer.valueOf(query); int_param = Integer.valueOf(query);
} }
catch (NumberFormatException e) { catch (NumberFormatException e) {
int_param = new Integer(-1); int_param = Integer.valueOf(-1);
} }
// Create the parameter array, including limit and offset if part of the query // Create the parameter array, including limit and offset if part of the query
@@ -960,7 +960,7 @@ public class Group extends DSpaceObject
int_param = Integer.valueOf(query); int_param = Integer.valueOf(query);
} }
catch (NumberFormatException e) { catch (NumberFormatException e) {
int_param = new Integer(-1); int_param = Integer.valueOf(-1);
} }
// Get all the epeople that match the query // Get all the epeople that match the query
@@ -970,11 +970,11 @@ public class Group extends DSpaceObject
Long count; Long count;
if ("oracle".equals(ConfigurationManager.getProperty("db.name"))) if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
{ {
count = new Long(row.getIntColumn("gcount")); count = Long.valueOf(row.getIntColumn("gcount"));
} }
else //getLongColumn works for postgres else //getLongColumn works for postgres
{ {
count = new Long(row.getLongColumn("gcount")); count = Long.valueOf(row.getLongColumn("gcount"));
} }
return count.intValue(); return count.intValue();
@@ -1226,8 +1226,8 @@ public class Group extends DSpaceObject
{ {
TableRow row = (TableRow) tri.next(); TableRow row = (TableRow) tri.next();
Integer parentID = new Integer(row.getIntColumn("parent_id")); Integer parentID = Integer.valueOf(row.getIntColumn("parent_id"));
Integer childID = new Integer(row.getIntColumn("child_id")); Integer childID = Integer.valueOf(row.getIntColumn("child_id"));
// if parent doesn't have an entry, create one // if parent doesn't have an entry, create one
if (!parents.containsKey(parentID)) if (!parents.containsKey(parentID))

View File

@@ -512,7 +512,7 @@ public class DatabaseManager
String ctable = canonicalize(table); String ctable = canonicalize(table);
return findByUnique(context, ctable, getPrimaryKeyColumn(ctable), return findByUnique(context, ctable, getPrimaryKeyColumn(ctable),
new Integer(id)); Integer.valueOf(id));
} }
/** /**
@@ -569,7 +569,7 @@ public class DatabaseManager
String ctable = canonicalize(table); String ctable = canonicalize(table);
return deleteByValue(context, ctable, getPrimaryKeyColumn(ctable), return deleteByValue(context, ctable, getPrimaryKeyColumn(ctable),
new Integer(id)); Integer.valueOf(id));
} }
/** /**

View File

@@ -374,7 +374,7 @@ public abstract class AbstractProcessingStep
int pageNumber) int pageNumber)
{ {
// set info to request // set info to request
request.setAttribute("submission.page", new Integer(pageNumber)); request.setAttribute("submission.page", Integer.valueOf(pageNumber));
} }
} }

View File

@@ -212,7 +212,7 @@ public class WorkflowManager
{ {
// make a hash table entry with item ID for no notify // make a hash table entry with item ID for no notify
// notify code checks no notify hash for item id // notify code checks no notify hash for item id
noEMail.put(new Integer(wsi.getItem().getID()), Boolean.TRUE); noEMail.put(Integer.valueOf(wsi.getItem().getID()), Boolean.TRUE);
return start(c, wsi); return start(c, wsi);
} }
@@ -841,7 +841,7 @@ public class WorkflowManager
// check to see if notification is turned off // check to see if notification is turned off
// and only do it once - delete key after notification has // and only do it once - delete key after notification has
// been suppressed for the first time // been suppressed for the first time
Integer myID = new Integer(wi.getItem().getID()); Integer myID = Integer.valueOf(wi.getItem().getID());
if (noEMail.containsKey(myID)) if (noEMail.containsKey(myID))
{ {