[DS-707] Style / readability improvements

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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