[DS-707] Remove useless methods

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5664 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Graham Triggs
2010-10-26 21:31:29 +00:00
parent 2d065ced4f
commit cb80f0cad4
26 changed files with 202 additions and 132 deletions

View File

@@ -156,7 +156,8 @@ public class Brand
bWidth = fm.stringWidth(brandText.getText()) + xOffset * 2 + 1; bWidth = fm.stringWidth(brandText.getText()) + xOffset * 2 + 1;
bHeight = fm.getHeight(); bHeight = fm.getHeight();
bx = by = 0; bx = 0;
by = 0;
if (brandText.getLocation().equals(BrandText.TL)) if (brandText.getLocation().equals(BrandText.TL))
{ {

View File

@@ -200,9 +200,9 @@ public class LDAPAuthentication
if (ldap.ldapAuthenticate(netid, password, context)) if (ldap.ldapAuthenticate(netid, password, context))
{ {
context.setCurrentUser(eperson = EPerson.findByNetid(context, netid.toLowerCase())); eperson = EPerson.findByNetid(context, netid.toLowerCase());
log.info(LogManager context.setCurrentUser(eperson);
.getHeader(context, "authenticate", "type=ldap")); log.info(LogManager.getHeader(context, "authenticate", "type=ldap"));
return SUCCESS; return SUCCESS;
} }
else else

View File

@@ -81,18 +81,14 @@ public class ShibAuthentication implements AuthenticationMethod
String name; String name;
while (names.hasMoreElements()) while (names.hasMoreElements())
{ {
log.debug("header:" + (name = names.nextElement().toString()) + "=" name = names.nextElement().toString();
+ request.getHeader(name)); log.debug("header:" + name + "=" + request.getHeader(name));
} }
boolean isUsingTomcatUser = ConfigurationManager boolean isUsingTomcatUser = ConfigurationManager.getBooleanProperty("authentication.shib.email-use-tomcat-remote-user");
.getBooleanProperty("authentication.shib.email-use-tomcat-remote-user"); String emailHeader = ConfigurationManager.getProperty("authentication.shib.email-header");
String emailHeader = ConfigurationManager String fnameHeader = ConfigurationManager.getProperty("authentication.shib.firstname-header");
.getProperty("authentication.shib.email-header"); String lnameHeader = ConfigurationManager.getProperty("authentication.shib.lastname-header");
String fnameHeader = ConfigurationManager
.getProperty("authentication.shib.firstname-header");
String lnameHeader = ConfigurationManager
.getProperty("authentication.shib.lastname-header");
String email = null; String email = null;
String fname = null; String fname = null;

View File

@@ -120,7 +120,8 @@ public class Bitstream extends DSpaceObject
// Cache ourselves // Cache ourselves
context.cache(this, row.getIntColumn("bitstream_id")); context.cache(this, row.getIntColumn("bitstream_id"));
modified = modifiedMetadata = false; modified = false;
modifiedMetadata = false;
clearDetails(); clearDetails();
} }

View File

