[DS-707] Style / readability improvements

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5555 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Graham Triggs
2010-10-22 16:49:20 +00:00
parent 41e98d3730
commit bed5b7249f
51 changed files with 510 additions and 88 deletions

View File

@@ -160,12 +160,22 @@ public class CreateAdministrator
System.out.print("First name: "); System.out.print("First name: ");
System.out.flush(); System.out.flush();
firstName = input.readLine().trim(); firstName = input.readLine();
if (firstName != null)
{
firstName = firstName.trim();
}
System.out.print("Last name: "); System.out.print("Last name: ");
System.out.flush(); System.out.flush();
lastName = input.readLine().trim(); lastName = input.readLine();
if (lastName != null)
{
lastName = lastName.trim();
}
if (ConfigurationManager.getProperty("webui.supported.locales") != null) if (ConfigurationManager.getProperty("webui.supported.locales") != null)
{ {
@@ -173,7 +183,13 @@ public class CreateAdministrator
System.out.print("Language: "); System.out.print("Language: ");
System.out.flush(); System.out.flush();
language = input.readLine().trim(); language = input.readLine();
if (language != null)
{
language = language.trim();
}
language = I18nUtil.getSupportedLocale(new Locale(language)).getLanguage(); language = I18nUtil.getSupportedLocale(new Locale(language)).getLanguage();
} }
@@ -181,12 +197,22 @@ public class CreateAdministrator
System.out.print("Password: "); System.out.print("Password: ");
System.out.flush(); System.out.flush();
password1 = input.readLine().trim(); password1 = input.readLine();
if (password1 != null)
{
password1 = password1.trim();
}
System.out.print("Again to confirm: "); System.out.print("Again to confirm: ");
System.out.flush(); System.out.flush();
password2 = input.readLine().trim(); password2 = input.readLine();
if (password2 != null)
{
password2 = password2.trim();
}
if (!password1.equals("") && password1.equals(password2)) if (!password1.equals("") && password1.equals(password2))
{ {
@@ -194,7 +220,12 @@ public class CreateAdministrator
System.out.print("Is the above data correct? (y or n): "); System.out.print("Is the above data correct? (y or n): ");
System.out.flush(); System.out.flush();
String s = input.readLine().trim(); String s = input.readLine();
if (s != null)
{
s = s.trim();
}
if (s.toLowerCase().startsWith("y")) if (s.toLowerCase().startsWith("y"))
{ {

View File

@@ -152,9 +152,13 @@ public class DailyFileAppender extends FileAppender
{ {
this.mstrDatePattern = checkPattern(pstrPattern); this.mstrDatePattern = checkPattern(pstrPattern);
if (mstrDatePattern.contains("dd") || mstrDatePattern.contains("DD")) if (mstrDatePattern.contains("dd") || mstrDatePattern.contains("DD"))
{
mMonthOnly = false; mMonthOnly = false;
}
else else
{
mMonthOnly = true; mMonthOnly = true;
}
} }
public void setFile(String file) public void setFile(String file)

View File

@@ -320,9 +320,13 @@ public class AuthenticationManager
// request, and most sites will only have 0 or 1 auth methods // request, and most sites will only have 0 or 1 auth methods
// actually returning groups, so it pays.. // actually returning groups, so it pays..
if (totalLen == 0) if (totalLen == 0)
{
return new int[0]; return new int[0];
}
else if (gll.size() == 1) else if (gll.size() == 1)
return (int [])gll.get(0); {
return (int[]) gll.get(0);
}
else else
{ {
// Have to do it this painful way since list.toArray() doesn't // Have to do it this painful way since list.toArray() doesn't

View File

@@ -532,16 +532,24 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
if (ConfigurationManager.getBooleanProperty("webui.browse.metadata.case-insensitive", false)) if (ConfigurationManager.getBooleanProperty("webui.browse.metadata.case-insensitive", false))
{ {
if (isValueColumnClob()) if (isValueColumnClob())
{
select = select + " WHERE UPPER(TO_CHAR(value))=UPPER(?)"; select = select + " WHERE UPPER(TO_CHAR(value))=UPPER(?)";
}
else else
{
select = select + " WHERE UPPER(value)=UPPER(?)"; select = select + " WHERE UPPER(value)=UPPER(?)";
}
} }
else else
{ {
if (isValueColumnClob()) if (isValueColumnClob())
{
select = select + " WHERE TO_CHAR(value)=?"; select = select + " WHERE TO_CHAR(value)=?";
}
else else
{
select = select + " WHERE value=?"; select = select + " WHERE value=?";
}
} }
if (authority != null) if (authority != null)

View File

@@ -888,9 +888,13 @@ public class BrowseDAOOracle implements BrowseDAO
{ {
queryBuf.append("rec WHERE rownum<=? "); queryBuf.append("rec WHERE rownum<=? ");
if (offset > 0) if (offset > 0)
{
params.add(Integer.valueOf(limit + offset)); params.add(Integer.valueOf(limit + offset));
}
else else
{
params.add(Integer.valueOf(limit)); params.add(Integer.valueOf(limit));
}
} }
if (offset > 0) if (offset > 0)

View File

@@ -664,9 +664,13 @@ public class BrowseIndex
else else
{ {
if (sortOption != null) if (sortOption != null)
{
focusField = "sort_" + sortOption.getNumber(); focusField = "sort_" + sortOption.getNumber();
}
else else
{
focusField = "sort_1"; // Use the first sort column focusField = "sort_1"; // Use the first sort column
}
} }
return focusField; return focusField;

View File

@@ -311,9 +311,13 @@ public final class BitstreamInfoDAO extends DAOSupport
LOG.debug("updating missing bitstreams"); LOG.debug("updating missing bitstreams");
conn = DatabaseManager.getConnection(); conn = DatabaseManager.getConnection();
if ("oracle".equals(ConfigurationManager.getProperty("db.name"))) if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
{
stmt = conn.prepareStatement(INSERT_MISSING_CHECKSUM_BITSTREAMS_ORACLE); stmt = conn.prepareStatement(INSERT_MISSING_CHECKSUM_BITSTREAMS_ORACLE);
}
else else
stmt = conn.prepareStatement(INSERT_MISSING_CHECKSUM_BITSTREAMS); {
stmt = conn.prepareStatement(INSERT_MISSING_CHECKSUM_BITSTREAMS);
}
stmt.setTimestamp(1, new java.sql.Timestamp(new Date().getTime())); stmt.setTimestamp(1, new java.sql.Timestamp(new Date().getTime()));
stmt.setTimestamp(2, new java.sql.Timestamp(new Date().getTime())); stmt.setTimestamp(2, new java.sql.Timestamp(new Date().getTime()));
stmt.executeUpdate(); stmt.executeUpdate();
@@ -425,9 +429,13 @@ public final class BitstreamInfoDAO extends DAOSupport
conn = DatabaseManager.getConnection(); conn = DatabaseManager.getConnection();
if ("oracle".equals(ConfigurationManager.getProperty("db.name"))) if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
prepStmt = conn.prepareStatement(GET_OLDEST_BITSTREAM_ORACLE); {
prepStmt = conn.prepareStatement(GET_OLDEST_BITSTREAM_ORACLE);
}
else else
prepStmt = conn.prepareStatement(GET_OLDEST_BITSTREAM); {
prepStmt = conn.prepareStatement(GET_OLDEST_BITSTREAM);
}
rs = prepStmt.executeQuery(); rs = prepStmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
@@ -469,9 +477,13 @@ public final class BitstreamInfoDAO extends DAOSupport
{ {
conn = DatabaseManager.getConnection(); conn = DatabaseManager.getConnection();
if ("oracle".equals(ConfigurationManager.getProperty("db.name"))) if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
prepStmt = conn.prepareStatement(GET_OLDEST_BITSTREAM_DATE_ORACLE); {
prepStmt = conn.prepareStatement(GET_OLDEST_BITSTREAM_DATE_ORACLE);
}
else else
prepStmt = conn.prepareStatement(GET_OLDEST_BITSTREAM_DATE); {
prepStmt = conn.prepareStatement(GET_OLDEST_BITSTREAM_DATE);
}
prepStmt.setTimestamp(1, lessThanDate); prepStmt.setTimestamp(1, lessThanDate);
rs = prepStmt.executeQuery(); rs = prepStmt.executeQuery();
if (rs.next()) if (rs.next())

View File

@@ -137,14 +137,16 @@ public class ChecksumHistoryDAO extends DAOSupport
{ {
conn = DatabaseManager.getConnection(); conn = DatabaseManager.getConnection();
if ("oracle".equals(ConfigurationManager.getProperty("db.name"))) if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
stmt = conn.prepareStatement(INSERT_HISTORY_ORACLE); {
stmt = conn.prepareStatement(INSERT_HISTORY_ORACLE);
}
else else
stmt = conn.prepareStatement(INSERT_HISTORY); {
stmt = conn.prepareStatement(INSERT_HISTORY);
}
stmt.setInt(1, info.getBitstreamId()); stmt.setInt(1, info.getBitstreamId());
stmt.setTimestamp(2, new java.sql.Timestamp(info stmt.setTimestamp(2, new java.sql.Timestamp(info.getProcessStartDate().getTime()));
.getProcessStartDate().getTime())); stmt.setTimestamp(3, new java.sql.Timestamp(info.getProcessEndDate().getTime()));
stmt.setTimestamp(3, new java.sql.Timestamp(info
.getProcessEndDate().getTime()));
stmt.setString(4, info.getStoredChecksum()); stmt.setString(4, info.getStoredChecksum());
stmt.setString(5, info.getCalculatedChecksum()); stmt.setString(5, info.getCalculatedChecksum());
stmt.setString(6, info.getChecksumCheckResult()); stmt.setString(6, info.getChecksumCheckResult());
@@ -210,9 +212,13 @@ public class ChecksumHistoryDAO extends DAOSupport
try try
{ {
if ("oracle".equals(ConfigurationManager.getProperty("db.name"))) if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
stmt = conn.prepareStatement(INSERT_MISSING_HISTORY_BITSTREAMS_ORACLE); {
stmt = conn.prepareStatement(INSERT_MISSING_HISTORY_BITSTREAMS_ORACLE);
}
else else
stmt = conn.prepareStatement(INSERT_MISSING_HISTORY_BITSTREAMS); {
stmt = conn.prepareStatement(INSERT_MISSING_HISTORY_BITSTREAMS);
}
stmt.executeUpdate(); stmt.executeUpdate();
} }
catch (SQLException e) catch (SQLException e)

View File

@@ -449,13 +449,21 @@ public class DCDate
private synchronized String toStringInternal() private synchronized String toStringInternal()
{ {
if (granularity == DateGran.YEAR) if (granularity == DateGran.YEAR)
{
return String.format("%4d", getYearUTC()); return String.format("%4d", getYearUTC());
}
else if (granularity == DateGran.MONTH) else if (granularity == DateGran.MONTH)
{
return String.format("%4d-%02d", getYearUTC(), getMonthUTC()); return String.format("%4d-%02d", getYearUTC(), getMonthUTC());
}
else if (granularity == DateGran.DAY) else if (granularity == DateGran.DAY)
{
return String.format("%4d-%02d-%02d", getYearUTC(), getMonthUTC(), getDayUTC()); return String.format("%4d-%02d-%02d", getYearUTC(), getMonthUTC(), getDayUTC());
}
else else
{
return fullIso.format(calendar.getTime()); return fullIso.format(calendar.getTime());
}
} }
/** /**
@@ -466,9 +474,13 @@ public class DCDate
public Date toDate() public Date toDate()
{ {
if (calendar == null) if (calendar == null)
{
return null; return null;
}
else else
{
return calendar.getTime(); return calendar.getTime();
}
} }
/** /**

View File

@@ -140,7 +140,9 @@ public class ChoiceAuthorityManager
closed.put(fkey, Boolean.valueOf(ConfigurationManager.getBooleanProperty(key))); closed.put(fkey, Boolean.valueOf(ConfigurationManager.getBooleanProperty(key)));
} }
else else
log.error("Illegal configuration property: "+key); {
log.error("Illegal configuration property: " + key);
}
} }
} }
} }

View File

@@ -127,7 +127,9 @@ public class DCInputAuthority extends SelfNamedPlugin implements ChoiceAuthority
log.debug("Found pairs for name="+pname); log.debug("Found pairs for name="+pname);
} }
else else
log.error("Failed to find any pairs for name="+pname, new IllegalStateException()); {
log.error("Failed to find any pairs for name=" + pname, new IllegalStateException());
}
} }
} }

View File

@@ -381,7 +381,9 @@ public class AIPTechMDCrosswalk
// if we get <dim> in a list, recurse. // if we get <dim> in a list, recurse.
if (field.getName().equals("dim") && field.getNamespace().equals(XSLTCrosswalk.DIM_NS)) if (field.getName().equals("dim") && field.getNamespace().equals(XSLTCrosswalk.DIM_NS))
{
ingest(context, dso, field.getChildren()); ingest(context, dso, field.getChildren());
}
else if (field.getName().equals("field") && field.getNamespace().equals(XSLTCrosswalk.DIM_NS)) else if (field.getName().equals("field") && field.getNamespace().equals(XSLTCrosswalk.DIM_NS))
{ {
String schema = field.getAttributeValue("mdschema"); String schema = field.getAttributeValue("mdschema");
@@ -426,16 +428,22 @@ public class AIPTechMDCrosswalk
{ {
int sl = BitstreamFormat.getSupportLevelID(value); int sl = BitstreamFormat.getSupportLevelID(value);
if (sl < 0) if (sl < 0)
throw new MetadataValidationException("Got unrecognized value for bitstream support level: "+value); {
throw new MetadataValidationException("Got unrecognized value for bitstream support level: " + value);
}
else else
{
bsfSupport = sl; bsfSupport = sl;
}
} }
else if (dcField.equals("format.internal")) else if (dcField.equals("format.internal"))
{ {
bsfInternal = (Boolean.valueOf(value)).booleanValue(); bsfInternal = (Boolean.valueOf(value)).booleanValue();
} }
else else
log.warn("Got unrecognized DC field for Bitstream: "+dcField); {
log.warn("Got unrecognized DC field for Bitstream: " + dcField);
}
} }
else if (type == Constants.ITEM) else if (type == Constants.ITEM)
{ {
@@ -462,7 +470,9 @@ public class AIPTechMDCrosswalk
sub.update(); sub.update();
} }
else else
log.warn("Ignoring unknown Submitter="+value+" in AIP Tech MD, no matching EPerson and 'mets.dspaceAIP.ingest.createSubmitter' is false in dspace.cfg."); {
log.warn("Ignoring unknown Submitter=" + value + " in AIP Tech MD, no matching EPerson and 'mets.dspaceAIP.ingest.createSubmitter' is false in dspace.cfg.");
}
} }
if (sub != null) if (sub != null)
{ {

View File

@@ -335,9 +335,13 @@ public abstract class AbstractMETSDisseminator
//actually add the file to the Zip package //actually add the file to the Zip package
ZipEntry ze = new ZipEntry(fname); ZipEntry ze = new ZipEntry(fname);
if (lmTime != 0) if (lmTime != 0)
{
ze.setTime(lmTime); ze.setTime(lmTime);
}
else //Set a default modified date so that checksum of Zip doesn't change if Zip contents are unchanged else //Set a default modified date so that checksum of Zip doesn't change if Zip contents are unchanged
{
ze.setTime(DEFAULT_MODIFIED_DATE); ze.setTime(DEFAULT_MODIFIED_DATE);
}
zip.putNextEntry(ze); zip.putNextEntry(ze);
Utils.copy(is, zip); Utils.copy(is, zip);
zip.closeEntry(); zip.closeEntry();
@@ -350,9 +354,13 @@ public abstract class AbstractMETSDisseminator
// write manifest after metadata. // write manifest after metadata.
ZipEntry me = new ZipEntry(METSManifest.MANIFEST_FILE); ZipEntry me = new ZipEntry(METSManifest.MANIFEST_FILE);
if (lmTime != 0) if (lmTime != 0)
{
me.setTime(lmTime); me.setTime(lmTime);
}
else //Set a default modified date so that checksum of Zip doesn't change if Zip contents are unchanged else //Set a default modified date so that checksum of Zip doesn't change if Zip contents are unchanged
{
me.setTime(DEFAULT_MODIFIED_DATE); me.setTime(DEFAULT_MODIFIED_DATE);
}
zip.putNextEntry(me); zip.putNextEntry(me);
@@ -407,7 +415,9 @@ public abstract class AbstractMETSDisseminator
continue; continue;
} }
else else
throw new AuthorizeException("Not authorized to read Bundle named \""+bundles[i].getName()+"\""); {
throw new AuthorizeException("Not authorized to read Bundle named \"" + bundles[i].getName() + "\"");
}
} }
Bitstream[] bitstreams = bundles[i].getBitstreams(); Bitstream[] bitstreams = bundles[i].getBitstreams();
for (int k = 0; k < bitstreams.length; k++) for (int k = 0; k < bitstreams.length; k++)
@@ -424,15 +434,23 @@ public abstract class AbstractMETSDisseminator
log.debug(new StringBuilder().append("Writing CONTENT stream of bitstream(").append(bitstreams[k].getID()).append(") to Zip: ").append(zname).append(", size=").append(bitstreams[k].getSize()).toString()); log.debug(new StringBuilder().append("Writing CONTENT stream of bitstream(").append(bitstreams[k].getID()).append(") to Zip: ").append(zname).append(", size=").append(bitstreams[k].getSize()).toString());
} }
if (lmTime != 0) if (lmTime != 0)
{
ze.setTime(lmTime); ze.setTime(lmTime);
}
else //Set a default modified date so that checksum of Zip doesn't change if Zip contents are unchanged else //Set a default modified date so that checksum of Zip doesn't change if Zip contents are unchanged
{
ze.setTime(DEFAULT_MODIFIED_DATE); ze.setTime(DEFAULT_MODIFIED_DATE);
}
ze.setSize(auth ? bitstreams[k].getSize() : 0); ze.setSize(auth ? bitstreams[k].getSize() : 0);
zip.putNextEntry(ze); zip.putNextEntry(ze);
if (auth) if (auth)
{
Utils.copy(bitstreams[k].retrieve(), zip); Utils.copy(bitstreams[k].retrieve(), zip);
}
else else
log.warn("Adding zero-length file for Bitstream, SID="+String.valueOf(bitstreams[k].getSequenceID())+", not authorized for READ."); {
log.warn("Adding zero-length file for Bitstream, SID=" + String.valueOf(bitstreams[k].getSequenceID()) + ", not authorized for READ.");
}
zip.closeEntry(); zip.closeEntry();
} }
else if (unauth != null && else if (unauth != null &&
@@ -549,7 +567,9 @@ public abstract class AbstractMETSDisseminator
xwalkName = parts[1]; xwalkName = parts[1];
} }
else else
{
xwalkName = metsName = typeSpec; xwalkName = metsName = 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
boolean xwalkFound = PluginManager.hasNamedPlugin(DisseminationCrosswalk.class, xwalkName); boolean xwalkFound = PluginManager.hasNamedPlugin(DisseminationCrosswalk.class, xwalkName);
@@ -583,10 +603,14 @@ public abstract class AbstractMETSDisseminator
return mdSec; return mdSec;
} }
else else
{
return null; return null;
}
} }
else else
{
return null; return null;
}
} }
// If we didn't find the correct crosswalk, we will check to see if this is // If we didn't find the correct crosswalk, we will check to see if this is
// a StreamDisseminationCrosswalk -- a Stream crosswalk disseminates to an OutputStream // a StreamDisseminationCrosswalk -- a Stream crosswalk disseminates to an OutputStream
@@ -649,13 +673,18 @@ public abstract class AbstractMETSDisseminator
mdWrap.getContent().add(binData); mdWrap.getContent().add(binData);
mdSec.getContent().add(mdWrap); mdSec.getContent().add(mdWrap);
} }
return mdSec; return mdSec;
} }
else else
{
return null; return null;
}
} }
else else
throw new PackageValidationException("Cannot find "+xwalkName+" crosswalk plugin, either DisseminationCrosswalk or StreamDisseminationCrosswalk"); {
throw new PackageValidationException("Cannot find " + xwalkName + " crosswalk plugin, either DisseminationCrosswalk or StreamDisseminationCrosswalk");
}
} }
} }
catch (InstantiationException e) catch (InstantiationException e)
@@ -715,7 +744,9 @@ public abstract class AbstractMETSDisseminator
return result; return result;
} }
else else
{
return null; return null;
}
} }
// make the most "persistent" identifier possible, preferably a URN // make the most "persistent" identifier possible, preferably a URN
@@ -726,9 +757,13 @@ public abstract class AbstractMETSDisseminator
// If no Handle, punt to much-less-satisfactory database ID and type.. // If no Handle, punt to much-less-satisfactory database ID and type..
if (handle == null) if (handle == null)
return "DSpace_DB_"+Constants.typeText[dso.getType()] + "_" + String.valueOf(dso.getID()); {
return "DSpace_DB_" + Constants.typeText[dso.getType()] + "_" + String.valueOf(dso.getID());
}
else else
{
return getHandleURN(handle); return getHandleURN(handle);
}
} }
/** /**
@@ -833,9 +868,13 @@ public abstract class AbstractMETSDisseminator
{ {
if (unauth != null && if (unauth != null &&
(unauth.equalsIgnoreCase("skip"))) (unauth.equalsIgnoreCase("skip")))
{
continue; continue;
}
else else
throw new AuthorizeException("Not authorized to read Bundle named \""+bundles[i].getName()+"\""); {
throw new AuthorizeException("Not authorized to read Bundle named \"" + bundles[i].getName() + "\"");
}
} }
Bitstream[] bitstreams = bundles[i].getBitstreams(); Bitstream[] bitstreams = bundles[i].getBitstreams();
@@ -1168,9 +1207,13 @@ public abstract class AbstractMETSDisseminator
} }
if(emptyDiv) if(emptyDiv)
{
return null; return null;
}
else else
{
return div; return div;
}
} }
// put handle in canonical URN format -- note that HandleManager's // put handle in canonical URN format -- note that HandleManager's
@@ -1246,9 +1289,13 @@ public abstract class AbstractMETSDisseminator
{ {
String uri = ns[i].getURI(); String uri = ns[i].getURI();
if (sloc != null && sloc.length > 1 && uri.equals(sloc[0])) if (sloc != null && sloc.length > 1 && uri.equals(sloc[0]))
{
me.setSchema(ns[i].getPrefix(), uri, sloc[1]); me.setSchema(ns[i].getPrefix(), uri, sloc[1]);
}
else else
{
me.setSchema(ns[i].getPrefix(), uri); me.setSchema(ns[i].getPrefix(), uri);
}
} }
// add result of crosswalk // add result of crosswalk

View File

@@ -505,9 +505,11 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
// Do nothing -- Crosswalks will handle anything necessary to ingest at Site-level // Do nothing -- Crosswalks will handle anything necessary to ingest at Site-level
} }
else else
{
throw new PackageValidationException( throw new PackageValidationException(
"Unknown DSpace Object type in package, type=" "Unknown DSpace Object type in package, type="
+ String.valueOf(type)); + String.valueOf(type));
}
// -- Step 5 -- // -- Step 5 --
// Run our Descriptive metadata (dublin core, etc) crosswalks! // Run our Descriptive metadata (dublin core, etc) crosswalks!
@@ -757,9 +759,13 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
Bundle bundle; Bundle bundle;
Bundle bns[] = item.getBundles(bundleName); Bundle bns[] = item.getBundles(bundleName);
if (bns != null && bns.length > 0) if (bns != null && bns.length > 0)
{
bundle = bns[0]; bundle = bns[0];
}
else else
{
bundle = item.createBundle(bundleName); bundle = item.createBundle(bundleName);
}
// Create the bitstream in the bundle & initialize its name // Create the bitstream in the bundle & initialize its name
Bitstream bitstream = bundle.createBitstream(fileStream); Bitstream bitstream = bundle.createBitstream(fileStream);
@@ -909,9 +915,13 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
// Add this logo to the Community/Collection // Add this logo to the Community/Collection
if (dso.getType() == Constants.COLLECTION) if (dso.getType() == Constants.COLLECTION)
{
((Collection) dso).setLogo(fileStream); ((Collection) dso).setLogo(fileStream);
}
else else
{
((Community) dso).setLogo(fileStream); ((Community) dso).setLogo(fileStream);
}
break; break;
} }
@@ -1029,8 +1039,10 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
} }
} }
else else
{
throw new UnsupportedOperationException( throw new UnsupportedOperationException(
"Could not find a parent DSpaceObject where we can ingest this package. A valid parent DSpaceObject must be specified in the METS Manifest itself."); "Could not find a parent DSpaceObject where we can ingest this package. A valid parent DSpaceObject must be specified in the METS Manifest itself.");
}
// As this object doesn't already exist, we will perform an // As this object doesn't already exist, we will perform an
// ingest of a new object in order to restore it // ingest of a new object in order to restore it
@@ -1128,9 +1140,13 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
protected String decodeHandleURN(String value) protected String decodeHandleURN(String value)
{ {
if (value != null && value.startsWith("hdl:")) if (value != null && value.startsWith("hdl:"))
{
return value.substring(4); return value.substring(4);
}
else else
{
return null; return null;
}
} }
/** /**
@@ -1244,8 +1260,10 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
} }
} }
else else
{
throw new UnsupportedOperationException( throw new UnsupportedOperationException(
"Could not find a parent DSpaceObject where we can ingest this package. A parent DSpaceObject must be specified from either the 'packager' command or noted in the METS Manifest itself."); "Could not find a parent DSpaceObject where we can ingest this package. A parent DSpaceObject must be specified from either the 'packager' command or noted in the METS Manifest itself.");
}
return parent; return parent;
} }

View File

@@ -160,7 +160,9 @@ public abstract class AbstractPackageIngester
log.warn(LogManager.getHeader(context, "skip_package_ingest", "Object already exists, package-skipped=" + pkgFile)); log.warn(LogManager.getHeader(context, "skip_package_ingest", "Object already exists, package-skipped=" + pkgFile));
} }
else // Pass this exception on -- which essentially causes a full rollback of all changes (this is the default) else // Pass this exception on -- which essentially causes a full rollback of all changes (this is the default)
{
throw ie; throw ie;
}
} }
//as long as our first object was ingested successfully //as long as our first object was ingested successfully

View File

@@ -899,7 +899,9 @@ public class ConfigurationManager
from = end+1; from = end+1;
} }
else else
{
break; break;
}
} }
if (result != null && from < value.length()) if (result != null && from < value.length())
{ {

View File

@@ -88,9 +88,13 @@ public class DefaultEmbargoSetter implements EmbargoSetter
if (terms != null && terms.length() > 0) if (terms != null && terms.length() > 0)
{ {
if (termsOpen.equals(terms)) if (termsOpen.equals(terms))
{
return EmbargoManager.FOREVER; return EmbargoManager.FOREVER;
}
else else
{
return new DCDate(terms); return new DCDate(terms);
}
} }
return null; return null;
} }

View File

@@ -123,12 +123,14 @@ public class ConsumerProfile
{ {
String fpart[] = part[j].split("\\+"); String fpart[] = part[j].split("\\+");
if (fpart.length != 2) if (fpart.length != 2)
{
log log
.error("Bad Filter clause in consumer stanza in Configuration entry for " .error("Bad Filter clause in consumer stanza in Configuration entry for "
+ CONSUMER_PREFIX + CONSUMER_PREFIX
+ name + name
+ ".consumers: " + ".consumers: "
+ part[j]); + part[j]);
}
else else
{ {
int filter[] = new int[2]; int filter[] = new int[2];
@@ -138,26 +140,34 @@ public class ConsumerProfile
{ {
int ot = Event.parseObjectType(objectNames[k]); int ot = Event.parseObjectType(objectNames[k]);
if (ot == 0) if (ot == 0)
{
log log
.error("Bad ObjectType in Consumer Stanza in Configuration entry for " .error("Bad ObjectType in Consumer Stanza in Configuration entry for "
+ CONSUMER_PREFIX + CONSUMER_PREFIX
+ name + name
+ ".consumers: " + objectNames[k]); + ".consumers: " + objectNames[k]);
}
else else
{
filter[Event.SUBJECT_MASK] |= ot; filter[Event.SUBJECT_MASK] |= ot;
}
} }
String eventNames[] = fpart[1].split("\\|"); String eventNames[] = fpart[1].split("\\|");
for (int k = 0; k < eventNames.length; ++k) for (int k = 0; k < eventNames.length; ++k)
{ {
int et = Event.parseEventType(eventNames[k]); int et = Event.parseEventType(eventNames[k]);
if (et == 0) if (et == 0)
{
log log
.error("Bad EventType in Consumer Stanza in Configuration entry for " .error("Bad EventType in Consumer Stanza in Configuration entry for "
+ CONSUMER_PREFIX + CONSUMER_PREFIX
+ name + name
+ ".consumers: " + eventNames[k]); + ".consumers: " + eventNames[k]);
}
else else
{
filter[Event.EVENT_MASK] |= et; filter[Event.EVENT_MASK] |= et;
}
} }
filters.add(filter); filters.add(filter);
} }

View File

@@ -115,9 +115,13 @@ public abstract class AbstractTextFilterOFD implements OrderFormatDelegate
for (int idx = 0; idx < filters.length; idx++) for (int idx = 0; idx < filters.length; idx++)
{ {
if (language != null) if (language != null)
value = filters[idx].filter(value, language); {
value = filters[idx].filter(value, language);
}
else else
value = filters[idx].filter(value); {
value = filters[idx].filter(value);
}
} }
} }

View File

@@ -1198,9 +1198,13 @@ public class DatabaseManager
// Otherwise, store it as long // Otherwise, store it as long
long longValue = results.getLong(i); long longValue = results.getLong(i);
if (longValue <= (long)Integer.MAX_VALUE) if (longValue <= (long)Integer.MAX_VALUE)
row.setColumn(name, (int)longValue); {
row.setColumn(name, (int) longValue);
}
else else
{
row.setColumn(name, longValue); row.setColumn(name, longValue);
}
} }
else else
{ // Not Oracle { // Not Oracle
@@ -1402,7 +1406,9 @@ public class DatabaseManager
{ {
// If we are using Oracle, we can pass in long values, so always do so. // If we are using Oracle, we can pass in long values, so always do so.
if ("oracle".equals(dbName)) if ("oracle".equals(dbName))
{
statement.setLong(count, row.getLongColumn(column)); statement.setLong(count, row.getLongColumn(column));
}
else else
{ // not Oracle { // not Oracle
if (jdbctype == Types.INTEGER) if (jdbctype == Types.INTEGER)

View File

@@ -190,9 +190,13 @@ public abstract class AbstractProcessingStep
private static final void setErrorFields(HttpServletRequest request, List errorFields) private static final void setErrorFields(HttpServletRequest request, List errorFields)
{ {
if(errorFields==null) if(errorFields==null)
{
request.removeAttribute(ERROR_FIELDS_ATTRIBUTE); request.removeAttribute(ERROR_FIELDS_ATTRIBUTE);
}
else else
{
request.setAttribute(ERROR_FIELDS_ATTRIBUTE, errorFields); request.setAttribute(ERROR_FIELDS_ATTRIBUTE, errorFields);
}
} }
/** /**
@@ -260,9 +264,13 @@ public abstract class AbstractProcessingStep
public final String getErrorMessage(int errorFlag) public final String getErrorMessage(int errorFlag)
{ {
if (this.errorMessages == null || this.errorMessages.size() == 0) if (this.errorMessages == null || this.errorMessages.size() == 0)
{
return null; return null;
}
else else
{
return (String) this.errorMessages.get(Integer.valueOf(errorFlag)); return (String) this.errorMessages.get(Integer.valueOf(errorFlag));
}
} }
/** /**

View File

@@ -126,9 +126,13 @@ public class CompleteStep extends AbstractProcessingStep
{ {
// commit changes to database // commit changes to database
if (success) if (success)
context.commit(); {
context.commit();
}
else else
{
context.getDBConnection().rollback(); context.getDBConnection().rollback();
}
} }
return STATUS_COMPLETE; return STATUS_COMPLETE;
} }

View File

@@ -610,14 +610,18 @@ public class DescribeStep extends AbstractProcessingStep
addErrorField(request, metadataField); addErrorField(request, metadataField);
} }
else else
{
item.addMetadata(schema, element, qualifier, null, item.addMetadata(schema, element, qualifier, null,
new DCPersonName(l, f).toString(), authKey, new DCPersonName(l, f).toString(), authKey,
(sconf != null && sconf.length() > 0) ? (sconf != null && sconf.length() > 0) ?
Choices.getConfidenceValue(sconf) : Choices.CF_ACCEPTED); Choices.getConfidenceValue(sconf) : Choices.CF_ACCEPTED);
}
} }
else else
{
item.addMetadata(schema, element, qualifier, null, item.addMetadata(schema, element, qualifier, null,
new DCPersonName(l, f).toString()); new DCPersonName(l, f).toString());
}
} }
} }
} }
@@ -738,12 +742,16 @@ public class DescribeStep extends AbstractProcessingStep
addErrorField(request, metadataField); addErrorField(request, metadataField);
} }
else else
{
item.addMetadata(schema, element, qualifier, lang, s, item.addMetadata(schema, element, qualifier, lang, s,
authKey, (sconf != null && sconf.length() > 0) ? authKey, (sconf != null && sconf.length() > 0) ?
Choices.getConfidenceValue(sconf) : Choices.CF_ACCEPTED); Choices.getConfidenceValue(sconf) : Choices.CF_ACCEPTED);
}
} }
else else
{
item.addMetadata(schema, element, qualifier, lang, s); item.addMetadata(schema, element, qualifier, lang, s);
}
} }
} }
} }

View File

@@ -70,9 +70,13 @@ public abstract class AbstractUsageEventListener implements EventListener {
public void setEventService(EventService service) throws Exception { public void setEventService(EventService service) throws Exception {
if(service != null) if(service != null)
service.registerEventListener(this); {
service.registerEventListener(this);
}
else else
throw new RuntimeException("EventService handed to Listener cannot be null"); {
throw new RuntimeException("EventService handed to Listener cannot be null");
}
} }

View File

@@ -339,10 +339,14 @@ public abstract class AbstractFiltersTransformer extends AbstractDSpaceTransform
//Also make sure we don't go above our newest year //Also make sure we don't go above our newest year
int currentTop = year; int currentTop = year;
if((year == topYear)) if((year == topYear))
{
currentTop = newestYear; currentTop = newestYear;
}
else else
{
//We need to do -1 on this one to get a better result //We need to do -1 on this one to get a better result
currentTop--; currentTop--;
}
facetQueries.add(dateFacet + ":[" + bottomYear + " TO " + currentTop + "]"); facetQueries.add(dateFacet + ":[" + bottomYear + " TO " + currentTop + "]");
} }
for (String facetQuery : facetQueries) { for (String facetQuery : facetQueries) {

View File

@@ -482,9 +482,13 @@ public abstract class AbstractSearch extends AbstractFiltersTransformer {
if (sortBy != null) { if (sortBy != null) {
if (sortOrder == null || sortOrder.equals("DESC")) if (sortOrder == null || sortOrder.equals("DESC"))
{
queryArgs.addSortField(sortBy, SolrQuery.ORDER.desc); queryArgs.addSortField(sortBy, SolrQuery.ORDER.desc);
}
else else
{
queryArgs.addSortField(sortBy, SolrQuery.ORDER.asc); queryArgs.addSortField(sortBy, SolrQuery.ORDER.asc);
}
} else { } else {
queryArgs.addSortField("score", SolrQuery.ORDER.asc); queryArgs.addSortField("score", SolrQuery.ORDER.asc);
} }
@@ -514,9 +518,13 @@ public abstract class AbstractSearch extends AbstractFiltersTransformer {
queryArgs.setQuery(query != null && !query.trim().equals("") ? query : "*:*"); queryArgs.setQuery(query != null && !query.trim().equals("") ? query : "*:*");
if (page > 1) if (page > 1)
{
queryArgs.setStart((page - 1) * queryArgs.getRows()); queryArgs.setStart((page - 1) * queryArgs.getRows());
}
else else
{
queryArgs.setStart(0); queryArgs.setStart(0);
}
@@ -590,11 +598,15 @@ public abstract class AbstractSearch extends AbstractFiltersTransformer {
// Are we in a community or collection? // Are we in a community or collection?
DSpaceObject dso; DSpaceObject dso;
if (scopeString == null || "".equals(scopeString)) if (scopeString == null || "".equals(scopeString))
{
// get the search scope from the url handle // get the search scope from the url handle
dso = HandleUtil.obtainHandle(objectModel); dso = HandleUtil.obtainHandle(objectModel);
}
else else
{
// Get the search scope from the location parameter // Get the search scope from the location parameter
dso = HandleManager.resolveToObject(context, scopeString); dso = HandleManager.resolveToObject(context, scopeString);
}
return dso; return dso;
} }

View File

@@ -193,9 +193,13 @@ public class CollectionSearch extends AbstractDSpaceTransformer implements Cache
// Set the page title // Set the page title
String name = collection.getMetadata("name"); String name = collection.getMetadata("name");
if (name == null || name.length() == 0) if (name == null || name.length() == 0)
pageMeta.addMetadata("title").addContent(T_untitled); {
pageMeta.addMetadata("title").addContent(T_untitled);
}
else else
pageMeta.addMetadata("title").addContent(name); {
pageMeta.addMetadata("title").addContent(name);
}
pageMeta.addTrailLink(contextPath + "/",T_dspace_home); pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath); HandleUtil.buildHandleTrail(collection,pageMeta,contextPath);

View File

@@ -223,9 +223,13 @@ public class CommunitySearch extends AbstractDSpaceTransformer implements Cachea
Division home = body.addDivision("community-home", "primary repository community"); Division home = body.addDivision("community-home", "primary repository community");
String name = community.getMetadata("name"); String name = community.getMetadata("name");
if (name == null || name.length() == 0) if (name == null || name.length() == 0)
home.setHead(T_untitled); {
home.setHead(T_untitled);
}
else else
home.setHead(name); {
home.setHead(name);
}
// The search / browse box. // The search / browse box.

View File

@@ -148,9 +148,13 @@ public abstract class AbstractBrowserServlet extends DSpaceServlet
if (bi == null) if (bi == null)
{ {
if (sortBy > 0) if (sortBy > 0)
{
bi = BrowseIndex.getBrowseIndex(SortOption.getSortOption(sortBy)); bi = BrowseIndex.getBrowseIndex(SortOption.getSortOption(sortBy));
}
else else
{
bi = BrowseIndex.getBrowseIndex(SortOption.getDefaultSortOption()); bi = BrowseIndex.getBrowseIndex(SortOption.getDefaultSortOption());
}
} }
// If we don't have a sort column // If we don't have a sort column

View File

@@ -233,9 +233,13 @@ public class Authenticate
} }
} }
if (count == 1) if (count == 1)
{
response.sendRedirect(url); response.sendRedirect(url);
}
else else
{
JSPManager.showJSP(request, response, "/login/chooser.jsp"); JSPManager.showJSP(request, response, "/login/chooser.jsp");
}
} }
return false; return false;
} }

View File

@@ -77,7 +77,9 @@ public class CollectionStyleSelection extends AKeyBasedStyleSelection
return getFromMap(c.getHandle()); return getFromMap(c.getHandle());
} }
else else
{
return "default"; //no specific style - item is an in progress Submission return "default"; //no specific style - item is an in progress Submission
}
} }
/** /**

View File

@@ -1332,6 +1332,7 @@ abstract class DAVResource
typeMask = TYPE_ALL; typeMask = TYPE_ALL;
} }
else else
{
for (String element : types) for (String element : types)
{ {
String key = element.trim(); String key = element.trim();
@@ -1362,6 +1363,7 @@ abstract class DAVResource
"Unrecognized type keyword: " + key); "Unrecognized type keyword: " + key);
} }
} }
}
return typeMask; return typeMask;
} }

View File

@@ -99,7 +99,9 @@ public class DatasetTimeGenerator extends DatasetGenerator {
endPos = true; endPos = true;
}else }else
if(0 < difEnd) if(0 < difEnd)
{
endPos = true; endPos = true;
}
else{ else{
difEnd++; difEnd++;
} }
@@ -209,7 +211,9 @@ public class DatasetTimeGenerator extends DatasetGenerator {
cal2 = backup; cal2 = backup;
toAdd = 1; toAdd = 1;
}else }else
{
toAdd = -1; toAdd = -1;
}

View File

@@ -51,13 +51,17 @@ public class ApacheLogRobotsProcessor {
String logFileLoc; String logFileLoc;
String spiderIpPath; String spiderIpPath;
if (line.hasOption("l")) if (line.hasOption("l"))
{
logFileLoc = line.getOptionValue("l"); logFileLoc = line.getOptionValue("l");
}
else { else {
System.out.println("We need our log file"); System.out.println("We need our log file");
return; return;
} }
if (line.hasOption("s")) if (line.hasOption("s"))
{
spiderIpPath = line.getOptionValue("s"); spiderIpPath = line.getOptionValue("s");
}
else { else {
System.out.println("We need a spider IP output file"); System.out.println("We need a spider IP output file");
return; return;

View File

@@ -434,9 +434,13 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
message.setLabel(T_alerts_message_label); message.setLabel(T_alerts_message_label);
message.setSize(5, 45); message.setSize(5, 45);
if (SystemwideAlerts.getMessage() == null) if (SystemwideAlerts.getMessage() == null)
message.setValue(T_alerts_message_default); {
message.setValue(T_alerts_message_default);
}
else else
message.setValue(SystemwideAlerts.getMessage()); {
message.setValue(SystemwideAlerts.getMessage());
}
Select countdown = form.addItem().addSelect("countdown"); Select countdown = form.addItem().addSelect("countdown");
countdown.setLabel(T_alerts_countdown_label); countdown.setLabel(T_alerts_countdown_label);
@@ -449,9 +453,13 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
// Is there a current count down active? // Is there a current count down active?
if (SystemwideAlerts.isAlertActive() && SystemwideAlerts.getCountDownToo() - System.currentTimeMillis() > 0) if (SystemwideAlerts.isAlertActive() && SystemwideAlerts.getCountDownToo() - System.currentTimeMillis() > 0)
countdown.addOption(true,-1,T_alerts_countdown_keep); {
countdown.addOption(true, -1, T_alerts_countdown_keep);
}
else else
countdown.setOptionSelected(0); {
countdown.setOptionSelected(0);
}
Select restrictsessions = form.addItem().addSelect("restrictsessions"); Select restrictsessions = form.addItem().addSelect("restrictsessions");
restrictsessions.setLabel(T_alerts_session_label); restrictsessions.setLabel(T_alerts_session_label);
@@ -627,11 +635,17 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
long ago = System.currentTimeMillis() - event.getTimeStamp(); long ago = System.currentTimeMillis() - event.getTimeStamp();
if (ago > 2*60*60*1000) if (ago > 2*60*60*1000)
timeStampMessage = T_hours.parameterize((ago / (60*60*1000))); {
timeStampMessage = T_hours.parameterize((ago / (60 * 60 * 1000)));
}
else if (ago > 60*1000) else if (ago > 60*1000)
timeStampMessage = T_minutes.parameterize((ago / (60*1000))); {
timeStampMessage = T_minutes.parameterize((ago / (60 * 1000)));
}
else else
timeStampMessage = T_seconds.parameterize((ago / (1000))); {
timeStampMessage = T_seconds.parameterize((ago / (1000)));
}
Row eventRow = activeUsers.addRow(); Row eventRow = activeUsers.addRow();

View File

@@ -125,8 +125,14 @@ public class DeletePoliciesConfirm extends AbstractDSpaceTransformer
Row row = table.addRow(); Row row = table.addRow();
row.addCell().addContent(policy.getID()); row.addCell().addContent(policy.getID());
row.addCell().addContent(policy.getActionText()); row.addCell().addContent(policy.getActionText());
if (policy.getGroup() != null) row.addCell().addContent(policy.getGroup().getName()); if (policy.getGroup() != null)
else row.addCell().addContent("..."); {
row.addCell().addContent(policy.getGroup().getName());
}
else
{
row.addCell().addContent("...");
}
} }
Para buttons = deleted.addPara(); Para buttons = deleted.addPara();
buttons.addButton("submit_confirm").setValue(T_submit_confirm); buttons.addButton("submit_confirm").setValue(T_submit_confirm);

View File

@@ -91,9 +91,13 @@ public class DeleteCollectionRoleConfirm extends AbstractDSpaceTransformer
main.setHead(T_main_head.parameterize(role)); main.setHead(T_main_head.parameterize(role));
// Different help message for the default read group to enforce its non-retroactive nature // Different help message for the default read group to enforce its non-retroactive nature
if (role == "DEFAULT_READ") if (role == "DEFAULT_READ")
main.addPara(T_main_para_read.parameterize(toBeDeleted.getName())); {
main.addPara(T_main_para_read.parameterize(toBeDeleted.getName()));
}
else else
main.addPara(T_main_para.parameterize(toBeDeleted.getName())); {
main.addPara(T_main_para.parameterize(toBeDeleted.getName()));
}
Para buttonList = main.addPara(); Para buttonList = main.addPara();
buttonList.addButton("submit_confirm").setValue(T_submit_confirm); buttonList.addButton("submit_confirm").setValue(T_submit_confirm);

View File

@@ -99,9 +99,13 @@ public class CreateCommunityForm extends AbstractDSpaceTransformer
/* Whether the parent community is null is what determines if /* Whether the parent community is null is what determines if
we are creating a top-level community or a sub-community */ we are creating a top-level community or a sub-community */
if (parentCommunity != null) if (parentCommunity != null)
main.setHead(T_main_head_sub.parameterize(parentCommunity.getMetadata("name"))); {
main.setHead(T_main_head_sub.parameterize(parentCommunity.getMetadata("name")));
}
else else
main.setHead(T_main_head_top); {
main.setHead(T_main_head_top);
}
// The grand list of metadata options // The grand list of metadata options

View File

@@ -444,9 +444,13 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer
queryArgs.setQuery(query); queryArgs.setQuery(query);
if (page > 1) if (page > 1)
{
queryArgs.setStart((Integer.valueOf(page) - 1) * queryArgs.getPageSize()); queryArgs.setStart((Integer.valueOf(page) - 1) * queryArgs.getPageSize());
}
else else
{
queryArgs.setStart(0); queryArgs.setStart(0);
}
QueryResults qResults = null; QueryResults qResults = null;
if (scope instanceof Community) if (scope instanceof Community)
@@ -480,11 +484,15 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer
// Are we in a community or collection? // Are we in a community or collection?
DSpaceObject dso; DSpaceObject dso;
if (scopeString == null || "".equals(scopeString)) if (scopeString == null || "".equals(scopeString))
{
// get the search scope from the url handle // get the search scope from the url handle
dso = HandleUtil.obtainHandle(objectModel); dso = HandleUtil.obtainHandle(objectModel);
}
else else
{
// Get the search scope from the location parameter // Get the search scope from the location parameter
dso = HandleManager.resolveToObject(context, scopeString); dso = HandleManager.resolveToObject(context, scopeString);
}
return dso; return dso;
} }

View File

@@ -242,9 +242,13 @@ public class CollectionViewer extends AbstractDSpaceTransformer implements Cache
Division home = body.addDivision("collection-home", "primary repository collection"); Division home = body.addDivision("collection-home", "primary repository collection");
String name = collection.getMetadata("name"); String name = collection.getMetadata("name");
if (name == null || name.length() == 0) if (name == null || name.length() == 0)
home.setHead(T_untitled); {
home.setHead(T_untitled);
}
else else
home.setHead(name); {
home.setHead(name);
}
// The search / browse box. // The search / browse box.
{ {

View File

@@ -207,9 +207,13 @@ public class CommunityViewer extends AbstractDSpaceTransformer implements Cachea
// Set the page title // Set the page title
String name = community.getMetadata("name"); String name = community.getMetadata("name");
if (name == null || name.length() == 0) if (name == null || name.length() == 0)
pageMeta.addMetadata("title").addContent(T_untitled); {
pageMeta.addMetadata("title").addContent(T_untitled);
}
else else
pageMeta.addMetadata("title").addContent(name); {
pageMeta.addMetadata("title").addContent(name);
}
// Add the trail back to the repository root. // Add the trail back to the repository root.
pageMeta.addTrailLink(contextPath + "/",T_dspace_home); pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
@@ -259,9 +263,13 @@ public class CommunityViewer extends AbstractDSpaceTransformer implements Cachea
Division home = body.addDivision("community-home", "primary repository community"); Division home = body.addDivision("community-home", "primary repository community");
String name = community.getMetadata("name"); String name = community.getMetadata("name");
if (name == null || name.length() == 0) if (name == null || name.length() == 0)
home.setHead(T_untitled); {
home.setHead(T_untitled);
}
else else
home.setHead(name); {
home.setHead(name);
}
// The search / browse box. // The search / browse box.
{ {

View File

@@ -422,11 +422,17 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
year.addOption(false, String.valueOf(i), String.valueOf(i)); year.addOption(false, String.valueOf(i), String.valueOf(i));
if (i <= fiveYearBreak) if (i <= fiveYearBreak)
{
i -= 10; i -= 10;
}
else if (i <= oneYearBreak) else if (i <= oneYearBreak)
{
i -= 5; i -= 5;
}
else else
{
i--; i--;
}
} }
while (i > tenYearBreak); while (i > tenYearBreak);
@@ -866,16 +872,22 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
value = "\""+cm.getLabel(fk, info.getValue(), null)+"\""; value = "\""+cm.getLabel(fk, info.getValue(), null)+"\"";
} }
else else
{
value = "\"" + info.getValue() + "\""; value = "\"" + info.getValue() + "\"";
}
} }
// Get the name of any scoping element (collection / community) // Get the name of any scoping element (collection / community)
String scopeName = ""; String scopeName = "";
if (info.getBrowseContainer() != null) if (info.getBrowseContainer() != null)
{
scopeName = info.getBrowseContainer().getName(); scopeName = info.getBrowseContainer().getName();
}
else else
{
scopeName = ""; scopeName = "";
}
if (bix.isMetadataIndex()) if (bix.isMetadataIndex())
{ {
@@ -907,9 +919,13 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
String scopeName = ""; String scopeName = "";
if (info.getBrowseContainer() != null) if (info.getBrowseContainer() != null)
{
scopeName = info.getBrowseContainer().getName(); scopeName = info.getBrowseContainer().getName();
}
else else
{
scopeName = ""; scopeName = "";
}
if (bix.isMetadataIndex()) if (bix.isMetadataIndex())
{ {

View File

@@ -161,9 +161,13 @@ public class ChoiceLookupTransformer extends AbstractDSpaceTransformer
Division idiv = body.addInteractiveDivision("lookup", "", "get", "popup"); Division idiv = body.addInteractiveDivision("lookup", "", "get", "popup");
if (isFieldMessage(field, "title")) if (isFieldMessage(field, "title"))
{
idiv.setHead(getFieldMessage(field, "title")); idiv.setHead(getFieldMessage(field, "title"));
}
else else
{
idiv.setHead(getFieldLabel(field, "title")); idiv.setHead(getFieldLabel(field, "title"));
}
List fl = idiv.addList("choicesList", "form", "choices-lookup"); List fl = idiv.addList("choicesList", "form", "choices-lookup");
fl.setHead(T_results); fl.setHead(T_results);
@@ -204,9 +208,13 @@ public class ChoiceLookupTransformer extends AbstractDSpaceTransformer
{ {
h = selectItem.addHidden("paramNonAuthority"); h = selectItem.addHidden("paramNonAuthority");
if (isFieldMessage(field, "nonauthority")) if (isFieldMessage(field, "nonauthority"))
{
h.setValue(getFieldMessage(field, "nonauthority")); h.setValue(getFieldMessage(field, "nonauthority"));
}
else else
{
h.setValue(getFieldLabel(field, "nonauthority")); h.setValue(getFieldLabel(field, "nonauthority"));
}
} }
h = selectItem.addHidden("contextPath"); h = selectItem.addHidden("contextPath");
h.setValue(contextPath); h.setValue(contextPath);
@@ -315,9 +323,13 @@ public class ChoiceLookupTransformer extends AbstractDSpaceTransformer
{ {
String cv = getFieldLabel(field, name); String cv = getFieldLabel(field, name);
if (cv == null) if (cv == null)
return message(MESSAGE_PREFIX+"field."+field+"."+name); {
return message(MESSAGE_PREFIX + "field." + field + "." + name);
}
else else
{
return message(cv); return message(cv);
}
} }
private int atoi(String s) private int atoi(String s)

View File

@@ -504,9 +504,13 @@ abstract public class AbstractStep extends AbstractDSpaceTransformer
if (errors!=null && errors.length() > 0) if (errors!=null && errors.length() > 0)
{ {
if(errors.indexOf(',') > 0) if(errors.indexOf(',') > 0)
fields = Arrays.asList(errors.split(",")); {
fields = Arrays.asList(errors.split(","));
}
else//only one error field else//only one error field
fields.add(errors); {
fields.add(errors);
}
} }
return fields; return fields;
@@ -532,11 +536,17 @@ abstract public class AbstractStep extends AbstractDSpaceTransformer
try try
{ {
if (givenStepAndPage.equals(this.stepAndPage)) if (givenStepAndPage.equals(this.stepAndPage))
return "current"; {
return "current";
}
else if (givenStepAndPage.compareTo(getMaxStepAndPageReached())>0) else if (givenStepAndPage.compareTo(getMaxStepAndPageReached())>0)
{
return "disabled"; return "disabled";
}
else else
return null; {
return null;
}
} }
catch(Exception e) catch(Exception e)
{ {

View File

@@ -409,7 +409,9 @@ public class DescribeStep extends AbstractSubmissionStep
authItem.addContent(displayValue); authItem.addContent(displayValue);
} }
else else
describeSection.addItem(displayValue); {
describeSection.addItem(displayValue);
}
} }
} // For each DCValue } // For each DCValue
} // If values exist } // If values exist
@@ -496,9 +498,13 @@ public class DescribeStep extends AbstractSubmissionStep
if (isAuthorityControlled) if (isAuthorityControlled)
{ {
if (dcValue.authority == null || dcValue.authority.equals("")) if (dcValue.authority == null || dcValue.authority.equals(""))
{
fi.setAuthorityValue("", "blank"); fi.setAuthorityValue("", "blank");
}
else else
{
fi.setAuthorityValue(dcValue.authority, Choices.getConfidenceText(dcValue.confidence)); fi.setAuthorityValue(dcValue.authority, Choices.getConfidenceText(dcValue.confidence));
}
} }
} }
} }
@@ -511,9 +517,13 @@ public class DescribeStep extends AbstractSubmissionStep
if (isAuthorityControlled) if (isAuthorityControlled)
{ {
if (dcValues[0].authority == null || dcValues[0].authority.equals("")) if (dcValues[0].authority == null || dcValues[0].authority.equals(""))
{
lastName.setAuthorityValue("", "blank"); lastName.setAuthorityValue("", "blank");
}
else else
{
lastName.setAuthorityValue(dcValues[0].authority, Choices.getConfidenceText(dcValues[0].confidence)); lastName.setAuthorityValue(dcValues[0].authority, Choices.getConfidenceText(dcValues[0].confidence));
}
} }
} }
} }
@@ -604,9 +614,13 @@ public class DescribeStep extends AbstractSubmissionStep
// Check if the day field is not specified, if so then just // Check if the day field is not specified, if so then just
// put a blank value in instead of the wiered looking -1. // put a blank value in instead of the wiered looking -1.
if (dcDate.getDay() == -1) if (dcDate.getDay() == -1)
day.setValue(""); {
day.setValue("");
}
else else
day.setValue(String.valueOf(dcDate.getDay())); {
day.setValue(String.valueOf(dcDate.getDay()));
}
} }
} }
@@ -818,9 +832,13 @@ public class DescribeStep extends AbstractSubmissionStep
if (isAuth) if (isAuth)
{ {
if (dcValue.authority == null || dcValue.authority.equals("")) if (dcValue.authority == null || dcValue.authority.equals(""))
{
ti.setAuthorityValue("", "blank"); ti.setAuthorityValue("", "blank");
}
else else
{
ti.setAuthorityValue(dcValue.authority, Choices.getConfidenceText(dcValue.confidence)); ti.setAuthorityValue(dcValue.authority, Choices.getConfidenceText(dcValue.confidence));
}
} }
} }
} }
@@ -830,9 +848,13 @@ public class DescribeStep extends AbstractSubmissionStep
if (isAuth) if (isAuth)
{ {
if (dcValues[0].authority == null || dcValues[0].authority.equals("")) if (dcValues[0].authority == null || dcValues[0].authority.equals(""))
{
textArea.setAuthorityValue("", "blank"); textArea.setAuthorityValue("", "blank");
}
else else
{
textArea.setAuthorityValue(dcValues[0].authority, Choices.getConfidenceText(dcValues[0].confidence)); textArea.setAuthorityValue(dcValues[0].authority, Choices.getConfidenceText(dcValues[0].confidence));
}
} }
} }
} }
@@ -879,7 +901,9 @@ public class DescribeStep extends AbstractSubmissionStep
select.setSize(6); select.setSize(6);
} }
else else
select.setSize(1); {
select.setSize(1);
}
if (readonly) if (readonly)
{ {
@@ -1108,9 +1132,13 @@ public class DescribeStep extends AbstractSubmissionStep
if (isAuth) if (isAuth)
{ {
if (dcValue.authority == null || dcValue.authority.equals("")) if (dcValue.authority == null || dcValue.authority.equals(""))
{
ti.setAuthorityValue("", "blank"); ti.setAuthorityValue("", "blank");
}
else else
{
ti.setAuthorityValue(dcValue.authority, Choices.getConfidenceText(dcValue.confidence)); ti.setAuthorityValue(dcValue.authority, Choices.getConfidenceText(dcValue.confidence));
}
} }
} }
} }
@@ -1120,9 +1148,13 @@ public class DescribeStep extends AbstractSubmissionStep
if (isAuth) if (isAuth)
{ {
if (dcValues[0].authority == null || dcValues[0].authority.equals("")) if (dcValues[0].authority == null || dcValues[0].authority.equals(""))
{
text.setAuthorityValue("", "blank"); text.setAuthorityValue("", "blank");
}
else else
{
text.setAuthorityValue(dcValues[0].authority, Choices.getConfidenceText(dcValues[0].confidence)); text.setAuthorityValue(dcValues[0].authority, Choices.getConfidenceText(dcValues[0].confidence));
}
} }
} }
} }

