[DS-707] Style / readability improvements

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5565 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Graham Triggs
2010-10-22 23:19:13 +00:00
parent 56c6ca1f49
commit d032c565e0
79 changed files with 927 additions and 246 deletions

View File

@@ -325,9 +325,13 @@ public class Harvest
// resolved, now make sure it's a collection
if (dso == null || dso.getType() != Constants.COLLECTION)
{
targetCollection = null;
}
else
targetCollection = (Collection)dso;
{
targetCollection = (Collection) dso;
}
}
// not a handle, try and treat it as an integer collection
// database ID

View File

@@ -1145,7 +1145,9 @@ public class ItemExport
return new FileInputStream(file);
}
else
{
return null;
}
}
/**

View File

@@ -839,7 +839,9 @@ public class MediaFilterManager
return true;
}
else
{
return false;
}
}
}

View File

@@ -224,9 +224,13 @@ public class OpenSearch
{
// Encode results in requested format
if ("rss".equals(format))
{
format = "rss_2.0";
}
else if ("atom".equals(format))
{
format = "atom_1.0";
}
SyndicationFeed feed = new SyndicationFeed(labels.get(SyndicationFeed.MSG_UITYPE));
feed.populate(null, scope, results, labels);

View File

@@ -188,19 +188,24 @@ public class LDAPAuthentication
{
// e-mail address corresponds to active account
if (eperson.getRequireCertificate())
return CERT_REQUIRED;
else if (!eperson.canLogIn())
return BAD_ARGS;
{
if (ldap.ldapAuthenticate(netid, password, context))
{
context.setCurrentUser(eperson = EPerson.findByNetid(context, netid.toLowerCase()));
log.info(LogManager
.getHeader(context, "authenticate", "type=ldap"));
return SUCCESS;
}
else
return BAD_CREDENTIALS;
return CERT_REQUIRED;
}
else if (!eperson.canLogIn())
{
return BAD_ARGS;
}
if (ldap.ldapAuthenticate(netid, password, context))
{
context.setCurrentUser(eperson = EPerson.findByNetid(context, netid.toLowerCase()));
log.info(LogManager
.getHeader(context, "authenticate", "type=ldap"));
return SUCCESS;
}
else
{
return BAD_CREDENTIALS;
}
}
@@ -240,11 +245,26 @@ public class LDAPAuthentication
{
context.setIgnoreAuthorization(true);
eperson = EPerson.create(context);
if ((ldap.ldapEmail!=null)&&(!ldap.ldapEmail.equals(""))) eperson.setEmail(ldap.ldapEmail);
else eperson.setEmail(netid);
if ((ldap.ldapGivenName!=null)&&(!ldap.ldapGivenName.equals(""))) eperson.setFirstName(ldap.ldapGivenName);
if ((ldap.ldapSurname!=null)&&(!ldap.ldapSurname.equals(""))) eperson.setLastName(ldap.ldapSurname);
if ((ldap.ldapPhone!=null)&&(!ldap.ldapPhone.equals(""))) eperson.setMetadata("phone", ldap.ldapPhone);
if ((ldap.ldapEmail!=null)&&(!ldap.ldapEmail.equals("")))
{
eperson.setEmail(ldap.ldapEmail);
}
else
{
eperson.setEmail(netid);
}
if ((ldap.ldapGivenName!=null)&&(!ldap.ldapGivenName.equals("")))
{
eperson.setFirstName(ldap.ldapGivenName);
}
if ((ldap.ldapSurname!=null)&&(!ldap.ldapSurname.equals("")))
{
eperson.setLastName(ldap.ldapSurname);
}
if ((ldap.ldapPhone!=null)&&(!ldap.ldapPhone.equals("")))
{
eperson.setMetadata("phone", ldap.ldapPhone);
}
eperson.setNetid(netid.toLowerCase());
eperson.setCanLogIn(true);
AuthenticationManager.initEPerson(context, request, eperson);

View File

@@ -225,19 +225,24 @@ public class LDAPHierarchicalAuthentication
{
// e-mail address corresponds to active account
if (eperson.getRequireCertificate())
return CERT_REQUIRED;
else if (!eperson.canLogIn())
return BAD_ARGS;
{
if (ldap.ldapAuthenticate(dn, password, context))
{
context.setCurrentUser(eperson);
log.info(LogManager
.getHeader(context, "authenticate", "type=ldap"));
return SUCCESS;
}
else
return BAD_CREDENTIALS;
return CERT_REQUIRED;
}
else if (!eperson.canLogIn())
{
return BAD_ARGS;
}
if (ldap.ldapAuthenticate(dn, password, context))
{
context.setCurrentUser(eperson);
log.info(LogManager
.getHeader(context, "authenticate", "type=ldap"));
return SUCCESS;
}
else
{
return BAD_CREDENTIALS;
}
}

View File

@@ -80,8 +80,10 @@ public class ShibAuthentication implements AuthenticationMethod
java.util.Enumeration names = request.getHeaderNames();
String name;
while (names.hasMoreElements())
{
log.debug("header:" + (name = names.nextElement().toString()) + "="
+ request.getHeader(name));
}
boolean isUsingTomcatUser = ConfigurationManager
.getBooleanProperty("authentication.shib.email-use-tomcat-remote-user");

View File

@@ -147,9 +147,13 @@ public class LocaleOrderingFilter implements TextFilter
String[] localeArr = locale.split("_");
if (localeArr.length > 1)
{
theLocale = new Locale(localeArr[0], localeArr[1]);
}
else
{
theLocale = new Locale(locale);
}
// Return the configured locale, or English default
if (theLocale == null)
@@ -159,7 +163,9 @@ public class LocaleOrderingFilter implements TextFilter
}
}
else
{
return Locale.ENGLISH;
}
return theLocale;
}

View File

@@ -71,9 +71,13 @@ public abstract class DSpaceObject
protected void addDetails(String d)
{
if (eventDetails == null)
{
eventDetails = new StringBuffer(d);
}
else
{
eventDetails.append(", ").append(d);
}
}
/**

View File

@@ -636,7 +636,9 @@ public class Item extends DSpaceObject
addMetadata(schema, element, qualifier, lang, values, authorities, confidences);
}
else
{
addMetadata(schema, element, qualifier, lang, values, null, null);
}
}
/**
@@ -1632,11 +1634,17 @@ public class Item extends DSpaceObject
{
String text = tr.getStringColumn("text_value");
if (dcv.value == null && text == null)
{
matched = true;
}
else if (dcv.value != null && dcv.value.equals(text))
{
matched = true;
}
else
{
matched = false;
}
}
// Check the language is the same
@@ -1644,11 +1652,17 @@ public class Item extends DSpaceObject
{
String lang = tr.getStringColumn("text_lang");
if (dcv.language == null && lang == null)
{
matched = true;
}
else if (dcv.language != null && dcv.language.equals(lang))
{
matched = true;
}
else
{
matched = false;
}
}
// check that authority and confidence match

View File

@@ -205,11 +205,17 @@ public class LCNameAuthority implements ChoiceAuthority
int confidence;
if (handler.hits == 0)
{
confidence = Choices.CF_NOTFOUND;
}
else if (handler.hits == 1)
{
confidence = Choices.CF_UNCERTAIN;
}
else
{
confidence = Choices.CF_AMBIGUOUS;
}
return new Choices(handler.result.toArray(new Choice[handler.result.size()]),
start, handler.hits, confidence, more);
}
@@ -271,9 +277,13 @@ public class LCNameAuthority implements ChoiceAuthority
if (newValue.length() > 0)
{
if (textValue == null)
{
textValue = newValue;
}
else
{
textValue += newValue;
}
}
}
@@ -308,7 +318,9 @@ public class LCNameAuthority implements ChoiceAuthority
result.add(new Choice(lccn, name, name));
}
else
log.warn("Got anomalous result, at least one of these null: lccn="+lccn+", name="+name);
{
log.warn("Got anomalous result, at least one of these null: lccn=" + lccn + ", name=" + name);
}
name = null;
lccn = null;
}
@@ -318,13 +330,16 @@ public class LCNameAuthority implements ChoiceAuthority
{
if (lastTag != null && lastCode != null)
{
// 010.a is lccn, "authority code"
if (lastTag.equals("010") && lastCode.equals("a"))
{
// 010.a is lccn, "authority code"
lccn = textValue;
// 100.a is the personal name
}
else if (lastTag.equals("100") && lastCode.equals("a"))
{
// 100.a is the personal name
name = textValue;
}
if (lastTag.equals("100") && lastCode.equals("d") && (name != null))
name = name+" "+textValue;

View File

@@ -159,10 +159,14 @@ public class METSRightsCrosswalk
IOException, SQLException, AuthorizeException
{
if(dso==null)
{
return null;
}
// we don't have a way to provide METSRights for a SITE object
else if(dso.getType() == Constants.SITE)
{
throw new CrosswalkObjectNotSupported("The METSRightsCrosswalk cannot crosswalk a SITE object");
}
//Root element: RightsDeclarationMD
@@ -203,9 +207,13 @@ public class METSRightsCrosswalk
String contextClass=GROUP_CONTEXTCLASS;
if(group.getID()==0) //DSpace Anonymous Group = 'GENERAL PUBLIC' type
contextClass = ANONYMOUS_CONTEXTCLASS;
{
contextClass = ANONYMOUS_CONTEXTCLASS;
}
else if(group.getID()==1) //DSpace Administrator Group = 'REPOSITORY MGR' type
contextClass = ADMIN_CONTEXTCLASS;
{
contextClass = ADMIN_CONTEXTCLASS;
}
rightsContext.setAttribute("CONTEXTCLASS", contextClass);
@@ -423,7 +431,9 @@ public class METSRightsCrosswalk
// if we're fed a <RightsDeclarationMD> wrapper object, recurse on its guts:
if (element.getName().equals("RightsDeclarationMD"))
{
ingest(context, dso, element.getChildren());
}
// "Context" section (where permissions are stored)
else if (element.getName().equals("Context"))
{

View File

@@ -288,8 +288,10 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
String val = modsConfig.getProperty(qdc);
String pair[] = val.split("\\s+\\|\\s+", 2);
if (pair.length < 2)
log.warn("Illegal MODS mapping in "+propsFile.toString()+", line = "+
{
log.warn("Illegal MODS mapping in " + propsFile.toString() + ", line = " +
qdc + " = " + val);
}
else
{
modsTriple trip = modsTriple.create(qdc, pair[0], pair[1]);
@@ -379,7 +381,9 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
modsTriple trip = (modsTriple)modsMap.get(qdc);
if (trip == null)
log.warn("WARNING: "+getPluginInstanceName()+": No MODS mapping for \"" + qdc+"\"");
{
log.warn("WARNING: " + getPluginInstanceName() + ": No MODS mapping for \"" + qdc + "\"");
}
else
{
try
@@ -397,13 +401,21 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
{
Object what = ni.next();
if (what instanceof Element)
((Element)what).setText(checkedString(value));
{
((Element) what).setText(checkedString(value));
}
else if (what instanceof Attribute)
((Attribute)what).setValue(checkedString(value));
{
((Attribute) what).setValue(checkedString(value));
}
else if (what instanceof Text)
((Text)what).setText(checkedString(value));
{
((Text) what).setText(checkedString(value));
}
else
log.warn("Got unknown object from XPath, class="+what.getClass().getName());
{
log.warn("Got unknown object from XPath, class=" + what.getClass().getName());
}
}
result.add(me);
}
@@ -584,14 +596,20 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
private String checkedString(String value)
{
if (value == null)
{
return null;
}
String reason = Verifier.checkCharacterData(value);
if (reason == null)
{
return value;
}
else
{
if (log.isDebugEnabled())
log.debug("Filtering out non-XML characters in string, reason="+reason);
{
log.debug("Filtering out non-XML characters in string, reason=" + reason);
}
StringBuffer result = new StringBuffer(value.length());
for (int i = 0; i < value.length(); ++i)
{

View File

@@ -248,7 +248,9 @@ public class DSpaceAIPDisseminator
return result;
}
else
{
return dmdTypes.split("\\s*,\\s*");
}
}
/**
@@ -284,7 +286,9 @@ public class DSpaceAIPDisseminator
}
}
else
{
return techTypes.split("\\s*,\\s*");
}
}
/**
@@ -317,7 +321,9 @@ public class DSpaceAIPDisseminator
return result;
}
else
{
return sourceTypes.split("\\s*,\\s*");
}
}
/**
@@ -340,9 +346,13 @@ public class DSpaceAIPDisseminator
{
String dpTypes = ConfigurationManager.getProperty("aip.disseminate.digiprovMD");
if (dpTypes == null)
{
return new String[0];
}
else
{
return dpTypes.split("\\s*,\\s*");
}
}
/**
@@ -380,7 +390,9 @@ public class DSpaceAIPDisseminator
result.add(DSPACE_DEPOSIT_LICENSE_MDTYPE);
if (CreativeCommons.getLicenseRdfBitstream((Item)dso) != null)
{
result.add(CREATIVE_COMMONS_RDF_MDTYPE);
}
else if (CreativeCommons.getLicenseTextBitstream((Item)dso) != null)
result.add(CREATIVE_COMMONS_TEXT_MDTYPE);
}
@@ -389,7 +401,9 @@ public class DSpaceAIPDisseminator
result.add("METSRights");
}
else
{
return rTypes.split("\\s*,\\s*");
}
return result.toArray(new String[result.size()]);
}
@@ -504,9 +518,13 @@ public class DSpaceAIPDisseminator
case Constants.COMMUNITY:
Community parent = ((Community)dso).getParentCommunity();
if (parent == null)
{
parentHandle = Site.getSiteHandle();
}
else
{
parentHandle = parent.getHandle();
}
case Constants.SITE:
break;
}

View File

@@ -113,7 +113,9 @@ public class DSpaceAIPIngester
{
String profile = manifest.getProfile();
if (profile == null)
{
throw new MetadataValidationException("Cannot accept METS with no PROFILE attribute!");
}
else if (!profile.equals(DSpaceAIPDisseminator.PROFILE_1_0))
throw new MetadataValidationException("METS has unacceptable PROFILE attribute, profile="+profile);
}
@@ -209,7 +211,9 @@ public class DSpaceAIPIngester
// it's an error if there is nothing to crosswalk:
else
{
throw new MetadataValidationException("DSpaceAIPIngester: Could not find an acceptable object-wide DMD section in manifest.");
}
}

View File

@@ -133,9 +133,13 @@ public class DSpaceMETSDisseminator
public String bundleToFileGrp(String bname)
{
if (bname.equals("ORIGINAL"))
{
return "CONTENT";
}
else
{
return bname;
}
}
/**
@@ -205,7 +209,9 @@ public class DSpaceMETSDisseminator
return result;
}
else
{
return new String[0];
}
}
@Override
@@ -244,13 +250,20 @@ public class DSpaceMETSDisseminator
{
Item item = (Item)dso;
if (PackageUtils.findDepositLicense(context, item) != null)
{
result.add(DSPACE_DEPOSIT_LICENSE_MDTYPE);
}
if (CreativeCommons.getLicenseRdfBitstream(item) != null)
{
result.add(CREATIVE_COMMONS_RDF_MDTYPE);
}
else if (CreativeCommons.getLicenseTextBitstream(item) != null)
{
result.add(CREATIVE_COMMONS_TEXT_MDTYPE);
}
}
return result.toArray(new String[result.size()]);
}

View File

@@ -92,9 +92,13 @@ public class DSpaceMETSIngester
{
String profile = manifest.getProfile();
if (profile == null)
{
throw new MetadataValidationException("Cannot accept METS with no PROFILE attribute!");
}
else if (!profile.startsWith(PROFILE_START))
throw new MetadataValidationException("METS has unacceptable PROFILE value, profile="+profile);
{
throw new MetadataValidationException("METS has unacceptable PROFILE value, profile=" + profile);
}
}
/**

View File

@@ -220,9 +220,13 @@ public class METSManifest
{
File xsd = new File(xsdPath1, val[1]);
if (!xsd.exists())
xsd = new File(xsdPath2, val[1]);
{
xsd = new File(xsdPath2, val[1]);
}
if (!xsd.exists())
log.warn("Schema file not found for config entry=\""+spec+"\"");
{
log.warn("Schema file not found for config entry=\"" + spec + "\"");
}
else
{
try
@@ -239,12 +243,16 @@ public class METSManifest
}
}
else
log.warn("Schema config entry has wrong format, entry=\""+spec+"\"");
{
log.warn("Schema config entry has wrong format, entry=\"" + spec + "\"");
}
}
}
localSchemas = result.toString();
if (log.isDebugEnabled())
log.debug("Got local schemas = \""+localSchemas+"\"");
{
log.debug("Got local schemas = \"" + localSchemas + "\"");
}
}
/**
@@ -437,9 +445,13 @@ public class METSManifest
private static String normalizeBundleName(String in)
{
if (in.equals("CONTENT"))
{
return Constants.CONTENT_BUNDLE_NAME;
}
else if (in.equals("MANIFESTMD"))
{
return Constants.METADATA_BUNDLE_NAME;
}
return in;
}
@@ -456,7 +468,9 @@ public class METSManifest
Element fg = file.getParentElement();
String fgUse = fg.getAttributeValue("USE");
if (fgUse == null)
{
throw new MetadataValidationException("Invalid METS Manifest: every fileGrp element must have a USE attribute.");
}
return normalizeBundleName(fgUse);
}
@@ -480,21 +494,31 @@ public class METSManifest
{
// check for forbidden FContent child first:
if (file.getChild("FContent", metsNS) == null)
{
throw new MetadataValidationException("Invalid METS Manifest: Every file element must have FLocat child.");
}
else
{
throw new MetadataValidationException("Invalid METS Manifest: file element has forbidden FContent child, only FLocat is allowed.");
}
}
}
else if (file.getName().equals("mdRef"))
{
ref = file;
}
else
throw new MetadataValidationException("getFileName() called with recognized element type: "+file.toString());
{
throw new MetadataValidationException("getFileName() called with recognized element type: " + file.toString());
}
String loctype = ref.getAttributeValue("LOCTYPE");
if (loctype != null && loctype.equals("URL"))
{
String result = ref.getAttributeValue("href", xlinkNS);
if (result == null)
{
throw new MetadataValidationException("Invalid METS Manifest: FLocat/mdRef is missing the required xlink:href attribute.");
}
return result;
}
throw new MetadataValidationException("Invalid METS Manifest: FLocat/mdRef does not have LOCTYPE=\"URL\" attribute.");
@@ -604,7 +628,9 @@ public class METSManifest
{
Element bin = mdWrap.getChild("binData", metsNS);
if (bin == null)
{
throw new MetadataValidationException("Invalid METS Manifest: mdWrap element with neither xmlData nor binData child.");
}
// if binData is actually XML, return it; otherwise ignore.
else
@@ -647,7 +673,9 @@ public class METSManifest
}
}
else
{
throw new MetadataValidationException("Invalid METS Manifest: ?mdSec element with neither mdRef nor mdWrap child.");
}
}
catch (JDOMException je)
{
@@ -676,7 +704,9 @@ public class METSManifest
{
Element bin = mdWrap.getChild("binData", metsNS);
if (bin == null)
{
throw new MetadataValidationException("Invalid METS Manifest: mdWrap element with neither xmlData nor binData child.");
}
else
{
@@ -696,7 +726,9 @@ public class METSManifest
return callback.getInputStream(mdRef);
}
else
{
throw new MetadataValidationException("Invalid METS Manifest: ?mdSec element with neither mdRef nor mdWrap child.");
}
}
@@ -853,11 +885,17 @@ public class METSManifest
xpath.addNamespace(xlinkNS);
Object result = xpath.selectSingleNode(mets);
if (result == null && nullOk)
{
return null;
}
else if (result instanceof Element)
return (Element)result;
{
return (Element) result;
}
else
throw new MetadataValidationException("METSManifest: Failed to resolve XPath, path=\""+path+"\"");
{
throw new MetadataValidationException("METSManifest: Failed to resolve XPath, path=\"" + path + "\"");
}
}
catch (JDOMException je)
{
@@ -1102,7 +1140,9 @@ public class METSManifest
{
Element bin = mdWrap.getChild("binData", metsNS);
if (bin == null)
{
throw new MetadataValidationException("Invalid METS Manifest: mdWrap element for streaming crosswalk without binData child.");
}
else
{
byte value[] = Base64.decodeBase64(bin.getText().getBytes());
@@ -1112,13 +1152,17 @@ public class METSManifest
}
}
else
throw new MetadataValidationException("Cannot process METS Manifest: "+
"Metadata of type="+type+" requires a reference to a stream (mdRef), which was not found in "+xmd.getName());
{
throw new MetadataValidationException("Cannot process METS Manifest: " +
"Metadata of type=" + type + " requires a reference to a stream (mdRef), which was not found in " + xmd.getName());
}
}
}
else
throw new MetadataValidationException("Cannot process METS Manifest: "+
"No crosswalk found for contents of "+xmd.getName()+" element, MDTYPE="+type);
{
throw new MetadataValidationException("Cannot process METS Manifest: " +
"No crosswalk found for contents of " + xmd.getName() + " element, MDTYPE=" + type);
}
}
}
catch (CrosswalkObjectNotSupported e)

View File

@@ -690,7 +690,9 @@ public class PluginManager
allInterfaces.addAll(reusableKey.keySet());
Iterator ii = allInterfaces.iterator();
while (ii.hasNext())
checkClassname((String)ii.next(), "key interface or class");
{
checkClassname((String) ii.next(), "key interface or class");
}
// Check implementation classes:
// - each class is loadable.

View File

@@ -360,11 +360,17 @@ public class EPerson extends DSpaceObject
// Create the parameter array, including limit and offset if part of the query
Object[] paramArr = new Object[] {int_param,params,params,params};
if (limit > 0 && offset > 0)
paramArr = new Object[] {int_param,params,params,params,limit,offset};
{
paramArr = new Object[]{int_param, params, params, params, limit, offset};
}
else if (limit > 0)
paramArr = new Object[] {int_param,params,params,params,limit};
{
paramArr = new Object[]{int_param, params, params, params, limit};
}
else if (offset > 0)
paramArr = new Object[] {int_param,params,params,params,offset};
{
paramArr = new Object[]{int_param, params, params, params, offset};
}
// Get all the epeople that match the query
TableRowIterator rows = DatabaseManager.queryTable(context, "eperson",

View File

@@ -897,11 +897,17 @@ public class Group extends DSpaceObject
// Create the parameter array, including limit and offset if part of the query
Object[] paramArr = new Object[]{params, int_param};
if (limit > 0 && offset > 0)
paramArr = new Object[] {params, int_param,limit,offset};
{
paramArr = new Object[]{params, int_param, limit, offset};
}
else if (limit > 0)
paramArr = new Object[] {params, int_param,limit};
{
paramArr = new Object[]{params, int_param, limit};
}
else if (offset > 0)
paramArr = new Object[] {params, int_param,offset};
{
paramArr = new Object[]{params, int_param, offset};
}
TableRowIterator rows =
DatabaseManager.query(context, dbquery, paramArr);

View File

@@ -306,9 +306,13 @@ public class Event implements Serializable
{
Integer mask = objTypeToMask.get(core);
if (mask == null)
{
return -1;
}
else
{
return mask.intValue();
}
}
// translate bitmask object-type to "core.Constants" object type.
@@ -316,9 +320,13 @@ public class Event implements Serializable
{
Integer core = objMaskToType.get(mask);
if (core == null)
{
return -1;
}
else
{
return core.intValue();
}
}
/**
@@ -331,9 +339,13 @@ public class Event implements Serializable
int type = getObjectType();
int id = getObjectID();
if (type < 0 || id < 0)
{
return null;
}
else
{
return DSpaceObject.find(context, type, id);
}
}
/**
@@ -387,9 +399,13 @@ public class Event implements Serializable
{
int i = log2(subjectType);
if (i >= 0 && i < Constants.typeText.length)
{
return Constants.typeText[i];
}
else
{
return "(Unknown)";
}
}
/**
@@ -399,9 +415,13 @@ public class Event implements Serializable
{
int i = log2(objectType);
if (i >= 0 && i < Constants.typeText.length)
{
return Constants.typeText[i];
}
else
{
return "(Unknown)";
}
}
/**
@@ -416,7 +436,9 @@ public class Event implements Serializable
public static int parseObjectType(String s)
{
if ("*".equals(s) || "all".equalsIgnoreCase(s))
{
return ALL_OBJECTS_MASK;
}
else
{
int id = Constants.getTypeID(s.toUpperCase());
@@ -445,9 +467,13 @@ public class Event implements Serializable
{
int i = log2(eventType);
if (i >= 0 && i < eventTypeText.length)
{
return eventTypeText[i];
}
else
{
return "(Unknown)";
}
}
/**

View File

@@ -279,7 +279,9 @@ public class HandleManager
}
else
{
log.warn("Cannot find Handle entry to unbind for object " + Constants.typeText[dso.getType()] + " id=" + dso.getID());
}
}
/**
@@ -384,12 +386,18 @@ public class HandleManager
if (row == null)
{
if (dso.getType() == Constants.SITE)
{
return Site.getSiteHandle();
}
else
{
return null;
}
}
else
{
return row.getStringColumn("handle");
}
}
/**

View File

@@ -96,7 +96,9 @@ public class HarvestConsumer implements Consumer
hi.update();
}
else
log.debug("Deleted item '" + id + "' and the associated harvested_item.");
{
log.debug("Deleted item '" + id + "' and the associated harvested_item.");
}
}
break;
case Constants.COLLECTION:
@@ -109,7 +111,9 @@ public class HarvestConsumer implements Consumer
hc.update();
}
else
log.debug("Deleted collection '" + id + "' and the associated harvested_collection.");
{
log.debug("Deleted collection '" + id + "' and the associated harvested_collection.");
}
}
default:
log.warn("consume() got unrecognized event: " + event.toString());

View File

@@ -274,9 +274,13 @@ public class HarvestedCollection
TableRow row = tri.next();
if (row != null)
return row.getIntColumn("collection_id");
{
return row.getIntColumn("collection_id");
}
else
return -1;
{
return -1;
}
}
/** Find the collection that was harvested most recently.
@@ -293,9 +297,13 @@ public class HarvestedCollection
TableRow row = tri.next();
if (row != null)
return row.getIntColumn("collection_id");
{
return row.getIntColumn("collection_id");
}
else
return -1;
{
return -1;
}
}

View File

@@ -1558,7 +1558,9 @@ public class DatabaseManager
Set pks = new HashSet();
while (pkcolumns.next())
{
pks.add(pkcolumns.getString(4));
}
columns = metadata.getColumns(catalog, schema, tname, null);

View File

@@ -119,9 +119,13 @@ public abstract class InitialArticleWord implements TextFilter
// then it must be followed by whitespace, if not, it can be anything
// Setting endPos signifies that we have found an article word
if (endsLetterOrDigit && isNextWhitespace)
{
initialEnd = curPos + initialArticleWord.length();
}
else if (!endsLetterOrDigit)
{
initialEnd = curPos + initialArticleWord.length();
}
}
}
@@ -139,7 +143,9 @@ public abstract class InitialArticleWord implements TextFilter
// Find a cut point in the source string, removing any whitespace after the article word
int cutPos = initialEnd;
while (cutPos < str.length() && Character.isWhitespace(str.charAt(cutPos)))
{
cutPos++;
}
// Are we stripping the article word?
if (stripInitialArticle)
@@ -202,7 +208,9 @@ public abstract class InitialArticleWord implements TextFilter
{
int testPos = pos + len;
while (testPos < str.length() && Character.isWhitespace(str.charAt(testPos)))
{
testPos++;
}
if (testPos < str.length())
return str.substring(pos, pos + len);

View File

@@ -45,10 +45,14 @@ public class StripLeadingNonAlphaNum implements TextFilter
int i = 0;
while (i < str.length() && !Character.isLetterOrDigit(str.charAt(i)))
{
i++;
}
if (i > 0)
{
return str.substring(i);
}
return str;
}

View File

@@ -93,11 +93,16 @@ public class LoggerUsageEventListener extends AbstractUsageEventListener{
/* Emulate Item logger */
if(handle != null && object instanceof Item)
return "handle=" + object.getHandle();
else
return objText + "_id=" + object.getID();
{
return "handle=" + object.getHandle();
}
else
{
return objText + "_id=" + object.getID();
}
}catch(Exception e)
}
catch(Exception e)
{
}

