mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-11 20:13:17 +00:00
[DS-707] Style / readability fixes
git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5574 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -147,11 +147,17 @@ public class XPDF2Text extends MediaFilter
|
||||
status = pdfProc.waitFor();
|
||||
String msg = null;
|
||||
if (status == 1)
|
||||
{
|
||||
msg = "pdftotext failed opening input: file=" + sourceTmp.toString();
|
||||
}
|
||||
else if (status == 3)
|
||||
{
|
||||
msg = "pdftotext permission failure (perhaps copying of text from this document is not allowed - check PDF file's internal permissions): file=" + sourceTmp.toString();
|
||||
}
|
||||
else if (status != 0)
|
||||
{
|
||||
msg = "pdftotext failed, maybe corrupt PDF? status=" + String.valueOf(status);
|
||||
}
|
||||
|
||||
if (msg != null)
|
||||
{
|
||||
|
@@ -302,7 +302,9 @@ public class XPDF2Thumbnail extends MediaFilter
|
||||
// ALSO pass through if min and max are both 0
|
||||
if ((min == 0 && max == 0) ||
|
||||
(msize >= min && Math.min(xsize, ysize) <= max))
|
||||
{
|
||||
return source;
|
||||
}
|
||||
else
|
||||
{
|
||||
int xnew = xsize * max / msize;
|
||||
|
@@ -138,15 +138,25 @@ public class StatisticsLoader
|
||||
public int compare(Date d1, Date d2)
|
||||
{
|
||||
if (d1 == null && d2 == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (d1 == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if (d2 == null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if (d1.before(d2))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if (d2.before(d1))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -213,12 +223,18 @@ public class StatisticsLoader
|
||||
File[] fileList = StatisticsLoader.getAnalysisAndReportFileList();
|
||||
|
||||
if (fileList != null && fileList.length != fileCount)
|
||||
{
|
||||
StatisticsLoader.loadFileList(fileList);
|
||||
}
|
||||
else if (lastLoaded == null)
|
||||
{
|
||||
StatisticsLoader.loadFileList(fileList);
|
||||
}
|
||||
else if (DateUtils.addHours(lastLoaded, 1).before(new Date()))
|
||||
{
|
||||
StatisticsLoader.loadFileList(fileList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the cached file list from the array of files
|
||||
|
@@ -270,9 +270,13 @@ public class SyndicationFeed
|
||||
for (DCValue v : dcv)
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
db.append("; ");
|
||||
}
|
||||
db.append(isDate ? new DCDate(v.value).toString() : v.value);
|
||||
}
|
||||
db.append("\n");
|
||||
@@ -441,7 +445,9 @@ public class SyndicationFeed
|
||||
if (baseURL == null)
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
baseURL = ConfigurationManager.getProperty("dspace.url");
|
||||
}
|
||||
else
|
||||
{
|
||||
baseURL = (request.isSecure()) ? "https://" : "http://";
|
||||
|
@@ -588,7 +588,9 @@ public class X509Authentication implements AuthenticationMethod
|
||||
.getAttribute("javax.servlet.request.X509Certificate");
|
||||
|
||||
if ((certs == null) || (certs.length == 0))
|
||||
{
|
||||
return BAD_ARGS;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We have a cert -- check it and get username from it.
|
||||
|
@@ -140,11 +140,17 @@ public abstract class SHERPARoMEOProtocol implements ChoiceAuthority
|
||||
xr.parse(new InputSource(get.getResponseBodyAsStream()));
|
||||
int confidence;
|
||||
if (handler.total == 0)
|
||||
{
|
||||
confidence = Choices.CF_NOTFOUND;
|
||||
}
|
||||
else if (handler.total == 1)
|
||||
{
|
||||
confidence = Choices.CF_UNCERTAIN;
|
||||
}
|
||||
else
|
||||
{
|
||||
confidence = Choices.CF_AMBIGUOUS;
|
||||
}
|
||||
return new Choices(handler.result, start, handler.total, confidence, false);
|
||||
}
|
||||
}
|
||||
@@ -214,11 +220,15 @@ public abstract class SHERPARoMEOProtocol implements ChoiceAuthority
|
||||
if (newValue.length() > 0)
|
||||
{
|
||||
if (textValue == null)
|
||||
{
|
||||
textValue = newValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
textValue += newValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if this was the FIRST "numhits" element, it's size of results:
|
||||
public void endElement(String namespaceURI, String localName,
|
||||
@@ -239,28 +249,28 @@ public abstract class SHERPARoMEOProtocol implements ChoiceAuthority
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// after start of result element, get next hit ready
|
||||
else if (localName.equals(resultElement))
|
||||
{
|
||||
// after start of result element, get next hit ready
|
||||
if (++rindex < result.length)
|
||||
result[rindex] = new Choice();
|
||||
}
|
||||
|
||||
// plug in label value
|
||||
else if (localName.equals(labelElement) && textValue != null)
|
||||
result[rindex].value =
|
||||
result[rindex].label = textValue.trim();
|
||||
|
||||
{
|
||||
// plug in label value
|
||||
result[rindex].value = result[rindex].label = textValue.trim();
|
||||
}
|
||||
else if (authorityElement != null && localName.equals(authorityElement) && textValue != null)
|
||||
{
|
||||
// plug in authority value
|
||||
else if (authorityElement != null &&
|
||||
localName.equals(authorityElement) && textValue != null)
|
||||
result[rindex].authority = textValue.trim();
|
||||
|
||||
// error message
|
||||
}
|
||||
else if (localName.equals("message") && textValue != null)
|
||||
{
|
||||
// error message
|
||||
log.warn("SHERPA/RoMEO response error message: " + textValue.trim());
|
||||
}
|
||||
}
|
||||
|
||||
// subclass overriding this MUST call it with super()
|
||||
public void startElement(String namespaceURI, String localName,
|
||||
|
@@ -135,9 +135,13 @@ public class SimpleDCDisseminationCrosswalk extends SelfNamedPlugin
|
||||
if (allDC[i].element.equals("contributor")
|
||||
&& (allDC[i].qualifier != null)
|
||||
&& allDC[i].qualifier.equals("author"))
|
||||
{
|
||||
element = "creator";
|
||||
}
|
||||
else
|
||||
{
|
||||
element = allDC[i].element;
|
||||
}
|
||||
Element field = new Element(element, DC_NS);
|
||||
field.addContent(allDC[i].value);
|
||||
if (addSchema)
|
||||
|
@@ -448,14 +448,20 @@ public class XSLTDisseminationCrosswalk
|
||||
private static String checkedString(String value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
String reason = Verifier.checkCharacterData(value);
|
||||
if (reason == null)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (log.isDebugEnabled())
|
||||
{
|
||||
log.debug("Filtering out non-XML characters in string, reason=" + reason);
|
||||
}
|
||||
StringBuffer result = new StringBuffer(value.length());
|
||||
for (int i = 0; i < value.length(); ++i)
|
||||
{
|
||||
|
@@ -98,13 +98,15 @@ public class XSLTIngestionCrosswalk
|
||||
while (di.hasNext())
|
||||
{
|
||||
Element elt = (Element)di.next();
|
||||
if (elt.getName().equals("field") && elt.getNamespace().equals(DIM_NS))
|
||||
if ("field".equals(elt.getName()) && DIM_NS.equals(elt.getNamespace()))
|
||||
{
|
||||
applyDimField(elt, item);
|
||||
|
||||
}
|
||||
else if ("dim".equals(elt.getName()) && DIM_NS.equals(elt.getNamespace()))
|
||||
{
|
||||
// if it's a <dim> container, apply its guts
|
||||
else if (elt.getName().equals("dim") && elt.getNamespace().equals(DIM_NS))
|
||||
applyDim(elt.getChildren(), item);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
log.error("Got unexpected element in DIM list: "+elt.toString());
|
||||
@@ -241,33 +243,43 @@ public class XSLTIngestionCrosswalk
|
||||
{
|
||||
Element field = (Element)di.next();
|
||||
String schema = field.getAttributeValue("mdschema");
|
||||
if (field.getName().equals("dim") &&
|
||||
field.getNamespace().equals(DIM_NS))
|
||||
if ("dim".equals(field.getName()) && DIM_NS.equals(field.getNamespace()))
|
||||
{
|
||||
ingestDIM(context, dso, field.getChildren());
|
||||
|
||||
else if (field.getName().equals("field") &&
|
||||
field.getNamespace().equals(DIM_NS) &&
|
||||
schema != null && schema.equals("dc"))
|
||||
}
|
||||
else if ("field".equals(field.getName()) &&
|
||||
DIM_NS.equals(field.getNamespace()) &&
|
||||
schema != null && "dc".equals(schema))
|
||||
{
|
||||
String md = getMetadataForDIM(field);
|
||||
if (md == null)
|
||||
{
|
||||
log.warn("Cannot map to Coll/Comm metadata field, DIM element=" +
|
||||
field.getAttributeValue("element") + ", qualifier=" + field.getAttributeValue("qualifier"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type == Constants.COLLECTION)
|
||||
{
|
||||
((Collection) dso).setMetadata(md, field.getText());
|
||||
}
|
||||
else
|
||||
{
|
||||
((Community) dso).setMetadata(md, field.getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
log.warn("ignoring unrecognized DIM element: " + field.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new CrosswalkObjectNotSupported("XsltSubmissionionCrosswalk can only crosswalk to an Item.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -400,11 +400,15 @@ public class Utils
|
||||
// SimpleDateFormat can't handle "Z"
|
||||
char tzSign = s.charAt(s.length()-6);
|
||||
if (s.endsWith("Z"))
|
||||
{
|
||||
s = s.substring(0, s.length() - 1) + "GMT+00:00";
|
||||
}
|
||||
|
||||
// check for trailing timezone
|
||||
else if (tzSign == '-' || tzSign == '+')
|
||||
{
|
||||
s = s.substring(0, s.length() - 6) + "GMT" + s.substring(s.length() - 6);
|
||||
}
|
||||
|
||||
// try to parse without milliseconds
|
||||
ParseException lastError = null;
|
||||
@@ -438,9 +442,13 @@ public class Utils
|
||||
String result;
|
||||
outCal.setTime(d);
|
||||
if (outCal.get(Calendar.MILLISECOND) == 0)
|
||||
{
|
||||
result = outFmtSecond.format(d);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = outFmtMillisec.format(d);
|
||||
}
|
||||
int rl = result.length();
|
||||
return result.substring(0, rl-2) + ":" + result.substring(rl-2);
|
||||
}
|
||||
|
@@ -233,9 +233,13 @@ public class OAIHarvester {
|
||||
metadataString = ConfigurationManager.getProperty(key);
|
||||
String namespacePiece;
|
||||
if (metadataString.indexOf(',') != -1)
|
||||
{
|
||||
namespacePiece = metadataString.substring(0, metadataString.indexOf(','));
|
||||
}
|
||||
else
|
||||
{
|
||||
namespacePiece = metadataString;
|
||||
}
|
||||
|
||||
return Namespace.getNamespace(namespacePiece);
|
||||
}
|
||||
@@ -486,9 +490,13 @@ public class OAIHarvester {
|
||||
// Otherwise, clear and re-import the metadata and bitstreams
|
||||
item.clearMetadata(Item.ANY, Item.ANY, Item.ANY, Item.ANY);
|
||||
if (descMD.size() == 1)
|
||||
{
|
||||
MDxwalk.ingest(ourContext, item, descMD.get(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
MDxwalk.ingest(ourContext, item, descMD);
|
||||
}
|
||||
|
||||
// Import the actual bitstreams
|
||||
if (harvestRow.getHarvestType() == 3) {
|
||||
@@ -514,9 +522,13 @@ public class OAIHarvester {
|
||||
//item.setOaiID(itemOaiID);
|
||||
|
||||
if (descMD.size() == 1)
|
||||
{
|
||||
MDxwalk.ingest(ourContext, item, descMD.get(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
MDxwalk.ingest(ourContext, item, descMD);
|
||||
}
|
||||
|
||||
if (harvestRow.getHarvestType() == 3) {
|
||||
ORExwalk.ingest(ourContext, item, oreREM);
|
||||
|
@@ -148,9 +148,13 @@ public class SortOption
|
||||
// If the option is configured to be hidden, then set the visible flag to false
|
||||
// otherwise, flag it as visible (true)
|
||||
if (matcher.groupCount() > 3 && "hide".equalsIgnoreCase(matcher.group(4)))
|
||||
{
|
||||
visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
visible = true;
|
||||
}
|
||||
|
||||
generateMdBits();
|
||||
}
|
||||
|
@@ -600,7 +600,9 @@ public class UploadStep extends AbstractProcessingStep
|
||||
return STATUS_UNKNOWN_FORMAT;
|
||||
}
|
||||
else
|
||||
{
|
||||
return STATUS_COMPLETE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -893,11 +893,15 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
||||
for (String location : locations) {
|
||||
doc.addField("location", location);
|
||||
if (location.startsWith("m"))
|
||||
{
|
||||
doc.addField("location.comm", location.substring(1));
|
||||
}
|
||||
else
|
||||
{
|
||||
doc.addField("location.coll", location.substring(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
@@ -302,9 +302,12 @@ public class SimpleSearch extends AbstractSearch implements CacheableProcessingC
|
||||
//Do not put a wildcard after a range query
|
||||
if (fq.matches(".*\\:\\[.* TO .*\\](?![a-z 0-9]).*")) {
|
||||
allFilterQueries.add(fq);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
allFilterQueries.add(fq.endsWith("*") ? fq : fq + " OR " + fq + "*");
|
||||
}
|
||||
}
|
||||
|
||||
return allFilterQueries.toArray(new String[allFilterQueries.size()]);
|
||||
}
|
||||
|
@@ -693,34 +693,38 @@ public class UKETDDCCrosswalk extends Crosswalk
|
||||
// group will either contain a character that we need to encode for xml
|
||||
// (ie. <, > or &), or it will be an invalid character
|
||||
// test the contents and replace appropriately
|
||||
if (group.equals("&"))
|
||||
if ("&".equals(group))
|
||||
{
|
||||
xmlMatcher.appendReplacement(valueBuf, "&");
|
||||
else if (group.equals("<"))
|
||||
}
|
||||
else if ("<".equals(group))
|
||||
{
|
||||
xmlMatcher.appendReplacement(valueBuf, "<");
|
||||
else if (group.equals(">"))
|
||||
}
|
||||
else if (">".equals(group))
|
||||
{
|
||||
xmlMatcher.appendReplacement(valueBuf, ">");
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlMatcher.appendReplacement(valueBuf, " ");
|
||||
}
|
||||
}
|
||||
|
||||
// add bit of the string after the final match
|
||||
xmlMatcher.appendTail(valueBuf);
|
||||
|
||||
if (qualifier == null)
|
||||
{
|
||||
buffer.append("<" + namespace + ":" + element + ">" +
|
||||
valueBuf.toString() +
|
||||
"</" + namespace + ":" + element + ">\n");
|
||||
buffer.append("<").append(namespace).append(":").append(element).append(">").append(valueBuf.toString()).append("</").append(namespace).append(":").append(element).append(">\n");
|
||||
} else
|
||||
{
|
||||
buffer.append("<" + namespace + ":" + element +
|
||||
" xsi:type=\"" + terms + ":" + qualifier + "\">" +
|
||||
valueBuf.toString() +
|
||||
"</" + namespace + ":" + element + ">\n");
|
||||
buffer.append("<").append(namespace).append(":").append(element).append(" xsi:type=\"").append(terms).append(":").append(qualifier).append("\">").append(valueBuf.toString()).append("</").append(namespace).append(":").append(element).append(">\n");
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer.append("<" + namespace + ":" + element + " />\n");
|
||||
buffer.append("<").append(namespace).append(":").append(element).append(" />\n");
|
||||
}
|
||||
|
||||
// Return the updated buffer
|
||||
|
@@ -111,9 +111,13 @@ public class SolrLogger
|
||||
locationService = service;
|
||||
|
||||
if ("true".equals(ConfigurationManager.getProperty("useProxies")))
|
||||
{
|
||||
useProxies = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
useProxies = false;
|
||||
}
|
||||
|
||||
log.info("useProxies=" + useProxies);
|
||||
|
||||
|
@@ -106,10 +106,14 @@ public class StatisticsDataVisits extends StatisticsData
|
||||
.get(1) instanceof DatasetTimeGenerator))
|
||||
{
|
||||
if(getDatasetGenerators().get(0) instanceof DatasetTimeGenerator)
|
||||
{
|
||||
dateFacet = (DatasetTimeGenerator) getDatasetGenerators().get(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
dateFacet = (DatasetTimeGenerator) getDatasetGenerators().get(1);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////
|
||||
// 2. DETERMINE VALUES //
|
||||
@@ -335,7 +339,9 @@ public class StatisticsDataVisits extends StatisticsData
|
||||
dataset.setRowTitle("Dataset 1");
|
||||
dataset.setColTitle("Dataset 2");
|
||||
}else
|
||||
{
|
||||
dataset = new Dataset(0, 0);
|
||||
}
|
||||
return dataset;
|
||||
}
|
||||
|
||||
@@ -540,11 +546,17 @@ public class StatisticsDataVisits extends StatisticsData
|
||||
// with an item (such as a community logo) then reference the bitstreamID directly.
|
||||
String identifier = null;
|
||||
if (owningItem != null && owningItem.getHandle() != null)
|
||||
{
|
||||
identifier = "handle/" + owningItem.getHandle();
|
||||
}
|
||||
else if (owningItem != null)
|
||||
{
|
||||
identifier = "item/" + owningItem.getID();
|
||||
}
|
||||
else
|
||||
{
|
||||
identifier = "id/" + bit.getID();
|
||||
}
|
||||
|
||||
|
||||
String url = ConfigurationManager.getProperty("dspace.url") + "/bitstream/"+identifier+"/";
|
||||
|
@@ -82,7 +82,9 @@ public class StatisticsSolrDateFilter implements StatisticsFilter {
|
||||
startCal.set(Calendar.DATE, 1);
|
||||
dateType = Calendar.YEAR;
|
||||
} else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
Calendar endCal = (Calendar) startCal.clone();
|
||||
|
||||
|
@@ -80,7 +80,9 @@ public class StatisticsDataGenerator {
|
||||
long epersonEndId;
|
||||
|
||||
if (line.hasOption("n"))
|
||||
{
|
||||
nrLogs = Integer.parseInt(line.getOptionValue("n"));
|
||||
}
|
||||
else {
|
||||
System.out
|
||||
.println("We need to know how many logs we need to create");
|
||||
@@ -89,53 +91,97 @@ public class StatisticsDataGenerator {
|
||||
if (line.hasOption("s")) {
|
||||
startDate = getDateInMiliseconds(line.getOptionValue("s"));
|
||||
} else
|
||||
{
|
||||
startDate = getDateInMiliseconds("01/01/2006");
|
||||
}
|
||||
if (line.hasOption("e")) {
|
||||
endDate = getDateInMiliseconds(line.getOptionValue("e"));
|
||||
} else
|
||||
{
|
||||
endDate = new Date().getTime();
|
||||
}
|
||||
|
||||
if (line.hasOption("a"))
|
||||
{
|
||||
commStartId = Long.parseLong(line.getOptionValue("a"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (line.hasOption("b"))
|
||||
{
|
||||
commEndId = Long.parseLong(line.getOptionValue("b"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (line.hasOption("c"))
|
||||
{
|
||||
collStartId = Long.parseLong(line.getOptionValue("c"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (line.hasOption("d"))
|
||||
{
|
||||
collEndId = Long.parseLong(line.getOptionValue("d"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (line.hasOption("f"))
|
||||
{
|
||||
itemStartId = Long.parseLong(line.getOptionValue("f"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (line.hasOption("g"))
|
||||
{
|
||||
itemEndId = Long.parseLong(line.getOptionValue("g"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (line.hasOption("h"))
|
||||
{
|
||||
bitStartId = Long.parseLong(line.getOptionValue("h"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (line.hasOption("i"))
|
||||
{
|
||||
bitEndId = Long.parseLong(line.getOptionValue("i"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (line.hasOption("j"))
|
||||
{
|
||||
epersonStartId = Long.parseLong(line.getOptionValue("j"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (line.hasOption("k"))
|
||||
{
|
||||
epersonEndId = Long.parseLong(line.getOptionValue("k"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the max id range
|
||||
long maxIdTotal = Math.max(commEndId, collEndId);
|
||||
@@ -253,9 +299,13 @@ public class StatisticsDataGenerator {
|
||||
substract = true;
|
||||
|
||||
if (substract)
|
||||
{
|
||||
dsoId--;
|
||||
}
|
||||
else
|
||||
{
|
||||
dsoId++;
|
||||
}
|
||||
|
||||
dso = DSpaceObject.find(context, type, dsoId);
|
||||
if (dso instanceof Bitstream) {
|
||||
|
@@ -87,11 +87,15 @@ public class SystemwideAlerts extends AbstractDSpaceTransformer implements Cache
|
||||
public Serializable getKey()
|
||||
{
|
||||
if (active)
|
||||
{
|
||||
// Don't cache any alert messages
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "1";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the cache validity object.
|
||||
@@ -99,10 +103,14 @@ public class SystemwideAlerts extends AbstractDSpaceTransformer implements Cache
|
||||
public SourceValidity getValidity()
|
||||
{
|
||||
if (active)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NOPValidity.SHARED_INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If an alert is activated then add a count down message.
|
||||
|
@@ -400,12 +400,18 @@ public class WithdrawnItems extends AbstractDSpaceTransformer implements
|
||||
year.addOption(false, String.valueOf(i), String.valueOf(i));
|
||||
|
||||
if (i <= fiveYearBreak)
|
||||
{
|
||||
i -= 10;
|
||||
}
|
||||
else if (i <= oneYearBreak)
|
||||
{
|
||||
i -= 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
i--;
|
||||
}
|
||||
}
|
||||
while (i > tenYearBreak);
|
||||
|
||||
// Create a free text entry box for the year
|
||||
@@ -784,9 +790,13 @@ public class WithdrawnItems extends AbstractDSpaceTransformer implements
|
||||
String scopeName = "";
|
||||
|
||||
if (info.getBrowseContainer() != null)
|
||||
{
|
||||
scopeName = info.getBrowseContainer().getName();
|
||||
}
|
||||
else
|
||||
{
|
||||
scopeName = "";
|
||||
}
|
||||
|
||||
if (bix.isMetadataIndex())
|
||||
{
|
||||
@@ -818,9 +828,13 @@ public class WithdrawnItems extends AbstractDSpaceTransformer implements
|
||||
String scopeName = "";
|
||||
|
||||
if (info.getBrowseContainer() != null)
|
||||
{
|
||||
scopeName = info.getBrowseContainer().getName();
|
||||
}
|
||||
else
|
||||
{
|
||||
scopeName = "";
|
||||
}
|
||||
|
||||
if (bix.isMetadataIndex())
|
||||
{
|
||||
|
@@ -132,10 +132,14 @@ public class SetupCollectionHarvestingForm extends AbstractDSpaceTransformer
|
||||
String[] errorPieces = error.split(":",2);
|
||||
|
||||
if (errorPieces.length > 1)
|
||||
{
|
||||
errorMap.put(errorPieces[0], errorPieces[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMap.put(errorPieces[0], errorPieces[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String oaiProviderValue;
|
||||
@@ -153,13 +157,19 @@ public class SetupCollectionHarvestingForm extends AbstractDSpaceTransformer
|
||||
oaiProviderValue = parameters.getParameter("oaiProviderValue", "");
|
||||
oaiSetIdValue = parameters.getParameter("oaiSetAll", "");
|
||||
if(!"all".equals(oaiSetIdValue))
|
||||
{
|
||||
oaiSetIdValue = parameters.getParameter("oaiSetIdValue", null);
|
||||
}
|
||||
metadataFormatValue = parameters.getParameter("metadataFormatValue", "");
|
||||
String harvestLevelString = parameters.getParameter("harvestLevelValue","0");
|
||||
if (harvestLevelString.length() == 0)
|
||||
{
|
||||
harvestLevelValue = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
harvestLevelValue = Integer.parseInt(harvestLevelString);
|
||||
}
|
||||
}
|
||||
|
||||
// DIVISION: main
|
||||
@@ -237,9 +247,13 @@ public class SetupCollectionHarvestingForm extends AbstractDSpaceTransformer
|
||||
String displayName;
|
||||
|
||||
if (metadataString.indexOf(',') != -1)
|
||||
{
|
||||
displayName = metadataString.substring(metadataString.indexOf(',') + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
displayName = metadataKey + "(" + metadataString + ")";
|
||||
}
|
||||
|
||||
metadataFormat.addOption(metadataKey.equalsIgnoreCase(metadataFormatValue), metadataKey, displayName);
|
||||
}
|
||||
|
@@ -140,9 +140,13 @@ public class StatisticsViewer extends AbstractDSpaceTransformer implements Cache
|
||||
|
||||
// Get a file for the report data
|
||||
if (reportDate != null)
|
||||
{
|
||||
analysisFile = StatisticsLoader.getAnalysisFor(reportDate);
|
||||
}
|
||||
else
|
||||
{
|
||||
analysisFile = StatisticsLoader.getGeneralAnalysis();
|
||||
}
|
||||
|
||||
if (analysisFile != null)
|
||||
{
|
||||
@@ -234,14 +238,20 @@ public class StatisticsViewer extends AbstractDSpaceTransformer implements Cache
|
||||
|
||||
// Check that the reports are either public, or user is an administrator
|
||||
if (!publicise && !AuthorizeManager.isAdmin(context))
|
||||
{
|
||||
throw new AuthorizeException();
|
||||
}
|
||||
|
||||
// Retrieve the report data to display
|
||||
File analysisFile;
|
||||
if (reportDate != null)
|
||||
{
|
||||
analysisFile = StatisticsLoader.getAnalysisFor(reportDate);
|
||||
}
|
||||
else
|
||||
{
|
||||
analysisFile = StatisticsLoader.getGeneralAnalysis();
|
||||
}
|
||||
|
||||
// Create the renderer for the results
|
||||
Division div = body.addDivision("statistics", "primary");
|
||||
|
@@ -120,10 +120,14 @@ public class StartForgotPassword extends AbstractDSpaceTransformer
|
||||
|
||||
String errors = parameters.getParameter("errors","");
|
||||
if (errors.length() > 0)
|
||||
{
|
||||
this.errors = Arrays.asList(errors.split(","));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.errors = new ArrayList<String>();
|
||||
}
|
||||
}
|
||||
|
||||
public void addPageMeta(PageMeta pageMeta) throws WingException
|
||||
{
|
||||
|
@@ -145,10 +145,14 @@ public class StartRegistration extends AbstractDSpaceTransformer implements Cach
|
||||
this.accountExists = parameters.getParameterAsBoolean("accountExists",false);
|
||||
String errors = parameters.getParameter("errors","");
|
||||
if (errors.length() > 0)
|
||||
{
|
||||
this.errors = Arrays.asList(errors.split(","));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.errors = new ArrayList<String>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -159,12 +163,16 @@ public class StartRegistration extends AbstractDSpaceTransformer implements Cach
|
||||
{
|
||||
// Only cache on the first attempt.
|
||||
if (email == null && accountExists == false && errors != null && errors.size() == 0)
|
||||
{
|
||||
// cacheable
|
||||
return "1";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Uncachable
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the cache validity object.
|
||||
@@ -172,12 +180,16 @@ public class StartRegistration extends AbstractDSpaceTransformer implements Cach
|
||||
public SourceValidity getValidity()
|
||||
{
|
||||
if (email == null && accountExists == false && errors != null && errors.size() == 0)
|
||||
{
|
||||
// Always valid
|
||||
return NOPValidity.SHARED_INSTANCE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// invalid
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addPageMeta(PageMeta pageMeta) throws WingException
|
||||
|
@@ -58,13 +58,19 @@ public class StepAndPage implements Comparable<StepAndPage>
|
||||
{
|
||||
step = Integer.parseInt(components[0]);
|
||||
if (components.length > 1)
|
||||
{
|
||||
page = Integer.parseInt(components[1]);
|
||||
else
|
||||
page = UNSET;
|
||||
}
|
||||
else
|
||||
{
|
||||
page = UNSET;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
step = UNSET;
|
||||
}
|
||||
}
|
||||
|
||||
public int getStep()
|
||||
{
|
||||
@@ -113,8 +119,12 @@ public class StepAndPage implements Comparable<StepAndPage>
|
||||
public int compareTo(StepAndPage o)
|
||||
{
|
||||
if (this.step == o.step)
|
||||
{
|
||||
return this.page - o.page;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.step - o.step;
|
||||
}
|
||||
}
|
||||
}
|
@@ -163,10 +163,14 @@ public class StepTransformer extends AbstractDSpaceTransformer
|
||||
|
||||
//call the setup for this step
|
||||
if(step!=null)
|
||||
{
|
||||
step.setup(resolver, objectModel, src, parameters);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ProcessingException("Step class is null! We do not have a valid AbstractStep in " + this.transformerClassName + ". ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** What to add at the end of the body */
|
||||
|
@@ -268,11 +268,15 @@ public class Submissions extends AbstractDSpaceTransformer
|
||||
{
|
||||
String displayTitle = titles[0].value;
|
||||
if (displayTitle.length() > 50)
|
||||
{
|
||||
displayTitle = displayTitle.substring(0, 50) + " ...";
|
||||
}
|
||||
row.addCell().addXref(url,displayTitle);
|
||||
}
|
||||
else
|
||||
{
|
||||
row.addCell().addXref(url, T_untitled);
|
||||
}
|
||||
|
||||
// Submitted too
|
||||
row.addCell().addXref(url,collectionName);
|
||||
@@ -337,12 +341,16 @@ public class Submissions extends AbstractDSpaceTransformer
|
||||
{
|
||||
String displayTitle = titles[0].value;
|
||||
if (displayTitle.length() > 50)
|
||||
{
|
||||
displayTitle = displayTitle.substring(0, 50) + " ...";
|
||||
}
|
||||
|
||||
row.addCell().addXref(url,displayTitle);
|
||||
}
|
||||
else
|
||||
{
|
||||
row.addCell().addXref(url, T_untitled);
|
||||
}
|
||||
|
||||
// Submitted too
|
||||
row.addCell().addXref(url,collectionName);
|
||||
@@ -450,11 +458,15 @@ public class Submissions extends AbstractDSpaceTransformer
|
||||
{
|
||||
String displayTitle = titles[0].value;
|
||||
if (displayTitle.length() > 50)
|
||||
{
|
||||
displayTitle = displayTitle.substring(0, 50) + " ...";
|
||||
}
|
||||
row.addCell().addXref(url,displayTitle);
|
||||
}
|
||||
else
|
||||
{
|
||||
row.addCell().addXref(url, T_untitled);
|
||||
}
|
||||
row.addCell().addXref(url,collectionName);
|
||||
Cell cell = row.addCell();
|
||||
cell.addContent(T_email);
|
||||
@@ -495,11 +507,15 @@ public class Submissions extends AbstractDSpaceTransformer
|
||||
{
|
||||
String displayTitle = titles[0].value;
|
||||
if (displayTitle.length() > 50)
|
||||
{
|
||||
displayTitle = displayTitle.substring(0, 50) + " ...";
|
||||
}
|
||||
row.addCell().addXref(url,displayTitle);
|
||||
}
|
||||
else
|
||||
{
|
||||
row.addCell().addXref(url, T_untitled);
|
||||
}
|
||||
row.addCell().addXref(url,collectionName);
|
||||
Cell cell = row.addCell();
|
||||
cell.addContent(T_email);
|
||||
@@ -553,11 +569,15 @@ public class Submissions extends AbstractDSpaceTransformer
|
||||
{
|
||||
String displayTitle = titles[0].value;
|
||||
if (displayTitle.length() > 50)
|
||||
{
|
||||
displayTitle = displayTitle.substring(0, 50) + " ...";
|
||||
}
|
||||
row.addCellContent(displayTitle);
|
||||
}
|
||||
else
|
||||
{
|
||||
row.addCellContent(T_untitled);
|
||||
}
|
||||
|
||||
// Collection name column
|
||||
row.addCellContent(collectionName);
|
||||
|
@@ -175,8 +175,10 @@ public class UploadStep extends AbstractSubmissionStep
|
||||
this.editFile.setup(resolver, objectModel, src, parameters);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.editFile = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addBody(Body body) throws SAXException, WingException,
|
||||
UIException, SQLException, IOException, AuthorizeException
|
||||
@@ -294,9 +296,13 @@ public class UploadStep extends AbstractSubmissionStep
|
||||
row.addCell().addXref(url,name);
|
||||
row.addCellContent(bytes + " bytes");
|
||||
if (desc == null || desc.length() == 0)
|
||||
{
|
||||
row.addCellContent(T_unknown_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
row.addCellContent(desc);
|
||||
}
|
||||
|
||||
BitstreamFormat format = bitstream.getFormat();
|
||||
if (format == null)
|
||||
@@ -396,9 +402,13 @@ public class UploadStep extends AbstractSubmissionStep
|
||||
String format = bitstreamFormat.getShortDescription();
|
||||
Message support = ReviewStep.T_unknown;
|
||||
if (bitstreamFormat.getSupportLevel() == BitstreamFormat.KNOWN)
|
||||
{
|
||||
support = T_known;
|
||||
}
|
||||
else if (bitstreamFormat.getSupportLevel() == BitstreamFormat.SUPPORTED)
|
||||
{
|
||||
support = T_supported;
|
||||
}
|
||||
|
||||
org.dspace.app.xmlui.wing.element.Item file = uploadSection.addItem();
|
||||
file.addXref(url,name);
|
||||
|
@@ -80,9 +80,13 @@ public class Theme
|
||||
this.id = id;
|
||||
this.regex = regex;
|
||||
if (regex != null && regex.length() > 0)
|
||||
{
|
||||
this.pattern = Pattern.compile(regex);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.pattern = null;
|
||||
}
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
|
@@ -273,7 +273,9 @@ public class SimpleHTMLFragment extends AbstractWingElement {
|
||||
}
|
||||
|
||||
if (empty == true)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// May be usefull for debugging:
|
||||
// contents.add(0, new Text("("+index+") "));
|
||||
@@ -281,9 +283,13 @@ public class SimpleHTMLFragment extends AbstractWingElement {
|
||||
Element para = new Element(Para.E_PARA);
|
||||
para.addContent(contents);
|
||||
if (index >= 0)
|
||||
{
|
||||
parent.addContent(index, para);
|
||||
}
|
||||
else
|
||||
{
|
||||
parent.addContent(para);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -582,9 +588,13 @@ public class SimpleHTMLFragment extends AbstractWingElement {
|
||||
String prefix = namespaces.getPrefix(URI);
|
||||
|
||||
if (prefix == null || prefix.equals(""))
|
||||
{
|
||||
return localName;
|
||||
}
|
||||
else
|
||||
{
|
||||
return prefix + ":" + localName;
|
||||
}
|
||||
}
|
||||
|
||||
/** ContentHandler methods: */
|
||||
|
@@ -308,9 +308,13 @@ public class UserMeta extends AbstractWingElement implements
|
||||
{
|
||||
AttributeMap attributes = new AttributeMap();
|
||||
if (authenticated)
|
||||
{
|
||||
attributes.put(A_AUTHENTICATED, "yes");
|
||||
}
|
||||
else
|
||||
{
|
||||
attributes.put(A_AUTHENTICATED, "no");
|
||||
}
|
||||
startElement(contentHandler, namespaces, E_USER_META, attributes);
|
||||
}
|
||||
|
||||
|
@@ -147,10 +147,14 @@ public class Value extends RichTextContainer
|
||||
|
||||
this.type = type;
|
||||
if (type.equals(TYPE_AUTHORITY))
|
||||
{
|
||||
this.confidence = optionOrConfidence;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.option = optionOrConfidence;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new field value, when used in a multiple value context
|
||||
|
Reference in New Issue
Block a user