View File

@@ -100,14 +100,22 @@ public class AdvancedFormTest 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."); 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) if (help)
div.addPara().addXref(makeURL(false,error),"Turn help OFF"); {
div.addPara().addXref(makeURL(false, error), "Turn help OFF");
}
else else
div.addPara().addXref(makeURL(true,error),"Turn help ON"); {
div.addPara().addXref(makeURL(true, error), "Turn help ON");
}
if (error) if (error)
div.addPara().addXref(makeURL(help,false),"Turn errors OFF"); {
div.addPara().addXref(makeURL(help, false), "Turn errors OFF");
}
else else
div.addPara().addXref(makeURL(help,true),"Turn errors ON"); {
div.addPara().addXref(makeURL(help, true), "Turn errors ON");
}
List list = div.addList("fieldTest",List.TYPE_FORM); List list = div.addList("fieldTest",List.TYPE_FORM);

View File

@@ -268,9 +268,13 @@ public class BitstreamReader extends AbstractReader implements Recyclable
//build redirect URL based on whether item has a handle assigned yet //build redirect URL based on whether item has a handle assigned yet
if(item.getHandle()!=null && item.getHandle().length()>0) if(item.getHandle()!=null && item.getHandle().length()>0)
redirectURL = request.getContextPath() + "/bitstream/handle/" + item.getHandle(); {
redirectURL = request.getContextPath() + "/bitstream/handle/" + item.getHandle();
}
else else
redirectURL = request.getContextPath() + "/bitstream/item/" + item.getID(); {
redirectURL = request.getContextPath() + "/bitstream/item/" + item.getID();
}
redirectURL += "/" + name + "?sequence=" + bitstream.getSequenceID(); redirectURL += "/" + name + "?sequence=" + bitstream.getSequenceID();