@@ -153,7 +153,8 @@ public class Bundle extends DSpaceObject
// Cache ourselves // Cache ourselves
context.cache(this, row.getIntColumn("bundle_id")); context.cache(this, row.getIntColumn("bundle_id"));
modified = modifiedMetadata = false; modified = false;
modifiedMetadata = false;
} }
/** /**

View File

@@ -174,7 +174,8 @@ public class Collection extends DSpaceObject
// Cache ourselves // Cache ourselves
context.cache(this, row.getIntColumn("collection_id")); context.cache(this, row.getIntColumn("collection_id"));
modified = modifiedMetadata = false; modified = false;
modifiedMetadata = false;
clearDetails(); clearDetails();
} }

View File

@@ -130,7 +130,8 @@ public class Community extends DSpaceObject
// Cache ourselves // Cache ourselves
context.cache(this, row.getIntColumn("community_id")); context.cache(this, row.getIntColumn("community_id"));
modified = modifiedMetadata = false; modified = false;
modifiedMetadata = false;
admins = groupFromColumn("admin"); admins = groupFromColumn("admin");

View File

@@ -262,7 +262,8 @@ public abstract class SHERPARoMEOProtocol implements ChoiceAuthority
else if (localName.equals(labelElement) && textValue != null) else if (localName.equals(labelElement) && textValue != null)
{ {
// plug in label value // plug in label value
result[rindex].value = result[rindex].label = textValue.trim(); result[rindex].value = textValue.trim();
result[rindex].label = result[rindex].value;
} }
else if (authorityElement != null && localName.equals(authorityElement) && textValue != null) else if (authorityElement != null && localName.equals(authorityElement) && textValue != null)
{ {

View File

@@ -574,7 +574,8 @@ public abstract class AbstractMETSDisseminator
} }
else else
{ {
xwalkName = metsName = typeSpec; metsName = typeSpec;
xwalkName = typeSpec;
} }
// First, check to see if the crosswalk we are using is a normal DisseminationCrosswalk // First, check to see if the crosswalk we are using is a normal DisseminationCrosswalk

View File

@@ -687,7 +687,10 @@ public class METSManifest
return xmlData.getChildren(); return xmlData.getChildren();
} }
} }
else if ((mdRef = mdSec.getChild("mdRef", metsNS)) != null) else
{
mdRef = mdSec.getChild("mdRef", metsNS);
if (mdRef != null)
{ {
String mimeType = mdRef.getAttributeValue("MIMETYPE"); String mimeType = mdRef.getAttributeValue("MIMETYPE");
if (mimeType != null && mimeType.equalsIgnoreCase("text/xml")) if (mimeType != null && mimeType.equalsIgnoreCase("text/xml"))
@@ -702,12 +705,14 @@ public class METSManifest
log.warn("Ignoring mdRef section because MIMETYPE is not XML, but: "+mimeType); log.warn("Ignoring mdRef section because MIMETYPE is not XML, but: "+mimeType);
return new ArrayList<Element>(0); return new ArrayList<Element>(0);
} }
} }
else else
{ {
throw new MetadataValidationException("Invalid METS Manifest: ?mdSec element with neither mdRef nor mdWrap child."); throw new MetadataValidationException("Invalid METS Manifest: ?mdSec element with neither mdRef nor mdWrap child.");
} }
} }
}
catch (JDOMException je) catch (JDOMException je)
{ {
throw new MetadataValidationException("Error parsing or validating metadata section in mdRef or binData within "+mdSec.toString(), je); throw new MetadataValidationException("Error parsing or validating metadata section in mdRef or binData within "+mdSec.toString(), je);
@@ -752,7 +757,10 @@ public class METSManifest
outputPretty.outputString(xmlData.getChildren()).getBytes()); outputPretty.outputString(xmlData.getChildren()).getBytes());
} }
} }
else if ((mdRef = mdSec.getChild("mdRef", metsNS)) != null) else
{
mdRef = mdSec.getChild("mdRef", metsNS);
if (mdRef != null)
{ {
return callback.getInputStream(mdRef); return callback.getInputStream(mdRef);
} }
@@ -761,6 +769,7 @@ public class METSManifest
throw new MetadataValidationException("Invalid METS Manifest: ?mdSec element with neither mdRef nor mdWrap child."); throw new MetadataValidationException("Invalid METS Manifest: ?mdSec element with neither mdRef nor mdWrap child.");
} }
} }
}
/** /**

View File

@@ -366,8 +366,8 @@ public class PDFPackager
log.debug("PDF Info dict title=\"" + title + "\""); log.debug("PDF Info dict title=\"" + title + "\"");
} }
item.addDC("title", null, "en", title); item.addDC("title", null, "en", title);
String value; String value = docinfo.getAuthor();
if ((value = docinfo.getAuthor()) != null) if (value != null)
{ {
item.addDC("contributor", "author", null, value); item.addDC("contributor", "author", null, value);
if (log.isDebugEnabled()) if (log.isDebugEnabled())
@@ -375,32 +375,41 @@ public class PDFPackager
log.debug("PDF Info dict author=\"" + value + "\""); log.debug("PDF Info dict author=\"" + value + "\"");
} }
} }
if ((value = docinfo.getCreator()) != null)
value = docinfo.getCreator();
if (value != null)
{ {
item.addDC("description", "provenance", "en", item.addDC("description", "provenance", "en",
"Application that created the original document: " + value); "Application that created the original document: " + value);
} }
if ((value = docinfo.getProducer()) != null)
value = docinfo.getProducer();
if (value != null)
{ {
item.addDC("description", "provenance", "en", item.addDC("description", "provenance", "en",
"Original document converted to PDF by: " + value); "Original document converted to PDF by: " + value);
} }
if ((value = docinfo.getSubject()) != null)
value = docinfo.getSubject();
if (value != null)
{ {
item.addDC("description", "abstract", null, value); item.addDC("description", "abstract", null, value);
} }
if ((value = docinfo.getKeywords()) != null)
value = docinfo.getKeywords();
if (value != null)
{ {
item.addDC("subject", "other", null, value); item.addDC("subject", "other", null, value);
} }
// Take either CreationDate or ModDate as "date.created", // Take either CreationDate or ModDate as "date.created",
// Too bad there's no place to put "last modified" in the DC. // Too bad there's no place to put "last modified" in the DC.
Calendar calValue; Calendar calValue = docinfo.getCreationDate();
if ((calValue = docinfo.getCreationDate()) == null) if (calValue == null)
{ {
calValue = docinfo.getModificationDate(); calValue = docinfo.getModificationDate();
} }
if (calValue != null) if (calValue != null)
{ {
item.addDC("date", "created", null, item.addDC("date", "created", null,

View File

@@ -108,7 +108,8 @@ public class EPerson extends DSpaceObject
// Cache ourselves // Cache ourselves
context.cache(this, row.getIntColumn("eperson_id")); context.cache(this, row.getIntColumn("eperson_id"));
modified = modifiedMetadata = false; modified = false;
modifiedMetadata = false;
clearDetails(); clearDetails();
} }

View File

@@ -134,7 +134,8 @@ public class ConsumerProfile
else else
{ {
int filter[] = new int[2]; int filter[] = new int[2];
filter[0] = filter[1] = 0; filter[0] = 0;
filter[1] = 0;
String objectNames[] = fpart[0].split("\\|"); String objectNames[] = fpart[0].split("\\|");
for (int k = 0; k < objectNames.length; ++k) for (int k = 0; k < objectNames.length; ++k)
{ {

View File

@@ -101,7 +101,8 @@ public class OrderFormat
if (type != null && type.length() > 0) if (type != null && type.length() > 0)
{ {
// Use a delegate if one is configured // Use a delegate if one is configured
if ((delegate = OrderFormat.getDelegate(type)) != null) delegate = OrderFormat.getDelegate(type);
if (delegate != null)
{ {
return delegate.makeSortString(value, language); return delegate.makeSortString(value, language);
} }

View File

@@ -98,7 +98,8 @@ public class ShibbolethFilter implements Filter
String name; String name;
while(names.hasMoreElements()) while(names.hasMoreElements())
{ {
log.debug("header:" + (name = names.nextElement().toString()) + "=" + ((HttpServletRequest) request).getHeader(name)); name = names.nextElement().toString();
log.debug("header:" + name + "=" + ((HttpServletRequest) request).getHeader(name));
} }
// No current user, prompt authentication // No current user, prompt authentication

View File

@@ -233,34 +233,42 @@ public class ItemTag extends TagSupport
private StyleSelection styleSelection = (StyleSelection) PluginManager.getSinglePlugin(StyleSelection.class); private StyleSelection styleSelection = (StyleSelection) PluginManager.getSinglePlugin(StyleSelection.class);
/** Hashmap of linked metadata to browse, from dspace.cfg */ /** Hashmap of linked metadata to browse, from dspace.cfg */
private Map<String,String> linkedMetadata; private static Map<String,String> linkedMetadata;
/** Hashmap of urn base url resolver, from dspace.cfg */ /** Hashmap of urn base url resolver, from dspace.cfg */
private Map<String,String> urn2baseurl; private static Map<String,String> urn2baseurl;
/** regex pattern to capture the style of a field, ie <code>schema.element.qualifier(style)</code> */ /** regex pattern to capture the style of a field, ie <code>schema.element.qualifier(style)</code> */
private Pattern fieldStylePatter = Pattern.compile(".*\\((.*)\\)"); private Pattern fieldStylePatter = Pattern.compile(".*\\((.*)\\)");
private static final long serialVersionUID = -3841266490729417240L; private static final long serialVersionUID = -3841266490729417240L;
public ItemTag() static {
{ int i;
super();
getThumbSettings();
linkedMetadata = new HashMap<String, String>(); linkedMetadata = new HashMap<String, String>();
String linkMetadata; String linkMetadata;
for (int i = 1; null != (linkMetadata = ConfigurationManager.getProperty("webui.browse.link."+i)); i++)
{ i = 1;
do {
linkMetadata = ConfigurationManager.getProperty("webui.browse.link."+i);
if (linkMetadata != null) {
String[] linkedMetadataSplit = linkMetadata.split(":"); String[] linkedMetadataSplit = linkMetadata.split(":");
String indexName = linkedMetadataSplit[0].trim(); String indexName = linkedMetadataSplit[0].trim();
String metadataName = linkedMetadataSplit[1].trim(); String metadataName = linkedMetadataSplit[1].trim();
linkedMetadata.put(indexName, metadataName); linkedMetadata.put(indexName, metadataName);
} }
i++;
} while (linkMetadata != null);
urn2baseurl = new HashMap<String, String>(); urn2baseurl = new HashMap<String, String>();
String urn; String urn;
for (int i = 1; null != (urn = ConfigurationManager.getProperty("webui.resolver."+i+".urn")); i++){ i = 1;
do {
urn = ConfigurationManager.getProperty("webui.resolver."+i+".urn");
if (urn != null) {
String baseurl = ConfigurationManager.getProperty("webui.resolver."+i+".baseurl"); String baseurl = ConfigurationManager.getProperty("webui.resolver."+i+".baseurl");
if (baseurl != null){ if (baseurl != null){
urn2baseurl.put(urn, baseurl); urn2baseurl.put(urn, baseurl);
@@ -269,6 +277,9 @@ public class ItemTag extends TagSupport
} }
} }
i++;
} while (urn != null);
// Set sensible default if no config is found for doi & handle // Set sensible default if no config is found for doi & handle
if (!urn2baseurl.containsKey("doi")){ if (!urn2baseurl.containsKey("doi")){
urn2baseurl.put("doi",DOI_DEFAULT_BASEURL); urn2baseurl.put("doi",DOI_DEFAULT_BASEURL);
@@ -279,6 +290,12 @@ public class ItemTag extends TagSupport
} }
} }
public ItemTag()
{
super();
getThumbSettings();
}
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
try try

