Merge branch 'master' into DS-2784-jersey2

Conflicts:
	dspace-rest/src/main/java/org/dspace/rest/BitstreamResource.java
This commit is contained in:
aleksanderkotbury
2015-12-11 19:28:09 +01:00
208 changed files with 2363 additions and 1849 deletions

View File

@@ -185,7 +185,7 @@ public class MetadataImporter
{ {
// Schema does not exist - create // Schema does not exist - create
log.info("Registering Schema " + name + " (" + namespace + ")"); log.info("Registering Schema " + name + " (" + namespace + ")");
MetadataSchema schema = metadataSchemaService.create(context, name, namespace); metadataSchemaService.create(context, name, namespace);
} }
else else
{ {

View File

@@ -9,12 +9,8 @@ package org.dspace.app.bulkedit;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.dspace.authority.AuthorityValue; import org.dspace.authority.AuthorityValue;
import org.dspace.app.bulkedit.DSpaceCSVLine;
import org.dspace.app.bulkedit.MetadataImport;
import org.dspace.app.bulkedit.MetadataImportInvalidHeadingException;
import org.dspace.authority.factory.AuthorityServiceFactory; import org.dspace.authority.factory.AuthorityServiceFactory;
import org.dspace.authority.service.AuthorityValueService; import org.dspace.authority.service.AuthorityValueService;
import org.dspace.content.Collection;
import org.dspace.content.*; import org.dspace.content.*;
import org.dspace.content.Collection; import org.dspace.content.Collection;
import org.dspace.content.factory.ContentServiceFactory; import org.dspace.content.factory.ContentServiceFactory;
@@ -73,10 +69,10 @@ public class DSpaceCSV implements Serializable
/** The authority separator in an escaped form for using in regexes */ /** The authority separator in an escaped form for using in regexes */
protected String escapedAuthoritySeparator; protected String escapedAuthoritySeparator;
protected final ItemService itemService = ContentServiceFactory.getInstance().getItemService(); protected transient final ItemService itemService = ContentServiceFactory.getInstance().getItemService();
protected final MetadataSchemaService metadataSchemaService = ContentServiceFactory.getInstance().getMetadataSchemaService(); protected transient final MetadataSchemaService metadataSchemaService = ContentServiceFactory.getInstance().getMetadataSchemaService();
protected final MetadataFieldService metadataFieldService = ContentServiceFactory.getInstance().getMetadataFieldService(); protected transient final MetadataFieldService metadataFieldService = ContentServiceFactory.getInstance().getMetadataFieldService();
protected final AuthorityValueService authorityValueService = AuthorityServiceFactory.getInstance().getAuthorityValueService(); protected transient final AuthorityValueService authorityValueService = AuthorityServiceFactory.getInstance().getAuthorityValueService();
/** Whether to export all metadata such as handles and provenance information */ /** Whether to export all metadata such as handles and provenance information */
@@ -262,16 +258,16 @@ public class DSpaceCSV implements Serializable
setAuthoritySeparator(); setAuthoritySeparator();
// Create the headings // Create the headings
headings = new ArrayList<String>(); headings = new ArrayList<>();
// Create the blank list of items // Create the blank list of items
lines = new ArrayList<DSpaceCSVLine>(); lines = new ArrayList<>();
// Initialise the counter // Initialise the counter
counter = 0; counter = 0;
// Set the metadata fields to ignore // Set the metadata fields to ignore
ignore = new HashMap<String, String>(); ignore = new HashMap<>();
String toIgnore = ConfigurationManager.getProperty("bulkedit", "ignore-on-export"); String toIgnore = ConfigurationManager.getProperty("bulkedit", "ignore-on-export");
if ((toIgnore == null) || ("".equals(toIgnore.trim()))) if ((toIgnore == null) || ("".equals(toIgnore.trim())))
{ {
@@ -495,7 +491,7 @@ public class DSpaceCSV implements Serializable
// Split up on field separator // Split up on field separator
String[] parts = line.split(escapedFieldSeparator); String[] parts = line.split(escapedFieldSeparator);
ArrayList<String> bits = new ArrayList<String>(); ArrayList<String> bits = new ArrayList<>();
bits.addAll(Arrays.asList(parts)); bits.addAll(Arrays.asList(parts));
// Merge parts with embedded separators // Merge parts with embedded separators
@@ -624,7 +620,7 @@ public class DSpaceCSV implements Serializable
// Create the headings line // Create the headings line
String[] csvLines = new String[counter + 1]; String[] csvLines = new String[counter + 1];
csvLines[0] = "id" + fieldSeparator + "collection"; csvLines[0] = "id" + fieldSeparator + "collection";
List<String> headingsCopy = new ArrayList<String>(headings); List<String> headingsCopy = new ArrayList<>(headings);
Collections.sort(headingsCopy); Collections.sort(headingsCopy);
for (String value : headingsCopy) for (String value : headingsCopy)
{ {
@@ -701,10 +697,11 @@ public class DSpaceCSV implements Serializable
* *
* @return The formatted String as a csv * @return The formatted String as a csv
*/ */
@Override
public final String toString() public final String toString()
{ {
// Return the csv as one long string // Return the csv as one long string
StringBuffer csvLines = new StringBuffer(); StringBuilder csvLines = new StringBuilder();
String[] lines = this.getCSVLinesAsStringArray(); String[] lines = this.getCSVLinesAsStringArray();
for (String line : lines) for (String line : lines)
{ {

View File

@@ -22,15 +22,16 @@ import java.util.*;
public class DSpaceCSVLine implements Serializable public class DSpaceCSVLine implements Serializable
{ {
/** The item id of the item represented by this line. -1 is for a new item */ /** The item id of the item represented by this line. -1 is for a new item */
private UUID id; private final UUID id;
/** The elements in this line in a hashtable, keyed by the metadata type */ /** The elements in this line in a hashtable, keyed by the metadata type */
private Map<String, ArrayList> items; private final Map<String, ArrayList> items;
protected final AuthorityValueService authorityValueService = AuthorityServiceFactory.getInstance().getAuthorityValueService(); protected transient final AuthorityValueService authorityValueService
= AuthorityServiceFactory.getInstance().getAuthorityValueService();
/** ensuring that the order-sensible columns of the csv are processed in the correct order */ /** ensuring that the order-sensible columns of the csv are processed in the correct order */
private final Comparator<? super String> headerComparator = new Comparator<String>() { private transient final Comparator<? super String> headerComparator = new Comparator<String>() {
@Override @Override
public int compare(String md1, String md2) { public int compare(String md1, String md2) {
// The metadata coming from an external source should be processed after the others // The metadata coming from an external source should be processed after the others
@@ -60,7 +61,7 @@ public class DSpaceCSVLine implements Serializable
{ {
// Store the ID + separator, and initialise the hashtable // Store the ID + separator, and initialise the hashtable
this.id = itemId; this.id = itemId;
items = new TreeMap<String, ArrayList>(headerComparator); items = new TreeMap<>(headerComparator);
// this.items = new HashMap<String, ArrayList>(); // this.items = new HashMap<String, ArrayList>();
} }
@@ -71,7 +72,7 @@ public class DSpaceCSVLine implements Serializable
{ {
// Set the ID to be null, and initialise the hashtable // Set the ID to be null, and initialise the hashtable
this.id = null; this.id = null;
this.items = new TreeMap<String, ArrayList>(headerComparator); this.items = new TreeMap<>(headerComparator);
} }
/** /**
@@ -149,6 +150,7 @@ public class DSpaceCSVLine implements Serializable
* Write this line out as a CSV formatted string, in the order given by the headings provided * Write this line out as a CSV formatted string, in the order given by the headings provided
* *
* @param headings The headings which define the order the elements must be presented in * @param headings The headings which define the order the elements must be presented in
* @param fieldSeparator
* @return The CSV formatted String * @return The CSV formatted String
*/ */
protected String toCSV(List<String> headings, String fieldSeparator) protected String toCSV(List<String> headings, String fieldSeparator)
@@ -177,6 +179,7 @@ public class DSpaceCSVLine implements Serializable
* Internal method to create a CSV formatted String joining a given set of elements * Internal method to create a CSV formatted String joining a given set of elements
* *
* @param values The values to create the string from * @param values The values to create the string from
* @param valueSeparator
* @return The line as a CSV formatted String * @return The line as a CSV formatted String
*/ */
protected String valueToCSV(List<String> values, String valueSeparator) protected String valueToCSV(List<String> values, String valueSeparator)

View File

@@ -483,7 +483,7 @@ public class MetadataImport
",looking_for_element=" + element + ",looking_for_element=" + element +
",looking_for_qualifier=" + qualifier + ",looking_for_qualifier=" + qualifier +
",looking_for_language=" + language)); ",looking_for_language=" + language));
String[] dcvalues = new String[0]; String[] dcvalues;
if(fromAuthority==null) { if(fromAuthority==null) {
List<MetadataValue> current = itemService.getMetadata(item, schema, element, qualifier, language); List<MetadataValue> current = itemService.getMetadata(item, schema, element, qualifier, language);
dcvalues = new String[current.size()]; dcvalues = new String[current.size()];

View File

@@ -71,6 +71,10 @@ public class ItemExportCLITool {
options.addOption("z", "zip", true, "export as zip file (specify filename e.g. export.zip)"); options.addOption("z", "zip", true, "export as zip file (specify filename e.g. export.zip)");
options.addOption("h", "help", false, "help"); options.addOption("h", "help", false, "help");
// as pointed out by Peter Dietz this provides similar functionality to export metadata
// but it is needed since it directly exports to Simple Archive Format (SAF)
options.addOption("x", "exclude-bitstreams", false, "do not export bitstreams");
CommandLine line = parser.parse(options, argv); CommandLine line = parser.parse(options, argv);
String typeString = null; String typeString = null;
@@ -137,6 +141,12 @@ public class ItemExportCLITool {
zipFileName = line.getOptionValue('z'); zipFileName = line.getOptionValue('z');
} }
boolean excludeBitstreams = false;
if (line.hasOption('x'))
{
excludeBitstreams = true;
}
// now validate the args // now validate the args
if (myType == -1) if (myType == -1)
{ {
@@ -234,14 +244,14 @@ public class ItemExportCLITool {
System.out.println("Exporting from collection: " + myIDString); System.out.println("Exporting from collection: " + myIDString);
items = itemService.findByCollection(c, mycollection); items = itemService.findByCollection(c, mycollection);
} }
itemExportService.exportAsZip(c, items, destDirName, zipFileName, seqStart, migrate); itemExportService.exportAsZip(c, items, destDirName, zipFileName, seqStart, migrate, excludeBitstreams);
} }
else else
{ {
if (myItem != null) if (myItem != null)
{ {
// it's only a single item // it's only a single item
itemExportService.exportItem(c, Collections.singletonList(myItem).iterator(), destDirName, seqStart, migrate); itemExportService.exportItem(c, Collections.singletonList(myItem).iterator(), destDirName, seqStart, migrate, excludeBitstreams);
} }
else else
{ {
@@ -249,7 +259,7 @@ public class ItemExportCLITool {
// it's a collection, so do a bunch of items // it's a collection, so do a bunch of items
Iterator<Item> i = itemService.findByCollection(c, mycollection); Iterator<Item> i = itemService.findByCollection(c, mycollection);
itemExportService.exportItem(c, i, destDirName, seqStart, migrate); itemExportService.exportItem(c, i, destDirName, seqStart, migrate, excludeBitstreams);
} }
} }

View File

@@ -88,7 +88,8 @@ public class ItemExportServiceImpl implements ItemExportService
@Override @Override
public void exportItem(Context c, Iterator<Item> i, public void exportItem(Context c, Iterator<Item> i,
String destDirName, int seqStart, boolean migrate) throws Exception String destDirName, int seqStart, boolean migrate,
boolean excludeBitstreams) throws Exception
{ {
int mySequenceNumber = seqStart; int mySequenceNumber = seqStart;
int counter = SUBDIR_LIMIT - 1; int counter = SUBDIR_LIMIT - 1;
@@ -123,13 +124,13 @@ public class ItemExportServiceImpl implements ItemExportService
} }
System.out.println("Exporting item to " + mySequenceNumber); System.out.println("Exporting item to " + mySequenceNumber);
exportItem(c, i.next(), fullPath, mySequenceNumber, migrate); exportItem(c, i.next(), fullPath, mySequenceNumber, migrate, excludeBitstreams);
mySequenceNumber++; mySequenceNumber++;
} }
} }
protected void exportItem(Context c, Item myItem, String destDirName, protected void exportItem(Context c, Item myItem, String destDirName,
int seqStart, boolean migrate) throws Exception int seqStart, boolean migrate, boolean excludeBitstreams) throws Exception
{ {
File destDir = new File(destDirName); File destDir = new File(destDirName);
@@ -137,9 +138,10 @@ public class ItemExportServiceImpl implements ItemExportService
{ {
// now create a subdirectory // now create a subdirectory
File itemDir = new File(destDir + "/" + seqStart); File itemDir = new File(destDir + "/" + seqStart);
System.out.println("Exporting Item " + myItem.getID() + " to " System.out.println("Exporting Item " + myItem.getID() +
+ itemDir); (myItem.getHandle() != null ? ", handle " + myItem.getHandle() : "") +
" to " + itemDir);
if (itemDir.exists()) if (itemDir.exists())
{ {
@@ -151,7 +153,7 @@ public class ItemExportServiceImpl implements ItemExportService
{ {
// make it this far, now start exporting // make it this far, now start exporting
writeMetadata(c, myItem, itemDir, migrate); writeMetadata(c, myItem, itemDir, migrate);
writeBitstreams(c, myItem, itemDir); writeBitstreams(c, myItem, itemDir, excludeBitstreams);
if (!migrate) if (!migrate)
{ {
writeHandle(c, myItem, itemDir); writeHandle(c, myItem, itemDir);
@@ -354,8 +356,8 @@ public class ItemExportServiceImpl implements ItemExportService
* @throws Exception * @throws Exception
* if there is any problem writing to the export directory * if there is any problem writing to the export directory
*/ */
protected void writeBitstreams(Context c, Item i, File destDir) protected void writeBitstreams(Context c, Item i, File destDir,
throws Exception boolean excludeBitstreams) throws Exception
{ {
File outFile = new File(destDir, "contents"); File outFile = new File(destDir, "contents");
@@ -389,12 +391,10 @@ public class ItemExportServiceImpl implements ItemExportService
int myPrefix = 1; // only used with name conflict int myPrefix = 1; // only used with name conflict
InputStream is = bitstreamService.retrieve(c, bitstream);
boolean isDone = false; // done when bitstream is finally boolean isDone = false; // done when bitstream is finally
// written // written
while (!isDone) { while (!excludeBitstreams && !isDone) {
if (myName.contains(File.separator)) { if (myName.contains(File.separator)) {
String dirs = myName.substring(0, myName String dirs = myName.substring(0, myName
.lastIndexOf(File.separator)); .lastIndexOf(File.separator));
@@ -408,23 +408,13 @@ public class ItemExportServiceImpl implements ItemExportService
File fout = new File(destDir, myName); File fout = new File(destDir, myName);
if (fout.createNewFile()) { if (fout.createNewFile()) {
InputStream is = bitstreamService.retrieve(c, bitstream);
FileOutputStream fos = new FileOutputStream(fout); FileOutputStream fos = new FileOutputStream(fout);
Utils.bufferedCopy(is, fos); Utils.bufferedCopy(is, fos);
// close streams // close streams
is.close(); is.close();
fos.close(); fos.close();
// write the manifest file entry
if (bitstreamService.isRegisteredBitstream(bitstream)) {
out.println("-r -s " + bitstream.getStoreNumber()
+ " -f " + myName +
"\tbundle:" + bundleName +
primary + description);
} else {
out.println(myName + "\tbundle:" + bundleName +
primary + description);
}
isDone = true; isDone = true;
} else { } else {
myName = myPrefix + "_" + oldName; // keep myName = myPrefix + "_" + oldName; // keep
@@ -435,6 +425,18 @@ public class ItemExportServiceImpl implements ItemExportService
myPrefix++; myPrefix++;
} }
} }
// write the manifest file entry
if (bitstreamService.isRegisteredBitstream(bitstream)) {
out.println("-r -s " + bitstream.getStoreNumber()
+ " -f " + myName +
"\tbundle:" + bundleName +
primary + description);
} else {
out.println(myName + "\tbundle:" + bundleName +
primary + description);
}
} }
} }
@@ -450,7 +452,9 @@ public class ItemExportServiceImpl implements ItemExportService
@Override @Override
public void exportAsZip(Context context, Iterator<Item> items, public void exportAsZip(Context context, Iterator<Item> items,
String destDirName, String zipFileName, String destDirName, String zipFileName,
int seqStart, boolean migrate) throws Exception int seqStart, boolean migrate,
boolean excludeBitstreams) throws Exception
{ {
String workDir = getExportWorkDirectory() + String workDir = getExportWorkDirectory() +
System.getProperty("file.separator") + System.getProperty("file.separator") +
@@ -469,7 +473,7 @@ public class ItemExportServiceImpl implements ItemExportService
} }
// export the items using normal export method // export the items using normal export method
exportItem(context, items, workDir, seqStart, migrate); exportItem(context, items, workDir, seqStart, migrate, excludeBitstreams);
// now zip up the export directory created above // now zip up the export directory created above
zip(workDir, destDirName + System.getProperty("file.separator") + zipFileName); zip(workDir, destDirName + System.getProperty("file.separator") + zipFileName);
@@ -716,7 +720,7 @@ public class ItemExportServiceImpl implements ItemExportService
// export the items using normal export method // export the items using normal export method
exportItem(context, iitems, workDir, 1, migrate); exportItem(context, iitems, workDir, 1, migrate, false);
} }
// now zip up the export directory created above // now zip up the export directory created above

View File

@@ -47,7 +47,8 @@ public interface ItemExportService {
public static final String COMPRESSED_EXPORT_MIME_TYPE = "application/zip"; public static final String COMPRESSED_EXPORT_MIME_TYPE = "application/zip";
public void exportItem(Context c, Iterator<Item> i, public void exportItem(Context c, Iterator<Item> i,
String destDirName, int seqStart, boolean migrate) throws Exception; String destDirName, int seqStart, boolean migrate,
boolean excludeBitstreams) throws Exception;
/** /**
* Method to perform an export and save it as a zip file. * Method to perform an export and save it as a zip file.
@@ -62,7 +63,8 @@ public interface ItemExportService {
*/ */
public void exportAsZip(Context context, Iterator<Item> items, public void exportAsZip(Context context, Iterator<Item> items,
String destDirName, String zipFileName, String destDirName, String zipFileName,
int seqStart, boolean migrate) throws Exception; int seqStart, boolean migrate,
boolean excludeBitstreams) throws Exception;
/** /**
* Convenience methot to create export a single Community, Collection, or * Convenience methot to create export a single Community, Collection, or

View File

@@ -275,7 +275,7 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
File outFile = null; File outFile = null;
PrintWriter mapOut = null; PrintWriter mapOut = null;
try { try {
Map<String, String> skipItems = new HashMap<String, String>(); // set of items to skip if in 'resume' Map<String, String> skipItems = new HashMap<>(); // set of items to skip if in 'resume'
// mode // mode
System.out.println("Adding items from directory: " + sourceDir); System.out.println("Adding items from directory: " + sourceDir);
@@ -595,7 +595,7 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
// read in the map file and generate a hashmap of (file,handle) pairs // read in the map file and generate a hashmap of (file,handle) pairs
protected Map<String, String> readMapFile(String filename) throws Exception protected Map<String, String> readMapFile(String filename) throws Exception
{ {
Map<String, String> myHash = new HashMap<String, String>(); Map<String, String> myHash = new HashMap<>();
BufferedReader is = null; BufferedReader is = null;
try try
@@ -893,7 +893,7 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
{ {
File contentsFile = new File(path + File.separatorChar + filename); File contentsFile = new File(path + File.separatorChar + filename);
String line = ""; String line = "";
List<String> options = new ArrayList<String>(); List<String> options = new ArrayList<>();
System.out.println("\tProcessing contents file: " + contentsFile); System.out.println("\tProcessing contents file: " + contentsFile);
@@ -1228,7 +1228,7 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
Bitstream bs = null; Bitstream bs = null;
String newBundleName = bundleName; String newBundleName = bundleName;
if (bundleName == null) if (StringUtils.isBlank(bundleName))
{ {
// is it license.txt? // is it license.txt?
if (bitstreamPath.endsWith("license.txt")) if (bitstreamPath.endsWith("license.txt"))
@@ -1260,7 +1260,7 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
} }
// now add the bitstream // now add the bitstream
bs = bitstreamService.register(c, assetstore, bitstreamPath); bs = bitstreamService.register(c, targetBundle, assetstore, bitstreamPath);
// set the name to just the filename // set the name to just the filename
int iLastSlash = bitstreamPath.lastIndexOf('/'); int iLastSlash = bitstreamPath.lastIndexOf('/');
@@ -1658,7 +1658,7 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
//regex supports either windows or *nix file paths //regex supports either windows or *nix file paths
String[] entryChunks = entry.getName().split("/|\\\\"); String[] entryChunks = entry.getName().split("/|\\\\");
if(entryChunks.length > 2) { if(entryChunks.length > 2) {
if(sourceDirForZip == sourcedir) { if(StringUtils.equals(sourceDirForZip, sourcedir)) {
sourceDirForZip = sourcedir + "/" + entryChunks[0]; sourceDirForZip = sourcedir + "/" + entryChunks[0];
} }
} }
@@ -1682,7 +1682,7 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
//Close zip file //Close zip file
zf.close(); zf.close();
if(sourceDirForZip != sourcedir) { if(!StringUtils.equals(sourceDirForZip, sourcedir)) {
sourcedir = sourceDirForZip; sourcedir = sourceDirForZip;
System.out.println("Set sourceDir using path inside of Zip: " + sourcedir); System.out.println("Set sourceDir using path inside of Zip: " + sourcedir);
log.info("Set sourceDir using path inside of Zip: " + sourcedir); log.info("Set sourceDir using path inside of Zip: " + sourcedir);
@@ -1840,6 +1840,7 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
List<Collection> finalCollections = null; List<Collection> finalCollections = null;
if (theOwningCollection != null){ if (theOwningCollection != null){
finalCollections = new ArrayList<>();
finalCollections.add(theOwningCollection); finalCollections.add(theOwningCollection);
finalCollections.addAll(collectionList); finalCollections.addAll(collectionList);
} }
@@ -1948,7 +1949,7 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
return null; return null;
} }
Map<String, BatchUpload> fileNames = new TreeMap<String, BatchUpload>(); Map<String, BatchUpload> fileNames = new TreeMap<>();
for (String fileName : uploadDir.list()) for (String fileName : uploadDir.list())
{ {
@@ -1963,7 +1964,7 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
if (fileNames.size() > 0) if (fileNames.size() > 0)
{ {
return new ArrayList<BatchUpload>(fileNames.values()); return new ArrayList<>(fileNames.values());
} }
return null; return null;

View File

@@ -55,8 +55,6 @@ public class SHERPAResponse
Document inDoc = db.parse(xmlData); Document inDoc = db.parse(xmlData);
Element xmlRoot = inDoc.getDocumentElement(); Element xmlRoot = inDoc.getDocumentElement();
Element dataRoot = XMLUtils.getSingleElement(xmlRoot, "romeoapi");
Element headersElement = XMLUtils.getSingleElement(xmlRoot, Element headersElement = XMLUtils.getSingleElement(xmlRoot,
"header"); "header");
Element journalsElement = XMLUtils.getSingleElement(xmlRoot, Element journalsElement = XMLUtils.getSingleElement(xmlRoot,

View File

@@ -26,7 +26,7 @@ public class SHERPAService
private int maxNumberOfTries; private int maxNumberOfTries;
private long sleepBetweenTimeouts; private long sleepBetweenTimeouts;
private int timeout; private int timeout = 5000;
/** log4j category */ /** log4j category */
private static final Logger log = Logger.getLogger(SHERPAService.class); private static final Logger log = Logger.getLogger(SHERPAService.class);

View File

@@ -347,8 +347,7 @@ public class GoogleMetadata
{ {
configFilter = configFilter.trim(); configFilter = configFilter.trim();
} }
ArrayList<ArrayList<String>> parsedOptions = new ArrayList<ArrayList<String>>(); ArrayList<ArrayList<String>> parsedOptions = parseOptions(configFilter);
parsedOptions = parseOptions(configFilter);
if (log.isDebugEnabled()) if (log.isDebugEnabled())
{ {

View File

@@ -20,6 +20,7 @@ import java.util.Properties;
import java.util.UUID; import java.util.UUID;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.dspace.content.Collection; import org.dspace.content.Collection;
@@ -249,6 +250,10 @@ public class Util {
public static UUID getUUIDParameter(HttpServletRequest request, String param) public static UUID getUUIDParameter(HttpServletRequest request, String param)
{ {
String val = request.getParameter(param); String val = request.getParameter(param);
if (StringUtils.isEmpty(val))
{
return null;
}
try try
{ {

View File

@@ -360,9 +360,6 @@ public class AuthorizeServiceImpl implements AuthorizeService
return false; return false;
} }
// is eperson set? if not, userid = 0 (anonymous)
EPerson e = c.getCurrentUser();
// //
// First, check all Resource Policies directly on this object // First, check all Resource Policies directly on this object
// //

View File

@@ -12,6 +12,7 @@ import java.util.ArrayList;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.apache.commons.lang.StringUtils;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
import org.dspace.sort.SortOption; import org.dspace.sort.SortOption;
@@ -95,17 +96,30 @@ public final class BrowseIndex
/** /**
* Create a new BrowseIndex object using the definition from the configuration, * Create a new BrowseIndex object using the definition from the configuration,
* and the number of the configuration option. The definition should be of * and the number of the configuration option. The definition should follow
* the form: * one of the following forms:
* *
* <code> * <code>
* [name]:[metadata]:[data type]:[display type] * [name]:item:[sort option]:[order]
* </code>
*
* or
*
* <code>
* [name]:metadata:[metadata]:[data type]:[order]:[sort option]
* </code> * </code>
* *
* [name] is a freetext name for the field * [name] is a freetext name for the field
* item or metadata defines the display type
* [metadata] is the usual format of the metadata such as dc.contributor.author * [metadata] is the usual format of the metadata such as dc.contributor.author
* [sort option] is the name of a separately defined sort option
* [order] must be either asc or desc
* [data type] must be either "title", "date" or "text" * [data type] must be either "title", "date" or "text"
* [display type] must be either "single" or "full" *
* If you use the first form (to define an index of type item), the order
* is facultative. If you use the second form (for type metadata), the order
* and sort option are facultative, but you must configure the order if you
* want to configure the sort option.
* *
* @param definition the configuration definition of this index * @param definition the configuration definition of this index
* @param number the configuration number of this index * @param number the configuration number of this index
@@ -120,7 +134,7 @@ public final class BrowseIndex
this.defaultOrder = SortOption.ASCENDING; this.defaultOrder = SortOption.ASCENDING;
this.number = number; this.number = number;
String rx = "(\\w+):(\\w+):([\\w\\.\\*,]+):?(\\w*):?(\\w*)"; String rx = "(\\w+):(\\w+):([\\w\\.\\*,]+):?(\\w*):?(\\w*):?(\\w*)";
Pattern pattern = Pattern.compile(rx); Pattern pattern = Pattern.compile(rx);
Matcher matcher = pattern.matcher(definition); Matcher matcher = pattern.matcher(definition);
@@ -159,6 +173,30 @@ public final class BrowseIndex
this.defaultOrder = SortOption.DESCENDING; this.defaultOrder = SortOption.DESCENDING;
} }
} }
if (matcher.groupCount() > 5)
{
String sortName = matcher.group(6).trim();
if (sortName.length() > 0)
{
for (SortOption so : SortOption.getSortOptions())
{
if (so.getName().equals(sortName))
{
sortOption = so;
}
}
// for backward compatability we ignore the keywords
// single and full here
if (!sortName.equalsIgnoreCase("single")
&& !sortName.equalsIgnoreCase("full")
&& sortOption == null)
{
valid = false;
}
}
}
tableBaseName = getItemBrowseIndex().tableBaseName; tableBaseName = getItemBrowseIndex().tableBaseName;
} }

View File

@@ -106,8 +106,7 @@ public class ItemCountDAOSolr implements ItemCountDAO
public int getCount(DSpaceObject dso) throws ItemCountException public int getCount(DSpaceObject dso) throws ItemCountException
{ {
loadCount(); loadCount();
DiscoverQuery query = new DiscoverQuery(); Integer val;
Integer val = null;
if (dso instanceof Collection) if (dso instanceof Collection)
{ {
val = collectionsCount.get(String.valueOf(((Collection) dso).getID())); val = collectionsCount.get(String.valueOf(((Collection) dso).getID()));

View File

@@ -7,6 +7,7 @@
*/ */
package org.dspace.browse; package org.dspace.browse;
import java.io.Serializable;
import java.util.*; import java.util.*;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@@ -26,12 +27,12 @@ import org.dspace.discovery.configuration.DiscoveryConfigurationParameters;
import org.dspace.utils.DSpace; import org.dspace.utils.DSpace;
/** /**
* *
* @author Andrea Bollini (CILEA) * @author Andrea Bollini (CILEA)
* @author Adán Román Ruiz at arvo.es (bugfix) * @author Adán Román Ruiz at arvo.es (bugfix)
* @author Panagiotis Koutsourakis (National Documentation Centre) (bugfix) * @author Panagiotis Koutsourakis (National Documentation Centre) (bugfix)
* @author Kostas Stamatis (National Documentation Centre) (bugfix) * @author Kostas Stamatis (National Documentation Centre) (bugfix)
* *
*/ */
public class SolrBrowseDAO implements BrowseDAO public class SolrBrowseDAO implements BrowseDAO
{ {
@@ -40,7 +41,8 @@ public class SolrBrowseDAO implements BrowseDAO
this.context = context; this.context = context;
} }
static private class FacetValueComparator implements Comparator static private class FacetValueComparator
implements Comparator, Serializable
{ {
@Override @Override
public int compare(Object o1, Object o2) public int compare(Object o1, Object o2)
@@ -64,10 +66,10 @@ public class SolrBrowseDAO implements BrowseDAO
} }
/** Log4j log */ /** Log4j log */
private static Logger log = Logger.getLogger(SolrBrowseDAO.class); private static final Logger log = Logger.getLogger(SolrBrowseDAO.class);
/** The DSpace context */ /** The DSpace context */
private Context context; private final Context context;
// SQL query related attributes for this class // SQL query related attributes for this class
@@ -136,7 +138,7 @@ public class SolrBrowseDAO implements BrowseDAO
private boolean itemsDiscoverable = true; private boolean itemsDiscoverable = true;
private boolean showFrequencies; private boolean showFrequencies;
private DiscoverResult getSolrResponse() throws BrowseException private DiscoverResult getSolrResponse() throws BrowseException
{ {
if (sResponse == null) if (sResponse == null)
@@ -205,7 +207,7 @@ public class SolrBrowseDAO implements BrowseDAO
} }
else if (!itemsDiscoverable) else if (!itemsDiscoverable)
{ {
query.addFilterQueries("discoverable:false"); query.addFilterQueries("discoverable:false");
} }
} }
@@ -254,7 +256,7 @@ public class SolrBrowseDAO implements BrowseDAO
int count = doCountQuery(); int count = doCountQuery();
int start = offset > 0 ? offset : 0; int start = offset > 0 ? offset : 0;
int max = limit > 0 ? limit : count; //if negative, return everything int max = limit > 0 ? limit : count; //if negative, return everything
List<String[]> result = new ArrayList<String[]>(); List<String[]> result = new ArrayList<>();
if (ascending) if (ascending)
{ {
for (int i = start; i < (start + max) && i < count; i++) for (int i = start; i < (start + max) && i < count; i++)
@@ -390,22 +392,22 @@ public class SolrBrowseDAO implements BrowseDAO
return doCountQuery() - ascValue; return doCountQuery() - ascValue;
} }
} }
@Override @Override
public boolean isEnableBrowseFrequencies() public boolean isEnableBrowseFrequencies()
{ {
return showFrequencies; return showFrequencies;
} }
@Override @Override
public void setEnableBrowseFrequencies(boolean enableBrowseFrequencies) public void setEnableBrowseFrequencies(boolean enableBrowseFrequencies)
{ {
showFrequencies = enableBrowseFrequencies; showFrequencies = enableBrowseFrequencies;
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#getContainerID() * @see org.dspace.browse.BrowseDAO#getContainerID()
*/ */
@Override @Override
@@ -416,7 +418,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#getContainerIDField() * @see org.dspace.browse.BrowseDAO#getContainerIDField()
*/ */
@Override @Override
@@ -427,7 +429,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#getContainerTable() * @see org.dspace.browse.BrowseDAO#getContainerTable()
*/ */
@Override @Override
@@ -445,7 +447,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#getFocusField() * @see org.dspace.browse.BrowseDAO#getFocusField()
*/ */
@Override @Override
@@ -456,7 +458,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#getFocusValue() * @see org.dspace.browse.BrowseDAO#getFocusValue()
*/ */
@Override @Override
@@ -467,7 +469,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#getLimit() * @see org.dspace.browse.BrowseDAO#getLimit()
*/ */
@Override @Override
@@ -478,7 +480,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#getOffset() * @see org.dspace.browse.BrowseDAO#getOffset()
*/ */
@Override @Override
@@ -489,7 +491,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#getOrderField() * @see org.dspace.browse.BrowseDAO#getOrderField()
*/ */
@Override @Override
@@ -507,7 +509,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#getTable() * @see org.dspace.browse.BrowseDAO#getTable()
*/ */
@Override @Override
@@ -518,7 +520,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#getValue() * @see org.dspace.browse.BrowseDAO#getValue()
*/ */
@Override @Override
@@ -529,7 +531,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#getValueField() * @see org.dspace.browse.BrowseDAO#getValueField()
*/ */
@Override @Override
@@ -540,7 +542,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#isAscending() * @see org.dspace.browse.BrowseDAO#isAscending()
*/ */
@Override @Override
@@ -551,7 +553,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#isDistinct() * @see org.dspace.browse.BrowseDAO#isDistinct()
*/ */
@Override @Override
@@ -562,7 +564,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#setAscending(boolean) * @see org.dspace.browse.BrowseDAO#setAscending(boolean)
*/ */
@Override @Override
@@ -574,7 +576,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#setContainerID(int) * @see org.dspace.browse.BrowseDAO#setContainerID(int)
*/ */
@Override @Override
@@ -586,7 +588,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#setContainerIDField(java.lang.String) * @see org.dspace.browse.BrowseDAO#setContainerIDField(java.lang.String)
*/ */
@Override @Override
@@ -598,7 +600,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#setContainerTable(java.lang.String) * @see org.dspace.browse.BrowseDAO#setContainerTable(java.lang.String)
*/ */
@Override @Override
@@ -618,7 +620,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#setDistinct(boolean) * @see org.dspace.browse.BrowseDAO#setDistinct(boolean)
*/ */
@Override @Override
@@ -630,7 +632,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#setEqualsComparator(boolean) * @see org.dspace.browse.BrowseDAO#setEqualsComparator(boolean)
*/ */
@Override @Override
@@ -642,7 +644,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#setFocusField(java.lang.String) * @see org.dspace.browse.BrowseDAO#setFocusField(java.lang.String)
*/ */
@Override @Override
@@ -654,7 +656,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#setFocusValue(java.lang.String) * @see org.dspace.browse.BrowseDAO#setFocusValue(java.lang.String)
*/ */
@Override @Override
@@ -666,7 +668,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#setLimit(int) * @see org.dspace.browse.BrowseDAO#setLimit(int)
*/ */
@Override @Override
@@ -678,7 +680,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#setOffset(int) * @see org.dspace.browse.BrowseDAO#setOffset(int)
*/ */
@Override @Override
@@ -690,7 +692,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#setOrderField(java.lang.String) * @see org.dspace.browse.BrowseDAO#setOrderField(java.lang.String)
*/ */
@Override @Override
@@ -710,7 +712,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#setTable(java.lang.String) * @see org.dspace.browse.BrowseDAO#setTable(java.lang.String)
*/ */
@Override @Override
@@ -740,7 +742,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#setValue(java.lang.String) * @see org.dspace.browse.BrowseDAO#setValue(java.lang.String)
*/ */
@Override @Override
@@ -752,7 +754,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#setFilterValuePartial(boolean) * @see org.dspace.browse.BrowseDAO#setFilterValuePartial(boolean)
*/ */
@Override @Override
@@ -764,7 +766,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#setValueField(java.lang.String) * @see org.dspace.browse.BrowseDAO#setValueField(java.lang.String)
*/ */
@Override @Override
@@ -776,7 +778,7 @@ public class SolrBrowseDAO implements BrowseDAO
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.dspace.browse.BrowseDAO#useEqualsComparator() * @see org.dspace.browse.BrowseDAO#useEqualsComparator()
*/ */
@Override @Override

View File

@@ -7,6 +7,7 @@
*/ */
package org.dspace.checker; package org.dspace.checker;
import java.io.Serializable;
import javax.persistence.*; import javax.persistence.*;
/** /**
@@ -16,7 +17,8 @@ import javax.persistence.*;
*/ */
@Entity @Entity
@Table(name="checksum_results") @Table(name="checksum_results")
public final class ChecksumResult public class ChecksumResult
implements Serializable
{ {
@Id @Id
@Column(name="result_code") @Column(name="result_code")

View File

@@ -71,7 +71,7 @@ public class Bitstream extends DSpaceObject implements DSpaceObjectLegacySupport
private Collection collection; private Collection collection;
@Transient @Transient
private BitstreamService bitstreamService; private transient BitstreamService bitstreamService;
public Bitstream() public Bitstream()

View File

@@ -7,6 +7,7 @@
*/ */
package org.dspace.content; package org.dspace.content;
import java.io.Serializable;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.List; import java.util.List;
@@ -31,7 +32,7 @@ import javax.persistence.*;
*/ */
@Entity @Entity
@Table(name="bitstreamformatregistry") @Table(name="bitstreamformatregistry")
public class BitstreamFormat public class BitstreamFormat implements Serializable
{ {
@Id @Id
@@ -71,7 +72,7 @@ public class BitstreamFormat
private List<String> fileExtensions; private List<String> fileExtensions;
@Transient @Transient
private BitstreamFormatService bitstreamFormatService; private transient BitstreamFormatService bitstreamFormatService;
/** /**
* The "unknown" support level - for bitstream formats that are unknown to * The "unknown" support level - for bitstream formats that are unknown to
@@ -109,7 +110,7 @@ public class BitstreamFormat
* *
* @return the short description * @return the short description
*/ */
public final String getShortDescription() public String getShortDescription()
{ {
return shortDescription; return shortDescription;
} }
@@ -127,7 +128,7 @@ public class BitstreamFormat
* *
* @return the description * @return the description
*/ */
public final String getDescription() public String getDescription()
{ {
return description; return description;
} }
@@ -139,7 +140,7 @@ public class BitstreamFormat
* @param s * @param s
* the new description * the new description
*/ */
public final void setDescription(String s) public void setDescription(String s)
{ {
this.description = s; this.description = s;
} }
@@ -172,7 +173,7 @@ public class BitstreamFormat
* *
* @return the support level * @return the support level
*/ */
public final int getSupportLevel() public int getSupportLevel()
{ {
return supportLevel; return supportLevel;
} }
@@ -194,7 +195,7 @@ public class BitstreamFormat
* *
* @return <code>true</code> if the bitstream format is an internal type * @return <code>true</code> if the bitstream format is an internal type
*/ */
public final boolean isInternal() public boolean isInternal()
{ {
return internal; return internal;
} }
@@ -206,7 +207,7 @@ public class BitstreamFormat
* pass in <code>true</code> if the bitstream format is an * pass in <code>true</code> if the bitstream format is an
* internal type * internal type
*/ */
public final void setInternal(boolean b) public void setInternal(boolean b)
{ {
internal = b; internal = b;
} }

View File

@@ -47,7 +47,7 @@ public class Bundle extends DSpaceObject implements DSpaceObjectLegacySupport
inverseJoinColumns={@JoinColumn(name="bitstream_id") } inverseJoinColumns={@JoinColumn(name="bitstream_id") }
) )
@OrderColumn(name="bitstream_order") @OrderColumn(name="bitstream_order")
private List<Bitstream> bitstreams = new ArrayList<>(); private final List<Bitstream> bitstreams = new ArrayList<>();
@ManyToMany(fetch = FetchType.LAZY) @ManyToMany(fetch = FetchType.LAZY)
@JoinTable( @JoinTable(
@@ -55,10 +55,10 @@ public class Bundle extends DSpaceObject implements DSpaceObjectLegacySupport
joinColumns = {@JoinColumn(name = "bundle_id", referencedColumnName = "uuid") }, joinColumns = {@JoinColumn(name = "bundle_id", referencedColumnName = "uuid") },
inverseJoinColumns = {@JoinColumn(name = "item_id", referencedColumnName = "uuid") } inverseJoinColumns = {@JoinColumn(name = "item_id", referencedColumnName = "uuid") }
) )
private List<Item> items = new ArrayList<>(); private final List<Item> items = new ArrayList<>();
@Transient @Transient
protected BundleService bundleService; protected transient BundleService bundleService;
protected Bundle() protected Bundle()
{ {

View File

@@ -83,10 +83,10 @@ public class Collection extends DSpaceObject implements DSpaceObjectLegacySuppor
joinColumns = {@JoinColumn(name = "collection_id") }, joinColumns = {@JoinColumn(name = "collection_id") },
inverseJoinColumns = {@JoinColumn(name = "community_id") } inverseJoinColumns = {@JoinColumn(name = "community_id") }
) )
private List<Community> communities = new ArrayList<>(); private final List<Community> communities = new ArrayList<>();
@Transient @Transient
private CollectionService collectionService; private transient CollectionService collectionService;
// Keys for accessing Collection metadata // Keys for accessing Collection metadata
@Transient @Transient

View File

@@ -7,9 +7,15 @@
*/ */
package org.dspace.content; package org.dspace.content;
import java.io.Serializable;
import java.util.Comparator; import java.util.Comparator;
public class CollectionNameComparator implements Comparator<Collection> { /**
* Compares the names of two {@link Collection}s.
*/
public class CollectionNameComparator
implements Comparator<Collection>, Serializable
{
@Override @Override
public int compare(Collection collection1, Collection collection2) { public int compare(Collection collection1, Collection collection2) {
return collection1.getName().compareTo(collection2.getName()); return collection1.getName().compareTo(collection2.getName());

View File

@@ -23,7 +23,6 @@ import org.dspace.eperson.Group;
import org.dspace.eperson.service.GroupService; import org.dspace.eperson.service.GroupService;
import org.dspace.eperson.service.SubscribeService; import org.dspace.eperson.service.SubscribeService;
import org.dspace.event.Event; import org.dspace.event.Event;
import org.dspace.handle.service.HandleService;
import org.dspace.workflow.factory.WorkflowServiceFactory; import org.dspace.workflow.factory.WorkflowServiceFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -42,7 +41,7 @@ import java.util.*;
public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> implements CollectionService { public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> implements CollectionService {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(CollectionServiceImpl.class); private static final Logger log = Logger.getLogger(CollectionServiceImpl.class);
@Autowired(required = true) @Autowired(required = true)
protected CollectionDAO collectionDAO; protected CollectionDAO collectionDAO;
@@ -58,8 +57,6 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
@Autowired(required = true) @Autowired(required = true)
protected GroupService groupService; protected GroupService groupService;
@Autowired(required = true)
protected HandleService handleService;
@Autowired(required = true) @Autowired(required = true)
protected LicenseService licenseService; protected LicenseService licenseService;
@Autowired(required = true) @Autowired(required = true)
@@ -135,7 +132,7 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
return findAuthorized(context, null, actionID); return findAuthorized(context, null, actionID);
} }
List<Collection> myResults = new ArrayList<Collection>(); List<Collection> myResults = new ArrayList<>();
if(authorizeService.isAdmin(context)) if(authorizeService.isAdmin(context))
{ {
@@ -340,7 +337,7 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
collection.setWorkflowStep3(group); collection.setWorkflowStep3(group);
break; break;
default: default:
new IllegalAccessException("Illegal step count: " + step); throw new IllegalArgumentException("Illegal step count: " + step);
} }
} }
@@ -362,6 +359,7 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
/** /**
* Get the value of a metadata field * Get the value of a metadata field
* *
* @param collection
* @param field * @param field
* the name of the metadata field to get * the name of the metadata field to get
* *
@@ -536,7 +534,7 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
} }
context.addEvent(new Event(Event.ADD, Constants.COLLECTION, collection.getID(), context.addEvent(new Event(Event.ADD, Constants.COLLECTION, collection.getID(),
Constants.ITEM, item.getID(), item.getHandle(), Constants.ITEM, item.getID(), item.getHandle(),
getIdentifiers(context, collection))); getIdentifiers(context, collection)));
} }
@@ -549,13 +547,13 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
item.removeCollection(collection); item.removeCollection(collection);
//Check if we orphaned our poor item //Check if we orphaned our poor item
if (item.getCollections().size() == 0) if (item.getCollections().isEmpty())
{ {
// Orphan; delete it // Orphan; delete it
itemService.delete(context, item); itemService.delete(context, item);
} }
context.addEvent(new Event(Event.REMOVE, Constants.COLLECTION, context.addEvent(new Event(Event.REMOVE, Constants.COLLECTION,
collection.getID(), Constants.ITEM, item.getID(), item.getHandle(), collection.getID(), Constants.ITEM, item.getID(), item.getHandle(),
getIdentifiers(context, collection))); getIdentifiers(context, collection)));
} }
@@ -736,9 +734,9 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
@Override @Override
public List<Collection> findAuthorized(Context context, Community community, int actionID) throws SQLException { public List<Collection> findAuthorized(Context context, Community community, int actionID) throws SQLException {
List<Collection> myResults = new ArrayList<Collection>(); List<Collection> myResults = new ArrayList<>();
List<Collection> myCollections = null; List<Collection> myCollections;
if (community != null) if (community != null)
{ {

View File

@@ -33,7 +33,7 @@ import java.util.*;
public class Community extends DSpaceObject implements DSpaceObjectLegacySupport public class Community extends DSpaceObject implements DSpaceObjectLegacySupport
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(Community.class); private static final Logger log = Logger.getLogger(Community.class);
@Column(name="community_id", insertable = false, updatable = false) @Column(name="community_id", insertable = false, updatable = false)
private Integer legacyId; private Integer legacyId;
@@ -44,13 +44,13 @@ public class Community extends DSpaceObject implements DSpaceObjectLegacySupport
joinColumns = {@JoinColumn(name = "parent_comm_id") }, joinColumns = {@JoinColumn(name = "parent_comm_id") },
inverseJoinColumns = {@JoinColumn(name = "child_comm_id") } inverseJoinColumns = {@JoinColumn(name = "child_comm_id") }
) )
private final List<Community> subCommunities = new ArrayList<>();
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "subCommunities")
private List<Community> parentCommunities = new ArrayList<>(); private List<Community> parentCommunities = new ArrayList<>();
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "parentCommunities")
private List<Community> subCommunities = new ArrayList<>();
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "communities", cascade = {CascadeType.PERSIST}) @ManyToMany(fetch = FetchType.LAZY, mappedBy = "communities", cascade = {CascadeType.PERSIST})
private List<Collection> collections = new ArrayList<>(); private final List<Collection> collections = new ArrayList<>();
@OneToOne @OneToOne
@JoinColumn(name = "admin") @JoinColumn(name = "admin")
@@ -69,7 +69,7 @@ public class Community extends DSpaceObject implements DSpaceObjectLegacySupport
public static final String SIDEBAR_TEXT = "side_bar_text"; public static final String SIDEBAR_TEXT = "side_bar_text";
@Transient @Transient
protected CommunityService communityService; protected transient CommunityService communityService;
protected Community() { protected Community() {
} }
@@ -207,6 +207,7 @@ public class Community extends DSpaceObject implements DSpaceObjectLegacySupport
return true; return true;
} }
@Override
public int hashCode() public int hashCode()
{ {
return new HashCodeBuilder().append(getID()).toHashCode(); return new HashCodeBuilder().append(getID()).toHashCode();

View File

@@ -24,7 +24,6 @@ import org.dspace.core.LogManager;
import org.dspace.eperson.Group; import org.dspace.eperson.Group;
import org.dspace.eperson.service.GroupService; import org.dspace.eperson.service.GroupService;
import org.dspace.event.Event; import org.dspace.event.Event;
import org.dspace.handle.service.HandleService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.io.IOException; import java.io.IOException;
@@ -51,8 +50,6 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
@Autowired(required = true) @Autowired(required = true)
protected CollectionService collectionService; protected CollectionService collectionService;
@Autowired(required = true) @Autowired(required = true)
protected HandleService handleService;
@Autowired(required = true)
protected GroupService groupService; protected GroupService groupService;
@Autowired(required = true) @Autowired(required = true)
protected AuthorizeService authorizeService; protected AuthorizeService authorizeService;
@@ -202,13 +199,14 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
canEdit(context, community); canEdit(context, community);
} }
// First, delete any existing logo // First, delete any existing logo
if (community.getLogo() != null) Bitstream oldLogo = community.getLogo();
if (oldLogo != null)
{ {
log.info(LogManager.getHeader(context, "remove_logo", log.info(LogManager.getHeader(context, "remove_logo",
"community_id=" + community.getID())); "community_id=" + community.getID()));
community.setLogo(null); community.setLogo(null);
bitstreamService.delete(context, community.getLogo()); bitstreamService.delete(context, oldLogo);
} }
if (is != null) if (is != null)

View File

@@ -78,13 +78,13 @@ public class Item extends DSpaceObject implements DSpaceObjectLegacySupport
joinColumns = {@JoinColumn(name = "item_id") }, joinColumns = {@JoinColumn(name = "item_id") },
inverseJoinColumns = {@JoinColumn(name = "collection_id") } inverseJoinColumns = {@JoinColumn(name = "collection_id") }
) )
private List<Collection> collections = new ArrayList<>(); private final List<Collection> collections = new ArrayList<>();
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "items") @ManyToMany(fetch = FetchType.LAZY, mappedBy = "items")
private List<Bundle> bundles = new ArrayList<>(); private final List<Bundle> bundles = new ArrayList<>();
@Transient @Transient
private ItemService itemService; private transient ItemService itemService;
protected Item() { protected Item() {
} }

View File

@@ -17,12 +17,12 @@ import org.dspace.sort.OrderFormat;
/** /**
* Compare two Items by their DCValues. * Compare two Items by their DCValues.
* *
* The DCValues to be compared are specified by the element, qualifier and * The DCValues to be compared are specified by the element, qualifier and
language parameters to the constructor. If the Item has more than one language parameters to the constructor. If the Item has more than one
matching Metadatum, then the max parameter to the constructor specifies whether matching Metadatum, then the max parameter to the constructor specifies whether
the maximum or minimum lexicographic value will be used. the maximum or minimum lexicographic value will be used.
* *
* @author Peter Breton * @author Peter Breton
* @version $Revision$ * @version $Revision$
*/ */
@@ -40,11 +40,12 @@ public class ItemComparator implements Comparator, Serializable
/** Whether maximum or minimum value will be used */ /** Whether maximum or minimum value will be used */
protected boolean max; protected boolean max;
protected ItemService itemService; protected transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
/** /**
* Constructor. * Constructor.
* *
* @param element * @param element
* The Dublin Core element * The Dublin Core element
* @param qualifier * @param qualifier
@@ -63,19 +64,18 @@ public class ItemComparator implements Comparator, Serializable
this.qualifier = qualifier; this.qualifier = qualifier;
this.language = language; this.language = language;
this.max = max; this.max = max;
this.itemService = ContentServiceFactory.getInstance().getItemService();
} }
/** /**
* Compare two Items by checking their DCValues for element, qualifier, and * Compare two Items by checking their DCValues for element, qualifier, and
* language. * language.
* *
* <p> * <p>
* Return >= 1 if the first is lexicographically greater than the second; <= * Return >= 1 if the first is lexicographically greater than the second; <=
* -1 if the second is lexicographically greater than the first, and 0 * -1 if the second is lexicographically greater than the first, and 0
* otherwise. * otherwise.
* </p> * </p>
* *
* @param first * @param first
* The first object to compare. Must be an object of type * The first object to compare. Must be an object of type
* org.dspace.content.Item. * org.dspace.content.Item.
@@ -122,11 +122,12 @@ public class ItemComparator implements Comparator, Serializable
* Return true if the object is equal to this one, false otherwise. Another * Return true if the object is equal to this one, false otherwise. Another
* object is equal to this one if it is also an ItemComparator, and has the * object is equal to this one if it is also an ItemComparator, and has the
* same values for element, qualifier, language, and max. * same values for element, qualifier, language, and max.
* *
* @param obj * @param obj
* The object to compare to. * The object to compare to.
* @return True if the other object is equal to this one, false otherwise. * @return True if the other object is equal to this one, false otherwise.
*/ */
@Override
public boolean equals(Object obj) public boolean equals(Object obj)
{ {
if (!(obj instanceof ItemComparator)) if (!(obj instanceof ItemComparator))
@@ -141,13 +142,16 @@ public class ItemComparator implements Comparator, Serializable
&& equalsWithNull(language, other.language) && (max == other.max); && equalsWithNull(language, other.language) && (max == other.max);
} }
@Override
public int hashCode() public int hashCode()
{ {
return new HashCodeBuilder().append(element).append(qualifier).append(language).append(max).toHashCode(); return new HashCodeBuilder().append(element).append(qualifier).append(language).append(max).toHashCode();
} }
/** /**
* Return true if the first string is equal to the second. Either or both * @param first
* @param second
* @return true if the first string is equal to the second. Either or both
* may be null. * may be null.
*/ */
protected boolean equalsWithNull(String first, String second) protected boolean equalsWithNull(String first, String second)
@@ -170,7 +174,7 @@ public class ItemComparator implements Comparator, Serializable
* values, null is returned. If there is exactly one value, then it is * values, null is returned. If there is exactly one value, then it is
* returned. Otherwise, either the maximum or minimum lexicographical value * returned. Otherwise, either the maximum or minimum lexicographical value
* is returned; the parameter to the constructor says which. * is returned; the parameter to the constructor says which.
* *
* @param item * @param item
* The item to check * The item to check
* @return The chosen value, or null * @return The chosen value, or null
@@ -180,7 +184,7 @@ public class ItemComparator implements Comparator, Serializable
// The overall array and each element are guaranteed non-null // The overall array and each element are guaranteed non-null
List<MetadataValue> dcvalues = itemService.getMetadata(item, MetadataSchema.DC_SCHEMA, element, qualifier, language); List<MetadataValue> dcvalues = itemService.getMetadata(item, MetadataSchema.DC_SCHEMA, element, qualifier, language);
if (dcvalues.size() == 0) if (dcvalues.isEmpty())
{ {
return null; return null;
} }
@@ -192,7 +196,7 @@ public class ItemComparator implements Comparator, Serializable
// We want to sort using Strings, but also keep track of // We want to sort using Strings, but also keep track of
// which Metadatum the value came from. // which Metadatum the value came from.
Map<String, Integer> values = new HashMap<String, Integer>(); Map<String, Integer> values = new HashMap<>();
for (int i = 0; i < dcvalues.size(); i++) for (int i = 0; i < dcvalues.size(); i++)
{ {
@@ -204,7 +208,7 @@ public class ItemComparator implements Comparator, Serializable
} }
} }
if (values.size() == 0) if (values.isEmpty())
{ {
return null; return null;
} }
@@ -220,6 +224,8 @@ public class ItemComparator implements Comparator, Serializable
/** /**
* Normalize the title of a Metadatum. * Normalize the title of a Metadatum.
* @param value
* @return
*/ */
protected String normalizeTitle(MetadataValue value) protected String normalizeTitle(MetadataValue value)
{ {

View File

@@ -26,7 +26,6 @@ import org.dspace.core.LogManager;
import org.dspace.eperson.EPerson; import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group; import org.dspace.eperson.Group;
import org.dspace.event.Event; import org.dspace.event.Event;
import org.dspace.handle.service.HandleService;
import org.dspace.identifier.IdentifierException; import org.dspace.identifier.IdentifierException;
import org.dspace.identifier.service.IdentifierService; import org.dspace.identifier.service.IdentifierService;
import org.dspace.versioning.service.VersioningService; import org.dspace.versioning.service.VersioningService;
@@ -57,16 +56,12 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
@Autowired(required = true) @Autowired(required = true)
protected CommunityService communityService; protected CommunityService communityService;
@Autowired(required = true) @Autowired(required = true)
protected HandleService handleService;
@Autowired(required = true)
protected AuthorizeService authorizeService; protected AuthorizeService authorizeService;
@Autowired(required = true) @Autowired(required = true)
protected BundleService bundleService; protected BundleService bundleService;
@Autowired(required = true) @Autowired(required = true)
protected BitstreamFormatService bitstreamFormatService; protected BitstreamFormatService bitstreamFormatService;
@Autowired(required = true) @Autowired(required = true)
protected ChoiceAuthorityService choiceAuthorityService;
@Autowired(required = true)
protected MetadataSchemaService metadataSchemaService; protected MetadataSchemaService metadataSchemaService;
@Autowired(required = true) @Autowired(required = true)
protected BitstreamService bitstreamService; protected BitstreamService bitstreamService;

View File

@@ -26,7 +26,7 @@ public class Site extends DSpaceObject
{ {
@Transient @Transient
private SiteService siteService; private transient SiteService siteService;
/** /**
* Get the type of this object, found in Constants * Get the type of this object, found in Constants

View File

@@ -15,7 +15,6 @@ import org.dspace.core.ConfigurationManager;
import org.dspace.core.Constants; import org.dspace.core.Constants;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.event.Event; import org.dspace.event.Event;
import org.dspace.handle.service.HandleService;
import org.dspace.services.ConfigurationService; import org.dspace.services.ConfigurationService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -35,9 +34,6 @@ public class SiteServiceImpl extends DSpaceObjectServiceImpl<Site> implements Si
@Autowired(required = true) @Autowired(required = true)
protected AuthorizeService authorizeService; protected AuthorizeService authorizeService;
@Autowired(required = true)
protected HandleService handleService;
@Autowired(required = true) @Autowired(required = true)
protected ConfigurationService configurationService; protected ConfigurationService configurationService;

View File

@@ -7,6 +7,7 @@
*/ */
package org.dspace.content; package org.dspace.content;
import java.io.Serializable;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -26,7 +27,7 @@ import javax.persistence.*;
*/ */
@Entity @Entity
@Table(name = "workspaceitem") @Table(name = "workspaceitem")
public class WorkspaceItem implements InProgressSubmission public class WorkspaceItem implements InProgressSubmission, Serializable
{ {
@Id @Id
@@ -67,7 +68,7 @@ public class WorkspaceItem implements InProgressSubmission
joinColumns = {@JoinColumn(name = "workspace_item_id") }, joinColumns = {@JoinColumn(name = "workspace_item_id") },
inverseJoinColumns = {@JoinColumn(name = "eperson_group_id") } inverseJoinColumns = {@JoinColumn(name = "eperson_group_id") }
) )
private List<Group> supervisorGroups = new ArrayList<>(); private final List<Group> supervisorGroups = new ArrayList<>();
/** /**
@@ -131,6 +132,7 @@ public class WorkspaceItem implements InProgressSubmission
* @param o The other workspace item to compare to * @param o The other workspace item to compare to
* @return If they are equal or not * @return If they are equal or not
*/ */
@Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)
{ {
@@ -150,6 +152,7 @@ public class WorkspaceItem implements InProgressSubmission
return true; return true;
} }
@Override
public int hashCode() public int hashCode()
{ {
return new HashCodeBuilder().append(getID()).toHashCode(); return new HashCodeBuilder().append(getID()).toHashCode();

View File

@@ -70,7 +70,7 @@ public class CrosswalkUtils {
if (mdField == null) { if (mdField == null) {
if (forceCreate && fieldChoice.equals("add")) { if (forceCreate && fieldChoice.equals("add")) {
try { try {
mdField = metadataFieldService.create(context, mdSchema, element, qualifier, null); metadataFieldService.create(context, mdSchema, element, qualifier, null);
} catch (NonUniqueMetadataException e) { } catch (NonUniqueMetadataException e) {
// This case should also not be possible // This case should also not be possible
e.printStackTrace(); e.printStackTrace();

View File

@@ -375,7 +375,7 @@ public class QDCCrosswalk extends SelfNamedPlugin
// only complain about missing elements in the DC schema: // only complain about missing elements in the DC schema:
if (elt == null) if (elt == null)
{ {
if (metadataField.getMetadataSchema().equals(MetadataSchema.DC_SCHEMA)) if (metadataField.getMetadataSchema().getName().equals(MetadataSchema.DC_SCHEMA))
{ {
log.warn("WARNING: " + myName + ": No QDC mapping for \"" + qdc + "\""); log.warn("WARNING: " + myName + ": No QDC mapping for \"" + qdc + "\"");
} }

View File

@@ -15,6 +15,7 @@ import org.dspace.core.GenericDAO;
* All DSpaceObject DAO classes should implement this class since it ensures that the T object is of type DSpaceObject * All DSpaceObject DAO classes should implement this class since it ensures that the T object is of type DSpaceObject
* *
* @author kevinvandevelde at atmire.com * @author kevinvandevelde at atmire.com
* @param <T>
*/ */
public interface DSpaceObjectDAO<T extends DSpaceObject> extends GenericDAO<T> { public interface DSpaceObjectDAO<T extends DSpaceObject> extends GenericDAO<T> {
} }

View File

@@ -17,6 +17,7 @@ import java.sql.SQLException;
* to identify DSpaceObjects prior to DSpace 6.0 * to identify DSpaceObjects prior to DSpace 6.0
* *
* @author kevinvandevelde at atmire.com * @author kevinvandevelde at atmire.com
* @param <T>
*/ */
public interface DSpaceObjectLegacySupportDAO<T extends DSpaceObject> extends DSpaceObjectDAO<T> { public interface DSpaceObjectLegacySupportDAO<T extends DSpaceObject> extends DSpaceObjectDAO<T> {

View File

@@ -77,8 +77,7 @@ public class BitstreamDAOImpl extends AbstractHibernateDSODAO<Bitstream> impleme
public Iterator<Bitstream> findByCommunity(Context context, Community community) throws SQLException { public Iterator<Bitstream> findByCommunity(Context context, Community community) throws SQLException {
Query query = createQuery(context, "select b from Bitstream b " + Query query = createQuery(context, "select b from Bitstream b " +
"join b.bundles bitBundles " + "join b.bundles bitBundles " +
"join bitBundles.bundle bundle " + "join bitBundles.items item " +
"join bundle.items item " +
"join item.collections itemColl " + "join item.collections itemColl " +
"join itemColl.communities community " + "join itemColl.communities community " +
"WHERE :community IN community"); "WHERE :community IN community");
@@ -92,8 +91,7 @@ public class BitstreamDAOImpl extends AbstractHibernateDSODAO<Bitstream> impleme
public Iterator<Bitstream> findByCollection(Context context, Collection collection) throws SQLException { public Iterator<Bitstream> findByCollection(Context context, Collection collection) throws SQLException {
Query query = createQuery(context, "select b from Bitstream b " + Query query = createQuery(context, "select b from Bitstream b " +
"join b.bundles bitBundles " + "join b.bundles bitBundles " +
"join bitBundles.bundle bundle " + "join bitBundles.items item " +
"join bundle.items item " +
"join item.collections c " + "join item.collections c " +
"WHERE :collection IN c"); "WHERE :collection IN c");
@@ -106,8 +104,7 @@ public class BitstreamDAOImpl extends AbstractHibernateDSODAO<Bitstream> impleme
public Iterator<Bitstream> findByItem(Context context, Item item) throws SQLException { public Iterator<Bitstream> findByItem(Context context, Item item) throws SQLException {
Query query = createQuery(context, "select b from Bitstream b " + Query query = createQuery(context, "select b from Bitstream b " +
"join b.bundles bitBundles " + "join b.bundles bitBundles " +
"join bitBundles.bundle bundle " + "join bitBundles.items item " +
"join bundle.items item " +
"WHERE :item IN item"); "WHERE :item IN item");
query.setParameter("item", item); query.setParameter("item", item);

View File

@@ -677,7 +677,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
owningCollection = inProgressSubmission.getCollection(); owningCollection = inProgressSubmission.getCollection();
} }
addLicense(context, item, license, (Collection) ContentServiceFactory.getInstance().getDSpaceObjectService(dso).getParentObject(context, dso) addLicense(context, item, license, owningCollection
, params); , params);
// FIXME ? // FIXME ?

View File

@@ -11,6 +11,8 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
@@ -256,12 +258,23 @@ public class RoleIngester implements PackageIngester
{ // Group already exists, so empty it { // Group already exists, so empty it
if (params.replaceModeEnabled()) // -r -f if (params.replaceModeEnabled()) // -r -f
{ {
for (Group member : collider.getMemberGroups()) // Get a *copy* of our group list to avoid ConcurrentModificationException
// when we remove these groups from the parent Group obj
List<Group> groupRemovalList = new ArrayList<>(collider.getMemberGroups());
Iterator<Group> groupIterator = groupRemovalList.iterator();
while(groupIterator.hasNext())
{ {
Group member = groupIterator.next();
groupService.removeMember(context, collider, member); groupService.removeMember(context, collider, member);
} }
for (EPerson member : collider.getMembers())
// Get a *copy* of our eperson list to avoid ConcurrentModificationException
// when we remove these epersons from the parent Group obj
List<EPerson> epersonRemovalList = new ArrayList<>(collider.getMembers());
Iterator<EPerson> epersonIterator = epersonRemovalList.iterator();
while(epersonIterator.hasNext())
{ {
EPerson member = epersonIterator.next();
// Remove all group members *EXCEPT* we don't ever want // Remove all group members *EXCEPT* we don't ever want
// to remove the current user from the list of Administrators // to remove the current user from the list of Administrators
// (otherwise remainder of ingest will fail) // (otherwise remainder of ingest will fail)

View File

@@ -35,7 +35,6 @@ public class MicrosoftTranslator extends AbstractTranslator
protected final String PLUGIN_PREFIX = "translator"; protected final String PLUGIN_PREFIX = "translator";
protected final String baseUrl = "http://api.microsofttranslator.com/V2/Http.svc/Translate"; protected final String baseUrl = "http://api.microsofttranslator.com/V2/Http.svc/Translate";
protected String apiKey = "";
private static final Logger log = Logger.getLogger(MicrosoftTranslator.class); private static final Logger log = Logger.getLogger(MicrosoftTranslator.class);

View File

@@ -218,10 +218,20 @@ public class DiscoverQuery {
this.facetOffset = facetOffset; this.facetOffset = facetOffset;
} }
/**
* Sets the fields which you want Discovery to return in the search results.
* It is HIGHLY recommended to limit the fields returned, as by default
* some backends (like Solr) will return everything.
* @param field field to add to the list of fields returned
*/
public void addSearchField(String field){ public void addSearchField(String field){
this.searchFields.add(field); this.searchFields.add(field);
} }
/**
* Get list of fields which Discovery will return in the search results
* @return List of field names
*/
public List<String> getSearchFields() { public List<String> getSearchFields() {
return searchFields; return searchFields;
} }

View File

@@ -90,6 +90,9 @@ public class SolrServiceImpl implements SearchService, IndexingService {
private static final Logger log = Logger.getLogger(SolrServiceImpl.class); private static final Logger log = Logger.getLogger(SolrServiceImpl.class);
protected static final String LAST_INDEXED_FIELD = "SolrIndexer.lastIndexed"; protected static final String LAST_INDEXED_FIELD = "SolrIndexer.lastIndexed";
protected static final String HANDLE_FIELD = "handle";
protected static final String RESOURCE_TYPE_FIELD = "search.resourcetype";
protected static final String RESOURCE_ID_FIELD = "search.resourceid";
public static final String FILTER_SEPARATOR = "\n|||\n"; public static final String FILTER_SEPARATOR = "\n|||\n";
@@ -135,9 +138,11 @@ public class SolrServiceImpl implements SearchService, IndexingService {
solr.setBaseURL(solrService); solr.setBaseURL(solrService);
solr.setUseMultiPartPost(true); solr.setUseMultiPartPost(true);
// Dummy/test query to search for Item (type=2) of ID=1
SolrQuery solrQuery = new SolrQuery() SolrQuery solrQuery = new SolrQuery()
.setQuery("search.resourcetype:2 AND search.resourceid:1"); .setQuery(RESOURCE_TYPE_FIELD + ":2 AND " + RESOURCE_ID_FIELD + ":1");
// Only return obj identifier fields in result doc
solrQuery.setFields(RESOURCE_TYPE_FIELD, RESOURCE_ID_FIELD);
solr.query(solrQuery); solr.query(solrQuery);
// As long as Solr initialized, check with DatabaseUtils to see // As long as Solr initialized, check with DatabaseUtils to see
@@ -309,7 +314,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
try { try {
if(getSolr() != null){ if(getSolr() != null){
getSolr().deleteByQuery("handle:\"" + handle + "\""); getSolr().deleteByQuery(HANDLE_FIELD + ":\"" + handle + "\"");
if(commit) if(commit)
{ {
getSolr().commit(); getSolr().commit();
@@ -437,10 +442,13 @@ public class SolrServiceImpl implements SearchService, IndexingService {
} }
if (force) if (force)
{ {
getSolr().deleteByQuery("search.resourcetype:[2 TO 4]"); getSolr().deleteByQuery(RESOURCE_TYPE_FIELD + ":[2 TO 4]");
} else { } else {
SolrQuery query = new SolrQuery(); SolrQuery query = new SolrQuery();
query.setQuery("search.resourcetype:[2 TO 4]"); // Query for all indexed Items, Collections and Communities,
// returning just their handle
query.setFields(HANDLE_FIELD);
query.setQuery(RESOURCE_TYPE_FIELD + ":[2 TO 4]");
QueryResponse rsp = getSolr().query(query); QueryResponse rsp = getSolr().query(query);
SolrDocumentList docs = rsp.getResults(); SolrDocumentList docs = rsp.getResults();
@@ -450,7 +458,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
SolrDocument doc = (SolrDocument) iter.next(); SolrDocument doc = (SolrDocument) iter.next();
String handle = (String) doc.getFieldValue("handle"); String handle = (String) doc.getFieldValue(HANDLE_FIELD);
DSpaceObject o = handleService.resolveToObject(context, handle); DSpaceObject o = handleService.resolveToObject(context, handle);
@@ -590,9 +598,9 @@ public class SolrServiceImpl implements SearchService, IndexingService {
boolean inIndex = false; boolean inIndex = false;
SolrQuery query = new SolrQuery(); SolrQuery query = new SolrQuery();
query.setQuery("handle:" + handle); query.setQuery(HANDLE_FIELD + ":" + handle);
// Specify that we ONLY want the LAST_INDEXED_FIELD returned in the field list (fl) // Specify that we ONLY want the LAST_INDEXED_FIELD returned in the field list (fl)
query.setParam(CommonParams.FL, LAST_INDEXED_FIELD); query.setFields(LAST_INDEXED_FIELD);
QueryResponse rsp; QueryResponse rsp;
try { try {
@@ -1414,10 +1422,9 @@ public class SolrServiceImpl implements SearchService, IndexingService {
// New fields to weaken the dependence on handles, and allow for faster // New fields to weaken the dependence on handles, and allow for faster
// list display // list display
doc.addField("search.uniqueid", type+"-"+id); doc.addField("search.uniqueid", type+"-"+id);
doc.addField("search.resourcetype", Integer.toString(type)); doc.addField(RESOURCE_TYPE_FIELD, Integer.toString(type));
doc.addField(RESOURCE_ID_FIELD, id.toString());
doc.addField("search.resourceid", id.toString());
// want to be able to search for handle, so use keyword // want to be able to search for handle, so use keyword
// (not tokenized, but it is indexed) // (not tokenized, but it is indexed)
@@ -1425,7 +1432,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{ {
// want to be able to search for handle, so use keyword // want to be able to search for handle, so use keyword
// (not tokenized, but it is indexed) // (not tokenized, but it is indexed)
doc.addField("handle", handle); doc.addField(HANDLE_FIELD, handle);
} }
if (locations != null) if (locations != null)
@@ -1529,7 +1536,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
return value; return value;
} }
//******** SearchService implementation //========== SearchService implementation
@Override @Override
public DiscoverResult search(Context context, DiscoverQuery query) throws SearchServiceException public DiscoverResult search(Context context, DiscoverQuery query) throws SearchServiceException
{ {
@@ -1556,7 +1563,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
discoveryQuery.addFilterQueries("location:l" + dso.getID()); discoveryQuery.addFilterQueries("location:l" + dso.getID());
} else if (dso instanceof Item) } else if (dso instanceof Item)
{ {
discoveryQuery.addFilterQueries("handle:" + dso.getHandle()); discoveryQuery.addFilterQueries(HANDLE_FIELD + ":" + dso.getHandle());
} }
} }
return search(context, discoveryQuery, includeUnDiscoverable); return search(context, discoveryQuery, includeUnDiscoverable);
@@ -1593,6 +1600,18 @@ public class SolrServiceImpl implements SearchService, IndexingService {
} }
solrQuery.setQuery(query); solrQuery.setQuery(query);
// Add any search fields to our query. This is the limited list
// of fields that will be returned in the solr result
for(String fieldName : discoveryQuery.getSearchFields())
{
solrQuery.addField(fieldName);
}
// Also ensure a few key obj identifier fields are returned with every query
solrQuery.addField(HANDLE_FIELD);
solrQuery.addField(RESOURCE_TYPE_FIELD);
solrQuery.addField(RESOURCE_ID_FIELD);
if(discoveryQuery.isSpellCheck()) if(discoveryQuery.isSpellCheck())
{ {
solrQuery.setParam(SpellingParams.SPELLCHECK_Q, query); solrQuery.setParam(SpellingParams.SPELLCHECK_Q, query);
@@ -1613,7 +1632,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
} }
if(discoveryQuery.getDSpaceObjectFilter() != -1) if(discoveryQuery.getDSpaceObjectFilter() != -1)
{ {
solrQuery.addFilterQuery("search.resourcetype:" + discoveryQuery.getDSpaceObjectFilter()); solrQuery.addFilterQuery(RESOURCE_TYPE_FIELD + ":" + discoveryQuery.getDSpaceObjectFilter());
} }
for (int i = 0; i < discoveryQuery.getFieldPresentQueries().size(); i++) for (int i = 0; i < discoveryQuery.getFieldPresentQueries().size(); i++)
@@ -1726,7 +1745,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
query.addFilterQueries("location:l" + dso.getID()); query.addFilterQueries("location:l" + dso.getID());
} else if (dso instanceof Item) } else if (dso instanceof Item)
{ {
query.addFilterQueries("handle:" + dso.getHandle()); query.addFilterQueries(HANDLE_FIELD + ":" + dso.getHandle());
} }
} }
return searchJSON(context, query, jsonIdentifier); return searchJSON(context, query, jsonIdentifier);
@@ -1781,7 +1800,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{ {
result.addDSpaceObject(dso); result.addDSpaceObject(dso);
} else { } else {
log.error(LogManager.getHeader(context, "Error while retrieving DSpace object from discovery index", "Handle: " + doc.getFirstValue("handle"))); log.error(LogManager.getHeader(context, "Error while retrieving DSpace object from discovery index", "Handle: " + doc.getFirstValue(HANDLE_FIELD)));
continue; continue;
} }
@@ -1900,9 +1919,9 @@ public class SolrServiceImpl implements SearchService, IndexingService {
protected DSpaceObject findDSpaceObject(Context context, SolrDocument doc) throws SQLException { protected DSpaceObject findDSpaceObject(Context context, SolrDocument doc) throws SQLException {
Integer type = (Integer) doc.getFirstValue("search.resourcetype"); Integer type = (Integer) doc.getFirstValue(RESOURCE_TYPE_FIELD);
UUID id = UUID.fromString((String) doc.getFirstValue("search.resourceid")); UUID id = UUID.fromString((String) doc.getFirstValue(RESOURCE_ID_FIELD));
String handle = (String) doc.getFirstValue("handle"); String handle = (String) doc.getFirstValue(HANDLE_FIELD);
if (type != null && id != null) if (type != null && id != null)
{ {
@@ -1956,7 +1975,8 @@ public class SolrServiceImpl implements SearchService, IndexingService {
SolrQuery solrQuery = new SolrQuery(); SolrQuery solrQuery = new SolrQuery();
solrQuery.setQuery(query); solrQuery.setQuery(query);
solrQuery.setFields("search.resourceid", "search.resourcetype"); //Only return obj identifier fields in result doc
solrQuery.setFields(RESOURCE_ID_FIELD, RESOURCE_TYPE_FIELD);
solrQuery.setStart(offset); solrQuery.setStart(offset);
solrQuery.setRows(max); solrQuery.setRows(max);
if (orderfield != null) if (orderfield != null)
@@ -1976,7 +1996,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{ {
SolrDocument doc = (SolrDocument) iter.next(); SolrDocument doc = (SolrDocument) iter.next();
DSpaceObject o = contentServiceFactory.getDSpaceObjectService((Integer) doc.getFirstValue("search.resourcetype")).find(context, UUID.fromString((String) doc.getFirstValue("search.resourceid"))); DSpaceObject o = contentServiceFactory.getDSpaceObjectService((Integer) doc.getFirstValue(RESOURCE_TYPE_FIELD)).find(context, UUID.fromString((String) doc.getFirstValue(RESOURCE_ID_FIELD)));
if (o != null) if (o != null)
{ {
@@ -2065,7 +2085,9 @@ public class SolrServiceImpl implements SearchService, IndexingService {
try{ try{
SolrQuery solrQuery = new SolrQuery(); SolrQuery solrQuery = new SolrQuery();
//Set the query to handle since this is unique //Set the query to handle since this is unique
solrQuery.setQuery("handle: " + item.getHandle()); solrQuery.setQuery(HANDLE_FIELD + ": " + item.getHandle());
//Only return obj identifier fields in result doc
solrQuery.setFields(HANDLE_FIELD, RESOURCE_TYPE_FIELD, RESOURCE_ID_FIELD);
//Add the more like this parameters ! //Add the more like this parameters !
solrQuery.setParam(MoreLikeThisParams.MLT, true); solrQuery.setParam(MoreLikeThisParams.MLT, true);
//Add a comma separated list of the similar fields //Add a comma separated list of the similar fields

View File

@@ -64,7 +64,7 @@ public class EPerson extends DSpaceObject implements DSpaceObjectLegacySupport
private String digestAlgorithm; private String digestAlgorithm;
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "epeople") @ManyToMany(fetch = FetchType.LAZY, mappedBy = "epeople")
private List<Group> groups = new ArrayList<>(); private final List<Group> groups = new ArrayList<>();
/** The e-mail field (for sorting) */ /** The e-mail field (for sorting) */
public static final int EMAIL = 1; public static final int EMAIL = 1;
@@ -82,7 +82,7 @@ public class EPerson extends DSpaceObject implements DSpaceObjectLegacySupport
public static final int LANGUAGE = 5; public static final int LANGUAGE = 5;
@Transient @Transient
protected EPersonService ePersonService; protected transient EPersonService ePersonService;
protected EPerson() { protected EPerson() {
} }
@@ -198,10 +198,10 @@ public class EPerson extends DSpaceObject implements DSpaceObjectLegacySupport
/** /**
* Set the EPerson's netid * Set the EPerson's netid
* *
* @param s * @param netid
* the new netid * the new netid
*/ */
public void setNetid(String s) { public void setNetid(String netid) {
this.netid = netid; this.netid = netid;
setModified(); setModified();
} }

View File

@@ -99,7 +99,11 @@ public class EPersonServiceImpl extends DSpaceObjectServiceImpl<EPerson> impleme
@Override @Override
public List<EPerson> search(Context context, String query) throws SQLException { public List<EPerson> search(Context context, String query) throws SQLException {
if(StringUtils.isBlank(query)) query = null; if(StringUtils.isBlank(query))
{
//If we don't have a query, just return everything.
return findAll(context, EPerson.EMAIL);
}
return search(context, query, -1, -1); return search(context, query, -1, -1);
} }
@@ -116,7 +120,10 @@ public class EPersonServiceImpl extends DSpaceObjectServiceImpl<EPerson> impleme
} catch(IllegalArgumentException e) { } catch(IllegalArgumentException e) {
MetadataField firstNameField = metadataFieldService.findByElement(context, "eperson", "firstname", null); MetadataField firstNameField = metadataFieldService.findByElement(context, "eperson", "firstname", null);
MetadataField lastNameField = metadataFieldService.findByElement(context, "eperson", "lastname", null); MetadataField lastNameField = metadataFieldService.findByElement(context, "eperson", "lastname", null);
if (StringUtils.isBlank(query)) query = null; if (StringUtils.isBlank(query))
{
query = null;
}
return ePersonDAO.search(context, query, Arrays.asList(firstNameField, lastNameField), Arrays.asList(firstNameField, lastNameField), offset, limit); return ePersonDAO.search(context, query, Arrays.asList(firstNameField, lastNameField), Arrays.asList(firstNameField, lastNameField), offset, limit);
} }
} }

View File

@@ -52,7 +52,7 @@ public class Group extends DSpaceObject implements DSpaceObjectLegacySupport
joinColumns = {@JoinColumn(name = "eperson_group_id") }, joinColumns = {@JoinColumn(name = "eperson_group_id") },
inverseJoinColumns = {@JoinColumn(name = "eperson_id") } inverseJoinColumns = {@JoinColumn(name = "eperson_id") }
) )
private List<EPerson> epeople = new ArrayList<>(); private final List<EPerson> epeople = new ArrayList<>();
@ManyToMany(fetch = FetchType.LAZY) @ManyToMany(fetch = FetchType.LAZY)
@JoinTable( @JoinTable(
@@ -60,19 +60,19 @@ public class Group extends DSpaceObject implements DSpaceObjectLegacySupport
joinColumns = {@JoinColumn(name = "parent_id") }, joinColumns = {@JoinColumn(name = "parent_id") },
inverseJoinColumns = {@JoinColumn(name = "child_id") } inverseJoinColumns = {@JoinColumn(name = "child_id") }
) )
private List<Group> groups = new ArrayList<>(); private final List<Group> groups = new ArrayList<>();
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "groups") @ManyToMany(fetch = FetchType.LAZY, mappedBy = "groups")
private List<Group> parentGroups = new ArrayList<>(); private final List<Group> parentGroups = new ArrayList<>();
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "supervisorGroups") @ManyToMany(fetch = FetchType.LAZY, mappedBy = "supervisorGroups")
private List<WorkspaceItem> supervisedItems = new ArrayList<>(); private final List<WorkspaceItem> supervisedItems = new ArrayList<>();
@Transient @Transient
private boolean groupsChanged; private boolean groupsChanged;
@Transient @Transient
private GroupService groupService; private transient GroupService groupService;
public Group() { public Group() {
} }

View File

@@ -134,8 +134,6 @@ public class SubscribeCLITool {
// Truncation will actually pass in "Midnight of yesterday in UTC", which will be, // Truncation will actually pass in "Midnight of yesterday in UTC", which will be,
// at least in CDT, "7pm, the day before yesterday, in my current timezone". // at least in CDT, "7pm, the day before yesterday, in my current timezone".
cal.add(Calendar.HOUR, -24); cal.add(Calendar.HOUR, -24);
Date thisTimeYesterday = cal.getTime();
cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0); cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0); cal.set(Calendar.SECOND, 0);

View File

@@ -836,7 +836,7 @@ public class OAIHarvester {
// First, see if we can contact the target server at all. // First, see if we can contact the target server at all.
try { try {
Identify idenTest = new Identify(oaiSource); new Identify(oaiSource);
} }
catch (Exception ex) { catch (Exception ex) {
errorSet.add(OAI_ADDRESS_ERROR + ": OAI server could not be reached."); errorSet.add(OAI_ADDRESS_ERROR + ": OAI server could not be reached.");

View File

@@ -330,14 +330,7 @@ public class CCLookup {
// Example: http://api.creativecommons.org/rest/1.5/details? // Example: http://api.creativecommons.org/rest/1.5/details?
// license-uri=http://creativecommons.org/licenses/by-nc-sa/3.0/ // license-uri=http://creativecommons.org/licenses/by-nc-sa/3.0/
String issueUrl = cc_root + "/details?license-uri=" + licenseURI; String issueUrl = cc_root + "/details?license-uri=" + licenseURI;
// todo : modify for post as in the above issue
String post_data;
try {
post_data = URLEncoder.encode("license-uri", "UTF-8") + "=" + URLEncoder.encode(licenseURI, "UTF-8");
} catch (UnsupportedEncodingException e) {
return;
}
//end todo
URL request_url; URL request_url;
try { try {
request_url = new URL(issueUrl); request_url = new URL(issueUrl);
@@ -434,8 +427,7 @@ public class CCLookup {
public boolean isSuccess() { public boolean isSuccess() {
setSuccess(false); setSuccess(false);
java.io.ByteArrayOutputStream outputstream = new java.io.ByteArrayOutputStream(); JDOMXPath xp_Success;
JDOMXPath xp_Success = null;
String text = null; String text = null;
try { try {
xp_Success = new JDOMXPath("//message"); xp_Success = new JDOMXPath("//message");

View File

@@ -179,7 +179,7 @@ public class CreativeCommonsServiceImpl implements CreativeCommonsService, Initi
bs_format = bitstreamFormatService.findByShortDescription(context, "License"); bs_format = bitstreamFormatService.findByShortDescription(context, "License");
} }
Bitstream bs = bitstreamService.create(context, licenseStm); Bitstream bs = bitstreamService.create(context, bundle, licenseStm);
bs.setSource(context, CC_BS_SOURCE); bs.setSource(context, CC_BS_SOURCE);
bs.setName(context, (mimeType != null && bs.setName(context, (mimeType != null &&
(mimeType.equalsIgnoreCase("text/xml") || (mimeType.equalsIgnoreCase("text/xml") ||
@@ -270,7 +270,6 @@ public class CreativeCommonsServiceImpl implements CreativeCommonsService, Initi
@Override @Override
public String fetchLicenseRdf(String ccResult) { public String fetchLicenseRdf(String ccResult) {
StringWriter result = new StringWriter(); StringWriter result = new StringWriter();
String licenseRdfString = new String("");
try { try {
InputStream inputstream = new ByteArrayInputStream(ccResult.getBytes("UTF-8")); InputStream inputstream = new ByteArrayInputStream(ccResult.getBytes("UTF-8"));
templates.newTransformer().transform(new StreamSource(inputstream), new StreamResult(result)); templates.newTransformer().transform(new StreamSource(inputstream), new StreamResult(result));

View File

@@ -489,7 +489,6 @@ public class RDFizer {
builder.append(argument); builder.append(argument);
} }
String argumentsLine = builder.toString().trim(); String argumentsLine = builder.toString().trim();
argumentsLine.substring(0, argumentsLine.length() - 1);
System.err.print("Cannot recognize the following argument"); System.err.print("Cannot recognize the following argument");
if (remainingArgs.length >= 2) System.err.print("s"); if (remainingArgs.length >= 2) System.err.print("s");
System.err.println(": " + argumentsLine + "."); System.err.println(": " + argumentsLine + ".");

View File

@@ -227,7 +227,11 @@ public class MetadataConverterPlugin implements ConverterPlugin
} }
config.read(is, "file://" + mappingPath, FileUtils.guessLang(mappingPath)); config.read(is, "file://" + mappingPath, FileUtils.guessLang(mappingPath));
try { try {
is.close(); // Make sure that we have an input stream to avoid NullPointer
if(is != null)
{
is.close();
}
} }
catch (IOException ex) catch (IOException ex)
{ {

View File

@@ -83,9 +83,7 @@ public class MediaRange
throws IllegalArgumentException, IllegalStateException throws IllegalArgumentException, IllegalStateException
{ {
Pattern mediaRangePattern = Pattern.compile("^" + mediaRangeRegex + "$"); Pattern mediaRangePattern = Pattern.compile("^" + mediaRangeRegex + "$");
Pattern nonQualityParamPattern = Pattern.compile(nonQualityParam);
Pattern qualityParamPattern = Pattern.compile(qualityParam);
Matcher rangeMatcher = mediaRangePattern.matcher(mediarange.trim()); Matcher rangeMatcher = mediaRangePattern.matcher(mediarange.trim());
if (!rangeMatcher.matches()) if (!rangeMatcher.matches())
{ {

View File

@@ -641,11 +641,6 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
{ {
return currentValsStored; return currentValsStored;
} }
// We have at least one document good
SolrDocument document = response.getResults().get(0);
// System.out.println("HERE");
// Get the info we need
} }
catch (SolrServerException e) catch (SolrServerException e)
{ {

View File

@@ -186,7 +186,7 @@ public class StatisticsDataWorkflow extends StatisticsData {
} catch (ConfigurationException e) { } catch (ConfigurationException e) {
log.error("Error while storing workflow start date", e); log.error("Error while storing workflow start date", e);
} }
//ALso store it in our local config ! //Also store it in our local config !
configurationService.setProperty("usage-statistics.workflow-start-date", new DCDate(oldestDate).toString()); configurationService.setProperty("usage-statistics.workflow-start-date", new DCDate(oldestDate).toString());
//Write to file //Write to file

View File

@@ -99,7 +99,7 @@ public class SpiderDetector {
* private loader to populate the table from files. * private loader to populate the table from files.
*/ */
private static void loadSpiderIpAddresses() { private synchronized static void loadSpiderIpAddresses() {
if (table == null) { if (table == null) {
table = new IPTable(); table = new IPTable();

View File

@@ -115,7 +115,6 @@ public class StatisticsImporterElasticSearch {
DNSCache dnsCache = new DNSCache(2500, 0.75f, 2500); DNSCache dnsCache = new DNSCache(2500, 0.75f, 2500);
Object fromCache; Object fromCache;
Random rand = new Random();
ContentServiceFactory contentServiceFactory = ContentServiceFactory.getInstance(); ContentServiceFactory contentServiceFactory = ContentServiceFactory.getInstance();
while ((line = input.readLine()) != null) while ((line = input.readLine()) != null)

View File

@@ -301,7 +301,7 @@ public class DatabaseUtils
System.out.println("\nERROR: The database user '" + username + "' does not have sufficient privileges to run a 'database clean' (via Flyway)."); System.out.println("\nERROR: The database user '" + username + "' does not have sufficient privileges to run a 'database clean' (via Flyway).");
System.out.println("\nIn order to run a 'clean', the database user MUST have 'superuser' privileges"); System.out.println("\nIn order to run a 'clean', the database user MUST have 'superuser' privileges");
System.out.println("OR the '" + PostgresUtils.PGCRYPTO + "' extension must be installed in a separate schema (see documentation)."); System.out.println("OR the '" + PostgresUtils.PGCRYPTO + "' extension must be installed in a separate schema (see documentation).");
System.out.println("\nOptionally, you could also manually remove the '" + PostgresUtils.PGCRYPTO + "' extension first (DROP EXTENSION '" + PostgresUtils.PGCRYPTO + "' CASCADE), then rerun the 'clean'"); System.out.println("\nOptionally, you could also manually remove the '" + PostgresUtils.PGCRYPTO + "' extension first (DROP EXTENSION " + PostgresUtils.PGCRYPTO + " CASCADE), then rerun the 'clean'");
System.exit(1); System.exit(1);
} }
} }
@@ -368,7 +368,7 @@ public class DatabaseUtils
* DataSource object initialized by DatabaseManager * DataSource object initialized by DatabaseManager
* @return initialized Flyway object * @return initialized Flyway object
*/ */
private static Flyway setupFlyway(DataSource datasource) private synchronized static Flyway setupFlyway(DataSource datasource)
{ {
if (flywaydb==null) if (flywaydb==null)
{ {

View File

@@ -52,8 +52,6 @@ public class V5_0_2014_11_04__Enable_XMLWorkflow_Migration
public void migrate(Connection connection) public void migrate(Connection connection)
throws IOException, SQLException throws IOException, SQLException
{ {
String currentFlyWayState = DatabaseUtils.getCurrentFlywayState(connection);
// Make sure XML Workflow is enabled in workflow.cfg before proceeding // Make sure XML Workflow is enabled in workflow.cfg before proceeding
if (ConfigurationManager.getProperty("workflow", "workflow.framework").equals("xmlworkflow") if (ConfigurationManager.getProperty("workflow", "workflow.framework").equals("xmlworkflow")
// If your database was upgraded to DSpace 6 prior to enabling XML Workflow, we MUST skip this 5.x migration, as it is incompatible // If your database was upgraded to DSpace 6 prior to enabling XML Workflow, we MUST skip this 5.x migration, as it is incompatible

View File

@@ -425,7 +425,7 @@ public class DSpaceWorkspaceItemOutputGenerator implements OutputGenerator
if (mdfield == null) if (mdfield == null)
{ {
mdfield = metadataFieldService.create(context, mdschema, element, qualifier, metadataFieldService.create(context, mdschema, element, qualifier,
"Campo utilizzato per la cache del provider submission-lookup: " "Campo utilizzato per la cache del provider submission-lookup: "
+ schema); + schema);
create = true; create = true;

View File

@@ -14,10 +14,7 @@ import gr.ekt.bte.core.Value;
import gr.ekt.bte.exceptions.MalformedSourceException; import gr.ekt.bte.exceptions.MalformedSourceException;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpException; import org.apache.http.HttpException;
@@ -78,7 +75,7 @@ public abstract class NetworkSubmissionLookupDataLoader implements
: null; : null;
String year = getSearchTerms().get("year") != null ? getSearchTerms() String year = getSearchTerms().get("year") != null ? getSearchTerms()
.get("year").iterator().next() .get("year").iterator().next()
: null; : String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
int yearInt = Integer.parseInt(year); int yearInt = Integer.parseInt(year);
results = search(null, title, authors, yearInt); results = search(null, title, authors, yearInt);
} }

View File

@@ -236,7 +236,6 @@ public class CCLicenseStep extends AbstractProcessingStep
throws ServletException, IOException, SQLException, throws ServletException, IOException, SQLException,
AuthorizeException { AuthorizeException {
String ccLicenseUrl = request.getParameter("cc_license_url");
HttpSession session = request.getSession(); HttpSession session = request.getSession();
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
String licenseclass = (request.getParameter("licenseclass_chooser") != null) ? request.getParameter("licenseclass_chooser") : ""; String licenseclass = (request.getParameter("licenseclass_chooser") != null) ? request.getParameter("licenseclass_chooser") : "";

View File

@@ -11,12 +11,15 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@@ -26,6 +29,7 @@ import org.dspace.authorize.AuthorizeException;
import org.dspace.content.*; import org.dspace.content.*;
import org.dspace.content.factory.ContentServiceFactory; import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.BitstreamFormatService; import org.dspace.content.service.BitstreamFormatService;
import org.dspace.content.service.BitstreamService;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
import org.dspace.curate.Curator; import org.dspace.curate.Curator;
@@ -264,6 +268,44 @@ public class UploadStep extends AbstractProcessingStep
// ------------------------------------------------- // -------------------------------------------------
// Step #3: Check for a change in file description // Step #3: Check for a change in file description
// ------------------------------------------------- // -------------------------------------------------
// We have to check for descriptions from users using the resumable upload
// and from users using the simple upload.
// Beginning with the resumable ones.
Enumeration<String> parameterNames = request.getParameterNames();
Map<String, String> descriptions = new HashMap<>();
while (parameterNames.hasMoreElements())
{
String name = parameterNames.nextElement();
if (StringUtils.startsWithIgnoreCase(name, "description["))
{
descriptions.put(
name.substring("description[".length(), name.length()-1),
request.getParameter(name));
}
}
if (!descriptions.isEmpty())
{
// we got descriptions from the resumable upload
if (item != null)
{
List<Bundle> bundles = itemService.getBundles(item, "ORIGINAL");
for (Bundle bundle : bundles)
{
List<Bitstream> bitstreams = bundle.getBitstreams();
for (Bitstream bitstream : bitstreams)
{
if (descriptions.containsKey(bitstream.getName()))
{
bitstream.setDescription(context, descriptions.get(bitstream.getName()));
bitstreamService.update(context, bitstream);
}
}
}
}
return STATUS_COMPLETE;
}
// Going on with descriptions from the simple upload
String fileDescription = request.getParameter("description"); String fileDescription = request.getParameter("description");
if (fileDescription != null && fileDescription.length() > 0) if (fileDescription != null && fileDescription.length() > 0)

View File

@@ -10,6 +10,11 @@ package org.dspace.submit.step;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Date; import java.util.Date;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List; import java.util.List;
@@ -20,6 +25,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.time.DateUtils; import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.dspace.app.util.SubmissionInfo; import org.dspace.app.util.SubmissionInfo;
import org.dspace.app.util.Util; import org.dspace.app.util.Util;
@@ -28,8 +34,6 @@ import org.dspace.authorize.ResourcePolicy;
import org.dspace.authorize.factory.AuthorizeServiceFactory; import org.dspace.authorize.factory.AuthorizeServiceFactory;
import org.dspace.authorize.service.ResourcePolicyService; import org.dspace.authorize.service.ResourcePolicyService;
import org.dspace.content.*; import org.dspace.content.*;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.BitstreamFormatService;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
import org.dspace.curate.Curator; import org.dspace.curate.Curator;
@@ -70,7 +74,6 @@ public class UploadWithEmbargoStep extends UploadStep
/** log4j logger */ /** log4j logger */
private static Logger log = Logger.getLogger(UploadWithEmbargoStep.class); private static Logger log = Logger.getLogger(UploadWithEmbargoStep.class);
protected BitstreamFormatService bitstreamFormatService = ContentServiceFactory.getInstance().getBitstreamFormatService();
protected HandleService handleService = HandleServiceFactory.getInstance().getHandleService(); protected HandleService handleService = HandleServiceFactory.getInstance().getHandleService();
protected GroupService groupService = EPersonServiceFactory.getInstance().getGroupService(); protected GroupService groupService = EPersonServiceFactory.getInstance().getGroupService();
protected ResourcePolicyService resourcePolicyService = AuthorizeServiceFactory.getInstance().getResourcePolicyService(); protected ResourcePolicyService resourcePolicyService = AuthorizeServiceFactory.getInstance().getResourcePolicyService();
@@ -244,6 +247,44 @@ public class UploadWithEmbargoStep extends UploadStep
// ------------------------------------------------- // -------------------------------------------------
// Step #3: Check for a change in file description // Step #3: Check for a change in file description
// ------------------------------------------------- // -------------------------------------------------
// We have to check for descriptions from users using the resumable upload
// and from users using the simple upload.
// Beginning with the resumable ones.
Enumeration<String> parameterNames = request.getParameterNames();
Map<String, String> descriptions = new HashMap<String, String>();
while (parameterNames.hasMoreElements())
{
String name = parameterNames.nextElement();
if (StringUtils.startsWithIgnoreCase(name, "description["))
{
descriptions.put(
name.substring("description[".length(), name.length()-1),
request.getParameter(name));
}
}
if (!descriptions.isEmpty())
{
// we got descriptions from the resumable upload
if (item != null)
{
List<Bundle> bundles = itemService.getBundles(item, "ORIGINAL");
for (Bundle bundle : bundles)
{
List<Bitstream> bitstreams = bundle.getBitstreams();
for (Bitstream bitstream : bitstreams)
{
if (descriptions.containsKey(bitstream.getName()))
{
bitstream.setDescription(context, descriptions.get(bitstream.getName()));
bitstreamService.update(context, bitstream);
}
}
}
}
return STATUS_COMPLETE;
}
// Going on with descriptions from the simple upload
String fileDescription = request.getParameter("description"); String fileDescription = request.getParameter("description");
if (fileDescription != null && fileDescription.length() > 0) if (fileDescription != null && fileDescription.length() > 0)

View File

@@ -15,103 +15,118 @@ import java.io.PrintWriter;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import org.apache.log4j.Logger; import org.dspace.core.Constants;
import org.dspace.services.ConfigurationService;
import org.dspace.core.ConfigurationManager;
import org.dspace.services.model.Event; import org.dspace.services.model.Event;
import org.dspace.utils.DSpace;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Serialize AbstractUsageEvent data to a file as Tab deliminated. Requires * Serialize {@link UsageEvent} data to a file as Tab delimited. In dspace.cfg
* configuration: in dspace.cfg specify the path to the file as the value of * specify the path to the file as the value of
* {@code usageEvent.tabFileLogger.file}. * {@code usageEvent.tabFileLogger.file}. If that path is not absolute, it
* will be interpreted as relative to the directory named in {@code log.dir}.
* If no name is configured, it defaults to "usage-events.tsv". If the file is
* new or empty, a column heading record will be written when the file is opened.
* *
* @author Mark H. Wood * @author Mark H. Wood
* @author Mark Diggory * @author Mark Diggory
* @version $Revision: 3734 $
*/ */
public class TabFileUsageEventListener extends AbstractUsageEventListener public class TabFileUsageEventListener
extends AbstractUsageEventListener
{ {
/** log category. */
/** log4j category */ private static final Logger errorLog = LoggerFactory
private static Logger errorLog = Logger
.getLogger(TabFileUsageEventListener.class); .getLogger(TabFileUsageEventListener.class);
/** File on which to write event records */ /** ISO 8601 Basic string format for record timestamps. */
static PrintWriter log = null; private static final SimpleDateFormat dateFormat = new SimpleDateFormat(
"yyyyMMdd'T'HHmmssSSS");
public TabFileUsageEventListener() /** File on which to write event records. */
private PrintWriter eventLog;
/** Is this instance initialized? */
private boolean initialized = false;
/**
* Set up a usage event listener for writing TSV records to a file.
*/
private void init()
{ {
ConfigurationService configurationService
= new DSpace().getConfigurationService();
if (null == log) String logPath = configurationService.getPropertyAsType(
"usageEvent.tabFileLogger.file",
"usage-events.tsv");
String logDir = null;
if (!new File(logPath).isAbsolute())
{ {
boolean appending; logDir = configurationService.getProperty("log.dir");
String logPath = ConfigurationManager
.getProperty("usageEvent.tabFileLogger.file");
if (null == logPath)
{
errorLog
.error("UsageEventTabFileLogger unconfigured, will not log events");
return;
}
String logDir = null;
if (!new File(logPath).isAbsolute())
{
logDir = ConfigurationManager.getProperty("log.dir");
}
File logFile = new File(logDir, logPath);
appending = logFile.length() > 0;
try
{
log = new PrintWriter(new OutputStreamWriter(
new FileOutputStream(logFile, true)));
}
catch (FileNotFoundException e)
{
errorLog
.error(
"UsageEventTabFileLogger cannot open file, will not log events",
e);
return;
}
if (!appending)
{
log.println("date event objectType objectId sessionId sourceAddress eperson");
}
} }
File logFile = new File(logDir, logPath);
try
{
eventLog = new PrintWriter(new OutputStreamWriter(
new FileOutputStream(logFile, true)));
errorLog.debug("Writing to {}", logFile.getAbsolutePath());
}
catch (FileNotFoundException e)
{
errorLog.error("{} cannot open file, will not log events: {}",
TabFileUsageEventListener.class.getName(),
e.getMessage());
throw new IllegalArgumentException("Cannot open event log file", e);
}
if (logFile.length() <= 0)
{
eventLog.println("date"
+ '\t' + "event"
+ '\t' + "objectType"
+ '\t' + "objectId"
+ '\t' + "sessionId"
+ '\t' + "sourceAddress"
+ '\t' + "eperson");
}
initialized = true;
} }
@Override @Override
public void receiveEvent(Event event) { public synchronized void receiveEvent(Event event)
System.out.println("got: " + event.toString()); {
if(event instanceof UsageEvent) if (!initialized)
{ init();
UsageEvent ue = (UsageEvent)event;
if (null == log) if (errorLog.isDebugEnabled())
{ errorLog.debug("got: {}", event.toString());
return;
} if(!(event instanceof UsageEvent))
return;
SimpleDateFormat dateFormat = new SimpleDateFormat(
"yyyyMMdd'T'HHmmssSSS"); if (null == eventLog)
return;
String string = dateFormat.format(new Date());
string += "\t" + ue.getName(); // event type UsageEvent ue = (UsageEvent)event;
string += "\t" + ue.getObject().getType();
string += "\t" + ue.getObject().getID(); eventLog.append(dateFormat.format(new Date()))
string += "\t" + ue.getRequest().getSession().getId(); .append('\t').append(ue.getName()) // event type
string += "\t" + ue.getRequest().getRequestURI(); .append('\t').append(Constants.typeText[ue.getObject().getType()])
.append('\t').append(ue.getObject().getID().toString())
String epersonName = (null == ue.getContext().getCurrentUser() ? "anonymous" : ue.getContext().getCurrentUser().getEmail()); .append('\t').append(ue.getRequest().getSession().getId())
string += "\t" + epersonName; .append('\t').append(ue.getRequest().getRemoteAddr());
log.println(string); String epersonName = (null == ue.getContext().getCurrentUser()
log.flush(); ? "anonymous"
} : ue.getContext().getCurrentUser().getEmail());
eventLog.append('\t').append(epersonName);
eventLog.println();
eventLog.flush();
} }
} }

View File

@@ -50,20 +50,20 @@ public class UsageEvent extends Event {
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private transient HttpServletRequest request; private HttpServletRequest request;
private transient String ip; private String ip;
private transient String userAgent; private String userAgent;
private transient String xforwardedfor; private String xforwardedfor;
private transient Context context; private Context context;
private transient DSpaceObject object; private DSpaceObject object;
private Action action; private Action action;
private static String checkParams(Action action, HttpServletRequest request, Context context, DSpaceObject object) private static String checkParams(Action action, HttpServletRequest request, Context context, DSpaceObject object)
{ {
StringBuilder eventName = new StringBuilder(); StringBuilder eventName = new StringBuilder();

View File

@@ -0,0 +1,33 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
/**
* Capture of "usage events". A {@link org.dspace.usage.UsageEvent} represents
* something like a download or viewing of a Bitstream -- that is, the
* <em>use</em> of content as opposed to its ingestion or alteration. Usage
* events are meant to be useful for statistical analysis of content usage.
*
* <p>
* Multiple {@link org.dspace.usage.AbstractUsageEventListener} implementations
* may be configured for processing these events. When an event is "fired",
* it is passed to each configured listener. Several stock listeners are provided,
* in this package and others, for doing common tasks.
* </p>
*
* <p>
* To add a usage event listener to the bus, configure it as a new {@code <bean>}
* in a web application's {@code applicationContext.xml} and inject the
* {@code EventService}, as with the stock listeners.
* </p>
*
* @see org.dspace.statistics.ElasticSearchLoggerEventListener
* @see org.dspace.google.GoogleRecorderEventListener
* @see org.dspace.statistics.SolrLoggerUsageEventListener
*/
package org.dspace.usage;

View File

@@ -116,7 +116,7 @@ public class MultiFormatDateParser
public static void main(String[] args) public static void main(String[] args)
throws IOException throws IOException
{ {
DSpaceKernel kernel = DSpaceKernelInit.getKernel(null); // Mainly to initialize Spring DSpaceKernelInit.getKernel(null); // Mainly to initialize Spring
// TODO direct log to stdout/stderr somehow // TODO direct log to stdout/stderr somehow
if (args.length > 0) // Test data supplied on the command line if (args.length > 0) // Test data supplied on the command line

View File

@@ -8,7 +8,6 @@
package org.dspace.versioning; package org.dspace.versioning;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.content.Item; import org.dspace.content.Item;
import org.dspace.content.WorkspaceItem; import org.dspace.content.WorkspaceItem;
import org.dspace.content.service.WorkspaceItemService; import org.dspace.content.service.WorkspaceItemService;
@@ -39,8 +38,6 @@ public class DefaultItemVersionProvider extends AbstractVersionProvider implemen
protected VersionHistoryService versionHistoryService; protected VersionHistoryService versionHistoryService;
@Autowired(required = true) @Autowired(required = true)
protected IdentifierService identifierService; protected IdentifierService identifierService;
@Autowired(required = true)
protected AuthorizeService authorizeService;
@Override @Override
public Item createNewItemAndAddItInWorkspace(Context context, Item nativeItem) { public Item createNewItemAndAddItInWorkspace(Context context, Item nativeItem) {

View File

@@ -419,6 +419,11 @@ public class BasicWorkflowServiceImpl implements BasicWorkflowService
//Gather our old data for launching the workflow event //Gather our old data for launching the workflow event
int oldState = workflowItem.getState(); int oldState = workflowItem.getState();
// in case we don't want to inform reviewers about tasks returned to
// the pool by other reviewers, we'll ne to know whether they were owned
// before. => keep this information before setting the new owner.
EPerson oldOwner = workflowItem.getOwner();
workflowItem.setState(newstate); workflowItem.setState(newstate);
@@ -443,8 +448,13 @@ public class BasicWorkflowServiceImpl implements BasicWorkflowService
createTasks(context, workflowItem, epa); createTasks(context, workflowItem, epa);
workflowItemService.update(context, workflowItem); workflowItemService.update(context, workflowItem);
// email notification if (ConfigurationManager.getBooleanProperty("workflow", "notify.returned.tasks", true)
notifyGroupOfTask(context, workflowItem, mygroup, epa); || oldState != WFSTATE_STEP1
|| oldOwner == null)
{
// email notification
notifyGroupOfTask(context, workflowItem, mygroup, epa);
}
} }
else else
{ {
@@ -484,8 +494,13 @@ public class BasicWorkflowServiceImpl implements BasicWorkflowService
// timestamp, and add them to the list // timestamp, and add them to the list
createTasks(context, workflowItem, epa); createTasks(context, workflowItem, epa);
// email notification if (ConfigurationManager.getBooleanProperty("workflow", "notify.returned.tasks", true)
notifyGroupOfTask(context, workflowItem, mygroup, epa); || oldState != WFSTATE_STEP2
|| oldOwner == null)
{
// email notification
notifyGroupOfTask(context, workflowItem, mygroup, epa);
}
} }
else else
{ {
@@ -521,8 +536,13 @@ public class BasicWorkflowServiceImpl implements BasicWorkflowService
// timestamp, and add them to the list // timestamp, and add them to the list
createTasks(context, workflowItem, epa); createTasks(context, workflowItem, epa);
// email notification if (ConfigurationManager.getBooleanProperty("workflow", "notify.returned.tasks", true)
notifyGroupOfTask(context, workflowItem, mygroup, epa); || oldState != WFSTATE_STEP3
|| oldOwner == null)
{
// email notification
notifyGroupOfTask(context, workflowItem, mygroup, epa);
}
} }
else else
{ {

View File

@@ -361,7 +361,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
e.printStackTrace(); e.printStackTrace();
} }
finally { finally {
if((nextStep != null && nextActionConfig != null) || wfi.getItem().isArchived()){ if((nextStep != null && currentStep != null && nextActionConfig != null) || (wfi.getItem().isArchived() && currentStep != null)){
logWorkflowEvent(c, currentStep.getWorkflow().getID(), currentStep.getId(), currentActionConfig.getId(), wfi, user, nextStep, nextActionConfig); logWorkflowEvent(c, currentStep.getWorkflow().getID(), currentStep.getId(), currentActionConfig.getId(), wfi, user, nextStep, nextActionConfig);
} }
} }

View File

@@ -89,12 +89,17 @@ public class AssignOriginalSubmitterAction extends UserSelectionAction{
@Override @Override
public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request) throws SQLException, AuthorizeException, IOException, WorkflowException { public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request) throws SQLException, AuthorizeException, IOException, WorkflowException {
EPerson submitter = wfi.getSubmitter(); EPerson submitter = wfi.getSubmitter();
Step currentStep = getParent().getStep();
WorkflowActionConfig nextAction = getParent().getStep().getNextAction(this.getParent()); WorkflowActionConfig nextAction = getParent().getStep().getNextAction(this.getParent());
//Retrieve the action which has a user interface //Retrieve the action which has a user interface
while(nextAction != null && !nextAction.requiresUI()){ while(nextAction != null && !nextAction.requiresUI()){
nextAction = nextAction.getStep().getNextAction(nextAction); nextAction = nextAction.getStep().getNextAction(nextAction);
} }
if(nextAction == null)
{
//Should never occur, but just in case
log.error("Could not find next action for step with id: " + step.getId() + " to assign a submitter to. Aborting the action.");
throw new IllegalStateException();
}
createTaskForEPerson(c, wfi, step, nextAction, submitter); createTaskForEPerson(c, wfi, step, nextAction, submitter);

View File

@@ -0,0 +1,64 @@
--
-- The contents of this file are subject to the license and copyright
-- detailed in the LICENSE and NOTICE files at the root of the source
-- tree and available online at
--
-- http://www.dspace.org/license/
--
-- ===============================================================
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
--
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
-- http://flywaydb.org/
-- ===============================================================
-- Special case of migration, we need to the EPerson schema in order to get our metadata for all queries to work
-- but we cannot a DB connection until our database is up to date, so we need to create our registries manually in sql
INSERT INTO metadataschemaregistry (metadata_schema_id, namespace, short_id) SELECT metadataschemaregistry_seq.nextval, 'http://dspace.org/eperson' as namespace, 'eperson' as short_id FROM dual
WHERE NOT EXISTS (SELECT metadata_schema_id,namespace,short_id FROM metadataschemaregistry WHERE namespace = 'http://dspace.org/eperson' AND short_id = 'eperson');
-- Insert eperson.firstname
INSERT INTO metadatafieldregistry (metadata_field_id, metadata_schema_id, element)
SELECT metadatafieldregistry_seq.nextval,
(SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'), 'firstname' FROM dual
WHERE NOT EXISTS
(SELECT metadata_field_id,element FROM metadatafieldregistry WHERE element = 'firstname' AND qualifier IS NULL AND metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'));
-- Insert eperson.lastname
INSERT INTO metadatafieldregistry (metadata_field_id, metadata_schema_id, element)
SELECT metadatafieldregistry_seq.nextval,
(SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'), 'lastname' FROM dual
WHERE NOT EXISTS
(SELECT metadata_field_id,element FROM metadatafieldregistry WHERE element = 'lastname' AND qualifier IS NULL AND metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'));
-- Insert eperson.phone
INSERT INTO metadatafieldregistry (metadata_field_id, metadata_schema_id, element)
SELECT metadatafieldregistry_seq.nextval,
(SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'), 'phone' FROM dual
WHERE NOT EXISTS
(SELECT metadata_field_id,element FROM metadatafieldregistry WHERE element = 'phone' AND qualifier IS NULL AND metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'));
-- Insert eperson.language
INSERT INTO metadatafieldregistry (metadata_field_id, metadata_schema_id, element)
SELECT metadatafieldregistry_seq.nextval,
(SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'), 'language' FROM dual
WHERE NOT EXISTS
(SELECT metadata_field_id,element FROM metadatafieldregistry WHERE element = 'language' AND qualifier IS NULL AND metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'));
-- Insert into dc.provenance
INSERT INTO metadatafieldregistry (metadata_field_id, metadata_schema_id, element)
SELECT metadatafieldregistry_seq.nextval,
(SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='dc'), 'provenance' FROM dual
WHERE NOT EXISTS
(SELECT metadata_field_id,element FROM metadatafieldregistry WHERE element = 'provenance' AND qualifier IS NULL AND metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='dc'));
-- Insert into dc.rights.license
INSERT INTO metadatafieldregistry (metadata_field_id, metadata_schema_id, element, qualifier)
SELECT metadatafieldregistry_seq.nextval,
(SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='dc'), 'rights', 'license' FROM dual
WHERE NOT EXISTS
(SELECT metadata_field_id,element,qualifier FROM metadatafieldregistry WHERE element = 'rights' AND qualifier='license' AND metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='dc'));

View File

@@ -0,0 +1,52 @@
--
-- The contents of this file are subject to the license and copyright
-- detailed in the LICENSE and NOTICE files at the root of the source
-- tree and available online at
--
-- http://www.dspace.org/license/
--
-- ===============================================================
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
--
-- DO NOT MANUALLY RUN THIS DATABASE MIGRATION. IT WILL BE EXECUTED
-- AUTOMATICALLY (IF NEEDED) BY "FLYWAY" WHEN YOU STARTUP DSPACE.
-- http://flywaydb.org/
-- ===============================================================
-- Special case of migration, we need to the EPerson schema in order to get our metadata for all queries to work
-- but we cannot a DB connection until our database is up to date, so we need to create our registries manually in sql
INSERT INTO metadataschemaregistry (namespace, short_id) SELECT 'http://dspace.org/eperson', 'eperson'
WHERE NOT EXISTS (SELECT metadata_schema_id,namespace,short_id FROM metadataschemaregistry WHERE namespace = 'http://dspace.org/eperson' AND short_id = 'eperson');
-- Insert eperson.firstname
INSERT INTO metadatafieldregistry (metadata_schema_id, element)
SELECT (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'), 'firstname'
WHERE NOT EXISTS (SELECT metadata_field_id,element FROM metadatafieldregistry WHERE element = 'firstname' AND qualifier IS NULL AND metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'));
-- Insert eperson.lastname
INSERT INTO metadatafieldregistry (metadata_schema_id, element)
SELECT (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'), 'lastname'
WHERE NOT EXISTS (SELECT metadata_field_id,element FROM metadatafieldregistry WHERE element = 'lastname' AND qualifier IS NULL AND metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'));
-- Insert eperson.phone
INSERT INTO metadatafieldregistry (metadata_schema_id, element)
SELECT (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'), 'phone'
WHERE NOT EXISTS (SELECT metadata_field_id,element FROM metadatafieldregistry WHERE element = 'phone' AND qualifier IS NULL AND metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'));
-- Insert eperson.language
INSERT INTO metadatafieldregistry (metadata_schema_id, element)
SELECT (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'), 'language'
WHERE NOT EXISTS (SELECT metadata_field_id,element FROM metadatafieldregistry WHERE element = 'language' AND qualifier IS NULL AND metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='eperson'));
-- Insert into dc.provenance
INSERT INTO metadatafieldregistry (metadata_schema_id, element)
SELECT (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='dc'), 'provenance'
WHERE NOT EXISTS (SELECT metadata_field_id,element FROM metadatafieldregistry WHERE element = 'provenance' AND qualifier IS NULL AND metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='dc'));
-- Insert into dc.rights.license
INSERT INTO metadatafieldregistry (metadata_schema_id, element, qualifier)
SELECT (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='dc'), 'rights', 'license'
WHERE NOT EXISTS (SELECT metadata_field_id,element,qualifier FROM metadatafieldregistry WHERE element = 'rights' AND qualifier='license' AND metadata_schema_id = (SELECT metadata_schema_id FROM metadataschemaregistry WHERE short_id='dc'));

View File

@@ -91,26 +91,24 @@ public class VersioningItemHome implements ItemHomeProcessor {
throw new PluginException(e.getMessage()); throw new PluginException(e.getMessage());
} }
if (latestVersion != null) { if (latestVersion != null && latestVersion.getItem() != null
if (latestVersion != null && latestVersion.getItem() != null && !latestVersion.getItem().getID().equals(item.getID())) {
&& !latestVersion.getItem().getID().equals(item.getID())) { // We have a newer version
// We have a newer version Item latestVersionItem = latestVersion.getItem();
Item latestVersionItem = latestVersion.getItem(); if (latestVersionItem.isArchived()) {
if (latestVersionItem.isArchived()) { // Available, add a link for the user alerting him that
// Available, add a link for the user alerting him that // a new version is available
// a new version is available newVersionAvailable = true;
newVersionAvailable = true; try {
try { latestVersionURL = handleService.resolveToURL(
latestVersionURL = handleService.resolveToURL( context, latestVersionItem.getHandle());
context, latestVersionItem.getHandle()); } catch (SQLException e) {
} catch (SQLException e) { throw new PluginException(e.getMessage());
throw new PluginException(e.getMessage());
}
latestVersionHandle = latestVersionItem.getHandle();
} else {
// We might be dealing with a workflow/workspace item
showVersionWorkflowAvailable = true;
} }
latestVersionHandle = latestVersionItem.getHandle();
} else {
// We might be dealing with a workflow/workspace item
showVersionWorkflowAvailable = true;
} }
} }
} }

View File

@@ -42,7 +42,7 @@ import org.dspace.eperson.service.GroupService;
public class AccessSettingTag extends TagSupport public class AccessSettingTag extends TagSupport
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(AccessSettingTag.class); private static final Logger log = Logger.getLogger(AccessSettingTag.class);
/** is advanced form enabled? */ /** is advanced form enabled? */
private static final boolean advanced = ConfigurationManager.getBooleanProperty("webui.submission.restrictstep.enableAdvancedForm", false); private static final boolean advanced = ConfigurationManager.getBooleanProperty("webui.submission.restrictstep.enableAdvancedForm", false);
@@ -50,7 +50,7 @@ public class AccessSettingTag extends TagSupport
/** Name of the restricted group */ /** Name of the restricted group */
private static final String restrictedGroup = ConfigurationManager.getProperty("webui.submission.restrictstep.groups"); private static final String restrictedGroup = ConfigurationManager.getProperty("webui.submission.restrictstep.groups");
/** the SubmittionInfo */ /** the SubmissionInfo */
private transient SubmissionInfo subInfo = null; private transient SubmissionInfo subInfo = null;
/** the target DSpaceObject */ /** the target DSpaceObject */
@@ -68,18 +68,21 @@ public class AccessSettingTag extends TagSupport
/** add the policy button */ /** add the policy button */
private boolean addpolicy = false; private boolean addpolicy = false;
private AuthorizeService authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService(); private final transient AuthorizeService authorizeService
= AuthorizeServiceFactory.getInstance().getAuthorizeService();
private GroupService groupService = EPersonServiceFactory.getInstance().getGroupService(); private final transient GroupService groupService
= EPersonServiceFactory.getInstance().getGroupService();
public AccessSettingTag() public AccessSettingTag()
{ {
super(); super();
} }
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
String legend = LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.access-setting.legend"); // String legend = LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.access-setting.legend");
String label_name = LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.access-setting.label_name"); String label_name = LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.access-setting.label_name");
String label_group = LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.access-setting.label_group"); String label_group = LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.access-setting.label_group");
String label_embargo = LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.access-setting.label_embargo"); String label_embargo = LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.access-setting.label_embargo");
@@ -109,7 +112,7 @@ public class AccessSettingTag extends TagSupport
} }
else if (rp != null) else if (rp != null)
{ {
policies = new ArrayList<ResourcePolicy>(); policies = new ArrayList<>();
policies.add(rp); policies.add(rp);
} }
@@ -186,7 +189,7 @@ public class AccessSettingTag extends TagSupport
// Embargo Date // Embargo Date
if (hidden) if (hidden)
{ {
sb.append("<input name=\"embargo_until_date\" id=\"embargo_until_date_hidden\" type=\"hidden\" value=\"").append(startDate).append("\" />\n");; sb.append("<input name=\"embargo_until_date\" id=\"embargo_until_date_hidden\" type=\"hidden\" value=\"").append(startDate).append("\" />\n");
sb.append("<input name=\"reason\" id=\"reason_hidden\" type=\"hidden\" value=\"").append(reason).append("\" />\n"); sb.append("<input name=\"reason\" id=\"reason_hidden\" type=\"hidden\" value=\"").append(reason).append("\" />\n");
} }
else else
@@ -365,6 +368,7 @@ public class AccessSettingTag extends TagSupport
return addpolicy; return addpolicy;
} }
@Override
public void release() public void release()
{ {
dso = null; dso = null;

View File

@@ -57,10 +57,10 @@ import org.dspace.sort.SortOption;
public class BrowseListTag extends TagSupport public class BrowseListTag extends TagSupport
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(BrowseListTag.class); private static final Logger log = Logger.getLogger(BrowseListTag.class);
/** Items to display */ /** Items to display */
private transient List<Item> items; private List<Item> items;
/** Row to highlight, -1 for no row */ /** Row to highlight, -1 for no row */
private int highlightRow = -1; private int highlightRow = -1;
@@ -105,11 +105,14 @@ public class BrowseListTag extends TagSupport
private static final long serialVersionUID = 8091584920304256107L; private static final long serialVersionUID = 8091584920304256107L;
private ItemService itemService = ContentServiceFactory.getInstance().getItemService(); transient private final ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
private MetadataAuthorityService metadataAuthorityService = ContentAuthorityServiceFactory.getInstance().getMetadataAuthorityService();
private BitstreamService bitstreamService = ContentServiceFactory.getInstance().getBitstreamService(); transient private final MetadataAuthorityService metadataAuthorityService
= ContentAuthorityServiceFactory.getInstance().getMetadataAuthorityService();
transient private final BitstreamService bitstreamService
= ContentServiceFactory.getInstance().getBitstreamService();
static static
{ {
@@ -152,6 +155,7 @@ public class BrowseListTag extends TagSupport
super(); super();
} }
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
JspWriter out = pageContext.getOut(); JspWriter out = pageContext.getOut();
@@ -477,7 +481,7 @@ public class BrowseListTag extends TagSupport
// save on a null check which would make the code untidy // save on a null check which would make the code untidy
if (metadataArray == null) if (metadataArray == null)
{ {
metadataArray = new ArrayList<MetadataValue>(); metadataArray = new ArrayList<>();
} }
// now prepare the content of the table division // now prepare the content of the table division
@@ -758,6 +762,7 @@ public class BrowseListTag extends TagSupport
emphColumn = emphColumnIn; emphColumn = emphColumnIn;
} }
@Override
public void release() public void release()
{ {
highlightRow = -1; highlightRow = -1;
@@ -885,12 +890,12 @@ public class BrowseListTag extends TagSupport
Bitstream original = thumbnail.getOriginal(); Bitstream original = thumbnail.getOriginal();
String link = hrq.getContextPath() + "/bitstream/" + item.getHandle() + "/" + original.getSequenceID() + "/" + String link = hrq.getContextPath() + "/bitstream/" + item.getHandle() + "/" + original.getSequenceID() + "/" +
UIUtil.encodeBitstreamName(original.getName(), Constants.DEFAULT_ENCODING); UIUtil.encodeBitstreamName(original.getName(), Constants.DEFAULT_ENCODING);
thumbFrag.append("<a target=\"_blank\" href=\"" + link + "\" />"); thumbFrag.append("<a target=\"_blank\" href=\"").append(link).append("\" />");
} }
else else
{ {
String link = hrq.getContextPath() + "/handle/" + item.getHandle(); String link = hrq.getContextPath() + "/handle/" + item.getHandle();
thumbFrag.append("<a href=\"" + link + "\" />"); thumbFrag.append("<a href=\"").append(link).append("\" />");
} }
Bitstream thumb = thumbnail.getThumb(); Bitstream thumb = thumbnail.getThumb();

View File

@@ -27,7 +27,7 @@ import org.dspace.content.Collection;
public class CollectionListTag extends TagSupport public class CollectionListTag extends TagSupport
{ {
/** Collections to display */ /** Collections to display */
private transient List<Collection> collections; private List<Collection> collections;
private static final long serialVersionUID = -9040013543196580904L; private static final long serialVersionUID = -9040013543196580904L;
@@ -36,6 +36,7 @@ public class CollectionListTag extends TagSupport
super(); super();
} }
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
JspWriter out = pageContext.getOut(); JspWriter out = pageContext.getOut();
@@ -106,6 +107,7 @@ public class CollectionListTag extends TagSupport
collections = collectionsIn; collections = collectionsIn;
} }
@Override
public void release() public void release()
{ {
collections = null; collections = null;

View File

@@ -27,7 +27,7 @@ import org.dspace.content.Community;
public class CommunityListTag extends TagSupport public class CommunityListTag extends TagSupport
{ {
/** Communities to display */ /** Communities to display */
private transient List<Community> communities; private List<Community> communities;
private static final long serialVersionUID = 5788338729470292501L; private static final long serialVersionUID = 5788338729470292501L;
@@ -36,6 +36,7 @@ public class CommunityListTag extends TagSupport
super(); super();
} }
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
JspWriter out = pageContext.getOut(); JspWriter out = pageContext.getOut();
@@ -106,6 +107,7 @@ public class CommunityListTag extends TagSupport
communities = communitiesIn; communities = communitiesIn;
} }
@Override
public void release() public void release()
{ {
communities = null; communities = null;

View File

@@ -32,10 +32,11 @@ import org.w3c.dom.Document;
public class ControlledVocabularyTag extends TagSupport public class ControlledVocabularyTag extends TagSupport
{ {
// path to the jsp that outputs the results of this tag // path to the jsp that outputs the results of this tag
private static final String CONTROLLEDVOCABULARY_JSPTAG = "/controlledvocabulary/controlledvocabularyTag.jsp"; private static final String CONTROLLEDVOCABULARY_JSPTAG
= "/controlledvocabulary/controlledvocabularyTag.jsp";
// the log // the log
private static Logger log = Logger.getLogger(ControlledVocabularyTag.class); private static final Logger log = Logger.getLogger(ControlledVocabularyTag.class);
// a tag attribute that contains the words used to trim the vocabulary tree // a tag attribute that contains the words used to trim the vocabulary tree
private String filter; private String filter;
@@ -46,12 +47,10 @@ public class ControlledVocabularyTag extends TagSupport
// a tag attribute that specifies the vocabulary to be displayed // a tag attribute that specifies the vocabulary to be displayed
private String vocabulary; private String vocabulary;
// an hashtable containing all the loaded vocabularies
public Map<String, Document> controlledVocabularies;
/** /**
* Process tag * Process tag
*/ */
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
HttpServletRequest request = (HttpServletRequest) pageContext HttpServletRequest request = (HttpServletRequest) pageContext
@@ -69,7 +68,9 @@ public class ControlledVocabularyTag extends TagSupport
+ "vocabulary2html.xsl"; + "vocabulary2html.xsl";
// Load vocabularies on startup // Load vocabularies on startup
controlledVocabularies = (Map<String, Document>) pageContext.getServletContext().getAttribute("controlledvocabulary.controlledVocabularies"); Map<String, Document> controlledVocabularies
= (Map<String, Document>) pageContext.getServletContext()
.getAttribute("controlledvocabulary.controlledVocabularies");
if (controlledVocabularies == null) if (controlledVocabularies == null)
{ {
controlledVocabularies = loadControlledVocabularies(vocabulariesPath); controlledVocabularies = loadControlledVocabularies(vocabulariesPath);
@@ -112,6 +113,7 @@ public class ControlledVocabularyTag extends TagSupport
/** /**
* End processing tag * End processing tag
*/ */
@Override
public int doEndTag() public int doEndTag()
{ {
return EVAL_PAGE; return EVAL_PAGE;
@@ -168,7 +170,7 @@ public class ControlledVocabularyTag extends TagSupport
*/ */
private Map<String, Document> filterVocabularies(Map<String, Document> vocabularies, String vocabularyPrunningXSLT) private Map<String, Document> filterVocabularies(Map<String, Document> vocabularies, String vocabularyPrunningXSLT)
{ {
Map<String, Document> prunnedVocabularies = new HashMap<String, Document>(); Map<String, Document> prunnedVocabularies = new HashMap<>();
for (Map.Entry<String, Document> entry : vocabularies.entrySet()) for (Map.Entry<String, Document> entry : vocabularies.entrySet())
{ {
prunnedVocabularies.put(entry.getKey(), filterVocabulary(entry.getValue(), vocabularyPrunningXSLT, getFilter())); prunnedVocabularies.put(entry.getKey(), filterVocabulary(entry.getValue(), vocabularyPrunningXSLT, getFilter()));
@@ -203,7 +205,7 @@ public class ControlledVocabularyTag extends TagSupport
try try
{ {
Map<String, String> parameters = new HashMap<String, String>(); Map<String, String> parameters = new HashMap<>();
parameters.put("allowMultipleSelection", allowMultipleSelection ? "yes" : "no"); parameters.put("allowMultipleSelection", allowMultipleSelection ? "yes" : "no");
parameters.put("contextPath", contextPath); parameters.put("contextPath", contextPath);
result = XMLUtil.transformDocumentAsString(vocabulary, parameters, controlledVocabulary2HtmlXSLT); result = XMLUtil.transformDocumentAsString(vocabulary, parameters, controlledVocabulary2HtmlXSLT);
@@ -236,7 +238,7 @@ public class ControlledVocabularyTag extends TagSupport
try try
{ {
Map<String, String> parameters = new HashMap<String, String>(); Map<String, String> parameters = new HashMap<>();
parameters.put("filter", filter); parameters.put("filter", filter);
return XMLUtil.transformDocument(vocabulary, parameters, vocabularyPrunningXSLT); return XMLUtil.transformDocument(vocabulary, parameters, vocabularyPrunningXSLT);
} }
@@ -259,11 +261,12 @@ public class ControlledVocabularyTag extends TagSupport
*/ */
private static Map<String, Document> loadControlledVocabularies(String directory) private static Map<String, Document> loadControlledVocabularies(String directory)
{ {
Map<String, Document> controlledVocabularies = new HashMap<String, Document>(); Map<String, Document> controlledVocabularies = new HashMap<>();
File dir = new File(directory); File dir = new File(directory);
FilenameFilter filter = new FilenameFilter() FilenameFilter filter = new FilenameFilter()
{ {
@Override
public boolean accept(File dir, String name) public boolean accept(File dir, String name)
{ {
return name.endsWith(".xml"); return name.endsWith(".xml");

View File

@@ -55,10 +55,10 @@ import org.dspace.sort.SortOption;
*/ */
public class ItemListTag extends TagSupport public class ItemListTag extends TagSupport
{ {
private static Logger log = Logger.getLogger(ItemListTag.class); private static final Logger log = Logger.getLogger(ItemListTag.class);
/** Items to display */ /** Items to display */
private transient List<Item> items; private List<Item> items;
/** Row to highlight, -1 for no row */ /** Row to highlight, -1 for no row */
private int highlightRow = -1; private int highlightRow = -1;
@@ -101,14 +101,17 @@ public class ItemListTag extends TagSupport
private transient SortOption sortOption = null; private transient SortOption sortOption = null;
private ItemService itemService = ContentServiceFactory.getInstance().getItemService(); private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
private static final long serialVersionUID = 348762897199116432L; private static final long serialVersionUID = 348762897199116432L;
private MetadataAuthorityService metadataAuthorityService = ContentAuthorityServiceFactory.getInstance().getMetadataAuthorityService(); private final transient MetadataAuthorityService metadataAuthorityService
= ContentAuthorityServiceFactory.getInstance().getMetadataAuthorityService();
private final transient BitstreamService bitstreamService
= ContentServiceFactory.getInstance().getBitstreamService();
private BitstreamService bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
static static
{ {
getThumbSettings(); getThumbSettings();
@@ -149,6 +152,7 @@ public class ItemListTag extends TagSupport
super(); super();
} }
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
JspWriter out = pageContext.getOut(); JspWriter out = pageContext.getOut();
@@ -430,7 +434,7 @@ public class ItemListTag extends TagSupport
// save on a null check which would make the code untidy // save on a null check which would make the code untidy
if (metadataArray == null) if (metadataArray == null)
{ {
metadataArray = new ArrayList<MetadataValue>(); metadataArray = new ArrayList<>();
} }
// now prepare the content of the table division // now prepare the content of the table division
@@ -726,6 +730,7 @@ public class ItemListTag extends TagSupport
emphColumn = emphColumnIn; emphColumn = emphColumnIn;
} }
@Override
public void release() public void release()
{ {
highlightRow = -1; highlightRow = -1;

View File

@@ -37,17 +37,19 @@ import org.dspace.core.Constants;
public class ItemPreviewTag extends TagSupport public class ItemPreviewTag extends TagSupport
{ {
/** Item to display */ /** Item to display */
private transient Item item; private Item item;
private static final long serialVersionUID = -5535762797556685631L; private static final long serialVersionUID = -5535762797556685631L;
private ItemService itemService = ContentServiceFactory.getInstance().getItemService(); private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
public ItemPreviewTag() public ItemPreviewTag()
{ {
super(); super();
} }
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
if (!ConfigurationManager.getBooleanProperty("webui.preview.enabled")) if (!ConfigurationManager.getBooleanProperty("webui.preview.enabled"))
@@ -124,6 +126,7 @@ public class ItemPreviewTag extends TagSupport
} }
} }
@Override
public void release() public void release()
{ {
item = null; item = null;

View File

@@ -26,7 +26,6 @@ import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.jstl.fmt.LocaleSupport; import javax.servlet.jsp.jstl.fmt.LocaleSupport;
import javax.servlet.jsp.tagext.TagSupport; import javax.servlet.jsp.tagext.TagSupport;
import org.apache.commons.lang.ArrayUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.dspace.app.util.DCInputsReaderException; import org.dspace.app.util.DCInputsReaderException;
import org.dspace.app.util.Util; import org.dspace.app.util.Util;
@@ -194,10 +193,10 @@ public class ItemTag extends TagSupport
private static final String DOI_DEFAULT_BASEURL = "http://dx.doi.org/"; private static final String DOI_DEFAULT_BASEURL = "http://dx.doi.org/";
/** Item to display */ /** Item to display */
private transient Item item; private Item item;
/** Collections this item appears in */ /** Collections this item appears in */
private transient List<Collection> collections; private List<Collection> collections;
/** The style to use - "default" or "full" */ /** The style to use - "default" or "full" */
private String style; private String style;
@@ -206,38 +205,45 @@ public class ItemTag extends TagSupport
private boolean showThumbs; private boolean showThumbs;
/** Default DC fields to display, in absence of configuration */ /** Default DC fields to display, in absence of configuration */
private static String defaultFields = "dc.title, dc.title.alternative, dc.contributor.*, dc.subject, dc.date.issued(date), dc.publisher, dc.identifier.citation, dc.relation.ispartofseries, dc.description.abstract, dc.description, dc.identifier.govdoc, dc.identifier.uri(link), dc.identifier.isbn, dc.identifier.issn, dc.identifier.ismn, dc.identifier"; private static final String defaultFields
= "dc.title, dc.title.alternative, dc.contributor.*, dc.subject, dc.date.issued(date), dc.publisher, dc.identifier.citation, dc.relation.ispartofseries, dc.description.abstract, dc.description, dc.identifier.govdoc, dc.identifier.uri(link), dc.identifier.isbn, dc.identifier.issn, dc.identifier.ismn, dc.identifier";
/** log4j logger */ /** log4j logger */
private static Logger log = Logger.getLogger(ItemTag.class); private static final Logger log = Logger.getLogger(ItemTag.class);
private StyleSelection styleSelection = (StyleSelection) PluginManager.getSinglePlugin(StyleSelection.class); private final transient StyleSelection styleSelection
= (StyleSelection) PluginManager.getSinglePlugin(StyleSelection.class);
/** Hashmap of linked metadata to browse, from dspace.cfg */ /** Hashmap of linked metadata to browse, from dspace.cfg */
private static Map<String,String> linkedMetadata; private static final Map<String,String> linkedMetadata;
/** Hashmap of urn base url resolver, from dspace.cfg */ /** Hashmap of urn base url resolver, from dspace.cfg */
private static Map<String,String> urn2baseurl; private static final Map<String,String> urn2baseurl;
/** regex pattern to capture the style of a field, ie <code>schema.element.qualifier(style)</code> */ /** regex pattern to capture the style of a field, ie <code>schema.element.qualifier(style)</code> */
private Pattern fieldStylePatter = Pattern.compile(".*\\((.*)\\)"); private final Pattern fieldStylePatter = Pattern.compile(".*\\((.*)\\)");
private static final long serialVersionUID = -3841266490729417240L; private static final long serialVersionUID = -3841266490729417240L;
private MetadataExposureService metadataExposureService = UtilServiceFactory.getInstance().getMetadataExposureService(); private final transient MetadataExposureService metadataExposureService
= UtilServiceFactory.getInstance().getMetadataExposureService();
private ItemService itemService = ContentServiceFactory.getInstance().getItemService();
private final transient ItemService itemService
private MetadataAuthorityService metadataAuthorityService = ContentAuthorityServiceFactory.getInstance().getMetadataAuthorityService(); = ContentServiceFactory.getInstance().getItemService();
private BundleService bundleService = ContentServiceFactory.getInstance().getBundleService(); private final transient MetadataAuthorityService metadataAuthorityService
= ContentAuthorityServiceFactory.getInstance().getMetadataAuthorityService();
private AuthorizeService authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
private final transient BundleService bundleService
= ContentServiceFactory.getInstance().getBundleService();
private final transient AuthorizeService authorizeService
= AuthorizeServiceFactory.getInstance().getAuthorizeService();
static { static {
int i; int i;
linkedMetadata = new HashMap<String, String>(); linkedMetadata = new HashMap<>();
String linkMetadata; String linkMetadata;
i = 1; i = 1;
@@ -253,7 +259,7 @@ public class ItemTag extends TagSupport
i++; i++;
} while (linkMetadata != null); } while (linkMetadata != null);
urn2baseurl = new HashMap<String, String>(); urn2baseurl = new HashMap<>();
String urn; String urn;
i = 1; i = 1;
@@ -287,6 +293,7 @@ public class ItemTag extends TagSupport
getThumbSettings(); getThumbSettings();
} }
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
try try
@@ -385,6 +392,7 @@ public class ItemTag extends TagSupport
style = styleIn; style = styleIn;
} }
@Override
public void release() public void release()
{ {
style = "default"; style = "default";
@@ -517,7 +525,7 @@ public class ItemTag extends TagSupport
//If the values are in controlled vocabulary and the display value should be shown //If the values are in controlled vocabulary and the display value should be shown
if (isDisplay){ if (isDisplay){
List<String> displayValues = new ArrayList<String>(); List<String> displayValues = new ArrayList<>();
displayValues = Util.getControlledVocabulariesDisplayValueLocalized(item, values, schema, element, qualifier, sessionLocale); displayValues = Util.getControlledVocabulariesDisplayValueLocalized(item, values, schema, element, qualifier, sessionLocale);
@@ -585,7 +593,7 @@ public class ItemTag extends TagSupport
else else
{ {
String foundUrn = null; String foundUrn = null;
if (!style.equals("resolver")) if (!"resolver".equals(style))
{ {
foundUrn = style; foundUrn = style;
} }

View File

@@ -30,19 +30,21 @@ import org.dspace.authorize.service.ResourcePolicyService;
public class PoliciesListTag extends TagSupport public class PoliciesListTag extends TagSupport
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(PoliciesListTag.class); private static final Logger log = Logger.getLogger(PoliciesListTag.class);
/** Groups to make options list */ /** Groups to make options list */
private transient List<ResourcePolicy> policies = null; private transient List<ResourcePolicy> policies = null;
private transient boolean showButton = true; private boolean showButton = true;
private ResourcePolicyService policyService = AuthorizeServiceFactory.getInstance().getResourcePolicyService();
private final transient ResourcePolicyService policyService
= AuthorizeServiceFactory.getInstance().getResourcePolicyService();
public PoliciesListTag() public PoliciesListTag()
{ {
super(); super();
} }
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
String label_name = LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.policies-list.label_name"); String label_name = LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.policies-list.label_name");
@@ -137,6 +139,7 @@ public class PoliciesListTag extends TagSupport
} }
@Override
public void release() public void release()
{ {
policies = null; policies = null;

View File

@@ -30,21 +30,23 @@ public class SFXLinkTag extends TagSupport
{ {
/** Item to display SFX link for */ /** Item to display SFX link for */
private transient Item item; private Item item;
/** The fully qualified pathname of the SFX XML file */ /** The fully qualified pathname of the SFX XML file */
private String sfxFile = ConfigurationManager.getProperty("dspace.dir") + File.separator private final String sfxFile = ConfigurationManager.getProperty("dspace.dir") + File.separator
+ "config" + File.separator + "sfx.xml"; + "config" + File.separator + "sfx.xml";
private static final long serialVersionUID = 7028793612957710128L; private static final long serialVersionUID = 7028793612957710128L;
private SFXFileReaderService sfxFileReaderService = SfxServiceFactory.getInstance().getSfxFileReaderService(); private final transient SFXFileReaderService sfxFileReaderService
= SfxServiceFactory.getInstance().getSfxFileReaderService();
public SFXLinkTag() public SFXLinkTag()
{ {
super(); super();
} }
@Override
public int doStartTag() throws JspException public int doStartTag() throws JspException
{ {
try try

View File

@@ -84,7 +84,7 @@ public class SelectCollectionTag extends TagSupport
for (Collection coll : collections) for (Collection coll : collections)
{ {
sb.append("<option value=\"").append(coll.getID()).append("\""); sb.append("<option value=\"").append(coll.getID()).append("\"");
if (collection == coll.getID().toString()) if (collection.equals(coll.getID().toString()))
{ {
sb.append(" selected=\"selected\""); sb.append(" selected=\"selected\"");
} }

View File

@@ -47,7 +47,7 @@ public class SelectEPersonTag extends TagSupport
private boolean multiple; private boolean multiple;
/** Which eperson/epeople are initially in the list? */ /** Which eperson/epeople are initially in the list? */
private transient EPerson[] epeople; private EPerson[] epeople;
private static final long serialVersionUID = -7323789442034590853L; private static final long serialVersionUID = -7323789442034590853L;

View File

@@ -42,7 +42,7 @@ public class SelectGroupTag extends TagSupport
private boolean multiple; private boolean multiple;
/** Which groups are initially in the list? */ /** Which groups are initially in the list? */
private transient Group[] groups; private Group[] groups;
private static final long serialVersionUID = -3330389128849427302L; private static final long serialVersionUID = -3330389128849427302L;
@@ -89,6 +89,7 @@ public class SelectGroupTag extends TagSupport
} }
@Override
public void release() public void release()
{ {
multiple = false; multiple = false;
@@ -96,6 +97,7 @@ public class SelectGroupTag extends TagSupport
} }
@Override
public int doStartTag() public int doStartTag()
throws JspException throws JspException
{ {

View File

@@ -29,12 +29,12 @@ import org.dspace.core.PluginManager;
*/ */
public class AdvancedSearchServlet extends DSpaceServlet public class AdvancedSearchServlet extends DSpaceServlet
{ {
private SearchRequestProcessor internalLogic; private transient SearchRequestProcessor internalLogic;
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(AdvancedSearchServlet.class); private static final Logger log = Logger.getLogger(AdvancedSearchServlet.class);
public void init() public AdvancedSearchServlet()
{ {
try try
{ {
@@ -44,7 +44,7 @@ public class AdvancedSearchServlet extends DSpaceServlet
catch (PluginConfigurationError e) catch (PluginConfigurationError e)
{ {
log.warn( log.warn(
"AdvancedSearchServlet not properly configurated, please configure the SearchRequestProcessor plugin", "AdvancedSearchServlet not properly configured -- please configure the SearchRequestProcessor plugin",
e); e);
} }
if (internalLogic == null) if (internalLogic == null)
@@ -53,6 +53,7 @@ public class AdvancedSearchServlet extends DSpaceServlet
} }
} }
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException

View File

@@ -5,9 +5,6 @@
* *
* http://www.dspace.org/license/ * http://www.dspace.org/license/
*/ */
/*
*
*/
package org.dspace.app.webui.servlet; package org.dspace.app.webui.servlet;
@@ -28,7 +25,6 @@ import org.dspace.content.authority.Choices;
import org.dspace.content.authority.ChoicesXMLGenerator; import org.dspace.content.authority.ChoicesXMLGenerator;
import org.dspace.content.authority.factory.ContentAuthorityServiceFactory; import org.dspace.content.authority.factory.ContentAuthorityServiceFactory;
import org.dspace.content.authority.service.ChoiceAuthorityService; import org.dspace.content.authority.service.ChoiceAuthorityService;
import org.dspace.content.authority.service.MetadataAuthorityService;
import org.dspace.content.factory.ContentServiceFactory; import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.CollectionService; import org.dspace.content.service.CollectionService;
import org.dspace.core.Context; import org.dspace.core.Context;
@@ -38,23 +34,17 @@ import org.apache.xml.serializer.Serializer;
import org.apache.xml.serializer.OutputPropertiesFactory; import org.apache.xml.serializer.OutputPropertiesFactory;
import org.apache.xml.serializer.Method; import org.apache.xml.serializer.Method;
/** /**
* *
* @author bollini * @author bollini
*/ */
public class AuthorityChooseServlet extends DSpaceServlet { public class AuthorityChooseServlet extends DSpaceServlet {
private ChoiceAuthorityService choiceAuthorityService; private final transient ChoiceAuthorityService choiceAuthorityService
= ContentAuthorityServiceFactory.getInstance().getChoiceAuthorityService();
private CollectionService collectionService; private final transient CollectionService collectionService
= ContentServiceFactory.getInstance().getCollectionService();
@Override
public void init() throws ServletException {
super.init();
choiceAuthorityService = ContentAuthorityServiceFactory.getInstance().getChoiceAuthorityService();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
}
@Override @Override
protected void doDSGet(Context context, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException { protected void doDSGet(Context context, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
process(context, request, response); process(context, request, response);

View File

@@ -43,19 +43,14 @@ import org.dspace.utils.DSpace;
public class BatchImportServlet extends DSpaceServlet public class BatchImportServlet extends DSpaceServlet
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(BatchImportServlet.class); private static final Logger log = Logger.getLogger(BatchImportServlet.class);
private CollectionService collectionService; private final transient CollectionService collectionService
= ContentServiceFactory.getInstance().getCollectionService();
private ItemImportService itemImportService; private final transient ItemImportService itemImportService
= ItemImportServiceFactory.getInstance().getItemImportService();
@Override
public void init() throws ServletException {
super.init();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
itemImportService = ItemImportServiceFactory.getInstance().getItemImportService();
}
/** /**
* Respond to a post request for metadata bulk importing via csv * Respond to a post request for metadata bulk importing via csv
* *
@@ -68,6 +63,7 @@ public class BatchImportServlet extends DSpaceServlet
* @throws SQLException * @throws SQLException
* @throws AuthorizeException * @throws AuthorizeException
*/ */
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -93,7 +89,7 @@ public class BatchImportServlet extends DSpaceServlet
List<Collection> collections = null; List<Collection> collections = null;
String colIdS = wrapper.getParameter("colId"); String colIdS = wrapper.getParameter("colId");
if (colIdS!=null){ if (colIdS!=null){
collections = new ArrayList<Collection>(); collections = new ArrayList<>();
collections.add(collectionService.findByIdOrLegacyId(context, colIdS)); collections.add(collectionService.findByIdOrLegacyId(context, colIdS));
} }
@@ -257,6 +253,7 @@ public class BatchImportServlet extends DSpaceServlet
* @throws SQLException * @throws SQLException
* @throws AuthorizeException * @throws AuthorizeException
*/ */
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -265,7 +262,7 @@ public class BatchImportServlet extends DSpaceServlet
List<Collection> collections = null; List<Collection> collections = null;
String colIdS = request.getParameter("colId"); String colIdS = request.getParameter("colId");
if (colIdS!=null){ if (colIdS!=null){
collections = new ArrayList<Collection>(); collections = new ArrayList<>();
collections.add(collectionService.findByIdOrLegacyId(context, colIdS)); collections.add(collectionService.findByIdOrLegacyId(context, colIdS));
} }
@@ -305,7 +302,7 @@ public class BatchImportServlet extends DSpaceServlet
protected List<String> getRepeatedParameter(HttpServletRequest request, protected List<String> getRepeatedParameter(HttpServletRequest request,
String metadataField, String param) String metadataField, String param)
{ {
List<String> vals = new LinkedList<String>(); List<String> vals = new LinkedList<>();
int i = 1; //start index at the first of the previously entered values int i = 1; //start index at the first of the previously entered values
boolean foundLast = false; boolean foundLast = false;

View File

@@ -32,7 +32,6 @@ import org.dspace.core.Constants;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.LogManager; import org.dspace.core.LogManager;
import org.dspace.core.Utils; import org.dspace.core.Utils;
import org.dspace.handle.HandleServiceImpl;
import org.dspace.handle.factory.HandleServiceFactory; import org.dspace.handle.factory.HandleServiceFactory;
import org.dspace.handle.service.HandleService; import org.dspace.handle.service.HandleService;
import org.dspace.usage.UsageEvent; import org.dspace.usage.UsageEvent;
@@ -51,7 +50,7 @@ import org.dspace.utils.DSpace;
public class BitstreamServlet extends DSpaceServlet public class BitstreamServlet extends DSpaceServlet
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(BitstreamServlet.class); private static final Logger log = Logger.getLogger(BitstreamServlet.class);
/** /**
* Threshold on Bitstream size before content-disposition will be set. * Threshold on Bitstream size before content-disposition will be set.
@@ -59,17 +58,17 @@ public class BitstreamServlet extends DSpaceServlet
private int threshold; private int threshold;
// services API // services API
private HandleService handleService; private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
private BitstreamService bitstreamService; private final transient BitstreamService bitstreamService
= ContentServiceFactory.getInstance().getBitstreamService();
@Override @Override
public void init(ServletConfig arg0) throws ServletException { public void init(ServletConfig arg0) throws ServletException {
super.init(arg0); super.init(arg0);
threshold = ConfigurationManager threshold = ConfigurationManager
.getIntProperty("webui.content_disposition_threshold"); .getIntProperty("webui.content_disposition_threshold");
handleService = HandleServiceFactory.getInstance().getHandleService();
bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
} }
@Override @Override

View File

@@ -23,13 +23,9 @@ import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Collection; import org.dspace.content.Collection;
import org.dspace.content.Community; import org.dspace.content.Community;
import org.dspace.content.factory.ContentServiceFactory; import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.CollectionService;
import org.dspace.content.service.CommunityService; import org.dspace.content.service.CommunityService;
import org.dspace.content.service.ItemService;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.LogManager; import org.dspace.core.LogManager;
import org.dspace.eperson.service.SubscribeService;
import org.dspace.handle.service.HandleService;
/** /**
* Servlet for listing communities (and collections within them) * Servlet for listing communities (and collections within them)
@@ -40,20 +36,13 @@ import org.dspace.handle.service.HandleService;
public class CommunityListServlet extends DSpaceServlet public class CommunityListServlet extends DSpaceServlet
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(CommunityListServlet.class); private static final Logger log = Logger.getLogger(CommunityListServlet.class);
// services API // services API
private CommunityService communityService; private final transient CommunityService communityService
= ContentServiceFactory.getInstance().getCommunityService();
private CollectionService collectionService;
@Override @Override
public void init() throws ServletException {
super.init();
communityService = ContentServiceFactory.getInstance().getCommunityService();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -64,8 +53,8 @@ public class CommunityListServlet extends DSpaceServlet
// This will map communityIDs to arrays of sub-communities // This will map communityIDs to arrays of sub-communities
Map<String, List<Community>> commMap; Map<String, List<Community>> commMap;
colMap = new HashMap<String, List<Collection>>(); colMap = new HashMap<>();
commMap = new HashMap<String, List<Community>>(); commMap = new HashMap<>();
log.info(LogManager.getHeader(context, "view_community_list", "")); log.info(LogManager.getHeader(context, "view_community_list", ""));

View File

@@ -45,7 +45,7 @@ import org.dspace.search.QueryResults;
public class ControlledVocabularySearchServlet extends DSpaceServlet public class ControlledVocabularySearchServlet extends DSpaceServlet
{ {
// the log // the log
private static Logger log = Logger private static final Logger log = Logger
.getLogger(ControlledVocabularySearchServlet.class); .getLogger(ControlledVocabularySearchServlet.class);
// the jsp that displays the HTML version of controlled-vocabulary // the jsp that displays the HTML version of controlled-vocabulary
@@ -54,19 +54,16 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
// the jsp that will show the search results // the jsp that will show the search results
private static final String RESULTS_JSP = "/controlledvocabulary/results.jsp"; private static final String RESULTS_JSP = "/controlledvocabulary/results.jsp";
private HandleService handleService; private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
private CommunityService communityService; private final transient CommunityService communityService
= ContentServiceFactory.getInstance().getCommunityService();
@Override
public void init() throws ServletException {
super.init();
handleService = HandleServiceFactory.getInstance().getHandleService();
communityService = ContentServiceFactory.getInstance().getCommunityService();
}
/** /**
* Handles requests * Handles requests
*/ */
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -104,7 +101,7 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
*/ */
private List<String> extractKeywords(HttpServletRequest request) private List<String> extractKeywords(HttpServletRequest request)
{ {
List<String> keywords = new ArrayList<String>(); List<String> keywords = new ArrayList<>();
Enumeration enumeration = request.getParameterNames(); Enumeration enumeration = request.getParameterNames();
while (enumeration.hasMoreElements()) while (enumeration.hasMoreElements())
{ {
@@ -143,9 +140,9 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
start = 0; start = 0;
} }
List<String> itemHandles = new ArrayList<String>(); List<String> itemHandles = new ArrayList<>();
List<String> collectionHandles = new ArrayList<String>(); List<String> collectionHandles = new ArrayList<>();
List<String> communityHandles = new ArrayList<String>(); List<String> communityHandles = new ArrayList<>();
Item[] resultsItems; Item[] resultsItems;
Collection[] resultsCollections; Collection[] resultsCollections;
@@ -219,7 +216,7 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
Integer myType = qResults.getHitTypes().get(i); Integer myType = qResults.getHitTypes().get(i);
// add the handle to the appropriate lists // add the handle to the appropriate lists
switch (myType.intValue()) switch (myType)
{ {
case Constants.ITEM: case Constants.ITEM:
itemHandles.add(myHandle); itemHandles.add(myHandle);
@@ -317,10 +314,10 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
request.setAttribute("communities", resultsCommunities); request.setAttribute("communities", resultsCommunities);
request.setAttribute("collections", resultsCollections); request.setAttribute("collections", resultsCollections);
request.setAttribute("pagetotal", Integer.valueOf(pageTotal)); request.setAttribute("pagetotal", pageTotal);
request.setAttribute("pagecurrent", Integer.valueOf(pageCurrent)); request.setAttribute("pagecurrent", pageCurrent);
request.setAttribute("pagelast", Integer.valueOf(pageLast)); request.setAttribute("pagelast", pageLast);
request.setAttribute("pagefirst", Integer.valueOf(pageFirst)); request.setAttribute("pagefirst", pageFirst);
request.setAttribute("queryresults", qResults); request.setAttribute("queryresults", qResults);
@@ -358,6 +355,7 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
/** /**
* Handle posts * Handle posts
*/ */
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException

View File

@@ -61,22 +61,19 @@ public class DSpaceServlet extends HttpServlet
*/ */
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(DSpaceServlet.class); private static final Logger log = Logger.getLogger(DSpaceServlet.class);
protected AuthorizeService authorizeService; protected transient AuthorizeService authorizeService
= AuthorizeServiceFactory.getInstance().getAuthorizeService();
@Override @Override
public void init() throws ServletException {
super.init();
authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
}
protected void doGet(HttpServletRequest request, protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException HttpServletResponse response) throws ServletException, IOException
{ {
processRequest(request, response); processRequest(request, response);
} }
@Override
protected void doPost(HttpServletRequest request, protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException HttpServletResponse response) throws ServletException, IOException
{ {

View File

@@ -43,16 +43,12 @@ import org.dspace.statistics.content.StatisticsTable;
public class DisplayStatisticsServlet extends DSpaceServlet public class DisplayStatisticsServlet extends DSpaceServlet
{ {
/** log4j logger */ /** log4j logger */
private static Logger log = Logger.getLogger(DisplayStatisticsServlet.class); private static final Logger log = Logger.getLogger(DisplayStatisticsServlet.class);
private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
private HandleService handleService;
@Override @Override
public void init() throws ServletException {
super.init();
handleService = HandleServiceFactory.getInstance().getHandleService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -157,7 +153,6 @@ public class DisplayStatisticsServlet extends DSpaceServlet
try try
{ {
StatisticsTable statisticsTable = new StatisticsTable(new StatisticsDataVisits(dso)); StatisticsTable statisticsTable = new StatisticsTable(new StatisticsDataVisits(dso));
statisticsTable.setTitle("Total Visits Per Month"); statisticsTable.setTitle("Total Visits Per Month");

View File

@@ -33,17 +33,12 @@ import org.dspace.eperson.service.EPersonService;
public class EditProfileServlet extends DSpaceServlet public class EditProfileServlet extends DSpaceServlet
{ {
/** Logger */ /** Logger */
private static Logger log = Logger.getLogger(EditProfileServlet.class); private static final Logger log = Logger.getLogger(EditProfileServlet.class);
protected EPersonService personService;
@Override
public void init() throws ServletException {
super.init();
personService = EPersonServiceFactory.getInstance().getEPersonService();
}
protected transient EPersonService personService
= EPersonServiceFactory.getInstance().getEPersonService();
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -57,6 +52,7 @@ public class EditProfileServlet extends DSpaceServlet
JSPManager.showJSP(request, response, "/register/edit-profile.jsp"); JSPManager.showJSP(request, response, "/register/edit-profile.jsp");
} }
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -99,7 +95,7 @@ public class EditProfileServlet extends DSpaceServlet
personService.update(context, eperson); personService.update(context, eperson);
// Show confirmation // Show confirmation
request.setAttribute("password.updated", Boolean.valueOf(settingPassword)); request.setAttribute("password.updated", settingPassword);
JSPManager.showJSP(request, response, JSPManager.showJSP(request, response,
"/register/profile-updated.jsp"); "/register/profile-updated.jsp");

View File

@@ -28,8 +28,6 @@ import org.apache.log4j.Logger;
import org.dspace.app.util.SyndicationFeed; import org.dspace.app.util.SyndicationFeed;
import org.dspace.app.webui.util.JSPManager; import org.dspace.app.webui.util.JSPManager;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.factory.AuthorizeServiceFactory;
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.browse.BrowseEngine; import org.dspace.browse.BrowseEngine;
import org.dspace.browse.BrowseException; import org.dspace.browse.BrowseException;
import org.dspace.browse.BrowseIndex; import org.dspace.browse.BrowseIndex;
@@ -43,15 +41,11 @@ import org.dspace.content.Item;
import org.dspace.content.factory.ContentServiceFactory; import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.CollectionService; import org.dspace.content.service.CollectionService;
import org.dspace.content.service.CommunityService; import org.dspace.content.service.CommunityService;
import org.dspace.content.service.ItemService;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
import org.dspace.core.Constants; import org.dspace.core.Constants;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.LogManager; import org.dspace.core.LogManager;
import org.dspace.eperson.Group; import org.dspace.eperson.Group;
import org.dspace.eperson.factory.EPersonServiceFactory;
import org.dspace.eperson.service.GroupService;
import org.dspace.eperson.service.SubscribeService;
import org.dspace.handle.factory.HandleServiceFactory; import org.dspace.handle.factory.HandleServiceFactory;
import org.dspace.handle.service.HandleService; import org.dspace.handle.service.HandleService;
import org.dspace.search.Harvest; import org.dspace.search.Harvest;
@@ -66,7 +60,6 @@ import com.sun.syndication.io.FeedException;
* Currently supports only RSS feed formats. * Currently supports only RSS feed formats.
* *
* @author Ben Bosman, Richard Rodgers * @author Ben Bosman, Richard Rodgers
* @version $Revision$
*/ */
public class FeedServlet extends DSpaceServlet public class FeedServlet extends DSpaceServlet
{ {
@@ -76,10 +69,10 @@ public class FeedServlet extends DSpaceServlet
// one hour in milliseconds // one hour in milliseconds
private static final long HOUR_MSECS = 60 * 60 * 1000; private static final long HOUR_MSECS = 60 * 60 * 1000;
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(FeedServlet.class); private static final Logger log = Logger.getLogger(FeedServlet.class);
private String clazz = "org.dspace.app.webui.servlet.FeedServlet";
private static final String clazz = "org.dspace.app.webui.servlet.FeedServlet";
// are syndication feeds enabled? // are syndication feeds enabled?
private static boolean enabled = false; private static boolean enabled = false;
// number of DSpace items per feed // number of DSpace items per feed
@@ -96,17 +89,14 @@ public class FeedServlet extends DSpaceServlet
private static boolean includeAll = true; private static boolean includeAll = true;
// services API // services API
private HandleService handleService; private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
private AuthorizeService authorizeService;
private SubscribeService subscribeService; private final transient CommunityService communityService
= ContentServiceFactory.getInstance().getCommunityService();
private ItemService itemService;
private final transient CollectionService collectionService
private CommunityService communityService; = ContentServiceFactory.getInstance().getCollectionService();
private CollectionService collectionService;
static static
{ {
@@ -118,7 +108,7 @@ public class FeedServlet extends DSpaceServlet
String fmtsStr = ConfigurationManager.getProperty("webui.feed.formats"); String fmtsStr = ConfigurationManager.getProperty("webui.feed.formats");
if ( fmtsStr != null ) if ( fmtsStr != null )
{ {
formats = new ArrayList<String>(); formats = new ArrayList<>();
String[] fmts = fmtsStr.split(","); String[] fmts = fmtsStr.split(",");
for (int i = 0; i < fmts.length; i++) for (int i = 0; i < fmts.length; i++)
{ {
@@ -130,22 +120,13 @@ public class FeedServlet extends DSpaceServlet
cacheSize = ConfigurationManager.getIntProperty("webui.feed.cache.size"); cacheSize = ConfigurationManager.getIntProperty("webui.feed.cache.size");
if (cacheSize > 0) if (cacheSize > 0)
{ {
feedCache = new HashMap<String, CacheFeed>(); feedCache = new HashMap<>();
cacheAge = ConfigurationManager.getIntProperty("webui.feed.cache.age"); cacheAge = ConfigurationManager.getIntProperty("webui.feed.cache.age");
} }
} }
} }
@Override @Override
public void init() throws ServletException {
handleService = HandleServiceFactory.getInstance().getHandleService();
authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
subscribeService = EPersonServiceFactory.getInstance().getSubscribeService();
itemService = ContentServiceFactory.getInstance().getItemService();
communityService = ContentServiceFactory.getInstance().getCommunityService();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
}
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -158,7 +139,7 @@ public class FeedServlet extends DSpaceServlet
// build label map from localized Messages resource bundle // build label map from localized Messages resource bundle
Locale locale = request.getLocale(); Locale locale = request.getLocale();
ResourceBundle msgs = ResourceBundle.getBundle("Messages", locale); ResourceBundle msgs = ResourceBundle.getBundle("Messages", locale);
Map<String, String> labelMap = new HashMap<String, String>(); Map<String, String> labelMap = new HashMap<>();
labelMap.put(SyndicationFeed.MSG_UNTITLED, msgs.getString(clazz + ".notitle")); labelMap.put(SyndicationFeed.MSG_UNTITLED, msgs.getString(clazz + ".notitle"));
labelMap.put(SyndicationFeed.MSG_LOGO_TITLE, msgs.getString(clazz + ".logo.title")); labelMap.put(SyndicationFeed.MSG_LOGO_TITLE, msgs.getString(clazz + ".logo.title"));
labelMap.put(SyndicationFeed.MSG_FEED_DESCRIPTION, msgs.getString(clazz + ".general-feed.description")); labelMap.put(SyndicationFeed.MSG_FEED_DESCRIPTION, msgs.getString(clazz + ".general-feed.description"));
@@ -354,7 +335,7 @@ public class FeedServlet extends DSpaceServlet
// Check to see if we can include this item // Check to see if we can include this item
//Group[] authorizedGroups = AuthorizeManager.getAuthorizedGroups(context, results[i], Constants.READ); //Group[] authorizedGroups = AuthorizeManager.getAuthorizedGroups(context, results[i], Constants.READ);
//boolean added = false; //boolean added = false;
List<Item> items = new ArrayList<Item>(); List<Item> items = new ArrayList<>();
for (Item result : results) for (Item result : results)
{ {
checkAccess: checkAccess:

View File

@@ -59,20 +59,20 @@ import org.dspace.utils.DSpace;
public class HTMLServlet extends DSpaceServlet public class HTMLServlet extends DSpaceServlet
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(HTMLServlet.class); private static final Logger log = Logger.getLogger(HTMLServlet.class);
/** /**
* Default maximum number of path elements to strip when testing if a * Default maximum number of path elements to strip when testing if a
* bitstream called "foo.html" should be served when "xxx/yyy/zzz/foo.html" * bitstream called "foo.html" should be served when "xxx/yyy/zzz/foo.html"
* is requested. * is requested.
*/ */
private int maxDepthGuess; private final int maxDepthGuess;
private ItemService itemService; private final transient ItemService itemService;
private HandleService handleService; private final transient HandleService handleService;
private BitstreamService bitstreamService; private final transient BitstreamService bitstreamService;
/** /**
* Create an HTML Servlet * Create an HTML Servlet
@@ -122,6 +122,7 @@ public class HTMLServlet extends DSpaceServlet
// On the surface it doesn't make much sense for this servlet to // On the surface it doesn't make much sense for this servlet to
// handle POST requests, but in practice some HTML pages which // handle POST requests, but in practice some HTML pages which
// are actually JSP get called on with a POST, so it's needed. // are actually JSP get called on with a POST, so it's needed.
@Override
protected void doDSPost(Context context, HttpServletRequest request, protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) HttpServletResponse response)
throws ServletException, IOException, SQLException, AuthorizeException throws ServletException, IOException, SQLException, AuthorizeException
@@ -129,6 +130,7 @@ public class HTMLServlet extends DSpaceServlet
doDSGet(context, request, response); doDSGet(context, request, response);
} }
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException

View File

@@ -27,8 +27,6 @@ import org.dspace.app.webui.util.Authenticate;
import org.dspace.app.webui.util.JSPManager; import org.dspace.app.webui.util.JSPManager;
import org.dspace.app.webui.util.UIUtil; import org.dspace.app.webui.util.UIUtil;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.factory.AuthorizeServiceFactory;
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.content.Collection; import org.dspace.content.Collection;
import org.dspace.content.Community; import org.dspace.content.Community;
import org.dspace.content.DSpaceObject; import org.dspace.content.DSpaceObject;
@@ -77,38 +75,30 @@ import org.jdom.output.XMLOutputter;
public class HandleServlet extends DSpaceServlet public class HandleServlet extends DSpaceServlet
{ {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(HandleServlet.class); private static final Logger log = Logger.getLogger(HandleServlet.class);
/** For obtaining &lt;meta&gt; elements to put in the &lt;head&gt; */ /** For obtaining &lt;meta&gt; elements to put in the &lt;head&gt; */
private DisseminationCrosswalk xHTMLHeadCrosswalk; private final transient DisseminationCrosswalk xHTMLHeadCrosswalk
= (DisseminationCrosswalk) PluginManager
.getNamedPlugin(DisseminationCrosswalk.class, "XHTML_HEAD_ITEM");
// services API // services API
private HandleService handleService; private final transient HandleService handleService
= HandleServiceFactory.getInstance().getHandleService();
private SubscribeService subscribeService;
private ItemService itemService;
private CommunityService communityService;
private CollectionService collectionService;
public HandleServlet()
{
super();
xHTMLHeadCrosswalk = (DisseminationCrosswalk) PluginManager
.getNamedPlugin(DisseminationCrosswalk.class, "XHTML_HEAD_ITEM");
}
public void init() throws ServletException {
super.init();
handleService = HandleServiceFactory.getInstance().getHandleService();
subscribeService = EPersonServiceFactory.getInstance().getSubscribeService();
itemService = ContentServiceFactory.getInstance().getItemService();
communityService = ContentServiceFactory.getInstance().getCommunityService();
collectionService = ContentServiceFactory.getInstance().getCollectionService();
}
private final transient SubscribeService subscribeService
= EPersonServiceFactory.getInstance().getSubscribeService();
private final transient ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
private final transient CommunityService communityService
= ContentServiceFactory.getInstance().getCommunityService();
private final transient CollectionService collectionService
= ContentServiceFactory.getInstance().getCollectionService();
@Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException SQLException, AuthorizeException
@@ -469,7 +459,7 @@ public class HandleServlet extends DSpaceServlet
else else
{ {
// check whether there is a logged in user // check whether there is a logged in user
suggestEnable = (context.getCurrentUser() == null ? false : true); suggestEnable = (context.getCurrentUser() != null);
} }
} }
@@ -482,8 +472,8 @@ public class HandleServlet extends DSpaceServlet
item)); item));
// Set attributes and display // Set attributes and display
request.setAttribute("suggest.enable", Boolean.valueOf(suggestEnable)); request.setAttribute("suggest.enable", suggestEnable);
request.setAttribute("display.all", Boolean.valueOf(displayAll)); request.setAttribute("display.all", displayAll);
request.setAttribute("item", item); request.setAttribute("item", item);
request.setAttribute("collections", collections); request.setAttribute("collections", collections);
request.setAttribute("dspace.layout.head", headMetadata); request.setAttribute("dspace.layout.head", headMetadata);
@@ -716,8 +706,8 @@ public class HandleServlet extends DSpaceServlet
// Forward to collection home page // Forward to collection home page
request.setAttribute("collection", collection); request.setAttribute("collection", collection);
request.setAttribute("community", community); request.setAttribute("community", community);
request.setAttribute("logged.in", Boolean.valueOf(e != null)); request.setAttribute("logged.in", e != null);
request.setAttribute("subscribed", Boolean.valueOf(subscribed)); request.setAttribute("subscribed", subscribed);
JSPManager.showJSP(request, response, "/collection-home.jsp"); JSPManager.showJSP(request, response, "/collection-home.jsp");
if (updated) if (updated)
@@ -823,7 +813,7 @@ public class HandleServlet extends DSpaceServlet
List<Community> parents = communityService.getAllParents(context, c); List<Community> parents = communityService.getAllParents(context, c);
// put into an array in reverse order // put into an array in reverse order
List<Community> reversedParents = new ArrayList<Community>(); List<Community> reversedParents = new ArrayList<>();
int index = parents.size() - 1; int index = parents.size() - 1;
for (int i = 0; i < parents.size(); i++) for (int i = 0; i < parents.size(); i++)

View File

@@ -38,15 +38,10 @@ import org.dspace.core.Utils;
*/ */
public class ItemExportArchiveServlet extends DSpaceServlet { public class ItemExportArchiveServlet extends DSpaceServlet {
/** log4j category */ /** log4j category */
private static Logger log = Logger.getLogger(ItemExportArchiveServlet.class); private static final Logger log = Logger.getLogger(ItemExportArchiveServlet.class);
private ItemExportService itemExportService; private final transient ItemExportService itemExportService
= ItemExportServiceFactory.getInstance().getItemExportService();
@Override
public void init() throws ServletException {
super.init();
itemExportService = ItemExportServiceFactory.getInstance().getItemExportService();
}
@Override @Override
protected void doDSGet(Context context, HttpServletRequest request, protected void doDSGet(Context context, HttpServletRequest request,

View File

@@ -20,6 +20,7 @@ import org.apache.log4j.Logger;
import org.dspace.app.webui.util.Authenticate; import org.dspace.app.webui.util.Authenticate;
import org.dspace.app.webui.util.JSPManager; import org.dspace.app.webui.util.JSPManager;
import org.dspace.authenticate.AuthenticationMethod; import org.dspace.authenticate.AuthenticationMethod;
import org.dspace.authenticate.factory.AuthenticateServiceFactory;
import org.dspace.authenticate.service.AuthenticationService; import org.dspace.authenticate.service.AuthenticationService;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
@@ -38,16 +39,12 @@ import org.dspace.core.LogManager;
public class LDAPServlet extends DSpaceServlet public class LDAPServlet extends DSpaceServlet
{ {
/** log4j logger */ /** log4j logger */
private static Logger log = Logger.getLogger(LDAPServlet.class); private static final Logger log = Logger.getLogger(LDAPServlet.class);
private AuthenticationService authenticationService;
@Override
public void init() throws ServletException {
super.init();
}
private final transient AuthenticationService authenticationService
= AuthenticateServiceFactory.getInstance().getAuthenticationService();
@Override
protected void doDSGet(Context context, protected void doDSGet(Context context,
HttpServletRequest request, HttpServletRequest request,
HttpServletResponse response) HttpServletResponse response)
@@ -66,6 +63,7 @@ public class LDAPServlet extends DSpaceServlet
} }
@Override
protected void doDSPost(Context context, protected void doDSPost(Context context,
HttpServletRequest request, HttpServletRequest request,
HttpServletResponse response) HttpServletResponse response)

Some files were not shown because too many files have changed in this diff Show More