View File

@@ -474,11 +474,17 @@ public abstract class AbstractAdapter
// with an item (such as a community logo) then reference the bitstreamID directly. // with an item (such as a community logo) then reference the bitstreamID directly.
String identifier = null; String identifier = null;
if (item != null && item.getHandle() != null) if (item != null && item.getHandle() != null)
identifier = "handle/"+item.getHandle(); {
identifier = "handle/" + item.getHandle();
}
else if (item != null) else if (item != null)
identifier = "item/"+item.getID(); {
identifier = "item/" + item.getID();
}
else else
identifier = "id/"+bitstream.getID(); {
identifier = "id/" + bitstream.getID();
}
String url = contextPath + "/bitstream/"+identifier+"/"; String url = contextPath + "/bitstream/"+identifier+"/";
@@ -710,9 +716,13 @@ public abstract class AbstractAdapter
{ {
String prefix = namespaces.getPrefix(namespace.URI); String prefix = namespaces.getPrefix(namespace.URI);
if (prefix == null || prefix.equals("")) if (prefix == null || prefix.equals(""))
{
return localName; return localName;
}
else else
{
return prefix + ":" + localName; return prefix + ":" + localName;
}
} }
} }

View File

@@ -154,12 +154,18 @@ public class ContainerAdapter extends AbstractAdapter
if (dso.getHandle() == null) if (dso.getHandle() == null)
{ {
if (dso instanceof Collection) if (dso instanceof Collection)
return "collection:"+dso.getID(); {
return "collection:" + dso.getID();
}
else else
return "community:"+dso.getID(); {
return "community:" + dso.getID();
}
} }
else else
return "hdl:"+dso.getHandle(); {
return "hdl:" + dso.getHandle();
}
} }
/** /**
@@ -178,9 +184,13 @@ public class ContainerAdapter extends AbstractAdapter
protected String getMETSLabel() protected String getMETSLabel()
{ {
if (dso instanceof Community) if (dso instanceof Community)
{
return "DSpace Community"; return "DSpace Community";
}
else else
{
return "DSpace Collection"; return "DSpace Collection";
}
} }
/** /**

View File

@@ -433,10 +433,14 @@ public class AuthenticationUtil
Context context = ContextUtil.obtainContext(objectModel); Context context = ContextUtil.obtainContext(objectModel);
if (SystemwideAlerts.canUserStartSession()) if (SystemwideAlerts.canUserStartSession())
return AuthenticationManager.canSelfRegister(context,request,email); {
return AuthenticationManager.canSelfRegister(context, request, email);
}
else else
// System wide alerts is preventing new sessions. {
return false; // System wide alerts is preventing new sessions.
return false;
}
} }
/** /**

View File

@@ -433,9 +433,13 @@ public abstract class AbstractWingElement implements WingElement
Namespace namespace = attributeMap.getNamespace(); Namespace namespace = attributeMap.getNamespace();
String URI; String URI;
if (namespace != null) if (namespace != null)
{
URI = namespace.URI; URI = namespace.URI;
}
else else
{
URI = WingConstants.DRI.URI; URI = WingConstants.DRI.URI;
}
String prefix = namespaces.getPrefix(URI); String prefix = namespaces.getPrefix(URI);
@@ -478,9 +482,13 @@ public abstract class AbstractWingElement implements WingElement
private String qName(String prefix, String localName) private String qName(String prefix, String localName)
{ {
if (prefix == null || prefix.equals("")) if (prefix == null || prefix.equals(""))
{
return localName; return localName;
}
else else
{
return prefix + ":" + localName; return prefix + ":" + localName;
}
} }
/** /**