[DS-707] Simplify expressions

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5622 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Graham Triggs
2010-10-24 22:14:43 +00:00
parent fa7af795d1
commit 60180f9f23
17 changed files with 62 additions and 68 deletions

View File

@@ -253,7 +253,7 @@ public class XHTMLHeadDisseminationCrosswalk extends SelfNamedPlugin implements
: handle) + " field " + originalKey); : handle) + " field " + originalKey);
} }
} }
else if (provenance != true) else if (!provenance)
{ {
Element e = new Element("meta", XHTML_NAMESPACE); Element e = new Element("meta", XHTML_NAMESPACE);
e.setAttribute("name", name); e.setAttribute("name", name);

View File

@@ -206,7 +206,7 @@ public class Harvest
parameters.add(toTimestamp(endDate, selfGenerated)); parameters.add(toTimestamp(endDate, selfGenerated));
} }
if (withdrawn == false) if (!withdrawn)
{ {
// Exclude withdrawn items // Exclude withdrawn items
if ("oracle".equals(ConfigurationManager.getProperty("db.name"))) if ("oracle".equals(ConfigurationManager.getProperty("db.name")))

View File

@@ -182,43 +182,43 @@ public class InitialQuestionsStep extends AbstractProcessingStep
// Now check to see if the changes will remove any values // Now check to see if the changes will remove any values
// (i.e. multiple files, titles or an issue date.) // (i.e. multiple files, titles or an issue date.)
// shouldn't need to check if submission is null, but just in case! if (subInfo.getSubmissionItem() != null)
if ((multipleTitles == false)
&& (subInfo.getSubmissionItem() != null))
{ {
DCValue[] altTitles = subInfo.getSubmissionItem().getItem() // shouldn't need to check if submission is null, but just in case!
.getDC("title", "alternative", Item.ANY); if (!multipleTitles)
willRemoveTitles = altTitles.length > 0;
}
if ((publishedBefore == false)
&& (subInfo.getSubmissionItem() != null))
{
DCValue[] dateIssued = subInfo.getSubmissionItem().getItem()
.getDC("date", "issued", Item.ANY);
DCValue[] citation = subInfo.getSubmissionItem().getItem()
.getDC("identifier", "citation", Item.ANY);
DCValue[] publisher = subInfo.getSubmissionItem().getItem()
.getDC("publisher", null, Item.ANY);
willRemoveDate = (dateIssued.length > 0)
|| (citation.length > 0) || (publisher.length > 0);
}
if ((multipleFiles == false)
&& (subInfo.getSubmissionItem() != null))
{
// see if number of bitstreams in "ORIGINAL" bundle > 1
// FIXME: Assumes multiple bundles, clean up someday...
Bundle[] bundles = subInfo.getSubmissionItem().getItem()
.getBundles("ORIGINAL");
if (bundles.length > 0)
{ {
Bitstream[] bitstreams = bundles[0].getBitstreams(); DCValue[] altTitles = subInfo.getSubmissionItem().getItem()
.getDC("title", "alternative", Item.ANY);
willRemoveFiles = bitstreams.length > 1; willRemoveTitles = altTitles.length > 0;
}
if (!publishedBefore)
{
DCValue[] dateIssued = subInfo.getSubmissionItem().getItem()
.getDC("date", "issued", Item.ANY);
DCValue[] citation = subInfo.getSubmissionItem().getItem()
.getDC("identifier", "citation", Item.ANY);
DCValue[] publisher = subInfo.getSubmissionItem().getItem()
.getDC("publisher", null, Item.ANY);
willRemoveDate = (dateIssued.length > 0)
|| (citation.length > 0) || (publisher.length > 0);
}
if (!multipleFiles)
{
// see if number of bitstreams in "ORIGINAL" bundle > 1
// FIXME: Assumes multiple bundles, clean up someday...
Bundle[] bundles = subInfo.getSubmissionItem().getItem()
.getBundles("ORIGINAL");
if (bundles.length > 0)
{
Bitstream[] bitstreams = bundles[0].getBitstreams();
willRemoveFiles = bitstreams.length > 1;
}
} }
} }
@@ -310,22 +310,19 @@ public class InitialQuestionsStep extends AbstractProcessingStep
// get the item to prune // get the item to prune
Item item = subInfo.getSubmissionItem().getItem(); Item item = subInfo.getSubmissionItem().getItem();
if (multipleTitles == false if (!multipleTitles && subInfo.getSubmissionItem().hasMultipleTitles())
&& subInfo.getSubmissionItem().hasMultipleTitles())
{ {
item.clearDC("title", "alternative", Item.ANY); item.clearDC("title", "alternative", Item.ANY);
} }
if (publishedBefore == false if (!publishedBefore && subInfo.getSubmissionItem().isPublishedBefore())
&& subInfo.getSubmissionItem().isPublishedBefore())
{ {
item.clearDC("date", "issued", Item.ANY); item.clearDC("date", "issued", Item.ANY);
item.clearDC("identifier", "citation", Item.ANY); item.clearDC("identifier", "citation", Item.ANY);
item.clearDC("publisher", null, Item.ANY); item.clearDC("publisher", null, Item.ANY);
} }
if (multipleFiles == false if (!multipleFiles && subInfo.getSubmissionItem().hasMultipleFiles())
&& subInfo.getSubmissionItem().hasMultipleFiles())
{ {
// remove all but first bitstream from bundle[0] // remove all but first bitstream from bundle[0]
// FIXME: Assumes multiple bundles, clean up someday... // FIXME: Assumes multiple bundles, clean up someday...

View File

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

View File

@@ -530,7 +530,7 @@ public abstract class AbstractFiltersTransformer extends AbstractDSpaceTransform
queryArgs = null; queryArgs = null;
} }
private class FilterDisplayValue { private static class FilterDisplayValue {
private String asFilterQuery; private String asFilterQuery;
private String displayedVal; private String displayedVal;
private long count; private long count;

View File

@@ -677,7 +677,7 @@ public class SearchFacetFilter extends AbstractDSpaceTransformer implements Cach
return request.getParameterValues("fq") != null ? request.getParameterValues("fq") : new String[0]; return request.getParameterValues("fq") != null ? request.getParameterValues("fq") : new String[0];
} }
private class SearchFilterParam { private static class SearchFilterParam {
private Request request; private Request request;
/** The always present commond params **/ /** The always present commond params **/

View File

@@ -88,9 +88,7 @@ public class EditProfileServlet extends DSpaceServlet
// Find out if they're trying to set a new password // Find out if they're trying to set a new password
boolean settingPassword = false; boolean settingPassword = false;
if ((eperson.getRequireCertificate() == false) if (eperson.getRequireCertificate() == false && !StringUtils.isEmpty(request.getParameter("password")))
&& (request.getParameter("password") != null)
&& !request.getParameter("password").equals(""))
{ {
settingPassword = true; settingPassword = true;
} }

View File

@@ -292,7 +292,7 @@ public class MyDSpaceServlet extends DSpaceServlet
} }
} }
if (ok == false) if (!ok)
{ {
log.warn(LogManager.getHeader(context, "integrity_error", UIUtil log.warn(LogManager.getHeader(context, "integrity_error", UIUtil
.getRequestLogInfo(request))); .getRequestLogInfo(request)));

View File

@@ -530,7 +530,7 @@ public class RegisterServlet extends DSpaceServlet
// If the user set a password, make sure it's OK // If the user set a password, make sure it's OK
boolean passwordOK = true; boolean passwordOK = true;
if (eperson.getRequireCertificate() == false && netid==null && if (!eperson.getRequireCertificate() && netid==null &&
AuthenticationManager.allowSetPassword(context, request, AuthenticationManager.allowSetPassword(context, request,
eperson.getEmail())) eperson.getEmail()))
{ {

View File

@@ -91,7 +91,7 @@ public class StatisticsServlet extends org.dspace.app.webui.servlet.DSpaceServle
boolean publicise = ConfigurationManager.getBooleanProperty("report.public"); boolean publicise = ConfigurationManager.getBooleanProperty("report.public");
// determine the navigation bar to be displayed // determine the navigation bar to be displayed
String navbar = (publicise == false ? "admin" : "default"); String navbar = (!publicise ? "admin" : "default");
request.setAttribute("navbar", navbar); request.setAttribute("navbar", navbar);
// is the user a member of the Administrator (1) group // is the user a member of the Administrator (1) group

View File

@@ -78,10 +78,9 @@ public class LNIRemoteException extends org.apache.axis.AxisFault implements j
} }
__equalsCalc = obj; __equalsCalc = obj;
boolean _equals; boolean _equals;
_equals = true && _equals = ((this.cause1 == null && other.getCause1() == null) ||
((this.cause1==null && other.getCause1()==null) || (this.cause1 != null &&
(this.cause1!=null && this.cause1.equals(other.getCause1()))) &&
this.cause1.equals(other.getCause1()))) &&
((this.message1==null && other.getMessage1()==null) || ((this.message1==null && other.getMessage1()==null) ||
(this.message1!=null && (this.message1!=null &&
this.message1.equals(other.getMessage1()))); this.message1.equals(other.getMessage1())));

View File

@@ -116,7 +116,7 @@ public class SendFeedbackAction extends AbstractAction
basicHost = host.substring(host.substring(0, lastDot).lastIndexOf('.')); basicHost = host.substring(host.substring(0, lastDot).lastIndexOf('.'));
} }
if ((fromPage == null) || ((fromPage.indexOf(basicHost) == -1) && (validReferral == false))) if ((fromPage == null) || ((fromPage.indexOf(basicHost) == -1) && (!validReferral)))
{ {
// N.B. must use old message catalog because Cocoon i18n is only available to transformed pages. // N.B. must use old message catalog because Cocoon i18n is only available to transformed pages.
throw new AuthorizeException(I18nUtil.getMessage("feedback.error.forbidden")); throw new AuthorizeException(I18nUtil.getMessage("feedback.error.forbidden"));

View File

@@ -162,7 +162,7 @@ public class StartRegistration extends AbstractDSpaceTransformer implements Cach
public Serializable getKey() public Serializable getKey()
{ {
// Only cache on the first attempt. // Only cache on the first attempt.
if (email == null && accountExists == false && errors != null && errors.size() == 0) if (email == null && !accountExists && errors != null && errors.size() == 0)
{ {
// cacheable // cacheable
return "1"; return "1";
@@ -179,7 +179,7 @@ public class StartRegistration extends AbstractDSpaceTransformer implements Cach
*/ */
public SourceValidity getValidity() public SourceValidity getValidity()
{ {
if (email == null && accountExists == false && errors != null && errors.size() == 0) if (email == null && !accountExists && errors != null && errors.size() == 0)
{ {
// Always valid // Always valid
return NOPValidity.SHARED_INSTANCE; return NOPValidity.SHARED_INSTANCE;

View File

@@ -547,7 +547,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
NamespaceSupport namespaces) throws SAXException NamespaceSupport namespaces) throws SAXException
{ {
if (this.merged == false) if (!this.merged)
{ {
AttributeMap attributes = new AttributeMap(); AttributeMap attributes = new AttributeMap();
attributes.put(A_NAME, this.name); attributes.put(A_NAME, this.name);
@@ -565,7 +565,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
} }
if (childMerged == false && head != null) if (!childMerged && head != null)
{ {
head.toSAX(contentHandler, lexicalHandler, namespaces); head.toSAX(contentHandler, lexicalHandler, namespaces);
} }
@@ -575,7 +575,7 @@ public class List extends AbstractWingElement implements WingMergeableElement,
content.toSAX(contentHandler, lexicalHandler, namespaces); content.toSAX(contentHandler, lexicalHandler, namespaces);
} }
if (this.merged == false) if (!this.merged)
{ {
endElement(contentHandler, namespaces, E_LIST); endElement(contentHandler, namespaces, E_LIST);
} }

View File

@@ -139,15 +139,15 @@ public class Metadata extends TextContainer implements MetadataElement
return false; return false;
} }
if (stringEqualsWithNulls(this.element, element) == false) if (!stringEqualsWithNulls(this.element, element))
{ {
return false; return false;
} }
if (stringEqualsWithNulls(this.qualifier, qualifier) == false) if (!stringEqualsWithNulls(this.qualifier, qualifier))
{ {
return false; return false;
} }
if (stringEqualsWithNulls(this.language, language) == false) if (!stringEqualsWithNulls(this.language, language))
{ {
return false; return false;
} }

View File

@@ -410,7 +410,7 @@ public class Params extends AbstractWingElement implements StructuralElement
attributes.put(A_MAX_LENGTH, this.maxlength); attributes.put(A_MAX_LENGTH, this.maxlength);
} }
if (this.multiple == true) if (this.multiple)
{ {
attributes.put(A_MULTIPLE, this.multiple); attributes.put(A_MULTIPLE, this.multiple);
} }

View File

@@ -262,7 +262,7 @@ public class SimpleHTMLFragment extends AbstractWingElement {
boolean empty = true; boolean empty = true;
for (Content content : contents) { for (Content content : contents) {
if (empty == false) if (!empty)
{ {
continue; continue;
} }
@@ -278,7 +278,7 @@ public class SimpleHTMLFragment extends AbstractWingElement {
} }
} }
if (empty == true) if (empty)
{ {
return false; return false;
} }