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