Merge branch 'master' into DS-3363-csv-import-error-messages

This commit is contained in:
helix84
2016-11-14 18:04:18 +01:00
committed by GitHub
640 changed files with 45958 additions and 40798 deletions

View File

@@ -5,6 +5,20 @@ env:
# Give Maven 1GB of memory to work with # Give Maven 1GB of memory to work with
- MAVEN_OPTS=-Xmx1024M - MAVEN_OPTS=-Xmx1024M
jdk:
# DS-3384 Oracle JDK 8 has DocLint enabled by default.
# Let's use this to catch any newly introduced DocLint issues.
- oraclejdk8
- oraclejdk7
## Should we run into any problems with oraclejdk8 on Travis, we may try the following workaround.
## https://docs.travis-ci.com/user/languages/java#Testing-Against-Multiple-JDKs
## https://github.com/travis-ci/travis-ci/issues/3259#issuecomment-130860338
#addons:
# apt:
# packages:
# - oracle-java8-installer
# Install prerequisites for building Mirage2 more rapidly # Install prerequisites for building Mirage2 more rapidly
before_install: before_install:
# Install Node.js 6.5.0 & print version info # Install Node.js 6.5.0 & print version info

View File

@@ -12,7 +12,7 @@
<parent> <parent>
<groupId>org.dspace</groupId> <groupId>org.dspace</groupId>
<artifactId>dspace-parent</artifactId> <artifactId>dspace-parent</artifactId>
<version>6.0-rc5-SNAPSHOT</version> <version>7.0-SNAPSHOT</version>
<relativePath>..</relativePath> <relativePath>..</relativePath>
</parent> </parent>

View File