View File

@@ -424,7 +424,8 @@ public class FeedServlet extends DSpaceServlet
else else
{ {
minKey = key; minKey = key;
minFeed = maxFeed = feed; minFeed = feed;
maxFeed = feed;
} }
total += feed.hits; total += feed.hits;
} }

View File

@@ -84,7 +84,8 @@ public class ShibbolethServlet extends DSpaceServlet {
String name; String name;
while(names.hasMoreElements()) while(names.hasMoreElements())
{ {
log.info("header:" + (name = names.nextElement().toString()) + "=" + request.getHeader(name)); name = names.nextElement().toString();
log.info("header:" + name + "=" + request.getHeader(name));
} }
String jsp = null; String jsp = null;

View File

@@ -226,7 +226,8 @@ public class Authenticate
{ {
String s; String s;
am = (AuthenticationMethod)ai.next(); am = (AuthenticationMethod)ai.next();
if ((s = am.loginPageURL(context, request, response)) != null) s = am.loginPageURL(context, request, response);
if (s != null)
{ {
url = s; url = s;
++count; ++count;

View File

@@ -225,15 +225,17 @@ class DAVCollection extends DAVDSpaceObject
else if (elementsEqualIsh(property, logoProperty)) else if (elementsEqualIsh(property, logoProperty))
{ {
Bitstream lbs = this.collection.getLogo(); Bitstream lbs = this.collection.getLogo();
Element le; if (lbs != null)
if (lbs != null {
&& (le = DAVBitstream.makeXmlBitstream(lbs, this)) != null) Element le = DAVBitstream.makeXmlBitstream(lbs, this);
if (le != null)
{ {
Element p = new Element("logo", DAV.NS_DSPACE); Element p = new Element("logo", DAV.NS_DSPACE);
p.addContent(le); p.addContent(le);
return p; return p;
} }
} }
}
else if (elementsEqualIsh(property, short_descriptionProperty)) else if (elementsEqualIsh(property, short_descriptionProperty))
{ {

View File

@@ -171,15 +171,17 @@ class DAVCommunity extends DAVDSpaceObject
else if (elementsEqualIsh(property, logoProperty)) else if (elementsEqualIsh(property, logoProperty))
{ {
Bitstream lbs = this.community.getLogo(); Bitstream lbs = this.community.getLogo();
Element le; if (lbs != null)
if (lbs != null {
&& (le = DAVBitstream.makeXmlBitstream(lbs, this)) != null) Element le = DAVBitstream.makeXmlBitstream(lbs, this);
if (le != null)
{ {
Element p = new Element("logo", DAV.NS_DSPACE); Element p = new Element("logo", DAV.NS_DSPACE);
p.addContent(le); p.addContent(le);
return p; return p;
} }
} }
}
else if (elementsEqualIsh(property, handleProperty)) else if (elementsEqualIsh(property, handleProperty))
{ {

View File

@@ -119,11 +119,9 @@ abstract class DAVDSpaceObject extends DAVResource
protected static String getPathElt(String handle) protected static String getPathElt(String handle)
{ {
int hs; int hs;
if (handleSeparator != '/' && (hs = handle.indexOf('/')) >= 0) if (handleSeparator != '/')
{ {
char hc[] = handle.toCharArray(); handle = handle.replaceFirst("/", String.valueOf(handleSeparator));
hc[hs] = handleSeparator;
handle = String.copyValueOf(hc);
} }
return "dso_" + encodeHandle(handle); return "dso_" + encodeHandle(handle);
} }

View File

@@ -397,31 +397,49 @@ abstract class DAVResource
String pathElt[]) throws IOException, SQLException, String pathElt[]) throws IOException, SQLException,
DAVStatusException, AuthorizeException DAVStatusException, AuthorizeException
{ {
DAVResource result = null; DAVResource result = DAVSite.matchResourceURI(context, request, response, pathElt);
if (result != null) {
if ((result = DAVSite.matchResourceURI(context, request, response,
pathElt)) == null
&& (result = DAVLookup.matchResourceURI(context, request,
response, pathElt)) == null
&& (result = DAVWorkspace.matchResourceURI(context, request,
response, pathElt)) == null
&& (result = DAVWorkflow.matchResourceURI(context, request,
response, pathElt)) == null
&& (result = DAVEPerson.matchResourceURI(context, request,
response, pathElt)) == null
&& (result = DAVItem.matchResourceURI(context, request,
response, pathElt)) == null
&& (result = DAVBitstream.matchResourceURI(context, request,
response, pathElt)) == null
&& (result = DAVDSpaceObject.matchResourceURI(context, request,
response, pathElt)) == null)
{
throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST,
"Unrecognized DSpace resource URI");
}
return result; return result;
} }
result = DAVLookup.matchResourceURI(context, request, response, pathElt);
if (result != null) {
return result;
}
result = DAVWorkspace.matchResourceURI(context, request, response, pathElt);
if (result != null) {
return result;
}
result = DAVWorkflow.matchResourceURI(context, request, response, pathElt);
if (result != null) {
return result;
}
result = DAVEPerson.matchResourceURI(context, request, response, pathElt);
if (result != null) {
return result;
}
result = DAVItem.matchResourceURI(context, request, response, pathElt);
if (result != null) {
return result;
}
result = DAVBitstream.matchResourceURI(context, request, response, pathElt);
if (result != null) {
return result;
}
result = DAVDSpaceObject.matchResourceURI(context, request, response, pathElt);
if (result != null) {
return result;
}
throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST, "Unrecognized DSpace resource URI");
}
/*----------------- Generating Resource URIs -----------------------*/ /*----------------- Generating Resource URIs -----------------------*/
/** /**

View File

@@ -315,7 +315,10 @@ class DAVWorkflowItem extends DAVInProgressSubmission
WorkflowManager.unclaim(this.context, (WorkflowItem) this.inProgressItem, WorkflowManager.unclaim(this.context, (WorkflowItem) this.inProgressItem,
this.context.getCurrentUser()); this.context.getCurrentUser());
} }
else if ((newState = WorkflowManager.getWorkflowID(key)) >= 0) else
{
newState = WorkflowManager.getWorkflowID(key);
if (newState >= 0)
{ {
((WorkflowItem) this.inProgressItem).setState(newState); ((WorkflowItem) this.inProgressItem).setState(newState);
} }
@@ -324,6 +327,7 @@ class DAVWorkflowItem extends DAVInProgressSubmission
throw new DAVStatusException(DAV.SC_CONFLICT, throw new DAVStatusException(DAV.SC_CONFLICT,
"Unrecognized verb or state-name in value for state property."); "Unrecognized verb or state-name in value for state property.");
} }
}
this.inProgressItem.update(); this.inProgressItem.update();
return HttpServletResponse.SC_OK; return HttpServletResponse.SC_OK;

View File

@@ -397,9 +397,9 @@ public class DSpaceOAICatalog extends AbstractCatalog
} }
} }
String schemaURL; String schemaURL = getCrosswalks().getSchemaURL(metadataPrefix);
if ((schemaURL = getCrosswalks().getSchemaURL(metadataPrefix)) == null) if (schemaURL == null)
{ {
log.info(LogManager.getHeader(null, "oai_error", log.info(LogManager.getHeader(null, "oai_error",
"cannot_disseminate_format")); "cannot_disseminate_format"));

View File

@@ -32,7 +32,8 @@ public class StepAndPage implements Comparable<StepAndPage>
/** Default constructor returns an unset instance */ /** Default constructor returns an unset instance */
public StepAndPage() public StepAndPage()
{ {
step = page = UNSET; step = UNSET;
page = UNSET;
} }
/** /**