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
- 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
before_install:
# Install Node.js 6.5.0 & print version info

View File

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

View File

@@ -72,10 +72,10 @@ public interface ExtractingParams {
/**
* Restrict the extracted parts of a document to be indexed
* 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>
* See Tika's docs for what the extracted document looks like.
* <p>
*
* @see #CAPTURE_ELEMENTS
*/
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
* then the case of passing in an XPath expression.
* <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
* be mapped into the index schema.
* <p>

View File

@@ -48,7 +48,7 @@ public class CommunityFiliator
/**
*
* @param argv arguments
* @param argv the command line arguments given
* @throws Exception if error
*/
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,
* it will negotiate with the user for the administrator details
*
* @param argv
* command-line arguments
* @param argv the command line arguments given
* @throws Exception if error
*/
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
* @param args arguments
*
* @param args the command line arguments given
* @throws ParseException if parse error
* @throws SQLException if database error
* @throws IOException if IO error

View File

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

View File

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

View File

@@ -67,12 +67,18 @@ public class Harvest
options.addOption("P", "purge", false, "purge all harvestable collections");
options.addOption("e", "eperson", true, "eperson");
options.addOption("c", "collection", true, "harvesting collection (handle or id)");
options.addOption("t", "type", true, "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("e", "eperson", true,
"eperson");
options.addOption("c", "collection", true,
"harvesting collection (handle or id)");
options.addOption("t", "type", true,
"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");
@@ -90,22 +96,14 @@ public class Harvest
{
HelpFormatter myhelp = new HelpFormatter();
myhelp.printHelp("Harvest\n", options);
System.out
.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
.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("RUN harvest once: Harvest -r -e eperson -c collection");
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");
System.out.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.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("RUN harvest once: Harvest -r -e eperson -c collection");
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
* @return whether bitstream name matches the regular expression
* @exception BitstreamFilterException if filter error
* @throws BitstreamFilterException if filter error
*/
@Override
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)
{
@@ -138,13 +138,13 @@ public class ItemUpdate {
delBitstreamOption.setArgName("BitstreamFilter");
options.addOption(delBitstreamOption);
//other params
//other params
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("F", "filter-properties", true, "filter class name; only for deleting bitstream");
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("P", "provenance", false, "suppress altering provenance field for bitstream changes");
options.addOption("h", "help", false, "help");
@@ -395,6 +395,7 @@ public class ItemUpdate {
/**
* process an archive
*
* @param context DSpace Context
* @param sourceDirPath source path
* @param itemField item field
@@ -516,7 +517,6 @@ public class ItemUpdate {
/**
*
* to avoid overwriting the undo source tree on repeated processing
* sequence numbers are added and checked
*
@@ -606,6 +606,7 @@ public class ItemUpdate {
* poor man's logging
* 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.
*
* @param s String
*/
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 FileNotFoundException if file doesn't exist
*/

View File

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

View File

@@ -61,7 +61,7 @@ public abstract class MediaFilter implements FormatFilter
* @param generatedBitstream
* the bitstream which was generated by
* this filter.
* @throws java.lang.Exception
* @throws Exception if error
*/
@Override
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
* @param context context
* @param bitstream bitstream
* @param item item
* @param reqMessage message
* @param allFiles all files flag
* @param context
* The relevant DSpace Context.
* @param bitstream
* The requested bitstream
* @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 reqName name
* Requester email
* @param reqName
* Requester name
* @return the token of the request item
* @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.
*
* @param context
* The relevant DSpace Context.
* @param requestItem
* requested item
*/
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
* 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 SQLException if database error
*/
@@ -1187,13 +1187,13 @@ public class LogAnalyser
// that
DiscoverQuery discoverQuery = new DiscoverQuery();
if(StringUtils.isNotBlank(type))
if (StringUtils.isNotBlank(type))
{
discoverQuery.addFilterQueries("dc.type=" + type +"*");
}
StringBuilder accessionedQuery = new StringBuilder();
accessionedQuery.append("dc.date.accessioned_dt:[");
if(startDate != null)
if (startDate != null)
{
accessionedQuery.append(unParseDate(startDate));
}
@@ -1202,7 +1202,7 @@ public class LogAnalyser
accessionedQuery.append("*");
}
accessionedQuery.append(" TO ");
if(endDate != null)
if (endDate != null)
{
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
* details as to how to use the command line flags
* @param argv
* @throws java.lang.Exception
* @throws java.sql.SQLException
* @param argv the command line arguments given
* @throws Exception on generic exception
* @throws SQLException
* An exception that provides information on a database access error or other errors.
*/
public static void main(String [] argv)
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.
* The full path will not be truncated.
*
* @param context
* The relevant DSpace Context.
* @param col
* Get full path for this 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.
* 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
* Get full path for this collection
* @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).
* @param context
* The relevant DSpace Context.
* @param collections An array of collections to annotate with their hierarchical paths.
* The array and all its entries must be non-null.
* @return A sorted array of collection path entries (essentially collection/path pairs).

View File

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

View File

@@ -94,8 +94,10 @@ public class DCInput
* a HashMap
*
* @param fieldMap
* ???
* named field values.
*
* @param listMap
* value-pairs map, computed from the forms definition XML file
*/
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?
* 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
*/
public boolean isFieldPresent(String fieldName)
@@ -152,7 +152,7 @@ public class DCInputSet
*/
public boolean isFieldPresent(String fieldName, String documentType)
{
if(documentType == null){
if (documentType == null) {
documentType = "";
}
for (int i = 0; i < inputPages.length; i++)
@@ -164,7 +164,7 @@ public class DCInputSet
pageInputs[row].getQualifier();
if (fullName.equals(fieldName) )
{
if(pageInputs[row].isAllowedFor(documentType)){
if (pageInputs[row].isAllowedFor(documentType)) {
return true;
}
}

View File

@@ -82,6 +82,7 @@ public class DCInputsReader
* level structures: a map between collections and forms, the definition for
* each page of each form, and lists of pairs of values that populate
* selection boxes.
*
* @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
* should correspond to the collection-form maps, the form definitions, and
* the display/storage word pairs.
*
* @param n
* top-level DOM node
*/
private void doNodes(Node n)
throws SAXException, DCInputsReaderException
@@ -337,7 +341,6 @@ public class DCInputsReader
// we omit the duplicate validation, allowing multiple fields definition for
// the same metadata and different visibility/type-bind
}
}
} // ignore any child that is not a 'page'
@@ -545,7 +548,6 @@ public class DCInputsReader
String errString =
"Missing name attribute for value-pairs for DC term " + dcTerm;
throw new SAXException(errString);
}
List<String> pairs = new ArrayList<String>();
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
// 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.
* @param event
* This is the event class for notifications about changes to the servlet context of a web application.
*/
@Override
public void contextInitialized(ServletContextEvent event)
@@ -63,6 +64,7 @@ public class DSpaceContextListener implements ServletContextListener
* Clean up resources used by the application when stopped
*
* @param event
8 Event class for notifications about changes to the servlet context of a web application.
*/
@Override
public void contextDestroyed(ServletContextEvent event)

View File

@@ -229,6 +229,7 @@ public class GoogleMetadata
* first-encountered instance of the field for this Item.
*
* @param fieldName
* metadata field name
* @return successful?
*/
protected boolean addSingleField(String fieldName)
@@ -262,7 +263,7 @@ public class GoogleMetadata
if (config.equals("$simple-pdf"))
{
String pdf_url = getPDFSimpleUrl(item);
if(pdf_url.length() > 0)
if (pdf_url.length() > 0)
{
metadataMappings.put(fieldName, pdf_url);
return true;
@@ -291,6 +292,7 @@ public class GoogleMetadata
* instead of an aggregate.
*
* @param configFilter
* list of DC metadata fields separated by "|" characters
* @return The first configured match of metadata field for the item.
*/
protected MetadataValue resolveMetadataField(String configFilter)
@@ -309,6 +311,7 @@ public class GoogleMetadata
* A plural version of resolveMetadata for aggregate fields.
*
* @param configFilter
* list of DC metadata fields separated by "|" characters
* @return Aggregate of all matching metadata fields configured in the first
* option field-set to return any number of filter matches.
*/
@@ -328,7 +331,9 @@ public class GoogleMetadata
* configuration filter.
*
* @param configFilter
* list of DC metadata fields separated by "|" characters
* @param returnType
* GoogleMetadata.SINGLE / GoogleMetadata.MULTI / GoogleMetadata.ALL_FIELDS_IN_OPTION
* @return Array of configuration to item-field matches
*/
protected ArrayList<MetadataValue> resolveMetadata(String configFilter,
@@ -350,8 +355,7 @@ public class GoogleMetadata
if (log.isDebugEnabled())
{
log
.debug("Resolved Fields For This Item Per Configuration Filter:");
log.debug("Resolved Fields For This Item Per Configuration Filter:");
for (int i = 0; i < parsedOptions.size(); i++)
{
ArrayList<String> optionFields = parsedOptions.get(i);
@@ -445,6 +449,7 @@ public class GoogleMetadata
* configuration.
*
* @param configFilter
* list of DC metadata fields separated by "|" characters
* @return array of parsed options or null
*/
protected ArrayList<ArrayList<String>> parseOptions(String configFilter)
@@ -720,7 +725,7 @@ public class GoogleMetadata
// Dissertations
if (itemIsDissertation())
{
if(log.isDebugEnabled()) {
if (log.isDebugEnabled()) {
log.debug("ITEM TYPE: DISSERTATION");
}
@@ -731,7 +736,7 @@ public class GoogleMetadata
// Patents
if (itemIsPatent())
{
if(log.isDebugEnabled()) {
if (log.isDebugEnabled()) {
log.debug("ITEM TYPE: PATENT");
}
@@ -750,7 +755,7 @@ public class GoogleMetadata
// Tech Reports
if (itemIsTechReport())
{
if(log.isDebugEnabled()) {
if (log.isDebugEnabled()) {
log.debug("ITEM TYPE: TECH REPORT");
}
addSingleField(TECH_REPORT_NUMBER);
@@ -758,7 +763,7 @@ public class GoogleMetadata
}
if(!itemIsDissertation() && !itemIsTechReport()) {
if (!itemIsDissertation() && !itemIsTechReport()) {
// 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
* 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
*/
protected String getPDFSimpleUrl(Item item)
@@ -1045,7 +1050,9 @@ public class GoogleMetadata
* <li>the primary bitstream</li>
* </ul>
* Additionally, this bitstream must be publicly viewable.
*
* @param item
* bitstream's parent item
* @return a linkable bitstream or null if none found
* @throws SQLException if database error
*/
@@ -1071,6 +1078,13 @@ public class GoogleMetadata
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) {
if (bitstream == null) {
return false;
@@ -1122,6 +1136,7 @@ public class GoogleMetadata
/**
* If metadata field contains multiple values, then add each value to the map separately
* @param FIELD
* metadata field
*/
protected void addMultipleValues(String FIELD)
{
@@ -1201,6 +1216,7 @@ public class GoogleMetadata
* metadata practice.
*
* @param dConfig
* configured fields (from google-metadata.properties)
* @return item matches configuration
*/
protected boolean identifyItemType(String dConfig)
@@ -1223,7 +1239,7 @@ public class GoogleMetadata
if (mdPairs.containsKey(parsedPair[0].trim()))
{
mdPairs.get(parsedPair[0].trim()).add(parsedPair[1]);
if(log.isDebugEnabled()) {
if (log.isDebugEnabled()) {
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"));
}
catch(UnsupportedEncodingException e)
catch (UnsupportedEncodingException e)
{
log.error(e);
}
@@ -281,7 +281,9 @@ public class OpenSearchServiceImpl implements OpenSearchService, InitializingBea
/**
* Converts a JDOM document to a W3C one
*
* @param jdomDoc
* jDOM document to convert
* @return W3C Document object
* @throws IOException if IO error
*/
@@ -292,7 +294,7 @@ public class OpenSearchServiceImpl implements OpenSearchService, InitializingBea
{
return domOut.output(jdomDoc);
}
catch(JDOMException jde)
catch (JDOMException 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
* <step-definitions> section)
* &lt;step-definitions&gt; section)
*/
private String id = null;

View File

@@ -13,13 +13,15 @@ import java.net.Inet6Address;
import java.net.UnknownHostException;
/**
* <p>
* Quickly tests whether a given IP address matches an IP range. An
* {@code IPMatcher} is initialized with a particular IP range specification.
* Calls to {@link IPMatcher#match(String) match} method will then quickly
* determine whether a given IP falls within that range.
* </p>
* <p>
* Supported range specifications are:
* <p>
* </p>
* <ul>
* <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>

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).
* 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 a string that will allow this AuthorityType to be recognized and
* 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}
*/
public String generateString() {

View File

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

View File

@@ -624,7 +624,7 @@ public class AuthorizeServiceImpl implements AuthorizeService
List<Group> groups = new ArrayList<Group>();
for (ResourcePolicy resourcePolicy : policies) {
if(resourcePolicy.getGroup() != null)
if (resourcePolicy.getGroup() != null)
{
groups.add(resourcePolicy.getGroup());
}
@@ -653,7 +653,7 @@ public class AuthorizeServiceImpl implements AuthorizeService
if (CollectionUtils.isNotEmpty(policies))
{
return policies.iterator().next();
}else{
} else {
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.
*
* @param context
* The relevant DSpace Context.
* @param embargoDate
* embargo end date
* @param reason
* embargo reason
* @param dso
* DSpace object
* @param owningCollection
* collection to get group policies from
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
*/
@Override
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))
@@ -714,7 +720,7 @@ public class AuthorizeServiceImpl implements AuthorizeService
@Override
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.");
}

View File

@@ -34,7 +34,8 @@ public class FixDefaultPolicies
{
/**
* Command line interface to setPolicies - run to see arguments
* @param argv arguments
*
* @param argv the command line arguments given
* @throws Exception if error
*/
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
* @param argv arguments
*
* @param argv the command line arguments given
* @throws Exception if error
*/
public static void main(String[] argv) throws Exception
@@ -130,17 +131,30 @@ public class PolicySet
/**
*
* @param c
* current context
* @param containerType
* type, Constants.ITEM or Constants.COLLECTION
* @param containerID
* ID of container (DB primary key)
* @param contentType
* ID of container (DB primary key)
* @param actionID
* action ID (e.g. Constants.READ)
* @param groupID
* group ID (database key)
* @param isReplace
* if <code>true</code>, existing policies are removed first,
* otherwise add to existing policies
* @param clearOnly
* if non-null, only process bitstreams whose names contain filter
* @param name
* policy name
* @param description
* policy descrption
* @param startDate
* policy start date
* @param endDate
* policy end date
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
*/
@@ -166,7 +180,7 @@ public class PolicySet
* @param contentType
* type (BUNDLE, ITEM, or BITSTREAM)
* @param actionID
* action ID
* action ID (e.g. Constants.READ)
* @param groupID
* group ID (database key)
* @param isReplace
@@ -214,9 +228,13 @@ public class PolicySet
* @param filter
* if non-null, only process bitstreams whose names contain filter
* @param name
* policy name
* @param description
* policy description
* @param startDate
* policy start date
* @param endDate
* policy end date
* @throws SQLException if database error
* if database problem
* @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
if(!authorizeService.isAnIdenticalPolicyAlreadyInPlace(c, myitem, group, actionID, -1)){
if (!authorizeService.isAnIdenticalPolicyAlreadyInPlace(c, myitem, group, actionID, -1)) {
// now add the policy
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.
*
* @param obj
* object to compare (eperson, group, start date, end date, ...)
* @return true if ResourcePolicy objects are equal
*/
@Override
@@ -144,23 +145,22 @@ public class ResourcePolicy implements ReloadableEntity<Integer> {
{
int hash = 7;
hash = 19 * hash + this.getAction();
if(this.getGroup() != null)
if (this.getGroup() != null)
{
hash = 19 * hash + this.getGroup().hashCode();
}else{
} else {
hash = 19 * hash + -1;
}
if(this.getEPerson() != null)
if (this.getEPerson() != null)
{
hash = 19 * hash + this.getEPerson().hashCode();
}else{
} else {
hash = 19 * hash + -1;
}
hash = 19 * hash + (this.getStartDate() != null? this.getStartDate().hashCode():0);
hash = 19 * hash + (this.getEndDate() != null? this.getEndDate().hashCode():0);
hash = 19 * hash + (this.getStartDate() != null ? this.getStartDate().hashCode() : 0);
hash = 19 * hash + (this.getEndDate() != null ? this.getEndDate().hashCode() : 0);
return hash;
}
@@ -185,7 +185,7 @@ public class ResourcePolicy implements ReloadableEntity<Integer> {
/**
* 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)
{
@@ -279,24 +279,24 @@ public class ResourcePolicy implements ReloadableEntity<Integer> {
this.endDate = d;
}
public String getRpName(){
public String getRpName() {
return rpname;
}
public void setRpName(String name){
public void setRpName(String name) {
this.rpname = name;
}
public String getRpType(){
public String getRpType() {
return rptype;
}
public void setRpType(String type){
public void setRpType(String type) {
this.rptype = type;
}
public String getRpDescription(){
public String getRpDescription() {
return rpdescription;
}
public void setRpDescription(String description){
public void setRpDescription(String description) {
this.rpdescription = description;
}
}

View File

@@ -47,7 +47,8 @@ public interface AuthorizeService {
* <code>org.dspace.core.Constants</code>
* @throws AuthorizeException if any one of the specified actions cannot be
* 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;
@@ -59,8 +60,11 @@ public interface AuthorizeService {
* @param c context
* @param o a DSpaceObject
* @param action action to perform from <code>org.dspace.core.Constants</code>
* @throws AuthorizeException if the user is denied
* @throws SQLException if database error
* @throws AuthorizeException
* 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;
@@ -75,8 +79,11 @@ public interface AuthorizeService {
* flag to say if ADMIN action on the current object or parent
* object can be used
* @param action action to perform from <code>org.dspace.core.Constants</code>
* @throws AuthorizeException if the user is denied
* @throws SQLException if database error
* @throws AuthorizeException
* 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)
throws AuthorizeException, SQLException;
@@ -93,8 +100,11 @@ public interface AuthorizeService {
* flag to say if ADMIN action on the current object or parent
* object can be used
* @param action action to perform from <code>org.dspace.core.Constants</code>
* @throws AuthorizeException if the user is denied
* @throws SQLException if database error
* @throws AuthorizeException
* 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)
throws AuthorizeException, SQLException;
@@ -109,7 +119,8 @@ public interface AuthorizeService {
* <code>org.dspace.core.Constants</code>
* @return {@code true} if the current user in the context is
* 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;
@@ -126,7 +137,8 @@ public interface AuthorizeService {
* object can be used
* @return {@code true} if the current user in the context is
* 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;
@@ -144,7 +156,8 @@ public interface AuthorizeService {
* object can be used
* @return {@code true} if the requested user is
* 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;
@@ -163,7 +176,8 @@ public interface AuthorizeService {
* method
* @return {@code true} if user has administrative privileges on the
* 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;
@@ -176,7 +190,8 @@ public interface AuthorizeService {
* @param c current context
* @return {@code true} if user is an admin or ignore authorization
* 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;
@@ -437,6 +452,7 @@ public interface AuthorizeService {
* specified object to the new action (toPolicy)
*
* @param context
* The relevant DSpace Context.
* @param dso
* the dspace object
* @param fromAction
@@ -444,7 +460,10 @@ public interface AuthorizeService {
* @param toAction
* the new action to set
* @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.
*/
void switchPoliciesAction(Context context, DSpaceObject dso, int fromAction, int toAction)
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.
*
* @param containerID
* community/collection internal ID (UUID)
*/
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
* means do not offset.
*
* @return the offset
* @return paging offset
*/
public int getOffset();
@@ -245,6 +246,7 @@ public interface BrowseDAO
* means do not offset.
*
* @param offset
* paging 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"
*
* @param etAl
* the number of metadata fields at which to truncate with "et al"
*/
public void setEtAl(int etAl)
{

View File

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

View File

@@ -30,8 +30,11 @@ public interface ChecksumHistoryDAO extends GenericDAO<ChecksumHistory> {
* the specified result code.
*
* @param context
* @param retentionDate row must be older than this to be deleted.
* @param checksumResultCode row must have this result to be deleted.
* The relevant DSpace Context.
* @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.
* @throws SQLException if database error
*/
@@ -41,7 +44,9 @@ public interface ChecksumHistoryDAO extends GenericDAO<ChecksumHistory> {
* Delete all ChecksumHistory rows for the given Bitstream.
*
* @param context
* The relevant DSpace Context.
* @param bitstream
* which bitstream's checksums to delete
* @throws SQLException if database error
*/
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."
*
* @param context
* The relevant DSpace Context.
* @param desc
* the user's description of the format
* @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
*
* @param collection
* which collection to operate on
* @param field
* the name of the metadata field to get
*
* @return the value of the metadata field
*
* @exception IllegalArgumentException
* @throws IllegalArgumentException
* if the requested metadata field doesn't exist
*/
@Override

View File

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

View File

@@ -149,8 +149,8 @@ public class ItemComparator implements Comparator, Serializable
}
/**
* @param first
* @param second
* @param first first operand
* @param second second operand
* @return true if the first string is equal to the second. Either or both
* may be null.
*/
@@ -224,7 +224,8 @@ public class ItemComparator implements Comparator, Serializable
/**
* Normalize the title of a Metadatum.
* @param value
*
* @param value metadata value
* @return normalized title
*/
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
*
* @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
* @throws SQLException
* An exception that provides information on a database access error or other errors.
*/
public boolean isInProgressSubmission(Context context, Item item) throws SQLException {
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
*/
@@ -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
*
* @param context
* The relevant DSpace Context.
* @param dso
* The DSpace Object to add policies to
* @param defaultCollectionPolicies
* list of policies
* @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.
*/
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
* @return an iterator over the items matching that authority value
* @throws SQLException if database error
* An exception that provides information on a database access error or other errors.
* @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
* A general class of exceptions produced by failed or interrupted I/O operations.
*
*/
@Override

View File

@@ -57,10 +57,15 @@ public class LicenseUtils
* LicenseArgumentFormatter based on his type (map key)
*
* @param locale
* Formatter locale
* @param collection
* collection to get license from
* @param item
* the item object of the license
* @param eperson
* EPerson to get firstname, lastname and email from
* @param additionalInfo
* additional template arguments beyond 0-6
* @return the license text obtained substituting the provided argument in
* the license template
*/
@@ -104,9 +109,13 @@ public class LicenseUtils
* supplying {@code null} for the additionalInfo argument)
*
* @param locale
* Formatter locale
* @param collection
* collection to get license from
* @param item
* the item object of the license
* @param eperson
* EPerson to get firstname, lastname and email from
* @return the license text, with no custom substitutions.
*/
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
*
* @param message
* message string
*/
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
* 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 {
if(!validatedBefore(schema, element, qualifier)) {
if (!validatedBefore(schema, element, qualifier)) {
// Verify that the schema exists
MetadataSchema mdSchema = metadataSchemaService.find(context, schema);
MetadataField mdField = null;

View File

@@ -402,9 +402,13 @@ public class METSRightsCrosswalk
* Ingest a whole XML document, starting at specified root.
*
* @param context
* The relevant DSpace Context.
* @param dso
* DSpace object to ingest
* @param root
* root element
* @param createMissingMetadataFields
* whether to create missing fields
* @throws CrosswalkException if crosswalk error
* @throws IOException if IO 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.
* @param context context
* @throws org.dspace.content.crosswalk.CrosswalkException
* @throws CrosswalkException if crosswalk error
* @throws IOException if IO error
* @throws SQLException if database error
* @throws AuthorizeException if authorization error

View File

@@ -32,6 +32,7 @@ public interface ParameterizedDisseminationCrosswalk
* <p>
*
* @param context
* The relevant DSpace Context.
* @param dso the DSpace Object whose metadata to export.
* @param parameters
* 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
* <p>
* See the XSLTCrosswalk superclass for details on configuration.
* <p>
* </p>
* <h3>Additional Configuration of Dissemination crosswalk:</h3>
* The disseminator also needs to be configured with an XML Namespace
* (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.
* Usage: {@code java XSLTDisseminationCrosswalk <crosswalk-name> <handle> [output-file]}
* @param argv arguments
*
* @param argv the command line arguments given
* @throws Exception if error
*/
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.
* Usage: {@code java XSLTIngestionCrosswalk <crosswalk-name> <input-file>}
* @param argv arguments
*
* @param argv the command line arguments given
* @throws Exception if error
*/
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
*
* @author kevinvandevelde at atmire.com
* @param <T>
* @param <T> some implementation of DSpaceObject
*/
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
*
* @author kevinvandevelde at atmire.com
* @param <T>
* @param <T> some implementation of DSpaceObject
*/
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();
/**
* <p>
* An instance of ZipMdrefManager holds the state needed to retrieve the
* contents of an external metadata stream referenced by an
* <code>mdRef</code> element in a Zipped up METS manifest.
@@ -244,7 +245,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
license);
//if ingestion was successful
if(dso!=null)
if (dso!=null)
{
// Log whether we finished an ingest (create new obj) or a restore
// (restore previously existing obj)
@@ -338,7 +339,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
// Retrieve the manifest file entry (named mets.xml)
ZipEntry manifestEntry = zip.getEntry(METSManifest.MANIFEST_FILE);
if(manifestEntry!=null)
if (manifestEntry!=null)
{
// parse the manifest and sanity-check it.
manifest = METSManifest.create(zip.getInputStream(manifestEntry),
@@ -404,7 +405,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
catch(UnsupportedOperationException e)
{
//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.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
// to install it into the archive & assign its handle.
if(wsi!=null)
if (wsi!=null)
{
// Finish creating the item. This actually assigns the handle,
// 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
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)
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.
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
InProgressSubmission inProgressSubmission = workspaceItemService.findByItem(context, item);
if(inProgressSubmission == null)
if (inProgressSubmission == null)
{
inProgressSubmission = WorkflowServiceFactory.getInstance().getWorkflowItemService().findByItem(context, item);
}
@@ -817,7 +818,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
// Set bitstream sequence id, if known
String seqID = mfile.getAttributeValue("SEQ");
if(seqID!=null && !seqID.isEmpty())
if (seqID!=null && !seqID.isEmpty())
bitstream.setSequenceID(Integer.parseInt(seqID));
// crosswalk this bitstream's administrative metadata located in
@@ -1044,7 +1045,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
CrosswalkException, PackageValidationException
{
//Template items only valid for collections
if(dso.getType()!=Constants.COLLECTION)
if (dso.getType()!=Constants.COLLECTION)
return;
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
List childObjList = manifest.getChildObjDivs();
if(childObjList!=null && !childObjList.isEmpty())
if (childObjList!=null && !childObjList.isEmpty())
{
Element templateItemDiv = null;
Iterator childIterator = childObjList.iterator();
//Search for the child with a type of "DSpace ITEM Template"
while(childIterator.hasNext())
while (childIterator.hasNext())
{
Element childDiv = (Element) childIterator.next();
String childType = childDiv.getAttributeValue("TYPE");
//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))
{
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(templateItemDiv!=null)
if (templateItemDiv!=null)
{
//make sure this templateItemDiv is associated with one or more dmdSecs
String templateDmdIds = templateItemDiv.getAttributeValue("DMDID");
if(templateDmdIds!=null)
if (templateDmdIds!=null)
{
//create our template item & get a reference to it
itemService.createTemplateItem(context, collection);
@@ -1193,7 +1194,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
null);
//if ingestion was successful
if(dso!=null)
if (dso!=null)
{
// Log that we created an object
log.info(LogManager.getHeader(context, "package_replace",
@@ -1222,7 +1223,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
}
//if ingest/restore/replace successful
if(dso!=null)
if (dso!=null)
{
// Check if the Packager is currently running 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 dso DSpace Object
* @param manifest the METSManifest
* @param manifest
* the METSManifest
* @param callback
* the MdrefManager (manages all external metadata files
* referenced by METS <code>mdref</code> elements)
* 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.
* array of Elements, each a METS <code>dmdSec</code> that
* applies to the Item as a whole.
* @param params
* Packager Parameters
* @throws CrosswalkException if crosswalk error
* @throws PackageValidationException if package validation error
* @throws IOException if IO error
@@ -1590,6 +1593,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
* @param license
* optional user-supplied Deposit License text (may be null)
* @param params
* Packager Parameters
* @throws PackageValidationException if package validation error
* @throws IOException if IO error
* @throws SQLException if database error

View File

@@ -454,6 +454,7 @@ public class DSpaceAIPDisseminator extends AbstractMETSDisseminator
* @throws IOException if IO error
* @throws AuthorizeException if authorization error
* @throws MetsException
* METS Java toolkit exception class.
*/
@Override
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
* same GROUPID<br>
* 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 CrosswalkException if crosswalk error
* @throws IOException if IO error
@@ -198,6 +213,15 @@ public class DSpaceAIPIngester
* license supplied by explicit argument next, else use collection's
* default deposit 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 IOException if IO error
* @throws SQLException if database error
@@ -211,7 +235,7 @@ public class DSpaceAIPIngester
{
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
newLicense = true;
@@ -225,7 +249,7 @@ public class DSpaceAIPIngester
newLicense = true;
}
if(newLicense)
if (newLicense)
{
PackageUtils.addDepositLicense(context, license, item, collection);
}
@@ -233,19 +257,30 @@ public class DSpaceAIPIngester
/**
* 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
* metadata fields already exist in the database (otherwise, the database
* will throw errors when we attempt to save/update the Item)
* </p>
*
* @param context DSpace Context
* @param dso DSpace object
* @param params Packager Parameters
* @throws org.dspace.content.packager.PackageValidationException
* @throws java.sql.SQLException
* @throws org.dspace.content.crosswalk.CrosswalkException
* @throws java.io.IOException
* @throws org.dspace.authorize.AuthorizeException
* @param context
* The relevant DSpace Context.
* @param dso
* DSpace object
* @param params
* Packager Parameters
* @throws PackageValidationException
* 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
public void finishObject(Context context, DSpaceObject dso, PackageParameters params)
@@ -253,7 +288,7 @@ public class DSpaceAIPIngester
AuthorizeException, SQLException, IOException
{
//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)
// 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;
/**
* <p>
* This represents a failure when importing or exporting a package
* caused by invalid unacceptable package format or contents; for
* example, missing files that were mentioned in the manifest, or
* extra files not in manifest, or lack of a manifest.
* </p>
* <p>
* When throwing a PackageValidationException, be sure the message
* includes enough specific information to let the end user diagnose
* 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.
* </p>
*
* @author Larry Stone
* @version $Revision$

View File

@@ -430,6 +430,7 @@ public class RoleIngester implements PackageIngester
* @param context DSpace Context
* @param parent the Parent DSpaceObject
* @param params package params
* @param stream input stream with the roles
* @throws PackageException if packaging error
* @throws SQLException if database 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.
* @param context
* The relevant DSpace Context.
* @param limit
* paging limit
* @param offset
* paging offset
* @return List of Collections
* @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
*
* @exception IllegalArgumentException
* @throws IllegalArgumentException
* if the requested metadata field doesn't exist
* @deprecated
*/
@@ -123,9 +123,9 @@ public interface CommunityService extends DSpaceObjectService<Community>, DSpace
* @param value
* value to set the field to
*
* @exception IllegalArgumentException
* @throws IllegalArgumentException
* if the requested metadata field doesn't exist
* @exception java.util.MissingResourceException
* @throws MissingResourceException if resource missing
* @throws SQLException if database error
* @deprecated
*/
@@ -192,7 +192,12 @@ public interface CommunityService extends DSpaceObjectService<Community>, DSpace
/**
* 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
* @throws SQLException if database error
*/
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)
*
* @exception IllegalArgumentException
* @throws IllegalArgumentException
* if the requested metadata field doesn't exist
*/
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 collection Collection (parent)
* @return Item
* @return empty template item for this collection
* @throws SQLException if database 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
* @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
* @return an iterator over the items submitted by eperson
* @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.
* @param context context
*
* @param context DSpace context object
* @param since earliest interesting last-modified date, or null for no date test.
* @return an iterator over the items in the collection.
* @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.
* @param item Item
*
* @param item item to check
* @param collection Collection (parent
* @return true if {@code collection} contains this Item.
* @throws SQLException if database error
@@ -161,7 +165,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* communities of the owning collections.
*
* @param context DSpace context object
* @param item Item
* @param item item to check
* @return the communities this item is in.
* @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)
*
* @param item Item
* @param item item to check
* @param name
* name of bundle (ORIGINAL/TEXT/THUMBNAIL)
* @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.
*
* @param context DSpace context object
* @param item Item
* @param item item to add the bundle to
* @param bundle
* the bundle to add
* @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
* bundle is orphaned.
*
* @param context DSpace context object
* @param item
* the item from which to remove our bundles
* the item from which to remove all bundles
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
* @throws IOException if IO error
@@ -224,7 +229,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* method for the most common use.
*
* @param context DSpace context object
* @param item Item
* @param item item to create bitstream on
* @param is
* the stream to create the new bitstream from
* @param name
@@ -241,7 +246,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* Convenience method, calls createSingleBitstream() with name "ORIGINAL"
*
* @param context DSpace context object
* @param item Item
* @param item item to create bitstream on
* @param is
* InputStream
* @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
* auditing for provenance messages and adding format.* DC values. The order
* is indeterminate.
*
* @param context DSpace context object
* @param item Item
* @param item item to check
* @return non-internal bitstreams.
* @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
*
* @param context DSpace context object
* @param item Item
* @param item item to remove DSpace license from
* @throws SQLException if database error
* @throws AuthorizeException if authorization 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
*
* @param context DSpace context object
* @param item Item
* @param item item to remove all licenses from
* @throws SQLException if database error
* @throws AuthorizeException if authorization 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.
*
* @param context DSpace context object
* @param item Item
* @param item item to withdraw
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
*/
@@ -306,7 +312,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* Reinstate a withdrawn item
*
* @param context DSpace context object
* @param item Item
* @param item withdrawn item to reinstate
* @throws SQLException if database 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
*
* @param item Item
* @param item item to check
* @param collection
* Collection
* @return true if this Collection owns this item
@@ -327,7 +333,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* policies
*
* @param context DSpace context object
* @param item Item
* @param item item to replace policies on
* @param newpolicies -
* this will be all of the new policies for the item and its
* contents
@@ -342,7 +348,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* them with a new list of policies
*
* @param context DSpace context object
* @param item Item
* @param item item to replace policies on
* @param newpolicies -
* this will be all of the new policies for the bundle and
* bitstream contents
@@ -358,7 +364,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* to a given Group
*
* @param context DSpace context object
* @param item Item
* @param item item to remove group policies from
* @param group
* Group referenced by policies that needs to be removed
* @throws SQLException if database error
@@ -372,7 +378,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* the collection.
*
* @param context DSpace context object
* @param item Item
* @param item item to reset policies on
* @param collection
* Collection
* @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
*
* @param context DSpace context object
* @param item Item
* @param item item to move
* @param from Collection to move from
* @param to Collection to move to
* @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
*
* @param context DSpace context object
* @param item Item
* @param item item to move
* @param from Collection to move from
* @param to Collection to move to
* @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 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
*
* @param item Item
* @param item item to check
* @return true if there is a bundle named ORIGINAL with one or more
* bitstreams inside
* @throws SQLException if database error
@@ -429,7 +435,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
* Get the collections this item is not in.
*
* @param context DSpace context object
* @param item Item
* @param item item to check
* @return the collections this item is not in, if any.
* @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
*
* @param context DSpace context object
* @param item Item
* @param item item to check
* @return boolean true = current user can edit item
* @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
* otherwise.
* @param context DSpace context object
* @param item item to check
* @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;
@@ -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.
* Items only show up in the "item list" if the user has READ permission
* and if the Item isn't flagged as unlisted.
* @param context context
* @param context DSpace context object
* @param item item
* @return true or false
*/
@@ -519,7 +527,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
/**
* Find all Items modified since a Date.
*
* @param context context
* @param context DSpace context object
* @param last Earliest interesting last-modified date.
* @return iterator over items
* @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
* @param context
* @param item
* @param context DSpace context object
* @param item item to check
* @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;
}

View File

@@ -37,7 +37,7 @@ public interface MetadataFieldService {
* @return new MetadataField
* @throws AuthorizeException if authorization 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)
throws AuthorizeException, SQLException, NonUniqueMetadataException;
@@ -102,7 +102,7 @@ public interface MetadataFieldService {
* @param metadataField metadata field
* @throws SQLException if database 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
*/
public void update(Context context, MetadataField metadataField)

View File

@@ -33,7 +33,7 @@ public interface MetadataSchemaService {
* @return new MetadataSchema
* @throws SQLException if database 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;
@@ -54,7 +54,7 @@ public interface MetadataSchemaService {
* @param metadataSchema metadata schema
* @throws SQLException if database 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;

View File

@@ -43,7 +43,7 @@ public interface MetadataValueService {
* @param context dspace context
* @param valueId database key id of value
* @return recalled metadata value
* @throws java.io.IOException
* @throws IOException if IO error
* @throws SQLException if database error
*/
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.
*
* @param context
* @param context dspace context
* @param metadataFieldId unique identifier of the interesting field.
* @return the minimum value of the metadata field
* @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
* @param context
* The relevant DSpace Context.
* @return the map
* @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.
*
* @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
* @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
* retrieved an exception will be thrown,
* so only use when the criteria state uniqueness in the database.
* @param criteria
* @param criteria JPA criteria
* @return a DAO specified by the 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
* single result, but this isn't enforced on the database.
* @param criteria
* @param criteria JPA criteria
* @return a DAO specified by the 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 joineded metadata fields can then be used to query or sort.
* @param query
* partial SQL query (to be appended)
* @param tableIdentifier
* DB table to join with
* @param metadataFields
* a collection of metadata fields
*/
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)
{
if(CollectionUtils.isNotEmpty(metadataFields) || StringUtils.isNotBlank(additionalWhere)){
if (CollectionUtils.isNotEmpty(metadataFields) || StringUtils.isNotBlank(additionalWhere)) {
//Add the where query on metadata
query.append(" WHERE ");
for (int i = 0; i < metadataFields.size(); i++) {
MetadataField metadataField = metadataFields.get(i);
if(StringUtils.isNotBlank(operator))
if (StringUtils.isNotBlank(operator))
{
query.append(" (");
query.append("lower(STR(" + metadataField.toString()).append(".value)) ").append(operator).append(" lower(:queryParam)");
query.append(")");
if(i < metadataFields.size() - 1)
if (i < metadataFields.size() - 1)
{
query.append(" OR ");
}
}
}
if(StringUtils.isNotBlank(additionalWhere))
if (StringUtils.isNotBlank(additionalWhere))
{
if(CollectionUtils.isNotEmpty(metadataFields))
if (CollectionUtils.isNotEmpty(metadataFields))
{
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)
{
if(CollectionUtils.isNotEmpty(metadataSortFields)){
if (CollectionUtils.isNotEmpty(metadataSortFields)) {
query.append(" ORDER BY ");
for (int i = 0; i < metadataSortFields.size(); i++) {
MetadataField metadataField = metadataSortFields.get(i);
query.append("STR(").append(metadataField.toString()).append(".value)");
if(i != metadataSortFields.size() -1)
if (i != metadataSortFields.size() -1)
{
query.append(",");
}
}
}else if(CollectionUtils.isNotEmpty(columnSortFields))
} else if (CollectionUtils.isNotEmpty(columnSortFields))
{
query.append(" ORDER BY ");
for (int i = 0; i < columnSortFields.size(); i++) {
String sortField = columnSortFields.get(i);
query.append(sortField);
if(i != columnSortFields.size() -1)
if (i != columnSortFields.size() -1)
{
query.append(",");
}

View File

@@ -130,7 +130,7 @@ public class Context
/**
* Initializes a new context object.
*
* @exception SQLException
* @throws SQLException
* if there was an error obtaining a database connection
*/
private void init()
@@ -337,7 +337,7 @@ public class Context
* Calling complete() on a Context which is no longer valid (isValid()==false),
* is a no-op.
*
* @exception SQLException
* @throws SQLException
* if there was an error completing the database transaction
* or closing the connection
*/
@@ -448,6 +448,7 @@ public class Context
* Add an event to be dispatched when this context is committed.
*
* @param event
* event to be dispatched
*/
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
* 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}).
* Returns the size of the cache of all object that have been read from the database so far.
*
* @return connection cache size
* @throws SQLException When connecting to the active cache fails.
*/
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.
* @param <E> the type of entity.
* @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;
/**
* 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
* @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 ;
}

View File

@@ -42,25 +42,28 @@ import org.dspace.services.factory.DSpaceServicesFactory;
/**
* Class representing an e-mail message, also used to send e-mails.
* <P>
* <p>
* Typical use:
* <P>
* </p>
* <p>
* <code>Email email = new Email();</code><br>
* <code>email.addRecipient("foo@bar.com");</code><br>
* <code>email.addArgument("John");</code><br>
* <code>email.addArgument("On the Testing of DSpace");</code><br>
* <code>email.send();</code><br>
* <P>
* </p>
* <p>
* <code>name</code> is the name of an email template in
* <code>dspace-dir/config/emails/</code> (which also includes the subject.)
* <code>arg0</code> and <code>arg1</code> are arguments to fill out the
* message with.
* <P>
* </p>
* <p>
* Emails are formatted using <code>java.text.MessageFormat.</code>
* 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
* subject line. For example:
* <P>
* </p>
*
* <pre>
*
@@ -77,10 +80,10 @@ import org.dspace.services.factory.DSpaceServicesFactory;
*
* </pre>
*
* <P>
* <p>
* 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:
* <P>
* </p>
*
* <pre>
*
@@ -91,9 +94,10 @@ import org.dspace.services.factory.DSpaceServicesFactory;
*
* </pre>
*
* <P>
* <p>
* Note that parameters like <code>{0}</code> cannot be placed in the subject
* of the e-mail; they won't get filled out.
* </p>
*
*
* @author Robert Tansley
@@ -295,13 +299,14 @@ public class Email
message.setText(fullMessage);
}
}
else{
else
{
Multipart multipart = new MimeMultipart();
// create the first part of the email
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(fullMessage);
multipart.addBodyPart(messageBodyPart);
if(!attachments.isEmpty()){
if (!attachments.isEmpty()) {
for (Iterator<FileAttachment> iter = attachments.iterator(); iter.hasNext();)
{
FileAttachment f = iter.next();
@@ -314,13 +319,19 @@ public class Email
}
message.setContent(multipart);
}
if(!moreAttachments.isEmpty()){
if (!moreAttachments.isEmpty()) {
for (Iterator<InputStreamAttachment> iter = moreAttachments.iterator(); iter.hasNext();)
{
InputStreamAttachment isa = iter.next();
// add the stream
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);
multipart.addBodyPart(messageBodyPart);
}
@@ -459,7 +470,7 @@ public class Email
/**
* 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)
{
@@ -479,7 +490,7 @@ public class Email
boolean disabled = config.getBooleanProperty("mail.server.disabled", false);
try
{
if( disabled)
if (disabled)
{
System.err.println("\nError sending email:");
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("\n");
System.exit(1);
}catch (IOException e1) {
}
catch (IOException e1)
{
System.err.println("\nError sending email:");
System.err.println(" - Error: " + e1);
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.
*
* @param context
* The relevant DSpace Context.
* @param clazz the desired type.
* @return list of DAOs of the same type as clazz
* @throws SQLException if database error
@@ -43,6 +44,7 @@ public interface GenericDAO<T>
* Execute a JPQL query returning a unique result.
*
* @param context
* The relevant DSpace Context.
* @param query JPQL query string
* @return a DAO specified by the query string
* @throws SQLException if database error
@@ -57,6 +59,7 @@ public interface GenericDAO<T>
* Execute a JPQL query and return a collection of results.
*
* @param context
* The relevant DSpace Context.
* @param query JPQL query string
* @return list of DAOs specified by the query string
* @throws SQLException if database error

View File

@@ -23,38 +23,43 @@ import org.dspace.services.ConfigurationService;
import org.springframework.beans.factory.annotation.Autowired;
/**
* <p>
* 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)
* from config file(s) and makes them available to the API. (TODO: Someday, this
* entire "plugin" framework needs to be replaced by Spring Beans.)
* </p>
* <p>
* 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
* control over the lifecycle of a plugin. It manages three different types
* (usage patterns) of plugins:
* <p>
* <ol><li> Singleton Plugin
* <br> There is only one implementation class for the plugin. It is indicated
* </p>
* <ol>
* <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
* a service, for the entire system, at configuration time. Your
* application just fetches the plugin for that interface and gets the
* configured-in choice.
* configured-in choice.</li>
*
* <p><li> Sequence Plugins
* <br> You need a sequence or series of plugins, to implement a mechanism like
* <li>Sequence Plugins<br>
* You need a sequence or series of plugins, to implement a mechanism like
* StackableAuthenticationMethods or a pipeline, where each plugin is
* called in order to contribute its implementation of a process to the
* whole.
* <p><li> Named Plugins
* <br> Use a named plugin when the application has to choose one plugin
* whole.</li>
* <li>Named Plugins<br>
* Use a named plugin when the application has to choose one plugin
* implementation out of many available ones. Each implementation is bound
* to one or more names (symbolic identifiers) in the configuration.
* </ol><p>
* to one or more names (symbolic identifiers) in the configuration.</li>
* </ol>
* <p>
* The name is just a <code>String</code> to be associated with the
* combination of implementation class and interface. It may contain
* any characters except for comma (,) and equals (=). It may contain
* embedded spaces. Comma is a special character used to separate
* names in the configuration entry.
* </p>
*
* @author Larry Stone
* @author Tim Donohue (turned old PluginManager into a PluginService)
@@ -122,7 +127,7 @@ public class LegacyPluginServiceImpl implements PluginService
*
* @param interfaceClass interface Class object
* @return instance of plugin
* @throws PluginConfigurationError
* @throws PluginConfigurationError if no matching singleton plugin is configured.
*/
@Override
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
// just a "name" that belongs with previous class.
// (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;
name = valSplit[0];
@@ -713,7 +718,8 @@ public class LegacyPluginServiceImpl implements PluginService
* Invoking this class from the command line just runs
* <code>checkConfiguration</code> and shows the results.
* There are no command-line options.
* @param argv arguments
*
* @param argv the command line arguments given
* @throws Exception if error
*/
public void main(String[] argv) throws Exception

View File

@@ -44,12 +44,12 @@ public class NewsServiceImpl implements NewsService
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");
List<String> newAcceptableFilenames = new ArrayList<>();
newAcceptableFilenames.addAll(acceptableFilenames);
for(String local : locales){
for(String acceptableFilename : acceptableFilenames){
for (String local : locales) {
for (String acceptableFilename : acceptableFilenames) {
int lastPoint = acceptableFilename.lastIndexOf(".");
newAcceptableFilenames.add(
acceptableFilename.substring(0, lastPoint)
@@ -69,7 +69,7 @@ public class NewsServiceImpl implements NewsService
public String readNewsFile(String 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();

View File

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

View File

@@ -113,7 +113,10 @@ public class BasicLinkChecker extends AbstractCurationTask
/**
* 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
*/
protected boolean checkURL(String url, StringBuilder results)

View File

@@ -113,6 +113,8 @@ public class BitstreamsIntoMetadata extends AbstractCurationTask
* @param item The item
* @param bitstream The 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 {
String value = bitstream.getFormat(Curator.curationContext()).getMIMEType() + "##";

View File

@@ -156,6 +156,9 @@ public class ClamScan extends AbstractCurationTask
/** openSession
*
* 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

View File

@@ -149,7 +149,7 @@ public class Curator
*
* @param reporter name of reporting stream. The name '-'
* causes reporting to standard out.
* @return the Curator instance
* @return return self (Curator instance) with reporter set
*/
public Curator setReporter(String reporter)
{
@@ -166,6 +166,9 @@ public class Curator
* entire performance is complete, and a scope of 'object'
* will commit for each object (e.g. item) encountered in
* a given execution.
*
* @param scope transactional scope
* @return return self (Curator instance) with given scope set
*/
public Curator setTransactionScope(TxScope scope)
{
@@ -358,18 +361,20 @@ public class Curator
/**
* 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.
* <P>
* <p>
* If the context is null or not set, then this just returns
* 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)
* @throws SQLException
* An exception that provides information on a database access error or other errors.
*/
public static Context curationContext() throws SQLException
{
// Return curation context or new context if undefined/invalid
Context curCtx = curationCtx.get();
if(curCtx==null || !curCtx.isValid())
if (curCtx==null || !curCtx.isValid())
{
//Create a new context (represents an Anonymous User)
curCtx = new Context();
@@ -407,7 +412,7 @@ public class Curator
// Site-wide Tasks really should have an EPerson performer associated with them,
// 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," +
" 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
* 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
{
@@ -540,7 +548,7 @@ public class Curator
visit(dso);
return ! suspend(statusCode);
}
catch(IOException ioe)
catch (IOException ioe)
{
//log error & pass exception upwards
log.error("Error executing curation task '" + task.getName() + "'", ioe);
@@ -561,7 +569,7 @@ public class Curator
visit(null);
return ! suspend(statusCode);
}
catch(IOException ioe)
catch (IOException ioe)
{
//log error & pass exception upwards
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
*
* @return whether task should be distributed through containers
*/
public boolean isDistributive()
{
@@ -123,6 +124,7 @@ public class ResolvedTask
/**
* Returns whether task alters (mutates) it's target objects
*
* @return whether task alters (mutates) it's target objects
*/
public boolean isMutative()
{
@@ -139,6 +141,11 @@ public class ResolvedTask
return codes;
}
/**
* Returns whether task is not scripted (curation task)
*
* @return true if this task is not scripted
*/
private boolean unscripted()
{
return sTask == null;

View File

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

View File

@@ -120,8 +120,8 @@ public class Utils
/**
* Performs a buffered copy from one file into another.
*
* @param inFile
* @param outFile
* @param inFile input file
* @param outFile output file
* @throws IOException if IO error
*/
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
* settings from configuration
* Called by "init-method" in Spring config.
* @throws Exception ...
*/
public void init() throws Exception {
File cfgFile = new File(configurationService.getProperty("dspace.dir") +
@@ -87,7 +88,7 @@ public class WorkflowCuratorServiceImpl implements WorkflowCuratorService
try
{
loadTaskConfig(cfgFile);
if(workflowServiceFactory.getWorkflowService() instanceof BasicWorkflowItemService)
if (workflowServiceFactory.getWorkflowService() instanceof BasicWorkflowItemService)
{
basicWorkflowService = (BasicWorkflowService) workflowServiceFactory.getWorkflowService();
basicWorkflowItemService = (BasicWorkflowItemService) workflowServiceFactory.getWorkflowItemService();

View File

@@ -46,8 +46,12 @@ public interface WorkflowCuratorService {
/**
* Determines and executes curation of a Workflow item.
*
* @param curator the Curator object
* @param c the user context
* @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 IOException if IO error
* @throws SQLException if database error
@@ -55,6 +59,18 @@ public interface WorkflowCuratorService {
public boolean curate(Curator curator, Context c, String wfId)
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)
throws AuthorizeException, IOException, SQLException;
}

View File

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

View File

@@ -41,12 +41,15 @@ public class IndexClient {
* from the whole index
*
* @param args the command-line arguments, none used
* @throws java.io.IOException
* @throws SQLException if database error
*
* @throws SQLException
* 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.turnOffAuthorisationSystem();
@@ -55,46 +58,49 @@ public class IndexClient {
HelpFormatter formatter = new HelpFormatter();
CommandLine line = null;
options
.addOption(OptionBuilder
options.addOption(OptionBuilder
.withArgName("handle to remove")
.hasArg(true)
.withDescription(
"remove an Item, Collection or Community from index based on its handle")
.create("r"));
options
.addOption(OptionBuilder
options.addOption(OptionBuilder
.withArgName("handle to add or update")
.hasArg(true)
.withDescription(
"add or update an Item, Collection or Community based on its handle")
.create("i"));
options
.addOption(OptionBuilder
options.addOption(OptionBuilder
.isRequired(false)
.withDescription(
"clean existing index removing any documents that no longer exist in the db")
.create("c"));
options.addOption(OptionBuilder.isRequired(false).withDescription(
"(re)build index, wiping out current one if it exists").create(
"b"));
options.addOption(OptionBuilder
.isRequired(false)
.withDescription(
"(re)build index, wiping out current one if it exists")
.create("b"));
options.addOption(OptionBuilder.isRequired(false).withDescription(
"Rebuild the spellchecker, can be combined with -b and -f.").create(
"s"));
options.addOption(OptionBuilder
.isRequired(false)
.withDescription(
"Rebuild the spellchecker, can be combined with -b and -f.")
.create("s"));
options
.addOption(OptionBuilder
options.addOption(OptionBuilder
.isRequired(false)
.withDescription(
"if updating existing index, force each handle to be reindexed even if uptodate")
.create("f"));
options.addOption(OptionBuilder.isRequired(false).withDescription(
"print this help message").create("h"));
options.addOption(OptionBuilder
.isRequired(false)
.withDescription(
"print this help message")
.create("h"));
options.addOption(OptionBuilder.isRequired(false).withDescription(
"optimize search core").create("o"));
@@ -118,7 +124,10 @@ public class IndexClient {
* 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")) {
log.info("Removing " + line.getOptionValue("r") + " from Index");
@@ -133,9 +142,9 @@ public class IndexClient {
} else if (line.hasOption("o")) {
log.info("Optimizing search core.");
indexer.optimize();
} else if(line.hasOption('s')) {
} else if (line.hasOption('s')) {
checkRebuildSpellCheck(line, indexer);
} else if(line.hasOption('i')) {
} else if (line.hasOption('i')) {
final String handle = line.getOptionValue('i');
final DSpaceObject dso = HandleServiceFactory.getInstance().getHandleService().resolveToObject(context, handle);
if (dso == null) {
@@ -160,11 +169,27 @@ public class IndexClient {
/**
* 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,
final ItemService itemService,
final Context context,
final DSpaceObject dso) throws IOException, SearchServiceException, SQLException {
final DSpaceObject dso)
throws IOException, SearchServiceException, SQLException
{
long count = 0;
indexingService.indexContent(context, dso, true, true);
@@ -194,11 +219,27 @@ public class IndexClient {
/**
* 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,
final ItemService itemService,
final Context context,
final Collection collection) throws IOException, SearchServiceException, SQLException {
final Collection collection)
throws IOException, SearchServiceException, SQLException
{
long count = 0;
final Iterator<Item> itemIterator = itemService.findByCollection(context, collection);
@@ -220,7 +261,9 @@ public class IndexClient {
* @param indexer the solr indexer
* @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")) {
log.info("Rebuilding spell checker.");
indexer.buildSpellCheck();

View File

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

View File

@@ -31,28 +31,28 @@ public class SearchUtils {
public static SearchService getSearchService()
{
if(searchService == null){
if (searchService == null) {
org.dspace.kernel.ServiceManager manager = DSpaceServicesFactory.getInstance().getServiceManager();
searchService = manager.getServiceByName(SearchService.class.getName(),SearchService.class);
}
return searchService;
}
public static DiscoveryConfiguration getDiscoveryConfiguration(){
public static DiscoveryConfiguration getDiscoveryConfiguration() {
return getDiscoveryConfiguration(null);
}
public static DiscoveryConfiguration getDiscoveryConfiguration(DSpaceObject dso){
public static DiscoveryConfiguration getDiscoveryConfiguration(DSpaceObject dso) {
DiscoveryConfigurationService configurationService = getConfigurationService();
DiscoveryConfiguration result = null;
if(dso == null){
if (dso == null) {
result = configurationService.getMap().get("site");
}else{
result = configurationService.getMap().get(dso.getHandle());
}
if(result == null){
if (result == null) {
//No specific configuration, get the default one
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
* A configuration object can be returned for each parent community/collection
*
* @param item the DSpace item
* @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 {
Map<String, DiscoveryConfiguration> result = new HashMap<String, DiscoveryConfiguration>();
@@ -82,14 +85,14 @@ public class SearchUtils {
List<Collection> collections = item.getCollections();
for (Collection collection : collections) {
DiscoveryConfiguration configuration = getDiscoveryConfiguration(collection);
if(!result.containsKey(configuration.getId())){
if (!result.containsKey(configuration.getId())) {
result.put(configuration.getId(), configuration);
}
}
//Also add one for the default
DiscoveryConfiguration configuration = getDiscoveryConfiguration(null);
if(!result.containsKey(configuration.getId())){
if (!result.containsKey(configuration.getId())) {
result.put(configuration.getId(), configuration);
}

View File

@@ -79,7 +79,7 @@ import org.dspace.eperson.factory.EPersonServiceFactory;
* that cron.
*
* 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
*
* Its configuration is Autowired by the ApplicationContext
@@ -257,6 +257,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
* unIndex removes an Item, Collection, or Community
*
* @param context
* The relevant DSpace Context.
* @param dso DSpace Object, can be Community, Item, or Collection
* @throws SQLException if database error
* @throws IOException if IO error
@@ -271,6 +272,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
* unIndex removes an Item, Collection, or Community
*
* @param context
* The relevant DSpace Context.
* @param dso DSpace Object, can be Community, Item, or Collection
* @param commit if <code>true</code> force an immediate commit on SOLR
* @throws SQLException if database error
@@ -286,7 +288,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
}
String uniqueID = dso.getType()+"-"+dso.getID();
getSolr().deleteById(uniqueID);
if(commit)
if (commit)
{
getSolr().commit();
}
@@ -320,9 +322,9 @@ public class SolrServiceImpl implements SearchService, IndexingService {
throws SQLException, IOException {
try {
if(getSolr() != null){
if (getSolr() != null) {
getSolr().deleteByQuery(HANDLE_FIELD + ":\"" + handle + "\"");
if(commit)
if (commit)
{
getSolr().commit();
}
@@ -416,7 +418,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
indexContent(context, community, force);
}
if(getSolr() != null)
if (getSolr() != null)
{
getSolr().commit();
}
@@ -445,7 +447,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
try
{
if(getSolr() == null)
if (getSolr() == null)
{
return;
}
@@ -484,7 +486,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
}
}
}
} catch(Exception e)
} catch (Exception e)
{
throw new SearchServiceException(e.getMessage(), e);
@@ -506,7 +508,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
public void optimize()
{
try {
if(getSolr() == null)
if (getSolr() == null)
{
return;
}
@@ -613,7 +615,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
QueryResponse rsp;
try {
if(getSolr() == null)
if (getSolr() == null)
{
return false;
}
@@ -630,7 +632,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
Object value = doc.getFieldValue(LAST_INDEXED_FIELD);
if(value instanceof Date)
if (value instanceof Date)
{
Date lastIndexed = (Date) value;
@@ -711,7 +713,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
List<Collection> allCollections = new ArrayList<>();
for( ResourcePolicy rp: collectionsPolicies){
for( ResourcePolicy rp: collectionsPolicies) {
Collection collection = ContentServiceFactory.getInstance().getCollectionService()
.find(context, rp.getdSpaceObject().getID());
allCollections.add(collection);
@@ -761,16 +763,19 @@ public class SolrServiceImpl implements SearchService, IndexingService {
/**
* 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
* @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 {
try {
if(getSolr() != null)
if (getSolr() != null)
{
if(CollectionUtils.isNotEmpty(streams))
if (CollectionUtils.isNotEmpty(streams))
{
ContentStreamUpdateRequest req = new ContentStreamUpdateRequest("/update/extract");
@@ -811,6 +816,8 @@ public class SolrServiceImpl implements SearchService, IndexingService {
/**
* Build a solr document for a DSpace Community.
*
* @param context
* The relevant DSpace Context.
* @param community Community to be indexed
* @throws SQLException if database error
* @throws IOException if IO error
@@ -824,7 +831,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
DiscoveryConfiguration discoveryConfiguration = SearchUtils.getDiscoveryConfiguration(community);
DiscoveryHitHighlightingConfiguration highlightingConfiguration = discoveryConfiguration.getHitHighlightingConfiguration();
List<String> highlightedMetadataFields = new ArrayList<String>();
if(highlightingConfiguration != null)
if (highlightingConfiguration != null)
{
for (DiscoveryHitHighlightFieldConfiguration configuration : highlightingConfiguration.getMetadataFields())
{
@@ -859,6 +866,8 @@ public class SolrServiceImpl implements SearchService, IndexingService {
/**
* Build a solr document for a DSpace Collection.
*
* @param context
* The relevant DSpace Context.
* @param collection Collection to be indexed
* @throws SQLException sql exception
* @throws IOException IO exception
@@ -874,7 +883,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
DiscoveryConfiguration discoveryConfiguration = SearchUtils.getDiscoveryConfiguration(collection);
DiscoveryHitHighlightingConfiguration highlightingConfiguration = discoveryConfiguration.getHitHighlightingConfiguration();
List<String> highlightedMetadataFields = new ArrayList<String>();
if(highlightingConfiguration != null)
if (highlightingConfiguration != null)
{
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
* IF needed highlighting is added !
*
* @param doc the solr document
* @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 value the value (can be NULL !)
*/
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);
if(highlightedMetadataFields.contains(metadataField))
if (highlightedMetadataFields.contains(metadataField))
{
doc.addField(metadataField + "_hl", value);
}
@@ -985,10 +996,10 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{
String metadataField = discoverySearchFilter.getMetadataFields().get(j);
List<DiscoverySearchFilter> resultingList;
if(searchFilters.get(metadataField) != null)
if (searchFilters.get(metadataField) != null)
{
resultingList = searchFilters.get(metadataField);
}else{
} else {
//New metadata field, create a new list for it
resultingList = new ArrayList<DiscoverySearchFilter>();
}
@@ -999,7 +1010,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
}
DiscoverySortConfiguration sortConfiguration = discoveryConfiguration.getSearchSortConfiguration();
if(sortConfiguration != null)
if (sortConfiguration != null)
{
for (DiscoverySortFieldConfiguration discoverySortConfiguration : sortConfiguration.getSortFields())
{
@@ -1008,13 +1019,13 @@ public class SolrServiceImpl implements SearchService, IndexingService {
}
DiscoveryRecentSubmissionsConfiguration recentSubmissionConfiguration = discoveryConfiguration.getRecentSubmissionConfiguration();
if(recentSubmissionConfiguration != null)
if (recentSubmissionConfiguration != null)
{
recentSubmissionsConfigurationMap.put(recentSubmissionConfiguration.getMetadataSortField(), recentSubmissionConfiguration);
}
DiscoveryHitHighlightingConfiguration hitHighlightingConfiguration = discoveryConfiguration.getHitHighlightingConfiguration();
if(hitHighlightingConfiguration != null)
if (hitHighlightingConfiguration != null)
{
List<DiscoveryHitHighlightFieldConfiguration> fieldConfigurations = hitHighlightingConfiguration.getMetadataFields();
for (DiscoveryHitHighlightFieldConfiguration fieldConfiguration : fieldConfigurations)
@@ -1023,7 +1034,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
}
}
DiscoveryMoreLikeThisConfiguration moreLikeThisConfiguration = discoveryConfiguration.getMoreLikeThisConfiguration();
if(moreLikeThisConfiguration != null)
if (moreLikeThisConfiguration != null)
{
for(String metadataField : moreLikeThisConfiguration.getSimilarityMetadataFields())
{
@@ -1035,7 +1046,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
List<String> toProjectionFields = new ArrayList<String>();
String[] projectionFields = DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty("discovery.index.projection");
if(projectionFields != null){
if (projectionFields != null) {
for (String field : projectionFields) {
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))
{
List<DiscoverySearchFilter> searchFilterConfigs = searchFilters.get(field);
if(searchFilterConfigs == null)
if (searchFilterConfigs == null)
{
searchFilterConfigs = searchFilters.get(unqualifiedField + "." + Item.ANY);
}
@@ -1137,15 +1148,15 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{
Date date = null;
String separator = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("discovery.solr.facets.split.char");
if(separator == null)
if (separator == null)
{
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
date = MultiFormatDateParser.parse(value);
if(date != null)
if (date != null)
{
//TODO: make this date format configurable !
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
//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);
}
}else
if(searchFilter.getType().equals(DiscoveryConfigurationParameters.TYPE_DATE))
} else
if (searchFilter.getType().equals(DiscoveryConfigurationParameters.TYPE_DATE))
{
if(date != null)
if (date != null)
{
String indexField = searchFilter.getIndexFieldName() + ".year";
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
if(doc.getField(indexField + "_sort") == null)
if (doc.getField(indexField + "_sort") == null)
{
//We can only add one year so take the first one
doc.addField(indexField + "_sort", yearUTC);
}
}
}else
if(searchFilter.getType().equals(DiscoveryConfigurationParameters.TYPE_HIERARCHICAL))
} else
if (searchFilter.getType().equals(DiscoveryConfigurationParameters.TYPE_HIERARCHICAL))
{
HierarchicalSidebarFacetConfiguration hierarchicalSidebarFacetConfiguration = (HierarchicalSidebarFacetConfiguration) searchFilter;
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
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++)
{
valueBuilder.append(subValues[j]);
if(j < i)
if (j < i)
{
valueBuilder.append(hierarchicalSidebarFacetConfiguration.getSplitter());
}
@@ -1310,34 +1321,34 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{
//Only add sort value once
String type;
if(sortFields.get(field) != null)
if (sortFields.get(field) != null)
{
type = sortFields.get(field).getType();
}else{
} else {
type = recentSubmissionsConfigurationMap.get(field).getType();
}
if(type.equals(DiscoveryConfigurationParameters.TYPE_DATE))
if (type.equals(DiscoveryConfigurationParameters.TYPE_DATE))
{
Date date = MultiFormatDateParser.parse(value);
if(date != null)
if (date != null)
{
doc.addField(field + "_dt", date);
}else{
} else {
log.warn("Error while indexing sort date field, item: " + item.getHandle() + " metadata field: " + field + " date value: " + date);
}
}else{
} else {
doc.addField(field + "_sort", value);
}
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);
}
if(moreLikeThisFields.contains(field) || moreLikeThisFields.contains(unqualifiedField + "." + Item.ANY))
if (moreLikeThisFields.contains(field) || moreLikeThisFields.contains(unqualifiedField + "." + Item.ANY))
{
doc.addField(field + "_mlt", value);
}
@@ -1384,7 +1395,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
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
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.
*
* @param type Type of DSpace Object
* @param type
* Type of DSpace Object
* @param id
* internal identifier
* @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,
List<String> locations)
@@ -1589,7 +1605,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
}
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;
DSpaceObject commColl = null;
@@ -1597,7 +1613,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{
commColl = contentServiceFactory.getDSpaceObjectService(type).find(context, UUID.fromString(value));
}
if(commColl != null)
if (commColl != null)
{
return commColl.getName();
}
@@ -1623,7 +1639,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
@Override
public DiscoverResult search(Context context, DSpaceObject dso, DiscoverQuery discoveryQuery, boolean includeUnDiscoverable) throws SearchServiceException {
if(dso != null)
if (dso != null)
{
if (dso instanceof Community)
{
@@ -1644,7 +1660,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
@Override
public DiscoverResult search(Context context, DiscoverQuery discoveryQuery, boolean includeUnDiscoverable) throws SearchServiceException {
try {
if(getSolr() == null){
if (getSolr() == null) {
return new DiscoverResult();
}
SolrQuery solrQuery = resolveToSolrQuery(context, discoveryQuery, includeUnDiscoverable);
@@ -1664,7 +1680,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
SolrQuery solrQuery = new SolrQuery();
String query = "*:*";
if(discoveryQuery.getQuery() != null)
if (discoveryQuery.getQuery() != null)
{
query = discoveryQuery.getQuery();
}
@@ -1682,7 +1698,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
solrQuery.addField(RESOURCE_TYPE_FIELD);
solrQuery.addField(RESOURCE_ID_FIELD);
if(discoveryQuery.isSpellCheck())
if (discoveryQuery.isSpellCheck())
{
solrQuery.setParam(SpellingParams.SPELLCHECK_Q, query);
solrQuery.setParam(SpellingParams.SPELLCHECK_COLLATE, Boolean.TRUE);
@@ -1700,7 +1716,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
String filterQuery = discoveryQuery.getFilterQueries().get(i);
solrQuery.addFilterQuery(filterQuery);
}
if(discoveryQuery.getDSpaceObjectFilter() != -1)
if (discoveryQuery.getDSpaceObjectFilter() != -1)
{
solrQuery.addFilterQuery(RESOURCE_TYPE_FIELD + ":" + discoveryQuery.getDSpaceObjectFilter());
}
@@ -1711,20 +1727,20 @@ public class SolrServiceImpl implements SearchService, IndexingService {
solrQuery.addFilterQuery(filterQuery + ":[* TO *]");
}
if(discoveryQuery.getStart() != -1)
if (discoveryQuery.getStart() != -1)
{
solrQuery.setStart(discoveryQuery.getStart());
}
if(discoveryQuery.getMaxResults() != -1)
if (discoveryQuery.getMaxResults() != -1)
{
solrQuery.setRows(discoveryQuery.getMaxResults());
}
if(discoveryQuery.getSortField() != null)
if (discoveryQuery.getSortField() != null)
{
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;
solrQuery.addSortField(discoveryQuery.getSortField(), order);
@@ -1737,7 +1753,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
}
List<DiscoverFacetField> facetFields = discoveryQuery.getFacetFields();
if(0 < facetFields.size())
if (0 < facetFields.size())
{
//Only add facet information if there are any facets
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
solrQuery.add("f." + field + "." + FacetParams.FACET_LIMIT, String.valueOf(facetFieldConfig.getLimit()));
String facetSort;
if(DiscoveryConfigurationParameters.SORT.COUNT.equals(facetFieldConfig.getSortOrder()))
if (DiscoveryConfigurationParameters.SORT.COUNT.equals(facetFieldConfig.getSortOrder()))
{
facetSort = FacetParams.FACET_SORT_COUNT;
}else{
} else {
facetSort = FacetParams.FACET_SORT_INDEX;
}
solrQuery.add("f." + field + "." + FacetParams.FACET_SORT, facetSort);
@@ -1761,7 +1777,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
+ FacetParams.FACET_OFFSET,
String.valueOf(facetFieldConfig.getOffset()));
}
if(facetFieldConfig.getPrefix() != null)
if (facetFieldConfig.getPrefix() != null)
{
solrQuery.setFacetPrefix(field, facetFieldConfig.getPrefix());
}
@@ -1773,7 +1789,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
solrQuery.addFacetQuery(facetQuery);
}
if(discoveryQuery.getFacetMinCount() != -1)
if (discoveryQuery.getFacetMinCount() != -1)
{
solrQuery.setFacetMinCount(discoveryQuery.getFacetMinCount());
}
@@ -1781,7 +1797,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
solrQuery.setParam(FacetParams.FACET_OFFSET, String.valueOf(discoveryQuery.getFacetOffset()));
}
if(0 < discoveryQuery.getHitHighlightingFields().size())
if (0 < discoveryQuery.getHitHighlightingFields().size())
{
solrQuery.setHighlight(true);
solrQuery.add(HighlightParams.USE_PHRASE_HIGHLIGHTER, Boolean.TRUE.toString());
@@ -1805,7 +1821,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
@Override
public InputStream searchJSON(Context context, DiscoverQuery query, DSpaceObject dso, String jsonIdentifier) throws SearchServiceException {
if(dso != null)
if (dso != null)
{
if (dso instanceof Community)
{
@@ -1824,7 +1840,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
@Override
public InputStream searchJSON(Context context, DiscoverQuery discoveryQuery, String jsonIdentifier) throws SearchServiceException {
if(getSolr() == null)
if (getSolr() == null)
{
return null;
}
@@ -1854,7 +1870,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
protected DiscoverResult retrieveResult(Context context, DiscoverQuery query, QueryResponse solrQueryResponse) throws SQLException {
DiscoverResult result = new DiscoverResult();
if(solrQueryResponse != null)
if (solrQueryResponse != null)
{
result.setSearchTime(solrQueryResponse.getQTime());
result.setStart(query.getStart());
@@ -1866,7 +1882,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{
DSpaceObject dso = findDSpaceObject(context, doc);
if(dso != null)
if (dso != null)
{
result.addDSpaceObject(dso);
} else {
@@ -1887,10 +1903,10 @@ public class SolrServiceImpl implements SearchService, IndexingService {
}
result.addSearchDocument(dso, resultDoc);
if(solrQueryResponse.getHighlighting() != null)
if (solrQueryResponse.getHighlighting() != null)
{
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
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
List<FacetField> facetFields = solrQueryResponse.getFacetFields();
if(facetFields != null)
if (facetFields != null)
{
for (int i = 0; i < facetFields.size(); i++)
{
@@ -1915,7 +1931,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
List<FacetField.Count> facetValues = facetField.getValues();
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
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!
// 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);
//No need to show empty years
if(0 < count)
if (0 < 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();
if(StringUtils.isNotBlank(recommendedQuery))
if (StringUtils.isNotBlank(recommendedQuery))
{
result.setSpellCheckQuery(recommendedQuery);
}
@@ -1987,6 +2003,17 @@ public class SolrServiceImpl implements SearchService, IndexingService {
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 {
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 {
if(getSolr() == null)
if (getSolr() == null)
{
return null;
}
@@ -2038,7 +2073,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{
try {
if(getSolr() == null)
if (getSolr() == null)
{
return Collections.emptyList();
}
@@ -2088,10 +2123,10 @@ public class SolrServiceImpl implements SearchService, IndexingService {
DiscoverFilterQuery result = new DiscoverFilterQuery();
StringBuilder filterQuery = new StringBuilder();
if(StringUtils.isNotBlank(field) && StringUtils.isNotBlank(value))
if (StringUtils.isNotBlank(field) && StringUtils.isNotBlank(value))
{
filterQuery.append(field);
if("equals".equals(operator))
if ("equals".equals(operator))
{
//Query the keyword indexed field !
filterQuery.append("_keyword");
@@ -2108,10 +2143,10 @@ public class SolrServiceImpl implements SearchService, IndexingService {
filterQuery.insert(0, "-");
}
filterQuery.append(":");
if("equals".equals(operator) || "notequals".equals(operator))
if ("equals".equals(operator) || "notequals".equals(operator))
{
//DO NOT ESCAPE RANGE QUERIES !
if(!value.matches("\\[.*TO.*\\]"))
if (!value.matches("\\[.*TO.*\\]"))
{
value = ClientUtils.escapeQueryChars(value);
filterQuery.append(value);
@@ -2127,9 +2162,9 @@ public class SolrServiceImpl implements SearchService, IndexingService {
filterQuery.append(value);
}
}
else{
else {
//DO NOT ESCAPE RANGE QUERIES !
if(!value.matches("\\[.*TO.*\\]"))
if (!value.matches("\\[.*TO.*\\]"))
{
value = ClientUtils.escapeQueryChars(value);
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.MIN_WORD_LEN, String.valueOf(mltConfig.getMinWordLength()));
if(getSolr() == null)
if (getSolr() == null)
{
return Collections.emptyList();
}
QueryResponse rsp = getSolr().query(solrQuery);
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());
for (Object relatedDoc : relatedDocs)
@@ -2207,67 +2242,67 @@ public class SolrServiceImpl implements SearchService, IndexingService {
@Override
public String toSortFieldIndex(String metadataField, String type)
{
if(type.equals(DiscoveryConfigurationParameters.TYPE_DATE))
if (type.equals(DiscoveryConfigurationParameters.TYPE_DATE))
{
return metadataField + "_dt";
}else{
} else {
return metadataField + "_sort";
}
}
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"));
}else{
} else {
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"));
}else{
} else {
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"));
}else{
} else {
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_");
}else{
} else {
//Only display top level filters !
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"));
}else{
} else {
return field + "_acid";
}
}else if(facetFieldConfig.getType().equals(DiscoveryConfigurationParameters.TYPE_STANDARD))
} else if (facetFieldConfig.getType().equals(DiscoveryConfigurationParameters.TYPE_STANDARD))
{
return field;
}else{
} else {
return field;
}
}
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);
}
@@ -2276,7 +2311,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{
//We have a filter make sure we split !
String separator = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("discovery.solr.facets.split.char");
if(separator == null)
if (separator == null)
{
separator = FILTER_SEPARATOR;
}
@@ -2291,7 +2326,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
valueBuffer.append(split[0]);
}
value = valueBuffer.toString();
}else if(value.matches("\\((.*?)\\)"))
} else if (value.matches("\\((.*?)\\)"))
{
//The brackets where added for better solr results, remove the first & last one
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 {
if(field.equals("location.comm") || field.equals("location.coll"))
if (field.equals("location.comm") || field.equals("location.coll"))
{
return value;
}
@@ -2309,7 +2344,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{
//We have a filter make sure we split !
String separator = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("discovery.solr.facets.split.char");
if(separator == null)
if (separator == null)
{
separator = FILTER_SEPARATOR;
}
@@ -2335,7 +2370,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
}
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);
}
@@ -2344,7 +2379,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
{
//We have a filter make sure we split !
String separator = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("discovery.solr.facets.split.char");
if(separator == null)
if (separator == null)
{
separator = FILTER_SEPARATOR;
}
@@ -2358,7 +2393,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
valueBuffer.append(fqParts[i]);
}
value = valueBuffer.toString();
}else if(value.matches("\\((.*?)\\)"))
} else if (value.matches("\\((.*?)\\)"))
{
//The brackets where added for better solr results, remove the first & last one
value = value.substring(1, value.length() -1);
@@ -2379,7 +2414,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
@Override
public void commit() throws SearchServiceException {
try {
if(getSolr() != null)
if (getSolr() != null)
{
getSolr().commit();
}

View File

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

View File

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

View File

@@ -28,8 +28,17 @@ public interface EmbargoLifter
* (access control) by (for example) turning on default read access to all
* Bitstreams.
*
* @param context the DSpace context
* @param item the Item on which to lift the embargo
* @param context
* 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)
throws SQLException, AuthorizeException, IOException;

View File

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

View File

@@ -42,6 +42,11 @@ public interface EmbargoSetter
* @param item the item to embargo
* @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
* @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)
throws SQLException, AuthorizeException;
@@ -52,6 +57,11 @@ public interface EmbargoSetter
*
* @param context the DSpace context
* @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)
throws SQLException, AuthorizeException;
@@ -68,6 +78,13 @@ public interface EmbargoSetter
*
* @param context the DSpace context
* @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)
throws SQLException, AuthorizeException, IOException;

View File

@@ -51,6 +51,11 @@ public interface EmbargoService {
*
* @param context the DSpace context
* @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)
throws SQLException, AuthorizeException;
@@ -69,6 +74,11 @@ public interface EmbargoService {
* @param context the DSpace context
* @param item the item to embargo
* @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)
throws SQLException, AuthorizeException;
@@ -80,6 +90,13 @@ public interface EmbargoService {
*
* @param context the 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)
throws SQLException, AuthorizeException, IOException;

View File

@@ -107,7 +107,7 @@ public class AccountServiceImpl implements AccountService
* @param token
* Account token
* @return The EPerson corresponding to token, or null.
* @exception SQLException
* @throws SQLException
* If the token or eperson cannot be retrieved from the
* database.
*/
@@ -161,7 +161,7 @@ public class AccountServiceImpl implements AccountService
* DSpace context
* @param token
* The token to delete
* @exception SQLException
* @throws SQLException
* If a database error occurs
*/
@Override
@@ -171,7 +171,7 @@ public class AccountServiceImpl implements AccountService
registrationDataService.deleteByToken(context, token);
}
/*
/**
* THIS IS AN INTERNAL METHOD. THE SEND PARAMETER ALLOWS IT TO BE USED FOR
* TESTING PURPOSES.
*
@@ -179,15 +179,18 @@ public class AccountServiceImpl implements AccountService
* is TRUE, this is registration email; otherwise, it is forgot-password
* email. If send is TRUE, the email is sent; otherwise it is skipped.
*
* Potential error conditions: No EPerson with that email (returns null)
* Cannot create registration data in database (throws SQLException) Error
* sending email (throws MessagingException) Error reading email template
* (throws IOException) Authorization error (throws AuthorizeException)
* Potential error conditions:
* @return null if no EPerson with that email found
* @throws SQLException Cannot create registration data in database
* @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
* forgot-password email to @param isRegister If true, this is for
* registration; otherwise, it is for forgot-password @param send If true,
* send email; otherwise do not send any email
* @param context DSpace context
* @param email Email address to send the forgot-password email to
* @param isRegister If true, this is for registration; otherwise, it is
* for forgot-password
* @param send If true, send email; otherwise do not send any email
*/
protected RegistrationData sendInfo(Context context, String email,
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;
* otherwise, it is a forgot-password email.
*
* @param context
* The relevant DSpace Context.
* @param email
* The email address to mail to
* @param isRegister
@@ -241,10 +246,12 @@ public class AccountServiceImpl implements AccountService
* forgot-password email.
* @param rd
* The RDBMS row representing the registration data.
* @exception MessagingException
* @throws MessagingException
* If an error occurs while sending email
* @exception IOException
* If an error occurs while reading the email template.
* @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.
*/
protected void sendEmail(Context context, String email, boolean isRegister, RegistrationData rd)
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.
*
* @param obj
* @return true if ResourcePolicy objects are equal
* @param obj another EPerson.
* @return true if EPerson objects are equal in ID, email, and full name
*/
@Override
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},
* e.g. "en", "en_US", "pt_BR" (the latter is Brazilian Portugese).
*
* @param context
* The relevant DSpace Context.
* @param language
* 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 {
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
*
* @param context
* The relevant DSpace Context.
* @param firstname
* 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 {
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
*
* @param context
* The relevant DSpace Context.
* @param lastname
* 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 {
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
public int getType()

View File

@@ -45,6 +45,15 @@ public class EPersonCLITool {
/**
* 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[])
throws ParseException, SQLException, AuthorizeException {

View File

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

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