@@ -72,10 +72,10 @@ public interface ExtractingParams {
/** /**
* Restrict the extracted parts of a document to be indexed * Restrict the extracted parts of a document to be indexed
* by passing in an XPath expression. All content that satisfies the XPath expr. * by passing in an XPath expression. All content that satisfies the XPath expr.
* will be passed to the {@link SolrContentHandler}. * will be passed to the {@link org.apache.solr.handler.extraction.SolrContentHandler}.
* <p> * <p>
* See Tika's docs for what the extracted document looks like. * See Tika's docs for what the extracted document looks like.
* <p> *
* @see #CAPTURE_ELEMENTS * @see #CAPTURE_ELEMENTS
*/ */
public static final String XPATH_EXPRESSION = "xpath"; public static final String XPATH_EXPRESSION = "xpath";
@@ -105,7 +105,7 @@ public interface ExtractingParams {
* Capture the specified fields (and everything included below it that isn't capture by some other capture field) separately from the default. This is different * Capture the specified fields (and everything included below it that isn't capture by some other capture field) separately from the default. This is different
* then the case of passing in an XPath expression. * then the case of passing in an XPath expression.
* <p> * <p>
* The Capture field is based on the localName returned to the {@link SolrContentHandler} * The Capture field is based on the localName returned to the {@link org.apache.solr.handler.extraction.SolrContentHandler}
* by Tika, not to be confused by the mapped field. The field name can then * by Tika, not to be confused by the mapped field. The field name can then
* be mapped into the index schema. * be mapped into the index schema.
* <p> * <p>

View File

@@ -48,7 +48,7 @@ public class CommunityFiliator
/** /**
* *
* @param argv arguments * @param argv the command line arguments given
* @throws Exception if error * @throws Exception if error
*/ */
public static void main(String[] argv) throws Exception public static void main(String[] argv) throws Exception

View File

@@ -57,8 +57,7 @@ public final class CreateAdministrator
* For invoking via the command line. If called with no command line arguments, * For invoking via the command line. If called with no command line arguments,
* it will negotiate with the user for the administrator details * it will negotiate with the user for the administrator details
* *
* @param argv * @param argv the command line arguments given
* command-line arguments
* @throws Exception if error * @throws Exception if error
*/ */
public static void main(String[] argv) public static void main(String[] argv)

View File

@@ -71,7 +71,8 @@ public class MetadataImporter
/** /**
* main method for reading user input from the command line * main method for reading user input from the command line
* @param args arguments *
* @param args the command line arguments given
* @throws ParseException if parse error * @throws ParseException if parse error
* @throws SQLException if database error * @throws SQLException if database error
* @throws IOException if IO error * @throws IOException if IO error

View File

@@ -54,8 +54,7 @@ public class RegistryLoader
/** /**
* For invoking via the command line * For invoking via the command line
* *
* @param argv * @param argv the command line arguments given
* command-line arguments
* @throws Exception if error * @throws Exception if error
*/ */
public static void main(String[] argv) throws Exception public static void main(String[] argv) throws Exception

View File

@@ -92,7 +92,8 @@ public class StructBuilder
* *
* The output file will contain exactly the same as the source xml document, but * The output file will contain exactly the same as the source xml document, but
* with the handle for each imported item added as an attribute. * with the handle for each imported item added as an attribute.
* @param argv commandline arguments *
* @param argv the command line arguments given
* @throws Exception if an error occurs * @throws Exception if an error occurs
*/ */
public static void main(String[] argv) public static void main(String[] argv)

View File

@@ -53,7 +53,6 @@ public final class ChecksumChecker
/** /**
* Command line access to the checksum package. * Command line access to the checksum package.
* *
* @param args
* <dl> * <dl>
* <dt>-h</dt> * <dt>-h</dt>
* <dd>Print help on command line options</dd> * <dd>Print help on command line options</dd>
@@ -72,6 +71,7 @@ public final class ChecksumChecker
* <dt>-p</dt> * <dt>-p</dt>
* <dd>Don't prune results before running checker</dd> * <dd>Don't prune results before running checker</dd>
* </dl> * </dl>
* @param args the command line arguments given
* @throws SQLException if error * @throws SQLException if error
*/ */
public static void main(String[] args) throws SQLException { public static void main(String[] args) throws SQLException {
@@ -98,8 +98,7 @@ public final class ChecksumChecker
options.addOption(useBitstreamIds); options.addOption(useBitstreamIds);
options.addOption("p", "prune", false, "Prune configuration file"); options.addOption("p", "prune", false, "Prune configuration file");
options options.addOption(OptionBuilder
.addOption(OptionBuilder
.withArgName("prune") .withArgName("prune")
.hasOptionalArgs(1) .hasOptionalArgs(1)
.withDescription( .withDescription(
@@ -233,7 +232,7 @@ public final class ChecksumChecker
context.complete(); context.complete();
context = null; context = null;
} finally { } finally {
if(context != null){ if (context != null) {
context.abort(); context.abort();
} }
} }
@@ -249,19 +248,15 @@ public final class ChecksumChecker
HelpFormatter myhelp = new HelpFormatter(); HelpFormatter myhelp = new HelpFormatter();
myhelp.printHelp("Checksum Checker\n", options); myhelp.printHelp("Checksum Checker\n", options);
System.out System.out.println("\nSpecify a duration for checker process, using s(seconds),"
.println("\nSpecify a duration for checker process, using s(seconds),"
+ "m(minutes), or h(hours): ChecksumChecker -d 30s" + "m(minutes), or h(hours): ChecksumChecker -d 30s"
+ " OR ChecksumChecker -d 30m" + " OR ChecksumChecker -d 30m"
+ " OR ChecksumChecker -d 2h"); + " OR ChecksumChecker -d 2h");
System.out System.out.println("\nSpecify bitstream IDs: ChecksumChecker -b 13 15 17 20");
.println("\nSpecify bitstream IDs: ChecksumChecker -b 13 15 17 20");
System.out.println("\nLoop once through all bitstreams: " System.out.println("\nLoop once through all bitstreams: "
+ "ChecksumChecker -l"); + "ChecksumChecker -l");
System.out System.out.println("\nLoop continuously through all bitstreams: ChecksumChecker -L");
.println("\nLoop continuously through all bitstreams: ChecksumChecker -L"); System.out.println("\nCheck a defined number of bitstreams: ChecksumChecker -c 10");
System.out
.println("\nCheck a defined number of bitstreams: ChecksumChecker -c 10");
System.out.println("\nReport all processing (verbose)(default reports only errors): ChecksumChecker -v"); System.out.println("\nReport all processing (verbose)(default reports only errors): ChecksumChecker -v");
System.out.println("\nDefault (no arguments) is equivalent to '-c 1'"); System.out.println("\nDefault (no arguments) is equivalent to '-c 1'");
System.exit(0); System.exit(0);

View File

@@ -67,12 +67,18 @@ public class Harvest
options.addOption("P", "purge", false, "purge all harvestable collections"); options.addOption("P", "purge", false, "purge all harvestable collections");
options.addOption("e", "eperson", true, "eperson"); options.addOption("e", "eperson", true,
options.addOption("c", "collection", true, "harvesting collection (handle or id)"); "eperson");
options.addOption("t", "type", true, "type of harvesting (0 for none)"); options.addOption("c", "collection", true,
options.addOption("a", "address", true, "address of the OAI-PMH server"); "harvesting collection (handle or id)");
options.addOption("i", "oai_set_id", true, "id of the PMH set representing the harvested collection"); options.addOption("t", "type", true,
options.addOption("m", "metadata_format", true, "the name of the desired metadata format for harvesting, resolved to namespace and crosswalk in dspace.cfg"); "type of harvesting (0 for none)");
options.addOption("a", "address", true,
"address of the OAI-PMH server");
options.addOption("i", "oai_set_id", true,
"id of the PMH set representing the harvested collection");
options.addOption("m", "metadata_format", true,
"the name of the desired metadata format for harvesting, resolved to namespace and crosswalk in dspace.cfg");
options.addOption("h", "help", false, "help"); options.addOption("h", "help", false, "help");
@@ -90,22 +96,14 @@ public class Harvest
{ {
HelpFormatter myhelp = new HelpFormatter(); HelpFormatter myhelp = new HelpFormatter();
myhelp.printHelp("Harvest\n", options); myhelp.printHelp("Harvest\n", options);
System.out System.out.println("\nPING OAI server: Harvest -g -s oai_source -i oai_set_id");
.println("\nPING OAI server: Harvest -g -s oai_source -i oai_set_id"); System.out.println("RUNONCE harvest with arbitrary options: Harvest -o -e eperson -c collection -t harvest_type -a oai_source -i oai_set_id -m metadata_format");
System.out System.out.println("SETUP a collection for harvesting: Harvest -s -c collection -t harvest_type -a oai_source -i oai_set_id -m metadata_format");
.println("RUNONCE harvest with arbitrary options: Harvest -o -e eperson -c collection -t harvest_type -a oai_source -i oai_set_id -m metadata_format"); System.out.println("RUN harvest once: Harvest -r -e eperson -c collection");
System.out System.out.println("START harvest scheduler: Harvest -S");
.println("SETUP a collection for harvesting: Harvest -s -c collection -t harvest_type -a oai_source -i oai_set_id -m metadata_format"); System.out.println("RESET all harvest status: Harvest -R");
System.out System.out.println("PURGE a collection of items and settings: Harvest -p -e eperson -c collection");
.println("RUN harvest once: Harvest -r -e eperson -c collection"); System.out.println("PURGE all harvestable collections: Harvest -P -e eperson");
System.out
.println("START harvest scheduler: Harvest -S");
System.out
.println("RESET all harvest status: Harvest -R");
System.out
.println("PURGE a collection of items and settings: Harvest -p -e eperson -c collection");
System.out
.println("PURGE all harvestable collections: Harvest -P -e eperson");

View File

@@ -31,7 +31,7 @@ public class BitstreamFilterByFilename extends BitstreamFilter {
* *
* @param bitstream Bitstream * @param bitstream Bitstream
* @return whether bitstream name matches the regular expression * @return whether bitstream name matches the regular expression
* @exception BitstreamFilterException if filter error * @throws BitstreamFilterException if filter error
*/ */
@Override @Override
public boolean accept(Bitstream bitstream) throws BitstreamFilterException public boolean accept(Bitstream bitstream) throws BitstreamFilterException

View File

@@ -113,7 +113,7 @@ public class ItemUpdate {
/** /**
* *
* @param argv commandline args * @param argv the command line arguments given
*/ */
public static void main(String[] argv) public static void main(String[] argv)
{ {
@@ -138,13 +138,13 @@ public class ItemUpdate {
delBitstreamOption.setArgName("BitstreamFilter"); delBitstreamOption.setArgName("BitstreamFilter");
options.addOption(delBitstreamOption); options.addOption(delBitstreamOption);
//other params //other params
options.addOption("e", "eperson", true, "email of eperson doing the update"); options.addOption("e", "eperson", true, "email of eperson doing the update");
options.addOption("i", "itemfield", true, "optional metadata field that containing item identifier; default is dc.identifier.uri"); options.addOption("i", "itemfield", true, "optional metadata field that containing item identifier; default is dc.identifier.uri");
options.addOption("F", "filter-properties", true, "filter class name; only for deleting bitstream"); options.addOption("F", "filter-properties", true, "filter class name; only for deleting bitstream");
options.addOption("v", "verbose", false, "verbose logging"); options.addOption("v", "verbose", false, "verbose logging");
//special run states //special run states
options.addOption("t", "test", false, "test run - do not actually import items"); options.addOption("t", "test", false, "test run - do not actually import items");
options.addOption("P", "provenance", false, "suppress altering provenance field for bitstream changes"); options.addOption("P", "provenance", false, "suppress altering provenance field for bitstream changes");
options.addOption("h", "help", false, "help"); options.addOption("h", "help", false, "help");
@@ -395,6 +395,7 @@ public class ItemUpdate {
/** /**
* process an archive * process an archive
*
* @param context DSpace Context * @param context DSpace Context
* @param sourceDirPath source path * @param sourceDirPath source path
* @param itemField item field * @param itemField item field
@@ -516,7 +517,6 @@ public class ItemUpdate {
/** /**
*
* to avoid overwriting the undo source tree on repeated processing * to avoid overwriting the undo source tree on repeated processing
* sequence numbers are added and checked * sequence numbers are added and checked
* *
@@ -606,6 +606,7 @@ public class ItemUpdate {
* poor man's logging * poor man's logging
* As with ItemImport, API logging goes through log4j to the DSpace.log files * As with ItemImport, API logging goes through log4j to the DSpace.log files
* whereas the batch logging goes to the console to be captured there. * whereas the batch logging goes to the console to be captured there.
*
* @param s String * @param s String
*/ */
static void pr(String s) static void pr(String s)

View File

@@ -25,7 +25,7 @@ public class CommandRunner
{ {
/** /**
* *
* @param args commandline args * @param args the command line arguments given
* @throws IOException if IO error * @throws IOException if IO error
* @throws FileNotFoundException if file doesn't exist * @throws FileNotFoundException if file doesn't exist
*/ */

View File

@@ -92,8 +92,9 @@ public class ScriptLauncher
/** /**
* Recognize and execute a single command. * Recognize and execute a single command.
*
* @param doc Document * @param doc Document
* @param args arguments * @param args the command line arguments given
*/ */
static int runOneCommand(Document commandConfigs, String[] args) static int runOneCommand(Document commandConfigs, String[] args)
{ {

View File

@@ -61,7 +61,7 @@ public abstract class MediaFilter implements FormatFilter
* @param generatedBitstream * @param generatedBitstream
* the bitstream which was generated by * the bitstream which was generated by
* this filter. * this filter.
* @throws java.lang.Exception * @throws Exception if error
*/ */
@Override @Override
public void postProcessBitstream(Context c, Item item, Bitstream generatedBitstream) public void postProcessBitstream(Context c, Item item, Bitstream generatedBitstream)

View File

@@ -24,13 +24,20 @@ public interface RequestItemService {
/** /**
* Generate a request item representing the request and put it into the DB * Generate a request item representing the request and put it into the DB
* @param context context * @param context
* @param bitstream bitstream * The relevant DSpace Context.
* @param item item * @param bitstream
* @param reqMessage message * The requested bitstream
* @param allFiles all files flag * @param item
* The requested item
* @param reqMessage
* Request message text
* @param allFiles
* true indicates that all bitstreams of this item are requested
* @param reqEmail email * @param reqEmail email
* @param reqName name * Requester email
* @param reqName
* Requester name
* @return the token of the request item * @return the token of the request item
* @throws SQLException if database error * @throws SQLException if database error
*/ */
@@ -41,8 +48,11 @@ public interface RequestItemService {
/** /**
* Save updates to the record. Only accept_request, and decision_date are set-able. * Save updates to the record. Only accept_request, and decision_date are set-able.
*
* @param context * @param context
* The relevant DSpace Context.
* @param requestItem * @param requestItem
* requested item
*/ */
public void update(Context context, RequestItem requestItem); public void update(Context context, RequestItem requestItem);

View File

@@ -212,7 +212,7 @@ public class LogAnalyser
/** /**
* main method to be run from command line. See usage information for * main method to be run from command line. See usage information for
* details as to how to use the command line flags (-help) * details as to how to use the command line flags (-help)
* @param argv arguments * @param argv the command line arguments given
* @throws Exception if error * @throws Exception if error
* @throws SQLException if database error * @throws SQLException if database error
*/ */
@@ -1187,13 +1187,13 @@ public class LogAnalyser
// that // that
DiscoverQuery discoverQuery = new DiscoverQuery(); DiscoverQuery discoverQuery = new DiscoverQuery();
if(StringUtils.isNotBlank(type)) if (StringUtils.isNotBlank(type))
{ {
discoverQuery.addFilterQueries("dc.type=" + type +"*"); discoverQuery.addFilterQueries("dc.type=" + type +"*");
} }
StringBuilder accessionedQuery = new StringBuilder(); StringBuilder accessionedQuery = new StringBuilder();
accessionedQuery.append("dc.date.accessioned_dt:["); accessionedQuery.append("dc.date.accessioned_dt:[");
if(startDate != null) if (startDate != null)
{ {
accessionedQuery.append(unParseDate(startDate)); accessionedQuery.append(unParseDate(startDate));
} }
@@ -1202,7 +1202,7 @@ public class LogAnalyser
accessionedQuery.append("*"); accessionedQuery.append("*");
} }
accessionedQuery.append(" TO "); accessionedQuery.append(" TO ");
if(endDate != null) if (endDate != null)
{ {
accessionedQuery.append(unParseDate(endDate)); accessionedQuery.append(unParseDate(endDate));
} }

View File

@@ -152,9 +152,10 @@ public class ReportGenerator
/** /**
* main method to be run from command line. See usage information for * main method to be run from command line. See usage information for
* details as to how to use the command line flags * details as to how to use the command line flags
* @param argv * @param argv the command line arguments given
* @throws java.lang.Exception * @throws Exception on generic exception
* @throws java.sql.SQLException * @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
public static void main(String [] argv) public static void main(String [] argv)
throws Exception, SQLException throws Exception, SQLException

View File

@@ -30,6 +30,8 @@ public class CollectionDropDown {
* Get full path starting from a top-level community via subcommunities down to a collection. * Get full path starting from a top-level community via subcommunities down to a collection.
* The full path will not be truncated. * The full path will not be truncated.
* *
* @param context
* The relevant DSpace Context.
* @param col * @param col
* Get full path for this collection * Get full path for this collection
* @return Full path to the collection * @return Full path to the collection
@@ -44,6 +46,8 @@ public class CollectionDropDown {
* Get full path starting from a top-level community via subcommunities down to a collection. * Get full path starting from a top-level community via subcommunities down to a collection.
* The full cat will be truncated to the specified number of characters and prepended with an ellipsis. * The full cat will be truncated to the specified number of characters and prepended with an ellipsis.
* *
* @param context
* The relevant DSpace Context.
* @param col * @param col
* Get full path for this collection * Get full path for this collection
* @param maxchars * @param maxchars
@@ -84,6 +88,8 @@ public class CollectionDropDown {
/** /**
* Annotates an array of collections with their respective full paths (@see #collectionPath() method in this class). * Annotates an array of collections with their respective full paths (@see #collectionPath() method in this class).
* @param context
* The relevant DSpace Context.
* @param collections An array of collections to annotate with their hierarchical paths. * @param collections An array of collections to annotate with their hierarchical paths.
* The array and all its entries must be non-null. * The array and all its entries must be non-null.
* @return A sorted array of collection path entries (essentially collection/path pairs). * @return A sorted array of collection path entries (essentially collection/path pairs).

View File

@@ -36,8 +36,7 @@ public class Configuration
* </ul> * </ul>
* If the property does not exist, nothing is written. * If the property does not exist, nothing is written.
* *
* @param argv * @param argv the command line arguments given
* command-line arguments
*/ */
public static void main(String[] argv) public static void main(String[] argv)
{ {

View File

@@ -94,8 +94,10 @@ public class DCInput
* a HashMap * a HashMap
* *
* @param fieldMap * @param fieldMap
* ??? * named field values.
*
* @param listMap * @param listMap
* value-pairs map, computed from the forms definition XML file
*/ */
public DCInput(Map<String, String> fieldMap, Map<String, List<String>> listMap) public DCInput(Map<String, String> fieldMap, Map<String, List<String>> listMap)
{ {

View File

@@ -120,7 +120,7 @@ public class DCInputSet
* Does the current input set define the named field? * Does the current input set define the named field?
* Scan through every field in every page of the input set * Scan through every field in every page of the input set
* *
* @param fieldName * @param fieldName selects the field.
* @return true if the current set has the named field * @return true if the current set has the named field
*/ */
public boolean isFieldPresent(String fieldName) public boolean isFieldPresent(String fieldName)
@@ -152,7 +152,7 @@ public class DCInputSet
*/ */
public boolean isFieldPresent(String fieldName, String documentType) public boolean isFieldPresent(String fieldName, String documentType)
{ {
if(documentType == null){ if (documentType == null) {
documentType = ""; documentType = "";
} }
for (int i = 0; i < inputPages.length; i++) for (int i = 0; i < inputPages.length; i++)
@@ -164,7 +164,7 @@ public class DCInputSet
pageInputs[row].getQualifier(); pageInputs[row].getQualifier();
if (fullName.equals(fieldName) ) if (fullName.equals(fieldName) )
{ {
if(pageInputs[row].isAllowedFor(documentType)){ if (pageInputs[row].isAllowedFor(documentType)) {
return true; return true;
} }
} }

View File

@@ -82,6 +82,7 @@ public class DCInputsReader
* level structures: a map between collections and forms, the definition for * level structures: a map between collections and forms, the definition for
* each page of each form, and lists of pairs of values that populate * each page of each form, and lists of pairs of values that populate
* selection boxes. * selection boxes.
*
* @throws DCInputsReaderException if input reader error * @throws DCInputsReaderException if input reader error
*/ */
@@ -197,6 +198,9 @@ public class DCInputsReader
* Process the top level child nodes in the passed top-level node. These * Process the top level child nodes in the passed top-level node. These
* should correspond to the collection-form maps, the form definitions, and * should correspond to the collection-form maps, the form definitions, and
* the display/storage word pairs. * the display/storage word pairs.
*
* @param n
* top-level DOM node
*/ */
private void doNodes(Node n) private void doNodes(Node n)
throws SAXException, DCInputsReaderException throws SAXException, DCInputsReaderException
@@ -337,7 +341,6 @@ public class DCInputsReader
// we omit the duplicate validation, allowing multiple fields definition for // we omit the duplicate validation, allowing multiple fields definition for
// the same metadata and different visibility/type-bind // the same metadata and different visibility/type-bind
} }
} }
} // ignore any child that is not a 'page' } // ignore any child that is not a 'page'
@@ -545,7 +548,6 @@ public class DCInputsReader
String errString = String errString =
"Missing name attribute for value-pairs for DC term " + dcTerm; "Missing name attribute for value-pairs for DC term " + dcTerm;
throw new SAXException(errString); throw new SAXException(errString);
} }
List<String> pairs = new ArrayList<String>(); List<String> pairs = new ArrayList<String>();
valuePairs.put(pairsName, pairs); valuePairs.put(pairsName, pairs);
@@ -626,7 +628,6 @@ public class DCInputsReader
// we omit the "required" and "visibility" validation, provided this must be checked in the processing class // we omit the "required" and "visibility" validation, provided this must be checked in the processing class
// only when it makes sense (if the field isn't visible means that it is not applicable, therefore it can't be required) // only when it makes sense (if the field isn't visible means that it is not applicable, therefore it can't be required)
} }
} }
} }

View File

@@ -30,6 +30,7 @@ public class DSpaceContextListener implements ServletContextListener
/** /**
* Initialize any resources required by the application. * Initialize any resources required by the application.
* @param event * @param event
* This is the event class for notifications about changes to the servlet context of a web application.
*/ */
@Override @Override
public void contextInitialized(ServletContextEvent event) public void contextInitialized(ServletContextEvent event)
@@ -63,6 +64,7 @@ public class DSpaceContextListener implements ServletContextListener
* Clean up resources used by the application when stopped * Clean up resources used by the application when stopped
* *
* @param event * @param event
8 Event class for notifications about changes to the servlet context of a web application.
*/ */
@Override @Override
public void contextDestroyed(ServletContextEvent event) public void contextDestroyed(ServletContextEvent event)

View File

@@ -229,6 +229,7 @@ public class GoogleMetadata
* first-encountered instance of the field for this Item. * first-encountered instance of the field for this Item.
* *
* @param fieldName * @param fieldName
* metadata field name
* @return successful? * @return successful?
*/ */
protected boolean addSingleField(String fieldName) protected boolean addSingleField(String fieldName)
@@ -262,7 +263,7 @@ public class GoogleMetadata
if (config.equals("$simple-pdf")) if (config.equals("$simple-pdf"))
{ {
String pdf_url = getPDFSimpleUrl(item); String pdf_url = getPDFSimpleUrl(item);
if(pdf_url.length() > 0) if (pdf_url.length() > 0)
{ {
metadataMappings.put(fieldName, pdf_url); metadataMappings.put(fieldName, pdf_url);
return true; return true;
@@ -291,6 +292,7 @@ public class GoogleMetadata
* instead of an aggregate. * instead of an aggregate.
* *
* @param configFilter * @param configFilter
* list of DC metadata fields separated by "|" characters
* @return The first configured match of metadata field for the item. * @return The first configured match of metadata field for the item.
*/ */
protected MetadataValue resolveMetadataField(String configFilter) protected MetadataValue resolveMetadataField(String configFilter)
@@ -309,6 +311,7 @@ public class GoogleMetadata
* A plural version of resolveMetadata for aggregate fields. * A plural version of resolveMetadata for aggregate fields.
* *
* @param configFilter * @param configFilter
* list of DC metadata fields separated by "|" characters
* @return Aggregate of all matching metadata fields configured in the first * @return Aggregate of all matching metadata fields configured in the first
* option field-set to return any number of filter matches. * option field-set to return any number of filter matches.
*/ */
@@ -328,7 +331,9 @@ public class GoogleMetadata
* configuration filter. * configuration filter.
* *
* @param configFilter * @param configFilter
* list of DC metadata fields separated by "|" characters
* @param returnType * @param returnType
* GoogleMetadata.SINGLE / GoogleMetadata.MULTI / GoogleMetadata.ALL_FIELDS_IN_OPTION
* @return Array of configuration to item-field matches * @return Array of configuration to item-field matches
*/ */
protected ArrayList<MetadataValue> resolveMetadata(String configFilter, protected ArrayList<MetadataValue> resolveMetadata(String configFilter,
@@ -350,8 +355,7 @@ public class GoogleMetadata
if (log.isDebugEnabled()) if (log.isDebugEnabled())
{ {
log log.debug("Resolved Fields For This Item Per Configuration Filter:");
.debug("Resolved Fields For This Item Per Configuration Filter:");
for (int i = 0; i < parsedOptions.size(); i++) for (int i = 0; i < parsedOptions.size(); i++)
{ {
ArrayList<String> optionFields = parsedOptions.get(i); ArrayList<String> optionFields = parsedOptions.get(i);
@@ -445,6 +449,7 @@ public class GoogleMetadata
* configuration. * configuration.
* *
* @param configFilter * @param configFilter
* list of DC metadata fields separated by "|" characters
* @return array of parsed options or null * @return array of parsed options or null
*/ */
protected ArrayList<ArrayList<String>> parseOptions(String configFilter) protected ArrayList<ArrayList<String>> parseOptions(String configFilter)
@@ -720,7 +725,7 @@ public class GoogleMetadata
// Dissertations // Dissertations
if (itemIsDissertation()) if (itemIsDissertation())
{ {
if(log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("ITEM TYPE: DISSERTATION"); log.debug("ITEM TYPE: DISSERTATION");
} }
@@ -731,7 +736,7 @@ public class GoogleMetadata
// Patents // Patents
if (itemIsPatent()) if (itemIsPatent())
{ {
if(log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("ITEM TYPE: PATENT"); log.debug("ITEM TYPE: PATENT");
} }
@@ -750,7 +755,7 @@ public class GoogleMetadata
// Tech Reports // Tech Reports
if (itemIsTechReport()) if (itemIsTechReport())
{ {
if(log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("ITEM TYPE: TECH REPORT"); log.debug("ITEM TYPE: TECH REPORT");
} }
addSingleField(TECH_REPORT_NUMBER); addSingleField(TECH_REPORT_NUMBER);
@@ -758,7 +763,7 @@ public class GoogleMetadata
} }
if(!itemIsDissertation() && !itemIsTechReport()) { if (!itemIsDissertation() && !itemIsTechReport()) {
// PUBLISHER // PUBLISHER
addSingleField(PUBLISHER); addSingleField(PUBLISHER);
} }
@@ -1004,7 +1009,7 @@ public class GoogleMetadata
* is in the default content bundle, and that the item only has one public bitstream * is in the default content bundle, and that the item only has one public bitstream
* and it is a PDF. * and it is a PDF.
* *
* @param item * @param item item to get PDF URL from
* @return URL that the PDF can be directly downloaded from * @return URL that the PDF can be directly downloaded from
*/ */
protected String getPDFSimpleUrl(Item item) protected String getPDFSimpleUrl(Item item)
@@ -1045,7 +1050,9 @@ public class GoogleMetadata
* <li>the primary bitstream</li> * <li>the primary bitstream</li>
* </ul> * </ul>
* Additionally, this bitstream must be publicly viewable. * Additionally, this bitstream must be publicly viewable.
*
* @param item * @param item
* bitstream's parent item
* @return a linkable bitstream or null if none found * @return a linkable bitstream or null if none found
* @throws SQLException if database error * @throws SQLException if database error
*/ */
@@ -1071,6 +1078,13 @@ public class GoogleMetadata
return bestSoFar; return bestSoFar;
} }
/**
* Find out whether bitstream is readable by the public.
*
* @param bitstream
* the target bitstream
* @return whether bitstream is readable by the Anonymous group
*/
protected boolean isPublic(Bitstream bitstream) { protected boolean isPublic(Bitstream bitstream) {
if (bitstream == null) { if (bitstream == null) {
return false; return false;
@@ -1122,6 +1136,7 @@ public class GoogleMetadata
/** /**
* If metadata field contains multiple values, then add each value to the map separately * If metadata field contains multiple values, then add each value to the map separately
* @param FIELD * @param FIELD
* metadata field
*/ */
protected void addMultipleValues(String FIELD) protected void addMultipleValues(String FIELD)
{ {
@@ -1201,6 +1216,7 @@ public class GoogleMetadata
* metadata practice. * metadata practice.
* *
* @param dConfig * @param dConfig
* configured fields (from google-metadata.properties)
* @return item matches configuration * @return item matches configuration
*/ */
protected boolean identifyItemType(String dConfig) protected boolean identifyItemType(String dConfig)
@@ -1223,7 +1239,7 @@ public class GoogleMetadata
if (mdPairs.containsKey(parsedPair[0].trim())) if (mdPairs.containsKey(parsedPair[0].trim()))
{ {
mdPairs.get(parsedPair[0].trim()).add(parsedPair[1]); mdPairs.get(parsedPair[0].trim()).add(parsedPair[1]);
if(log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Registering Type Identifier: " + parsedPair[0] + " => " + parsedPair[1]); log.debug("Registering Type Identifier: " + parsedPair[0] + " => " + parsedPair[1]);
} }
} }

View File

@@ -197,7 +197,7 @@ public class OpenSearchServiceImpl implements OpenSearchService, InitializingBea
{ {
osq.setSearchTerms(URLEncoder.encode(query, "UTF-8")); osq.setSearchTerms(URLEncoder.encode(query, "UTF-8"));
} }
catch(UnsupportedEncodingException e) catch (UnsupportedEncodingException e)
{ {
log.error(e); log.error(e);
} }
@@ -281,7 +281,9 @@ public class OpenSearchServiceImpl implements OpenSearchService, InitializingBea
/** /**
* Converts a JDOM document to a W3C one * Converts a JDOM document to a W3C one
*
* @param jdomDoc * @param jdomDoc
* jDOM document to convert
* @return W3C Document object * @return W3C Document object
* @throws IOException if IO error * @throws IOException if IO error
*/ */
@@ -292,7 +294,7 @@ public class OpenSearchServiceImpl implements OpenSearchService, InitializingBea
{ {
return domOut.output(jdomDoc); return domOut.output(jdomDoc);
} }
catch(JDOMException jde) catch (JDOMException jde)
{ {
throw new IOException("JDOM output exception", jde); throw new IOException("JDOM output exception", jde);
} }

View File

@@ -39,7 +39,7 @@ public class SubmissionStepConfig implements Serializable
/** /**
* the id for this step ('id' only exists if this step is defined in the * the id for this step ('id' only exists if this step is defined in the
* <step-definitions> section) * &lt;step-definitions&gt; section)
*/ */
private String id = null; private String id = null;

View File

@@ -13,13 +13,15 @@ import java.net.Inet6Address;
import java.net.UnknownHostException; import java.net.UnknownHostException;
/** /**
* <p>
* Quickly tests whether a given IP address matches an IP range. An * Quickly tests whether a given IP address matches an IP range. An
* {@code IPMatcher} is initialized with a particular IP range specification. * {@code IPMatcher} is initialized with a particular IP range specification.
* Calls to {@link IPMatcher#match(String) match} method will then quickly * Calls to {@link IPMatcher#match(String) match} method will then quickly
* determine whether a given IP falls within that range. * determine whether a given IP falls within that range.
* </p>
* <p> * <p>
* Supported range specifications are: * Supported range specifications are:
* <p> * </p>
* <ul> * <ul>
* <li>Full IPv4 address, e.g. {@code 12.34.56.78}</li> * <li>Full IPv4 address, e.g. {@code 12.34.56.78}</li>
* <li>Full IPv6 address, e.g. {@code 2001:18e8:3:171:218:8bff:fe2a:56a4}</li> * <li>Full IPv6 address, e.g. {@code 2001:18e8:3:171:218:8bff:fe2a:56a4}</li>

View File

@@ -242,8 +242,9 @@ public class AuthorityValue {
} }
/** /**
* Provides a string that will allow this AuthorityType to be recognized and provides information to create a new instance to be created using public AuthorityValue newInstance(String info). * Provides a string that will allow this AuthorityType to be recognized and
* See the implementation of {@link com.atmire.org.dspace.authority.AuthorityValueGenerator#generateRaw(java.lang.String, java.lang.String) AuthorityValueGenerator#generateRaw(java.lang.String, java.lang.String)} for more details. * provides information to create a new instance to be created using {@link #newInstance(String)}.
* See the implementation of {@link org.dspace.authority.AuthorityValueServiceImpl#generateRaw(java.lang.String, java.lang.String, java.lang.String)} for more details.
* @return see {@link org.dspace.authority.service.AuthorityValueService#GENERATE AuthorityValueService.GENERATE} * @return see {@link org.dspace.authority.service.AuthorityValueService#GENERATE AuthorityValueService.GENERATE}
*/ */
public String generateString() { public String generateString() {

View File

@@ -37,6 +37,7 @@ public class AuthorizeException extends Exception
* create an exception with only a message * create an exception with only a message
* *
* @param message * @param message
* Exception message
*/ */
public AuthorizeException(String message) public AuthorizeException(String message)
{ {

View File

@@ -624,7 +624,7 @@ public class AuthorizeServiceImpl implements AuthorizeService
List<Group> groups = new ArrayList<Group>(); List<Group> groups = new ArrayList<Group>();
for (ResourcePolicy resourcePolicy : policies) { for (ResourcePolicy resourcePolicy : policies) {
if(resourcePolicy.getGroup() != null) if (resourcePolicy.getGroup() != null)
{ {
groups.add(resourcePolicy.getGroup()); groups.add(resourcePolicy.getGroup());
} }
@@ -653,7 +653,7 @@ public class AuthorizeServiceImpl implements AuthorizeService
if (CollectionUtils.isNotEmpty(policies)) if (CollectionUtils.isNotEmpty(policies))
{ {
return policies.iterator().next(); return policies.iterator().next();
}else{ } else {
return null; return null;
} }
} }
@@ -664,16 +664,22 @@ public class AuthorizeServiceImpl implements AuthorizeService
* have right on the collection. E.g., if the anonymous can access the collection policies are assigned to anonymous. * have right on the collection. E.g., if the anonymous can access the collection policies are assigned to anonymous.
* *
* @param context * @param context
* The relevant DSpace Context.
* @param embargoDate * @param embargoDate
* embargo end date
* @param reason * @param reason
* embargo reason
* @param dso * @param dso
* DSpace object
* @param owningCollection * @param owningCollection
* collection to get group policies from
* @throws SQLException if database error * @throws SQLException if database error
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error
*/ */
@Override @Override
public void generateAutomaticPolicies(Context context, Date embargoDate, public void generateAutomaticPolicies(Context context, Date embargoDate,
String reason, DSpaceObject dso, Collection owningCollection) throws SQLException, AuthorizeException String reason, DSpaceObject dso, Collection owningCollection)
throws SQLException, AuthorizeException
{ {
if (embargoDate != null || (embargoDate == null && dso instanceof Bitstream)) if (embargoDate != null || (embargoDate == null && dso instanceof Bitstream))
@@ -714,7 +720,7 @@ public class AuthorizeServiceImpl implements AuthorizeService
@Override @Override
public ResourcePolicy createResourcePolicy(Context context, DSpaceObject dso, Group group, EPerson eperson, int type, String rpType) throws SQLException, AuthorizeException { public ResourcePolicy createResourcePolicy(Context context, DSpaceObject dso, Group group, EPerson eperson, int type, String rpType) throws SQLException, AuthorizeException {
if(group == null && eperson == null) if (group == null && eperson == null)
{ {
throw new IllegalArgumentException("We need at least an eperson or a group in order to create a resource policy."); throw new IllegalArgumentException("We need at least an eperson or a group in order to create a resource policy.");
} }

View File

@@ -34,7 +34,8 @@ public class FixDefaultPolicies
{ {
/** /**
* Command line interface to setPolicies - run to see arguments * Command line interface to setPolicies - run to see arguments
* @param argv arguments *
* @param argv the command line arguments given
* @throws Exception if error * @throws Exception if error
*/ */
public static void main(String[] argv) throws Exception public static void main(String[] argv) throws Exception

View File

@@ -43,7 +43,8 @@ public class PolicySet
/** /**
* Command line interface to setPolicies - run to see arguments * Command line interface to setPolicies - run to see arguments
* @param argv arguments *
* @param argv the command line arguments given
* @throws Exception if error * @throws Exception if error
*/ */
public static void main(String[] argv) throws Exception public static void main(String[] argv) throws Exception
@@ -130,17 +131,30 @@ public class PolicySet
/** /**
* *
* @param c * @param c
* current context
* @param containerType * @param containerType
* type, Constants.ITEM or Constants.COLLECTION
* @param containerID * @param containerID
* ID of container (DB primary key)
* @param contentType * @param contentType
* ID of container (DB primary key)
* @param actionID * @param actionID
* action ID (e.g. Constants.READ)
* @param groupID * @param groupID
* group ID (database key)
* @param isReplace * @param isReplace
* if <code>true</code>, existing policies are removed first,
* otherwise add to existing policies
* @param clearOnly * @param clearOnly
* if non-null, only process bitstreams whose names contain filter
* @param name * @param name
* policy name
* @param description * @param description
* policy descrption
* @param startDate * @param startDate
* policy start date
* @param endDate * @param endDate
* policy end date
* @throws SQLException if database error * @throws SQLException if database error
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error
*/ */
@@ -166,7 +180,7 @@ public class PolicySet
* @param contentType * @param contentType
* type (BUNDLE, ITEM, or BITSTREAM) * type (BUNDLE, ITEM, or BITSTREAM)
* @param actionID * @param actionID
* action ID * action ID (e.g. Constants.READ)
* @param groupID * @param groupID
* group ID (database key) * group ID (database key)
* @param isReplace * @param isReplace
@@ -214,9 +228,13 @@ public class PolicySet
* @param filter * @param filter
* if non-null, only process bitstreams whose names contain filter * if non-null, only process bitstreams whose names contain filter
* @param name * @param name
* policy name
* @param description * @param description
* policy description
* @param startDate * @param startDate
* policy start date
* @param endDate * @param endDate
* policy end date
* @throws SQLException if database error * @throws SQLException if database error
* if database problem * if database problem
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error
@@ -250,7 +268,7 @@ public class PolicySet
{ {
// before create a new policy check if an identical policy is already in place // before create a new policy check if an identical policy is already in place
if(!authorizeService.isAnIdenticalPolicyAlreadyInPlace(c, myitem, group, actionID, -1)){ if (!authorizeService.isAnIdenticalPolicyAlreadyInPlace(c, myitem, group, actionID, -1)) {
// now add the policy // now add the policy
ResourcePolicy rp = resourcePolicyService.create(c); ResourcePolicy rp = resourcePolicyService.create(c);

View File

@@ -96,6 +96,7 @@ public class ResourcePolicy implements ReloadableEntity<Integer> {
* Return true if this object equals obj, false otherwise. * Return true if this object equals obj, false otherwise.
* *
* @param obj * @param obj
* object to compare (eperson, group, start date, end date, ...)
* @return true if ResourcePolicy objects are equal * @return true if ResourcePolicy objects are equal
*/ */
@Override @Override
@@ -144,23 +145,22 @@ public class ResourcePolicy implements ReloadableEntity<Integer> {
{ {
int hash = 7; int hash = 7;
hash = 19 * hash + this.getAction(); hash = 19 * hash + this.getAction();
if(this.getGroup() != null) if (this.getGroup() != null)
{ {
hash = 19 * hash + this.getGroup().hashCode(); hash = 19 * hash + this.getGroup().hashCode();
}else{ } else {
hash = 19 * hash + -1; hash = 19 * hash + -1;
} }
if(this.getEPerson() != null) if (this.getEPerson() != null)
{ {
hash = 19 * hash + this.getEPerson().hashCode(); hash = 19 * hash + this.getEPerson().hashCode();
}else{ } else {
hash = 19 * hash + -1; hash = 19 * hash + -1;
} }
hash = 19 * hash + (this.getStartDate() != null? this.getStartDate().hashCode():0); hash = 19 * hash + (this.getStartDate() != null ? this.getStartDate().hashCode() : 0);
hash = 19 * hash + (this.getEndDate() != null? this.getEndDate().hashCode():0); hash = 19 * hash + (this.getEndDate() != null ? this.getEndDate().hashCode() : 0);
return hash; return hash;
} }
@@ -185,7 +185,7 @@ public class ResourcePolicy implements ReloadableEntity<Integer> {
/** /**
* set the action this policy authorizes * set the action this policy authorizes
* *
* @param myid action ID from <code>org.dspace.core.Constants</code> * @param myid action ID from {@link org.dspace.core.Constants#Constants Constants}
*/ */
public void setAction(int myid) public void setAction(int myid)
{ {
@@ -279,24 +279,24 @@ public class ResourcePolicy implements ReloadableEntity<Integer> {
this.endDate = d; this.endDate = d;
} }
public String getRpName(){ public String getRpName() {
return rpname; return rpname;
} }
public void setRpName(String name){ public void setRpName(String name) {
this.rpname = name; this.rpname = name;
} }
public String getRpType(){ public String getRpType() {
return rptype; return rptype;
} }
public void setRpType(String type){ public void setRpType(String type) {
this.rptype = type; this.rptype = type;
} }
public String getRpDescription(){ public String getRpDescription() {
return rpdescription; return rpdescription;
} }
public void setRpDescription(String description){ public void setRpDescription(String description) {
this.rpdescription = description; this.rpdescription = description;
} }
} }

View File

@@ -47,7 +47,8 @@ public interface AuthorizeService {
* <code>org.dspace.core.Constants</code> * <code>org.dspace.core.Constants</code>
* @throws AuthorizeException if any one of the specified actions cannot be * @throws AuthorizeException if any one of the specified actions cannot be
* performed by the current user on the given object. * performed by the current user on the given object.
* @throws SQLException if database error * @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
public void authorizeAnyOf(Context c, DSpaceObject o, int[] actions) throws AuthorizeException, SQLException; public void authorizeAnyOf(Context c, DSpaceObject o, int[] actions) throws AuthorizeException, SQLException;
@@ -59,8 +60,11 @@ public interface AuthorizeService {
* @param c context * @param c context
* @param o a DSpaceObject * @param o a DSpaceObject
* @param action action to perform from <code>org.dspace.core.Constants</code> * @param action action to perform from <code>org.dspace.core.Constants</code>
* @throws AuthorizeException if the user is denied * @throws AuthorizeException
* @throws SQLException if database error * Exception indicating the current user of the context does not have permission
* to perform a particular action.
* @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
public void authorizeAction(Context c, DSpaceObject o, int action) throws AuthorizeException, SQLException; public void authorizeAction(Context c, DSpaceObject o, int action) throws AuthorizeException, SQLException;
@@ -75,8 +79,11 @@ public interface AuthorizeService {
* flag to say if ADMIN action on the current object or parent * flag to say if ADMIN action on the current object or parent
* object can be used * object can be used
* @param action action to perform from <code>org.dspace.core.Constants</code> * @param action action to perform from <code>org.dspace.core.Constants</code>
* @throws AuthorizeException if the user is denied * @throws AuthorizeException
* @throws SQLException if database error * Exception indicating the current user of the context does not have permission
* to perform a particular action.
* @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
public void authorizeAction(Context c, DSpaceObject o, int action, boolean useInheritance) public void authorizeAction(Context c, DSpaceObject o, int action, boolean useInheritance)
throws AuthorizeException, SQLException; throws AuthorizeException, SQLException;
@@ -93,8 +100,11 @@ public interface AuthorizeService {
* flag to say if ADMIN action on the current object or parent * flag to say if ADMIN action on the current object or parent
* object can be used * object can be used
* @param action action to perform from <code>org.dspace.core.Constants</code> * @param action action to perform from <code>org.dspace.core.Constants</code>
* @throws AuthorizeException if the user is denied * @throws AuthorizeException
* @throws SQLException if database error * Exception indicating the current user of the context does not have permission
* to perform a particular action.
* @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
public void authorizeAction(Context c, EPerson e, DSpaceObject o, int action, boolean useInheritance) public void authorizeAction(Context c, EPerson e, DSpaceObject o, int action, boolean useInheritance)
throws AuthorizeException, SQLException; throws AuthorizeException, SQLException;
@@ -109,7 +119,8 @@ public interface AuthorizeService {
* <code>org.dspace.core.Constants</code> * <code>org.dspace.core.Constants</code>
* @return {@code true} if the current user in the context is * @return {@code true} if the current user in the context is
* authorized to perform the given action on the given object * authorized to perform the given action on the given object
* @throws SQLException if database error * @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
public boolean authorizeActionBoolean(Context c, DSpaceObject o, int a) throws SQLException; public boolean authorizeActionBoolean(Context c, DSpaceObject o, int a) throws SQLException;
@@ -126,7 +137,8 @@ public interface AuthorizeService {
* object can be used * object can be used
* @return {@code true} if the current user in the context is * @return {@code true} if the current user in the context is
* authorized to perform the given action on the given object * authorized to perform the given action on the given object
* @throws SQLException if database error * @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
public boolean authorizeActionBoolean(Context c, DSpaceObject o, int a, boolean useInheritance) throws SQLException; public boolean authorizeActionBoolean(Context c, DSpaceObject o, int a, boolean useInheritance) throws SQLException;
@@ -144,7 +156,8 @@ public interface AuthorizeService {
* object can be used * object can be used
* @return {@code true} if the requested user is * @return {@code true} if the requested user is
* authorized to perform the given action on the given object * authorized to perform the given action on the given object
* @throws SQLException if database error * @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
public boolean authorizeActionBoolean(Context c, EPerson e, DSpaceObject o, int a, boolean useInheritance) throws SQLException; public boolean authorizeActionBoolean(Context c, EPerson e, DSpaceObject o, int a, boolean useInheritance) throws SQLException;
@@ -163,7 +176,8 @@ public interface AuthorizeService {
* method * method
* @return {@code true} if user has administrative privileges on the * @return {@code true} if user has administrative privileges on the
* given DSpace object * given DSpace object
* @throws SQLException if database error * @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
public boolean isAdmin(Context c, DSpaceObject o) throws SQLException; public boolean isAdmin(Context c, DSpaceObject o) throws SQLException;
@@ -176,7 +190,8 @@ public interface AuthorizeService {
* @param c current context * @param c current context
* @return {@code true} if user is an admin or ignore authorization * @return {@code true} if user is an admin or ignore authorization
* flag set * flag set
* @throws SQLException if database error * @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
public boolean isAdmin(Context c) throws SQLException; public boolean isAdmin(Context c) throws SQLException;
@@ -437,6 +452,7 @@ public interface AuthorizeService {
* specified object to the new action (toPolicy) * specified object to the new action (toPolicy)
* *
* @param context * @param context
* The relevant DSpace Context.
* @param dso * @param dso
* the dspace object * the dspace object
* @param fromAction * @param fromAction
@@ -444,7 +460,10 @@ public interface AuthorizeService {
* @param toAction * @param toAction
* the new action to set * the new action to set
* @throws SQLException * @throws SQLException
* An exception that provides information on a database access error or other errors.
* @throws AuthorizeException * @throws AuthorizeException
* Exception indicating the current user of the context does not have permission
* to perform a particular action.
*/ */
void switchPoliciesAction(Context context, DSpaceObject dso, int fromAction, int toAction) void switchPoliciesAction(Context context, DSpaceObject dso, int fromAction, int toAction)
throws SQLException, AuthorizeException; throws SQLException, AuthorizeException;

View File

@@ -155,6 +155,7 @@ public interface BrowseDAO
* to only items or values within items that appear in the given container. * to only items or values within items that appear in the given container.
* *
* @param containerID * @param containerID
* community/collection internal ID (UUID)
*/ */
public void setContainerID(UUID containerID); public void setContainerID(UUID containerID);
@@ -234,7 +235,7 @@ public interface BrowseDAO
* normal browse operations can be completed without it. The default is -1, which * normal browse operations can be completed without it. The default is -1, which
* means do not offset. * means do not offset.
* *
* @return the offset * @return paging offset
*/ */
public int getOffset(); public int getOffset();
@@ -245,6 +246,7 @@ public interface BrowseDAO
* means do not offset. * means do not offset.
* *
* @param offset * @param offset
* paging offset
*/ */
public void setOffset(int offset); public void setOffset(int offset);

View File

@@ -139,6 +139,7 @@ public class BrowseInfo
* set the number of metadata fields at which to truncate with "et al" * set the number of metadata fields at which to truncate with "et al"
* *
* @param etAl * @param etAl
* the number of metadata fields at which to truncate with "et al"
*/ */
public void setEtAl(int etAl) public void setEtAl(int etAl)
{ {

View File

@@ -67,7 +67,7 @@ public class DailyReportEmailer
public void sendReport(File attachment, int numberOfBitstreams) public void sendReport(File attachment, int numberOfBitstreams)
throws IOException, javax.mail.MessagingException throws IOException, javax.mail.MessagingException
{ {
if(numberOfBitstreams > 0) if (numberOfBitstreams > 0)
{ {
String hostname = ConfigurationManager.getProperty("dspace.hostname"); String hostname = ConfigurationManager.getProperty("dspace.hostname");
Email email = new Email(); Email email = new Email();
@@ -83,7 +83,6 @@ public class DailyReportEmailer
* Allows users to have email sent to them. The default is to send all * Allows users to have email sent to them. The default is to send all
* reports in one email * reports in one email
* *
* @param args
* <dl> * <dl>
* <dt>-h</dt> * <dt>-h</dt>
* <dd>help</dd> * <dd>help</dd>
@@ -99,6 +98,7 @@ public class DailyReportEmailer
* <dd>Send all reports in one email</dd> * <dd>Send all reports in one email</dd>
* </dl> * </dl>
* *
* @param args the command line arguments given
*/ */
public static void main(String[] args) public static void main(String[] args)
{ {
@@ -110,25 +110,17 @@ public class DailyReportEmailer
Options options = new Options(); Options options = new Options();
options.addOption("h", "help", false, "Help"); options.addOption("h", "help", false, "Help");
options options.addOption("d", "Deleted", false,
.addOption("d", "Deleted", false,
"Send E-mail report for all bitstreams set as deleted for today"); "Send E-mail report for all bitstreams set as deleted for today");
options options.addOption("m", "Missing", false,
.addOption("m", "Missing", false,
"Send E-mail report for all bitstreams not found in assetstore for today"); "Send E-mail report for all bitstreams not found in assetstore for today");
options options.addOption("c", "Changed", false,
.addOption(
"c",
"Changed",
false,
"Send E-mail report for all bitstreams where checksum has been changed for today"); "Send E-mail report for all bitstreams where checksum has been changed for today");
options.addOption("a", "All", false, "Send all E-mail reports"); options.addOption("a", "All", false,
"Send all E-mail reports");
options.addOption("u", "Unchecked", false, options.addOption("u", "Unchecked", false,
"Send the Unchecked bitstream report"); "Send the Unchecked bitstream report");
options.addOption("n", "Not Processed", false,
options
.addOption("n", "Not Processed", false,
"Send E-mail report for all bitstreams set to longer be processed for today"); "Send E-mail report for all bitstreams set to longer be processed for today");
try try
@@ -147,19 +139,11 @@ public class DailyReportEmailer
HelpFormatter myhelp = new HelpFormatter(); HelpFormatter myhelp = new HelpFormatter();
myhelp.printHelp("Checksum Reporter\n", options); myhelp.printHelp("Checksum Reporter\n", options);
System.out System.out.println("\nSend Deleted bitstream email report: DailyReportEmailer -d");
.println("\nSend Deleted bitstream email report: DailyReportEmailer -d"); System.out.println("\nSend Missing bitstreams email report: DailyReportEmailer -m");
System.out System.out.println("\nSend Checksum Changed email report: DailyReportEmailer -c");
.println("\nSend Missing bitstreams email report: DailyReportEmailer -m"); System.out.println("\nSend bitstream not to be processed email report: DailyReportEmailer -n");
System.out System.out.println("\nSend Un-checked bitstream report: DailyReportEmailer -u");
.println("\nSend Checksum Changed email report: DailyReportEmailer -c");
System.out
.println("\nSend bitstream not to be processed email report: DailyReportEmailer -n");
System.out
.println("\nSend Un-checked bitstream report: DailyReportEmailer -u");
System.out.println("\nSend All email reports: DailyReportEmailer"); System.out.println("\nSend All email reports: DailyReportEmailer");
System.exit(0); System.exit(0);
} }
@@ -208,27 +192,17 @@ public class DailyReportEmailer
if ((line.hasOption("a")) || (line.getOptions().length == 0)) if ((line.hasOption("a")) || (line.getOptions().length == 0))
{ {
writer writer.write("\n--------------------------------- Begin Reporting ------------------------\n\n");
.write("\n--------------------------------- Begin Reporting ------------------------\n\n"); numBitstreams += reporter.getDeletedBitstreamReport(context, yesterday, tomorrow, writer);
numBitstreams += reporter.getDeletedBitstreamReport(context, yesterday, writer.write("\n--------------------------------- Report Spacer ---------------------------\n\n");
tomorrow, writer); numBitstreams += reporter.getChangedChecksumReport(context, yesterday, tomorrow, writer);
writer writer.write("\n--------------------------------- Report Spacer ---------------------------\n\n");
.write("\n--------------------------------- Report Spacer ---------------------------\n\n"); numBitstreams += reporter.getBitstreamNotFoundReport(context, yesterday, tomorrow, writer);
numBitstreams += reporter.getChangedChecksumReport(context, yesterday, writer.write("\n--------------------------------- Report Spacer ---------------------------\n\n");
tomorrow, writer); numBitstreams += reporter.getNotToBeProcessedReport(context, yesterday, tomorrow, writer);
writer writer.write("\n--------------------------------- Report Spacer ---------------------------\n\n");
.write("\n--------------------------------- Report Spacer ---------------------------\n\n");
numBitstreams += reporter.getBitstreamNotFoundReport(context, yesterday,
tomorrow, writer);
writer
.write("\n--------------------------------- Report Spacer ---------------------------\n\n");
numBitstreams += reporter.getNotToBeProcessedReport(context, yesterday,
tomorrow, writer);
writer
.write("\n--------------------------------- Report Spacer ---------------------------\n\n");
numBitstreams += reporter.getUncheckedBitstreamsReport(context, writer); numBitstreams += reporter.getUncheckedBitstreamsReport(context, writer);
writer writer.write("\n--------------------------------- End Report ---------------------------\n\n");
.write("\n--------------------------------- End Report ---------------------------\n\n");
writer.flush(); writer.flush();
writer.close(); writer.close();
emailer.sendReport(report, numBitstreams); emailer.sendReport(report, numBitstreams);
@@ -237,8 +211,7 @@ public class DailyReportEmailer
{ {
if (line.hasOption("d")) if (line.hasOption("d"))
{ {
writer writer.write("\n--------------------------------- Begin Reporting ------------------------\n\n");
.write("\n--------------------------------- Begin Reporting ------------------------\n\n");
numBitstreams += reporter.getDeletedBitstreamReport(context, numBitstreams += reporter.getDeletedBitstreamReport(context,
yesterday, tomorrow, writer); yesterday, tomorrow, writer);
writer.flush(); writer.flush();
@@ -248,8 +221,7 @@ public class DailyReportEmailer
if (line.hasOption("m")) if (line.hasOption("m"))
{ {
writer writer.write("\n--------------------------------- Begin Reporting ------------------------\n\n");
.write("\n--------------------------------- Begin Reporting ------------------------\n\n");
numBitstreams += reporter.getBitstreamNotFoundReport(context, numBitstreams += reporter.getBitstreamNotFoundReport(context,
yesterday, tomorrow, writer); yesterday, tomorrow, writer);
writer.flush(); writer.flush();
@@ -259,8 +231,7 @@ public class DailyReportEmailer
if (line.hasOption("c")) if (line.hasOption("c"))
{ {
writer writer.write("\n--------------------------------- Begin Reporting ------------------------\n\n");
.write("\n--------------------------------- Begin Reporting ------------------------\n\n");
numBitstreams += reporter.getChangedChecksumReport(context, numBitstreams += reporter.getChangedChecksumReport(context,
yesterday, tomorrow, writer); yesterday, tomorrow, writer);
writer.flush(); writer.flush();
@@ -270,8 +241,7 @@ public class DailyReportEmailer
if (line.hasOption("n")) if (line.hasOption("n"))
{ {
writer writer.write("\n--------------------------------- Begin Reporting ------------------------\n\n");
.write("\n--------------------------------- Begin Reporting ------------------------\n\n");
numBitstreams += reporter.getNotToBeProcessedReport(context, numBitstreams += reporter.getNotToBeProcessedReport(context,
yesterday, tomorrow, writer); yesterday, tomorrow, writer);
writer.flush(); writer.flush();
@@ -281,8 +251,7 @@ public class DailyReportEmailer
if (line.hasOption("u")) if (line.hasOption("u"))
{ {
writer writer.write("\n--------------------------------- Begin Reporting ------------------------\n\n");
.write("\n--------------------------------- Begin Reporting ------------------------\n\n");
numBitstreams += reporter numBitstreams += reporter
.getUncheckedBitstreamsReport(context, writer); .getUncheckedBitstreamsReport(context, writer);
writer.flush(); writer.flush();
@@ -294,9 +263,10 @@ public class DailyReportEmailer
catch (MessagingException | SQLException | IOException e) catch (MessagingException | SQLException | IOException e)
{ {
log.fatal(e); log.fatal(e);
} finally }
finally
{ {
if(context != null && context.isValid()) if (context != null && context.isValid())
{ {
context.abort(); context.abort();
} }

View File

@@ -30,8 +30,11 @@ public interface ChecksumHistoryDAO extends GenericDAO<ChecksumHistory> {
* the specified result code. * the specified result code.
* *
* @param context * @param context
* @param retentionDate row must be older than this to be deleted. * The relevant DSpace Context.
* @param checksumResultCode row must have this result to be deleted. * @param retentionDate
* row must be older than this to be deleted.
* @param checksumResultCode
* row must have this result to be deleted.
* @return number of rows deleted. * @return number of rows deleted.
* @throws SQLException if database error * @throws SQLException if database error
*/ */
@@ -41,7 +44,9 @@ public interface ChecksumHistoryDAO extends GenericDAO<ChecksumHistory> {
* Delete all ChecksumHistory rows for the given Bitstream. * Delete all ChecksumHistory rows for the given Bitstream.
* *
* @param context * @param context
* The relevant DSpace Context.
* @param bitstream * @param bitstream
* which bitstream's checksums to delete
* @throws SQLException if database error * @throws SQLException if database error
*/ */
public void deleteByBitstream(Context context, Bitstream bitstream) throws SQLException; public void deleteByBitstream(Context context, Bitstream bitstream) throws SQLException;

View File

@@ -345,6 +345,7 @@ public class Bitstream extends DSpaceObject implements DSpaceObjectLegacySupport
* bitstream is uncertain, and the format is set to "unknown." * bitstream is uncertain, and the format is set to "unknown."
* *
* @param context * @param context
* The relevant DSpace Context.
* @param desc * @param desc
* the user's description of the format * the user's description of the format
* @throws SQLException if database error * @throws SQLException if database error

View File

@@ -379,12 +379,13 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
* Get the value of a metadata field * Get the value of a metadata field
* *
* @param collection * @param collection
* which collection to operate on
* @param field * @param field
* the name of the metadata field to get * the name of the metadata field to get
* *
* @return the value of the metadata field * @return the value of the metadata field
* *
* @exception IllegalArgumentException * @throws IllegalArgumentException
* if the requested metadata field doesn't exist * if the requested metadata field doesn't exist
*/ */
@Override @Override

View File

@@ -594,7 +594,6 @@ public class DCDate
* Get a date representing the current instant in time. * Get a date representing the current instant in time.
* *
* @return a DSpaceDate object representing the current instant. * @return a DSpaceDate object representing the current instant.
*/ */
public static DCDate getCurrent() public static DCDate getCurrent()
{ {
@@ -607,9 +606,8 @@ public class DCDate
* *
* @param m * @param m
* the month number * the month number
*
* @param locale * @param locale
* * which locale to render the month name in
* @return the month name. * @return the month name.
*/ */
public static String getMonthName(int m, Locale locale) public static String getMonthName(int m, Locale locale)

View File

@@ -149,8 +149,8 @@ public class ItemComparator implements Comparator, Serializable
} }
/** /**
* @param first * @param first first operand
* @param second * @param second second operand
* @return true if the first string is equal to the second. Either or both * @return true if the first string is equal to the second. Either or both
* may be null. * may be null.
*/ */
@@ -224,7 +224,8 @@ public class ItemComparator implements Comparator, Serializable
/** /**
* Normalize the title of a Metadatum. * Normalize the title of a Metadatum.
* @param value *
* @param value metadata value
* @return normalized title * @return normalized title
*/ */
protected String normalizeTitle(MetadataValue value) protected String normalizeTitle(MetadataValue value)

View File

@@ -932,10 +932,13 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
/** /**
* Check if the item is an inprogress submission * Check if the item is an inprogress submission
*
* @param context * @param context
* @param item * The relevant DSpace Context.
* @param item item to check
* @return <code>true</code> if the item is an inprogress submission, i.e. a WorkspaceItem or WorkflowItem * @return <code>true</code> if the item is an inprogress submission, i.e. a WorkspaceItem or WorkflowItem
* @throws SQLException * @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
public boolean isInProgressSubmission(Context context, Item item) throws SQLException { public boolean isInProgressSubmission(Context context, Item item) throws SQLException {
return workspaceItemService.findByItem(context, item) != null return workspaceItemService.findByItem(context, item) != null
@@ -943,7 +946,7 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
} }
/* /*
With every finished submission a bunch of resource policy entries with have null value for the dspace_object column are generated in the database. With every finished submission a bunch of resource policy entries which have null value for the dspace_object column are generated in the database.
prevent the generation of resource policy entry values with null dspace_object as value prevent the generation of resource policy entry values with null dspace_object as value
*/ */
@@ -952,10 +955,16 @@ prevent the generation of resource policy entry values with null dspace_object a
* Add the default policies, which have not been already added to the given DSpace object * Add the default policies, which have not been already added to the given DSpace object
* *
* @param context * @param context
* The relevant DSpace Context.
* @param dso * @param dso
* The DSpace Object to add policies to
* @param defaultCollectionPolicies * @param defaultCollectionPolicies
* list of policies
* @throws SQLException * @throws SQLException
* An exception that provides information on a database access error or other errors.
* @throws AuthorizeException * @throws AuthorizeException
* Exception indicating the current user of the context does not have permission
* to perform a particular action.
*/ */
protected void addDefaultPoliciesNotInPlace(Context context, DSpaceObject dso, List<ResourcePolicy> defaultCollectionPolicies) throws SQLException, AuthorizeException protected void addDefaultPoliciesNotInPlace(Context context, DSpaceObject dso, List<ResourcePolicy> defaultCollectionPolicies) throws SQLException, AuthorizeException
{ {
@@ -983,8 +992,12 @@ prevent the generation of resource policy entry values with null dspace_object a
* @param value field value or Item.ANY to match any value * @param value field value or Item.ANY to match any value
* @return an iterator over the items matching that authority value * @return an iterator over the items matching that authority value
* @throws SQLException if database error * @throws SQLException if database error
* An exception that provides information on a database access error or other errors.
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error
* Exception indicating the current user of the context does not have permission
* to perform a particular action.
* @throws IOException if IO error * @throws IOException if IO error
* A general class of exceptions produced by failed or interrupted I/O operations.
* *
*/ */
@Override @Override

View File

@@ -57,10 +57,15 @@ public class LicenseUtils
* LicenseArgumentFormatter based on his type (map key) * LicenseArgumentFormatter based on his type (map key)
* *
* @param locale * @param locale
* Formatter locale
* @param collection * @param collection
* collection to get license from
* @param item * @param item
* the item object of the license
* @param eperson * @param eperson
* EPerson to get firstname, lastname and email from
* @param additionalInfo * @param additionalInfo
* additional template arguments beyond 0-6
* @return the license text obtained substituting the provided argument in * @return the license text obtained substituting the provided argument in
* the license template * the license template
*/ */
@@ -104,9 +109,13 @@ public class LicenseUtils
* supplying {@code null} for the additionalInfo argument) * supplying {@code null} for the additionalInfo argument)
* *
* @param locale * @param locale
* Formatter locale
* @param collection * @param collection
* collection to get license from
* @param item * @param item
* the item object of the license
* @param eperson * @param eperson
* EPerson to get firstname, lastname and email from
* @return the license text, with no custom substitutions. * @return the license text, with no custom substitutions.
*/ */
public static String getLicenseText(Locale locale, Collection collection, public static String getLicenseText(Locale locale, Collection collection,

View File

@@ -27,6 +27,7 @@ public class NonUniqueMetadataException extends Exception
* Create an exception with only a message * Create an exception with only a message
* *
* @param message * @param message
* message string
*/ */
public NonUniqueMetadataException(String message) public NonUniqueMetadataException(String message)
{ {

View File

@@ -57,9 +57,24 @@ public class CrosswalkMetadataValidator {
/** /**
* Scans metadata for elements not defined in this DSpace instance. It then takes action based * Scans metadata for elements not defined in this DSpace instance. It then takes action based
* on a configurable parameter (fail, ignore, add). * on a configurable parameter (fail, ignore, add).
*
* @param context
* The relevant DSpace Context.
* @param schema metadata field schema
* @param element metadata field element
* @param qualifier metadata field qualifier
* @param forceCreate if true, force addinga schema or metadata field
* @return metadata field
* @throws SQLException
* An exception that provides information on a database access error or other errors.
* @throws AuthorizeException
* Exception indicating the current user of the context does not have permission
* to perform a particular action.
* @throws CrosswalkException
* Superclass for more-specific crosswalk exceptions.
*/ */
public MetadataField checkMetadata(Context context, String schema, String element, String qualifier, boolean forceCreate) throws SQLException, AuthorizeException, CrosswalkException { public MetadataField checkMetadata(Context context, String schema, String element, String qualifier, boolean forceCreate) throws SQLException, AuthorizeException, CrosswalkException {
if(!validatedBefore(schema, element, qualifier)) { if (!validatedBefore(schema, element, qualifier)) {
// Verify that the schema exists // Verify that the schema exists
MetadataSchema mdSchema = metadataSchemaService.find(context, schema); MetadataSchema mdSchema = metadataSchemaService.find(context, schema);
MetadataField mdField = null; MetadataField mdField = null;

View File

@@ -402,9 +402,13 @@ public class METSRightsCrosswalk
* Ingest a whole XML document, starting at specified root. * Ingest a whole XML document, starting at specified root.
* *
* @param context * @param context
* The relevant DSpace Context.
* @param dso * @param dso
* DSpace object to ingest
* @param root * @param root
* root element
* @param createMissingMetadataFields * @param createMissingMetadataFields
* whether to create missing fields
* @throws CrosswalkException if crosswalk error * @throws CrosswalkException if crosswalk error
* @throws IOException if IO error * @throws IOException if IO error
* @throws SQLException if database error * @throws SQLException if database error

View File

@@ -311,7 +311,7 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
/** /**
* Returns object's metadata in MODS format, as List of XML structure nodes. * Returns object's metadata in MODS format, as List of XML structure nodes.
* @param context context * @param context context
* @throws org.dspace.content.crosswalk.CrosswalkException * @throws CrosswalkException if crosswalk error
* @throws IOException if IO error * @throws IOException if IO error
* @throws SQLException if database error * @throws SQLException if database error
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error

View File

@@ -32,6 +32,7 @@ public interface ParameterizedDisseminationCrosswalk
* <p> * <p>
* *
* @param context * @param context
* The relevant DSpace Context.
* @param dso the DSpace Object whose metadata to export. * @param dso the DSpace Object whose metadata to export.
* @param parameters * @param parameters
* names and values of parameters to be passed into the transform. * names and values of parameters to be passed into the transform.

View File

@@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory;
* Configurable XSLT-driven dissemination Crosswalk * Configurable XSLT-driven dissemination Crosswalk
* <p> * <p>
* See the XSLTCrosswalk superclass for details on configuration. * See the XSLTCrosswalk superclass for details on configuration.
* <p> * </p>
* <h3>Additional Configuration of Dissemination crosswalk:</h3> * <h3>Additional Configuration of Dissemination crosswalk:</h3>
* The disseminator also needs to be configured with an XML Namespace * The disseminator also needs to be configured with an XML Namespace
* (including prefix and URI) and an XML Schema for output format. This * (including prefix and URI) and an XML Schema for output format. This
@@ -524,7 +524,8 @@ public class XSLTDisseminationCrosswalk
/** /**
* Simple command-line rig for testing the DIM output of a stylesheet. * Simple command-line rig for testing the DIM output of a stylesheet.
* Usage: {@code java XSLTDisseminationCrosswalk <crosswalk-name> <handle> [output-file]} * Usage: {@code java XSLTDisseminationCrosswalk <crosswalk-name> <handle> [output-file]}
* @param argv arguments *
* @param argv the command line arguments given
* @throws Exception if error * @throws Exception if error
*/ */
public static void main(String[] argv) throws Exception public static void main(String[] argv) throws Exception

View File

@@ -293,7 +293,8 @@ public class XSLTIngestionCrosswalk
/** /**
* Simple command-line rig for testing the DIM output of a stylesheet. * Simple command-line rig for testing the DIM output of a stylesheet.
* Usage: {@code java XSLTIngestionCrosswalk <crosswalk-name> <input-file>} * Usage: {@code java XSLTIngestionCrosswalk <crosswalk-name> <input-file>}
* @param argv arguments *
* @param argv the command line arguments given
* @throws Exception if error * @throws Exception if error
*/ */
public static void main(String[] argv) throws Exception public static void main(String[] argv) throws Exception

View File

@@ -15,7 +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> * @param <T> some implementation of DSpaceObject
*/ */
public interface DSpaceObjectDAO<T extends DSpaceObject> extends GenericDAO<T> { public interface DSpaceObjectDAO<T extends DSpaceObject> extends GenericDAO<T> {
} }

View File

@@ -17,7 +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> * @param <T> some implementation of DSpaceObject
*/ */
public interface DSpaceObjectLegacySupportDAO<T extends DSpaceObject> extends DSpaceObjectDAO<T> { public interface DSpaceObjectLegacySupportDAO<T extends DSpaceObject> extends DSpaceObjectDAO<T> {

View File

@@ -106,6 +106,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
protected final WorkspaceItemService workspaceItemService = ContentServiceFactory.getInstance().getWorkspaceItemService(); protected final WorkspaceItemService workspaceItemService = ContentServiceFactory.getInstance().getWorkspaceItemService();
/** /**
* <p>
* An instance of ZipMdrefManager holds the state needed to retrieve the * An instance of ZipMdrefManager holds the state needed to retrieve the
* contents of an external metadata stream referenced by an * contents of an external metadata stream referenced by an
* <code>mdRef</code> element in a Zipped up METS manifest. * <code>mdRef</code> element in a Zipped up METS manifest.
@@ -244,7 +245,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
license); license);
//if ingestion was successful //if ingestion was successful
if(dso!=null) if (dso!=null)
{ {
// Log whether we finished an ingest (create new obj) or a restore // Log whether we finished an ingest (create new obj) or a restore
// (restore previously existing obj) // (restore previously existing obj)
@@ -338,7 +339,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
// Retrieve the manifest file entry (named mets.xml) // Retrieve the manifest file entry (named mets.xml)
ZipEntry manifestEntry = zip.getEntry(METSManifest.MANIFEST_FILE); ZipEntry manifestEntry = zip.getEntry(METSManifest.MANIFEST_FILE);
if(manifestEntry!=null) if (manifestEntry!=null)
{ {
// parse the manifest and sanity-check it. // parse the manifest and sanity-check it.
manifest = METSManifest.create(zip.getInputStream(manifestEntry), manifest = METSManifest.create(zip.getInputStream(manifestEntry),
@@ -404,7 +405,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
catch(UnsupportedOperationException e) catch(UnsupportedOperationException e)
{ {
//If user specified to skip item ingest if any "missing parent" error message occur //If user specified to skip item ingest if any "missing parent" error message occur
if(params.getBooleanProperty("skipIfParentMissing", false)) if (params.getBooleanProperty("skipIfParentMissing", false))
{ {
//log a warning instead of throwing an error //log a warning instead of throwing an error
log.warn(LogManager.getHeader(context, "package_ingest", log.warn(LogManager.getHeader(context, "package_ingest",
@@ -518,7 +519,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
// Finally, if item is still in the workspace, then we actually need // Finally, if item is still in the workspace, then we actually need
// to install it into the archive & assign its handle. // to install it into the archive & assign its handle.
if(wsi!=null) if (wsi!=null)
{ {
// Finish creating the item. This actually assigns the handle, // Finish creating the item. This actually assigns the handle,
// and will either install item immediately or start a workflow, based on params // and will either install item immediately or start a workflow, based on params
@@ -531,7 +532,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
// Add logo if one is referenced from manifest // Add logo if one is referenced from manifest
addContainerLogo(context, dso, manifest, pkgFile, params); addContainerLogo(context, dso, manifest, pkgFile, params);
if(type==Constants.COLLECTION) if (type==Constants.COLLECTION)
{ {
//Add template item if one is referenced from manifest (only for Collections) //Add template item if one is referenced from manifest (only for Collections)
addTemplateItem(context, dso, manifest, pkgFile, params, callback); addTemplateItem(context, dso, manifest, pkgFile, params, callback);
@@ -670,11 +671,11 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
// have subclass manage license since it may be extra package file. // have subclass manage license since it may be extra package file.
Collection owningCollection = (Collection) ContentServiceFactory.getInstance().getDSpaceObjectService(dso).getParentObject(context, dso); Collection owningCollection = (Collection) ContentServiceFactory.getInstance().getDSpaceObjectService(dso).getParentObject(context, dso);
if(owningCollection == null) if (owningCollection == null)
{ {
//We are probably dealing with an item that isn't archived yet //We are probably dealing with an item that isn't archived yet
InProgressSubmission inProgressSubmission = workspaceItemService.findByItem(context, item); InProgressSubmission inProgressSubmission = workspaceItemService.findByItem(context, item);
if(inProgressSubmission == null) if (inProgressSubmission == null)
{ {
inProgressSubmission = WorkflowServiceFactory.getInstance().getWorkflowItemService().findByItem(context, item); inProgressSubmission = WorkflowServiceFactory.getInstance().getWorkflowItemService().findByItem(context, item);
} }
@@ -817,7 +818,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
// Set bitstream sequence id, if known // Set bitstream sequence id, if known
String seqID = mfile.getAttributeValue("SEQ"); String seqID = mfile.getAttributeValue("SEQ");
if(seqID!=null && !seqID.isEmpty()) if (seqID!=null && !seqID.isEmpty())
bitstream.setSequenceID(Integer.parseInt(seqID)); bitstream.setSequenceID(Integer.parseInt(seqID));
// crosswalk this bitstream's administrative metadata located in // crosswalk this bitstream's administrative metadata located in
@@ -1044,7 +1045,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
CrosswalkException, PackageValidationException CrosswalkException, PackageValidationException
{ {
//Template items only valid for collections //Template items only valid for collections
if(dso.getType()!=Constants.COLLECTION) if (dso.getType()!=Constants.COLLECTION)
return; return;
Collection collection = (Collection) dso; Collection collection = (Collection) dso;
@@ -1052,18 +1053,18 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
//retrieve list of all <div>s representing child objects from manifest //retrieve list of all <div>s representing child objects from manifest
List childObjList = manifest.getChildObjDivs(); List childObjList = manifest.getChildObjDivs();
if(childObjList!=null && !childObjList.isEmpty()) if (childObjList!=null && !childObjList.isEmpty())
{ {
Element templateItemDiv = null; Element templateItemDiv = null;
Iterator childIterator = childObjList.iterator(); Iterator childIterator = childObjList.iterator();
//Search for the child with a type of "DSpace ITEM Template" //Search for the child with a type of "DSpace ITEM Template"
while(childIterator.hasNext()) while (childIterator.hasNext())
{ {
Element childDiv = (Element) childIterator.next(); Element childDiv = (Element) childIterator.next();
String childType = childDiv.getAttributeValue("TYPE"); String childType = childDiv.getAttributeValue("TYPE");
//should be the only child of type "ITEM" with "Template" for a suffix //should be the only child of type "ITEM" with "Template" for a suffix
if(childType.contains(Constants.typeText[Constants.ITEM]) && if (childType.contains(Constants.typeText[Constants.ITEM]) &&
childType.endsWith(AbstractMETSDisseminator.TEMPLATE_TYPE_SUFFIX)) childType.endsWith(AbstractMETSDisseminator.TEMPLATE_TYPE_SUFFIX))
{ {
templateItemDiv = childDiv; templateItemDiv = childDiv;
@@ -1072,11 +1073,11 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
} }
//If an Template Item was found, create it with the specified metadata //If an Template Item was found, create it with the specified metadata
if(templateItemDiv!=null) if (templateItemDiv!=null)
{ {
//make sure this templateItemDiv is associated with one or more dmdSecs //make sure this templateItemDiv is associated with one or more dmdSecs
String templateDmdIds = templateItemDiv.getAttributeValue("DMDID"); String templateDmdIds = templateItemDiv.getAttributeValue("DMDID");
if(templateDmdIds!=null) if (templateDmdIds!=null)
{ {
//create our template item & get a reference to it //create our template item & get a reference to it
itemService.createTemplateItem(context, collection); itemService.createTemplateItem(context, collection);
@@ -1193,7 +1194,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
null); null);
//if ingestion was successful //if ingestion was successful
if(dso!=null) if (dso!=null)
{ {
// Log that we created an object // Log that we created an object
log.info(LogManager.getHeader(context, "package_replace", log.info(LogManager.getHeader(context, "package_replace",
@@ -1222,7 +1223,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
} }
//if ingest/restore/replace successful //if ingest/restore/replace successful
if(dso!=null) if (dso!=null)
{ {
// Check if the Packager is currently running recursively. // Check if the Packager is currently running recursively.
// If so, this means the Packager will attempt to recursively // If so, this means the Packager will attempt to recursively
@@ -1547,14 +1548,16 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
* *
* @param context the DSpace context * @param context the DSpace context
* @param dso DSpace Object * @param dso DSpace Object
* @param manifest the METSManifest * @param manifest
* the METSManifest
* @param callback * @param callback
* the MdrefManager (manages all external metadata files * the MdrefManager (manages all external metadata files
* referenced by METS <code>mdref</code> elements) * referenced by METS <code>mdref</code> elements)
* @param dmds * @param dmds
* array of Elements, each a METS <code>dmdSec</code> that * array of Elements, each a METS <code>dmdSec</code> that
* applies to the Item as a whole. * applies to the Item as a whole.
* @param params * @param params
* Packager Parameters
* @throws CrosswalkException if crosswalk error * @throws CrosswalkException if crosswalk error
* @throws PackageValidationException if package validation error * @throws PackageValidationException if package validation error
* @throws IOException if IO error * @throws IOException if IO error
@@ -1590,6 +1593,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
* @param license * @param license
* optional user-supplied Deposit License text (may be null) * optional user-supplied Deposit License text (may be null)
* @param params * @param params
* Packager Parameters
* @throws PackageValidationException if package validation error * @throws PackageValidationException if package validation error
* @throws IOException if IO error * @throws IOException if IO error
* @throws SQLException if database error * @throws SQLException if database error

View File

@@ -454,6 +454,7 @@ public class DSpaceAIPDisseminator extends AbstractMETSDisseminator
* @throws IOException if IO error * @throws IOException if IO error
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error
* @throws MetsException * @throws MetsException
* METS Java toolkit exception class.
*/ */
@Override @Override
public void addStructMap(Context context, DSpaceObject dso, public void addStructMap(Context context, DSpaceObject dso,

View File

@@ -95,6 +95,21 @@ public class DSpaceAIPIngester
* 3. If (1) or (2) succeeds, crosswalk it and ignore all other DMDs with * 3. If (1) or (2) succeeds, crosswalk it and ignore all other DMDs with
* same GROUPID<br> * same GROUPID<br>
* 4. Crosswalk remaining DMDs not eliminated already. * 4. Crosswalk remaining DMDs not eliminated already.
*
* @param context
* The relevant DSpace Context.
* @param dso
* DSpace object
* @param manifest
* the METSManifest
* @param callback
* the MdrefManager (manages all external metadata files
* referenced by METS <code>mdref</code> elements)
* @param dmds
* array of Elements, each a METS <code>dmdSec</code> that
* applies to the Item as a whole.
* @param params
* Packager Parameters
* @throws PackageValidationException validation error * @throws PackageValidationException validation error
* @throws CrosswalkException if crosswalk error * @throws CrosswalkException if crosswalk error
* @throws IOException if IO error * @throws IOException if IO error
@@ -198,6 +213,15 @@ public class DSpaceAIPIngester
* license supplied by explicit argument next, else use collection's * license supplied by explicit argument next, else use collection's
* default deposit license. * default deposit license.
* Normally the rightsMD crosswalks should provide a license. * Normally the rightsMD crosswalks should provide a license.
*
* @param context
* The relevant DSpace Context.
* @param item
* item to add license to
* @param collection
* collection to get the default license from
* @param params
* Packager Parameters
* @throws PackageValidationException validation error * @throws PackageValidationException validation error
* @throws IOException if IO error * @throws IOException if IO error
* @throws SQLException if database error * @throws SQLException if database error
@@ -211,7 +235,7 @@ public class DSpaceAIPIngester
{ {
boolean newLicense = false; boolean newLicense = false;
if(!params.restoreModeEnabled()) if (!params.restoreModeEnabled())
{ {
//AIP is not being restored/replaced, so treat it like a SIP -- every new SIP needs a new license //AIP is not being restored/replaced, so treat it like a SIP -- every new SIP needs a new license
newLicense = true; newLicense = true;
@@ -225,7 +249,7 @@ public class DSpaceAIPIngester
newLicense = true; newLicense = true;
} }
if(newLicense) if (newLicense)
{ {
PackageUtils.addDepositLicense(context, license, item, collection); PackageUtils.addDepositLicense(context, license, item, collection);
} }
@@ -233,19 +257,30 @@ public class DSpaceAIPIngester
/** /**
* Last change to fix up a DSpace Object. * Last change to fix up a DSpace Object.
* <P> * <p>
* For AIPs, if the object is an Item, we may want to make sure all of its * For AIPs, if the object is an Item, we may want to make sure all of its
* metadata fields already exist in the database (otherwise, the database * metadata fields already exist in the database (otherwise, the database
* will throw errors when we attempt to save/update the Item) * will throw errors when we attempt to save/update the Item)
* </p>
* *
* @param context DSpace Context * @param context
* @param dso DSpace object * The relevant DSpace Context.
* @param params Packager Parameters * @param dso
* @throws org.dspace.content.packager.PackageValidationException * DSpace object
* @throws java.sql.SQLException * @param params
* @throws org.dspace.content.crosswalk.CrosswalkException * Packager Parameters
* @throws java.io.IOException * @throws PackageValidationException
* @throws org.dspace.authorize.AuthorizeException * Failure when importing or exporting a package
* caused by invalid unacceptable package format or contents
* @throws CrosswalkException
* Superclass for more-specific crosswalk exceptions.
* @throws IOException
* A general class of exceptions produced by failed or interrupted I/O operations.
* @throws SQLException
* An exception that provides information on a database access error or other errors.
* @throws AuthorizeException
* Exception indicating the current user of the context does not have permission
* to perform a particular action.
*/ */
@Override @Override
public void finishObject(Context context, DSpaceObject dso, PackageParameters params) public void finishObject(Context context, DSpaceObject dso, PackageParameters params)
@@ -253,7 +288,7 @@ public class DSpaceAIPIngester
AuthorizeException, SQLException, IOException AuthorizeException, SQLException, IOException
{ {
//Metadata fields are now required before adding, so this logic isn't needed anymore //Metadata fields are now required before adding, so this logic isn't needed anymore
/*if(dso.getType()==Constants.ITEM) /*if (dso.getType()==Constants.ITEM)
{ {
// Check if 'createMetadataFields' option is enabled (default=true) // Check if 'createMetadataFields' option is enabled (default=true)
// This defaults to true as by default we should attempt to restore as much metadata as we can. // This defaults to true as by default we should attempt to restore as much metadata as we can.

View File

@@ -8,15 +8,18 @@
package org.dspace.content.packager; package org.dspace.content.packager;
/** /**
* <p>
* This represents a failure when importing or exporting a package * This represents a failure when importing or exporting a package
* caused by invalid unacceptable package format or contents; for * caused by invalid unacceptable package format or contents; for
* example, missing files that were mentioned in the manifest, or * example, missing files that were mentioned in the manifest, or
* extra files not in manifest, or lack of a manifest. * extra files not in manifest, or lack of a manifest.
* </p>
* <p> * <p>
* When throwing a PackageValidationException, be sure the message * When throwing a PackageValidationException, be sure the message
* includes enough specific information to let the end user diagnose * includes enough specific information to let the end user diagnose
* the problem, i.e. what files appear to be missing from the manifest * the problem, i.e. what files appear to be missing from the manifest
* or package, or the details of a checksum error on a file. * or package, or the details of a checksum error on a file.
* </p>
* *
* @author Larry Stone * @author Larry Stone
* @version $Revision$ * @version $Revision$

View File

@@ -430,6 +430,7 @@ public class RoleIngester implements PackageIngester
* @param context DSpace Context * @param context DSpace Context
* @param parent the Parent DSpaceObject * @param parent the Parent DSpaceObject
* @param params package params * @param params package params
* @param stream input stream with the roles
* @throws PackageException if packaging error * @throws PackageException if packaging error
* @throws SQLException if database error * @throws SQLException if database error
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error

View File

@@ -77,8 +77,11 @@ public interface CollectionService extends DSpaceObjectService<Collection>, DSpa
/** /**
* Get all collections in the system. Adds support for limit and offset. * Get all collections in the system. Adds support for limit and offset.
* @param context * @param context
* The relevant DSpace Context.
* @param limit * @param limit
* paging limit
* @param offset * @param offset
* paging offset
* @return List of Collections * @return List of Collections
* @throws SQLException if database error * @throws SQLException if database error
*/ */

View File

@@ -104,7 +104,7 @@ public interface CommunityService extends DSpaceObjectService<Community>, DSpace
* *
* @return the value of the metadata field * @return the value of the metadata field
* *
* @exception IllegalArgumentException * @throws IllegalArgumentException
* if the requested metadata field doesn't exist * if the requested metadata field doesn't exist
* @deprecated * @deprecated
*/ */
@@ -123,9 +123,9 @@ public interface CommunityService extends DSpaceObjectService<Community>, DSpace
* @param value * @param value
* value to set the field to * value to set the field to
* *
* @exception IllegalArgumentException * @throws IllegalArgumentException
* if the requested metadata field doesn't exist * if the requested metadata field doesn't exist
* @exception java.util.MissingResourceException * @throws MissingResourceException if resource missing
* @throws SQLException if database error * @throws SQLException if database error
* @deprecated * @deprecated
*/ */
@@ -192,7 +192,12 @@ public interface CommunityService extends DSpaceObjectService<Community>, DSpace
/** /**
* Return an array of parent communities of this collection. * Return an array of parent communities of this collection.
* *
* @param context
* The relevant DSpace Context.
* @param collection
* collection to check
* @return an array of parent communities * @return an array of parent communities
* @throws SQLException if database error
*/ */
public List<Community> getAllParents(Context context, Collection collection) throws SQLException; public List<Community> getAllParents(Context context, Collection collection) throws SQLException;

View File

@@ -181,7 +181,7 @@ public interface DSpaceObjectService<T extends DSpaceObject> {
* *
* @return the value of the metadata field (or null if the column is an SQL NULL) * @return the value of the metadata field (or null if the column is an SQL NULL)
* *
* @exception IllegalArgumentException * @throws IllegalArgumentException
* if the requested metadata field doesn't exist * if the requested metadata field doesn't exist
*/ */
public String getMetadata(T dSpaceObject, String value); public String getMetadata(T dSpaceObject, String value);

View File

@@ -53,7 +53,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* *
* @param context DSpace context object * @param context DSpace context object
* @param collection Collection (parent) * @param collection Collection (parent)
* @return Item * @return empty template item for this collection
* @throws SQLException if database error * @throws SQLException if database error
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error
*/ */
@@ -96,8 +96,10 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
/** /**
* Retrieve the list of items submitted by eperson, ordered by recently submitted, optionally limitable * Retrieve the list of items submitted by eperson, ordered by recently submitted, optionally limitable
* @param context context *
* @param eperson eperson * @param context DSpace context object
* @param eperson
* the submitter
* @param limit a positive integer to limit, -1 or null for unlimited * @param limit a positive integer to limit, -1 or null for unlimited
* @return an iterator over the items submitted by eperson * @return an iterator over the items submitted by eperson
* @throws SQLException if database error * @throws SQLException if database error
@@ -128,7 +130,8 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
/** /**
* Get all Items installed or withdrawn, discoverable, and modified since a Date. * Get all Items installed or withdrawn, discoverable, and modified since a Date.
* @param context context *
* @param context DSpace context object
* @param since earliest interesting last-modified date, or null for no date test. * @param since earliest interesting last-modified date, or null for no date test.
* @return an iterator over the items in the collection. * @return an iterator over the items in the collection.
* @throws SQLException if database error * @throws SQLException if database error
@@ -148,7 +151,8 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
/** /**
* See whether this Item is contained by a given Collection. * See whether this Item is contained by a given Collection.
* @param item Item *
* @param item item to check
* @param collection Collection (parent * @param collection Collection (parent
* @return true if {@code collection} contains this Item. * @return true if {@code collection} contains this Item.
* @throws SQLException if database error * @throws SQLException if database error
@@ -161,7 +165,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* communities of the owning collections. * communities of the owning collections.
* *
* @param context DSpace context object * @param context DSpace context object
* @param item Item * @param item item to check
* @return the communities this item is in. * @return the communities this item is in.
* @throws SQLException if database error * @throws SQLException if database error
*/ */
@@ -171,7 +175,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
/** /**
* Get the bundles matching a bundle name (name corresponds roughly to type) * Get the bundles matching a bundle name (name corresponds roughly to type)
* *
* @param item Item * @param item item to check
* @param name * @param name
* name of bundle (ORIGINAL/TEXT/THUMBNAIL) * name of bundle (ORIGINAL/TEXT/THUMBNAIL)
* @throws SQLException if database error * @throws SQLException if database error
@@ -184,7 +188,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* Add an existing bundle to this item. This has immediate effect. * Add an existing bundle to this item. This has immediate effect.
* *
* @param context DSpace context object * @param context DSpace context object
* @param item Item * @param item item to add the bundle to
* @param bundle * @param bundle
* the bundle to add * the bundle to add
* @throws SQLException if database error * @throws SQLException if database error
@@ -210,9 +214,10 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
/** /**
* Remove all bundles linked to this item. This may result in the bundle being deleted, if the * Remove all bundles linked to this item. This may result in the bundle being deleted, if the
* bundle is orphaned. * bundle is orphaned.
*
* @param context DSpace context object * @param context DSpace context object
* @param item * @param item
* the item from which to remove our bundles * the item from which to remove all bundles
* @throws SQLException if database error * @throws SQLException if database error
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error
* @throws IOException if IO error * @throws IOException if IO error
@@ -224,7 +229,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* method for the most common use. * method for the most common use.
* *
* @param context DSpace context object * @param context DSpace context object
* @param item Item * @param item item to create bitstream on
* @param is * @param is
* the stream to create the new bitstream from * the stream to create the new bitstream from
* @param name * @param name
@@ -241,7 +246,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* Convenience method, calls createSingleBitstream() with name "ORIGINAL" * Convenience method, calls createSingleBitstream() with name "ORIGINAL"
* *
* @param context DSpace context object * @param context DSpace context object
* @param item Item * @param item item to create bitstream on
* @param is * @param is
* InputStream * InputStream
* @return created bitstream * @return created bitstream
@@ -256,8 +261,9 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* Get all non-internal bitstreams in the item. This is mainly used for * Get all non-internal bitstreams in the item. This is mainly used for
* auditing for provenance messages and adding format.* DC values. The order * auditing for provenance messages and adding format.* DC values. The order
* is indeterminate. * is indeterminate.
*
* @param context DSpace context object * @param context DSpace context object
* @param item Item * @param item item to check
* @return non-internal bitstreams. * @return non-internal bitstreams.
* @throws SQLException if database error * @throws SQLException if database error
*/ */
@@ -271,7 +277,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* This method is used by the org.dspace.submit.step.LicenseStep class * This method is used by the org.dspace.submit.step.LicenseStep class
* *
* @param context DSpace context object * @param context DSpace context object
* @param item Item * @param item item to remove DSpace license from
* @throws SQLException if database error * @throws SQLException if database error
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error
* @throws IOException if IO error * @throws IOException if IO error
@@ -283,7 +289,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* Remove all licenses from an item - it was rejected * Remove all licenses from an item - it was rejected
* *
* @param context DSpace context object * @param context DSpace context object
* @param item Item * @param item item to remove all licenses from
* @throws SQLException if database error * @throws SQLException if database error
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error
* @throws IOException if IO error * @throws IOException if IO error
@@ -295,7 +301,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* and metadata are not deleted, but it is not publicly accessible. * and metadata are not deleted, but it is not publicly accessible.
* *
* @param context DSpace context object * @param context DSpace context object
* @param item Item * @param item item to withdraw
* @throws SQLException if database error * @throws SQLException if database error
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error
*/ */
@@ -306,7 +312,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* Reinstate a withdrawn item * Reinstate a withdrawn item
* *
* @param context DSpace context object * @param context DSpace context object
* @param item Item * @param item withdrawn item to reinstate
* @throws SQLException if database error * @throws SQLException if database error
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error
*/ */
@@ -315,7 +321,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
/** /**
* Return true if this Collection 'owns' this item * Return true if this Collection 'owns' this item
* *
* @param item Item * @param item item to check
* @param collection * @param collection
* Collection * Collection
* @return true if this Collection owns this item * @return true if this Collection owns this item
@@ -327,7 +333,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* policies * policies
* *
* @param context DSpace context object * @param context DSpace context object
* @param item Item * @param item item to replace policies on
* @param newpolicies - * @param newpolicies -
* this will be all of the new policies for the item and its * this will be all of the new policies for the item and its
* contents * contents
@@ -342,7 +348,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* them with a new list of policies * them with a new list of policies
* *
* @param context DSpace context object * @param context DSpace context object
* @param item Item * @param item item to replace policies on
* @param newpolicies - * @param newpolicies -
* this will be all of the new policies for the bundle and * this will be all of the new policies for the bundle and
* bitstream contents * bitstream contents
@@ -358,7 +364,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* to a given Group * to a given Group
* *
* @param context DSpace context object * @param context DSpace context object
* @param item Item * @param item item to remove group policies from
* @param group * @param group
* Group referenced by policies that needs to be removed * Group referenced by policies that needs to be removed
* @throws SQLException if database error * @throws SQLException if database error
@@ -372,7 +378,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* the collection. * the collection.
* *
* @param context DSpace context object * @param context DSpace context object
* @param item Item * @param item item to reset policies on
* @param collection * @param collection
* Collection * Collection
* @throws SQLException if database error * @throws SQLException if database error
@@ -392,7 +398,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* Moves the item from one collection to another one * Moves the item from one collection to another one
* *
* @param context DSpace context object * @param context DSpace context object
* @param item Item * @param item item to move
* @param from Collection to move from * @param from Collection to move from
* @param to Collection to move to * @param to Collection to move to
* @throws SQLException if database error * @throws SQLException if database error
@@ -405,7 +411,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* Moves the item from one collection to another one * Moves the item from one collection to another one
* *
* @param context DSpace context object * @param context DSpace context object
* @param item Item * @param item item to move
* @param from Collection to move from * @param from Collection to move from
* @param to Collection to move to * @param to Collection to move to
* @param inheritDefaultPolicies whether to inherit policies from new collection * @param inheritDefaultPolicies whether to inherit policies from new collection
@@ -413,12 +419,12 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error
* @throws IOException if IO error * @throws IOException if IO error
*/ */
public void move (Context context, Item item, Collection from, Collection to, boolean inheritDefaultPolicies) throws SQLException, AuthorizeException, IOException; public void move(Context context, Item item, Collection from, Collection to, boolean inheritDefaultPolicies) throws SQLException, AuthorizeException, IOException;
/** /**
* Check the bundle ORIGINAL to see if there are any uploaded files * Check the bundle ORIGINAL to see if there are any uploaded files
* *
* @param item Item * @param item item to check
* @return true if there is a bundle named ORIGINAL with one or more * @return true if there is a bundle named ORIGINAL with one or more
* bitstreams inside * bitstreams inside
* @throws SQLException if database error * @throws SQLException if database error
@@ -429,7 +435,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* Get the collections this item is not in. * Get the collections this item is not in.
* *
* @param context DSpace context object * @param context DSpace context object
* @param item Item * @param item item to check
* @return the collections this item is not in, if any. * @return the collections this item is not in, if any.
* @throws SQLException if database error * @throws SQLException if database error
*/ */
@@ -439,7 +445,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* return TRUE if context's user can edit item, false otherwise * return TRUE if context's user can edit item, false otherwise
* *
* @param context DSpace context object * @param context DSpace context object
* @param item Item * @param item item to check
* @return boolean true = current user can edit item * @return boolean true = current user can edit item
* @throws SQLException if database error * @throws SQLException if database error
*/ */
@@ -448,8 +454,10 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
/** /**
* return TRUE if context's user can create new version of the item, false * return TRUE if context's user can create new version of the item, false
* otherwise. * otherwise.
* @param context DSpace context object
* @param item item to check
* @return boolean true = current user can create new version of the item * @return boolean true = current user can create new version of the item
* @throws SQLException * @throws SQLException if database error
*/ */
public boolean canCreateNewVersion(Context context, Item item) throws SQLException; public boolean canCreateNewVersion(Context context, Item item) throws SQLException;
@@ -500,7 +508,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* Service method for knowing if this Item should be visible in the item list. * Service method for knowing if this Item should be visible in the item list.
* Items only show up in the "item list" if the user has READ permission * Items only show up in the "item list" if the user has READ permission
* and if the Item isn't flagged as unlisted. * and if the Item isn't flagged as unlisted.
* @param context context * @param context DSpace context object
* @param item item * @param item item
* @return true or false * @return true or false
*/ */
@@ -519,7 +527,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
/** /**
* Find all Items modified since a Date. * Find all Items modified since a Date.
* *
* @param context context * @param context DSpace context object
* @param last Earliest interesting last-modified date. * @param last Earliest interesting last-modified date.
* @return iterator over items * @return iterator over items
* @throws SQLException if database error * @throws SQLException if database error
@@ -566,9 +574,10 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
/** /**
* Check if the supplied item is an inprogress submission * Check if the supplied item is an inprogress submission
* @param context * @param context DSpace context object
* @param item * @param item item to check
* @return <code>true</code> if the item is linked to a workspaceitem or workflowitem * @return <code>true</code> if the item is linked to a workspaceitem or workflowitem
* @throws SQLException if database error
*/ */
boolean isInProgressSubmission(Context context, Item item) throws SQLException; boolean isInProgressSubmission(Context context, Item item) throws SQLException;
} }

View File

@@ -37,7 +37,7 @@ public interface MetadataFieldService {
* @return new MetadataField * @return new MetadataField
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error
* @throws SQLException if database error * @throws SQLException if database error
* @throws NonUniqueMetadataException * @throws NonUniqueMetadataException if an existing field with an identical element and qualifier is already present
*/ */
public MetadataField create(Context context, MetadataSchema metadataSchema, String element, String qualifier, String scopeNote) public MetadataField create(Context context, MetadataSchema metadataSchema, String element, String qualifier, String scopeNote)
throws AuthorizeException, SQLException, NonUniqueMetadataException; throws AuthorizeException, SQLException, NonUniqueMetadataException;
@@ -102,7 +102,7 @@ public interface MetadataFieldService {
* @param metadataField metadata field * @param metadataField metadata field
* @throws SQLException if database error * @throws SQLException if database error
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error
* @throws NonUniqueMetadataException * @throws NonUniqueMetadataException if an existing field with an identical element and qualifier is already present
* @throws IOException if IO error * @throws IOException if IO error
*/ */
public void update(Context context, MetadataField metadataField) public void update(Context context, MetadataField metadataField)

View File

@@ -33,7 +33,7 @@ public interface MetadataSchemaService {
* @return new MetadataSchema * @return new MetadataSchema
* @throws SQLException if database error * @throws SQLException if database error
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error
* @throws NonUniqueMetadataException * @throws NonUniqueMetadataException if an existing field with an identical element and qualifier is already present
*/ */
public MetadataSchema create(Context context, String name, String namespace) throws SQLException, AuthorizeException, NonUniqueMetadataException; public MetadataSchema create(Context context, String name, String namespace) throws SQLException, AuthorizeException, NonUniqueMetadataException;
@@ -54,7 +54,7 @@ public interface MetadataSchemaService {
* @param metadataSchema metadata schema * @param metadataSchema metadata schema
* @throws SQLException if database error * @throws SQLException if database error
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error
* @throws NonUniqueMetadataException * @throws NonUniqueMetadataException if an existing field with an identical element and qualifier is already present
*/ */
public void update(Context context, MetadataSchema metadataSchema) throws SQLException, AuthorizeException, NonUniqueMetadataException; public void update(Context context, MetadataSchema metadataSchema) throws SQLException, AuthorizeException, NonUniqueMetadataException;

View File

@@ -43,7 +43,7 @@ public interface MetadataValueService {
* @param context dspace context * @param context dspace context
* @param valueId database key id of value * @param valueId database key id of value
* @return recalled metadata value * @return recalled metadata value
* @throws java.io.IOException * @throws IOException if IO error
* @throws SQLException if database error * @throws SQLException if database error
*/ */
public MetadataValue find(Context context, int valueId) public MetadataValue find(Context context, int valueId)
@@ -89,7 +89,7 @@ public interface MetadataValueService {
/** /**
* Get the minimum value of a given metadata field across all objects. * Get the minimum value of a given metadata field across all objects.
* *
* @param context * @param context dspace context
* @param metadataFieldId unique identifier of the interesting field. * @param metadataFieldId unique identifier of the interesting field.
* @return the minimum value of the metadata field * @return the minimum value of the metadata field
* @throws SQLException if database error * @throws SQLException if database error

View File

@@ -143,6 +143,7 @@ public interface WorkspaceItemService extends InProgressSubmissionService<Worksp
/** /**
* The map entry returned contains stage reached as the key and count of items in that stage as a value * The map entry returned contains stage reached as the key and count of items in that stage as a value
* @param context * @param context
* The relevant DSpace Context.
* @return the map * @return the map
* @throws SQLException if database error * @throws SQLException if database error
*/ */

View File

@@ -94,7 +94,9 @@ public abstract class AbstractHibernateDAO<T> implements GenericDAO<T> {
* Execute a JPA Criteria query and return a collection of results. * Execute a JPA Criteria query and return a collection of results.
* *
* @param context * @param context
* @param query JPQL query string * The relevant DSpace Context.
* @param query
* JPQL query string
* @return list of DAOs specified by the query string * @return list of DAOs specified by the query string
* @throws SQLException if database error * @throws SQLException if database error
*/ */
@@ -134,7 +136,7 @@ public abstract class AbstractHibernateDAO<T> implements GenericDAO<T> {
* Retrieve a unique result from the query. If multiple results CAN be * Retrieve a unique result from the query. If multiple results CAN be
* retrieved an exception will be thrown, * retrieved an exception will be thrown,
* so only use when the criteria state uniqueness in the database. * so only use when the criteria state uniqueness in the database.
* @param criteria * @param criteria JPA criteria
* @return a DAO specified by the criteria * @return a DAO specified by the criteria
*/ */
public T uniqueResult(Criteria criteria) public T uniqueResult(Criteria criteria)
@@ -147,7 +149,7 @@ public abstract class AbstractHibernateDAO<T> implements GenericDAO<T> {
/** /**
* Retrieve a single result from the query. Best used if you expect a * Retrieve a single result from the query. Best used if you expect a
* single result, but this isn't enforced on the database. * single result, but this isn't enforced on the database.
* @param criteria * @param criteria JPA criteria
* @return a DAO specified by the criteria * @return a DAO specified by the criteria
*/ */
public T singleResult(Criteria criteria) public T singleResult(Criteria criteria)

View File

@@ -40,8 +40,11 @@ public abstract class AbstractHibernateDSODAO<T extends DSpaceObject> extends Ab
* The identifier of the join will be the toString() representation of the metadata field. * The identifier of the join will be the toString() representation of the metadata field.
* The joineded metadata fields can then be used to query or sort. * The joineded metadata fields can then be used to query or sort.
* @param query * @param query
* partial SQL query (to be appended)
* @param tableIdentifier * @param tableIdentifier
* DB table to join with
* @param metadataFields * @param metadataFields
* a collection of metadata fields
*/ */
protected void addMetadataLeftJoin(StringBuilder query, String tableIdentifier, Collection<MetadataField> metadataFields) protected void addMetadataLeftJoin(StringBuilder query, String tableIdentifier, Collection<MetadataField> metadataFields)
{ {
@@ -63,26 +66,26 @@ public abstract class AbstractHibernateDSODAO<T extends DSpaceObject> extends Ab
*/ */
protected void addMetadataValueWhereQuery(StringBuilder query, List<MetadataField> metadataFields, String operator, String additionalWhere) protected void addMetadataValueWhereQuery(StringBuilder query, List<MetadataField> metadataFields, String operator, String additionalWhere)
{ {
if(CollectionUtils.isNotEmpty(metadataFields) || StringUtils.isNotBlank(additionalWhere)){ if (CollectionUtils.isNotEmpty(metadataFields) || StringUtils.isNotBlank(additionalWhere)) {
//Add the where query on metadata //Add the where query on metadata
query.append(" WHERE "); query.append(" WHERE ");
for (int i = 0; i < metadataFields.size(); i++) { for (int i = 0; i < metadataFields.size(); i++) {
MetadataField metadataField = metadataFields.get(i); MetadataField metadataField = metadataFields.get(i);
if(StringUtils.isNotBlank(operator)) if (StringUtils.isNotBlank(operator))
{ {
query.append(" ("); query.append(" (");
query.append("lower(STR(" + metadataField.toString()).append(".value)) ").append(operator).append(" lower(:queryParam)"); query.append("lower(STR(" + metadataField.toString()).append(".value)) ").append(operator).append(" lower(:queryParam)");
query.append(")"); query.append(")");
if(i < metadataFields.size() - 1) if (i < metadataFields.size() - 1)
{ {
query.append(" OR "); query.append(" OR ");
} }
} }
} }
if(StringUtils.isNotBlank(additionalWhere)) if (StringUtils.isNotBlank(additionalWhere))
{ {
if(CollectionUtils.isNotEmpty(metadataFields)) if (CollectionUtils.isNotEmpty(metadataFields))
{ {
query.append(" OR "); query.append(" OR ");
} }
@@ -95,23 +98,23 @@ public abstract class AbstractHibernateDSODAO<T extends DSpaceObject> extends Ab
protected void addMetadataSortQuery(StringBuilder query, List<MetadataField> metadataSortFields, List<String> columnSortFields) protected void addMetadataSortQuery(StringBuilder query, List<MetadataField> metadataSortFields, List<String> columnSortFields)
{ {
if(CollectionUtils.isNotEmpty(metadataSortFields)){ if (CollectionUtils.isNotEmpty(metadataSortFields)) {
query.append(" ORDER BY "); query.append(" ORDER BY ");
for (int i = 0; i < metadataSortFields.size(); i++) { for (int i = 0; i < metadataSortFields.size(); i++) {
MetadataField metadataField = metadataSortFields.get(i); MetadataField metadataField = metadataSortFields.get(i);
query.append("STR(").append(metadataField.toString()).append(".value)"); query.append("STR(").append(metadataField.toString()).append(".value)");
if(i != metadataSortFields.size() -1) if (i != metadataSortFields.size() -1)
{ {
query.append(","); query.append(",");
} }
} }
}else if(CollectionUtils.isNotEmpty(columnSortFields)) } else if (CollectionUtils.isNotEmpty(columnSortFields))
{ {
query.append(" ORDER BY "); query.append(" ORDER BY ");
for (int i = 0; i < columnSortFields.size(); i++) { for (int i = 0; i < columnSortFields.size(); i++) {
String sortField = columnSortFields.get(i); String sortField = columnSortFields.get(i);
query.append(sortField); query.append(sortField);
if(i != columnSortFields.size() -1) if (i != columnSortFields.size() -1)
{ {
query.append(","); query.append(",");
} }

View File

@@ -130,7 +130,7 @@ public class Context
/** /**
* Initializes a new context object. * Initializes a new context object.
* *
* @exception SQLException * @throws SQLException
* if there was an error obtaining a database connection * if there was an error obtaining a database connection
*/ */
private void init() private void init()
@@ -337,7 +337,7 @@ public class Context
* Calling complete() on a Context which is no longer valid (isValid()==false), * Calling complete() on a Context which is no longer valid (isValid()==false),
* is a no-op. * is a no-op.
* *
* @exception SQLException * @throws SQLException
* if there was an error completing the database transaction * if there was an error completing the database transaction
* or closing the connection * or closing the connection
*/ */
@@ -448,6 +448,7 @@ public class Context
* Add an event to be dispatched when this context is committed. * Add an event to be dispatched when this context is committed.
* *
* @param event * @param event
* event to be dispatched
*/ */
public void addEvent(Event event) public void addEvent(Event event)
{ {
@@ -630,10 +631,9 @@ public class Context
/** /**
* Returns the size of the cache of all object that have been read from the database so far. A larger number * Returns the size of the cache of all object that have been read from the database so far.
* means that more memory is consumed by the cache. This also has a negative impact on the query performance. In
* that case you should consider clearing the cache (see {@link Context#clearCache() clearCache}).
* *
* @return connection cache size
* @throws SQLException When connecting to the active cache fails. * @throws SQLException When connecting to the active cache fails.
*/ */
public long getCacheSize() throws SQLException { public long getCacheSize() throws SQLException {

View File

@@ -48,13 +48,20 @@ public interface DBConnection<T> {
/** /**
* Reload a DSpace object from the database. This will make sure the object is valid and stored in the cache. * Reload a DSpace object from the database. This will make sure the object is valid and stored in the cache.
* @param <E> the type of entity.
* @param entity The DSpace object to reload * @param entity The DSpace object to reload
* @return the reloaded entity.
* @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
public <E extends ReloadableEntity> E reloadEntity(E entity) throws SQLException; public <E extends ReloadableEntity> E reloadEntity(E entity) throws SQLException;
/** /**
* Remove a DSpace object from the cache when batch processing a large number of objects. * Remove a DSpace object from the cache when batch processing a large number of objects.
* @param <E> the type of entity.
* @param entity The DSpace object to reload * @param entity The DSpace object to reload
* @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
public <E extends ReloadableEntity> void uncacheEntity(E entity) throws SQLException ; public <E extends ReloadableEntity> void uncacheEntity(E entity) throws SQLException ;
} }

View File

@@ -42,25 +42,28 @@ import org.dspace.services.factory.DSpaceServicesFactory;
/** /**
* Class representing an e-mail message, also used to send e-mails. * Class representing an e-mail message, also used to send e-mails.
* <P> * <p>
* Typical use: * Typical use:
* <P> * </p>
* <p>
* <code>Email email = new Email();</code><br> * <code>Email email = new Email();</code><br>
* <code>email.addRecipient("foo@bar.com");</code><br> * <code>email.addRecipient("foo@bar.com");</code><br>
* <code>email.addArgument("John");</code><br> * <code>email.addArgument("John");</code><br>
* <code>email.addArgument("On the Testing of DSpace");</code><br> * <code>email.addArgument("On the Testing of DSpace");</code><br>
* <code>email.send();</code><br> * <code>email.send();</code><br>
* <P> * </p>
* <p>
* <code>name</code> is the name of an email template in * <code>name</code> is the name of an email template in
* <code>dspace-dir/config/emails/</code> (which also includes the subject.) * <code>dspace-dir/config/emails/</code> (which also includes the subject.)
* <code>arg0</code> and <code>arg1</code> are arguments to fill out the * <code>arg0</code> and <code>arg1</code> are arguments to fill out the
* message with. * message with.
* <P> * </p>
* <p>
* Emails are formatted using <code>java.text.MessageFormat.</code> * Emails are formatted using <code>java.text.MessageFormat.</code>
* Additionally, comment lines (starting with '#') are stripped, and if a line * Additionally, comment lines (starting with '#') are stripped, and if a line
* starts with "Subject:" the text on the right of the colon is used for the * starts with "Subject:" the text on the right of the colon is used for the
* subject line. For example: * subject line. For example:
* <P> * </p>
* *
* <pre> * <pre>
* *
@@ -77,10 +80,10 @@ import org.dspace.services.factory.DSpaceServicesFactory;
* *
* </pre> * </pre>
* *
* <P> * <p>
* If the example code above was used to send this mail, the resulting mail * If the example code above was used to send this mail, the resulting mail
* would have the subject <code>Example e-mail</code> and the body would be: * would have the subject <code>Example e-mail</code> and the body would be:
* <P> * </p>
* *
* <pre> * <pre>
* *
@@ -91,9 +94,10 @@ import org.dspace.services.factory.DSpaceServicesFactory;
* *
* </pre> * </pre>
* *
* <P> * <p>
* Note that parameters like <code>{0}</code> cannot be placed in the subject * Note that parameters like <code>{0}</code> cannot be placed in the subject
* of the e-mail; they won't get filled out. * of the e-mail; they won't get filled out.
* </p>
* *
* *
* @author Robert Tansley * @author Robert Tansley
@@ -295,13 +299,14 @@ public class Email
message.setText(fullMessage); message.setText(fullMessage);
} }
} }
else{ else
{
Multipart multipart = new MimeMultipart(); Multipart multipart = new MimeMultipart();
// create the first part of the email // create the first part of the email
BodyPart messageBodyPart = new MimeBodyPart(); BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(fullMessage); messageBodyPart.setText(fullMessage);
multipart.addBodyPart(messageBodyPart); multipart.addBodyPart(messageBodyPart);
if(!attachments.isEmpty()){ if (!attachments.isEmpty()) {
for (Iterator<FileAttachment> iter = attachments.iterator(); iter.hasNext();) for (Iterator<FileAttachment> iter = attachments.iterator(); iter.hasNext();)
{ {
FileAttachment f = iter.next(); FileAttachment f = iter.next();
@@ -314,13 +319,19 @@ public class Email
} }
message.setContent(multipart); message.setContent(multipart);
} }
if(!moreAttachments.isEmpty()){ if (!moreAttachments.isEmpty()) {
for (Iterator<InputStreamAttachment> iter = moreAttachments.iterator(); iter.hasNext();) for (Iterator<InputStreamAttachment> iter = moreAttachments.iterator(); iter.hasNext();)
{ {
InputStreamAttachment isa = iter.next(); InputStreamAttachment isa = iter.next();
// add the stream // add the stream
messageBodyPart = new MimeBodyPart(); messageBodyPart = new MimeBodyPart();
messageBodyPart.setDataHandler(new DataHandler(new InputStreamDataSource(isa.name,isa.mimetype,isa.is))); messageBodyPart.setDataHandler(
new DataHandler(new InputStreamDataSource(
isa.name,
isa.mimetype,
isa.is)
)
);
messageBodyPart.setFileName(isa.name); messageBodyPart.setFileName(isa.name);
multipart.addBodyPart(messageBodyPart); multipart.addBodyPart(messageBodyPart);
} }
@@ -459,7 +470,7 @@ public class Email
/** /**
* Test method to send an email to check email server settings * Test method to send an email to check email server settings
* *
* @param args Command line options * @param args the command line arguments given
*/ */
public static void main(String[] args) public static void main(String[] args)
{ {
@@ -479,7 +490,7 @@ public class Email
boolean disabled = config.getBooleanProperty("mail.server.disabled", false); boolean disabled = config.getBooleanProperty("mail.server.disabled", false);
try try
{ {
if( disabled) if (disabled)
{ {
System.err.println("\nError sending email:"); System.err.println("\nError sending email:");
System.err.println(" - Error: cannot test email because mail.server.disabled is set to true"); System.err.println(" - Error: cannot test email because mail.server.disabled is set to true");
@@ -497,7 +508,9 @@ public class Email
System.err.println("\nPlease see the DSpace documentation for assistance.\n"); System.err.println("\nPlease see the DSpace documentation for assistance.\n");
System.err.println("\n"); System.err.println("\n");
System.exit(1); System.exit(1);
}catch (IOException e1) { }
catch (IOException e1)
{
System.err.println("\nError sending email:"); System.err.println("\nError sending email:");
System.err.println(" - Error: " + e1); System.err.println(" - Error: " + e1);
System.err.println("\nPlease see the DSpace documentation for assistance.\n"); System.err.println("\nPlease see the DSpace documentation for assistance.\n");

View File

@@ -33,6 +33,7 @@ public interface GenericDAO<T>
* Fetch all persisted instances of a given object type. * Fetch all persisted instances of a given object type.
* *
* @param context * @param context
* The relevant DSpace Context.
* @param clazz the desired type. * @param clazz the desired type.
* @return list of DAOs of the same type as clazz * @return list of DAOs of the same type as clazz
* @throws SQLException if database error * @throws SQLException if database error
@@ -43,6 +44,7 @@ public interface GenericDAO<T>
* Execute a JPQL query returning a unique result. * Execute a JPQL query returning a unique result.
* *
* @param context * @param context
* The relevant DSpace Context.
* @param query JPQL query string * @param query JPQL query string
* @return a DAO specified by the query string * @return a DAO specified by the query string
* @throws SQLException if database error * @throws SQLException if database error
@@ -57,6 +59,7 @@ public interface GenericDAO<T>
* Execute a JPQL query and return a collection of results. * Execute a JPQL query and return a collection of results.
* *
* @param context * @param context
* The relevant DSpace Context.
* @param query JPQL query string * @param query JPQL query string
* @return list of DAOs specified by the query string * @return list of DAOs specified by the query string
* @throws SQLException if database error * @throws SQLException if database error

View File

@@ -23,38 +23,43 @@ import org.dspace.services.ConfigurationService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
/** /**
* <p>
* The Legacy Plugin Service is a very simple component container (based on the * The Legacy Plugin Service is a very simple component container (based on the
* legacy PluginManager class from 5.x or below). It reads defined "plugins" (interfaces) * legacy PluginManager class from 5.x or below). It reads defined "plugins" (interfaces)
* from config file(s) and makes them available to the API. (TODO: Someday, this * from config file(s) and makes them available to the API. (TODO: Someday, this
* entire "plugin" framework needs to be replaced by Spring Beans.) * entire "plugin" framework needs to be replaced by Spring Beans.)
* </p>
* <p> * <p>
* It creates and organizes components (plugins), and helps select a plugin in * It creates and organizes components (plugins), and helps select a plugin in
* the cases where there are many possible choices. It also gives some limited * the cases where there are many possible choices. It also gives some limited
* control over the lifecycle of a plugin. It manages three different types * control over the lifecycle of a plugin. It manages three different types
* (usage patterns) of plugins: * (usage patterns) of plugins:
* <p> * </p>
* <ol><li> Singleton Plugin * <ol>
* <br> There is only one implementation class for the plugin. It is indicated * <li>Singleton Plugin<br>
* There is only one implementation class for the plugin. It is indicated
* in the configuration. This type of plugin chooses an implementations of * in the configuration. This type of plugin chooses an implementations of
* a service, for the entire system, at configuration time. Your * a service, for the entire system, at configuration time. Your
* application just fetches the plugin for that interface and gets the * application just fetches the plugin for that interface and gets the
* configured-in choice. * configured-in choice.</li>
* *
* <p><li> Sequence Plugins * <li>Sequence Plugins<br>
* <br> You need a sequence or series of plugins, to implement a mechanism like * You need a sequence or series of plugins, to implement a mechanism like
* StackableAuthenticationMethods or a pipeline, where each plugin is * StackableAuthenticationMethods or a pipeline, where each plugin is
* called in order to contribute its implementation of a process to the * called in order to contribute its implementation of a process to the
* whole. * whole.</li>
* <p><li> Named Plugins * <li>Named Plugins<br>
* <br> Use a named plugin when the application has to choose one plugin * Use a named plugin when the application has to choose one plugin
* implementation out of many available ones. Each implementation is bound * implementation out of many available ones. Each implementation is bound
* to one or more names (symbolic identifiers) in the configuration. * to one or more names (symbolic identifiers) in the configuration.</li>
* </ol><p> * </ol>
* <p>
* The name is just a <code>String</code> to be associated with the * The name is just a <code>String</code> to be associated with the
* combination of implementation class and interface. It may contain * combination of implementation class and interface. It may contain
* any characters except for comma (,) and equals (=). It may contain * any characters except for comma (,) and equals (=). It may contain
* embedded spaces. Comma is a special character used to separate * embedded spaces. Comma is a special character used to separate
* names in the configuration entry. * names in the configuration entry.
* </p>
* *
* @author Larry Stone * @author Larry Stone
* @author Tim Donohue (turned old PluginManager into a PluginService) * @author Tim Donohue (turned old PluginManager into a PluginService)
@@ -122,7 +127,7 @@ public class LegacyPluginServiceImpl implements PluginService
* *
* @param interfaceClass interface Class object * @param interfaceClass interface Class object
* @return instance of plugin * @return instance of plugin
* @throws PluginConfigurationError * @throws PluginConfigurationError if no matching singleton plugin is configured.
*/ */
@Override @Override
public Object getSinglePlugin(Class interfaceClass) public Object getSinglePlugin(Class interfaceClass)
@@ -257,7 +262,7 @@ public class LegacyPluginServiceImpl implements PluginService
// If there's no "=" separator in this value, assume it's // If there's no "=" separator in this value, assume it's
// just a "name" that belongs with previous class. // just a "name" that belongs with previous class.
// (This may occur if there's an unescaped comma between names) // (This may occur if there's an unescaped comma between names)
if(prevClassName!=null && valSplit.length==1) if (prevClassName!=null && valSplit.length==1)
{ {
className = prevClassName; className = prevClassName;
name = valSplit[0]; name = valSplit[0];
@@ -713,7 +718,8 @@ public class LegacyPluginServiceImpl implements PluginService
* Invoking this class from the command line just runs * Invoking this class from the command line just runs
* <code>checkConfiguration</code> and shows the results. * <code>checkConfiguration</code> and shows the results.
* There are no command-line options. * There are no command-line options.
* @param argv arguments *
* @param argv the command line arguments given
* @throws Exception if error * @throws Exception if error
*/ */
public void main(String[] argv) throws Exception public void main(String[] argv) throws Exception

View File

@@ -44,12 +44,12 @@ public class NewsServiceImpl implements NewsService
this.acceptableFilenames = addLocalesToAcceptableFilenames(acceptableFilenames); this.acceptableFilenames = addLocalesToAcceptableFilenames(acceptableFilenames);
} }
protected List<String> addLocalesToAcceptableFilenames(List<String> acceptableFilenames){ protected List<String> addLocalesToAcceptableFilenames(List<String> acceptableFilenames) {
String [] locales = configurationService.getArrayProperty("webui.supported.locales"); String [] locales = configurationService.getArrayProperty("webui.supported.locales");
List<String> newAcceptableFilenames = new ArrayList<>(); List<String> newAcceptableFilenames = new ArrayList<>();
newAcceptableFilenames.addAll(acceptableFilenames); newAcceptableFilenames.addAll(acceptableFilenames);
for(String local : locales){ for (String local : locales) {
for(String acceptableFilename : acceptableFilenames){ for (String acceptableFilename : acceptableFilenames) {
int lastPoint = acceptableFilename.lastIndexOf("."); int lastPoint = acceptableFilename.lastIndexOf(".");
newAcceptableFilenames.add( newAcceptableFilenames.add(
acceptableFilename.substring(0, lastPoint) acceptableFilename.substring(0, lastPoint)
@@ -69,7 +69,7 @@ public class NewsServiceImpl implements NewsService
public String readNewsFile(String newsFile) public String readNewsFile(String newsFile)
{ {
if (!validate(newsFile)) { if (!validate(newsFile)) {
throw new IllegalArgumentException("The file "+ newsFile + " is not a valid news file"); throw new IllegalArgumentException("The file " + newsFile + " is not a valid news file");
} }
String fileName = getNewsFilePath(); String fileName = getNewsFilePath();

View File

@@ -42,9 +42,10 @@ public interface NewsService {
public String getNewsFilePath(); public String getNewsFilePath();
/** /**
* Check if the newsName is a valid one * Check if the newsName is an acceptable file name
* *
* @param newsName * @param newsName
* news name
* @return true * @return true
* if the newsName is valid * if the newsName is valid
*/ */

View File

@@ -113,7 +113,10 @@ public class BasicLinkChecker extends AbstractCurationTask
/** /**
* Check the URL and perform appropriate reporting * Check the URL and perform appropriate reporting
* *
* @param url The URL to check * @param url
* The URL to check
* @param results
* Result string with HTTP status codes
* @return If the URL was OK or not * @return If the URL was OK or not
*/ */
protected boolean checkURL(String url, StringBuilder results) protected boolean checkURL(String url, StringBuilder results)

View File

@@ -113,6 +113,8 @@ public class BitstreamsIntoMetadata extends AbstractCurationTask
* @param item The item * @param item The item
* @param bitstream The bitstream * @param bitstream The bitstream
* @param type The type of bitstream * @param type The type of bitstream
* @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
protected void addMetadata(Item item, Bitstream bitstream, String type) throws SQLException { protected void addMetadata(Item item, Bitstream bitstream, String type) throws SQLException {
String value = bitstream.getFormat(Curator.curationContext()).getMIMEType() + "##"; String value = bitstream.getFormat(Curator.curationContext()).getMIMEType() + "##";

View File

@@ -156,6 +156,9 @@ public class ClamScan extends AbstractCurationTask
/** openSession /** openSession
* *
* This method opens a session. * This method opens a session.
*
* @throws IOException
* A general class of exceptions produced by failed or interrupted I/O operations.
*/ */
protected void openSession() throws IOException protected void openSession() throws IOException

View File

@@ -149,7 +149,7 @@ public class Curator
* *
* @param reporter name of reporting stream. The name '-' * @param reporter name of reporting stream. The name '-'
* causes reporting to standard out. * causes reporting to standard out.
* @return the Curator instance * @return return self (Curator instance) with reporter set
*/ */
public Curator setReporter(String reporter) public Curator setReporter(String reporter)
{ {
@@ -166,6 +166,9 @@ public class Curator
* entire performance is complete, and a scope of 'object' * entire performance is complete, and a scope of 'object'
* will commit for each object (e.g. item) encountered in * will commit for each object (e.g. item) encountered in
* a given execution. * a given execution.
*
* @param scope transactional scope
* @return return self (Curator instance) with given scope set
*/ */
public Curator setTransactionScope(TxScope scope) public Curator setTransactionScope(TxScope scope)
{ {
@@ -358,18 +361,20 @@ public class Curator
/** /**
* Returns the context object used in the current curation thread. * Returns the context object used in the current curation thread.
* This is primarily a utility method to allow tasks access to the context when necessary. * This is primarily a utility method to allow tasks access to the context when necessary.
* <P> * <p>
* If the context is null or not set, then this just returns * If the context is null or not set, then this just returns
* a brand new Context object representing an Anonymous User. * a brand new Context object representing an Anonymous User.
* *
* @return curation thread's Context object (or a new, anonymous Context if no curation Context exists) * @return curation thread's Context object (or a new, anonymous Context if no curation Context exists)
* @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
public static Context curationContext() throws SQLException public static Context curationContext() throws SQLException
{ {
// Return curation context or new context if undefined/invalid // Return curation context or new context if undefined/invalid
Context curCtx = curationCtx.get(); Context curCtx = curationCtx.get();
if(curCtx==null || !curCtx.isValid()) if (curCtx==null || !curCtx.isValid())
{ {
//Create a new context (represents an Anonymous User) //Create a new context (represents an Anonymous User)
curCtx = new Context(); curCtx = new Context();
@@ -407,7 +412,7 @@ public class Curator
// Site-wide Tasks really should have an EPerson performer associated with them, // Site-wide Tasks really should have an EPerson performer associated with them,
// otherwise they are run as an "anonymous" user with limited access rights. // otherwise they are run as an "anonymous" user with limited access rights.
if(ctx.getCurrentUser()==null && !ctx.ignoreAuthorization()) if (ctx.getCurrentUser()==null && !ctx.ignoreAuthorization())
{ {
log.warn("You are running one or more Site-Wide curation tasks in ANONYMOUS USER mode," + log.warn("You are running one or more Site-Wide curation tasks in ANONYMOUS USER mode," +
" as there is no EPerson 'performer' associated with this task. To associate an EPerson 'performer' " + " as there is no EPerson 'performer' associated with this task. To associate an EPerson 'performer' " +
@@ -502,6 +507,9 @@ public class Curator
/** /**
* Record a 'visit' to a DSpace object and enforce any policies set * Record a 'visit' to a DSpace object and enforce any policies set
* on this curator. * on this curator.
* @param dso the DSpace object
* @throws IOException
* A general class of exceptions produced by failed or interrupted I/O operations.
*/ */
protected void visit(DSpaceObject dso) throws IOException protected void visit(DSpaceObject dso) throws IOException
{ {
@@ -540,7 +548,7 @@ public class Curator
visit(dso); visit(dso);
return ! suspend(statusCode); return ! suspend(statusCode);
} }
catch(IOException ioe) catch (IOException ioe)
{ {
//log error & pass exception upwards //log error & pass exception upwards
log.error("Error executing curation task '" + task.getName() + "'", ioe); log.error("Error executing curation task '" + task.getName() + "'", ioe);
@@ -561,7 +569,7 @@ public class Curator
visit(null); visit(null);
return ! suspend(statusCode); return ! suspend(statusCode);
} }
catch(IOException ioe) catch (IOException ioe)
{ {
//log error & pass exception upwards //log error & pass exception upwards
log.error("Error executing curation task '" + task.getName() + "'", ioe); log.error("Error executing curation task '" + task.getName() + "'", ioe);

View File

@@ -114,6 +114,7 @@ public class ResolvedTask
/** /**
* Returns whether task should be distributed through containers * Returns whether task should be distributed through containers
* *
* @return whether task should be distributed through containers
*/ */
public boolean isDistributive() public boolean isDistributive()
{ {
@@ -123,6 +124,7 @@ public class ResolvedTask
/** /**
* Returns whether task alters (mutates) it's target objects * Returns whether task alters (mutates) it's target objects
* *
* @return whether task alters (mutates) it's target objects
*/ */
public boolean isMutative() public boolean isMutative()
{ {
@@ -139,6 +141,11 @@ public class ResolvedTask
return codes; return codes;
} }
/**
* Returns whether task is not scripted (curation task)
*
* @return true if this task is not scripted
*/
private boolean unscripted() private boolean unscripted()
{ {
return sTask == null; return sTask == null;

View File

@@ -27,9 +27,13 @@ public final class TaskQueueEntry
* TaskQueueEntry constructor with enumerated field values. * TaskQueueEntry constructor with enumerated field values.
* *
* @param epersonId * @param epersonId
* task owner
* @param submitTime * @param submitTime
* time the task was submitted (System.currentTimeMillis())
* @param taskNames * @param taskNames
* list of task names
* @param objId * @param objId
* usually a handle or workflow id
*/ */
public TaskQueueEntry(String epersonId, long submitTime, public TaskQueueEntry(String epersonId, long submitTime,
List<String> taskNames, String objId) List<String> taskNames, String objId)

View File

@@ -120,8 +120,8 @@ public class Utils
/** /**
* Performs a buffered copy from one file into another. * Performs a buffered copy from one file into another.
* *
* @param inFile * @param inFile input file
* @param outFile * @param outFile output file
* @throws IOException if IO error * @throws IOException if IO error
*/ */
public static void copy(File inFile, File outFile) throws IOException public static void copy(File inFile, File outFile) throws IOException

View File

@@ -79,6 +79,7 @@ public class WorkflowCuratorServiceImpl implements WorkflowCuratorService
* Ensures the configurationService is injected, so that we can read the * Ensures the configurationService is injected, so that we can read the
* settings from configuration * settings from configuration
* Called by "init-method" in Spring config. * Called by "init-method" in Spring config.
* @throws Exception ...
*/ */
public void init() throws Exception { public void init() throws Exception {
File cfgFile = new File(configurationService.getProperty("dspace.dir") + File cfgFile = new File(configurationService.getProperty("dspace.dir") +
@@ -87,7 +88,7 @@ public class WorkflowCuratorServiceImpl implements WorkflowCuratorService
try try
{ {
loadTaskConfig(cfgFile); loadTaskConfig(cfgFile);
if(workflowServiceFactory.getWorkflowService() instanceof BasicWorkflowItemService) if (workflowServiceFactory.getWorkflowService() instanceof BasicWorkflowItemService)
{ {
basicWorkflowService = (BasicWorkflowService) workflowServiceFactory.getWorkflowService(); basicWorkflowService = (BasicWorkflowService) workflowServiceFactory.getWorkflowService();
basicWorkflowItemService = (BasicWorkflowItemService) workflowServiceFactory.getWorkflowItemService(); basicWorkflowItemService = (BasicWorkflowItemService) workflowServiceFactory.getWorkflowItemService();

View File

@@ -46,8 +46,12 @@ public interface WorkflowCuratorService {
/** /**
* Determines and executes curation of a Workflow item. * Determines and executes curation of a Workflow item.
* *
* @param curator the Curator object
* @param c the user context * @param c the user context
* @param wfId the workflow id * @param wfId the workflow id
* @return true if curation was completed or not required,
* false if no workflow item found for id
* or item was rejected
* @throws AuthorizeException if authorization error * @throws AuthorizeException if authorization error
* @throws IOException if IO error * @throws IOException if IO error
* @throws SQLException if database error * @throws SQLException if database error
@@ -55,6 +59,18 @@ public interface WorkflowCuratorService {
public boolean curate(Curator curator, Context c, String wfId) public boolean curate(Curator curator, Context c, String wfId)
throws AuthorizeException, IOException, SQLException; throws AuthorizeException, IOException, SQLException;
/**
* Determines and executes curation of a Workflow item.
*
* @param curator the Curator object
* @param c the user context
* @param wfi the workflow item
* @return true if curation was completed or not required,
* false if item was rejected
* @throws AuthorizeException if authorization error
* @throws IOException if IO error
* @throws SQLException if database error
*/
public boolean curate(Curator curator, Context c, BasicWorkflowItem wfi) public boolean curate(Curator curator, Context c, BasicWorkflowItem wfi)
throws AuthorizeException, IOException, SQLException; throws AuthorizeException, IOException, SQLException;
} }

View File

@@ -40,12 +40,17 @@ public class DiscoverHitHighlightingField {
* field containing a matching hit. e.g. If maxChars = 200 * field containing a matching hit. e.g. If maxChars = 200
* and a hit is found in the full-text the 200 chars * and a hit is found in the full-text the 200 chars
* surrounding the hit will be shown * surrounding the hit will be shown
*
* @return max number of characters shown for a hit
*/ */
public int getMaxChars() public int getMaxChars()
{ {
return maxChars; return maxChars;
} }
/**
* @return max number of result snippets
*/
public int getMaxSnippets() public int getMaxSnippets()
{ {
return maxSnippets; return maxSnippets;

View File

@@ -41,12 +41,15 @@ public class IndexClient {
* from the whole index * from the whole index
* *
* @param args the command-line arguments, none used * @param args the command-line arguments, none used
* @throws java.io.IOException * @throws SQLException
* @throws SQLException if database error * An exception that provides information on a database access error or other errors.
* * @throws IOException
* A general class of exceptions produced by failed or interrupted I/O operations.
* @throws SearchServiceException if something went wrong with querying the solr server
*/ */
public static void main(String[] args) throws SQLException, IOException, SearchServiceException { public static void main(String[] args)
throws SQLException, IOException, SearchServiceException
{
Context context = new Context(); Context context = new Context();
context.turnOffAuthorisationSystem(); context.turnOffAuthorisationSystem();
@@ -55,46 +58,49 @@ public class IndexClient {
HelpFormatter formatter = new HelpFormatter(); HelpFormatter formatter = new HelpFormatter();
CommandLine line = null; CommandLine line = null;
options options.addOption(OptionBuilder
.addOption(OptionBuilder
.withArgName("handle to remove") .withArgName("handle to remove")
.hasArg(true) .hasArg(true)
.withDescription( .withDescription(
"remove an Item, Collection or Community from index based on its handle") "remove an Item, Collection or Community from index based on its handle")
.create("r")); .create("r"));
options options.addOption(OptionBuilder
.addOption(OptionBuilder
.withArgName("handle to add or update") .withArgName("handle to add or update")
.hasArg(true) .hasArg(true)
.withDescription( .withDescription(
"add or update an Item, Collection or Community based on its handle") "add or update an Item, Collection or Community based on its handle")
.create("i")); .create("i"));
options options.addOption(OptionBuilder
.addOption(OptionBuilder
.isRequired(false) .isRequired(false)
.withDescription( .withDescription(
"clean existing index removing any documents that no longer exist in the db") "clean existing index removing any documents that no longer exist in the db")
.create("c")); .create("c"));
options.addOption(OptionBuilder.isRequired(false).withDescription( options.addOption(OptionBuilder
"(re)build index, wiping out current one if it exists").create( .isRequired(false)
"b")); .withDescription(
"(re)build index, wiping out current one if it exists")
.create("b"));
options.addOption(OptionBuilder.isRequired(false).withDescription( options.addOption(OptionBuilder
"Rebuild the spellchecker, can be combined with -b and -f.").create( .isRequired(false)
"s")); .withDescription(
"Rebuild the spellchecker, can be combined with -b and -f.")
.create("s"));
options options.addOption(OptionBuilder
.addOption(OptionBuilder
.isRequired(false) .isRequired(false)
.withDescription( .withDescription(
"if updating existing index, force each handle to be reindexed even if uptodate") "if updating existing index, force each handle to be reindexed even if uptodate")
.create("f")); .create("f"));
options.addOption(OptionBuilder.isRequired(false).withDescription( options.addOption(OptionBuilder
"print this help message").create("h")); .isRequired(false)
.withDescription(
"print this help message")
.create("h"));
options.addOption(OptionBuilder.isRequired(false).withDescription( options.addOption(OptionBuilder.isRequired(false).withDescription(
"optimize search core").create("o")); "optimize search core").create("o"));
@@ -118,7 +124,10 @@ public class IndexClient {
* new DSpace.getServiceManager().getServiceByName("org.dspace.discovery.SolrIndexer"); * new DSpace.getServiceManager().getServiceByName("org.dspace.discovery.SolrIndexer");
*/ */
IndexingService indexer = DSpaceServicesFactory.getInstance().getServiceManager().getServiceByName(IndexingService.class.getName(),IndexingService.class); IndexingService indexer = DSpaceServicesFactory.getInstance().getServiceManager().getServiceByName(
IndexingService.class.getName(),
IndexingService.class
);
if (line.hasOption("r")) { if (line.hasOption("r")) {
log.info("Removing " + line.getOptionValue("r") + " from Index"); log.info("Removing " + line.getOptionValue("r") + " from Index");
@@ -133,9 +142,9 @@ public class IndexClient {
} else if (line.hasOption("o")) { } else if (line.hasOption("o")) {
log.info("Optimizing search core."); log.info("Optimizing search core.");
indexer.optimize(); indexer.optimize();
} else if(line.hasOption('s')) { } else if (line.hasOption('s')) {
checkRebuildSpellCheck(line, indexer); checkRebuildSpellCheck(line, indexer);
} else if(line.hasOption('i')) { } else if (line.hasOption('i')) {
final String handle = line.getOptionValue('i'); final String handle = line.getOptionValue('i');
final DSpaceObject dso = HandleServiceFactory.getInstance().getHandleService().resolveToObject(context, handle); final DSpaceObject dso = HandleServiceFactory.getInstance().getHandleService().resolveToObject(context, handle);
if (dso == null) { if (dso == null) {
@@ -160,11 +169,27 @@ public class IndexClient {
/** /**
* Indexes the given object and all children, if applicable. * Indexes the given object and all children, if applicable.
*
* @param indexingService
*
* @param itemService
*
* @param context
* The relevant DSpace Context.
* @param dso
* DSpace object to index recursively
* @throws IOException
* A general class of exceptions produced by failed or interrupted I/O operations.
* @throws SearchServiceException in case of a solr exception
* @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
private static long indexAll(final IndexingService indexingService, private static long indexAll(final IndexingService indexingService,
final ItemService itemService, final ItemService itemService,
final Context context, final Context context,
final DSpaceObject dso) throws IOException, SearchServiceException, SQLException { final DSpaceObject dso)
throws IOException, SearchServiceException, SQLException
{
long count = 0; long count = 0;
indexingService.indexContent(context, dso, true, true); indexingService.indexContent(context, dso, true, true);
@@ -194,11 +219,27 @@ public class IndexClient {
/** /**
* Indexes all items in the given collection. * Indexes all items in the given collection.
*
* @param indexingService
*
* @param itemService
*
* @param context
* The relevant DSpace Context.
* @param collection
* collection to index
* @throws IOException
* A general class of exceptions produced by failed or interrupted I/O operations.
* @throws SearchServiceException in case of a solr exception
* @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
private static long indexItems(final IndexingService indexingService, private static long indexItems(final IndexingService indexingService,
final ItemService itemService, final ItemService itemService,
final Context context, final Context context,
final Collection collection) throws IOException, SearchServiceException, SQLException { final Collection collection)
throws IOException, SearchServiceException, SQLException
{
long count = 0; long count = 0;
final Iterator<Item> itemIterator = itemService.findByCollection(context, collection); final Iterator<Item> itemIterator = itemService.findByCollection(context, collection);
@@ -220,7 +261,9 @@ public class IndexClient {
* @param indexer the solr indexer * @param indexer the solr indexer
* @throws SearchServiceException in case of a solr exception * @throws SearchServiceException in case of a solr exception
*/ */
protected static void checkRebuildSpellCheck(CommandLine line, IndexingService indexer) throws SearchServiceException { protected static void checkRebuildSpellCheck(CommandLine line, IndexingService indexer)
throws SearchServiceException
{
if (line.hasOption("s")) { if (line.hasOption("s")) {
log.info("Rebuilding spell checker."); log.info("Rebuilding spell checker.");
indexer.buildSpellCheck(); indexer.buildSpellCheck();

View File

@@ -34,6 +34,7 @@ public interface SearchService {
* DSpace Context object. * DSpace Context object.
* @param query * @param query
* the discovery query object. * the discovery query object.
* @return discovery search result object
* @throws SearchServiceException if search error * @throws SearchServiceException if search error
*/ */
DiscoverResult search(Context context, DiscoverQuery query) DiscoverResult search(Context context, DiscoverQuery query)
@@ -50,6 +51,7 @@ public interface SearchService {
* within this object) * within this object)
* @param query * @param query
* the discovery query object * the discovery query object
* @return discovery search result object
* @throws SearchServiceException if search error * @throws SearchServiceException if search error
*/ */
DiscoverResult search(Context context, DSpaceObject dso, DiscoverQuery query) DiscoverResult search(Context context, DSpaceObject dso, DiscoverQuery query)
@@ -64,6 +66,7 @@ public interface SearchService {
* @param includeWithdrawn * @param includeWithdrawn
* use <code>true</code> to include in the results also withdrawn * use <code>true</code> to include in the results also withdrawn
* items that match the query. * items that match the query.
* @return discovery search result object
* @throws SearchServiceException if search error * @throws SearchServiceException if search error
*/ */
DiscoverResult search(Context context, DiscoverQuery query, DiscoverResult search(Context context, DiscoverQuery query,
@@ -81,7 +84,7 @@ public interface SearchService {
* @param includeWithdrawn * @param includeWithdrawn
* use <code>true</code> to include in the results also withdrawn * use <code>true</code> to include in the results also withdrawn
* items that match the query * items that match the query
* * @return discovery search result object
* @throws SearchServiceException if search error * @throws SearchServiceException if search error
*/ */
DiscoverResult search(Context context, DSpaceObject dso, DiscoverQuery query, boolean includeWithdrawn) throws SearchServiceException; DiscoverResult search(Context context, DSpaceObject dso, DiscoverQuery query, boolean includeWithdrawn) throws SearchServiceException;
@@ -97,11 +100,14 @@ public interface SearchService {
/** /**
* Transforms the given string field and value into a filter query * Transforms the given string field and value into a filter query
* @param context the DSpace context * @param context
* The relevant DSpace Context.
* @param field the field of the filter query * @param field the field of the filter query
* @param operator equals/notequals/notcontains/authority/notauthority
* @param value the filter query value * @param value the filter query value
* @return a filter query * @return a filter query
* @throws SQLException if database error * @throws SQLException if database error
* An exception that provides information on a database access error or other errors.
*/ */
DiscoverFilterQuery toFilterQuery(Context context, String field, String operator, String value) throws SQLException; DiscoverFilterQuery toFilterQuery(Context context, String field, String operator, String value) throws SQLException;
@@ -118,21 +124,27 @@ public interface SearchService {
* communities/collections only. * communities/collections only.
* *
* @param context * @param context
* @return * The relevant DSpace Context.
* @return query string specific to the user's rights
* @throws SQLException * @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
String createLocationQueryForAdministrableItems(Context context) throws SQLException; String createLocationQueryForAdministrableItems(Context context) throws SQLException;
/** /**
* Transforms the metadata field of the given sort configuration into the indexed field which we can then use in our solr queries * Transforms the metadata field of the given sort configuration into the indexed field which we can then use in our Solr queries.
*
* @param metadataField the metadata field * @param metadataField the metadata field
* @param type see {@link org.dspace.discovery.configuration.DiscoveryConfigurationParameters}
* @return the indexed field * @return the indexed field
*/ */
String toSortFieldIndex(String metadataField, String type); String toSortFieldIndex(String metadataField, String type);
/** /**
* Utility method to escape any special characters in a user's query * Utility method to escape any special characters in a user's query
*
* @param query * @param query
* User's query to escape.
* @return query with any special characters escaped * @return query with any special characters escaped
*/ */
String escapeQueryChars(String query); String escapeQueryChars(String query);

View File

@@ -31,28 +31,28 @@ public class SearchUtils {
public static SearchService getSearchService() public static SearchService getSearchService()
{ {
if(searchService == null){ if (searchService == null) {
org.dspace.kernel.ServiceManager manager = DSpaceServicesFactory.getInstance().getServiceManager(); org.dspace.kernel.ServiceManager manager = DSpaceServicesFactory.getInstance().getServiceManager();
searchService = manager.getServiceByName(SearchService.class.getName(),SearchService.class); searchService = manager.getServiceByName(SearchService.class.getName(),SearchService.class);
} }
return searchService; return searchService;
} }
public static DiscoveryConfiguration getDiscoveryConfiguration(){ public static DiscoveryConfiguration getDiscoveryConfiguration() {
return getDiscoveryConfiguration(null); return getDiscoveryConfiguration(null);
} }
public static DiscoveryConfiguration getDiscoveryConfiguration(DSpaceObject dso){ public static DiscoveryConfiguration getDiscoveryConfiguration(DSpaceObject dso) {
DiscoveryConfigurationService configurationService = getConfigurationService(); DiscoveryConfigurationService configurationService = getConfigurationService();
DiscoveryConfiguration result = null; DiscoveryConfiguration result = null;
if(dso == null){ if (dso == null) {
result = configurationService.getMap().get("site"); result = configurationService.getMap().get("site");
}else{ }else{
result = configurationService.getMap().get(dso.getHandle()); result = configurationService.getMap().get(dso.getHandle());
} }
if(result == null){ if (result == null) {
//No specific configuration, get the default one //No specific configuration, get the default one
result = configurationService.getMap().get("default"); result = configurationService.getMap().get("default");
} }
@@ -73,8 +73,11 @@ public class SearchUtils {
/** /**
* Method that retrieves a list of all the configuration objects from the given item * Method that retrieves a list of all the configuration objects from the given item
* A configuration object can be returned for each parent community/collection * A configuration object can be returned for each parent community/collection
*
* @param item the DSpace item * @param item the DSpace item
* @return a list of configuration objects * @return a list of configuration objects
* @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
public static List<DiscoveryConfiguration> getAllDiscoveryConfigurations(Item item) throws SQLException { public static List<DiscoveryConfiguration> getAllDiscoveryConfigurations(Item item) throws SQLException {
Map<String, DiscoveryConfiguration> result = new HashMap<String, DiscoveryConfiguration>(); Map<String, DiscoveryConfiguration> result = new HashMap<String, DiscoveryConfiguration>();
@@ -82,14 +85,14 @@ public class SearchUtils {
List<Collection> collections = item.getCollections(); List<Collection> collections = item.getCollections();
for (Collection collection : collections) { for (Collection collection : collections) {
DiscoveryConfiguration configuration = getDiscoveryConfiguration(collection); DiscoveryConfiguration configuration = getDiscoveryConfiguration(collection);
if(!result.containsKey(configuration.getId())){ if (!result.containsKey(configuration.getId())) {
result.put(configuration.getId(), configuration); result.put(configuration.getId(), configuration);
} }
} }
//Also add one for the default //Also add one for the default
DiscoveryConfiguration configuration = getDiscoveryConfiguration(null); DiscoveryConfiguration configuration = getDiscoveryConfiguration(null);
if(!result.containsKey(configuration.getId())){ if (!result.containsKey(configuration.getId())) {
result.put(configuration.getId(), configuration); result.put(configuration.getId(), configuration);
} }

View File

@@ -79,7 +79,7 @@ import org.dspace.eperson.factory.EPersonServiceFactory;
* that cron. * that cron.
* *
* The SolrServiceImpl is registered as a Service in the ServiceManager via * The SolrServiceImpl is registered as a Service in the ServiceManager via
* a spring configuration file located under * a Spring configuration file located under
* classpath://spring/spring-dspace-applicationContext.xml * classpath://spring/spring-dspace-applicationContext.xml
* *
* Its configuration is Autowired by the ApplicationContext * Its configuration is Autowired by the ApplicationContext
@@ -257,6 +257,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
* unIndex removes an Item, Collection, or Community * unIndex removes an Item, Collection, or Community
* *
* @param context * @param context
* The relevant DSpace Context.
* @param dso DSpace Object, can be Community, Item, or Collection * @param dso DSpace Object, can be Community, Item, or Collection
* @throws SQLException if database error * @throws SQLException if database error
* @throws IOException if IO error * @throws IOException if IO error
@@ -271,6 +272,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
* unIndex removes an Item, Collection, or Community * unIndex removes an Item, Collection, or Community
* *
* @param context * @param context
* The relevant DSpace Context.
* @param dso DSpace Object, can be Community, Item, or Collection * @param dso DSpace Object, can be Community, Item, or Collection
* @param commit if <code>true</code> force an immediate commit on SOLR * @param commit if <code>true</code> force an immediate commit on SOLR
* @throws SQLException if database error * @throws SQLException if database error
@@ -286,7 +288,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
} }
String uniqueID = dso.getType()+"-"+dso.getID(); String uniqueID = dso.getType()+"-"+dso.getID();
getSolr().deleteById(uniqueID); getSolr().deleteById(uniqueID);
if(commit) if (commit)
{ {
getSolr().commit(); getSolr().commit();
} }
@@ -320,9 +322,9 @@ public class SolrServiceImpl implements SearchService, IndexingService {
throws SQLException, IOException { throws SQLException, IOException {
try { try {
if(getSolr() != null){ if (getSolr() != null) {
getSolr().deleteByQuery(HANDLE_FIELD + ":\"" + handle + "\""); getSolr().deleteByQuery(HANDLE_FIELD + ":\"" + handle + "\"");
if(commit) if (commit)
{ {
getSolr().commit(); getSolr().commit();
} }
@@ -416,7 +418,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
indexContent(context, community, force); indexContent(context, community, force);
} }
if(getSolr() != null) if (getSolr() != null)
{ {
getSolr().commit(); getSolr().commit();
} }
@@ -445,7 +447,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
try try
{ {
if(getSolr() == null) if (getSolr() == null)
{ {
return; return;
} }
@@ -484,7 +486,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
} }
} }
} }
} catch(Exception e) } catch (Exception e)
{ {
throw new SearchServiceException(e.getMessage(), e); throw new SearchServiceException(e.getMessage(), e);
@@ -506,7 +508,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
public void optimize() public void optimize()
{ {
try { try {
if(getSolr() == null) if (getSolr() == null)
{ {
return; return;
} }
@@ -613,7 +615,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
QueryResponse rsp; QueryResponse rsp;
try { try {
if(getSolr() == null) if (getSolr() == null)
{ {
return false; return false;
} }
@@ -630,7 +632,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
Object value = doc.getFieldValue(LAST_INDEXED_FIELD); Object value = doc.getFieldValue(LAST_INDEXED_FIELD);
if(value instanceof Date) if (value instanceof Date)
{ {
Date lastIndexed = (Date) value; Date lastIndexed = (Date) value;
@@ -711,7 +713,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
List<Collection> allCollections = new ArrayList<>(); List<Collection> allCollections = new ArrayList<>();
for( ResourcePolicy rp: collectionsPolicies){ for( ResourcePolicy rp: collectionsPolicies) {
Collection collection = ContentServiceFactory.getInstance().getCollectionService() Collection collection = ContentServiceFactory.getInstance().getCollectionService()
.find(context, rp.getdSpaceObject().getID()); .find(context, rp.getdSpaceObject().getID());
allCollections.add(collection); allCollections.add(collection);
@@ -761,16 +763,19 @@ public class SolrServiceImpl implements SearchService, IndexingService {
/** /**
* Write the document to the index under the appropriate handle. * Write the document to the index under the appropriate handle.
* *
* @param doc the solr document to be written to the server * @param doc
* the solr document to be written to the server
* @param streams * @param streams
* @throws IOException IO exception * list of bitstream content streams
* @throws IOException
* A general class of exceptions produced by failed or interrupted I/O operations.
*/ */
protected void writeDocument(SolrInputDocument doc, List<BitstreamContentStream> streams) throws IOException { protected void writeDocument(SolrInputDocument doc, List<BitstreamContentStream> streams) throws IOException {
try { try {
if(getSolr() != null) if (getSolr() != null)
{ {
if(CollectionUtils.isNotEmpty(streams)) if (CollectionUtils.isNotEmpty(streams))
{ {
ContentStreamUpdateRequest req = new ContentStreamUpdateRequest("/update/extract"); ContentStreamUpdateRequest req = new ContentStreamUpdateRequest("/update/extract");
@@ -811,6 +816,8 @@ public class SolrServiceImpl implements SearchService, IndexingService {
/** /**
* Build a solr document for a DSpace Community. * Build a solr document for a DSpace Community.
* *
* @param context
* The relevant DSpace Context.
* @param community Community to be indexed * @param community Community to be indexed
* @throws SQLException if database error * @throws SQLException if database error
* @throws IOException if IO error * @throws IOException if IO error
@@ -824,7 +831,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
DiscoveryConfiguration discoveryConfiguration = SearchUtils.getDiscoveryConfiguration(community); DiscoveryConfiguration discoveryConfiguration = SearchUtils.getDiscoveryConfiguration(community);
DiscoveryHitHighlightingConfiguration highlightingConfiguration = discoveryConfiguration.getHitHighlightingConfiguration(); DiscoveryHitHighlightingConfiguration highlightingConfiguration = discoveryConfiguration.getHitHighlightingConfiguration();
List<String> highlightedMetadataFields = new ArrayList<String>(); List<String> highlightedMetadataFields = new ArrayList<String>();
if(highlightingConfiguration != null) if (highlightingConfiguration != null)
{ {
for (DiscoveryHitHighlightFieldConfiguration configuration : highlightingConfiguration.getMetadataFields()) for (DiscoveryHitHighlightFieldConfiguration configuration : highlightingConfiguration.getMetadataFields())
{ {
@@ -859,6 +866,8 @@ public class SolrServiceImpl implements SearchService, IndexingService {
/** /**
* Build a solr document for a DSpace Collection. * Build a solr document for a DSpace Collection.
* *
* @param context
* The relevant DSpace Context.
* @param collection Collection to be indexed * @param collection Collection to be indexed
* @throws SQLException sql exception * @throws SQLException sql exception
* @throws IOException IO exception * @throws IOException IO exception
@@ -874,7 +883,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
DiscoveryConfiguration discoveryConfiguration = SearchUtils.getDiscoveryConfiguration(collection); DiscoveryConfiguration discoveryConfiguration = SearchUtils.getDiscoveryConfiguration(collection);
DiscoveryHitHighlightingConfiguration highlightingConfiguration = discoveryConfiguration.getHitHighlightingConfiguration(); DiscoveryHitHighlightingConfiguration highlightingConfiguration = discoveryConfiguration.getHitHighlightingConfiguration();
List<String> highlightedMetadataFields = new ArrayList<String>(); List<String> highlightedMetadataFields = new ArrayList<String>();
if(highlightingConfiguration != null) if (highlightingConfiguration != null)
{ {
for (DiscoveryHitHighlightFieldConfiguration configuration : highlightingConfiguration.getMetadataFields()) for (DiscoveryHitHighlightFieldConfiguration configuration : highlightingConfiguration.getMetadataFields())
{ {
@@ -915,19 +924,21 @@ public class SolrServiceImpl implements SearchService, IndexingService {
/** /**
* Add the metadata value of the community/collection to the solr document * Add the metadata value of the community/collection to the solr document
* IF needed highlighting is added ! * IF needed highlighting is added !
*
* @param doc the solr document * @param doc the solr document
* @param highlightedMetadataFields the list of metadata fields that CAN be highlighted * @param highlightedMetadataFields the list of metadata fields that CAN be highlighted
* @param toIgnoreMetadataFields the list of metadata fields to skip adding to Solr
* @param metadataField the metadata field added * @param metadataField the metadata field added
* @param value the value (can be NULL !) * @param value the value (can be NULL !)
*/ */
protected void addContainerMetadataField(SolrInputDocument doc, List<String> highlightedMetadataFields, List<String> toIgnoreMetadataFields, String metadataField, String value) protected void addContainerMetadataField(SolrInputDocument doc, List<String> highlightedMetadataFields, List<String> toIgnoreMetadataFields, String metadataField, String value)
{ {
if(toIgnoreMetadataFields == null || !toIgnoreMetadataFields.contains(metadataField)) if (toIgnoreMetadataFields == null || !toIgnoreMetadataFields.contains(metadataField))
{ {
if(StringUtils.isNotBlank(value)) if (StringUtils.isNotBlank(value))
{ {
doc.addField(metadataField, value); doc.addField(metadataField, value);
if(highlightedMetadataFields.contains(metadataField)) if (highlightedMetadataFields.contains(metadataField))
{ {
doc.addField(metadataField + "_hl", value); doc.addField(metadataField + "_hl", value);
} }
@@ -985,10 +996,10 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{ {
String metadataField = discoverySearchFilter.getMetadataFields().get(j); String metadataField = discoverySearchFilter.getMetadataFields().get(j);
List<DiscoverySearchFilter> resultingList; List<DiscoverySearchFilter> resultingList;
if(searchFilters.get(metadataField) != null) if (searchFilters.get(metadataField) != null)
{ {
resultingList = searchFilters.get(metadataField); resultingList = searchFilters.get(metadataField);
}else{ } else {
//New metadata field, create a new list for it //New metadata field, create a new list for it
resultingList = new ArrayList<DiscoverySearchFilter>(); resultingList = new ArrayList<DiscoverySearchFilter>();
} }
@@ -999,7 +1010,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
} }
DiscoverySortConfiguration sortConfiguration = discoveryConfiguration.getSearchSortConfiguration(); DiscoverySortConfiguration sortConfiguration = discoveryConfiguration.getSearchSortConfiguration();
if(sortConfiguration != null) if (sortConfiguration != null)
{ {
for (DiscoverySortFieldConfiguration discoverySortConfiguration : sortConfiguration.getSortFields()) for (DiscoverySortFieldConfiguration discoverySortConfiguration : sortConfiguration.getSortFields())
{ {
@@ -1008,13 +1019,13 @@ public class SolrServiceImpl implements SearchService, IndexingService {
} }
DiscoveryRecentSubmissionsConfiguration recentSubmissionConfiguration = discoveryConfiguration.getRecentSubmissionConfiguration(); DiscoveryRecentSubmissionsConfiguration recentSubmissionConfiguration = discoveryConfiguration.getRecentSubmissionConfiguration();
if(recentSubmissionConfiguration != null) if (recentSubmissionConfiguration != null)
{ {
recentSubmissionsConfigurationMap.put(recentSubmissionConfiguration.getMetadataSortField(), recentSubmissionConfiguration); recentSubmissionsConfigurationMap.put(recentSubmissionConfiguration.getMetadataSortField(), recentSubmissionConfiguration);
} }
DiscoveryHitHighlightingConfiguration hitHighlightingConfiguration = discoveryConfiguration.getHitHighlightingConfiguration(); DiscoveryHitHighlightingConfiguration hitHighlightingConfiguration = discoveryConfiguration.getHitHighlightingConfiguration();
if(hitHighlightingConfiguration != null) if (hitHighlightingConfiguration != null)
{ {
List<DiscoveryHitHighlightFieldConfiguration> fieldConfigurations = hitHighlightingConfiguration.getMetadataFields(); List<DiscoveryHitHighlightFieldConfiguration> fieldConfigurations = hitHighlightingConfiguration.getMetadataFields();
for (DiscoveryHitHighlightFieldConfiguration fieldConfiguration : fieldConfigurations) for (DiscoveryHitHighlightFieldConfiguration fieldConfiguration : fieldConfigurations)
@@ -1023,7 +1034,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
} }
} }
DiscoveryMoreLikeThisConfiguration moreLikeThisConfiguration = discoveryConfiguration.getMoreLikeThisConfiguration(); DiscoveryMoreLikeThisConfiguration moreLikeThisConfiguration = discoveryConfiguration.getMoreLikeThisConfiguration();
if(moreLikeThisConfiguration != null) if (moreLikeThisConfiguration != null)
{ {
for(String metadataField : moreLikeThisConfiguration.getSimilarityMetadataFields()) for(String metadataField : moreLikeThisConfiguration.getSimilarityMetadataFields())
{ {
@@ -1035,7 +1046,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
List<String> toProjectionFields = new ArrayList<String>(); List<String> toProjectionFields = new ArrayList<String>();
String[] projectionFields = DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty("discovery.index.projection"); String[] projectionFields = DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty("discovery.index.projection");
if(projectionFields != null){ if (projectionFields != null) {
for (String field : projectionFields) { for (String field : projectionFields) {
toProjectionFields.add(field.trim()); toProjectionFields.add(field.trim());
} }
@@ -1128,7 +1139,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
if ((searchFilters.get(field) != null || searchFilters.get(unqualifiedField + "." + Item.ANY) != null)) if ((searchFilters.get(field) != null || searchFilters.get(unqualifiedField + "." + Item.ANY) != null))
{ {
List<DiscoverySearchFilter> searchFilterConfigs = searchFilters.get(field); List<DiscoverySearchFilter> searchFilterConfigs = searchFilters.get(field);
if(searchFilterConfigs == null) if (searchFilterConfigs == null)
{ {
searchFilterConfigs = searchFilters.get(unqualifiedField + "." + Item.ANY); searchFilterConfigs = searchFilters.get(unqualifiedField + "." + Item.ANY);
} }
@@ -1137,15 +1148,15 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{ {
Date date = null; Date date = null;
String separator = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("discovery.solr.facets.split.char"); String separator = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("discovery.solr.facets.split.char");
if(separator == null) if (separator == null)
{ {
separator = FILTER_SEPARATOR; separator = FILTER_SEPARATOR;
} }
if(searchFilter.getType().equals(DiscoveryConfigurationParameters.TYPE_DATE)) if (searchFilter.getType().equals(DiscoveryConfigurationParameters.TYPE_DATE))
{ {
//For our search filters that are dates we format them properly //For our search filters that are dates we format them properly
date = MultiFormatDateParser.parse(value); date = MultiFormatDateParser.parse(value);
if(date != null) if (date != null)
{ {
//TODO: make this date format configurable ! //TODO: make this date format configurable !
value = DateFormatUtils.formatUTC(date, "yyyy-MM-dd"); value = DateFormatUtils.formatUTC(date, "yyyy-MM-dd");
@@ -1214,9 +1225,9 @@ public class SolrServiceImpl implements SearchService, IndexingService {
} }
} }
if(searchFilter.getFilterType().equals(DiscoverySearchFilterFacet.FILTER_TYPE_FACET)) if (searchFilter.getFilterType().equals(DiscoverySearchFilterFacet.FILTER_TYPE_FACET))
{ {
if(searchFilter.getType().equals(DiscoveryConfigurationParameters.TYPE_TEXT)) if (searchFilter.getType().equals(DiscoveryConfigurationParameters.TYPE_TEXT))
{ {
//Add a special filter //Add a special filter
//We use a separator to split up the lowercase and regular case, this is needed to get our filters in regular case //We use a separator to split up the lowercase and regular case, this is needed to get our filters in regular case
@@ -1230,10 +1241,10 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{ {
doc.addField(searchFilter.getIndexFieldName() + "_filter", value.toLowerCase() + separator + value); doc.addField(searchFilter.getIndexFieldName() + "_filter", value.toLowerCase() + separator + value);
} }
}else } else
if(searchFilter.getType().equals(DiscoveryConfigurationParameters.TYPE_DATE)) if (searchFilter.getType().equals(DiscoveryConfigurationParameters.TYPE_DATE))
{ {
if(date != null) if (date != null)
{ {
String indexField = searchFilter.getIndexFieldName() + ".year"; String indexField = searchFilter.getIndexFieldName() + ".year";
String yearUTC = DateFormatUtils.formatUTC(date, "yyyy"); String yearUTC = DateFormatUtils.formatUTC(date, "yyyy");
@@ -1264,18 +1275,18 @@ public class SolrServiceImpl implements SearchService, IndexingService {
} }
//Also save a sort value of this year, this is required for determining the upper & lower bound year of our facet //Also save a sort value of this year, this is required for determining the upper & lower bound year of our facet
if(doc.getField(indexField + "_sort") == null) if (doc.getField(indexField + "_sort") == null)
{ {
//We can only add one year so take the first one //We can only add one year so take the first one
doc.addField(indexField + "_sort", yearUTC); doc.addField(indexField + "_sort", yearUTC);
} }
} }
}else } else
if(searchFilter.getType().equals(DiscoveryConfigurationParameters.TYPE_HIERARCHICAL)) if (searchFilter.getType().equals(DiscoveryConfigurationParameters.TYPE_HIERARCHICAL))
{ {
HierarchicalSidebarFacetConfiguration hierarchicalSidebarFacetConfiguration = (HierarchicalSidebarFacetConfiguration) searchFilter; HierarchicalSidebarFacetConfiguration hierarchicalSidebarFacetConfiguration = (HierarchicalSidebarFacetConfiguration) searchFilter;
String[] subValues = value.split(hierarchicalSidebarFacetConfiguration.getSplitter()); String[] subValues = value.split(hierarchicalSidebarFacetConfiguration.getSplitter());
if(hierarchicalSidebarFacetConfiguration.isSkipFirstNodeLevel() && 1 < subValues.length) if (hierarchicalSidebarFacetConfiguration.isSkipFirstNodeLevel() && 1 < subValues.length)
{ {
//Remove the first element of our array //Remove the first element of our array
subValues = (String[]) ArrayUtils.subarray(subValues, 1, subValues.length); subValues = (String[]) ArrayUtils.subarray(subValues, 1, subValues.length);
@@ -1286,7 +1297,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
for(int j = 0; j <= i; j++) for(int j = 0; j <= i; j++)
{ {
valueBuilder.append(subValues[j]); valueBuilder.append(subValues[j]);
if(j < i) if (j < i)
{ {
valueBuilder.append(hierarchicalSidebarFacetConfiguration.getSplitter()); valueBuilder.append(hierarchicalSidebarFacetConfiguration.getSplitter());
} }
@@ -1310,34 +1321,34 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{ {
//Only add sort value once //Only add sort value once
String type; String type;
if(sortFields.get(field) != null) if (sortFields.get(field) != null)
{ {
type = sortFields.get(field).getType(); type = sortFields.get(field).getType();
}else{ } else {
type = recentSubmissionsConfigurationMap.get(field).getType(); type = recentSubmissionsConfigurationMap.get(field).getType();
} }
if(type.equals(DiscoveryConfigurationParameters.TYPE_DATE)) if (type.equals(DiscoveryConfigurationParameters.TYPE_DATE))
{ {
Date date = MultiFormatDateParser.parse(value); Date date = MultiFormatDateParser.parse(value);
if(date != null) if (date != null)
{ {
doc.addField(field + "_dt", date); doc.addField(field + "_dt", date);
}else{ } else {
log.warn("Error while indexing sort date field, item: " + item.getHandle() + " metadata field: " + field + " date value: " + date); log.warn("Error while indexing sort date field, item: " + item.getHandle() + " metadata field: " + field + " date value: " + date);
} }
}else{ } else {
doc.addField(field + "_sort", value); doc.addField(field + "_sort", value);
} }
sortFieldsAdded.add(field); sortFieldsAdded.add(field);
} }
if(hitHighlightingFields.contains(field) || hitHighlightingFields.contains("*") || hitHighlightingFields.contains(unqualifiedField + "." + Item.ANY)) if (hitHighlightingFields.contains(field) || hitHighlightingFields.contains("*") || hitHighlightingFields.contains(unqualifiedField + "." + Item.ANY))
{ {
doc.addField(field + "_hl", value); doc.addField(field + "_hl", value);
} }
if(moreLikeThisFields.contains(field) || moreLikeThisFields.contains(unqualifiedField + "." + Item.ANY)) if (moreLikeThisFields.contains(field) || moreLikeThisFields.contains(unqualifiedField + "." + Item.ANY))
{ {
doc.addField(field + "_mlt", value); doc.addField(field + "_mlt", value);
} }
@@ -1384,7 +1395,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
List<MetadataValue> values = itemService.getMetadataByMetadataString(item, "dc.relation.ispartof"); List<MetadataValue> values = itemService.getMetadataByMetadataString(item, "dc.relation.ispartof");
if(values != null && values.size() > 0 && values.get(0) != null && values.get(0).getValue() != null) if (values != null && values.size() > 0 && values.get(0) != null && values.get(0).getValue() != null)
{ {
// group on parent // group on parent
String handlePrefix = ConfigurationManager.getProperty("handle.canonical.prefix"); String handlePrefix = ConfigurationManager.getProperty("handle.canonical.prefix");
@@ -1472,10 +1483,15 @@ public class SolrServiceImpl implements SearchService, IndexingService {
/** /**
* Create Lucene document with all the shared fields initialized. * Create Lucene document with all the shared fields initialized.
* *
* @param type Type of DSpace Object * @param type
* Type of DSpace Object
* @param id * @param id
* internal identifier
* @param handle * @param handle
* @param locations @return * handle string
* @param locations
* list of collection/community internal identifiers
* @return initialized Lucene document
*/ */
protected SolrInputDocument buildDocument(int type, UUID id, String handle, protected SolrInputDocument buildDocument(int type, UUID id, String handle,
List<String> locations) List<String> locations)
@@ -1589,7 +1605,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
} }
public String locationToName(Context context, String field, String value) throws SQLException { public String locationToName(Context context, String field, String value) throws SQLException {
if("location.comm".equals(field) || "location.coll".equals(field)) if ("location.comm".equals(field) || "location.coll".equals(field))
{ {
int type = ("location.comm").equals(field) ? Constants.COMMUNITY : Constants.COLLECTION; int type = ("location.comm").equals(field) ? Constants.COMMUNITY : Constants.COLLECTION;
DSpaceObject commColl = null; DSpaceObject commColl = null;
@@ -1597,7 +1613,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{ {
commColl = contentServiceFactory.getDSpaceObjectService(type).find(context, UUID.fromString(value)); commColl = contentServiceFactory.getDSpaceObjectService(type).find(context, UUID.fromString(value));
} }
if(commColl != null) if (commColl != null)
{ {
return commColl.getName(); return commColl.getName();
} }
@@ -1623,7 +1639,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
@Override @Override
public DiscoverResult search(Context context, DSpaceObject dso, DiscoverQuery discoveryQuery, boolean includeUnDiscoverable) throws SearchServiceException { public DiscoverResult search(Context context, DSpaceObject dso, DiscoverQuery discoveryQuery, boolean includeUnDiscoverable) throws SearchServiceException {
if(dso != null) if (dso != null)
{ {
if (dso instanceof Community) if (dso instanceof Community)
{ {
@@ -1644,7 +1660,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
@Override @Override
public DiscoverResult search(Context context, DiscoverQuery discoveryQuery, boolean includeUnDiscoverable) throws SearchServiceException { public DiscoverResult search(Context context, DiscoverQuery discoveryQuery, boolean includeUnDiscoverable) throws SearchServiceException {
try { try {
if(getSolr() == null){ if (getSolr() == null) {
return new DiscoverResult(); return new DiscoverResult();
} }
SolrQuery solrQuery = resolveToSolrQuery(context, discoveryQuery, includeUnDiscoverable); SolrQuery solrQuery = resolveToSolrQuery(context, discoveryQuery, includeUnDiscoverable);
@@ -1664,7 +1680,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
SolrQuery solrQuery = new SolrQuery(); SolrQuery solrQuery = new SolrQuery();
String query = "*:*"; String query = "*:*";
if(discoveryQuery.getQuery() != null) if (discoveryQuery.getQuery() != null)
{ {
query = discoveryQuery.getQuery(); query = discoveryQuery.getQuery();
} }
@@ -1682,7 +1698,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
solrQuery.addField(RESOURCE_TYPE_FIELD); solrQuery.addField(RESOURCE_TYPE_FIELD);
solrQuery.addField(RESOURCE_ID_FIELD); solrQuery.addField(RESOURCE_ID_FIELD);
if(discoveryQuery.isSpellCheck()) if (discoveryQuery.isSpellCheck())
{ {
solrQuery.setParam(SpellingParams.SPELLCHECK_Q, query); solrQuery.setParam(SpellingParams.SPELLCHECK_Q, query);
solrQuery.setParam(SpellingParams.SPELLCHECK_COLLATE, Boolean.TRUE); solrQuery.setParam(SpellingParams.SPELLCHECK_COLLATE, Boolean.TRUE);
@@ -1700,7 +1716,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
String filterQuery = discoveryQuery.getFilterQueries().get(i); String filterQuery = discoveryQuery.getFilterQueries().get(i);
solrQuery.addFilterQuery(filterQuery); solrQuery.addFilterQuery(filterQuery);
} }
if(discoveryQuery.getDSpaceObjectFilter() != -1) if (discoveryQuery.getDSpaceObjectFilter() != -1)
{ {
solrQuery.addFilterQuery(RESOURCE_TYPE_FIELD + ":" + discoveryQuery.getDSpaceObjectFilter()); solrQuery.addFilterQuery(RESOURCE_TYPE_FIELD + ":" + discoveryQuery.getDSpaceObjectFilter());
} }
@@ -1711,20 +1727,20 @@ public class SolrServiceImpl implements SearchService, IndexingService {
solrQuery.addFilterQuery(filterQuery + ":[* TO *]"); solrQuery.addFilterQuery(filterQuery + ":[* TO *]");
} }
if(discoveryQuery.getStart() != -1) if (discoveryQuery.getStart() != -1)
{ {
solrQuery.setStart(discoveryQuery.getStart()); solrQuery.setStart(discoveryQuery.getStart());
} }
if(discoveryQuery.getMaxResults() != -1) if (discoveryQuery.getMaxResults() != -1)
{ {
solrQuery.setRows(discoveryQuery.getMaxResults()); solrQuery.setRows(discoveryQuery.getMaxResults());
} }
if(discoveryQuery.getSortField() != null) if (discoveryQuery.getSortField() != null)
{ {
SolrQuery.ORDER order = SolrQuery.ORDER.asc; SolrQuery.ORDER order = SolrQuery.ORDER.asc;
if(discoveryQuery.getSortOrder().equals(DiscoverQuery.SORT_ORDER.desc)) if (discoveryQuery.getSortOrder().equals(DiscoverQuery.SORT_ORDER.desc))
order = SolrQuery.ORDER.desc; order = SolrQuery.ORDER.desc;
solrQuery.addSortField(discoveryQuery.getSortField(), order); solrQuery.addSortField(discoveryQuery.getSortField(), order);
@@ -1737,7 +1753,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
} }
List<DiscoverFacetField> facetFields = discoveryQuery.getFacetFields(); List<DiscoverFacetField> facetFields = discoveryQuery.getFacetFields();
if(0 < facetFields.size()) if (0 < facetFields.size())
{ {
//Only add facet information if there are any facets //Only add facet information if there are any facets
for (DiscoverFacetField facetFieldConfig : facetFields) for (DiscoverFacetField facetFieldConfig : facetFields)
@@ -1748,10 +1764,10 @@ public class SolrServiceImpl implements SearchService, IndexingService {
// Setting the facet limit in this fashion ensures that each facet can have its own max // Setting the facet limit in this fashion ensures that each facet can have its own max
solrQuery.add("f." + field + "." + FacetParams.FACET_LIMIT, String.valueOf(facetFieldConfig.getLimit())); solrQuery.add("f." + field + "." + FacetParams.FACET_LIMIT, String.valueOf(facetFieldConfig.getLimit()));
String facetSort; String facetSort;
if(DiscoveryConfigurationParameters.SORT.COUNT.equals(facetFieldConfig.getSortOrder())) if (DiscoveryConfigurationParameters.SORT.COUNT.equals(facetFieldConfig.getSortOrder()))
{ {
facetSort = FacetParams.FACET_SORT_COUNT; facetSort = FacetParams.FACET_SORT_COUNT;
}else{ } else {
facetSort = FacetParams.FACET_SORT_INDEX; facetSort = FacetParams.FACET_SORT_INDEX;
} }
solrQuery.add("f." + field + "." + FacetParams.FACET_SORT, facetSort); solrQuery.add("f." + field + "." + FacetParams.FACET_SORT, facetSort);
@@ -1761,7 +1777,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
+ FacetParams.FACET_OFFSET, + FacetParams.FACET_OFFSET,
String.valueOf(facetFieldConfig.getOffset())); String.valueOf(facetFieldConfig.getOffset()));
} }
if(facetFieldConfig.getPrefix() != null) if (facetFieldConfig.getPrefix() != null)
{ {
solrQuery.setFacetPrefix(field, facetFieldConfig.getPrefix()); solrQuery.setFacetPrefix(field, facetFieldConfig.getPrefix());
} }
@@ -1773,7 +1789,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
solrQuery.addFacetQuery(facetQuery); solrQuery.addFacetQuery(facetQuery);
} }
if(discoveryQuery.getFacetMinCount() != -1) if (discoveryQuery.getFacetMinCount() != -1)
{ {
solrQuery.setFacetMinCount(discoveryQuery.getFacetMinCount()); solrQuery.setFacetMinCount(discoveryQuery.getFacetMinCount());
} }
@@ -1781,7 +1797,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
solrQuery.setParam(FacetParams.FACET_OFFSET, String.valueOf(discoveryQuery.getFacetOffset())); solrQuery.setParam(FacetParams.FACET_OFFSET, String.valueOf(discoveryQuery.getFacetOffset()));
} }
if(0 < discoveryQuery.getHitHighlightingFields().size()) if (0 < discoveryQuery.getHitHighlightingFields().size())
{ {
solrQuery.setHighlight(true); solrQuery.setHighlight(true);
solrQuery.add(HighlightParams.USE_PHRASE_HIGHLIGHTER, Boolean.TRUE.toString()); solrQuery.add(HighlightParams.USE_PHRASE_HIGHLIGHTER, Boolean.TRUE.toString());
@@ -1805,7 +1821,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
@Override @Override
public InputStream searchJSON(Context context, DiscoverQuery query, DSpaceObject dso, String jsonIdentifier) throws SearchServiceException { public InputStream searchJSON(Context context, DiscoverQuery query, DSpaceObject dso, String jsonIdentifier) throws SearchServiceException {
if(dso != null) if (dso != null)
{ {
if (dso instanceof Community) if (dso instanceof Community)
{ {
@@ -1824,7 +1840,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
@Override @Override
public InputStream searchJSON(Context context, DiscoverQuery discoveryQuery, String jsonIdentifier) throws SearchServiceException { public InputStream searchJSON(Context context, DiscoverQuery discoveryQuery, String jsonIdentifier) throws SearchServiceException {
if(getSolr() == null) if (getSolr() == null)
{ {
return null; return null;
} }
@@ -1854,7 +1870,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
protected DiscoverResult retrieveResult(Context context, DiscoverQuery query, QueryResponse solrQueryResponse) throws SQLException { protected DiscoverResult retrieveResult(Context context, DiscoverQuery query, QueryResponse solrQueryResponse) throws SQLException {
DiscoverResult result = new DiscoverResult(); DiscoverResult result = new DiscoverResult();
if(solrQueryResponse != null) if (solrQueryResponse != null)
{ {
result.setSearchTime(solrQueryResponse.getQTime()); result.setSearchTime(solrQueryResponse.getQTime());
result.setStart(query.getStart()); result.setStart(query.getStart());
@@ -1866,7 +1882,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{ {
DSpaceObject dso = findDSpaceObject(context, doc); DSpaceObject dso = findDSpaceObject(context, doc);
if(dso != null) if (dso != null)
{ {
result.addDSpaceObject(dso); result.addDSpaceObject(dso);
} else { } else {
@@ -1887,10 +1903,10 @@ public class SolrServiceImpl implements SearchService, IndexingService {
} }
result.addSearchDocument(dso, resultDoc); result.addSearchDocument(dso, resultDoc);
if(solrQueryResponse.getHighlighting() != null) if (solrQueryResponse.getHighlighting() != null)
{ {
Map<String, List<String>> highlightedFields = solrQueryResponse.getHighlighting().get(dso.getType() + "-" + dso.getID()); Map<String, List<String>> highlightedFields = solrQueryResponse.getHighlighting().get(dso.getType() + "-" + dso.getID());
if(MapUtils.isNotEmpty(highlightedFields)) if (MapUtils.isNotEmpty(highlightedFields))
{ {
//We need to remove all the "_hl" appendix strings from our keys //We need to remove all the "_hl" appendix strings from our keys
Map<String, List<String>> resultMap = new HashMap<String, List<String>>(); Map<String, List<String>> resultMap = new HashMap<String, List<String>>();
@@ -1906,7 +1922,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
//Resolve our facet field values //Resolve our facet field values
List<FacetField> facetFields = solrQueryResponse.getFacetFields(); List<FacetField> facetFields = solrQueryResponse.getFacetFields();
if(facetFields != null) if (facetFields != null)
{ {
for (int i = 0; i < facetFields.size(); i++) for (int i = 0; i < facetFields.size(); i++)
{ {
@@ -1915,7 +1931,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
List<FacetField.Count> facetValues = facetField.getValues(); List<FacetField.Count> facetValues = facetField.getValues();
if (facetValues != null) if (facetValues != null)
{ {
if(facetFieldConfig.getType().equals(DiscoveryConfigurationParameters.TYPE_DATE) && facetFieldConfig.getSortOrder().equals(DiscoveryConfigurationParameters.SORT.VALUE)) if (facetFieldConfig.getType().equals(DiscoveryConfigurationParameters.TYPE_DATE) && facetFieldConfig.getSortOrder().equals(DiscoveryConfigurationParameters.SORT.VALUE))
{ {
//If we have a date & are sorting by value, ensure that the results are flipped for a proper result //If we have a date & are sorting by value, ensure that the results are flipped for a proper result
Collections.reverse(facetValues); Collections.reverse(facetValues);
@@ -1942,7 +1958,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
} }
} }
if(solrQueryResponse.getFacetQuery() != null) if (solrQueryResponse.getFacetQuery() != null)
{ {
// just retrieve the facets in the order they where requested! // just retrieve the facets in the order they where requested!
// also for the date we ask it in proper (reverse) order // also for the date we ask it in proper (reverse) order
@@ -1967,17 +1983,17 @@ public class SolrServiceImpl implements SearchService, IndexingService {
Integer count = sortedFacetQueries.get(facetQuery); Integer count = sortedFacetQueries.get(facetQuery);
//No need to show empty years //No need to show empty years
if(0 < count) if (0 < count)
{ {
result.addFacetResult(facetField, new DiscoverResult.FacetResult(filter, name, null, name, count)); result.addFacetResult(facetField, new DiscoverResult.FacetResult(filter, name, null, name, count));
} }
} }
} }
if(solrQueryResponse.getSpellCheckResponse() != null) if (solrQueryResponse.getSpellCheckResponse() != null)
{ {
String recommendedQuery = solrQueryResponse.getSpellCheckResponse().getCollatedResult(); String recommendedQuery = solrQueryResponse.getSpellCheckResponse().getCollatedResult();
if(StringUtils.isNotBlank(recommendedQuery)) if (StringUtils.isNotBlank(recommendedQuery))
{ {
result.setSpellCheckQuery(recommendedQuery); result.setSpellCheckQuery(recommendedQuery);
} }
@@ -1987,6 +2003,17 @@ public class SolrServiceImpl implements SearchService, IndexingService {
return result; return result;
} }
/**
* Find DSpace object by type and UUID or by handle from given Solr document
*
* @param context
* The relevant DSpace Context.
* @param doc
* the solr document
* @return DSpace object
* @throws SQLException
* An exception that provides information on a database access error or other errors.
*/
protected DSpaceObject findDSpaceObject(Context context, SolrDocument doc) throws SQLException { protected DSpaceObject findDSpaceObject(Context context, SolrDocument doc) throws SQLException {
Integer type = (Integer) doc.getFirstValue(RESOURCE_TYPE_FIELD); Integer type = (Integer) doc.getFirstValue(RESOURCE_TYPE_FIELD);
@@ -2005,9 +2032,17 @@ public class SolrServiceImpl implements SearchService, IndexingService {
} }
/** Simple means to return the search result as an InputStream */ /**
* Simple means to return the search result as an InputStream
*
* @param query discovery query
* @return input stream
* @throws IOException
* A general class of exceptions produced by failed or interrupted I/O operations.
* @throws SearchServiceException if something went wrong with querying the solr server
*/
public java.io.InputStream searchAsInputStream(DiscoverQuery query) throws SearchServiceException, java.io.IOException { public java.io.InputStream searchAsInputStream(DiscoverQuery query) throws SearchServiceException, java.io.IOException {
if(getSolr() == null) if (getSolr() == null)
{ {
return null; return null;
} }
@@ -2038,7 +2073,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{ {
try { try {
if(getSolr() == null) if (getSolr() == null)
{ {
return Collections.emptyList(); return Collections.emptyList();
} }
@@ -2088,10 +2123,10 @@ public class SolrServiceImpl implements SearchService, IndexingService {
DiscoverFilterQuery result = new DiscoverFilterQuery(); DiscoverFilterQuery result = new DiscoverFilterQuery();
StringBuilder filterQuery = new StringBuilder(); StringBuilder filterQuery = new StringBuilder();
if(StringUtils.isNotBlank(field) && StringUtils.isNotBlank(value)) if (StringUtils.isNotBlank(field) && StringUtils.isNotBlank(value))
{ {
filterQuery.append(field); filterQuery.append(field);
if("equals".equals(operator)) if ("equals".equals(operator))
{ {
//Query the keyword indexed field ! //Query the keyword indexed field !
filterQuery.append("_keyword"); filterQuery.append("_keyword");
@@ -2108,10 +2143,10 @@ public class SolrServiceImpl implements SearchService, IndexingService {
filterQuery.insert(0, "-"); filterQuery.insert(0, "-");
} }
filterQuery.append(":"); filterQuery.append(":");
if("equals".equals(operator) || "notequals".equals(operator)) if ("equals".equals(operator) || "notequals".equals(operator))
{ {
//DO NOT ESCAPE RANGE QUERIES ! //DO NOT ESCAPE RANGE QUERIES !
if(!value.matches("\\[.*TO.*\\]")) if (!value.matches("\\[.*TO.*\\]"))
{ {
value = ClientUtils.escapeQueryChars(value); value = ClientUtils.escapeQueryChars(value);
filterQuery.append(value); filterQuery.append(value);
@@ -2127,9 +2162,9 @@ public class SolrServiceImpl implements SearchService, IndexingService {
filterQuery.append(value); filterQuery.append(value);
} }
} }
else{ else {
//DO NOT ESCAPE RANGE QUERIES ! //DO NOT ESCAPE RANGE QUERIES !
if(!value.matches("\\[.*TO.*\\]")) if (!value.matches("\\[.*TO.*\\]"))
{ {
value = ClientUtils.escapeQueryChars(value); value = ClientUtils.escapeQueryChars(value);
filterQuery.append("(").append(value).append(")"); filterQuery.append("(").append(value).append(")");
@@ -2176,13 +2211,13 @@ public class SolrServiceImpl implements SearchService, IndexingService {
solrQuery.setParam(MoreLikeThisParams.DOC_COUNT, String.valueOf(mltConfig.getMax())); solrQuery.setParam(MoreLikeThisParams.DOC_COUNT, String.valueOf(mltConfig.getMax()));
solrQuery.setParam(MoreLikeThisParams.MIN_WORD_LEN, String.valueOf(mltConfig.getMinWordLength())); solrQuery.setParam(MoreLikeThisParams.MIN_WORD_LEN, String.valueOf(mltConfig.getMinWordLength()));
if(getSolr() == null) if (getSolr() == null)
{ {
return Collections.emptyList(); return Collections.emptyList();
} }
QueryResponse rsp = getSolr().query(solrQuery); QueryResponse rsp = getSolr().query(solrQuery);
NamedList mltResults = (NamedList) rsp.getResponse().get("moreLikeThis"); NamedList mltResults = (NamedList) rsp.getResponse().get("moreLikeThis");
if(mltResults != null && mltResults.get(item.getType() + "-" + item.getID()) != null) if (mltResults != null && mltResults.get(item.getType() + "-" + item.getID()) != null)
{ {
SolrDocumentList relatedDocs = (SolrDocumentList) mltResults.get(item.getType() + "-" + item.getID()); SolrDocumentList relatedDocs = (SolrDocumentList) mltResults.get(item.getType() + "-" + item.getID());
for (Object relatedDoc : relatedDocs) for (Object relatedDoc : relatedDocs)
@@ -2207,67 +2242,67 @@ public class SolrServiceImpl implements SearchService, IndexingService {
@Override @Override
public String toSortFieldIndex(String metadataField, String type) public String toSortFieldIndex(String metadataField, String type)
{ {
if(type.equals(DiscoveryConfigurationParameters.TYPE_DATE)) if (type.equals(DiscoveryConfigurationParameters.TYPE_DATE))
{ {
return metadataField + "_dt"; return metadataField + "_dt";
}else{ } else {
return metadataField + "_sort"; return metadataField + "_sort";
} }
} }
protected String transformFacetField(DiscoverFacetField facetFieldConfig, String field, boolean removePostfix) protected String transformFacetField(DiscoverFacetField facetFieldConfig, String field, boolean removePostfix)
{ {
if(facetFieldConfig.getType().equals(DiscoveryConfigurationParameters.TYPE_TEXT)) if (facetFieldConfig.getType().equals(DiscoveryConfigurationParameters.TYPE_TEXT))
{ {
if(removePostfix) if (removePostfix)
{ {
return field.substring(0, field.lastIndexOf("_filter")); return field.substring(0, field.lastIndexOf("_filter"));
}else{ } else {
return field + "_filter"; return field + "_filter";
} }
}else if(facetFieldConfig.getType().equals(DiscoveryConfigurationParameters.TYPE_DATE)) } else if (facetFieldConfig.getType().equals(DiscoveryConfigurationParameters.TYPE_DATE))
{ {
if(removePostfix) if (removePostfix)
{ {
return field.substring(0, field.lastIndexOf(".year")); return field.substring(0, field.lastIndexOf(".year"));
}else{ } else {
return field + ".year"; return field + ".year";
} }
}else if(facetFieldConfig.getType().equals(DiscoveryConfigurationParameters.TYPE_AC)) } else if (facetFieldConfig.getType().equals(DiscoveryConfigurationParameters.TYPE_AC))
{ {
if(removePostfix) if (removePostfix)
{ {
return field.substring(0, field.lastIndexOf("_ac")); return field.substring(0, field.lastIndexOf("_ac"));
}else{ } else {
return field + "_ac"; return field + "_ac";
} }
}else if(facetFieldConfig.getType().equals(DiscoveryConfigurationParameters.TYPE_HIERARCHICAL)) } else if (facetFieldConfig.getType().equals(DiscoveryConfigurationParameters.TYPE_HIERARCHICAL))
{ {
if(removePostfix) if (removePostfix)
{ {
return StringUtils.substringBeforeLast(field, "_tax_"); return StringUtils.substringBeforeLast(field, "_tax_");
}else{ } else {
//Only display top level filters ! //Only display top level filters !
return field + "_tax_0_filter"; return field + "_tax_0_filter";
} }
}else if(facetFieldConfig.getType().equals(DiscoveryConfigurationParameters.TYPE_AUTHORITY)) } else if (facetFieldConfig.getType().equals(DiscoveryConfigurationParameters.TYPE_AUTHORITY))
{ {
if(removePostfix) if (removePostfix)
{ {
return field.substring(0, field.lastIndexOf("_acid")); return field.substring(0, field.lastIndexOf("_acid"));
}else{ } else {
return field + "_acid"; return field + "_acid";
} }
}else if(facetFieldConfig.getType().equals(DiscoveryConfigurationParameters.TYPE_STANDARD)) } else if (facetFieldConfig.getType().equals(DiscoveryConfigurationParameters.TYPE_STANDARD))
{ {
return field; return field;
}else{ } else {
return field; return field;
} }
} }
protected String transformDisplayedValue(Context context, String field, String value) throws SQLException { protected String transformDisplayedValue(Context context, String field, String value) throws SQLException {
if(field.equals("location.comm") || field.equals("location.coll")) if (field.equals("location.comm") || field.equals("location.coll"))
{ {
value = locationToName(context, field, value); value = locationToName(context, field, value);
} }
@@ -2276,7 +2311,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{ {
//We have a filter make sure we split ! //We have a filter make sure we split !
String separator = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("discovery.solr.facets.split.char"); String separator = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("discovery.solr.facets.split.char");
if(separator == null) if (separator == null)
{ {
separator = FILTER_SEPARATOR; separator = FILTER_SEPARATOR;
} }
@@ -2291,7 +2326,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
valueBuffer.append(split[0]); valueBuffer.append(split[0]);
} }
value = valueBuffer.toString(); value = valueBuffer.toString();
}else if(value.matches("\\((.*?)\\)")) } else if (value.matches("\\((.*?)\\)"))
{ {
//The brackets where added for better solr results, remove the first & last one //The brackets where added for better solr results, remove the first & last one
value = value.substring(1, value.length() -1); value = value.substring(1, value.length() -1);
@@ -2300,7 +2335,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
} }
protected String transformAuthorityValue(Context context, String field, String value) throws SQLException { protected String transformAuthorityValue(Context context, String field, String value) throws SQLException {
if(field.equals("location.comm") || field.equals("location.coll")) if (field.equals("location.comm") || field.equals("location.coll"))
{ {
return value; return value;
} }
@@ -2309,7 +2344,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{ {
//We have a filter make sure we split ! //We have a filter make sure we split !
String separator = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("discovery.solr.facets.split.char"); String separator = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("discovery.solr.facets.split.char");
if(separator == null) if (separator == null)
{ {
separator = FILTER_SEPARATOR; separator = FILTER_SEPARATOR;
} }
@@ -2335,7 +2370,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
} }
protected String transformSortValue(Context context, String field, String value) throws SQLException { protected String transformSortValue(Context context, String field, String value) throws SQLException {
if(field.equals("location.comm") || field.equals("location.coll")) if (field.equals("location.comm") || field.equals("location.coll"))
{ {
value = locationToName(context, field, value); value = locationToName(context, field, value);
} }
@@ -2344,7 +2379,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{ {
//We have a filter make sure we split ! //We have a filter make sure we split !
String separator = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("discovery.solr.facets.split.char"); String separator = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("discovery.solr.facets.split.char");
if(separator == null) if (separator == null)
{ {
separator = FILTER_SEPARATOR; separator = FILTER_SEPARATOR;
} }
@@ -2358,7 +2393,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
valueBuffer.append(fqParts[i]); valueBuffer.append(fqParts[i]);
} }
value = valueBuffer.toString(); value = valueBuffer.toString();
}else if(value.matches("\\((.*?)\\)")) } else if (value.matches("\\((.*?)\\)"))
{ {
//The brackets where added for better solr results, remove the first & last one //The brackets where added for better solr results, remove the first & last one
value = value.substring(1, value.length() -1); value = value.substring(1, value.length() -1);
@@ -2379,7 +2414,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
@Override @Override
public void commit() throws SearchServiceException { public void commit() throws SearchServiceException {
try { try {
if(getSolr() != null) if (getSolr() != null)
{ {
getSolr().commit(); getSolr().commit();
} }

View File

@@ -55,6 +55,8 @@ public class DiscoveryHitHighlightFieldConfiguration
/** /**
* Get the maximum number of highlighted snippets to generate per field * Get the maximum number of highlighted snippets to generate per field
*
* @return maximum number of highlighted snippets to generate per field
*/ */
public int getSnippets() public int getSnippets()
{ {

View File

@@ -62,10 +62,11 @@ public class EmbargoCLITool {
* <dt>-q,--quiet</dt> * <dt>-q,--quiet</dt>
* <dd> No output except upon error.</dd> * <dd> No output except upon error.</dd>
* </dl> * </dl>
*
* @param argv the command line arguments given
*/ */
public static void main(String argv[]) public static void main(String argv[])
{ {
int status = 0; int status = 0;
Options options = new Options(); Options options = new Options();
@@ -197,7 +198,7 @@ public class EmbargoCLITool {
if (line.hasOption('a')){ if (line.hasOption('a')){
embargoService.setEmbargo(context, item); embargoService.setEmbargo(context, item);
} }
else{ else {
log.debug("Testing embargo on item="+item.getHandle()+", date="+liftDate.toString()); log.debug("Testing embargo on item="+item.getHandle()+", date="+liftDate.toString());
if (liftDate.toDate().before(now)) if (liftDate.toDate().before(now))
{ {
@@ -229,8 +230,8 @@ public class EmbargoCLITool {
} }
catch (Exception e) catch (Exception e)
{ {
log.error("Failed attempting to lift embargo, item="+item.getHandle()+": ", e); log.error("Failed attempting to lift embargo, item=" + item.getHandle() + ": ", e);
System.err.println("Failed attempting to lift embargo, item="+item.getHandle()+": "+ e); System.err.println("Failed attempting to lift embargo, item=" + item.getHandle() + ": " + e);
status = true; status = true;
} }
} }

View File

@@ -28,8 +28,17 @@ public interface EmbargoLifter
* (access control) by (for example) turning on default read access to all * (access control) by (for example) turning on default read access to all
* Bitstreams. * Bitstreams.
* *
* @param context the DSpace context * @param context
* @param item the Item on which to lift the embargo * The relevant DSpace Context.
* @param item
* the Item on which to lift the embargo
* @throws IOException
* A general class of exceptions produced by failed or interrupted I/O operations.
* @throws SQLException
* An exception that provides information on a database access error or other errors.
* @throws AuthorizeException
* Exception indicating the current user of the context does not have permission
* to perform a particular action.
*/ */
public void liftEmbargo(Context context, Item item) public void liftEmbargo(Context context, Item item)
throws SQLException, AuthorizeException, IOException; throws SQLException, AuthorizeException, IOException;

View File

@@ -171,6 +171,8 @@ public class EmbargoServiceImpl implements EmbargoService
* Ensures the configurationService is injected, so that we can * Ensures the configurationService is injected, so that we can
* get plugins and MD field settings from config. * get plugins and MD field settings from config.
* Called by "init-method" in Spring config. * Called by "init-method" in Spring config.
*
* @throws Exception on generic exception
*/ */
public void init() throws Exception public void init() throws Exception
{ {

View File

@@ -42,6 +42,11 @@ public interface EmbargoSetter
* @param item the item to embargo * @param item the item to embargo
* @param terms value of the metadata field configured as embargo terms, if any. * @param terms value of the metadata field configured as embargo terms, if any.
* @return absolute date on which the embargo is to be lifted, or null if none * @return absolute date on which the embargo is to be lifted, or null if none
* @throws SQLException
* An exception that provides information on a database access error or other errors.
* @throws AuthorizeException
* Exception indicating the current user of the context does not have permission
* to perform a particular action.
*/ */
public DCDate parseTerms(Context context, Item item, String terms) public DCDate parseTerms(Context context, Item item, String terms)
throws SQLException, AuthorizeException; throws SQLException, AuthorizeException;
@@ -52,6 +57,11 @@ public interface EmbargoSetter
* *
* @param context the DSpace context * @param context the DSpace context
* @param item the item to embargo * @param item the item to embargo
* @throws SQLException
* An exception that provides information on a database access error or other errors.
* @throws AuthorizeException
* Exception indicating the current user of the context does not have permission
* to perform a particular action.
*/ */
public void setEmbargo(Context context, Item item) public void setEmbargo(Context context, Item item)
throws SQLException, AuthorizeException; throws SQLException, AuthorizeException;
@@ -68,6 +78,13 @@ public interface EmbargoSetter
* *
* @param context the DSpace context * @param context the DSpace context
* @param item the item to embargo * @param item the item to embargo
* @throws IOException
* A general class of exceptions produced by failed or interrupted I/O operations.
* @throws SQLException
* An exception that provides information on a database access error or other errors.
* @throws AuthorizeException
* Exception indicating the current user of the context does not have permission
* to perform a particular action.
*/ */
public void checkEmbargo(Context context, Item item) public void checkEmbargo(Context context, Item item)
throws SQLException, AuthorizeException, IOException; throws SQLException, AuthorizeException, IOException;

View File

@@ -51,6 +51,11 @@ public interface EmbargoService {
* *
* @param context the DSpace context * @param context the DSpace context
* @param item the item to embargo * @param item the item to embargo
* @throws SQLException
* An exception that provides information on a database access error or other errors.
* @throws AuthorizeException
* Exception indicating the current user of the context does not have permission
* to perform a particular action.
*/ */
public void setEmbargo(Context context, Item item) public void setEmbargo(Context context, Item item)
throws SQLException, AuthorizeException; throws SQLException, AuthorizeException;
@@ -69,6 +74,11 @@ public interface EmbargoService {
* @param context the DSpace context * @param context the DSpace context
* @param item the item to embargo * @param item the item to embargo
* @return lift date on which the embargo is to be lifted, or null if none * @return lift date on which the embargo is to be lifted, or null if none
* @throws SQLException
* An exception that provides information on a database access error or other errors.
* @throws AuthorizeException
* Exception indicating the current user of the context does not have permission
* to perform a particular action.
*/ */
public DCDate getEmbargoTermsAsDate(Context context, Item item) public DCDate getEmbargoTermsAsDate(Context context, Item item)
throws SQLException, AuthorizeException; throws SQLException, AuthorizeException;
@@ -80,6 +90,13 @@ public interface EmbargoService {
* *
* @param context the DSpace context * @param context the DSpace context
* @param item the item on which to lift the embargo * @param item the item on which to lift the embargo
* @throws IOException
* A general class of exceptions produced by failed or interrupted I/O operations.
* @throws SQLException
* An exception that provides information on a database access error or other errors.
* @throws AuthorizeException
* Exception indicating the current user of the context does not have permission
* to perform a particular action.
*/ */
public void liftEmbargo(Context context, Item item) public void liftEmbargo(Context context, Item item)
throws SQLException, AuthorizeException, IOException; throws SQLException, AuthorizeException, IOException;

View File

@@ -107,7 +107,7 @@ public class AccountServiceImpl implements AccountService
* @param token * @param token
* Account token * Account token
* @return The EPerson corresponding to token, or null. * @return The EPerson corresponding to token, or null.
* @exception SQLException * @throws SQLException
* If the token or eperson cannot be retrieved from the * If the token or eperson cannot be retrieved from the
* database. * database.
*/ */
@@ -161,7 +161,7 @@ public class AccountServiceImpl implements AccountService
* DSpace context * DSpace context
* @param token * @param token
* The token to delete * The token to delete
* @exception SQLException * @throws SQLException
* If a database error occurs * If a database error occurs
*/ */
@Override @Override
@@ -171,7 +171,7 @@ public class AccountServiceImpl implements AccountService
registrationDataService.deleteByToken(context, token); registrationDataService.deleteByToken(context, token);
} }
/* /**
* THIS IS AN INTERNAL METHOD. THE SEND PARAMETER ALLOWS IT TO BE USED FOR * THIS IS AN INTERNAL METHOD. THE SEND PARAMETER ALLOWS IT TO BE USED FOR
* TESTING PURPOSES. * TESTING PURPOSES.
* *
@@ -179,15 +179,18 @@ public class AccountServiceImpl implements AccountService
* is TRUE, this is registration email; otherwise, it is forgot-password * is TRUE, this is registration email; otherwise, it is forgot-password
* email. If send is TRUE, the email is sent; otherwise it is skipped. * email. If send is TRUE, the email is sent; otherwise it is skipped.
* *
* Potential error conditions: No EPerson with that email (returns null) * Potential error conditions:
* Cannot create registration data in database (throws SQLException) Error * @return null if no EPerson with that email found
* sending email (throws MessagingException) Error reading email template * @throws SQLException Cannot create registration data in database
* (throws IOException) Authorization error (throws AuthorizeException) * @throws MessagingException Error sending email
* @throws IOException Error reading email template
* @throws AuthorizeException Authorization error
* *
* @param context DSpace context @param email Email address to send the * @param context DSpace context
* forgot-password email to @param isRegister If true, this is for * @param email Email address to send the forgot-password email to
* registration; otherwise, it is for forgot-password @param send If true, * @param isRegister If true, this is for registration; otherwise, it is
* send email; otherwise do not send any email * for forgot-password
* @param send If true, send email; otherwise do not send any email
*/ */
protected RegistrationData sendInfo(Context context, String email, protected RegistrationData sendInfo(Context context, String email,
boolean isRegister, boolean send) throws SQLException, IOException, boolean isRegister, boolean send) throws SQLException, IOException,
@@ -234,6 +237,8 @@ public class AccountServiceImpl implements AccountService
* If isRegister is <code>true</code>, this is registration email; * If isRegister is <code>true</code>, this is registration email;
* otherwise, it is a forgot-password email. * otherwise, it is a forgot-password email.
* *
* @param context
* The relevant DSpace Context.
* @param email * @param email
* The email address to mail to * The email address to mail to
* @param isRegister * @param isRegister
@@ -241,10 +246,12 @@ public class AccountServiceImpl implements AccountService
* forgot-password email. * forgot-password email.
* @param rd * @param rd
* The RDBMS row representing the registration data. * The RDBMS row representing the registration data.
* @exception MessagingException * @throws MessagingException
* If an error occurs while sending email * If an error occurs while sending email
* @exception IOException * @throws IOException
* If an error occurs while reading the email template. * A general class of exceptions produced by failed or interrupted I/O operations.
* @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
protected void sendEmail(Context context, String email, boolean isRegister, RegistrationData rd) protected void sendEmail(Context context, String email, boolean isRegister, RegistrationData rd)
throws MessagingException, IOException, SQLException throws MessagingException, IOException, SQLException

View File

@@ -104,8 +104,8 @@ public class EPerson extends DSpaceObject implements DSpaceObjectLegacySupport
/** /**
* Return true if this object equals obj, false otherwise. * Return true if this object equals obj, false otherwise.
* *
* @param obj * @param obj another EPerson.
* @return true if ResourcePolicy objects are equal * @return true if EPerson objects are equal in ID, email, and full name
*/ */
@Override @Override
public boolean equals(Object obj) public boolean equals(Object obj)
@@ -165,8 +165,12 @@ public class EPerson extends DSpaceObject implements DSpaceObjectLegacySupport
* Locale specification of the form {language} or {language}_{territory}, * Locale specification of the form {language} or {language}_{territory},
* e.g. "en", "en_US", "pt_BR" (the latter is Brazilian Portugese). * e.g. "en", "en_US", "pt_BR" (the latter is Brazilian Portugese).
* *
* @param context
* The relevant DSpace Context.
* @param language * @param language
* language code * language code
* @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
public void setLanguage(Context context, String language) throws SQLException { public void setLanguage(Context context, String language) throws SQLException {
getePersonService().setMetadataSingleValue(context, this, "eperson", "language", null, null, language); getePersonService().setMetadataSingleValue(context, this, "eperson", "language", null, null, language);
@@ -253,8 +257,12 @@ public class EPerson extends DSpaceObject implements DSpaceObjectLegacySupport
/** /**
* Set the eperson's first name * Set the eperson's first name
* *
* @param context
* The relevant DSpace Context.
* @param firstname * @param firstname
* the person's first name * the person's first name
* @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
public void setFirstName(Context context, String firstname) throws SQLException { public void setFirstName(Context context, String firstname) throws SQLException {
getePersonService().setMetadataSingleValue(context, this, "eperson", "firstname", null, null, firstname); getePersonService().setMetadataSingleValue(context, this, "eperson", "firstname", null, null, firstname);
@@ -274,8 +282,12 @@ public class EPerson extends DSpaceObject implements DSpaceObjectLegacySupport
/** /**
* Set the eperson's last name * Set the eperson's last name
* *
* @param context
* The relevant DSpace Context.
* @param lastname * @param lastname
* the person's last name * the person's last name
* @throws SQLException
* An exception that provides information on a database access error or other errors.
*/ */
public void setLastName(Context context, String lastname) throws SQLException { public void setLastName(Context context, String lastname) throws SQLException {
getePersonService().setMetadataSingleValue(context, this, "eperson", "lastname", null, null, lastname); getePersonService().setMetadataSingleValue(context, this, "eperson", "lastname", null, null, lastname);
@@ -369,7 +381,7 @@ public class EPerson extends DSpaceObject implements DSpaceObjectLegacySupport
} }
/** /**
* return type found in Constants * @return type found in Constants, see {@link org.dspace.core.Constants#Constants Constants}
*/ */
@Override @Override
public int getType() public int getType()

View File

@@ -45,6 +45,15 @@ public class EPersonCLITool {
/** /**
* Tool for manipulating user accounts. * Tool for manipulating user accounts.
*
* @param argv the command line arguments given
* @throws ParseException
* Base for Exceptions thrown during parsing of a command-line.
* @throws SQLException
* An exception that provides information on a database access error or other errors.
* @throws AuthorizeException
* Exception indicating the current user of the context does not have permission
* to perform a particular action.
*/ */
public static void main(String argv[]) public static void main(String argv[])
throws ParseException, SQLException, AuthorizeException { throws ParseException, SQLException, AuthorizeException {

View File

@@ -50,7 +50,9 @@ public class EPersonConsumer implements Consumer
* Consume the event * Consume the event
* *
* @param context * @param context
* The relevant DSpace Context.
* @param event * @param event
* Which Event to consume
* @throws Exception if error * @throws Exception if error
*/ */
@Override @Override
@@ -116,6 +118,7 @@ public class EPersonConsumer implements Consumer
* Handle the end of the event * Handle the end of the event
* *
* @param ctx * @param ctx
* The relevant DSpace Context.
* @throws Exception if error * @throws Exception if error
*/ */
@Override @Override
@@ -129,6 +132,7 @@ public class EPersonConsumer implements Consumer
* Finish the event * Finish the event
* *
* @param ctx * @param ctx
* The relevant DSpace Context.
*/ */
@Override @Override
public void finish(Context ctx) public void finish(Context ctx)

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