mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-15 22:13:08 +00:00
[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:
@@ -160,12 +160,22 @@ public class CreateAdministrator
|
||||
System.out.print("First name: ");
|
||||
System.out.flush();
|
||||
|
||||
firstName = input.readLine().trim();
|
||||
firstName = input.readLine();
|
||||
|
||||
if (firstName != null)
|
||||
{
|
||||
firstName = firstName.trim();
|
||||
}
|
||||
|
||||
System.out.print("Last name: ");
|
||||
System.out.flush();
|
||||
|
||||
lastName = input.readLine().trim();
|
||||
lastName = input.readLine();
|
||||
|
||||
if (lastName != null)
|
||||
{
|
||||
lastName = lastName.trim();
|
||||
}
|
||||
|
||||
if (ConfigurationManager.getProperty("webui.supported.locales") != null)
|
||||
{
|
||||
@@ -173,7 +183,13 @@ public class CreateAdministrator
|
||||
System.out.print("Language: ");
|
||||
System.out.flush();
|
||||
|
||||
language = input.readLine().trim();
|
||||
language = input.readLine();
|
||||
|
||||
if (language != null)
|
||||
{
|
||||
language = language.trim();
|
||||
}
|
||||
|
||||
language = I18nUtil.getSupportedLocale(new Locale(language)).getLanguage();
|
||||
}
|
||||
|
||||
@@ -181,12 +197,22 @@ public class CreateAdministrator
|
||||
System.out.print("Password: ");
|
||||
System.out.flush();
|
||||
|
||||
password1 = input.readLine().trim();
|
||||
password1 = input.readLine();
|
||||
|
||||
if (password1 != null)
|
||||
{
|
||||
password1 = password1.trim();
|
||||
}
|
||||
|
||||
System.out.print("Again to confirm: ");
|
||||
System.out.flush();
|
||||
|
||||
password2 = input.readLine().trim();
|
||||
password2 = input.readLine();
|
||||
|
||||
if (password2 != null)
|
||||
{
|
||||
password2 = password2.trim();
|
||||
}
|
||||
|
||||
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.flush();
|
||||
|
||||
String s = input.readLine().trim();
|
||||
String s = input.readLine();
|
||||
|
||||
if (s != null)
|
||||
{
|
||||
s = s.trim();
|
||||
}
|
||||
|
||||
if (s.toLowerCase().startsWith("y"))
|
||||
{
|
||||
|
@@ -152,10 +152,14 @@ public class DailyFileAppender extends FileAppender
|
||||
{
|
||||
this.mstrDatePattern = checkPattern(pstrPattern);
|
||||
if (mstrDatePattern.contains("dd") || mstrDatePattern.contains("DD"))
|
||||
{
|
||||
mMonthOnly = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
mMonthOnly = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFile(String file)
|
||||
{
|
||||
|
@@ -320,9 +320,13 @@ public class AuthenticationManager
|
||||
// request, and most sites will only have 0 or 1 auth methods
|
||||
// actually returning groups, so it pays..
|
||||
if (totalLen == 0)
|
||||
{
|
||||
return new int[0];
|
||||
}
|
||||
else if (gll.size() == 1)
|
||||
return (int [])gll.get(0);
|
||||
{
|
||||
return (int[]) gll.get(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Have to do it this painful way since list.toArray() doesn't
|
||||
|
@@ -532,16 +532,24 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
||||
if (ConfigurationManager.getBooleanProperty("webui.browse.metadata.case-insensitive", false))
|
||||
{
|
||||
if (isValueColumnClob())
|
||||
{
|
||||
select = select + " WHERE UPPER(TO_CHAR(value))=UPPER(?)";
|
||||
}
|
||||
else
|
||||
{
|
||||
select = select + " WHERE UPPER(value)=UPPER(?)";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isValueColumnClob())
|
||||
{
|
||||
select = select + " WHERE TO_CHAR(value)=?";
|
||||
}
|
||||
else
|
||||
{
|
||||
select = select + " WHERE value=?";
|
||||
}
|
||||
}
|
||||
|
||||
if (authority != null)
|
||||
|
@@ -888,10 +888,14 @@ public class BrowseDAOOracle implements BrowseDAO
|
||||
{
|
||||
queryBuf.append("rec WHERE rownum<=? ");
|
||||
if (offset > 0)
|
||||
{
|
||||
params.add(Integer.valueOf(limit + offset));
|
||||
}
|
||||
else
|
||||
{
|
||||
params.add(Integer.valueOf(limit));
|
||||
}
|
||||
}
|
||||
|
||||
if (offset > 0)
|
||||
{
|
||||
|
@@ -664,10 +664,14 @@ public class BrowseIndex
|
||||
else
|
||||
{
|
||||
if (sortOption != null)
|
||||
{
|
||||
focusField = "sort_" + sortOption.getNumber();
|
||||
}
|
||||
else
|
||||
{
|
||||
focusField = "sort_1"; // Use the first sort column
|
||||
}
|
||||
}
|
||||
|
||||
return focusField;
|
||||
}
|
||||
|
@@ -311,9 +311,13 @@ public final class BitstreamInfoDAO extends DAOSupport
|
||||
LOG.debug("updating missing bitstreams");
|
||||
conn = DatabaseManager.getConnection();
|
||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
||||
{
|
||||
stmt = conn.prepareStatement(INSERT_MISSING_CHECKSUM_BITSTREAMS_ORACLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
stmt = conn.prepareStatement(INSERT_MISSING_CHECKSUM_BITSTREAMS);
|
||||
}
|
||||
stmt.setTimestamp(1, new java.sql.Timestamp(new Date().getTime()));
|
||||
stmt.setTimestamp(2, new java.sql.Timestamp(new Date().getTime()));
|
||||
stmt.executeUpdate();
|
||||
@@ -425,9 +429,13 @@ public final class BitstreamInfoDAO extends DAOSupport
|
||||
|
||||
conn = DatabaseManager.getConnection();
|
||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
||||
{
|
||||
prepStmt = conn.prepareStatement(GET_OLDEST_BITSTREAM_ORACLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
prepStmt = conn.prepareStatement(GET_OLDEST_BITSTREAM);
|
||||
}
|
||||
rs = prepStmt.executeQuery();
|
||||
if (rs.next())
|
||||
{
|
||||
@@ -469,9 +477,13 @@ public final class BitstreamInfoDAO extends DAOSupport
|
||||
{
|
||||
conn = DatabaseManager.getConnection();
|
||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
||||
{
|
||||
prepStmt = conn.prepareStatement(GET_OLDEST_BITSTREAM_DATE_ORACLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
prepStmt = conn.prepareStatement(GET_OLDEST_BITSTREAM_DATE);
|
||||
}
|
||||
prepStmt.setTimestamp(1, lessThanDate);
|
||||
rs = prepStmt.executeQuery();
|
||||
if (rs.next())
|
||||
|
@@ -137,14 +137,16 @@ public class ChecksumHistoryDAO extends DAOSupport
|
||||
{
|
||||
conn = DatabaseManager.getConnection();
|
||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
||||
{
|
||||
stmt = conn.prepareStatement(INSERT_HISTORY_ORACLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
stmt = conn.prepareStatement(INSERT_HISTORY);
|
||||
}
|
||||
stmt.setInt(1, info.getBitstreamId());
|
||||
stmt.setTimestamp(2, new java.sql.Timestamp(info
|
||||
.getProcessStartDate().getTime()));
|
||||
stmt.setTimestamp(3, new java.sql.Timestamp(info
|
||||
.getProcessEndDate().getTime()));
|
||||
stmt.setTimestamp(2, new java.sql.Timestamp(info.getProcessStartDate().getTime()));
|
||||
stmt.setTimestamp(3, new java.sql.Timestamp(info.getProcessEndDate().getTime()));
|
||||
stmt.setString(4, info.getStoredChecksum());
|
||||
stmt.setString(5, info.getCalculatedChecksum());
|
||||
stmt.setString(6, info.getChecksumCheckResult());
|
||||
@@ -210,9 +212,13 @@ public class ChecksumHistoryDAO extends DAOSupport
|
||||
try
|
||||
{
|
||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
||||
{
|
||||
stmt = conn.prepareStatement(INSERT_MISSING_HISTORY_BITSTREAMS_ORACLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
stmt = conn.prepareStatement(INSERT_MISSING_HISTORY_BITSTREAMS);
|
||||
}
|
||||
stmt.executeUpdate();
|
||||
}
|
||||
catch (SQLException e)
|
||||
|
@@ -449,14 +449,22 @@ public class DCDate
|
||||
private synchronized String toStringInternal()
|
||||
{
|
||||
if (granularity == DateGran.YEAR)
|
||||
{
|
||||
return String.format("%4d", getYearUTC());
|
||||
}
|
||||
else if (granularity == DateGran.MONTH)
|
||||
{
|
||||
return String.format("%4d-%02d", getYearUTC(), getMonthUTC());
|
||||
}
|
||||
else if (granularity == DateGran.DAY)
|
||||
{
|
||||
return String.format("%4d-%02d-%02d", getYearUTC(), getMonthUTC(), getDayUTC());
|
||||
}
|
||||
else
|
||||
{
|
||||
return fullIso.format(calendar.getTime());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the date as a Java Date object.
|
||||
@@ -466,10 +474,14 @@ public class DCDate
|
||||
public Date toDate()
|
||||
{
|
||||
if (calendar == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return calendar.getTime();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a human-readable version of the DCDate, with optional time.
|
||||
|
@@ -140,7 +140,9 @@ public class ChoiceAuthorityManager
|
||||
closed.put(fkey, Boolean.valueOf(ConfigurationManager.getBooleanProperty(key)));
|
||||
}
|
||||
else
|
||||
log.error("Illegal configuration property: "+key);
|
||||
{
|
||||
log.error("Illegal configuration property: " + key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -127,7 +127,9 @@ public class DCInputAuthority extends SelfNamedPlugin implements ChoiceAuthority
|
||||
log.debug("Found pairs for name="+pname);
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -381,7 +381,9 @@ public class AIPTechMDCrosswalk
|
||||
|
||||
// if we get <dim> in a list, recurse.
|
||||
if (field.getName().equals("dim") && field.getNamespace().equals(XSLTCrosswalk.DIM_NS))
|
||||
{
|
||||
ingest(context, dso, field.getChildren());
|
||||
}
|
||||
else if (field.getName().equals("field") && field.getNamespace().equals(XSLTCrosswalk.DIM_NS))
|
||||
{
|
||||
String schema = field.getAttributeValue("mdschema");
|
||||
@@ -426,16 +428,22 @@ public class AIPTechMDCrosswalk
|
||||
{
|
||||
int sl = BitstreamFormat.getSupportLevelID(value);
|
||||
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
|
||||
{
|
||||
bsfSupport = sl;
|
||||
}
|
||||
}
|
||||
else if (dcField.equals("format.internal"))
|
||||
{
|
||||
bsfInternal = (Boolean.valueOf(value)).booleanValue();
|
||||
}
|
||||
else
|
||||
log.warn("Got unrecognized DC field for Bitstream: "+dcField);
|
||||
{
|
||||
log.warn("Got unrecognized DC field for Bitstream: " + dcField);
|
||||
}
|
||||
}
|
||||
else if (type == Constants.ITEM)
|
||||
{
|
||||
@@ -462,7 +470,9 @@ public class AIPTechMDCrosswalk
|
||||
sub.update();
|
||||
}
|
||||
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)
|
||||
{
|
||||
|
@@ -335,9 +335,13 @@ public abstract class AbstractMETSDisseminator
|
||||
//actually add the file to the Zip package
|
||||
ZipEntry ze = new ZipEntry(fname);
|
||||
if (lmTime != 0)
|
||||
{
|
||||
ze.setTime(lmTime);
|
||||
}
|
||||
else //Set a default modified date so that checksum of Zip doesn't change if Zip contents are unchanged
|
||||
{
|
||||
ze.setTime(DEFAULT_MODIFIED_DATE);
|
||||
}
|
||||
zip.putNextEntry(ze);
|
||||
Utils.copy(is, zip);
|
||||
zip.closeEntry();
|
||||
@@ -350,9 +354,13 @@ public abstract class AbstractMETSDisseminator
|
||||
// write manifest after metadata.
|
||||
ZipEntry me = new ZipEntry(METSManifest.MANIFEST_FILE);
|
||||
if (lmTime != 0)
|
||||
{
|
||||
me.setTime(lmTime);
|
||||
}
|
||||
else //Set a default modified date so that checksum of Zip doesn't change if Zip contents are unchanged
|
||||
{
|
||||
me.setTime(DEFAULT_MODIFIED_DATE);
|
||||
}
|
||||
|
||||
zip.putNextEntry(me);
|
||||
|
||||
@@ -407,7 +415,9 @@ public abstract class AbstractMETSDisseminator
|
||||
continue;
|
||||
}
|
||||
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();
|
||||
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());
|
||||
}
|
||||
if (lmTime != 0)
|
||||
{
|
||||
ze.setTime(lmTime);
|
||||
}
|
||||
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.setSize(auth ? bitstreams[k].getSize() : 0);
|
||||
zip.putNextEntry(ze);
|
||||
if (auth)
|
||||
{
|
||||
Utils.copy(bitstreams[k].retrieve(), zip);
|
||||
}
|
||||
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();
|
||||
}
|
||||
else if (unauth != null &&
|
||||
@@ -549,7 +567,9 @@ public abstract class AbstractMETSDisseminator
|
||||
xwalkName = parts[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
xwalkName = metsName = typeSpec;
|
||||
}
|
||||
|
||||
// First, check to see if the crosswalk we are using is a normal DisseminationCrosswalk
|
||||
boolean xwalkFound = PluginManager.hasNamedPlugin(DisseminationCrosswalk.class, xwalkName);
|
||||
@@ -583,11 +603,15 @@ public abstract class AbstractMETSDisseminator
|
||||
return mdSec;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// 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
|
||||
else
|
||||
@@ -649,13 +673,18 @@ public abstract class AbstractMETSDisseminator
|
||||
mdWrap.getContent().add(binData);
|
||||
mdSec.getContent().add(mdWrap);
|
||||
}
|
||||
|
||||
return mdSec;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
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)
|
||||
@@ -715,8 +744,10 @@ public abstract class AbstractMETSDisseminator
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// make the most "persistent" identifier possible, preferably a URN
|
||||
// based on the Handle.
|
||||
@@ -726,10 +757,14 @@ public abstract class AbstractMETSDisseminator
|
||||
|
||||
// If no Handle, punt to much-less-satisfactory database ID and type..
|
||||
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
|
||||
{
|
||||
return getHandleURN(handle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write out a METS manifest.
|
||||
@@ -833,9 +868,13 @@ public abstract class AbstractMETSDisseminator
|
||||
{
|
||||
if (unauth != null &&
|
||||
(unauth.equalsIgnoreCase("skip")))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
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();
|
||||
@@ -1168,10 +1207,14 @@ public abstract class AbstractMETSDisseminator
|
||||
}
|
||||
|
||||
if(emptyDiv)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return div;
|
||||
}
|
||||
}
|
||||
|
||||
// put handle in canonical URN format -- note that HandleManager's
|
||||
// canonicalize currently returns HTTP URL format.
|
||||
@@ -1246,10 +1289,14 @@ public abstract class AbstractMETSDisseminator
|
||||
{
|
||||
String uri = ns[i].getURI();
|
||||
if (sloc != null && sloc.length > 1 && uri.equals(sloc[0]))
|
||||
{
|
||||
me.setSchema(ns[i].getPrefix(), uri, sloc[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
me.setSchema(ns[i].getPrefix(), uri);
|
||||
}
|
||||
}
|
||||
|
||||
// add result of crosswalk
|
||||
PreformedXML pXML = null;
|
||||
|
@@ -505,9 +505,11 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
// Do nothing -- Crosswalks will handle anything necessary to ingest at Site-level
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new PackageValidationException(
|
||||
"Unknown DSpace Object type in package, type="
|
||||
+ String.valueOf(type));
|
||||
}
|
||||
|
||||
// -- Step 5 --
|
||||
// Run our Descriptive metadata (dublin core, etc) crosswalks!
|
||||
@@ -757,9 +759,13 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
Bundle bundle;
|
||||
Bundle bns[] = item.getBundles(bundleName);
|
||||
if (bns != null && bns.length > 0)
|
||||
{
|
||||
bundle = bns[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
bundle = item.createBundle(bundleName);
|
||||
}
|
||||
|
||||
// Create the bitstream in the bundle & initialize its name
|
||||
Bitstream bitstream = bundle.createBitstream(fileStream);
|
||||
@@ -909,9 +915,13 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
|
||||
// Add this logo to the Community/Collection
|
||||
if (dso.getType() == Constants.COLLECTION)
|
||||
{
|
||||
((Collection) dso).setLogo(fileStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
((Community) dso).setLogo(fileStream);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1029,8 +1039,10 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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.");
|
||||
}
|
||||
|
||||
// As this object doesn't already exist, we will perform an
|
||||
// ingest of a new object in order to restore it
|
||||
@@ -1128,10 +1140,14 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
protected String decodeHandleURN(String value)
|
||||
{
|
||||
if (value != null && value.startsWith("hdl:"))
|
||||
{
|
||||
return value.substring(4);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an existing DSpace Object (called during a replace)
|
||||
@@ -1244,8 +1260,10 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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.");
|
||||
}
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
@@ -160,8 +160,10 @@ public abstract class AbstractPackageIngester
|
||||
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)
|
||||
{
|
||||
throw ie;
|
||||
}
|
||||
}
|
||||
|
||||
//as long as our first object was ingested successfully
|
||||
if(dso!=null)
|
||||
|
@@ -899,8 +899,10 @@ public class ConfigurationManager
|
||||
from = end+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (result != null && from < value.length())
|
||||
{
|
||||
result.append(value.substring(from));
|
||||
|
@@ -88,10 +88,14 @@ public class DefaultEmbargoSetter implements EmbargoSetter
|
||||
if (terms != null && terms.length() > 0)
|
||||
{
|
||||
if (termsOpen.equals(terms))
|
||||
{
|
||||
return EmbargoManager.FOREVER;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new DCDate(terms);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@@ -123,12 +123,14 @@ public class ConsumerProfile
|
||||
{
|
||||
String fpart[] = part[j].split("\\+");
|
||||
if (fpart.length != 2)
|
||||
{
|
||||
log
|
||||
.error("Bad Filter clause in consumer stanza in Configuration entry for "
|
||||
+ CONSUMER_PREFIX
|
||||
+ name
|
||||
+ ".consumers: "
|
||||
+ part[j]);
|
||||
}
|
||||
else
|
||||
{
|
||||
int filter[] = new int[2];
|
||||
@@ -138,27 +140,35 @@ public class ConsumerProfile
|
||||
{
|
||||
int ot = Event.parseObjectType(objectNames[k]);
|
||||
if (ot == 0)
|
||||
{
|
||||
log
|
||||
.error("Bad ObjectType in Consumer Stanza in Configuration entry for "
|
||||
+ CONSUMER_PREFIX
|
||||
+ name
|
||||
+ ".consumers: " + objectNames[k]);
|
||||
}
|
||||
else
|
||||
{
|
||||
filter[Event.SUBJECT_MASK] |= ot;
|
||||
}
|
||||
}
|
||||
String eventNames[] = fpart[1].split("\\|");
|
||||
for (int k = 0; k < eventNames.length; ++k)
|
||||
{
|
||||
int et = Event.parseEventType(eventNames[k]);
|
||||
if (et == 0)
|
||||
{
|
||||
log
|
||||
.error("Bad EventType in Consumer Stanza in Configuration entry for "
|
||||
+ CONSUMER_PREFIX
|
||||
+ name
|
||||
+ ".consumers: " + eventNames[k]);
|
||||
}
|
||||
else
|
||||
{
|
||||
filter[Event.EVENT_MASK] |= et;
|
||||
}
|
||||
}
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
|
@@ -115,11 +115,15 @@ public abstract class AbstractTextFilterOFD implements OrderFormatDelegate
|
||||
for (int idx = 0; idx < filters.length; idx++)
|
||||
{
|
||||
if (language != null)
|
||||
{
|
||||
value = filters[idx].filter(value, language);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = filters[idx].filter(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@@ -1198,10 +1198,14 @@ public class DatabaseManager
|
||||
// Otherwise, store it as long
|
||||
long longValue = results.getLong(i);
|
||||
if (longValue <= (long)Integer.MAX_VALUE)
|
||||
row.setColumn(name, (int)longValue);
|
||||
{
|
||||
row.setColumn(name, (int) longValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
row.setColumn(name, longValue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Not Oracle
|
||||
if (jdbctype == Types.INTEGER)
|
||||
@@ -1402,7 +1406,9 @@ public class DatabaseManager
|
||||
{
|
||||
// If we are using Oracle, we can pass in long values, so always do so.
|
||||
if ("oracle".equals(dbName))
|
||||
{
|
||||
statement.setLong(count, row.getLongColumn(column));
|
||||
}
|
||||
else
|
||||
{ // not Oracle
|
||||
if (jdbctype == Types.INTEGER)
|
||||
|
@@ -190,10 +190,14 @@ public abstract class AbstractProcessingStep
|
||||
private static final void setErrorFields(HttpServletRequest request, List errorFields)
|
||||
{
|
||||
if(errorFields==null)
|
||||
{
|
||||
request.removeAttribute(ERROR_FIELDS_ATTRIBUTE);
|
||||
}
|
||||
else
|
||||
{
|
||||
request.setAttribute(ERROR_FIELDS_ATTRIBUTE, errorFields);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a single UI field to the list of all error fields (which can
|
||||
@@ -260,10 +264,14 @@ public abstract class AbstractProcessingStep
|
||||
public final String getErrorMessage(int errorFlag)
|
||||
{
|
||||
if (this.errorMessages == null || this.errorMessages.size() == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (String) this.errorMessages.get(Integer.valueOf(errorFlag));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an error message to the internal map for this step.
|
||||
|
@@ -126,10 +126,14 @@ public class CompleteStep extends AbstractProcessingStep
|
||||
{
|
||||
// commit changes to database
|
||||
if (success)
|
||||
{
|
||||
context.commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
context.getDBConnection().rollback();
|
||||
}
|
||||
}
|
||||
return STATUS_COMPLETE;
|
||||
}
|
||||
|
||||
|
@@ -610,17 +610,21 @@ public class DescribeStep extends AbstractProcessingStep
|
||||
addErrorField(request, metadataField);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.addMetadata(schema, element, qualifier, null,
|
||||
new DCPersonName(l, f).toString(), authKey,
|
||||
(sconf != null && sconf.length() > 0) ?
|
||||
Choices.getConfidenceValue(sconf) : Choices.CF_ACCEPTED);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item.addMetadata(schema, element, qualifier, null,
|
||||
new DCPersonName(l, f).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill out an item's metadata values from a plain standard text field. If
|
||||
@@ -738,15 +742,19 @@ public class DescribeStep extends AbstractProcessingStep
|
||||
addErrorField(request, metadataField);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.addMetadata(schema, element, qualifier, lang, s,
|
||||
authKey, (sconf != null && sconf.length() > 0) ?
|
||||
Choices.getConfidenceValue(sconf) : Choices.CF_ACCEPTED);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item.addMetadata(schema, element, qualifier, lang, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill out a metadata date field with the value from a form. The date is
|
||||
|
@@ -70,9 +70,13 @@ public abstract class AbstractUsageEventListener implements EventListener {
|
||||
|
||||
public void setEventService(EventService service) throws Exception {
|
||||
if(service != null)
|
||||
{
|
||||
service.registerEventListener(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RuntimeException("EventService handed to Listener cannot be null");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -339,10 +339,14 @@ public abstract class AbstractFiltersTransformer extends AbstractDSpaceTransform
|
||||
//Also make sure we don't go above our newest year
|
||||
int currentTop = year;
|
||||
if((year == topYear))
|
||||
{
|
||||
currentTop = newestYear;
|
||||
}
|
||||
else
|
||||
{
|
||||
//We need to do -1 on this one to get a better result
|
||||
currentTop--;
|
||||
}
|
||||
facetQueries.add(dateFacet + ":[" + bottomYear + " TO " + currentTop + "]");
|
||||
}
|
||||
for (String facetQuery : facetQueries) {
|
||||
|
@@ -482,9 +482,13 @@ public abstract class AbstractSearch extends AbstractFiltersTransformer {
|
||||
|
||||
if (sortBy != null) {
|
||||
if (sortOrder == null || sortOrder.equals("DESC"))
|
||||
{
|
||||
queryArgs.addSortField(sortBy, SolrQuery.ORDER.desc);
|
||||
}
|
||||
else
|
||||
{
|
||||
queryArgs.addSortField(sortBy, SolrQuery.ORDER.asc);
|
||||
}
|
||||
} else {
|
||||
queryArgs.addSortField("score", SolrQuery.ORDER.asc);
|
||||
}
|
||||
@@ -514,9 +518,13 @@ public abstract class AbstractSearch extends AbstractFiltersTransformer {
|
||||
queryArgs.setQuery(query != null && !query.trim().equals("") ? query : "*:*");
|
||||
|
||||
if (page > 1)
|
||||
{
|
||||
queryArgs.setStart((page - 1) * queryArgs.getRows());
|
||||
}
|
||||
else
|
||||
{
|
||||
queryArgs.setStart(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -590,11 +598,15 @@ public abstract class AbstractSearch extends AbstractFiltersTransformer {
|
||||
// Are we in a community or collection?
|
||||
DSpaceObject dso;
|
||||
if (scopeString == null || "".equals(scopeString))
|
||||
{
|
||||
// get the search scope from the url handle
|
||||
dso = HandleUtil.obtainHandle(objectModel);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the search scope from the location parameter
|
||||
dso = HandleManager.resolveToObject(context, scopeString);
|
||||
}
|
||||
|
||||
return dso;
|
||||
}
|
||||
|
@@ -193,9 +193,13 @@ public class CollectionSearch extends AbstractDSpaceTransformer implements Cache
|
||||
// Set the page title
|
||||
String name = collection.getMetadata("name");
|
||||
if (name == null || name.length() == 0)
|
||||
{
|
||||
pageMeta.addMetadata("title").addContent(T_untitled);
|
||||
}
|
||||
else
|
||||
{
|
||||
pageMeta.addMetadata("title").addContent(name);
|
||||
}
|
||||
|
||||
pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
|
||||
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath);
|
||||
|
@@ -223,9 +223,13 @@ public class CommunitySearch extends AbstractDSpaceTransformer implements Cachea
|
||||
Division home = body.addDivision("community-home", "primary repository community");
|
||||
String name = community.getMetadata("name");
|
||||
if (name == null || name.length() == 0)
|
||||
{
|
||||
home.setHead(T_untitled);
|
||||
}
|
||||
else
|
||||
{
|
||||
home.setHead(name);
|
||||
}
|
||||
|
||||
// The search / browse box.
|
||||
|
||||
|
@@ -148,10 +148,14 @@ public abstract class AbstractBrowserServlet extends DSpaceServlet
|
||||
if (bi == null)
|
||||
{
|
||||
if (sortBy > 0)
|
||||
{
|
||||
bi = BrowseIndex.getBrowseIndex(SortOption.getSortOption(sortBy));
|
||||
}
|
||||
else
|
||||
{
|
||||
bi = BrowseIndex.getBrowseIndex(SortOption.getDefaultSortOption());
|
||||
}
|
||||
}
|
||||
|
||||
// If we don't have a sort column
|
||||
if (bi != null && sortBy == -1)
|
||||
|
@@ -233,10 +233,14 @@ public class Authenticate
|
||||
}
|
||||
}
|
||||
if (count == 1)
|
||||
{
|
||||
response.sendRedirect(url);
|
||||
}
|
||||
else
|
||||
{
|
||||
JSPManager.showJSP(request, response, "/login/chooser.jsp");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -77,8 +77,10 @@ public class CollectionStyleSelection extends AKeyBasedStyleSelection
|
||||
return getFromMap(c.getHandle());
|
||||
}
|
||||
else
|
||||
{
|
||||
return "default"; //no specific style - item is an in progress Submission
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Put collection handle/style name mapping in an in-memory map.
|
||||
|
@@ -1332,6 +1332,7 @@ abstract class DAVResource
|
||||
typeMask = TYPE_ALL;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (String element : types)
|
||||
{
|
||||
String key = element.trim();
|
||||
@@ -1362,6 +1363,7 @@ abstract class DAVResource
|
||||
"Unrecognized type keyword: " + key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return typeMask;
|
||||
}
|
||||
|
||||
|
@@ -99,7 +99,9 @@ public class DatasetTimeGenerator extends DatasetGenerator {
|
||||
endPos = true;
|
||||
}else
|
||||
if(0 < difEnd)
|
||||
{
|
||||
endPos = true;
|
||||
}
|
||||
else{
|
||||
difEnd++;
|
||||
}
|
||||
@@ -209,7 +211,9 @@ public class DatasetTimeGenerator extends DatasetGenerator {
|
||||
cal2 = backup;
|
||||
toAdd = 1;
|
||||
}else
|
||||
{
|
||||
toAdd = -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -51,13 +51,17 @@ public class ApacheLogRobotsProcessor {
|
||||
String logFileLoc;
|
||||
String spiderIpPath;
|
||||
if (line.hasOption("l"))
|
||||
{
|
||||
logFileLoc = line.getOptionValue("l");
|
||||
}
|
||||
else {
|
||||
System.out.println("We need our log file");
|
||||
return;
|
||||
}
|
||||
if (line.hasOption("s"))
|
||||
{
|
||||
spiderIpPath = line.getOptionValue("s");
|
||||
}
|
||||
else {
|
||||
System.out.println("We need a spider IP output file");
|
||||
return;
|
||||
|
@@ -434,9 +434,13 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
message.setLabel(T_alerts_message_label);
|
||||
message.setSize(5, 45);
|
||||
if (SystemwideAlerts.getMessage() == null)
|
||||
{
|
||||
message.setValue(T_alerts_message_default);
|
||||
}
|
||||
else
|
||||
{
|
||||
message.setValue(SystemwideAlerts.getMessage());
|
||||
}
|
||||
|
||||
Select countdown = form.addItem().addSelect("countdown");
|
||||
countdown.setLabel(T_alerts_countdown_label);
|
||||
@@ -449,9 +453,13 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
|
||||
// Is there a current count down active?
|
||||
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
|
||||
{
|
||||
countdown.setOptionSelected(0);
|
||||
}
|
||||
|
||||
Select restrictsessions = form.addItem().addSelect("restrictsessions");
|
||||
restrictsessions.setLabel(T_alerts_session_label);
|
||||
@@ -627,11 +635,17 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
long ago = System.currentTimeMillis() - event.getTimeStamp();
|
||||
|
||||
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)
|
||||
timeStampMessage = T_minutes.parameterize((ago / (60*1000)));
|
||||
{
|
||||
timeStampMessage = T_minutes.parameterize((ago / (60 * 1000)));
|
||||
}
|
||||
else
|
||||
{
|
||||
timeStampMessage = T_seconds.parameterize((ago / (1000)));
|
||||
}
|
||||
|
||||
|
||||
Row eventRow = activeUsers.addRow();
|
||||
|
@@ -125,8 +125,14 @@ public class DeletePoliciesConfirm extends AbstractDSpaceTransformer
|
||||
Row row = table.addRow();
|
||||
row.addCell().addContent(policy.getID());
|
||||
row.addCell().addContent(policy.getActionText());
|
||||
if (policy.getGroup() != null) row.addCell().addContent(policy.getGroup().getName());
|
||||
else row.addCell().addContent("...");
|
||||
if (policy.getGroup() != null)
|
||||
{
|
||||
row.addCell().addContent(policy.getGroup().getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
row.addCell().addContent("...");
|
||||
}
|
||||
}
|
||||
Para buttons = deleted.addPara();
|
||||
buttons.addButton("submit_confirm").setValue(T_submit_confirm);
|
||||
|
@@ -91,9 +91,13 @@ public class DeleteCollectionRoleConfirm extends AbstractDSpaceTransformer
|
||||
main.setHead(T_main_head.parameterize(role));
|
||||
// Different help message for the default read group to enforce its non-retroactive nature
|
||||
if (role == "DEFAULT_READ")
|
||||
{
|
||||
main.addPara(T_main_para_read.parameterize(toBeDeleted.getName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
main.addPara(T_main_para.parameterize(toBeDeleted.getName()));
|
||||
}
|
||||
|
||||
Para buttonList = main.addPara();
|
||||
buttonList.addButton("submit_confirm").setValue(T_submit_confirm);
|
||||
|
@@ -99,9 +99,13 @@ public class CreateCommunityForm extends AbstractDSpaceTransformer
|
||||
/* Whether the parent community is null is what determines if
|
||||
we are creating a top-level community or a sub-community */
|
||||
if (parentCommunity != null)
|
||||
{
|
||||
main.setHead(T_main_head_sub.parameterize(parentCommunity.getMetadata("name")));
|
||||
}
|
||||
else
|
||||
{
|
||||
main.setHead(T_main_head_top);
|
||||
}
|
||||
|
||||
|
||||
// The grand list of metadata options
|
||||
|
@@ -444,9 +444,13 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer
|
||||
|
||||
queryArgs.setQuery(query);
|
||||
if (page > 1)
|
||||
{
|
||||
queryArgs.setStart((Integer.valueOf(page) - 1) * queryArgs.getPageSize());
|
||||
}
|
||||
else
|
||||
{
|
||||
queryArgs.setStart(0);
|
||||
}
|
||||
|
||||
QueryResults qResults = null;
|
||||
if (scope instanceof Community)
|
||||
@@ -480,11 +484,15 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer
|
||||
// Are we in a community or collection?
|
||||
DSpaceObject dso;
|
||||
if (scopeString == null || "".equals(scopeString))
|
||||
{
|
||||
// get the search scope from the url handle
|
||||
dso = HandleUtil.obtainHandle(objectModel);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the search scope from the location parameter
|
||||
dso = HandleManager.resolveToObject(context, scopeString);
|
||||
}
|
||||
|
||||
return dso;
|
||||
}
|
||||
|
@@ -242,9 +242,13 @@ public class CollectionViewer extends AbstractDSpaceTransformer implements Cache
|
||||
Division home = body.addDivision("collection-home", "primary repository collection");
|
||||
String name = collection.getMetadata("name");
|
||||
if (name == null || name.length() == 0)
|
||||
{
|
||||
home.setHead(T_untitled);
|
||||
}
|
||||
else
|
||||
{
|
||||
home.setHead(name);
|
||||
}
|
||||
|
||||
// The search / browse box.
|
||||
{
|
||||
|
@@ -207,9 +207,13 @@ public class CommunityViewer extends AbstractDSpaceTransformer implements Cachea
|
||||
// Set the page title
|
||||
String name = community.getMetadata("name");
|
||||
if (name == null || name.length() == 0)
|
||||
{
|
||||
pageMeta.addMetadata("title").addContent(T_untitled);
|
||||
}
|
||||
else
|
||||
{
|
||||
pageMeta.addMetadata("title").addContent(name);
|
||||
}
|
||||
|
||||
// Add the trail back to the repository root.
|
||||
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");
|
||||
String name = community.getMetadata("name");
|
||||
if (name == null || name.length() == 0)
|
||||
{
|
||||
home.setHead(T_untitled);
|
||||
}
|
||||
else
|
||||
{
|
||||
home.setHead(name);
|
||||
}
|
||||
|
||||
// The search / browse box.
|
||||
{
|
||||
|
@@ -422,12 +422,18 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
year.addOption(false, String.valueOf(i), String.valueOf(i));
|
||||
|
||||
if (i <= fiveYearBreak)
|
||||
{
|
||||
i -= 10;
|
||||
}
|
||||
else if (i <= oneYearBreak)
|
||||
{
|
||||
i -= 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
i--;
|
||||
}
|
||||
}
|
||||
while (i > tenYearBreak);
|
||||
|
||||
// Create a free text entry box for the year
|
||||
@@ -866,16 +872,22 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
value = "\""+cm.getLabel(fk, info.getValue(), null)+"\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
value = "\"" + info.getValue() + "\"";
|
||||
}
|
||||
}
|
||||
|
||||
// Get the name of any scoping element (collection / community)
|
||||
String scopeName = "";
|
||||
|
||||
if (info.getBrowseContainer() != null)
|
||||
{
|
||||
scopeName = info.getBrowseContainer().getName();
|
||||
}
|
||||
else
|
||||
{
|
||||
scopeName = "";
|
||||
}
|
||||
|
||||
if (bix.isMetadataIndex())
|
||||
{
|
||||
@@ -907,9 +919,13 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
String scopeName = "";
|
||||
|
||||
if (info.getBrowseContainer() != null)
|
||||
{
|
||||
scopeName = info.getBrowseContainer().getName();
|
||||
}
|
||||
else
|
||||
{
|
||||
scopeName = "";
|
||||
}
|
||||
|
||||
if (bix.isMetadataIndex())
|
||||
{
|
||||
|
@@ -161,9 +161,13 @@ public class ChoiceLookupTransformer extends AbstractDSpaceTransformer
|
||||
|
||||
Division idiv = body.addInteractiveDivision("lookup", "", "get", "popup");
|
||||
if (isFieldMessage(field, "title"))
|
||||
{
|
||||
idiv.setHead(getFieldMessage(field, "title"));
|
||||
}
|
||||
else
|
||||
{
|
||||
idiv.setHead(getFieldLabel(field, "title"));
|
||||
}
|
||||
List fl = idiv.addList("choicesList", "form", "choices-lookup");
|
||||
fl.setHead(T_results);
|
||||
|
||||
@@ -204,10 +208,14 @@ public class ChoiceLookupTransformer extends AbstractDSpaceTransformer
|
||||
{
|
||||
h = selectItem.addHidden("paramNonAuthority");
|
||||
if (isFieldMessage(field, "nonauthority"))
|
||||
{
|
||||
h.setValue(getFieldMessage(field, "nonauthority"));
|
||||
}
|
||||
else
|
||||
{
|
||||
h.setValue(getFieldLabel(field, "nonauthority"));
|
||||
}
|
||||
}
|
||||
h = selectItem.addHidden("contextPath");
|
||||
h.setValue(contextPath);
|
||||
|
||||
@@ -315,10 +323,14 @@ public class ChoiceLookupTransformer extends AbstractDSpaceTransformer
|
||||
{
|
||||
String cv = getFieldLabel(field, name);
|
||||
if (cv == null)
|
||||
return message(MESSAGE_PREFIX+"field."+field+"."+name);
|
||||
{
|
||||
return message(MESSAGE_PREFIX + "field." + field + "." + name);
|
||||
}
|
||||
else
|
||||
{
|
||||
return message(cv);
|
||||
}
|
||||
}
|
||||
|
||||
private int atoi(String s)
|
||||
{
|
||||
|
@@ -504,9 +504,13 @@ abstract public class AbstractStep extends AbstractDSpaceTransformer
|
||||
if (errors!=null && errors.length() > 0)
|
||||
{
|
||||
if(errors.indexOf(',') > 0)
|
||||
{
|
||||
fields = Arrays.asList(errors.split(","));
|
||||
}
|
||||
else//only one error field
|
||||
{
|
||||
fields.add(errors);
|
||||
}
|
||||
}
|
||||
|
||||
return fields;
|
||||
@@ -532,12 +536,18 @@ abstract public class AbstractStep extends AbstractDSpaceTransformer
|
||||
try
|
||||
{
|
||||
if (givenStepAndPage.equals(this.stepAndPage))
|
||||
{
|
||||
return "current";
|
||||
}
|
||||
else if (givenStepAndPage.compareTo(getMaxStepAndPageReached())>0)
|
||||
{
|
||||
return "disabled";
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
return null;
|
||||
|
@@ -409,8 +409,10 @@ public class DescribeStep extends AbstractSubmissionStep
|
||||
authItem.addContent(displayValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
describeSection.addItem(displayValue);
|
||||
}
|
||||
}
|
||||
} // For each DCValue
|
||||
} // If values exist
|
||||
}// For each input
|
||||
@@ -496,12 +498,16 @@ public class DescribeStep extends AbstractSubmissionStep
|
||||
if (isAuthorityControlled)
|
||||
{
|
||||
if (dcValue.authority == null || dcValue.authority.equals(""))
|
||||
{
|
||||
fi.setAuthorityValue("", "blank");
|
||||
}
|
||||
else
|
||||
{
|
||||
fi.setAuthorityValue(dcValue.authority, Choices.getConfidenceText(dcValue.confidence));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dcValues.length == 1)
|
||||
{
|
||||
DCPersonName dpn = new DCPersonName(dcValues[0].value);
|
||||
@@ -511,12 +517,16 @@ public class DescribeStep extends AbstractSubmissionStep
|
||||
if (isAuthorityControlled)
|
||||
{
|
||||
if (dcValues[0].authority == null || dcValues[0].authority.equals(""))
|
||||
{
|
||||
lastName.setAuthorityValue("", "blank");
|
||||
}
|
||||
else
|
||||
{
|
||||
lastName.setAuthorityValue(dcValues[0].authority, Choices.getConfidenceText(dcValues[0].confidence));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a date field to the DRI document. The date field consists of
|
||||
@@ -604,11 +614,15 @@ public class DescribeStep extends AbstractSubmissionStep
|
||||
// Check if the day field is not specified, if so then just
|
||||
// put a blank value in instead of the wiered looking -1.
|
||||
if (dcDate.getDay() == -1)
|
||||
{
|
||||
day.setValue("");
|
||||
}
|
||||
else
|
||||
{
|
||||
day.setValue(String.valueOf(dcDate.getDay()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a series field to the DRI document. The series field conist of
|
||||
@@ -818,24 +832,32 @@ public class DescribeStep extends AbstractSubmissionStep
|
||||
if (isAuth)
|
||||
{
|
||||
if (dcValue.authority == null || dcValue.authority.equals(""))
|
||||
{
|
||||
ti.setAuthorityValue("", "blank");
|
||||
}
|
||||
else
|
||||
{
|
||||
ti.setAuthorityValue(dcValue.authority, Choices.getConfidenceText(dcValue.confidence));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dcValues.length == 1)
|
||||
{
|
||||
textArea.setValue(dcValues[0].value);
|
||||
if (isAuth)
|
||||
{
|
||||
if (dcValues[0].authority == null || dcValues[0].authority.equals(""))
|
||||
{
|
||||
textArea.setAuthorityValue("", "blank");
|
||||
}
|
||||
else
|
||||
{
|
||||
textArea.setAuthorityValue(dcValues[0].authority, Choices.getConfidenceText(dcValues[0].confidence));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a dropdown field for a choice-controlled input of the
|
||||
@@ -879,7 +901,9 @@ public class DescribeStep extends AbstractSubmissionStep
|
||||
select.setSize(6);
|
||||
}
|
||||
else
|
||||
{
|
||||
select.setSize(1);
|
||||
}
|
||||
|
||||
if (readonly)
|
||||
{
|
||||
@@ -1108,24 +1132,32 @@ public class DescribeStep extends AbstractSubmissionStep
|
||||
if (isAuth)
|
||||
{
|
||||
if (dcValue.authority == null || dcValue.authority.equals(""))
|
||||
{
|
||||
ti.setAuthorityValue("", "blank");
|
||||
}
|
||||
else
|
||||
{
|
||||
ti.setAuthorityValue(dcValue.authority, Choices.getConfidenceText(dcValue.confidence));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dcValues.length == 1)
|
||||
{
|
||||
text.setValue(dcValues[0].value);
|
||||
if (isAuth)
|
||||
{
|
||||
if (dcValues[0].authority == null || dcValues[0].authority.equals(""))
|
||||
{
|
||||
text.setAuthorityValue("", "blank");
|
||||
}
|
||||
else
|
||||
{
|
||||
text.setAuthorityValue(dcValues[0].authority, Choices.getConfidenceText(dcValues[0].confidence));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -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.");
|
||||
|
||||
if (help)
|
||||
div.addPara().addXref(makeURL(false,error),"Turn help OFF");
|
||||
{
|
||||
div.addPara().addXref(makeURL(false, error), "Turn help OFF");
|
||||
}
|
||||
else
|
||||
div.addPara().addXref(makeURL(true,error),"Turn help ON");
|
||||
{
|
||||
div.addPara().addXref(makeURL(true, error), "Turn help ON");
|
||||
}
|
||||
|
||||
if (error)
|
||||
div.addPara().addXref(makeURL(help,false),"Turn errors OFF");
|
||||
{
|
||||
div.addPara().addXref(makeURL(help, false), "Turn errors OFF");
|
||||
}
|
||||
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);
|
||||
|
@@ -268,9 +268,13 @@ public class BitstreamReader extends AbstractReader implements Recyclable
|
||||
|
||||
//build redirect URL based on whether item has a handle assigned yet
|
||||
if(item.getHandle()!=null && item.getHandle().length()>0)
|
||||
{
|
||||
redirectURL = request.getContextPath() + "/bitstream/handle/" + item.getHandle();
|
||||
}
|
||||
else
|
||||
{
|
||||
redirectURL = request.getContextPath() + "/bitstream/item/" + item.getID();
|
||||
}
|
||||
|
||||
redirectURL += "/" + name + "?sequence=" + bitstream.getSequenceID();
|
||||
|
||||
|
@@ -474,11 +474,17 @@ public abstract class AbstractAdapter
|
||||
// with an item (such as a community logo) then reference the bitstreamID directly.
|
||||
String identifier = null;
|
||||
if (item != null && item.getHandle() != null)
|
||||
identifier = "handle/"+item.getHandle();
|
||||
{
|
||||
identifier = "handle/" + item.getHandle();
|
||||
}
|
||||
else if (item != null)
|
||||
identifier = "item/"+item.getID();
|
||||
{
|
||||
identifier = "item/" + item.getID();
|
||||
}
|
||||
else
|
||||
identifier = "id/"+bitstream.getID();
|
||||
{
|
||||
identifier = "id/" + bitstream.getID();
|
||||
}
|
||||
|
||||
|
||||
String url = contextPath + "/bitstream/"+identifier+"/";
|
||||
@@ -710,9 +716,13 @@ public abstract class AbstractAdapter
|
||||
{
|
||||
String prefix = namespaces.getPrefix(namespace.URI);
|
||||
if (prefix == null || prefix.equals(""))
|
||||
{
|
||||
return localName;
|
||||
}
|
||||
else
|
||||
{
|
||||
return prefix + ":" + localName;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -154,12 +154,18 @@ public class ContainerAdapter extends AbstractAdapter
|
||||
if (dso.getHandle() == null)
|
||||
{
|
||||
if (dso instanceof Collection)
|
||||
return "collection:"+dso.getID();
|
||||
else
|
||||
return "community:"+dso.getID();
|
||||
{
|
||||
return "collection:" + dso.getID();
|
||||
}
|
||||
else
|
||||
return "hdl:"+dso.getHandle();
|
||||
{
|
||||
return "community:" + dso.getID();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "hdl:" + dso.getHandle();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,10 +184,14 @@ public class ContainerAdapter extends AbstractAdapter
|
||||
protected String getMETSLabel()
|
||||
{
|
||||
if (dso instanceof Community)
|
||||
{
|
||||
return "DSpace Community";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "DSpace Collection";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a unique id for the given bitstream
|
||||
|
@@ -433,11 +433,15 @@ public class AuthenticationUtil
|
||||
Context context = ContextUtil.obtainContext(objectModel);
|
||||
|
||||
if (SystemwideAlerts.canUserStartSession())
|
||||
return AuthenticationManager.canSelfRegister(context,request,email);
|
||||
{
|
||||
return AuthenticationManager.canSelfRegister(context, request, email);
|
||||
}
|
||||
else
|
||||
{
|
||||
// System wide alerts is preventing new sessions.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the EPerson (to be created or already created) has the
|
||||
|
@@ -433,9 +433,13 @@ public abstract class AbstractWingElement implements WingElement
|
||||
Namespace namespace = attributeMap.getNamespace();
|
||||
String URI;
|
||||
if (namespace != null)
|
||||
{
|
||||
URI = namespace.URI;
|
||||
}
|
||||
else
|
||||
{
|
||||
URI = WingConstants.DRI.URI;
|
||||
}
|
||||
|
||||
String prefix = namespaces.getPrefix(URI);
|
||||
|
||||
@@ -478,10 +482,14 @@ public abstract class AbstractWingElement implements WingElement
|
||||
private String qName(String prefix, String localName)
|
||||
{
|
||||
if (prefix == null || prefix.equals(""))
|
||||
{
|
||||
return localName;
|
||||
}
|
||||
else
|
||||
{
|
||||
return prefix + ":" + localName;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispose
|
||||
|
Reference in New Issue
Block a user