View File

@@ -121,7 +121,9 @@ public class IndexEventConsumer implements Consumer {
log.debug("Transforming Bundle event into MODIFY of Item "
+ subject.getHandle());
} else
{
return;
}
}
switch (et) {
@@ -129,10 +131,12 @@ public class IndexEventConsumer implements Consumer {
case Event.MODIFY:
case Event.MODIFY_METADATA:
if (subject == null)
{
log.warn(event.getEventTypeAsString() + " event, could not get object for "
+ event.getSubjectTypeAsString() + " id="
+ String.valueOf(event.getSubjectID())
+ ", perhaps it has been deleted.");
}
else {
log.debug("consume() adding event to update queue: " + event.toString());
objectsToUpdate.add(subject);
@@ -142,10 +146,12 @@ public class IndexEventConsumer implements Consumer {
case Event.REMOVE:
case Event.ADD:
if (object == null)
{
log.warn(event.getEventTypeAsString() + " event, could not get object for "
+ event.getObjectTypeAsString() + " id="
+ String.valueOf(event.getObjectID())
+ ", perhaps it has been deleted.");
}
else {
log.debug("consume() adding event to update queue: " + event.toString());
objectsToUpdate.add(object);
@@ -155,7 +161,9 @@ public class IndexEventConsumer implements Consumer {
case Event.DELETE:
String detail = event.getDetail();
if (detail == null)
{
log.warn("got null detail on DELETE event, skipping it.");
}
else {
log.debug("consume() adding event to delete queue: " + event.toString());
handlesToDelete.add(detail);

View File

@@ -116,8 +116,11 @@ public class JSONSolrSearcher extends AbstractReader implements Recyclable {
//Should an invalid value be supplied use -1
facetLimit = -1;
}
}else
}
else
{
facetLimit = -1;
}
//Retrieve our sorting value
facetSort = request.getParameter(FacetParams.FACET_SORT);

View File

@@ -96,7 +96,10 @@ public class ShibbolethFilter implements Filter
{
java.util.Enumeration names = ((HttpServletRequest) request).getHeaderNames();
String name;
while(names.hasMoreElements()) log.debug("header:"+(name = names.nextElement().toString())+"="+((HttpServletRequest)request).getHeader(name));
while(names.hasMoreElements())
{
log.debug("header:" + (name = names.nextElement().toString()) + "=" + ((HttpServletRequest) request).getHeader(name));
}
// No current user, prompt authentication
Authenticate.startAuthentication(context, hrequest, hresponse);

View File

@@ -86,7 +86,9 @@ public class FeedbackServlet extends DSpaceServlet
String basicHost = "";
if (host.equals("localhost") || host.equals("127.0.0.1")
|| host.equals(InetAddress.getLocalHost().getHostAddress()))
{
basicHost = host;
}
else
{
// cut off all but the hostname, to cover cases where more than one URL

View File

@@ -541,7 +541,9 @@ public class HandleServlet extends DSpaceServlet
!Authenticate
.startAuthentication(context, request, response))
{
return;
}
else
{
Subscribe.subscribe(context, context.getCurrentUser(),

View File

@@ -81,9 +81,13 @@ public class LDAPServlet extends DSpaceServlet
// check if ldap is enables and forward to the correct login form
boolean ldap_enabled = ConfigurationManager.getBooleanProperty("ldap.enable");
if (ldap_enabled)
{
JSPManager.showJSP(request, response, "/login/ldap.jsp");
}
else
{
JSPManager.showJSP(request, response, "/login/password.jsp");
}
}

View File

@@ -82,7 +82,10 @@ public class ShibbolethServlet extends DSpaceServlet {
//debugging, show all headers
java.util.Enumeration names = request.getHeaderNames();
String name;
while(names.hasMoreElements()) log.info("header:"+(name=names.nextElement().toString())+"="+request.getHeader(name));
while(names.hasMoreElements())
{
log.info("header:" + (name = names.nextElement().toString()) + "=" + request.getHeader(name));
}
String jsp = null;

View File

@@ -353,7 +353,9 @@ public class JSPStepManager
return completeStep(context, request, response, subInfo);
}
else
{
return false; // step not completed
}
}
/**
@@ -519,8 +521,10 @@ public class JSPStepManager
return true;
}
else
{
return false; // couldn't return to controller since response is
// committed
}
}
/**

View File

@@ -256,16 +256,24 @@ public class OAIDCCrosswalk extends Crosswalk
// test the contents and replace appropriately
if (group.equals("&"))
{
xmlMatcher.appendReplacement(valueBuf,
"&amp;");
}
else if (group.equals("<"))
{
xmlMatcher.appendReplacement(valueBuf,
"&lt;");
}
else if (group.equals(">"))
{
xmlMatcher.appendReplacement(valueBuf,
"&gt;");
}
else
{
xmlMatcher.appendReplacement(valueBuf, " ");
}
}
// add bit of the string after the final match

View File

@@ -39,8 +39,12 @@ public class DnsLookup {
Record[] answers = response.getSectionArray(Section.ANSWER);
if (answers.length == 0)
return hostIp;
{
return hostIp;
}
else
return answers[0].rdataToString();
{
return answers[0].rdataToString();
}
}
}

View File

@@ -247,8 +247,14 @@ public class FlowAuthorizationUtils {
result.setContinue(true);
result.setOutcome(true);
if (added) result.setMessage(new Message("default","A new policy was created successfully"));
else result.setMessage(new Message("default","The policy was edited successfully"));
if (added)
{
result.setMessage(new Message("default", "A new policy was created successfully"));
}
else
{
result.setMessage(new Message("default", "The policy was edited successfully"));
}
result.setParameter("policyID", policy.getID());

View File

@@ -214,9 +214,13 @@ public class FlowContainerUtils
boolean oaiAllSets = "all".equals(request.getParameter("oai-set-setting"));
String oaiSetId;
if(oaiAllSets)
{
oaiSetId = "all";
}
else
{
oaiSetId = request.getParameter("oai_setid");
}
String metadataKey = request.getParameter("metadata_format");
@@ -352,15 +356,25 @@ public class FlowContainerUtils
int harvestTypeInt = 0;
if (oaiProvider == null || oaiProvider.length() == 0)
result.addError("oai_provider");
{
result.addError("oai_provider");
}
if (oaiSetId == null || oaiSetId.length() == 0)
result.addError("oai_setid");
{
result.addError("oai_setid");
}
if (metadataKey == null || metadataKey.length() == 0)
result.addError("metadata_format");
{
result.addError("metadata_format");
}
if (harvestType == null || harvestType.length() == 0)
result.addError("harvest_level");
{
result.addError("harvest_level");
}
else
harvestTypeInt = Integer.parseInt(harvestType);
{
harvestTypeInt = Integer.parseInt(harvestType);
}
if (result.getErrors() == null) {
@@ -781,9 +795,13 @@ public class FlowContainerUtils
Community newCommunity;
if (parent != null)
newCommunity = parent.createSubcommunity();
{
newCommunity = parent.createSubcommunity();
}
else
newCommunity = Community.create(null, context);
{
newCommunity = Community.create(null, context);
}
String name = request.getParameter("name");
String shortDescription = request.getParameter("short_description");

View File

@@ -331,9 +331,13 @@ public class FlowEPersonUtils {
for(String unable : unableList )
{
if (characters == null)
characters = unable;
{
characters = unable;
}
else
characters += ", "+unable;
{
characters += ", " + unable;
}
}
result.setCharacters(characters);

View File

@@ -473,23 +473,41 @@ public class FlowGroupUtils {
if (groupName.endsWith(suffix))
{
if (COLLECTION_SUFFIXES[0].equals(suffix))
return Role.Submitters;
{
return Role.Submitters;
}
else if (COLLECTION_SUFFIXES[1].equals(suffix))
return Role.Administrators;
{
return Role.Administrators;
}
else if (COLLECTION_SUFFIXES[2].equals(suffix))
return Role.WorkflowStep1;
{
return Role.WorkflowStep1;
}
else if (COLLECTION_SUFFIXES[3].equals(suffix))
return Role.WorkflowStep1;
{
return Role.WorkflowStep1;
}
else if (COLLECTION_SUFFIXES[4].equals(suffix))
return Role.WorkflowStep2;
{
return Role.WorkflowStep2;
}
else if (COLLECTION_SUFFIXES[5].equals(suffix))
return Role.WorkflowStep2;
{
return Role.WorkflowStep2;
}
else if (COLLECTION_SUFFIXES[6].equals(suffix))
return Role.WorkflowStep3;
{
return Role.WorkflowStep3;
}
else if (COLLECTION_SUFFIXES[7].equals(suffix))
return Role.WorkflowStep3;
{
return Role.WorkflowStep3;
}
else if (COLLECTION_SUFFIXES[8].equals(suffix))
return Role.DefaultRead;
{
return Role.DefaultRead;
}
} // if it ends with a proper suffix.
} // for each possible suffix
@@ -557,23 +575,41 @@ public class FlowGroupUtils {
if (groupName.endsWith(suffix))
{
if (COLLECTION_SUFFIXES[0].equals(suffix))
{
return Role.Submitters;
}
else if (COLLECTION_SUFFIXES[1].equals(suffix))
{
return Role.Administrators;
}
else if (COLLECTION_SUFFIXES[2].equals(suffix))
{
return Role.WorkflowStep1;
}
else if (COLLECTION_SUFFIXES[3].equals(suffix))
{
return Role.WorkflowStep1;
}
else if (COLLECTION_SUFFIXES[4].equals(suffix))
{
return Role.WorkflowStep2;
}
else if (COLLECTION_SUFFIXES[5].equals(suffix))
{
return Role.WorkflowStep2;
}
else if (COLLECTION_SUFFIXES[6].equals(suffix))
{
return Role.WorkflowStep3;
}
else if (COLLECTION_SUFFIXES[7].equals(suffix))
{
return Role.WorkflowStep3;
}
else if (COLLECTION_SUFFIXES[8].equals(suffix))
{
return Role.DefaultRead;
}
} // if it ends with a proper suffix.
} // for each possible suffix

View File

@@ -472,20 +472,30 @@ public class FlowRegistryUtils
// Get or create the format
BitstreamFormat format;
if (formatID >= 0)
format = BitstreamFormat.find(context, formatID);
{
format = BitstreamFormat.find(context, formatID);
}
else
format = BitstreamFormat.create(context);
{
format = BitstreamFormat.create(context);
}
// Update values
format.setMIMEType(mimeType);
if (formatID != 1) // don't change the unknow format.
format.setShortDescription(shortDescription);
{
format.setShortDescription(shortDescription);
}
format.setDescription(description);
format.setSupportLevel(Integer.valueOf(supportLevel));
if (internal == null)
format.setInternal(false);
{
format.setInternal(false);
}
else
format.setInternal(true);
{
format.setInternal(true);
}
format.setExtensions(extensions);

View File

@@ -144,9 +144,13 @@ public class FlowResult {
public void setOutcome(boolean success)
{
if (success)
outcome = Outcome.SUCCESS;
{
outcome = Outcome.SUCCESS;
}
else
outcome = Outcome.FAILURE;
{
outcome = Outcome.FAILURE;
}
}
/**
@@ -260,15 +264,21 @@ public class FlowResult {
public String getErrorString()
{
if (errors == null || errors.size() == 0)
return null;
{
return null;
}
String errorString = null;
for (String error : errors)
{
if (errorString == null)
errorString = error;
{
errorString = error;
}
else
errorString += ","+error;
{
errorString += "," + error;
}
}
return errorString;
}

View File

@@ -232,8 +232,11 @@ public class ItemExport extends AbstractDSpaceTransformer implements
if (request.getQueryString() != null) {
key.append(request.getQueryString());
}
} else
key.append("anonymous");
}
else
{
key.append("anonymous");
}
return HashUtil.hash(key.toString());
}

View File

@@ -153,7 +153,9 @@ public class Navigation extends AbstractDSpaceTransformer implements CacheablePr
}
}
else
key = "anonymous";
{
key = "anonymous";
}
return HashUtil.hash(key);
}

View File

@@ -149,9 +149,13 @@ public class EditContainerPolicies extends AbstractDSpaceTransformer
{
Row row;
if (policy.getID() == highlightID)
row = table.addRow(null, null, "highlight");
{
row = table.addRow(null, null, "highlight");
}
else
row = table.addRow();
{
row = table.addRow();
}
CheckBox select = row.addCell().addCheckBox("select_policy");
select.setLabel(String.valueOf(policy.getID()));

View File

@@ -208,17 +208,27 @@ public class EditItemPolicies extends AbstractDSpaceTransformer
{
Row row;
if (policy.getID() == highlightID)
row = table.addRow(null, null, "highlight");
{
row = table.addRow(null, null, "highlight");
}
else
row = table.addRow();
{
row = table.addRow();
}
Cell cell;
if (objectType == Constants.BUNDLE)
cell = row.addCell(null, null, "indent");
{
cell = row.addCell(null, null, "indent");
}
else if (objectType == Constants.BITSTREAM)
cell = row.addCell(null, null, "doubleIndent");
{
cell = row.addCell(null, null, "doubleIndent");
}
else
cell = row.addCell();
{
cell = row.addCell();
}
CheckBox select = cell.addCheckBox("select_policy");

View File

@@ -163,7 +163,10 @@ public class EditPolicyForm extends AbstractDSpaceTransformer
else if (policy != null) {
currentGroup = policy.getGroup();
}
else currentGroup = null;
else
{
currentGroup = null;
}
// Same for the current action; it can either blank (-1), manually set, or inherited from the current policy
if (policy != null && actionID == -1)
@@ -201,7 +204,9 @@ public class EditPolicyForm extends AbstractDSpaceTransformer
main.setHead(T_main_head_edit.parameterize(policyID,Constants.typeText[objectType],objectID));
}
else
main.setHead(T_main_head_new.parameterize(Constants.typeText[objectType],objectID));
{
main.setHead(T_main_head_new.parameterize(Constants.typeText[objectType], objectID));
}
int resourceRelevance = 1 << objectType;
@@ -226,9 +231,13 @@ public class EditPolicyForm extends AbstractDSpaceTransformer
if( (Constants.actionTypeRelevance[i] & resourceRelevance) > 0)
{
if (actionID == i)
actionSelect.addOption(true, i, Constants.actionText[i]);
{
actionSelect.addOption(true, i, Constants.actionText[i]);
}
else
actionSelect.addOption(i, Constants.actionText[i]);
{
actionSelect.addOption(i, Constants.actionText[i]);
}
}
}
if (errors.contains("action_id"))
@@ -242,9 +251,13 @@ public class EditPolicyForm extends AbstractDSpaceTransformer
for (Group group : Group.findAll(context, Group.NAME))
{
if (group == currentGroup)
groupSelect.addOption(true, group.getID(), group.getName());
{
groupSelect.addOption(true, group.getID(), group.getName());
}
else
groupSelect.addOption(group.getID(), group.getName());
{
groupSelect.addOption(group.getID(), group.getName());
}
}
if (errors.contains("group_id"))
groupSelect.addError(T_error_no_group);
@@ -337,13 +350,19 @@ public class EditPolicyForm extends AbstractDSpaceTransformer
if (groupsMatched > 0) {
row.addCell().addContent(otherAuthorizations.substring(0,otherAuthorizations.lastIndexOf(", ")));
}
else
row.addCell().addContent("-");
else
{
row.addCell().addContent("-");
}
if (group != sourceGroup)
row.addCell().addButton("submit_group_id_"+groupID).setValue(T_set_group);
{
row.addCell().addButton("submit_group_id_" + groupID).setValue(T_set_group);
}
else
row.addCell().addContent(T_current_group);
{
row.addCell().addContent(T_current_group);
}
}
if (groups.length <= 0) {

View File

@@ -166,9 +166,13 @@ public class EditCollectionHarvestingForm extends AbstractDSpaceTransformer
String displayName;
if (metadataString.indexOf(',') != -1)
displayName = metadataString.substring(metadataString.indexOf(',') + 1);
{
displayName = metadataString.substring(metadataString.indexOf(',') + 1);
}
else
displayName = metadataFormatValue + "(" + metadataString + ")";
{
displayName = metadataFormatValue + "(" + metadataString + ")";
}
settings.addItem(displayName);

View File

@@ -207,7 +207,9 @@ public class EditCollectionMetadataForm extends AbstractDSpaceTransformer
item = metadataList.addItem();
if (thisCollection.getTemplateItem() == null)
item.addButton("submit_create_template").setValue(T_submit_create_template);
{
item.addButton("submit_create_template").setValue(T_submit_create_template);
}
else
{
item.addButton("submit_edit_template").setValue(T_submit_edit_template);

View File

@@ -250,9 +250,13 @@ public class EditEPersonForm extends AbstractDSpaceTransformer
email.setLabel(T_email_address);
email.setValue(emailValue);
if (errors.contains("eperson_email_key"))
email.addError(T_error_email_unique);
{
email.addError(T_error_email_unique);
}
else if (errors.contains("email_address"))
email.addError(T_error_email);
{
email.addError(T_error_email);
}
}
else
{
@@ -348,13 +352,21 @@ public class EditEPersonForm extends AbstractDSpaceTransformer
hi.addContent(", ");
if ("item".equals(constraint))
hi.addContent(T_constraint_item);
{
hi.addContent(T_constraint_item);
}
else if ("workflowitem".equals(constraint))
hi.addContent(T_constraint_workflowitem);
{
hi.addContent(T_constraint_workflowitem);
}
else if ("tasklistitem".equals(constraint))
hi.addContent(T_constraint_tasklistitem);
{
hi.addContent(T_constraint_tasklistitem);
}
else
hi.addContent(T_constraint_unknown);
{
hi.addContent(T_constraint_unknown);
}
}
hi.addContent(".");

View File

@@ -222,16 +222,22 @@ public class ManageEPeopleMain extends AbstractDSpaceTransformer
Row row;
if (person.getID() == highlightID)
// This is a highlighted eperson
row = table.addRow(null, null, "highlight");
{
// This is a highlighted eperson
row = table.addRow(null, null, "highlight");
}
else
row = table.addRow();
{
row = table.addRow();
}
selectEPerson = row.addCell().addCheckBox("select_eperson");
selectEPerson.setLabel(epersonID);
selectEPerson.addOption(epersonID);
if (deleteConstraints != null && deleteConstraints.size() > 0)
selectEPerson.setDisabled();
{
selectEPerson.setDisabled();
}
row.addCellContent(epersonID);

View File

@@ -239,12 +239,16 @@ public class EditGroupForm extends AbstractDSpaceTransformer
{
int collectionID = FlowGroupUtils.getCollectionId(group.getName());
if (collectionID > -1)
collection = Collection.find(context, collectionID);
{
collection = Collection.find(context, collectionID);
}
else
{
int communityID = FlowGroupUtils.getCommunityId(group.getName());
if (communityID > -1)
community = Community.find(context, communityID);
{
community = Community.find(context, communityID);
}
}
}
@@ -297,9 +301,13 @@ public class EditGroupForm extends AbstractDSpaceTransformer
//DIVISION: group-edit
Division main = body.addInteractiveDivision("group-edit",contextPath+"/admin/groups",Division.METHOD_POST,"primary administrative groups");
if (group == null)
main.setHead(T_main_head_new);
{
main.setHead(T_main_head_new);
}
else
main.setHead(T_main_head.parameterize(group.getName(),groupID));
{
main.setHead(T_main_head.parameterize(group.getName(), groupID));
}
if(collection != null)
@@ -427,9 +435,13 @@ public class EditGroupForm extends AbstractDSpaceTransformer
{
// Check if they really members or just pending members
if (group != null && group.isMember(person))
personData.addCellContent(T_member);
{
personData.addCellContent(T_member);
}
else
personData.addCell().addHighlight("warn").addContent(T_pending);
{
personData.addCell().addHighlight("warn").addContent(T_pending);
}
}
else
{
@@ -492,9 +504,13 @@ public class EditGroupForm extends AbstractDSpaceTransformer
row.addCell().addContent(groupID);
if (AuthorizeManager.isAdmin(context))
// Only administrators can edit other groups.
row.addCell().addXref(url,name);
{
row.addCell().addXref(url, name);
}
else
row.addCell().addContent(name);
{
row.addCell().addContent(name);
}
@@ -509,9 +525,13 @@ public class EditGroupForm extends AbstractDSpaceTransformer
String collectionName = collection.getMetadata("name");
if (collectionName == null)
collectionName = "";
{
collectionName = "";
}
else if (collectionName.length() > MAX_COLLECTION_NAME)
collectionName = collectionName.substring(0,MAX_COLLECTION_NAME-3) + "...";
{
collectionName = collectionName.substring(0, MAX_COLLECTION_NAME - 3) + "...";
}
cell.addContent(collectionName+" ");
@@ -528,9 +548,13 @@ public class EditGroupForm extends AbstractDSpaceTransformer
{
// Check if they really members or just pending members
if (parent != null && parent.isMember(group))
row.addCellContent(T_member);
{
row.addCellContent(T_member);
}
else
row.addCell().addHighlight("warn").addContent(T_pending);
{
row.addCell().addHighlight("warn").addContent(T_pending);
}
}
else if (isDescendant(sourceGroup, group, memberGroupIDs))
{
@@ -691,9 +715,13 @@ public class EditGroupForm extends AbstractDSpaceTransformer
// Mark if this member is pending or not.
Cell nameCell = groupData.addCell();
if (AuthorizeManager.isAdmin(context))
nameCell.addHighlight("bold").addXref(url,T_members_group_name.parameterize(name));
{
nameCell.addHighlight("bold").addXref(url, T_members_group_name.parameterize(name));
}
else
nameCell.addHighlight("bold").addContent(T_members_group_name.parameterize(name));
{
nameCell.addHighlight("bold").addContent(T_members_group_name.parameterize(name));
}
if (pendingAddition)
{
@@ -704,9 +732,13 @@ public class EditGroupForm extends AbstractDSpaceTransformer
groupData.addCell().addContent("-");
if (pendingRemoval)
groupData.addCell().addHighlight("warn").addContent(T_pending);
{
groupData.addCell().addHighlight("warn").addContent(T_pending);
}
else
groupData.addCell().addButton("submit_remove_group_"+group.getID()).setValue(T_submit_remove);
{
groupData.addCell().addButton("submit_remove_group_" + group.getID()).setValue(T_submit_remove);
}
}
/**
@@ -740,8 +772,12 @@ public class EditGroupForm extends AbstractDSpaceTransformer
personData.addCell().addXref(url, email);
if (pendingRemoval)
personData.addCell().addHighlight("warn").addContent(T_pending);
{
personData.addCell().addHighlight("warn").addContent(T_pending);
}
else
personData.addCell().addButton("submit_remove_eperson_"+eperson.getID()).setValue(T_submit_remove);
{
personData.addCell().addButton("submit_remove_eperson_" + eperson.getID()).setValue(T_submit_remove);
}
}
}

View File

@@ -224,9 +224,13 @@ public class ManageGroupsMain extends AbstractDSpaceTransformer
{
Row row;
if (group.getID() == highlightID)
row = table.addRow(null,null,"highlight");
{
row = table.addRow(null, null, "highlight");
}
else
row = table.addRow();
{
row = table.addRow();
}
if (group.getID() > 1)
{
@@ -278,9 +282,13 @@ public class ManageGroupsMain extends AbstractDSpaceTransformer
if (collectionOrCommunity != null)
{
if (collectionOrCommunityName == null)
{
collectionOrCommunityName = "";
}
else if (collectionOrCommunityName.length() > MAX_COLLECTION_OR_COMMUNITY_NAME)
collectionOrCommunityName = collectionOrCommunityName.substring(0,MAX_COLLECTION_OR_COMMUNITY_NAME-3) + "...";
{
collectionOrCommunityName = collectionOrCommunityName.substring(0, MAX_COLLECTION_OR_COMMUNITY_NAME - 3) + "...";
}
cell.addContent(collectionOrCommunityName + " ");

View File

@@ -169,9 +169,13 @@ public class EditBitstreamForm extends AbstractDSpaceTransformer
continue;
String supportLevel = "Unknown";
if (bitstreamFormat.getSupportLevel() == BitstreamFormat.KNOWN)
supportLevel = "known";
{
supportLevel = "known";
}
else if (bitstreamFormat.getSupportLevel() == BitstreamFormat.SUPPORTED)
supportLevel = "Supported";
{
supportLevel = "Supported";
}
String name = bitstreamFormat.getShortDescription()+" ("+supportLevel+")";
if (bitstreamFormat.isInternal())
name += " (Internal)";

View File

@@ -235,7 +235,9 @@ public class EditItemBitstreamsForm extends AbstractDSpaceTransformer {
Para actions = main.addPara("editItemActionsP","editItemActionsP" );
// Only System Administrators can delete bitstreams
if (AuthorizeManager.authorizeActionBoolean(context, item, Constants.REMOVE))
actions.addButton("submit_delete").setValue(T_submit_delete);
{
actions.addButton("submit_delete").setValue(T_submit_delete);
}
else
{
Button button = actions.addButton("submit_delete");

View File

@@ -167,9 +167,13 @@ public class MapperMain extends AbstractDSpaceTransformer {
Item item = iterator.next();
if (item.isOwningCollection(collection))
{
count_native++;
}
else
{
count_import++;
}
}
}
finally

View File

@@ -186,9 +186,13 @@ public class EditBitstreamFormat extends AbstractDSpaceTransformer
// DIVISION: edit-bitstream-format
Division main = body.addInteractiveDivision("edit-bitstream-format",contextPath+"/admin/format-registry",Division.METHOD_POST,"primary administrative format-registry");
if (formatID == -1)
main.setHead(T_head1);
{
main.setHead(T_head1);
}
else
main.setHead(T_head2.parameterize(nameValue));
{
main.setHead(T_head2.parameterize(nameValue));
}
main.addPara(T_para1);
List form = main.addList("edit-bitstream-format",List.TYPE_FORM);
@@ -200,7 +204,9 @@ public class EditBitstreamFormat extends AbstractDSpaceTransformer
name.setValue(nameValue);
name.setSize(35);
if (errors.contains("short_description"))
name.addError(T_name_error);
{
name.addError(T_name_error);
}
Text mimeType = form.addItem().addText("mimetype");
mimeType.setLabel(T_mimetype);
@@ -210,7 +216,9 @@ public class EditBitstreamFormat extends AbstractDSpaceTransformer
// Do not allow anyone to change the name of the unknown format.
if (format != null && format.getID() == 1)
name.setDisabled();
{
name.setDisabled();
}
TextArea description = form.addItem().addTextArea("description");
description.setLabel(T_description);

View File

@@ -175,11 +175,15 @@ public class EditMetadataSchema extends AbstractDSpaceTransformer
// DIVISION: add or updating a metadata field
if (updateID >= 0)
// Updating an existing field
addUpdateFieldForm(main, schemaName, updateID, errors);
{
// Updating an existing field
addUpdateFieldForm(main, schemaName, updateID, errors);
}
else
// Add a new field
addNewFieldForm(main, schemaName, errors);
{
// Add a new field
addNewFieldForm(main, schemaName, errors);
}
@@ -215,9 +219,13 @@ public class EditMetadataSchema extends AbstractDSpaceTransformer
Row row;
if (highlight)
row = table.addRow(null,null,"highlight");
{
row = table.addRow(null, null, "highlight");
}
else
row = table.addRow();
{
row = table.addRow();
}
CheckBox select = row.addCell().addCheckBox("select_field");
select.setLabel(id);

View File

@@ -146,9 +146,13 @@ public class FormatRegistryMain extends AbstractDSpaceTransformer
Row row;
if (highlight)
row = table.addRow(null,null,"highlight");
{
row = table.addRow(null, null, "highlight");
}
else
row = table.addRow();
{
row = table.addRow();
}
// Select checkbox
Cell cell = row.addCell();

View File

@@ -180,9 +180,13 @@ public class ItemViewer extends AbstractDSpaceTransformer implements CacheablePr
String title = getItemTitle(item);
if (title != null)
{
pageMeta.addMetadata("title").addContent(title);
}
else
{
pageMeta.addMetadata("title").addContent(item.getHandle());
}
pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
HandleUtil.buildHandleTrail(item,pageMeta,contextPath);
@@ -256,9 +260,13 @@ public class ItemViewer extends AbstractDSpaceTransformer implements CacheablePr
Division division = body.addDivision("item-view","primary");
String title = getItemTitle(item);
if (title != null)
{
division.setHead(title);
}
else
{
division.setHead(item.getHandle());
}
Para showfullPara = division.addPara(null, "item-view-toggle item-view-toggle-top");
@@ -333,9 +341,13 @@ public class ItemViewer extends AbstractDSpaceTransformer implements CacheablePr
String title;
if (titles != null && titles.length > 0)
{
title = titles[0].value;
}
else
{
title = null;
}
return title;
}

View File

@@ -104,8 +104,12 @@ public class EPersonUtils
private static String render(int givenStep, int step)
{
if (givenStep == step)
{
return "current";
}
else
{
return null;
}
}
}

View File

@@ -217,28 +217,42 @@ public class EditProfile extends AbstractDSpaceTransformer
String errors = parameters.getParameter("errors","");
if (errors.length() > 0)
{
this.errors = Arrays.asList(errors.split(","));
}
else
{
this.errors = new ArrayList<String>();
}
// Ensure that the email variable is set.
if (eperson != null)
{
this.email = eperson.getEmail();
}
}
public void addPageMeta(PageMeta pageMeta) throws WingException
{
// Set the page title
if (registering)
{
pageMeta.addMetadata("title").addContent(T_title_create);
}
else
{
pageMeta.addMetadata("title").addContent(T_title_update);
}
pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
if (registering)
{
pageMeta.addTrail().addContent(T_trail_new_registration);
}
else
{
pageMeta.addTrail().addContent(T_trail_update);
}
}
@@ -268,9 +282,13 @@ public class EditProfile extends AbstractDSpaceTransformer
String action = contextPath;
if (registering)
{
action += "/register";
}
else
{
action += "/profile";
}
@@ -279,13 +297,19 @@ public class EditProfile extends AbstractDSpaceTransformer
action,Division.METHOD_POST,"primary");
if (registering)
{
profile.setHead(T_head_create);
}
else
{
profile.setHead(T_head_update);
}
// Add the progress list if we are registering a new user
if (registering)
EPersonUtils.registrationProgressList(profile,2);
{
EPersonUtils.registrationProgressList(profile, 2);
}
@@ -425,9 +449,13 @@ public class EditProfile extends AbstractDSpaceTransformer
Button submit = form.addItem().addButton("submit");
if (registering)
{
submit.setValue(T_submit_update);
}
else
{
submit.setValue(T_submit_create);
}
profile.addHidden("eperson-continue").setValue(knot.getId());
@@ -441,7 +469,9 @@ public class EditProfile extends AbstractDSpaceTransformer
// Not a member of any groups then don't do anything.
if (!(memberships.length > 0))
return;
{
return;
}
List list = profile.addList("memberships");
list.setHead(T_head_auth);

View File

@@ -111,11 +111,15 @@ public class LDAPLogin extends AbstractDSpaceTransformer implements
// cachable
if (header == null && message == null && characters == null
&& previous_username == null)
// cacheable
return "1";
{
// cacheable
return "1";
}
else
// Uncachable
return "0";
{
// Uncachable
return "0";
}
}
/**
@@ -138,11 +142,15 @@ public class LDAPLogin extends AbstractDSpaceTransformer implements
// cachable
if (header == null && message == null && characters == null
&& previous_username == null)
// Always valid
return NOPValidity.SHARED_INSTANCE;
{
// Always valid
return NOPValidity.SHARED_INSTANCE;
}
else
// invalid
return null;
{
// invalid
return null;
}
}
/**
@@ -177,10 +185,14 @@ public class LDAPLogin extends AbstractDSpaceTransformer implements
Division reason = body.addDivision("login-reason");
if (header != null)
reason.setHead(message(header));
{
reason.setHead(message(header));
}
else
// Allways have a head.
reason.setHead("Authentication Required");
{
// Always have a head.
reason.setHead("Authentication Required");
}
if (message != null)
reason.addPara(message(message));

View File

@@ -108,11 +108,15 @@ public class LoginChooser extends AbstractDSpaceTransformer implements
// cachable
if (header == null && message == null && characters == null
&& previous_email == null)
// cacheable
return "1";
{
// cacheable
return "1";
}
else
// Uncachable
return "0";
{
// Uncachable
return "0";
}
}
/**
@@ -135,11 +139,15 @@ public class LoginChooser extends AbstractDSpaceTransformer implements
// cachable
if (header == null && message == null && characters == null
&& previous_email == null)
// Always valid
return NOPValidity.SHARED_INSTANCE;
{
// Always valid
return NOPValidity.SHARED_INSTANCE;
}
else
// invalid
return null;
{
// invalid
return null;
}
}
/**
@@ -174,10 +182,14 @@ public class LoginChooser extends AbstractDSpaceTransformer implements
Division reason = body.addDivision("login-reason");
if (header != null)
reason.setHead(message(header));
{
reason.setHead(message(header));
}
else
// Allways have a head.
reason.setHead("Authentication Required");
{
// Allways have a head.
reason.setHead("Authentication Required");
}
if (message != null)
reason.addPara(message(message));

View File

@@ -136,9 +136,13 @@ public class Navigation extends AbstractDSpaceTransformer implements CacheablePr
String key;
if (context.getCurrentUser() != null)
{
key = context.getCurrentUser().getEmail();
}
else
key = "anonymous";
{
key = "anonymous";
}
// Add the user's language
Enumeration locales = request.getLocales();

View File

@@ -106,22 +106,36 @@ public class NoticeTransformer extends AbstractDSpaceTransformer
String rend = "notice";
if ("netural".equals(outcome))
rend += " netural";
{
rend += " netural";
}
else if ("success".equals(outcome))
rend += " success";
{
rend += " success";
}
else if ("failure".equals(outcome))
rend += " failure";
{
rend += " failure";
}
Division div = body.addDivision("general-message",rend);
if ((header != null) && (!"".equals(header)))
div.setHead(message(header));
{
div.setHead(message(header));
}
else
div.setHead(T_head);
{
div.setHead(T_head);
}
if (message != null && message.length() > 0)
div.addPara(message(message));
{
div.addPara(message(message));
}
if (characters != null && characters.length() > 0)
div.addPara(characters);
{
div.addPara(characters);
}
}
}

View File

@@ -182,9 +182,13 @@ public class EditFileStep extends AbstractStep
{
String supportLevel = "Unknown";
if (bitstreamFormat.getSupportLevel() == BitstreamFormat.KNOWN)
supportLevel = "known";
{
supportLevel = "known";
}
else if (bitstreamFormat.getSupportLevel() == BitstreamFormat.SUPPORTED)
supportLevel = "Supported";
{
supportLevel = "Supported";
}
String name = bitstreamFormat.getShortDescription()+" ("+supportLevel+")";
int id = bitstreamFormat.getID();

View File

@@ -131,7 +131,9 @@ public class LicenseStep extends AbstractSubmissionStep
ccLicenseStep.setup(resolver, objectModel, src, parameters);
}
else
ccLicenseStep = null;
{
ccLicenseStep = null;
}
}

View File

@@ -101,14 +101,22 @@ public class InlineFormTest extends AbstractDSpaceTransformer
div.addPara("There are two options you can use to control how this page is generated. First is the help parameter, if this is present then help text will be provided for all fields. Next is the error parameter, if it is provided then all fields will be generated in error conditions.");
if (help)
div.addPara().addXref(makeURL(false,error),"Turn help OFF");
else
div.addPara().addXref(makeURL(true,error),"Turn help ON");
{
div.addPara().addXref(makeURL(false, error), "Turn help OFF");
}
else
{
div.addPara().addXref(makeURL(true, error), "Turn help ON");
}
if (error)
div.addPara().addXref(makeURL(help,false),"Turn errors OFF");
else
div.addPara().addXref(makeURL(help,true),"Turn errors ON");
{
div.addPara().addXref(makeURL(help, false), "Turn errors OFF");
}
else
{
div.addPara().addXref(makeURL(help, true), "Turn errors ON");
}
Division suited = body.addDivision("suited");

View File

@@ -294,7 +294,9 @@ public class DSpaceFeedGenerator extends AbstractGenerator
String source = ConfigurationManager.getProperty("recent.submissions.sort-option");
BrowserScope scope = new BrowserScope(context);
if (dso instanceof Collection)
scope.setCollection((Collection) dso);
{
scope.setCollection((Collection) dso);
}
else if (dso instanceof Community)
scope.setCommunity((Community) dso);
scope.setResultsPerPage(itemCount);

View File

@@ -166,14 +166,18 @@ public class DSpaceMETSGenerator extends AbstractGenerator
AbstractAdapter adapter = null;
if (handle != null)
{
// Specified using a regular handle.
DSpaceObject dso = HandleManager.resolveToObject(context, handle);
// Handles can be either items or containers.
if (dso instanceof Item)
adapter = new ItemAdapter(context, (Item) dso, contextPath);
// Specified using a regular handle.
DSpaceObject dso = HandleManager.resolveToObject(context, handle);
// Handles can be either items or containers.
if (dso instanceof Item)
{
adapter = new ItemAdapter(context, (Item) dso, contextPath);
}
else if (dso instanceof Collection || dso instanceof Community)
adapter = new ContainerAdapter(context, dso, contextPath);
{
adapter = new ContainerAdapter(context, dso, contextPath);
}
}
else if (internal != null)
{

View File

@@ -122,9 +122,13 @@ public class DSpaceOREGenerator extends AbstractGenerator
// Handles can be either items or containers.
if (dso instanceof Item)
return (Item)dso;
{
return (Item) dso;
}
else
throw new CrosswalkException("ORE dissemination only available for DSpace Items.");
{
throw new CrosswalkException("ORE dissemination only available for DSpace Items.");
}
}
else if (internal != null)
{
@@ -141,7 +145,9 @@ public class DSpaceOREGenerator extends AbstractGenerator
return Item.find(context,id);
}
else
throw new CrosswalkException("ORE dissemination only available for DSpace Items.");
{
throw new CrosswalkException("ORE dissemination only available for DSpace Items.");
}
}
}

View File

@@ -82,9 +82,13 @@ public class NamespaceFilterTransformer extends AbstractTransformer implements C
*/
public Serializable getKey() {
if (filterNamespace != null)
return filterNamespace;
else
return "1";
{
return filterNamespace;
}
else
{
return "1";
}
}

View File

@@ -169,9 +169,13 @@ public class ItemAdapter extends AbstractAdapter
protected String getMETSID()
{
if (item.getHandle() == null)
return "item:"+item.getID();
{
return "item:" + item.getID();
}
else
return "hdl:"+item.getHandle();
{
return "hdl:" + item.getHandle();
}
}
/**
@@ -212,9 +216,13 @@ public class ItemAdapter extends AbstractAdapter
protected String getAmdSecID(String admSecName, String mdType, DSpaceObject dso)
{
if (dso.getType() == Constants.BITSTREAM)
return admSecName + "_" + getFileID((Bitstream)dso) + "_" + mdType;
{
return admSecName + "_" + getFileID((Bitstream) dso) + "_" + mdType;
}
else
return admSecName + "_" + dso.getID() + "_" + mdType;
{
return admSecName + "_" + dso.getID() + "_" + mdType;
}
}
/**
@@ -581,17 +589,25 @@ public class ItemAdapter extends AbstractAdapter
// Add this to our list of each file's administrative section IDs
String fileID = getFileID((Bitstream) dso);
if(fileAmdSecIDs.containsKey(fileID))
fileAmdSecIDs.get(fileID).append(" " + amdSecID);
{
fileAmdSecIDs.get(fileID).append(" " + amdSecID);
}
else
fileAmdSecIDs.put(fileID, new StringBuffer(amdSecID));
{
fileAmdSecIDs.put(fileID, new StringBuffer(amdSecID));
}
}//else if an Item
else if (dso.getType() == Constants.ITEM)
{
//Add this to our list of item's administrative section IDs
if(amdSecIDS==null)
amdSecIDS = new StringBuffer(amdSecID);
{
amdSecIDS = new StringBuffer(amdSecID);
}
else
amdSecIDS.append(" " + amdSecID);
{
amdSecIDS.append(" " + amdSecID);
}
}
////////////////////////////////
@@ -889,7 +905,9 @@ public class ItemAdapter extends AbstractAdapter
// the all bundles.
List<Bundle> bundles;
if (fileGrpTypes.size() == 0)
bundles = Arrays.asList(item.getBundles());
{
bundles = Arrays.asList(item.getBundles());
}
else
{
bundles = new ArrayList<Bundle>();

View File

@@ -227,18 +227,26 @@ public class HandleUtil
Collection collection = (Collection) pop;
String name = collection.getMetadata("name");
if (name == null || name.length() == 0)
pageMeta.addTrailLink(contextPath + "/handle/" + pop.getHandle(), new Message("default","xmlui.general.untitled") );
{
pageMeta.addTrailLink(contextPath + "/handle/" + pop.getHandle(), new Message("default", "xmlui.general.untitled"));
}
else
pageMeta.addTrailLink(contextPath + "/handle/" + pop.getHandle(), name);
{
pageMeta.addTrailLink(contextPath + "/handle/" + pop.getHandle(), name);
}
}
else if (pop instanceof Community)
{
Community community = (Community) pop;
String name = community.getMetadata("name");
if (name == null || name.length() == 0)
pageMeta.addTrailLink(contextPath + "/handle/" + pop.getHandle(), new Message("default","xmlui.general.untitled") );
{
pageMeta.addTrailLink(contextPath + "/handle/" + pop.getHandle(), new Message("default", "xmlui.general.untitled"));
}
else
pageMeta.addTrailLink(contextPath + "/handle/" + pop.getHandle(), name);
{
pageMeta.addTrailLink(contextPath + "/handle/" + pop.getHandle(), name);
}
}
}

View File

@@ -177,17 +177,23 @@ public class Include extends AbstractTransformer implements CacheableProcessingC
{
if (source.exists())
// The file exists so return it's validity.
return source.getValidity();
{
return source.getValidity();
}
else
{
// The file does not exist so we will just return always valid. This
// will have an nastly side effect that if a file is removed from a
// running system the cache will remain valid. However if the other
// option is to always invalidate the cache if the file is not present
// which is not desirable either.
return NOPValidity.SHARED_INSTANCE;
return NOPValidity.SHARED_INSTANCE;
}
}
else
{
return null;
}
}
@@ -253,7 +259,9 @@ public class Include extends AbstractTransformer implements CacheableProcessingC
// or not found in startDocument()
}
else if (stack.size() == 0)
{
stack.push(w3cDocument.getDocumentElement());
}
else
{
Element peek = stack.peek();