Merge remote-tracking branch 'upstream/master' into DS-3179-jspui-remove-file

Conflicts:
	dspace-api/src/main/java/org/dspace/content/ItemServiceImpl.java
This commit is contained in:
philip Vissenaekens
2016-06-20 15:48:12 +02:00
671 changed files with 11528 additions and 7483 deletions

View File

@@ -38,9 +38,10 @@ script:
# -P !assembly => Skip normal assembly (as it can be memory intensive) # -P !assembly => Skip normal assembly (as it can be memory intensive)
# -B => Maven batch/non-interactive mode (recommended for CI) # -B => Maven batch/non-interactive mode (recommended for CI)
# -V => Display Maven version info before build # -V => Display Maven version info before build
- "mvn clean install license:check -Dmaven.test.skip=false -DskipITs=false -P !assembly -B -V" # -Dsurefire.rerunFailingTestsCount=2 => try again for flakey tests, and keep track of/report on number of retries
- "mvn clean install license:check -Dmaven.test.skip=false -DskipITs=false -P !assembly -B -V -Dsurefire.rerunFailingTestsCount=2"
# 2. [Assemble DSpace] Ensure assembly process works (from [src]/dspace/), including Mirage 2 # 2. [Assemble DSpace] Ensure assembly process works (from [src]/dspace/), including Mirage 2
# -Dmirage2.on=true => Build Mirage2 # -Dmirage2.on=true => Build Mirage2
# -Dmirage2.deps.included=false => Don't include Mirage2 build dependencies (We installed them in before_install) # -Dmirage2.deps.included=false => Don't include Mirage2 build dependencies (We installed them in before_install)
# -P !assembly => SKIP the actual building of [src]/dspace/dspace-installer (as it can be memory intensive) # -P !assembly => SKIP the actual building of [src]/dspace/dspace-installer (as it can be memory intensive)
- "cd dspace && mvn package -Dmirage2.on=true -Dmirage2.deps.included=false -P !assembly -B -V" - "cd dspace && mvn package -Dmirage2.on=true -Dmirage2.deps.included=false -P !assembly -B -V -Dsurefire.rerunFailingTestsCount=2"

View File

@@ -12,7 +12,7 @@
<parent> <parent>
<groupId>org.dspace</groupId> <groupId>org.dspace</groupId>
<artifactId>dspace-parent</artifactId> <artifactId>dspace-parent</artifactId>
<version>6.0-rc2-SNAPSHOT</version> <version>6.0-rc3-SNAPSHOT</version>
<relativePath>..</relativePath> <relativePath>..</relativePath>
</parent> </parent>
@@ -683,13 +683,15 @@
<dependency> <dependency>
<groupId>org.apache.ws.commons.axiom</groupId> <groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId> <artifactId>axiom-impl</artifactId>
<version>1.2.17</version> <!-- NOTE: SWORDv2 needs 1.2.14, required by Abdera: https://abdera.apache.org/ -->
<version>1.2.14</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.ws.commons.axiom</groupId> <groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId> <artifactId>axiom-api</artifactId>
<version>1.2.17</version> <!-- NOTE: SWORDv2 needs 1.2.14, required by Abdera: https://abdera.apache.org/ -->
<version>1.2.14</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.glassfish.jersey.core</groupId> <groupId>org.glassfish.jersey.core</groupId>

View File

@@ -36,7 +36,7 @@ public interface ExtractingParams {
/** /**
* The param prefix for mapping Tika metadata to Solr fields. * The param prefix for mapping Tika metadata to Solr fields.
* <p/> * <p>
* To map a field, add a name like: * To map a field, add a name like:
* <pre>fmap.title=solr.title</pre> * <pre>fmap.title=solr.title</pre>
* *
@@ -48,7 +48,7 @@ public interface ExtractingParams {
/** /**
* The boost value for the name of the field. The boost can be specified by a name mapping. * The boost value for the name of the field. The boost can be specified by a name mapping.
* <p/> * <p>
* For example * For example
* <pre> * <pre>
* map.title=solr.title * map.title=solr.title
@@ -73,9 +73,9 @@ public interface ExtractingParams {
* Restrict the extracted parts of a document to be indexed * Restrict the extracted parts of a document to be indexed
* by passing in an XPath expression. All content that satisfies the XPath expr. * by passing in an XPath expression. All content that satisfies the XPath expr.
* will be passed to the {@link SolrContentHandler}. * will be passed to the {@link SolrContentHandler}.
* <p/> * <p>
* See Tika's docs for what the extracted document looks like. * See Tika's docs for what the extracted document looks like.
* <p/> * <p>
* @see #CAPTURE_ELEMENTS * @see #CAPTURE_ELEMENTS
*/ */
public static final String XPATH_EXPRESSION = "xpath"; public static final String XPATH_EXPRESSION = "xpath";
@@ -104,11 +104,11 @@ public interface ExtractingParams {
/** /**
* Capture the specified fields (and everything included below it that isn't capture by some other capture field) separately from the default. This is different * Capture the specified fields (and everything included below it that isn't capture by some other capture field) separately from the default. This is different
* then the case of passing in an XPath expression. * then the case of passing in an XPath expression.
* <p/> * <p>
* The Capture field is based on the localName returned to the {@link SolrContentHandler} * The Capture field is based on the localName returned to the {@link SolrContentHandler}
* by Tika, not to be confused by the mapped field. The field name can then * by Tika, not to be confused by the mapped field. The field name can then
* be mapped into the index schema. * be mapped into the index schema.
* <p/> * <p>
* For instance, a Tika document may look like: * For instance, a Tika document may look like:
* <pre> * <pre>
* &lt;html&gt; * &lt;html&gt;

View File

@@ -46,6 +46,11 @@ public class CommunityFiliator
handleService = HandleServiceFactory.getInstance().getHandleService(); handleService = HandleServiceFactory.getInstance().getHandleService();
} }
/**
*
* @param argv arguments
* @throws Exception if error
*/
public static void main(String[] argv) throws Exception public static void main(String[] argv) throws Exception
{ {
// create an options object and populate it // create an options object and populate it
@@ -174,6 +179,15 @@ public class CommunityFiliator
} }
} }
/**
*
* @param c context
* @param parent parent Community
* @param child child community
* @throws SQLException if database error
* @throws AuthorizeException if authorize error
* @throws IOException if IO error
*/
public void filiate(Context c, Community parent, Community child) public void filiate(Context c, Community parent, Community child)
throws SQLException, AuthorizeException, IOException throws SQLException, AuthorizeException, IOException
{ {
@@ -212,6 +226,15 @@ public class CommunityFiliator
+ "' is parent of community: '" + child.getID() + "'"); + "' is parent of community: '" + child.getID() + "'");
} }
/**
*
* @param c context
* @param parent parent Community
* @param child child community
* @throws SQLException if database error
* @throws AuthorizeException if authorize error
* @throws IOException if IO error
*/
public void defiliate(Context c, Community parent, Community child) public void defiliate(Context c, Community parent, Community child)
throws SQLException, AuthorizeException, IOException throws SQLException, AuthorizeException, IOException
{ {
@@ -250,6 +273,13 @@ public class CommunityFiliator
+ "'"); + "'");
} }
/**
* Find a community by ID
* @param c context
* @param communityID community ID
* @return Community object
* @throws SQLException if database error
*/
protected Community resolveCommunity(Context c, String communityID) protected Community resolveCommunity(Context c, String communityID)
throws SQLException throws SQLException
{ {

View File

@@ -59,6 +59,7 @@ public final class CreateAdministrator
* *
* @param argv * @param argv
* command-line arguments * command-line arguments
* @throws Exception if error
*/ */
public static void main(String[] argv) public static void main(String[] argv)
throws Exception throws Exception
@@ -92,7 +93,7 @@ public final class CreateAdministrator
/** /**
* constructor, which just creates and object with a ready context * constructor, which just creates and object with a ready context
* *
* @throws Exception * @throws Exception if error
*/ */
protected CreateAdministrator() protected CreateAdministrator()
throws Exception throws Exception
@@ -106,7 +107,7 @@ public final class CreateAdministrator
* Method which will negotiate with the user via the command line to * Method which will negotiate with the user via the command line to
* obtain the administrator's details * obtain the administrator's details
* *
* @throws Exception * @throws Exception if error
*/ */
protected void negotiateAdministratorDetails() protected void negotiateAdministratorDetails()
throws Exception throws Exception
@@ -228,7 +229,7 @@ public final class CreateAdministrator
* @param language preferred language * @param language preferred language
* @param pw desired password * @param pw desired password
* *
* @throws Exception * @throws Exception if error
*/ */
protected void createAdministrator(String email, String first, String last, protected void createAdministrator(String email, String first, String last,
String language, String pw) String language, String pw)

View File

@@ -7,19 +7,7 @@
*/ */
package org.dspace.administer; package org.dspace.administer;
import java.io.BufferedWriter; import org.apache.commons.cli.*;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.apache.xml.serialize.Method; import org.apache.xml.serialize.Method;
import org.apache.xml.serialize.OutputFormat; import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.XMLSerializer; import org.apache.xml.serialize.XMLSerializer;
@@ -31,6 +19,14 @@ import org.dspace.content.service.MetadataSchemaService;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @author Graham Triggs * @author Graham Triggs
@@ -39,13 +35,14 @@ import org.xml.sax.SAXException;
* from the metadata schemas for the repository. * from the metadata schemas for the repository.
* *
* The form of the XML is as follows * The form of the XML is as follows
* * {@code
* <metadata-schemas> * <metadata-schemas>
* <schema> * <schema>
* <name>dc</name> * <name>dc</name>
* <namespace>http://dublincore.org/documents/dcmi-terms/</namespace> * <namespace>http://dublincore.org/documents/dcmi-terms/</namespace>
* </schema> * </schema>
* </metadata-schemas> * </metadata-schemas>
* }
*/ */
public class MetadataExporter public class MetadataExporter
{ {
@@ -54,12 +51,12 @@ public class MetadataExporter
protected static MetadataFieldService metadataFieldService = ContentServiceFactory.getInstance().getMetadataFieldService(); protected static MetadataFieldService metadataFieldService = ContentServiceFactory.getInstance().getMetadataFieldService();
/** /**
* @param args * @param args commandline arguments
* @throws ParseException * @throws ParseException if parser error
* @throws SAXException * @throws SAXException if XML parse error
* @throws IOException * @throws IOException if IO error
* @throws SQLException * @throws SQLException if database error
* @throws RegistryExportException * @throws RegistryExportException if export error
*/ */
public static void main(String[] args) throws ParseException, SQLException, IOException, SAXException, RegistryExportException public static void main(String[] args) throws ParseException, SQLException, IOException, SAXException, RegistryExportException
{ {
@@ -91,6 +88,15 @@ public class MetadataExporter
saveRegistry(file, schema); saveRegistry(file, schema);
} }
/**
* Save a registry to a filepath
* @param file filepath
* @param schema schema definition to save
* @throws SQLException if database error
* @throws IOException if IO error
* @throws SAXException if XML error
* @throws RegistryExportException if export error
*/
public static void saveRegistry(String file, String schema) throws SQLException, IOException, SAXException, RegistryExportException public static void saveRegistry(String file, String schema) throws SQLException, IOException, SAXException, RegistryExportException
{ {
// create a context // create a context
@@ -145,12 +151,12 @@ public class MetadataExporter
/** /**
* Serialize the schema registry. If the parameter 'schema' is null or empty, save all schemas * Serialize the schema registry. If the parameter 'schema' is null or empty, save all schemas
* @param context * @param context DSpace Context
* @param xmlSerializer * @param xmlSerializer XML serializer
* @param schema * @param schema schema (may be null to save all)
* @throws SQLException * @throws SQLException if database error
* @throws SAXException * @throws SAXException if XML error
* @throws RegistryExportException * @throws RegistryExportException if export error
*/ */
public static void saveSchema(Context context, XMLSerializer xmlSerializer, String schema) throws SQLException, SAXException, RegistryExportException public static void saveSchema(Context context, XMLSerializer xmlSerializer, String schema) throws SQLException, SAXException, RegistryExportException
{ {
@@ -176,10 +182,10 @@ public class MetadataExporter
/** /**
* Serialize a single schema (namespace) registry entry * Serialize a single schema (namespace) registry entry
* *
* @param xmlSerializer * @param xmlSerializer XML serializer
* @param mdSchema * @param mdSchema DSpace metadata schema
* @throws SAXException * @throws SAXException if XML error
* @throws RegistryExportException * @throws RegistryExportException if export error
*/ */
private static void saveSchema(XMLSerializer xmlSerializer, MetadataSchema mdSchema) throws SAXException, RegistryExportException private static void saveSchema(XMLSerializer xmlSerializer, MetadataSchema mdSchema) throws SAXException, RegistryExportException
{ {
@@ -223,13 +229,13 @@ public class MetadataExporter
/** /**
* Serialize a single metadata field registry entry to xml * Serialize a single metadata field registry entry to xml
* *
* @param context * @param context DSpace context
* @param xmlSerializer * @param xmlSerializer xml serializer
* @param mdField * @param mdField DSpace metadata field
* @throws SAXException * @throws SAXException if XML error
* @throws RegistryExportException * @throws RegistryExportException if export error
* @throws SQLException * @throws SQLException if database error
* @throws IOException * @throws IOException if IO error
*/ */
private static void saveType(Context context, XMLSerializer xmlSerializer, MetadataField mdField) throws SAXException, RegistryExportException, SQLException, IOException private static void saveType(Context context, XMLSerializer xmlSerializer, MetadataField mdField) throws SAXException, RegistryExportException, SQLException, IOException
{ {
@@ -291,24 +297,29 @@ public class MetadataExporter
xmlSerializer.endElement("dc-type"); xmlSerializer.endElement("dc-type");
} }
static Map<Integer, String> schemaMap = new HashMap<Integer, String>();
/** /**
* Helper method to retrieve a schema name for the field. * Helper method to retrieve a schema name for the field.
* Caches the name after looking up the id. * Caches the name after looking up the id.
* @param context DSpace Context
* @param mdField DSpace metadata field
* @return name of schema
* @throws SQLException if database error
* @throws RegistryExportException if export error
*/ */
static Map<Integer, String> schemaMap = new HashMap<Integer, String>();
private static String getSchemaName(Context context, MetadataField mdField) throws SQLException, RegistryExportException private static String getSchemaName(Context context, MetadataField mdField) throws SQLException, RegistryExportException
{ {
// Get name from cache // Get name from cache
String name = schemaMap.get(mdField.getMetadataSchema().getSchemaID()); String name = schemaMap.get(mdField.getMetadataSchema().getID());
if (name == null) if (name == null)
{ {
// Name not retrieved before, so get the schema now // Name not retrieved before, so get the schema now
MetadataSchema mdSchema = metadataSchemaService.find(context, mdField.getMetadataSchema().getSchemaID()); MetadataSchema mdSchema = metadataSchemaService.find(context, mdField.getMetadataSchema().getID());
if (mdSchema != null) if (mdSchema != null)
{ {
name = mdSchema.getName(); name = mdSchema.getName();
schemaMap.put(mdSchema.getSchemaID(), name); schemaMap.put(mdSchema.getID(), name);
} }
else else
{ {

View File

@@ -47,6 +47,7 @@ import org.xml.sax.SAXException;
* *
* The format of the XML file is as follows: * The format of the XML file is as follows:
* *
* {@code
* <dspace-dc-types> * <dspace-dc-types>
* <dc-type> * <dc-type>
* <schema>icadmin</schema> * <schema>icadmin</schema>
@@ -58,6 +59,7 @@ import org.xml.sax.SAXException;
* [....] * [....]
* *
* </dspace-dc-types> * </dspace-dc-types>
* }
*/ */
public class MetadataImporter public class MetadataImporter
{ {
@@ -67,9 +69,19 @@ public class MetadataImporter
/** logging category */ /** logging category */
private static final Logger log = LoggerFactory.getLogger(MetadataImporter.class); private static final Logger log = LoggerFactory.getLogger(MetadataImporter.class);
/** /**
* main method for reading user input from the command line * main method for reading user input from the command line
*/ * @param args arguments
* @throws ParseException if parse error
* @throws SQLException if database error
* @throws IOException if IO error
* @throws TransformerException if transformer error
* @throws ParserConfigurationException if config error
* @throws AuthorizeException if authorization error
* @throws SAXException if parser error
* @throws NonUniqueMetadataException if duplicate metadata
* @throws RegistryImportException if import fails
**/
public static void main(String[] args) public static void main(String[] args)
throws ParseException, SQLException, IOException, TransformerException, throws ParseException, SQLException, IOException, TransformerException,
ParserConfigurationException, AuthorizeException, SAXException, ParserConfigurationException, AuthorizeException, SAXException,
@@ -103,6 +115,15 @@ public class MetadataImporter
* Load the data from the specified file path into the database * Load the data from the specified file path into the database
* *
* @param file the file path containing the source data * @param file the file path containing the source data
* @param forceUpdate whether to force update
* @throws SQLException if database error
* @throws IOException if IO error
* @throws TransformerException if transformer error
* @throws ParserConfigurationException if config error
* @throws AuthorizeException if authorization error
* @throws SAXException if parser error
* @throws NonUniqueMetadataException if duplicate metadata
* @throws RegistryImportException if import fails
*/ */
public static void loadRegistry(String file, boolean forceUpdate) public static void loadRegistry(String file, boolean forceUpdate)
throws SQLException, IOException, TransformerException, ParserConfigurationException, throws SQLException, IOException, TransformerException, ParserConfigurationException,
@@ -158,7 +179,12 @@ public class MetadataImporter
* DSpace context object * DSpace context object
* @param node * @param node
* the node in the DOM tree * the node in the DOM tree
* @throws NonUniqueMetadataException * @throws SQLException if database error
* @throws IOException if IO error
* @throws TransformerException if transformer error
* @throws AuthorizeException if authorization error
* @throws NonUniqueMetadataException if duplicate metadata
* @throws RegistryImportException if import fails
*/ */
private static void loadSchema(Context context, Node node, boolean updateExisting) private static void loadSchema(Context context, Node node, boolean updateExisting)
throws SQLException, IOException, TransformerException, throws SQLException, IOException, TransformerException,
@@ -221,7 +247,12 @@ public class MetadataImporter
* DSpace context object * DSpace context object
* @param node * @param node
* the node in the DOM tree * the node in the DOM tree
* @throws NonUniqueMetadataException * @throws SQLException if database error
* @throws IOException if IO error
* @throws TransformerException if transformer error
* @throws AuthorizeException if authorization error
* @throws NonUniqueMetadataException if duplicate metadata
* @throws RegistryImportException if import fails
*/ */
private static void loadType(Context context, Node node) private static void loadType(Context context, Node node)
throws SQLException, IOException, TransformerException, throws SQLException, IOException, TransformerException,

View File

@@ -25,7 +25,7 @@ public class RegistryExportException extends Exception
/** /**
* create an exception with only a message * create an exception with only a message
* *
* @param message * @param message exception message
*/ */
public RegistryExportException(String message) public RegistryExportException(String message)
{ {
@@ -35,8 +35,8 @@ public class RegistryExportException extends Exception
/** /**
* create an exception with an inner exception and a message * create an exception with an inner exception and a message
* *
* @param message * @param message exception message
* @param e * @param e reference to Throwable
*/ */
public RegistryExportException(String message, Throwable e) public RegistryExportException(String message, Throwable e)
{ {
@@ -46,7 +46,7 @@ public class RegistryExportException extends Exception
/** /**
* create an exception with an inner exception * create an exception with an inner exception
* *
* @param e * @param e reference to Throwable
*/ */
public RegistryExportException(Throwable e) public RegistryExportException(Throwable e)
{ {

View File

@@ -25,7 +25,7 @@ public class RegistryImportException extends Exception
/** /**
* create an exception with only a message * create an exception with only a message
* *
* @param message * @param message error message
*/ */
public RegistryImportException(String message) public RegistryImportException(String message)
{ {
@@ -35,8 +35,8 @@ public class RegistryImportException extends Exception
/** /**
* create an exception with an inner exception and a message * create an exception with an inner exception and a message
* *
* @param message * @param message error message
* @param e * @param e throwable
*/ */
public RegistryImportException(String message, Throwable e) public RegistryImportException(String message, Throwable e)
{ {
@@ -46,7 +46,7 @@ public class RegistryImportException extends Exception
/** /**
* create an exception with an inner exception * create an exception with an inner exception
* *
* @param e * @param e throwable
*/ */
public RegistryImportException(Throwable e) public RegistryImportException(Throwable e)
{ {

View File

@@ -40,6 +40,9 @@ public class RegistryImporter
* the filename to load from * the filename to load from
* *
* @return the DOM representation of the XML file * @return the DOM representation of the XML file
* @throws IOException if IO error
* @throws ParserConfigurationException if configuration parse error
* @throws SAXException if XML parse error
*/ */
public static Document loadXML(String filename) public static Document loadXML(String filename)
throws IOException, ParserConfigurationException, SAXException throws IOException, ParserConfigurationException, SAXException
@@ -68,7 +71,7 @@ public class RegistryImporter
* the element, whose child element you want the CDATA from * the element, whose child element you want the CDATA from
* @param childName * @param childName
* the name of the element you want the CDATA from * the name of the element you want the CDATA from
* * @throws TransformerException if error
* @return the CDATA as a <code>String</code> * @return the CDATA as a <code>String</code>
*/ */
public static String getElementData(Node parentElement, String childName) public static String getElementData(Node parentElement, String childName)
@@ -116,7 +119,7 @@ public class RegistryImporter
* the element, whose child element you want the CDATA from * the element, whose child element you want the CDATA from
* @param childName * @param childName
* the name of the element you want the CDATA from * the name of the element you want the CDATA from
* * @throws TransformerException if error
* @return the CDATA as a <code>String</code> * @return the CDATA as a <code>String</code>
*/ */
public static String[] getRepeatedElementData(Node parentElement, public static String[] getRepeatedElementData(Node parentElement,

View File

@@ -56,6 +56,7 @@ public class RegistryLoader
* *
* @param argv * @param argv
* command-line arguments * command-line arguments
* @throws Exception if error
*/ */
public static void main(String[] argv) throws Exception public static void main(String[] argv) throws Exception
{ {
@@ -121,6 +122,12 @@ public class RegistryLoader
* DSpace context object * DSpace context object
* @param filename * @param filename
* the filename of the XML file to load * the filename of the XML file to load
* @throws SQLException if database error
* @throws IOException if IO error
* @throws TransformerException if transformer error
* @throws ParserConfigurationException if config error
* @throws AuthorizeException if authorization error
* @throws SAXException if parser error
*/ */
public static void loadBitstreamFormats(Context context, String filename) public static void loadBitstreamFormats(Context context, String filename)
throws SQLException, IOException, ParserConfigurationException, throws SQLException, IOException, ParserConfigurationException,
@@ -151,6 +158,10 @@ public class RegistryLoader
* DSpace context object * DSpace context object
* @param node * @param node
* the node in the DOM tree * the node in the DOM tree
* @throws SQLException if database error
* @throws IOException if IO error
* @throws TransformerException if transformer error
* @throws AuthorizeException if authorization error
*/ */
private static void loadFormat(Context context, Node node) private static void loadFormat(Context context, Node node)
throws SQLException, IOException, TransformerException, throws SQLException, IOException, TransformerException,
@@ -206,7 +217,9 @@ public class RegistryLoader
* *
* @param filename * @param filename
* the filename to load from * the filename to load from
* * @throws IOException if IO error
* @throws ParserConfigurationException if config error
* @throws SAXException if parser error
* @return the DOM representation of the XML file * @return the DOM representation of the XML file
*/ */
private static Document loadXML(String filename) throws IOException, private static Document loadXML(String filename) throws IOException,
@@ -234,7 +247,7 @@ public class RegistryLoader
* the element, whose child element you want the CDATA from * the element, whose child element you want the CDATA from
* @param childName * @param childName
* the name of the element you want the CDATA from * the name of the element you want the CDATA from
* * @throws TransformerException if transformer error
* @return the CDATA as a <code>String</code> * @return the CDATA as a <code>String</code>
*/ */
private static String getElementData(Node parentElement, String childName) private static String getElementData(Node parentElement, String childName)
@@ -282,7 +295,7 @@ public class RegistryLoader
* the element, whose child element you want the CDATA from * the element, whose child element you want the CDATA from
* @param childName * @param childName
* the name of the element you want the CDATA from * the name of the element you want the CDATA from
* * @throws TransformerException if transformer error
* @return the CDATA as a <code>String</code> * @return the CDATA as a <code>String</code>
*/ */
private static String[] getRepeatedElementData(Node parentElement, private static String[] getRepeatedElementData(Node parentElement,

View File

@@ -46,7 +46,7 @@ import org.xml.sax.SAXException;
* an XML file. * an XML file.
* *
* The XML file structure needs to be: * The XML file structure needs to be:
* * {@code
* <import_structure> * <import_structure>
* <community> * <community>
* <name>....</name> * <name>....</name>
@@ -56,7 +56,7 @@ import org.xml.sax.SAXException;
* </collection> * </collection>
* </community> * </community>
* </import_structure> * </import_structure>
* * }
* it can be arbitrarily deep, and supports all the metadata elements * it can be arbitrarily deep, and supports all the metadata elements
* that make up the community and collection metadata. See the system * that make up the community and collection metadata. See the system
* documentation for more details * documentation for more details
@@ -88,10 +88,12 @@ public class StructBuilder
* *
* This is of the form: * This is of the form:
* *
* StructBuilder -f [xml source] -e [administrator email] -o [output file] * {@code StructBuilder -f [xml source] -e [administrator email] -o [output file]}
* *
* The output file will contain exactly the same as the source xml document, but * The output file will contain exactly the same as the source xml document, but
* with the handle for each imported item added as an attribute. * with the handle for each imported item added as an attribute.
* @param argv commandline arguments
* @throws Exception if an error occurs
*/ */
public static void main(String[] argv) public static void main(String[] argv)
throws Exception throws Exception
@@ -203,7 +205,7 @@ public class StructBuilder
* fails it generates an error and ceases execution * fails it generates an error and ceases execution
* *
* @param document the XML document object * @param document the XML document object
* @throws TransformerException * @throws TransformerException if transformer error
* *
*/ */
private static void validate(org.w3c.dom.Document document) private static void validate(org.w3c.dom.Document document)

View File

@@ -150,7 +150,7 @@ public class DSpaceCSVLine implements Serializable
* Write this line out as a CSV formatted string, in the order given by the headings provided * Write this line out as a CSV formatted string, in the order given by the headings provided
* *
* @param headings The headings which define the order the elements must be presented in * @param headings The headings which define the order the elements must be presented in
* @param fieldSeparator * @param fieldSeparator field separator
* @return The CSV formatted String * @return The CSV formatted String
*/ */
protected String toCSV(List<String> headings, String fieldSeparator) protected String toCSV(List<String> headings, String fieldSeparator)
@@ -179,7 +179,7 @@ public class DSpaceCSVLine implements Serializable
* Internal method to create a CSV formatted String joining a given set of elements * Internal method to create a CSV formatted String joining a given set of elements
* *
* @param values The values to create the string from * @param values The values to create the string from
* @param valueSeparator * @param valueSeparator value separator
* @return The line as a CSV formatted String * @return The line as a CSV formatted String
*/ */
protected String valueToCSV(List<String> values, String valueSeparator) protected String valueToCSV(List<String> values, String valueSeparator)

View File

@@ -71,7 +71,7 @@ public class MetadataExport
try try
{ {
// Try to export the community // Try to export the community
this.toExport = buildFromCommunity(c, toExport, new ArrayList<Integer>(), 0); this.toExport = buildFromCommunity(c, toExport, 0);
this.exportAll = exportAll; this.exportAll = exportAll;
} }
catch (SQLException sqle) catch (SQLException sqle)
@@ -86,13 +86,13 @@ public class MetadataExport
/** /**
* Build an array list of item ids that are in a community (include sub-communities and collections) * Build an array list of item ids that are in a community (include sub-communities and collections)
* *
* @param context DSpace context
* @param community The community to build from * @param community The community to build from
* @param itemIDs The itemID (used for recursion - use an empty ArrayList)
* @param indent How many spaces to use when writing out the names of items added * @param indent How many spaces to use when writing out the names of items added
* @return The list of item ids * @return The list of item ids
* @throws SQLException * @throws SQLException if database error
*/ */
protected Iterator<Item> buildFromCommunity(Context context, Community community, List<Integer> itemIDs, int indent) protected Iterator<Item> buildFromCommunity(Context context, Community community, int indent)
throws SQLException throws SQLException
{ {
// Add all the collections // Add all the collections
@@ -106,12 +106,7 @@ public class MetadataExport
} }
Iterator<Item> items = itemService.findByCollection(context, collection); Iterator<Item> items = itemService.findByCollection(context, collection);
if(result == null) result = addItemsToResult(result,items);
{
result = items;
}else{
result = Iterators.concat(result, items);
}
} }
// Add all the sub-communities // Add all the sub-communities
@@ -122,7 +117,19 @@ public class MetadataExport
{ {
System.out.print(" "); System.out.print(" ");
} }
buildFromCommunity(context, subCommunity, itemIDs, indent + 1); Iterator<Item> items = buildFromCommunity(context, subCommunity, indent + 1);
result = addItemsToResult(result,items);
}
return result;
}
private Iterator<Item> addItemsToResult(Iterator<Item> result, Iterator<Item> items) {
if(result == null)
{
result = items;
}else{
result = Iterators.concat(result, items);
} }
return result; return result;
@@ -176,6 +183,7 @@ public class MetadataExport
* main method to run the metadata exporter * main method to run the metadata exporter
* *
* @param argv the command line arguments given * @param argv the command line arguments given
* @throws Exception if error occurs
*/ */
public static void main(String[] argv) throws Exception public static void main(String[] argv) throws Exception
{ {

View File

@@ -420,8 +420,7 @@ public class MetadataImport
* @param change Whether or not to make the update * @param change Whether or not to make the update
* @param md The element to compare * @param md The element to compare
* @param changes The changes object to populate * @param changes The changes object to populate
* * @param line line in CSV file
* @param line
* @throws SQLException if there is a problem accessing a Collection from the database, from its handle * @throws SQLException if there is a problem accessing a Collection from the database, from its handle
* @throws AuthorizeException if there is an authorization problem with permissions * @throws AuthorizeException if there is an authorization problem with permissions
*/ */

View File

@@ -41,6 +41,7 @@ public class MetadataImportInvalidHeadingException extends Exception
* *
* @param message the error message * @param message the error message
* @param theType the type of the error * @param theType the type of the error
* @param theColumn column number
*/ */
public MetadataImportInvalidHeadingException(String message, int theType, int theColumn) public MetadataImportInvalidHeadingException(String message, int theType, int theColumn)
{ {

View File

@@ -9,7 +9,6 @@
/** /**
* <p>The DSpace Batch Metadata Editor, which uses a CSV file to export/import * <p>The DSpace Batch Metadata Editor, which uses a CSV file to export/import
* item metadata.</p> * item metadata.</p>
* <p>
* <ul> * <ul>
* <li>works on items, communities, collections or the whole site</li> * <li>works on items, communities, collections or the whole site</li>
* <li>can also create new items, delete items and withdraw/restore them</li> * <li>can also create new items, delete items and withdraw/restore them</li>

View File

@@ -29,7 +29,7 @@ import org.dspace.core.Utils;
/** /**
* Command line access to the checksum checker. Options are listed in the * Command line access to the checksum checker. Options are listed in the
* documentation for the main method.</p> * documentation for the main method.
* *
* @author Jim Downing * @author Jim Downing
* @author Grace Carpenter * @author Grace Carpenter
@@ -72,6 +72,7 @@ public final class ChecksumChecker
* <dt>-p</dt> * <dt>-p</dt>
* <dd>Don't prune results before running checker</dd> * <dd>Don't prune results before running checker</dd>
* </dl> * </dl>
* @throws SQLException if error
*/ */
public static void main(String[] args) throws SQLException { public static void main(String[] args) throws SQLException {
// set up command line parser // set up command line parser

View File

@@ -391,6 +391,7 @@ public class Harvest
harvestedCollectionService.update(context, hc); harvestedCollectionService.update(context, hc);
} }
context.restoreAuthSystemState(); context.restoreAuthSystemState();
context.dispatchEvents();
} }
catch (Exception e) { catch (Exception e) {
System.out.println("Changes could not be committed"); System.out.println("Changes could not be committed");

View File

@@ -34,8 +34,8 @@ import java.util.*;
* core in RDF schema / contents - text file, listing one file per line / file1 * core in RDF schema / contents - text file, listing one file per line / file1
* - files contained in the item / file2 / ... * - files contained in the item / file2 / ...
* <P> * <P>
* issues -doesn't handle special characters in metadata (needs to turn &'s into * issues -doesn't handle special characters in metadata (needs to turn {@code &'s} into
* &amp;, etc.) * {@code &amp;}, etc.)
* <P> * <P>
* Modified by David Little, UCSD Libraries 12/21/04 to allow the registration * Modified by David Little, UCSD Libraries 12/21/04 to allow the registration
* of files (bitstreams) into DSpace. * of files (bitstreams) into DSpace.

View File

@@ -57,8 +57,8 @@ import org.springframework.beans.factory.annotation.Autowired;
* core in RDF schema / contents - text file, listing one file per line / file1 * core in RDF schema / contents - text file, listing one file per line / file1
* - files contained in the item / file2 / ... * - files contained in the item / file2 / ...
* <P> * <P>
* issues -doesn't handle special characters in metadata (needs to turn &'s into * issues -doesn't handle special characters in metadata (needs to turn {@code &'s} into
* &amp;, etc.) * {@code &amp;}, etc.)
* <P> * <P>
* Modified by David Little, UCSD Libraries 12/21/04 to allow the registration * Modified by David Little, UCSD Libraries 12/21/04 to allow the registration
* of files (bitstreams) into DSpace. * of files (bitstreams) into DSpace.
@@ -180,10 +180,11 @@ public class ItemExportServiceImpl implements ItemExportService
* Discover the different schemas in use and output a separate metadata XML * Discover the different schemas in use and output a separate metadata XML
* file for each schema. * file for each schema.
* *
* @param c * @param c DSpace context
* @param i * @param i DSpace Item
* @param destDir * @param destDir destination directory
* @throws Exception * @param migrate Whether to use the migrate option or not
* @throws Exception if error
*/ */
protected void writeMetadata(Context c, Item i, File destDir, boolean migrate) protected void writeMetadata(Context c, Item i, File destDir, boolean migrate)
throws Exception throws Exception
@@ -202,7 +203,15 @@ public class ItemExportServiceImpl implements ItemExportService
} }
} }
// output the item's dublin core into the item directory /**
* output the item's dublin core into the item directory
* @param c DSpace context
* @param schema schema
* @param i DSpace Item
* @param destDir destination directory
* @param migrate Whether to use the migrate option or not
* @throws Exception if error
*/
protected void writeMetadata(Context c, String schema, Item i, protected void writeMetadata(Context c, String schema, Item i,
File destDir, boolean migrate) throws Exception File destDir, boolean migrate) throws Exception
{ {
@@ -318,7 +327,13 @@ public class ItemExportServiceImpl implements ItemExportService
} }
} }
// create the file 'handle' which contains the handle assigned to the item /**
* create the file 'handle' which contains the handle assigned to the item
* @param c DSpace Context
* @param i DSpace Item
* @param destDir destination directory
* @throws Exception if error
*/
protected void writeHandle(Context c, Item i, File destDir) protected void writeHandle(Context c, Item i, File destDir)
throws Exception throws Exception
{ {
@@ -358,7 +373,9 @@ public class ItemExportServiceImpl implements ItemExportService
* the item being exported * the item being exported
* @param destDir * @param destDir
* the item's export directory * the item's export directory
* @throws Exception * @param excludeBitstreams
* whether to exclude bitstreams
* @throws Exception if error
* if there is any problem writing to the export directory * if there is any problem writing to the export directory
*/ */
protected void writeBitstreams(Context c, Item i, File destDir, protected void writeBitstreams(Context c, Item i, File destDir,
@@ -531,7 +548,8 @@ public class ItemExportServiceImpl implements ItemExportService
* - the dspace context * - the dspace context
* @param additionalEmail * @param additionalEmail
* - email address to cc in addition the the current user email * - email address to cc in addition the the current user email
* @throws Exception * @param toMigrate Whether to use the migrate option or not
* @throws Exception if error
*/ */
protected void processDownloadableExport(List<DSpaceObject> dsObjects, protected void processDownloadableExport(List<DSpaceObject> dsObjects,
Context context, final String additionalEmail, boolean toMigrate) throws Exception Context context, final String additionalEmail, boolean toMigrate) throws Exception
@@ -808,7 +826,7 @@ public class ItemExportServiceImpl implements ItemExportService
"A dspace.cfg entry for 'org.dspace.app.itemexport.download.dir' does not exist."); "A dspace.cfg entry for 'org.dspace.app.itemexport.download.dir' does not exist.");
} }
File result = new File(downloadDir + System.getProperty("file.separator") + ePerson.getID()); File result = new File(downloadDir + System.getProperty("file.separator") + ePerson.getID());
if(!result.exists()) if(!result.exists() && ePerson.getLegacyId()!=null)
{ {
//Check for the old identifier //Check for the old identifier
result = new File(downloadDir + System.getProperty("file.separator") + ePerson.getLegacyId()); result = new File(downloadDir + System.getProperty("file.separator") + ePerson.getLegacyId());
@@ -868,6 +886,13 @@ public class ItemExportServiceImpl implements ItemExportService
return file.length(); return file.length();
} }
/**
* Attempt to find an EPerson based on string ID
* @param context DSpace context
* @param strID string identifier
* @return EPerson object (if found)
* @throws SQLException if database error
*/
protected EPerson getEPersonFromString(Context context, String strID) throws SQLException { protected EPerson getEPersonFromString(Context context, String strID) throws SQLException {
EPerson eperson; EPerson eperson;
try{ try{
@@ -1105,6 +1130,14 @@ public class ItemExportServiceImpl implements ItemExportService
} }
} }
/**
*
* @param cpFile file
* @param strSource source location
* @param strTarget target location
* @param cpZipOutputStream current zip outputstream
* @throws Exception if error
*/
protected void zipFiles(File cpFile, String strSource, protected void zipFiles(File cpFile, String strSource,
String strTarget, ZipOutputStream cpZipOutputStream) String strTarget, ZipOutputStream cpZipOutputStream)
throws Exception throws Exception
@@ -1158,6 +1191,11 @@ public class ItemExportServiceImpl implements ItemExportService
} }
} }
/**
* Delete a directory
* @param path directory path
* @return true if successful, false otherwise
*/
protected boolean deleteDirectory(File path) protected boolean deleteDirectory(File path)
{ {
if (path.exists()) if (path.exists())

View File

@@ -30,8 +30,8 @@ import java.util.List;
* core in RDF schema / contents - text file, listing one file per line / file1 * core in RDF schema / contents - text file, listing one file per line / file1
* - files contained in the item / file2 / ... * - files contained in the item / file2 / ...
* <P> * <P>
* issues -doesn't handle special characters in metadata (needs to turn &'s into * issues -doesn't handle special characters in metadata (needs to turn {@code &'s} into
* &amp;, etc.) * {@code &amp;}, etc.)
* <P> * <P>
* Modified by David Little, UCSD Libraries 12/21/04 to allow the registration * Modified by David Little, UCSD Libraries 12/21/04 to allow the registration
* of files (bitstreams) into DSpace. * of files (bitstreams) into DSpace.
@@ -59,7 +59,8 @@ public interface ItemExportService {
* @param zipFileName The name to save the zip file as * @param zipFileName The name to save the zip file as
* @param seqStart The first number in the sequence * @param seqStart The first number in the sequence
* @param migrate Whether to use the migrate option or not * @param migrate Whether to use the migrate option or not
* @throws Exception * @param excludeBitstreams Whether to exclude bitstreams or not
* @throws Exception if error
*/ */
public void exportAsZip(Context context, Iterator<Item> items, public void exportAsZip(Context context, Iterator<Item> items,
String destDirName, String zipFileName, String destDirName, String zipFileName,
@@ -74,7 +75,8 @@ public interface ItemExportService {
* - the dspace object to export * - the dspace object to export
* @param context * @param context
* - the dspace context * - the dspace context
* @throws Exception * @param migrate Whether to use the migrate option or not
* @throws Exception if error
*/ */
public void createDownloadableExport(DSpaceObject dso, public void createDownloadableExport(DSpaceObject dso,
Context context, boolean migrate) throws Exception; Context context, boolean migrate) throws Exception;
@@ -87,7 +89,8 @@ public interface ItemExportService {
* - List containing dspace objects * - List containing dspace objects
* @param context * @param context
* - the dspace context * - the dspace context
* @throws Exception * @param migrate Whether to use the migrate option or not
* @throws Exception if error
*/ */
public void createDownloadableExport(List<DSpaceObject> dsObjects, public void createDownloadableExport(List<DSpaceObject> dsObjects,
Context context, boolean migrate) throws Exception; Context context, boolean migrate) throws Exception;
@@ -102,7 +105,8 @@ public interface ItemExportService {
* - the dspace context * - the dspace context
* @param additionalEmail * @param additionalEmail
* - cc email to use * - cc email to use
* @throws Exception * @param migrate Whether to use the migrate option or not
* @throws Exception if error
*/ */
public void createDownloadableExport(DSpaceObject dso, public void createDownloadableExport(DSpaceObject dso,
Context context, String additionalEmail, boolean migrate) throws Exception; Context context, String additionalEmail, boolean migrate) throws Exception;
@@ -117,7 +121,8 @@ public interface ItemExportService {
* - the dspace context * - the dspace context
* @param additionalEmail * @param additionalEmail
* - cc email to use * - cc email to use
* @throws Exception * @param migrate Whether to use the migrate option or not
* @throws Exception if error
*/ */
public void createDownloadableExport(List<DSpaceObject> dsObjects, public void createDownloadableExport(List<DSpaceObject> dsObjects,
Context context, String additionalEmail, boolean migrate) throws Exception; Context context, String additionalEmail, boolean migrate) throws Exception;
@@ -126,13 +131,14 @@ public interface ItemExportService {
/** /**
* Create a file name based on the date and eperson * Create a file name based on the date and eperson
* *
* @param type Type of object (as string)
* @param eperson * @param eperson
* - eperson who requested export and will be able to download it * - eperson who requested export and will be able to download it
* @param date * @param date
* - the date the export process was created * - the date the export process was created
* @return String representing the file name in the form of * @return String representing the file name in the form of
* 'export_yyy_MMM_dd_count_epersonID' * 'export_yyy_MMM_dd_count_epersonID'
* @throws Exception * @throws Exception if error
*/ */
public String assembleFileName(String type, EPerson eperson, public String assembleFileName(String type, EPerson eperson,
Date date) throws Exception; Date date) throws Exception;
@@ -146,7 +152,7 @@ public interface ItemExportService {
* - the eperson who requested export archive * - the eperson who requested export archive
* @return String representing a directory in the form of * @return String representing a directory in the form of
* org.dspace.app.itemexport.download.dir/epersonID * org.dspace.app.itemexport.download.dir/epersonID
* @throws Exception * @throws Exception if error
*/ */
public String getExportDownloadDirectory(EPerson ePerson) public String getExportDownloadDirectory(EPerson ePerson)
throws Exception; throws Exception;
@@ -157,7 +163,7 @@ public interface ItemExportService {
* *
* @return String representing config file entry for * @return String representing config file entry for
* org.dspace.app.itemexport.work.dir * org.dspace.app.itemexport.work.dir
* @throws Exception * @throws Exception if error
*/ */
public String getExportWorkDirectory() throws Exception; public String getExportWorkDirectory() throws Exception;
@@ -169,7 +175,7 @@ public interface ItemExportService {
* @param eperson * @param eperson
* the eperson requesting the download * the eperson requesting the download
* @return an input stream of the file to be downloaded * @return an input stream of the file to be downloaded
* @throws Exception * @throws Exception if error
*/ */
public InputStream getExportDownloadInputStream(String fileName, public InputStream getExportDownloadInputStream(String fileName,
EPerson eperson) throws Exception; EPerson eperson) throws Exception;
@@ -177,12 +183,24 @@ public interface ItemExportService {
/** /**
* Get the file size of the export archive represented by the file name. * Get the file size of the export archive represented by the file name.
* *
* @param context DSpace context
* @param fileName * @param fileName
* name of the file to get the size. * name of the file to get the size.
* @throws Exception * @throws Exception if error
* @return size as long
*/ */
public long getExportFileSize(Context context, String fileName) throws Exception; public long getExportFileSize(Context context, String fileName) throws Exception;
/**
* Get the last modified date of the export archive represented by the file name.
*
* @param context DSpace context
* @param fileName
* name of the file to get the size.
* @return date as long
* @see java.io.File#lastModified()
* @throws Exception if error
*/
public long getExportFileLastModified(Context context, String fileName) public long getExportFileLastModified(Context context, String fileName)
throws Exception; throws Exception;
@@ -203,10 +221,10 @@ public interface ItemExportService {
* Reads the download directory for the eperson to see if any export * Reads the download directory for the eperson to see if any export
* archives are available * archives are available
* *
* @param eperson * @param eperson EPerson object
* @return a list of file names representing export archives that have been * @return a list of file names representing export archives that have been
* processed * processed
* @throws Exception * @throws Exception if error
*/ */
public List<String> getExportsAvailable(EPerson eperson) public List<String> getExportsAvailable(EPerson eperson)
throws Exception; throws Exception;
@@ -218,7 +236,7 @@ public interface ItemExportService {
* *
* @param eperson * @param eperson
* - the eperson to clean up * - the eperson to clean up
* @throws Exception * @throws Exception if error
*/ */
public void deleteOldExportArchives(EPerson eperson) throws Exception; public void deleteOldExportArchives(EPerson eperson) throws Exception;
@@ -228,7 +246,7 @@ public interface ItemExportService {
* determine if the current exports are too old and need purgeing * determine if the current exports are too old and need purgeing
* Removes all old exports, not just those for the person doing the export. * Removes all old exports, not just those for the person doing the export.
* *
* @throws Exception * @throws Exception if error
*/ */
public void deleteOldExportArchives() throws Exception; public void deleteOldExportArchives() throws Exception;
@@ -245,7 +263,7 @@ public interface ItemExportService {
* @param fileName * @param fileName
* - the file name to be downloaded. It is added to the url in * - the file name to be downloaded. It is added to the url in
* the email * the email
* @throws MessagingException * @throws MessagingException if error
*/ */
public void emailSuccessMessage(Context context, EPerson eperson, public void emailSuccessMessage(Context context, EPerson eperson,
String fileName) throws MessagingException; String fileName) throws MessagingException;
@@ -260,11 +278,17 @@ public interface ItemExportService {
* - EPerson to send the error message to * - EPerson to send the error message to
* @param error * @param error
* - the error message * - the error message
* @throws MessagingException * @throws MessagingException if error
*/ */
public void emailErrorMessage(EPerson eperson, String error) public void emailErrorMessage(EPerson eperson, String error)
throws MessagingException; throws MessagingException;
/**
* Zip source to target
* @param strSource source file
* @param target target file
* @throws Exception if error
*/
public void zip(String strSource, String target) throws Exception; public void zip(String strSource, String target) throws Exception;
} }

View File

@@ -20,7 +20,7 @@ import java.util.Map;
/** /**
* This class acts as a Service in the procedure ot batch import using the Biblio-Transformation-Engine * This class acts as a Service in the procedure to batch import using the Biblio-Transformation-Engine
*/ */
public class BTEBatchImportService public class BTEBatchImportService
{ {
@@ -39,7 +39,7 @@ public class BTEBatchImportService
/** /**
* Setter method for dataLoaders parameter * Setter method for dataLoaders parameter
* @param dataLoaders * @param dataLoaders map of data loaders
*/ */
public void setDataLoaders(Map<String, DataLoader> dataLoaders) public void setDataLoaders(Map<String, DataLoader> dataLoaders)
{ {
@@ -47,7 +47,7 @@ public class BTEBatchImportService
} }
/** /**
* * Get data loaders
* @return the map of DataLoaders * @return the map of DataLoaders
*/ */
public Map<String, DataLoader> getDataLoaders() public Map<String, DataLoader> getDataLoaders()
@@ -56,7 +56,7 @@ public class BTEBatchImportService
} }
/** /**
* * Get output map
* @return the outputMapping * @return the outputMapping
*/ */
public Map<String, String> getOutputMap() { public Map<String, String> getOutputMap() {
@@ -65,20 +65,32 @@ public class BTEBatchImportService
/** /**
* Setter method for the outputMapping * Setter method for the outputMapping
* @param outputMapping * @param outputMap the output mapping
*/ */
public void setOutputMap(Map<String, String> outputMap) { public void setOutputMap(Map<String, String> outputMap) {
this.outputMap = outputMap; this.outputMap = outputMap;
} }
/**
* Get transformation engine
* @return transformation engine
*/
public TransformationEngine getTransformationEngine() { public TransformationEngine getTransformationEngine() {
return transformationEngine; return transformationEngine;
} }
/**
* set transformation engine
* @param transformationEngine transformation engine
*/
public void setTransformationEngine(TransformationEngine transformationEngine) { public void setTransformationEngine(TransformationEngine transformationEngine) {
this.transformationEngine = transformationEngine; this.transformationEngine = transformationEngine;
} }
/**
* Getter of file data loaders
* @return List of file data loaders
*/
public List<String> getFileDataLoaders(){ public List<String> getFileDataLoaders(){
List<String> result = new ArrayList<String>(); List<String> result = new ArrayList<String>();

View File

@@ -7,9 +7,7 @@
*/ */
package org.dspace.app.itemimport; package org.dspace.app.itemimport;
import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.io.LineNumberReader; import java.io.LineNumberReader;
@@ -19,7 +17,6 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.List; import java.util.List;
import java.util.Scanner;
/** /**
* @author kstamatis * @author kstamatis
@@ -37,7 +34,8 @@ public class BatchUpload {
private String errorMsgHTML = ""; private String errorMsgHTML = "";
/** /**
* * Initialize with directory
* @param dirPath directory path
*/ */
public BatchUpload(String dirPath) { public BatchUpload(String dirPath) {
@@ -45,13 +43,20 @@ public class BatchUpload {
} }
/**
* Initialize with directory
* @param dir directory path
*/
public BatchUpload(File dir) { public BatchUpload(File dir) {
this.initializeWithFile(dir); this.initializeWithFile(dir);
} }
/**
* Initialize with directory
* @param dir directory path
*/
private void initializeWithFile(File dir){ private void initializeWithFile(File dir){
this.dir = dir; this.dir = dir;
@@ -89,6 +94,12 @@ public class BatchUpload {
} }
} }
/**
* Count lines in file
* @param filename file name
* @return lines in file
* @throws IOException if IO error
*/
private int countLines(String filename) throws IOException { private int countLines(String filename) throws IOException {
LineNumberReader reader = new LineNumberReader(new FileReader(filename)); LineNumberReader reader = new LineNumberReader(new FileReader(filename));
int cnt = 0; int cnt = 0;
@@ -106,6 +117,11 @@ public class BatchUpload {
return cnt; return cnt;
} }
/**
* Read a file
* @param filename file name
* @throws IOException if IO error
*/
private void readFile(String filename) throws IOException { private void readFile(String filename) throws IOException {
LineNumberReader reader = new LineNumberReader(new FileReader(filename)); LineNumberReader reader = new LineNumberReader(new FileReader(filename));
String lineRead = ""; String lineRead = "";
@@ -125,40 +141,76 @@ public class BatchUpload {
reader.close(); reader.close();
} }
/**
* Get date
* @return Date
*/
public Date getDate() { public Date getDate() {
return date; return date;
} }
/**
* Get path to directory
* @return directory
*/
public File getDir() { public File getDir() {
return dir; return dir;
} }
/**
* Whether successulf
* @return true or false
*/
public boolean isSuccessful() { public boolean isSuccessful() {
return successful; return successful;
} }
/**
* Get items imported
* @return number of items
*/
public int getItemsImported() { public int getItemsImported() {
return itemsImported; return itemsImported;
} }
/**
* Get total items
* @return total
*/
public int getTotalItems() { public int getTotalItems() {
return totalItems; return totalItems;
} }
/**
* Get formatted date (DD/MM/YY)
* @return date as string
*/
public String getDateFormatted(){ public String getDateFormatted(){
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy - HH:mm"); SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy - HH:mm");
return df.format(date); return df.format(date);
} }
/**
* Get handles of imported files
* @return list of handles
*/
public List<String> getHandlesImported() { public List<String> getHandlesImported() {
return handlesImported; return handlesImported;
} }
/**
* Get error message
* @return error message
*/
public String getErrorMsg() { public String getErrorMsg() {
return errorMsg; return errorMsg;
} }
/**
* Get error message as HTML
* @return error message string as HTML
*/
public String getErrorMsgHTML() { public String getErrorMsgHTML() {
return errorMsgHTML; return errorMsgHTML;
} }

View File

@@ -175,10 +175,10 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
* @param mycollections The collections the items are inserted to * @param mycollections The collections the items are inserted to
* @param sourceDir The filepath to the file to read data from * @param sourceDir The filepath to the file to read data from
* @param mapFile The filepath to mapfile to be generated * @param mapFile The filepath to mapfile to be generated
* @param template * @param template whether to use collection template item as starting point
* @param inputType The type of the input data (bibtex, csv, etc.) * @param inputType The type of the input data (bibtex, csv, etc.)
* @param workingDir The path to create temporary files (for command line or UI based) * @param workingDir The path to create temporary files (for command line or UI based)
* @throws Exception * @throws Exception if error occurs
*/ */
@Override @Override
public void addBTEItems(Context c, List<Collection> mycollections, public void addBTEItems(Context c, List<Collection> mycollections,
@@ -457,10 +457,14 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
/** /**
* item? try and add it to the archive. * item? try and add it to the archive.
* @param c current Context
* @param mycollections - add item to these Collections. * @param mycollections - add item to these Collections.
* @param path - directory containing the item directories. * @param path - directory containing the item directories.
* @param itemname handle - non-null means we have a pre-defined handle already * @param itemname handle - non-null means we have a pre-defined handle already
* @param mapOut - mapfile we're writing * @param mapOut - mapfile we're writing
* @param template whether to use collection template item as starting point
* @return Item
* @throws Exception if error occurs
*/ */
protected Item addItem(Context c, List<Collection> mycollections, String path, protected Item addItem(Context c, List<Collection> mycollections, String path,
String itemname, PrintWriter mapOut, boolean template) throws Exception String itemname, PrintWriter mapOut, boolean template) throws Exception
@@ -765,6 +769,8 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
* @param path The path to the data directory for this item * @param path The path to the data directory for this item
* @param filename The collections file filename. Should be "collections" * @param filename The collections file filename. Should be "collections"
* @return A list of collections in which to insert the item or null * @return A list of collections in which to insert the item or null
* @throws IOException if IO error
* @throws SQLException if database error
*/ */
protected List<Collection> processCollectionFile(Context c, String path, String filename) throws IOException, SQLException protected List<Collection> processCollectionFile(Context c, String path, String filename) throws IOException, SQLException
@@ -827,7 +833,12 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
} }
/** /**
* Read in the handle file or return null if empty or doesn't exist * Read in the handle file contents or return null if empty or doesn't exist
* @param c DSpace context
* @param i DSpace item
* @param path path to handle file
* @param filename name of file
* @return handle file contents or null if doesn't exist
*/ */
protected String processHandleFile(Context c, Item i, String path, String filename) protected String processHandleFile(Context c, Item i, String path, String filename)
{ {
@@ -886,6 +897,14 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
* Given a contents file and an item, stuffing it with bitstreams from the * Given a contents file and an item, stuffing it with bitstreams from the
* contents file Returns a List of Strings with lines from the contents * contents file Returns a List of Strings with lines from the contents
* file that request non-default bitstream permission * file that request non-default bitstream permission
* @param c DSpace Context
* @param i DSpace item
* @param path path as string
* @param filename file name
* @return List of Strings
* @throws SQLException if database error
* @throws IOException if IO error
* @throws AuthorizeException if authorization error
*/ */
protected List<String> processContentsFile(Context c, Item i, String path, protected List<String> processContentsFile(Context c, Item i, String path,
String filename) throws SQLException, IOException, String filename) throws SQLException, IOException,
@@ -1129,14 +1148,15 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
/** /**
* each entry represents a bitstream.... * each entry represents a bitstream....
* @param c * @param c DSpace Context
* @param i * @param i Dspace Item
* @param path * @param path path to file
* @param fileName * @param fileName file name
* @param bundleName * @param bundleName bundle name
* @throws SQLException * @param primary if primary bitstream
* @throws IOException * @throws SQLException if database error
* @throws AuthorizeException * @throws IOException if IO error
* @throws AuthorizeException if authorization error
*/ */
protected void processContentFileEntry(Context c, Item i, String path, protected void processContentFileEntry(Context c, Item i, String path,
String fileName, String bundleName, boolean primary) throws SQLException, String fileName, String bundleName, boolean primary) throws SQLException,
@@ -1209,14 +1229,15 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
/** /**
* Register the bitstream file into DSpace * Register the bitstream file into DSpace
* *
* @param c * @param c DSpace Context
* @param i * @param i DSpace Item
* @param assetstore * @param assetstore assetstore number
* @param bitstreamPath the full filepath expressed in the contents file * @param bitstreamPath the full filepath expressed in the contents file
* @param bundleName * @param bundleName bundle name
* @throws SQLException * @param description bitstream description
* @throws IOException * @throws SQLException if database error
* @throws AuthorizeException * @throws IOException if IO error
* @throws AuthorizeException if authorization error
*/ */
protected void registerBitstream(Context c, Item i, int assetstore, protected void registerBitstream(Context c, Item i, int assetstore,
String bitstreamPath, String bundleName, String description ) String bitstreamPath, String bundleName, String description )
@@ -1281,19 +1302,21 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
* Process the Options to apply to the Item. The options are tab delimited * Process the Options to apply to the Item. The options are tab delimited
* *
* Options: * Options:
* {@code
* 48217870-MIT.pdf permissions: -r 'MIT Users' description: Full printable version (MIT only) * 48217870-MIT.pdf permissions: -r 'MIT Users' description: Full printable version (MIT only)
* permissions:[r|w]-['group name'] * permissions:[r|w]-['group name']
* description: 'the description of the file' * description: 'the description of the file'
* * }
* where: * where:
* {@code
* [r|w] (meaning: read|write) * [r|w] (meaning: read|write)
* ['MIT Users'] (the group name) * ['MIT Users'] (the group name)
* * }
* @param c * @param c DSpace Context
* @param myItem * @param myItem DSpace Item
* @param options * @param options List of option strings
* @throws SQLException * @throws SQLException if database error
* @throws AuthorizeException * @throws AuthorizeException if authorization error
*/ */
protected void processOptions(Context c, Item myItem, List<String> options) protected void processOptions(Context c, Item myItem, List<String> options)
throws SQLException, AuthorizeException throws SQLException, AuthorizeException
@@ -1447,12 +1470,13 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
/** /**
* Set the Permission on a Bitstream. * Set the Permission on a Bitstream.
* *
* @param c * @param c DSpace Context
* @param g * @param g Dspace Group
* @param actionID * @param actionID action identifier
* @param bs * @param bs Bitstream
* @throws SQLException * @see org.dspace.core.Constants
* @throws AuthorizeException * @throws SQLException if database error
* @throws AuthorizeException if authorization error
*/ */
protected void setPermission(Context c, Group g, int actionID, Bitstream bs) protected void setPermission(Context c, Group g, int actionID, Bitstream bs)
throws SQLException, AuthorizeException throws SQLException, AuthorizeException
@@ -1488,9 +1512,9 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
// XML utility methods // XML utility methods
/** /**
* Lookup an attribute from a DOM node. * Lookup an attribute from a DOM node.
* @param n * @param n node
* @param name * @param name attribute name
* @return * @return attribute value
*/ */
private String getAttributeValue(Node n, String name) private String getAttributeValue(Node n, String name)
{ {
@@ -1512,8 +1536,8 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
/** /**
* Return the String value of a Node. * Return the String value of a Node.
* @param node * @param node node
* @return * @return string value
*/ */
protected String getStringValue(Node node) protected String getStringValue(Node node)
{ {
@@ -1539,6 +1563,9 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
* the filename to load from * the filename to load from
* *
* @return the DOM representation of the XML file * @return the DOM representation of the XML file
* @throws IOException if IO error
* @throws ParserConfigurationException if config error
* @throws SAXException if XML error
*/ */
protected Document loadXML(String filename) throws IOException, protected Document loadXML(String filename) throws IOException,
ParserConfigurationException, SAXException ParserConfigurationException, SAXException
@@ -1721,7 +1748,8 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
* @param resumeDir In case of a resume request, the directory that containsthe old mapfile and data * @param resumeDir In case of a resume request, the directory that containsthe old mapfile and data
* @param inputType The input type of the data (bibtex, csv, etc.), in case of local file * @param inputType The input type of the data (bibtex, csv, etc.), in case of local file
* @param context The context * @param context The context
* @throws Exception * @param template whether to use template item
* @throws Exception if error
*/ */
@Override @Override
public void processUIImport(String filepath, Collection owningCollection, String[] otherCollections, String resumeDir, String inputType, Context context, final boolean template) throws Exception public void processUIImport(String filepath, Collection owningCollection, String[] otherCollections, String resumeDir, String inputType, Context context, final boolean template) throws Exception

View File

@@ -36,15 +36,53 @@ import java.util.List;
public interface ItemImportService { public interface ItemImportService {
/**
*
* @param c DSpace Context
* @param mycollections List of Collections
* @param sourceDir source location
* @param mapFile map file
* @param template whether to use template item
* @throws Exception if error
*/
public void addItemsAtomic(Context c, List<Collection> mycollections, String sourceDir, String mapFile, boolean template) throws Exception; public void addItemsAtomic(Context c, List<Collection> mycollections, String sourceDir, String mapFile, boolean template) throws Exception;
/**
* Add items
* @param c DSpace Context
* @param mycollections List of Collections
* @param sourceDir source location
* @param mapFile map file
* @param template whether to use template item
* @throws Exception if error
*/
public void addItems(Context c, List<Collection> mycollections, public void addItems(Context c, List<Collection> mycollections,
String sourceDir, String mapFile, boolean template) throws Exception; String sourceDir, String mapFile, boolean template) throws Exception;
/**
* Unzip a file
* @param zipfile file
* @return unzip location
* @throws IOException if error
*/
public String unzip(File zipfile) throws IOException; public String unzip(File zipfile) throws IOException;
/**
* Unzip a file to a destination
* @param zipfile file
* @param destDir destination directory
* @return unzip location
* @throws IOException if error
*/
public String unzip(File zipfile, String destDir) throws IOException; public String unzip(File zipfile, String destDir) throws IOException;
/**
* Unzip a file in a specific source directory
* @param sourcedir source directory
* @param zipfilename file name
* @return unzip location
* @throws IOException if error
*/
public String unzip(String sourcedir, String zipfilename) throws IOException; public String unzip(String sourcedir, String zipfilename) throws IOException;
/** /**
@@ -54,8 +92,10 @@ public interface ItemImportService {
* @param owningCollection The owning collection the items will belong to * @param owningCollection The owning collection the items will belong to
* @param collections The collections the created items will be inserted to, apart from the owning one * @param collections The collections the created items will be inserted to, apart from the owning one
* @param resumeDir In case of a resume request, the directory that containsthe old mapfile and data * @param resumeDir In case of a resume request, the directory that containsthe old mapfile and data
* @param inputType The input type of the data (bibtex, csv, etc.), in case of local file
* @param context The context * @param context The context
* @throws Exception * @param template whether to use template item
* @throws Exception if error
*/ */
public void processUIImport(String url, Collection owningCollection, String[] collections, String resumeDir, String inputType, Context context, boolean template) throws Exception; public void processUIImport(String url, Collection owningCollection, String[] collections, String resumeDir, String inputType, Context context, boolean template) throws Exception;
@@ -71,7 +111,7 @@ public interface ItemImportService {
* - eperson to send the email to * - eperson to send the email to
* @param fileName * @param fileName
* - the filepath to the mapfile created by the batch import * - the filepath to the mapfile created by the batch import
* @throws javax.mail.MessagingException * @throws MessagingException if error
*/ */
public void emailSuccessMessage(Context context, EPerson eperson, public void emailSuccessMessage(Context context, EPerson eperson,
String fileName) throws MessagingException; String fileName) throws MessagingException;
@@ -86,39 +126,113 @@ public interface ItemImportService {
* - EPerson to send the error message to * - EPerson to send the error message to
* @param error * @param error
* - the error message * - the error message
* @throws MessagingException * @throws MessagingException if error
*/ */
public void emailErrorMessage(EPerson eperson, String error) public void emailErrorMessage(EPerson eperson, String error)
throws MessagingException; throws MessagingException;
/**
* Get imports available for a person
* @param eperson EPerson object
* @return List of batch uploads
* @throws Exception if error
*/
public List<BatchUpload> getImportsAvailable(EPerson eperson) public List<BatchUpload> getImportsAvailable(EPerson eperson)
throws Exception; throws Exception;
/**
* Get import upload directory
* @param ePerson EPerson object
* @return directory
* @throws Exception if error
*/
public String getImportUploadableDirectory(EPerson ePerson) public String getImportUploadableDirectory(EPerson ePerson)
throws Exception; throws Exception;
/**
* Delete a batch by ID
* @param c DSpace Context
* @param uploadId identifier
* @throws Exception if error
*/
public void deleteBatchUpload(Context c, String uploadId) throws Exception; public void deleteBatchUpload(Context c, String uploadId) throws Exception;
/**
* Replace items
* @param c DSpace Context
* @param mycollections List of Collections
* @param sourcedir source directory
* @param mapfile map file
* @param template whether to use template item
* @throws Exception if error
*/
public void replaceItems(Context c, List<Collection> mycollections, String sourcedir, String mapfile, boolean template) throws Exception; public void replaceItems(Context c, List<Collection> mycollections, String sourcedir, String mapfile, boolean template) throws Exception;
/**
* Delete items via mapfile
* @param c DSpace Context
* @param mapfile map file
* @throws Exception if error
*/
public void deleteItems(Context c, String mapfile) throws Exception; public void deleteItems(Context c, String mapfile) throws Exception;
/**
* Add items
* @param c DSpace Context
* @param mycollections List of Collections
* @param sourcedir source directory
* @param mapfile map file
* @param template whether to use template item
* @param bteInputType The input type of the data (bibtex, csv, etc.), in case of local file
* @param workingDir working directory
* @throws Exception if error
*/
public void addBTEItems(Context c, List<Collection> mycollections, String sourcedir, String mapfile, boolean template, String bteInputType, String workingDir) throws Exception; public void addBTEItems(Context c, List<Collection> mycollections, String sourcedir, String mapfile, boolean template, String bteInputType, String workingDir) throws Exception;
/**
* Get temporary work directory
* @return directory as string
*/
public String getTempWorkDir(); public String getTempWorkDir();
/**
* Get temporary work directory (as File)
* @return directory as File
*/
public File getTempWorkDirFile(); public File getTempWorkDirFile();
/**
* Cleanup
*/
public void cleanupZipTemp(); public void cleanupZipTemp();
/**
* Set test flag
* @param isTest true or false
*/
public void setTest(boolean isTest); public void setTest(boolean isTest);
/**
* Set resume flag
* @param isResume true or false
*/
public void setResume(boolean isResume); public void setResume(boolean isResume);
/**
* Set use workflow
* @param useWorkflow whether to enable workflow
*/
public void setUseWorkflow(boolean useWorkflow); public void setUseWorkflow(boolean useWorkflow);
public void setUseWorkflowSendEmail(boolean useWorkflow); /**
* @param useWorkflowSendMail whether to send mail
*/
public void setUseWorkflowSendEmail(boolean useWorkflowSendMail);
/**
* Set quiet flag
* @param isQuiet true or false
*/
public void setQuiet(boolean isQuiet); public void setQuiet(boolean isQuiet);
} }

View File

@@ -24,6 +24,13 @@ public class ActionManager implements Iterable<UpdateAction> {
protected Map<Class<? extends UpdateAction>, UpdateAction> registry protected Map<Class<? extends UpdateAction>, UpdateAction> registry
= new LinkedHashMap<Class<? extends UpdateAction>, UpdateAction>(); = new LinkedHashMap<Class<? extends UpdateAction>, UpdateAction>();
/**
* Get update action
* @param actionClass UpdateAction class
* @return instantiation of UpdateAction class
* @throws InstantiationException if instantiation error
* @throws IllegalAccessException if illegal access error
*/
public UpdateAction getUpdateAction(Class<? extends UpdateAction> actionClass) public UpdateAction getUpdateAction(Class<? extends UpdateAction> actionClass)
throws InstantiationException, IllegalAccessException throws InstantiationException, IllegalAccessException
{ {

View File

@@ -46,17 +46,17 @@ public class AddBitstreamsAction extends UpdateBitstreamsAction {
} }
/** /**
* Adds bitstreams from the archive as listed in the contents file. * Adds bitstreams from the archive as listed in the contents file.
* *
* @param context * @param context DSpace Context
* @param itarch * @param itarch Item Archive
* @param isTest * @param isTest test flag
* @param suppressUndo * @param suppressUndo undo flag
* @throws IllegalArgumentException * @throws IOException if IO error
* @throws ParseException * @throws IllegalArgumentException if arg exception
* @throws IOException * @throws SQLException if database error
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* @throws SQLException * @throws ParseException if parse error
*/ */
@Override @Override
public void execute(Context context, ItemArchive itarch, boolean isTest, public void execute(Context context, ItemArchive itarch, boolean isTest,
@@ -117,6 +117,22 @@ public class AddBitstreamsAction extends UpdateBitstreamsAction {
} }
} }
/**
* Add bitstream
* @param context DSpace Context
* @param itarch Item Archive
* @param item DSpace Item
* @param dir directory
* @param ce contents entry for bitstream
* @param suppressUndo undo flag
* @param isTest test flag
* @return bundle name
* @throws IOException if IO error
* @throws IllegalArgumentException if arg exception
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
* @throws ParseException if parse error
*/
protected String addBitstream(Context context, ItemArchive itarch, Item item, File dir, protected String addBitstream(Context context, ItemArchive itarch, Item item, File dir,
ContentsEntry ce, boolean suppressUndo, boolean isTest) ContentsEntry ce, boolean suppressUndo, boolean isTest)
throws IOException, IllegalArgumentException, SQLException, AuthorizeException, ParseException throws IOException, IllegalArgumentException, SQLException, AuthorizeException, ParseException

View File

@@ -31,14 +31,14 @@ public class AddMetadataAction extends UpdateMetadataAction {
protected MetadataFieldService metadataFieldService = ContentServiceFactory.getInstance().getMetadataFieldService(); protected MetadataFieldService metadataFieldService = ContentServiceFactory.getInstance().getMetadataFieldService();
/** /**
* Adds metadata specified in the source archive * Adds metadata specified in the source archive
* *
* @param context * @param context DSpace Context
* @param itarch * @param itarch item archive
* @param isTest * @param isTest test flag
* @param suppressUndo * @param suppressUndo undo flag
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* @throws SQLException * @throws SQLException if database error
*/ */
@Override @Override
public void execute(Context context, ItemArchive itarch, boolean isTest, public void execute(Context context, ItemArchive itarch, boolean isTest,

View File

@@ -26,16 +26,16 @@ public abstract class BitstreamFilter {
/** /**
* The filter method * The filter method
* *
* @param bitstream * @param bitstream Bitstream
* @return whether the bitstream matches the criteria * @return whether the bitstream matches the criteria
* @throws BitstreamFilterException * @throws BitstreamFilterException if filter error
*/ */
public abstract boolean accept(Bitstream bitstream) throws BitstreamFilterException; public abstract boolean accept(Bitstream bitstream) throws BitstreamFilterException;
/** /**
* *
* @param filepath - The complete path for the properties file * @param filepath - The complete path for the properties file
* @throws IOException * @throws IOException if IO error
*/ */
public void initProperties(String filepath) public void initProperties(String filepath)
throws IOException throws IOException

View File

@@ -29,8 +29,8 @@ public class BitstreamFilterByBundleName extends BitstreamFilter {
/** /**
* Filter bitstream based on bundle name found in properties file * Filter bitstream based on bundle name found in properties file
* *
* @param bitstream * @param bitstream Bitstream
* @throws BitstreamFilterException * @throws BitstreamFilterException if filter error
* @return whether bitstream is in bundle * @return whether bitstream is in bundle
* *
*/ */

View File

@@ -29,7 +29,9 @@ public class BitstreamFilterByFilename extends BitstreamFilter {
* Tests bitstream by matching the regular expression in the * Tests bitstream by matching the regular expression in the
* properties against the bitstream name * properties against the bitstream name
* *
* @return whether bitstream name matches the regular expression * @param bitstream Bitstream
* @return whether bitstream name matches the regular expression
* @exception BitstreamFilterException if filter error
*/ */
@Override @Override
public boolean accept(Bitstream bitstream) throws BitstreamFilterException public boolean accept(Bitstream bitstream) throws BitstreamFilterException

View File

@@ -17,10 +17,18 @@ public class BitstreamFilterException extends Exception
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public BitstreamFilterException() {} public BitstreamFilterException() {}
/**
*
* @param msg exception message
*/
public BitstreamFilterException(String msg) public BitstreamFilterException(String msg)
{ {
super(msg); super(msg);
} }
/**
*
* @param e exception
*/
public BitstreamFilterException(Exception e) public BitstreamFilterException(Exception e)
{ {
super(e); super(e);

View File

@@ -21,9 +21,11 @@ import org.dspace.core.Constants;
* it looks from the source code that the ordering or elements is not fixed * it looks from the source code that the ordering or elements is not fixed
* *
* e.g.: * e.g.:
* {@code
* 48217870-MIT.pdf\tbundle: bundlename\tpermissions: -r 'MIT Users'\tdescription: Full printable version (MIT only) * 48217870-MIT.pdf\tbundle: bundlename\tpermissions: -r 'MIT Users'\tdescription: Full printable version (MIT only)
* permissions: -[r|w] ['group name'] * permissions: -[r|w] ['group name']
* description: <the description of the file> * description: <the description of the file>
* }
* *
* *
*/ */
@@ -57,9 +59,9 @@ public class ContentsEntry
/** /**
* Factory method parses a line from the Contents Entry file * Factory method parses a line from the Contents Entry file
* *
* @param line * @param line line as string
* @return the parsed ContentsEntry object * @return the parsed ContentsEntry object
* @throws ParseException * @throws ParseException if parse error
*/ */
public static ContentsEntry parse(String line) public static ContentsEntry parse(String line)
throws ParseException throws ParseException

View File

@@ -30,15 +30,15 @@ public class DeleteBitstreamsAction extends UpdateBitstreamsAction
/** /**
* Delete bitstream from item * Delete bitstream from item
* *
* @param context * @param context DSpace Context
* @param itarch * @param itarch item archive
* @param isTest * @param isTest test flag
* @param suppressUndo * @param suppressUndo undo flag
* @throws IllegalArgumentException * @throws IOException if IO error
* @throws ParseException * @throws IllegalArgumentException if arg exception
* @throws IOException * @throws SQLException if database error
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* @throws SQLException * @throws ParseException if parse error
*/ */
@Override @Override
public void execute(Context context, ItemArchive itarch, boolean isTest, public void execute(Context context, ItemArchive itarch, boolean isTest,

View File

@@ -35,7 +35,7 @@ public class DeleteBitstreamsByFilterAction extends UpdateBitstreamsAction {
/** /**
* Set filter * Set filter
* *
* @param filter * @param filter BitstreamFilter
*/ */
public void setBitstreamFilter(BitstreamFilter filter) public void setBitstreamFilter(BitstreamFilter filter)
{ {
@@ -54,15 +54,15 @@ public class DeleteBitstreamsByFilterAction extends UpdateBitstreamsAction {
/** /**
* Delete bitstream * Delete bitstream
* *
* @param context * @param context DSpace Context
* @param itarch * @param itarch item archive
* @param isTest * @param isTest test flag
* @param suppressUndo * @param suppressUndo undo flag
* @throws IllegalArgumentException * @throws IOException if IO error
* @throws ParseException * @throws SQLException if database error
* @throws IOException * @throws AuthorizeException if authorization error
* @throws AuthorizeException * @throws ParseException if parse error
* @throws SQLException * @throws BitstreamFilterException if filter error
*/ */
@Override @Override
public void execute(Context context, ItemArchive itarch, boolean isTest, public void execute(Context context, ItemArchive itarch, boolean isTest,

View File

@@ -28,12 +28,13 @@ public class DeleteMetadataAction extends UpdateMetadataAction {
/** /**
* Delete metadata from item * Delete metadata from item
* *
* @param context * @param context DSpace Context
* @param itarch * @param itarch Item Archive
* @param isTest * @param isTest test flag
* @param suppressUndo * @param suppressUndo undo flag
* @throws ParseException * @throws SQLException if database error
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* @throws ParseException if parse error
*/ */
@Override @Override
public void execute(Context context, ItemArchive itarch, boolean isTest, public void execute(Context context, ItemArchive itarch, boolean isTest,

View File

@@ -16,7 +16,7 @@ import org.dspace.content.Item;
* *
* Adds some utility methods * Adds some utility methods
* *
* Really not at all general enough but supports Dublin Core and the compound form notation <schema>.<element>[.<qualifier>] * Really not at all general enough but supports Dublin Core and the compound form notation {@code <schema>.<element>[.<qualifier>]}
* *
* Does not support wildcard for qualifier * Does not support wildcard for qualifier
* *
@@ -47,8 +47,9 @@ class DtoMetadata
* @param element not null, not empty * @param element not null, not empty
* @param qualifier null; don't allow empty string or * indicating 'any' * @param qualifier null; don't allow empty string or * indicating 'any'
* @param language null or empty * @param language null or empty
* @param value * @param value value
* @return DtoMetadata object * @return DtoMetadata object
* @throws IllegalArgumentException if arg error
*/ */
public static DtoMetadata create(String schema, public static DtoMetadata create(String schema,
String element, String element,
@@ -70,7 +71,9 @@ class DtoMetadata
* *
* @param compoundForm of the form <schema>.<element>[.<qualifier>] * @param compoundForm of the form <schema>.<element>[.<qualifier>]
* @param language null or empty * @param language null or empty
* @param value * @param value value
* @throws ParseException if parse error
* @throws IllegalArgumentException if arg error
*/ */
public static DtoMetadata create(String compoundForm, String language, String value) public static DtoMetadata create(String compoundForm, String language, String value)
throws ParseException, IllegalArgumentException throws ParseException, IllegalArgumentException

View File

@@ -85,6 +85,8 @@ public class ItemArchive {
* @param dir - The directory File in the source archive * @param dir - The directory File in the source archive
* @param itemField - The metadata field in which the Item identifier is located * @param itemField - The metadata field in which the Item identifier is located
* if null, the default is the handle in the dc.identifier.uri field * if null, the default is the handle in the dc.identifier.uri field
* @return ItemArchive object
* @throws Exception if error
* *
*/ */
public static ItemArchive create(Context context, File dir, String itemField) public static ItemArchive create(Context context, File dir, String itemField)
@@ -137,6 +139,11 @@ public class ItemArchive {
return builder; return builder;
} }
/**
* Getter for Transformer
* @return Transformer
* @throws TransformerConfigurationException if config error
*/
protected Transformer getTransformer() protected Transformer getTransformer()
throws TransformerConfigurationException throws TransformerConfigurationException
{ {
@@ -176,7 +183,7 @@ public class ItemArchive {
/** /**
* Add metadata field to undo list * Add metadata field to undo list
* @param dtom * @param dtom DtoMetadata (represents metadata field)
*/ */
public void addUndoMetadataField(DtoMetadata dtom) public void addUndoMetadataField(DtoMetadata dtom)
{ {
@@ -194,7 +201,7 @@ public class ItemArchive {
/** /**
* Add bitstream id to delete contents file * Add bitstream id to delete contents file
* @param bitstreamId * @param bitstreamId bitstream ID
*/ */
public void addUndoDeleteContents(UUID bitstreamId) public void addUndoDeleteContents(UUID bitstreamId)
{ {
@@ -207,7 +214,9 @@ public class ItemArchive {
* This is the default implementation * This is the default implementation
* that uses the dc.identifier.uri metadatafield * that uses the dc.identifier.uri metadatafield
* that contains the item handle as its value * that contains the item handle as its value
* * @param context DSpace Context
* @throws SQLException if database error
* @throws Exception if error
*/ */
private Item itemFromHandleInput(Context context) private Item itemFromHandleInput(Context context)
throws SQLException, Exception throws SQLException, Exception
@@ -250,8 +259,8 @@ public class ItemArchive {
* *
* @param context - the DSpace context * @param context - the DSpace context
* @param itemField - the compound form of the metadata element <schema>.<element>.<qualifier> * @param itemField - the compound form of the metadata element <schema>.<element>.<qualifier>
* @throws SQLException * @throws SQLException if database error
* @throws Exception * @throws Exception if error
*/ */
private Item itemFromMetadataField(Context context, String itemField) private Item itemFromMetadataField(Context context, String itemField)
throws SQLException, AuthorizeException, Exception throws SQLException, AuthorizeException, Exception
@@ -285,7 +294,11 @@ public class ItemArchive {
return item; return item;
} }
/**
* Get DtoMetadata field
* @param compoundForm compound form
* @return DtoMetadata field
*/
private DtoMetadata getMetadataField(String compoundForm) private DtoMetadata getMetadataField(String compoundForm)
{ {
for (DtoMetadata dtom : dtomList) for (DtoMetadata dtom : dtomList)
@@ -301,8 +314,12 @@ public class ItemArchive {
/** /**
* write undo directory and files to Disk in archive format * write undo directory and files to Disk in archive format
* *
*
* @param undoDir - the root directory of the undo archive * @param undoDir - the root directory of the undo archive
* @throws IOException if IO error
* @throws ParserConfigurationException if config error
* @throws TransformerConfigurationException if transformer config error
* @throws TransformerException if transformer error
* @throws FileNotFoundException if file not found
*/ */
public void writeUndo(File undoDir) public void writeUndo(File undoDir)
throws IOException, ParserConfigurationException, TransformerConfigurationException, throws IOException, ParserConfigurationException, TransformerConfigurationException,

View File

@@ -113,7 +113,7 @@ public class ItemUpdate {
/** /**
* *
* @param argv * @param argv commandline args
*/ */
public static void main(String[] argv) public static void main(String[] argv)
{ {
@@ -392,6 +392,16 @@ public class ItemUpdate {
System.exit(status); System.exit(status);
} }
/**
* process an archive
* @param context DSpace Context
* @param sourceDirPath source path
* @param itemField item field
* @param metadataIndexName index name
* @param alterProvenance whether to alter provenance
* @param isTest test flag
* @throws Exception if error
*/
protected void processArchive(Context context, String sourceDirPath, String itemField, protected void processArchive(Context context, String sourceDirPath, String itemField,
String metadataIndexName, boolean alterProvenance, boolean isTest) String metadataIndexName, boolean alterProvenance, boolean isTest)
throws Exception throws Exception
@@ -511,8 +521,8 @@ public class ItemUpdate {
* *
* @param sourceDir - the original source directory * @param sourceDir - the original source directory
* @return the directory of the undo archive * @return the directory of the undo archive
* @throws FileNotFoundException * @throws FileNotFoundException if file doesn't exist
* @throws IOException * @throws IOException if IO error
*/ */
protected File initUndoArchive(File sourceDir) protected File initUndoArchive(File sourceDir)
throws FileNotFoundException, IOException throws FileNotFoundException, IOException
@@ -555,6 +565,12 @@ public class ItemUpdate {
//private void write //private void write
/**
* Set EPerson doing import
* @param context DSpace Context
* @param eperson EPerson obj
* @throws Exception if error
*/
protected void setEPerson(Context context, String eperson) protected void setEPerson(Context context, String eperson)
throws Exception throws Exception
{ {
@@ -589,7 +605,7 @@ public class ItemUpdate {
* poor man's logging * poor man's logging
* As with ItemImport, API logging goes through log4j to the DSpace.log files * As with ItemImport, API logging goes through log4j to the DSpace.log files
* whereas the batch logging goes to the console to be captured there. * whereas the batch logging goes to the console to be captured there.
* @param s * @param s String
*/ */
static void pr(String s) static void pr(String s)
{ {
@@ -598,7 +614,7 @@ public class ItemUpdate {
/** /**
* print if verbose flag is set * print if verbose flag is set
* @param s * @param s String
*/ */
static void prv(String s) static void prv(String s)
{ {

View File

@@ -48,7 +48,7 @@ import org.dspace.core.ConfigurationManager;
/** /**
* Miscellaneous methods for metadata handling that build on the API * Miscellaneous methods for metadata handling that build on the API
* which might have general utility outside of the specific use * which might have general utility outside of the specific use
* in context in ItemUpdate. * in context in ItemUpdate.
* *
@@ -68,11 +68,11 @@ public class MetadataUtilities {
clear (i.e. delete) all of these DCValues clear (i.e. delete) all of these DCValues
* add them back, minus the one to actually delete * add them back, minus the one to actually delete
* *
* * @param context DSpace Context
* @param item * @param item Item Object
* @param dtom * @param dtom metadata field
* @param isLanguageStrict - * @param isLanguageStrict whether strict or not
* * @throws SQLException if database error
* @return true if metadata field is found with matching value and was deleted * @return true if metadata field is found with matching value and was deleted
*/ */
public static boolean deleteMetadataByValue(Context context, Item item, DtoMetadata dtom, boolean isLanguageStrict) throws SQLException { public static boolean deleteMetadataByValue(Context context, Item item, DtoMetadata dtom, boolean isLanguageStrict) throws SQLException {
@@ -122,11 +122,13 @@ public class MetadataUtilities {
/** /**
* Append text to value metadata field to item * Append text to value metadata field to item
* *
* @param item * @param context DSpace Context
* @param dtom * @param item DSpace Item
* @param isLanguageStrict * @param dtom metadata field
* @param textToAppend * @param isLanguageStrict if strict
* @param textToAppend text to append
* @throws IllegalArgumentException - When target metadata field is not found * @throws IllegalArgumentException - When target metadata field is not found
* @throws SQLException if database error
*/ */
public static void appendMetadata(Context context, Item item, DtoMetadata dtom, boolean isLanguageStrict, public static void appendMetadata(Context context, Item item, DtoMetadata dtom, boolean isLanguageStrict,
String textToAppend) String textToAppend)
@@ -184,15 +186,15 @@ public class MetadataUtilities {
* Modification of method from ItemImporter.loadDublinCore * Modification of method from ItemImporter.loadDublinCore
* as a Factory method * as a Factory method
* *
* @param docBuilder - * @param docBuilder DocumentBuilder
* @param is - InputStream of dublin_core.xml * @param is - InputStream of dublin_core.xml
* @return list of DtoMetadata representing the metadata fields relating to an Item * @return list of DtoMetadata representing the metadata fields relating to an Item
* @throws SQLException * @throws SQLException if database error
* @throws IOException * @throws IOException if IO error
* @throws ParserConfigurationException * @throws ParserConfigurationException if parser config error
* @throws SAXException * @throws SAXException if XML error
* @throws TransformerException * @throws TransformerException if transformer error
* @throws AuthorizeException * @throws AuthorizeException if authorization error
*/ */
public static List<DtoMetadata> loadDublinCore(DocumentBuilder docBuilder, InputStream is) public static List<DtoMetadata> loadDublinCore(DocumentBuilder docBuilder, InputStream is)
throws SQLException, IOException, ParserConfigurationException, throws SQLException, IOException, ParserConfigurationException,
@@ -269,12 +271,12 @@ public class MetadataUtilities {
/** /**
* Write dublin_core.xml * Write dublin_core.xml
* *
* @param docBuilder * @param docBuilder DocumentBuilder
* @param dtomList * @param dtomList List of metadata fields
* @return xml document * @return xml document
* @throws ParserConfigurationException * @throws ParserConfigurationException if parser config error
* @throws TransformerConfigurationException * @throws TransformerConfigurationException if transformer config error
* @throws TransformerException * @throws TransformerException if transformer error
*/ */
public static Document writeDublinCore(DocumentBuilder docBuilder, List<DtoMetadata> dtomList) public static Document writeDublinCore(DocumentBuilder docBuilder, List<DtoMetadata> dtomList)
throws ParserConfigurationException, TransformerConfigurationException, TransformerException throws ParserConfigurationException, TransformerConfigurationException, TransformerException
@@ -313,11 +315,11 @@ public class MetadataUtilities {
/** /**
* write xml document to output stream * write xml document to output stream
* @param doc * @param doc XML Document
* @param transformer * @param transformer XML Transformer
* @param out * @param out OutputStream
* @throws IOException * @throws IOException if IO Error
* @throws TransformerException * @throws TransformerException if Transformer error
*/ */
public static void writeDocument(Document doc, Transformer transformer, OutputStream out) public static void writeDocument(Document doc, Transformer transformer, OutputStream out)
throws IOException, TransformerException throws IOException, TransformerException
@@ -332,9 +334,9 @@ public class MetadataUtilities {
// XML utility methods // XML utility methods
/** /**
* Lookup an attribute from a DOM node. * Lookup an attribute from a DOM node.
* @param n * @param n Node
* @param name * @param name name
* @return * @return attribute value
*/ */
private static String getAttributeValue(Node n, String name) private static String getAttributeValue(Node n, String name)
{ {
@@ -355,8 +357,8 @@ public class MetadataUtilities {
/** /**
* Return the String value of a Node. * Return the String value of a Node.
* @param node * @param node node
* @return * @return string value
*/ */
private static String getStringValue(Node node) private static String getStringValue(Node node)
{ {
@@ -379,7 +381,11 @@ public class MetadataUtilities {
* Rewrite of ItemImport's functionality * Rewrite of ItemImport's functionality
* but just the parsing of the file, not the processing of its elements. * but just the parsing of the file, not the processing of its elements.
* *
* @validate flag to verify matching files in tree * @param f file
* @return list of ContentsEntry
* @throws FileNotFoundException if file doesn't exist
* @throws IOException if IO error
* @throws ParseException if parse error
*/ */
public static List<ContentsEntry> readContentsFile(File f) public static List<ContentsEntry> readContentsFile(File f)
throws FileNotFoundException, IOException, ParseException throws FileNotFoundException, IOException, ParseException
@@ -421,9 +427,10 @@ public class MetadataUtilities {
/** /**
* *
* @param f * @param f file
* @throws FileNotFoundException * @return list of lines as strings
* @throws IOException * @throws FileNotFoundException if file doesn't exist
* @throws IOException if IO Error
*/ */
public static List<String> readDeleteContentsFile(File f) public static List<String> readDeleteContentsFile(File f)
throws FileNotFoundException, IOException throws FileNotFoundException, IOException
@@ -466,7 +473,7 @@ public class MetadataUtilities {
/** /**
* Get display of Metadatum * Get display of Metadatum
* *
* @param dcv * @param dcv MetadataValue
* @return string displaying elements of the Metadatum * @return string displaying elements of the Metadatum
*/ */
public static String getDCValueString(MetadataValue dcv) public static String getDCValueString(MetadataValue dcv)
@@ -478,7 +485,10 @@ public class MetadataUtilities {
} }
/** /**
* * Return compound form of a metadata field (i.e. schema.element.qualifier)
* @param schema schema
* @param element element
* @param qualifier qualifier
* @return a String representation of the two- or three-part form of a metadata element * @return a String representation of the two- or three-part form of a metadata element
* e.g. dc.identifier.uri * e.g. dc.identifier.uri
*/ */
@@ -495,9 +505,10 @@ public class MetadataUtilities {
} }
/** /**
* Parses metadata field given in the form <schema>.<element>[.<qualifier>|.*] * Parses metadata field given in the form {@code <schema>.<element>[.<qualifier>|.*]}
* checks for correct number of elements (2 or 3) and for empty strings * checks for correct number of elements (2 or 3) and for empty strings
* *
* @param compoundForm compound form of metadata field
* @return String Array * @return String Array
* @throws ParseException if validity checks fail * @throws ParseException if validity checks fail
* *

View File

@@ -27,10 +27,10 @@ public class OriginalBitstreamFilter extends BitstreamFilterByBundleName
/** /**
* Tests bitstreams for containment in an ORIGINAL bundle * Tests bitstreams for containment in an ORIGINAL bundle
* * @param bitstream Bitstream
* @return true if the bitstream is in the ORIGINAL bundle * @return true if the bitstream is in the ORIGINAL bundle
* *
* @throws BitstreamFilterException * @throws BitstreamFilterException if filter error
*/ */
@Override @Override
public boolean accept(Bitstream bitstream) public boolean accept(Bitstream bitstream)

View File

@@ -30,8 +30,8 @@ public class OriginalWithDerivativesBitstreamFilter extends BitstreamFilter
/** /**
* Tests bitstream for membership in specified bundles (ORIGINAL, TEXT, THUMBNAIL) * Tests bitstream for membership in specified bundles (ORIGINAL, TEXT, THUMBNAIL)
* *
* @param bitstream * @param bitstream Bitstream
* @throws BitstreamFilterException * @throws BitstreamFilterException if error
* @return true if bitstream is in specified bundles * @return true if bitstream is in specified bundles
*/ */
@Override @Override

View File

@@ -21,13 +21,13 @@ public interface UpdateAction
/** /**
* Action to update item * Action to update item
* *
* @param context * @param context DSpace context
* @param itarch * @param itarch item archive
* @param isTest * @param isTest test flag
* @param suppressUndo * @param suppressUndo undo flag
* @throws Exception * @throws Exception if error
*/ */
public void execute(Context context, ItemArchive itarch, boolean isTest, boolean suppressUndo) public void execute(Context context, ItemArchive itarch, boolean isTest, boolean suppressUndo)
throws Exception; throws Exception;

View File

@@ -27,7 +27,7 @@ public abstract class UpdateBitstreamsAction implements UpdateAction {
/** /**
* Set variable to indicate that the dc.description.provenance field may * Set variable to indicate that the dc.description.provenance field may
* be changed as a result of Bitstream changes by ItemUpdate * be changed as a result of Bitstream changes by ItemUpdate
* @param alterProvenance * @param alterProvenance whether to alter provenance
*/ */
public void setAlterProvenance(boolean alterProvenance) public void setAlterProvenance(boolean alterProvenance)
{ {

View File

@@ -13,7 +13,7 @@ import java.util.Set;
/** /**
* This abstract subclass for metadata actions * This abstract subclass for metadata actions
* maintains a collection for the target metadata fields * maintains a collection for the target metadata fields
* expressed as a string in the compound notation ( <schema>.<element>.<qualifier> ) * expressed as a string in the compound notation ( {@code <schema>.<element>.<qualifier>} )
* on which to apply the action when the method execute is called. * on which to apply the action when the method execute is called.
* *
* Implemented as a Set to avoid problems with duplicates * Implemented as a Set to avoid problems with duplicates
@@ -36,7 +36,7 @@ public abstract class UpdateMetadataAction implements UpdateAction {
/** /**
* Set target fields * Set target fields
* *
* @param targetFields * @param targetFields Set of target fields to update
*/ */
public void addTargetFields(Set<String> targetFields) { public void addTargetFields(Set<String> targetFields) {
for (String tf : targetFields) for (String tf : targetFields)
@@ -48,7 +48,7 @@ public abstract class UpdateMetadataAction implements UpdateAction {
/** /**
* Add array of target fields to update * Add array of target fields to update
* @param targetFields * @param targetFields array of target fields to update
*/ */
public void addTargetFields(String[] targetFields) { public void addTargetFields(String[] targetFields) {
for (String tf : targetFields) for (String tf : targetFields)
@@ -61,7 +61,7 @@ public abstract class UpdateMetadataAction implements UpdateAction {
/** /**
* Add single field to update * Add single field to update
* *
* @param targetField * @param targetField target field to update
*/ */
public void addTargetField(String targetField) { public void addTargetField(String targetField) {
this.targetFields.add(targetField); this.targetFields.add(targetField);

View File

@@ -23,6 +23,12 @@ import org.jdom.Document;
*/ */
public class CommandRunner public class CommandRunner
{ {
/**
*
* @param args commandline args
* @throws IOException if IO error
* @throws FileNotFoundException if file doesn't exist
*/
public static void main(String[] args) public static void main(String[] args)
throws FileNotFoundException, IOException throws FileNotFoundException, IOException
{ {
@@ -46,11 +52,10 @@ public class CommandRunner
/** /**
* Read a file of command lines and execute each in turn. * Read a file of command lines and execute each in turn.
* *
* @param doc details of recognized commands.
* @param script the file of command lines to be executed. * @param script the file of command lines to be executed.
* @return * @return status code
* @throws FileNotFoundException * @throws IOException if IO error
* @throws IOException * @throws FileNotFoundException if file doesn't exist
*/ */
static int runManyCommands(String script) static int runManyCommands(String script)
throws FileNotFoundException, IOException throws FileNotFoundException, IOException

View File

@@ -34,6 +34,8 @@ public class ScriptLauncher
* Execute the DSpace script launcher * Execute the DSpace script launcher
* *
* @param args Any parameters required to be passed to the scripts it executes * @param args Any parameters required to be passed to the scripts it executes
* @throws IOException if IO error
* @throws FileNotFoundException if file doesn't exist
*/ */
public static void main(String[] args) public static void main(String[] args)
throws FileNotFoundException, IOException throws FileNotFoundException, IOException
@@ -90,8 +92,8 @@ public class ScriptLauncher
/** /**
* Recognize and execute a single command. * Recognize and execute a single command.
* @param doc * @param doc Document
* @param args * @param args arguments
*/ */
static int runOneCommand(Document commandConfigs, String[] args) static int runOneCommand(Document commandConfigs, String[] args)
{ {
@@ -275,6 +277,7 @@ public class ScriptLauncher
/** /**
* Display the commands that the current launcher config file knows about * Display the commands that the current launcher config file knows about
* @param commandConfigs configs as Document
*/ */
private static void display(Document commandConfigs) private static void display(Document commandConfigs)
{ {

View File

@@ -7,14 +7,7 @@
*/ */
package org.dspace.app.mediafilter; package org.dspace.app.mediafilter;
import java.awt.Graphics2D;
import java.awt.Color;
import java.awt.image.*; import java.awt.image.*;
import java.awt.RenderingHints;
import java.awt.Transparency;
import java.awt.Font;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream; import java.io.InputStream;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@@ -29,7 +22,7 @@ import org.dspace.app.mediafilter.JPEGFilter;
* thumbnail.maxwidth, thumbnail.maxheight, the size we want our thumbnail to be * thumbnail.maxwidth, thumbnail.maxheight, the size we want our thumbnail to be
* no bigger than. Creates only JPEGs. * no bigger than. Creates only JPEGs.
* *
* @author Jason Sherman <jsherman@usao.edu> * @author Jason Sherman jsherman@usao.edu
*/ */
public class BrandedPreviewJPEGFilter extends MediaFilter public class BrandedPreviewJPEGFilter extends MediaFilter
{ {
@@ -69,10 +62,13 @@ public class BrandedPreviewJPEGFilter extends MediaFilter
/** /**
* @param currentItem item
* @param source * @param source
* source input stream * source input stream
* @param verbose verbose mode
* *
* @return InputStream the resulting input stream * @return InputStream the resulting input stream
* @throws Exception if error
*/ */
@Override @Override
public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose) public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose)

View File

@@ -73,11 +73,14 @@ public class ExcelFilter extends MediaFilter
} }
/** /**
* @param source * @param item item
* source input stream * @param source source input stream
* @param verbose verbose mode
* *
* @return InputStream the resulting input stream * @return InputStream the resulting input stream
* @throws Exception if error
*/ */
@Override
public InputStream getDestinationStream(Item item, InputStream source, boolean verbose) public InputStream getDestinationStream(Item item, InputStream source, boolean verbose)
throws Exception throws Exception
{ {

View File

@@ -50,10 +50,13 @@ public interface FormatFilter
public String getDescription(); public String getDescription();
/** /**
* @param item Item
* @param source * @param source
* input stream * input stream
* @param verbose verbosity flag
* *
* @return result of filter's transformation, written out to a bitstream * @return result of filter's transformation, written out to a bitstream
* @throws Exception if error
*/ */
public InputStream getDestinationStream(Item item, InputStream source, boolean verbose) public InputStream getDestinationStream(Item item, InputStream source, boolean verbose)
throws Exception; throws Exception;
@@ -67,15 +70,14 @@ public interface FormatFilter
* for any reason. * for any reason.
* *
* *
* @param c * @param c context
* context * @param item item containing bitstream to process
* @param item * @param source source bitstream to be processed
* item containing bitstream to process * @param verbose verbose mode
* @param source
* source bitstream to be processed
* *
* @return true if bitstream processing should continue, * @return true if bitstream processing should continue,
* false if this bitstream should be skipped * false if this bitstream should be skipped
* @throws Exception if error
*/ */
public boolean preProcessBitstream(Context c, Item item, Bitstream source, boolean verbose) public boolean preProcessBitstream(Context c, Item item, Bitstream source, boolean verbose)
throws Exception; throws Exception;
@@ -96,6 +98,7 @@ public interface FormatFilter
* @param generatedBitstream * @param generatedBitstream
* the bitstream which was generated by * the bitstream which was generated by
* this filter. * this filter.
* @throws Exception if error
*/ */
public void postProcessBitstream(Context c, Item item, Bitstream generatedBitstream) public void postProcessBitstream(Context c, Item item, Bitstream generatedBitstream)
throws Exception; throws Exception;

View File

@@ -59,10 +59,12 @@ public class HTMLFilter extends MediaFilter
} }
/** /**
* @param source * @param currentItem item
* source input stream * @param source source input stream
* @param verbose verbose mode
* *
* @return InputStream the resulting input stream * @return InputStream the resulting input stream
* @throws Exception if error
*/ */
@Override @Override
public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose) public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose)

View File

@@ -24,10 +24,12 @@ public class ImageMagickImageThumbnailFilter extends ImageMagickThumbnailFilter
{ {
/** /**
* @param source * @param currentItem item
* source input stream * @param source source input stream
* @param verbose verbose mode
* *
* @return InputStream the resulting input stream * @return InputStream the resulting input stream
* @throws Exception if error
*/ */
@Override @Override
public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose) public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose)

View File

@@ -27,7 +27,7 @@ import org.dspace.core.ConfigurationManager;
* thumbnail.maxwidth, thumbnail.maxheight, the size we want our thumbnail to be * thumbnail.maxwidth, thumbnail.maxheight, the size we want our thumbnail to be
* no bigger than. Creates only JPEGs. * no bigger than. Creates only JPEGs.
* *
* @author Jason Sherman <jsherman@usao.edu> * @author Jason Sherman jsherman@usao.edu
*/ */
public class JPEGFilter extends MediaFilter implements SelfRegisterInputFormats public class JPEGFilter extends MediaFilter implements SelfRegisterInputFormats
{ {
@@ -66,10 +66,12 @@ public class JPEGFilter extends MediaFilter implements SelfRegisterInputFormats
} }
/** /**
* @param source * @param currentItem item
* source input stream * @param source source input stream
* @param verbose verbose mode
* *
* @return InputStream the resulting input stream * @return InputStream the resulting input stream
* @throws Exception if error
*/ */
@Override @Override
public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose) public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose)
@@ -239,6 +241,8 @@ public class JPEGFilter extends MediaFilter implements SelfRegisterInputFormats
* Convenience method that returns a blurred instance of the * Convenience method that returns a blurred instance of the
* provided {@code BufferedImage}. * provided {@code BufferedImage}.
* *
* @param buf buffered image
* @return updated BufferedImage
*/ */
public BufferedImage getBlurredInstance(BufferedImage buf) public BufferedImage getBlurredInstance(BufferedImage buf)
{ {

View File

@@ -29,15 +29,14 @@ public abstract class MediaFilter implements FormatFilter
* for any reason. * for any reason.
* *
* *
* @param c * @param c context
* context * @param item item containing bitstream to process
* @param item * @param source source bitstream to be processed
* item containing bitstream to process * @param verbose verbose mode
* @param source
* source bitstream to be processed
* *
* @return true if bitstream processing should continue, * @return true if bitstream processing should continue,
* false if this bitstream should be skipped * false if this bitstream should be skipped
* @throws Exception if error
*/ */
@Override @Override
public boolean preProcessBitstream(Context c, Item item, Bitstream source, boolean verbose) public boolean preProcessBitstream(Context c, Item item, Bitstream source, boolean verbose)
@@ -62,6 +61,7 @@ public abstract class MediaFilter implements FormatFilter
* @param generatedBitstream * @param generatedBitstream
* the bitstream which was generated by * the bitstream which was generated by
* this filter. * this filter.
* @throws java.lang.Exception
*/ */
@Override @Override
public void postProcessBitstream(Context c, Item item, Bitstream generatedBitstream) public void postProcessBitstream(Context c, Item item, Bitstream generatedBitstream)

View File

@@ -7,13 +7,7 @@
*/ */
package org.dspace.app.mediafilter; package org.dspace.app.mediafilter;
import java.awt.Graphics2D;
import java.awt.Color;
import java.awt.image.*; import java.awt.image.*;
import java.awt.RenderingHints;
import java.awt.Transparency;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream; import java.io.InputStream;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@@ -22,7 +16,6 @@ import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.rendering.PDFRenderer; import org.apache.pdfbox.rendering.PDFRenderer;
import org.dspace.content.Item; import org.dspace.content.Item;
import org.dspace.core.ConfigurationManager;
import org.dspace.app.mediafilter.JPEGFilter; import org.dspace.app.mediafilter.JPEGFilter;
@@ -33,8 +26,8 @@ import org.dspace.app.mediafilter.JPEGFilter;
* thumbnail.maxwidth, thumbnail.maxheight, the size we want our thumbnail to be * thumbnail.maxwidth, thumbnail.maxheight, the size we want our thumbnail to be
* no bigger than. Creates only JPEGs. * no bigger than. Creates only JPEGs.
* *
* @author Ivan Masár <helix84@centrum.sk> * @author Ivan Masár helix84@centrum.sk
* @author Jason Sherman <jsherman@usao.edu> * @author Jason Sherman jsherman@usao.edu
*/ */
public class PDFBoxThumbnail extends MediaFilter implements SelfRegisterInputFormats public class PDFBoxThumbnail extends MediaFilter implements SelfRegisterInputFormats
{ {
@@ -73,10 +66,12 @@ public class PDFBoxThumbnail extends MediaFilter implements SelfRegisterInputFor
} }
/** /**
* @param source * @param currentItem item
* source input stream * @param source source input stream
* @param verbose verbose mode
* *
* @return InputStream the resulting input stream * @return InputStream the resulting input stream
* @throws Exception if error
*/ */
@Override @Override
public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose) public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose)

View File

@@ -68,10 +68,12 @@ public class PDFFilter extends MediaFilter
} }
/** /**
* @param source * @param currentItem item
* source input stream * @param source source input stream
* @param verbose verbose mode
* *
* @return InputStream the resulting input stream * @return InputStream the resulting input stream
* @throws Exception if error
*/ */
@Override @Override
public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose) public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose)

View File

@@ -64,10 +64,12 @@ public class PowerPointFilter extends MediaFilter
} }
/** /**
* @param source * @param currentItem item
* source input stream * @param source source input stream
* @param verbose verbose mode
* *
* @return InputStream the resulting input stream * @return InputStream the resulting input stream
* @throws Exception if error
*/ */
@Override @Override
public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose) public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose)

View File

@@ -63,10 +63,12 @@ public class WordFilter extends MediaFilter
} }
/** /**
* @param source * @param currentItem item
* source input stream * @param source source input stream
* @param verbose verbose mode
* *
* @return InputStream the resulting input stream * @return InputStream the resulting input stream
* @throws Exception if error
*/ */
@Override @Override
public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose) public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose)

View File

@@ -48,8 +48,11 @@ public interface MediaFilterService {
* Iterate through the item's bitstreams in the ORIGINAL bundle, applying * Iterate through the item's bitstreams in the ORIGINAL bundle, applying
* filters if possible. * filters if possible.
* *
* @param context context
* @param myItem item
* @return true if any bitstreams processed, * @return true if any bitstreams processed,
* false if none * false if none
* @throws Exception if error
*/ */
public boolean filterItem(Context context, Item myItem) throws Exception; public boolean filterItem(Context context, Item myItem) throws Exception;
@@ -60,8 +63,12 @@ public interface MediaFilterService {
* instantiated. Exceptions from filtering will be logged to STDOUT and * instantiated. Exceptions from filtering will be logged to STDOUT and
* swallowed. * swallowed.
* *
* @param c context
* @param myItem item
* @param myBitstream bitstream
* @return true if bitstream processed, * @return true if bitstream processed,
* false if no applicable filter or already processed * false if no applicable filter or already processed
* @throws Exception if error
*/ */
public boolean filterBitstream(Context c, Item myItem, Bitstream myBitstream) throws Exception; public boolean filterBitstream(Context c, Item myItem, Bitstream myBitstream) throws Exception;
@@ -72,7 +79,7 @@ public interface MediaFilterService {
* already been filtered, and if not or if overWrite is set, invokes the * already been filtered, and if not or if overWrite is set, invokes the
* filter. * filter.
* *
* @param c * @param context
* context * context
* @param item * @param item
* item containing bitstream to process * item containing bitstream to process
@@ -80,7 +87,7 @@ public interface MediaFilterService {
* source bitstream to process * source bitstream to process
* @param formatFilter * @param formatFilter
* FormatFilter to perform filtering * FormatFilter to perform filtering
* * @throws Exception if error occurs
* @return true if new rendition is created, false if rendition already * @return true if new rendition is created, false if rendition already
* exists and overWrite is not set * exists and overWrite is not set
*/ */

View File

@@ -478,12 +478,12 @@ public class Packager
* @param pkgParams Parameters to pass to individual packager instances * @param pkgParams Parameters to pass to individual packager instances
* @param sourceFile location of the source package to ingest * @param sourceFile location of the source package to ingest
* @param parentObjs Parent DSpace object(s) to attach new object to * @param parentObjs Parent DSpace object(s) to attach new object to
* @throws IOException * @throws IOException if IO error
* @throws SQLException * @throws SQLException if database error
* @throws FileNotFoundException * @throws FileNotFoundException if file doesn't exist
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* @throws CrosswalkException * @throws CrosswalkException if crosswalk error
* @throws PackageException * @throws PackageException if packaging error
*/ */
protected void ingest(Context context, PackageIngester sip, PackageParameters pkgParams, String sourceFile, DSpaceObject parentObjs[]) protected void ingest(Context context, PackageIngester sip, PackageParameters pkgParams, String sourceFile, DSpaceObject parentObjs[])
throws IOException, SQLException, FileNotFoundException, AuthorizeException, CrosswalkException, PackageException throws IOException, SQLException, FileNotFoundException, AuthorizeException, CrosswalkException, PackageException
@@ -617,12 +617,12 @@ public class Packager
* @param dso DSpace Object to disseminate as a package * @param dso DSpace Object to disseminate as a package
* @param pkgParams Parameters to pass to individual packager instances * @param pkgParams Parameters to pass to individual packager instances
* @param outputFile File where final package should be saved * @param outputFile File where final package should be saved
* @throws IOException * @throws IOException if IO error
* @throws SQLException * @throws SQLException if database error
* @throws FileNotFoundException * @throws FileNotFoundException if file doesn't exist
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* @throws CrosswalkException * @throws CrosswalkException if crosswalk error
* @throws PackageException * @throws PackageException if packaging error
*/ */
protected void disseminate(Context context, PackageDisseminator dip, protected void disseminate(Context context, PackageDisseminator dip,
DSpaceObject dso, PackageParameters pkgParams, DSpaceObject dso, PackageParameters pkgParams,
@@ -699,12 +699,12 @@ public class Packager
* @param pkgParams Parameters to pass to individual packager instances * @param pkgParams Parameters to pass to individual packager instances
* @param sourceFile location of the source package to ingest as the replacement * @param sourceFile location of the source package to ingest as the replacement
* @param objToReplace DSpace object to replace (may be null if it will be specified in the package itself) * @param objToReplace DSpace object to replace (may be null if it will be specified in the package itself)
* @throws IOException * @throws IOException if IO error
* @throws SQLException * @throws SQLException if database error
* @throws FileNotFoundException * @throws FileNotFoundException if file doesn't exist
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* @throws CrosswalkException * @throws CrosswalkException if crosswalk error
* @throws PackageException * @throws PackageException if packaging error
*/ */
protected void replace(Context context, PackageIngester sip, PackageParameters pkgParams, String sourceFile, DSpaceObject objToReplace) protected void replace(Context context, PackageIngester sip, PackageParameters pkgParams, String sourceFile, DSpaceObject objToReplace)
throws IOException, SQLException, FileNotFoundException, AuthorizeException, CrosswalkException, PackageException throws IOException, SQLException, FileNotFoundException, AuthorizeException, CrosswalkException, PackageException

View File

@@ -10,6 +10,7 @@ package org.dspace.app.requestitem;
import org.dspace.content.Bitstream; import org.dspace.content.Bitstream;
import org.dspace.content.Item; import org.dspace.content.Item;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.ReloadableEntity;
import javax.persistence.*; import javax.persistence.*;
import java.util.Date; import java.util.Date;
@@ -19,7 +20,7 @@ import java.util.Date;
*/ */
@Entity @Entity
@Table(name="requestitem") @Table(name="requestitem")
public class RequestItem { public class RequestItem implements ReloadableEntity<Integer> {
@Id @Id
@@ -76,7 +77,7 @@ public class RequestItem {
{ {
} }
public int getID() { public Integer getID() {
return requestitem_id; return requestitem_id;
} }

View File

@@ -9,7 +9,6 @@ package org.dspace.app.requestitem;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Item; import org.dspace.content.Item;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context; import org.dspace.core.Context;
@@ -55,9 +54,10 @@ public class RequestItemHelpdeskStrategy extends RequestItemSubmitterStrategy {
* Return a RequestItemAuthor object for the specified helpdesk email address. * Return a RequestItemAuthor object for the specified helpdesk email address.
* It makes an attempt to find if there is a matching eperson for the helpdesk address, to use the name, * It makes an attempt to find if there is a matching eperson for the helpdesk address, to use the name,
* Otherwise it falls back to a helpdeskname key in the Messages.props. * Otherwise it falls back to a helpdeskname key in the Messages.props.
* @param context * @param context context
* @param helpDeskEmail * @param helpDeskEmail email
* @return * @return RequestItemAuthor
* @throws SQLException if database error
*/ */
public RequestItemAuthor getHelpDeskPerson(Context context, String helpDeskEmail) throws SQLException{ public RequestItemAuthor getHelpDeskPerson(Context context, String helpDeskEmail) throws SQLException{
EPerson helpdeskEPerson = null; EPerson helpdeskEPerson = null;

View File

@@ -16,7 +16,7 @@ import java.sql.SQLException;
/** /**
* Database Access Object interface class for the RequestItem object. * Database Access Object interface class for the RequestItem object.
* The implementation of this class is responsible for all database calls for the RequestItem object and is autowired by spring * The implementation of this class is responsible for all database calls for the RequestItem object and is autowired by spring
* This class should only be accessed from a single service & should never be exposed outside of the API * This class should only be accessed from a single service and should never be exposed outside of the API
* *
* @author kevinvandevelde at atmire.com * @author kevinvandevelde at atmire.com
*/ */

View File

@@ -24,9 +24,15 @@ public interface RequestItemService {
/** /**
* Generate a request item representing the request and put it into the DB * Generate a request item representing the request and put it into the DB
* @param context * @param context context
* @param bitstream bitstream
* @param item item
* @param reqMessage message
* @param allFiles all files flag
* @param reqEmail email
* @param reqName name
* @return the token of the request item * @return the token of the request item
* @throws java.sql.SQLException * @throws SQLException if database error
*/ */
public String createRequest(Context context, Bitstream bitstream, Item item, boolean allFiles, String reqEmail, String reqName, String reqMessage) public String createRequest(Context context, Bitstream bitstream, Item item, boolean allFiles, String reqEmail, String reqName, String reqMessage)
throws SQLException; throws SQLException;
@@ -36,6 +42,7 @@ public interface RequestItemService {
/** /**
* Save updates to the record. Only accept_request, and decision_date are set-able. * Save updates to the record. Only accept_request, and decision_date are set-able.
* @param context * @param context
* @param requestItem
*/ */
public void update(Context context, RequestItem requestItem); public void update(Context context, RequestItem requestItem);

View File

@@ -140,7 +140,7 @@ public class SFXFileReaderServiceImpl implements SFXFileReaderService {
* @param e DOM node of the mapping pair in the XML file (field element) * @param e DOM node of the mapping pair in the XML file (field element)
* @param item The item to process, from which metadata values will be taken * @param item The item to process, from which metadata values will be taken
* @return assembled OpenURL query. * @return assembled OpenURL query.
* @throws IOException * @throws IOException if IO error
*/ */
protected String processFields(Node e, Item item) throws IOException { protected String processFields(Node e, Item item) throws IOException {
NodeList cl = e.getChildNodes(); NodeList cl = e.getChildNodes();

View File

@@ -36,7 +36,7 @@ public interface SFXFileReaderService {
* @param item The item to process, from which metadata values will be taken * @param item The item to process, from which metadata values will be taken
* *
* @return the SFX string * @return the SFX string
* @throws java.io.IOException * @throws IOException if IO error
*/ */
public String loadSFXFile(String fileName, Item item) throws IOException; public String loadSFXFile(String fileName, Item item) throws IOException;
@@ -53,7 +53,7 @@ public interface SFXFileReaderService {
* @param node DOM node of the mapping pair in the XML file (field element) * @param node DOM node of the mapping pair in the XML file (field element)
* @param item The item to process, from which metadata values will be taken * @param item The item to process, from which metadata values will be taken
* @return processed fields. * @return processed fields.
* @throws IOException * @throws IOException if IO error
*/ */
public String doNodes(Node node, Item item) throws IOException; public String doNodes(Node node, Item item) throws IOException;
@@ -67,17 +67,24 @@ public interface SFXFileReaderService {
/** /**
* Is Empty text Node * * Is Empty text Node *
* @param nd node
* @return true or false
*/ */
public boolean isEmptyTextNode(Node nd); public boolean isEmptyTextNode(Node nd);
/** /**
* Returns the value of the node's attribute named <name> * Returns the value of the node's attribute named {@code <name>}
* @param e node
* @param name name
* @return value
*/ */
public String getAttribute(Node e, String name); public String getAttribute(Node e, String name);
/** /**
* Returns the value found in the Text node (if any) in the * Returns the value found in the Text node (if any) in the
* node list that's passed in. * node list that's passed in.
* @param node node
* @return value
*/ */
public String getValue(Node node); public String getValue(Node node);
} }

View File

@@ -37,7 +37,10 @@ public class MetadataAuthorityISSNExtractor implements ISSNItemExtractor
List<MetadataValue> dcvalues = itemService.getMetadataByMetadataString(item, metadata); List<MetadataValue> dcvalues = itemService.getMetadataByMetadataString(item, metadata);
for (MetadataValue dcvalue : dcvalues) for (MetadataValue dcvalue : dcvalues)
{ {
values.add(dcvalue.getAuthority()); String authority = dcvalue.getAuthority();
if(authority !=null){
values.add(authority);
}
} }
} }
return values; return values;

View File

@@ -74,7 +74,7 @@ public abstract class AbstractGenerator
/** /**
* Start writing a new sitemap file. * Start writing a new sitemap file.
* *
* @throws IOException * @throws IOException if IO error
* if an error occurs creating the file * if an error occurs creating the file
*/ */
protected void startNewFile() throws IOException protected void startNewFile() throws IOException
@@ -102,7 +102,7 @@ public abstract class AbstractGenerator
* Full URL to add * Full URL to add
* @param lastMod * @param lastMod
* Date URL was last modified, or {@code null} * Date URL was last modified, or {@code null}
* @throws IOException * @throws IOException if IO error
* if an error occurs writing * if an error occurs writing
*/ */
public void addURL(String url, Date lastMod) throws IOException public void addURL(String url, Date lastMod) throws IOException
@@ -130,7 +130,7 @@ public abstract class AbstractGenerator
/** /**
* Finish with the current sitemap file. * Finish with the current sitemap file.
* *
* @throws IOException * @throws IOException if IO error
* if an error occurs writing * if an error occurs writing
*/ */
protected void closeCurrentFile() throws IOException protected void closeCurrentFile() throws IOException
@@ -147,7 +147,7 @@ public abstract class AbstractGenerator
* *
* @return number of sitemap files written. * @return number of sitemap files written.
* *
* @throws IOException * @throws IOException if IO error
* if an error occurs writing * if an error occurs writing
*/ */
public int finish() throws IOException public int finish() throws IOException
@@ -246,7 +246,7 @@ public abstract class AbstractGenerator
* stream to write the index to * stream to write the index to
* @param sitemapCount * @param sitemapCount
* number of sitemaps that were generated * number of sitemaps that were generated
* @throws IOException * @throws IOException if IO error
* if an IO error occurs * if an IO error occurs
*/ */
public abstract void writeIndex(PrintStream output, int sitemapCount) public abstract void writeIndex(PrintStream output, int sitemapCount)

View File

@@ -152,9 +152,9 @@ public class GenerateSitemaps
* if {@code true}, generate an HTML sitemap. * if {@code true}, generate an HTML sitemap.
* @param makeSitemapOrg * @param makeSitemapOrg
* if {@code true}, generate an sitemap.org sitemap. * if {@code true}, generate an sitemap.org sitemap.
* @throws SQLException * @throws SQLException if database error
* if a database error occurs. * if a database error occurs.
* @throws IOException * @throws IOException if IO error
* if IO error occurs. * if IO error occurs.
*/ */
public static void generateSitemaps(boolean makeHTMLMap, public static void generateSitemaps(boolean makeHTMLMap,

View File

@@ -25,9 +25,9 @@ import org.dspace.core.ConfigurationManager;
/** /**
* This class allows the running of the DSpace statistic tools * This class allows the running of the DSpace statistic tools
* *
* Usage: java CreateStatReport -r <statistic to run> * Usage: {@code java CreateStatReport -r <statistic to run>}
* Available: <stat-initial> <stat-general> <stat-monthly> <stat-report-initial> * Available: {@code <stat-initial> <stat-general> <stat-monthly> <stat-report-initial>
* <stat-report-general> <stat-report-monthly> * <stat-report-general> <stat-report-monthly>}
* *
* @author Chris Yates * @author Chris Yates
* *
@@ -95,7 +95,7 @@ public class CreateStatReport {
context.setIgnoreAuthorization(true); context.setIgnoreAuthorization(true);
//get paths to directories //get paths to directories
outputLogDirectory = ConfigurationManager.getProperty("log.dir") + File.separator; outputLogDirectory = ConfigurationManager.getProperty("log.report.dir") + File.separator;
outputReportDirectory = ConfigurationManager.getProperty("report.dir") + File.separator; outputReportDirectory = ConfigurationManager.getProperty("report.dir") + File.separator;
//read in command line variable to determine which statistic to run //read in command line variable to determine which statistic to run
@@ -145,7 +145,7 @@ public class CreateStatReport {
/** /**
* This method generates a report from the first of the current month to the end of the current month. * This method generates a report from the first of the current month to the end of the current month.
* *
* @throws Exception * @throws Exception if error
*/ */
private static void statMonthly() throws Exception { private static void statMonthly() throws Exception {
@@ -184,7 +184,7 @@ public class CreateStatReport {
/** /**
* This method generates a full report based on the full log period * This method generates a full report based on the full log period
* *
* @throws Exception * @throws Exception if error
*/ */
private static void statGeneral() throws Exception { private static void statGeneral() throws Exception {
@@ -216,7 +216,7 @@ public class CreateStatReport {
* This script starts from the year and month specified below and loops each month until the current month * This script starts from the year and month specified below and loops each month until the current month
* generating a monthly aggregation files for the DStat system. * generating a monthly aggregation files for the DStat system.
* *
* @throws Exception * @throws Exception if error
*/ */
private static void statInitial() throws Exception { private static void statInitial() throws Exception {
@@ -265,7 +265,7 @@ public class CreateStatReport {
/** /**
* This method generates a full report based on the full log period * This method generates a full report based on the full log period
* *
* @throws Exception * @throws Exception if error
*/ */
private static void statReportGeneral() throws Exception { private static void statReportGeneral() throws Exception {
@@ -304,7 +304,7 @@ public class CreateStatReport {
* This script starts from the year and month specified below and loops each month until the current month * This script starts from the year and month specified below and loops each month until the current month
* generating monthly reports from the DStat aggregation files * generating monthly reports from the DStat aggregation files
* *
* @throws Exception * @throws Exception if error
*/ */
private static void statReportInitial() throws Exception { private static void statReportInitial() throws Exception {
@@ -349,7 +349,7 @@ public class CreateStatReport {
/** /**
* This method generates a report from the aggregation files which have been run for the most recent month * This method generates a report from the aggregation files which have been run for the most recent month
* *
* @throws Exception * @throws Exception if error
*/ */
private static void statReportMonthly() throws Exception private static void statReportMonthly() throws Exception
{ {

View File

@@ -334,7 +334,7 @@ public class HTMLReport implements Report
/** /**
* output the report block based on the passed mapping, where the mapping * output the report block based on the passed mapping, where the mapping
* sould be "name of report element" => "value", where both sides of the * should be "name of report element" to "value", where both sides of the
* mapping should be Strings. This class also assumes that the reference * mapping should be Strings. This class also assumes that the reference
* is a linkable URL to the resource * is a linkable URL to the resource
* *

View File

@@ -9,7 +9,6 @@ package org.dspace.app.statistics;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
import org.dspace.core.Constants;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.LogManager; import org.dspace.core.LogManager;
import org.dspace.discovery.DiscoverQuery; import org.dspace.discovery.DiscoverQuery;
@@ -185,7 +184,7 @@ public class LogAnalyser
//////////////////////// ////////////////////////
/** the log directory to be analysed */ /** the log directory to be analysed */
private static String logDir = ConfigurationManager.getProperty("log.dir"); private static String logDir = ConfigurationManager.getProperty("log.report.dir");
/** the regex to describe the file name format */ /** the regex to describe the file name format */
private static String fileTemplate = "dspace\\.log.*"; private static String fileTemplate = "dspace\\.log.*";
@@ -196,7 +195,7 @@ public class LogAnalyser
"dstat.cfg"; "dstat.cfg";
/** the output file to which to write aggregation data */ /** the output file to which to write aggregation data */
private static String outFile = ConfigurationManager.getProperty("log.dir") + File.separator + "dstat.dat"; private static String outFile = ConfigurationManager.getProperty("log.report.dir") + File.separator + "dstat.dat";
/** the starting date of the report */ /** the starting date of the report */
private static Date startDate = null; private static Date startDate = null;
@@ -213,6 +212,9 @@ public class LogAnalyser
/** /**
* main method to be run from command line. See usage information for * main method to be run from command line. See usage information for
* details as to how to use the command line flags (-help) * details as to how to use the command line flags (-help)
* @param argv arguments
* @throws Exception if error
* @throws SQLException if database error
*/ */
public static void main(String [] argv) public static void main(String [] argv)
throws Exception, SQLException throws Exception, SQLException
@@ -294,6 +296,10 @@ public class LogAnalyser
* @param myStartDate the desired start of the analysis. Starts from the beginning otherwise * @param myStartDate the desired start of the analysis. Starts from the beginning otherwise
* @param myEndDate the desired end of the analysis. Goes to the end otherwise * @param myEndDate the desired end of the analysis. Goes to the end otherwise
* @param myLookUp force a lookup of the database * @param myLookUp force a lookup of the database
* @return aggregate output
* @throws IOException if IO error
* @throws SQLException if database error
* @throws SearchServiceException if search error
*/ */
public static String processLogs(Context context, String myLogDir, public static String processLogs(Context context, String myLogDir,
String myFileTemplate, String myConfigFile, String myFileTemplate, String myConfigFile,
@@ -587,6 +593,7 @@ public class LogAnalyser
/** /**
* generate the analyser's output to the specified out file * generate the analyser's output to the specified out file
* @return output
*/ */
public static String createOutput() public static String createOutput()
{ {
@@ -866,6 +873,7 @@ public class LogAnalyser
/** /**
* Read in the current config file and populate the class globals. * Read in the current config file and populate the class globals.
* @throws IOException if IO error
*/ */
public static void readConfig() throws IOException public static void readConfig() throws IOException
{ {
@@ -876,6 +884,7 @@ public class LogAnalyser
* Read in the given config file and populate the class globals. * Read in the given config file and populate the class globals.
* *
* @param configFile the config file to read in * @param configFile the config file to read in
* @throws IOException if IO error
*/ */
public static void readConfig(String configFile) throws IOException public static void readConfig(String configFile) throws IOException
{ {
@@ -1166,6 +1175,8 @@ public class LogAnalyser
* @param type value for DC field 'type' (unqualified) * @param type value for DC field 'type' (unqualified)
* *
* @return an integer containing the relevant count * @return an integer containing the relevant count
* @throws SQLException if database error
* @throws SearchServiceException if search error
*/ */
public static Integer getNumItems(Context context, String type) public static Integer getNumItems(Context context, String type)
throws SQLException, SearchServiceException { throws SQLException, SearchServiceException {
@@ -1216,6 +1227,8 @@ public class LogAnalyser
* *
* @return an Integer containing the number of items in the * @return an Integer containing the number of items in the
* archive * archive
* @throws SQLException if database error
* @throws SearchServiceException if search error
*/ */
public static Integer getNumItems(Context context) public static Integer getNumItems(Context context)
throws SQLException, SearchServiceException { throws SQLException, SearchServiceException {

View File

@@ -152,6 +152,9 @@ public class ReportGenerator
/** /**
* main method to be run from command line. See usage information for * main method to be run from command line. See usage information for
* details as to how to use the command line flags * details as to how to use the command line flags
* @param argv
* @throws java.lang.Exception
* @throws java.sql.SQLException
*/ */
public static void main(String [] argv) public static void main(String [] argv)
throws Exception, SQLException throws Exception, SQLException
@@ -206,10 +209,13 @@ public class ReportGenerator
* this method is retained for backwards compatibility, but delegates the actual * this method is retained for backwards compatibility, but delegates the actual
* wprk to a new method * wprk to a new method
* *
* @param context the DSpace context in which this action is performed * @param context the DSpace context in which this action is performed
* @param myFormat the desired output format (currently on HTML supported) * @param myFormat the desired output format (currently on HTML supported)
* @param myInput the aggregation file to be turned into a report * @param myInput the aggregation file to be turned into a report
* @param myOutput the file into which to write the report * @param myOutput the file into which to write the report
* @param myMap the map
* @throws Exception if error
* @throws SQLException if database error
*/ */
public static void processReport(Context context, String myFormat, public static void processReport(Context context, String myFormat,
String myInput, String myOutput, String myInput, String myOutput,
@@ -242,6 +248,11 @@ public class ReportGenerator
* using the pre-configuration information passed here, read in the * using the pre-configuration information passed here, read in the
* aggregation data and output a file containing the report in the * aggregation data and output a file containing the report in the
* requested format * requested format
* @param context context
* @param report report
* @param myInput input
* @throws Exception if error
* @throws SQLException if database error
*/ */
public static void processReport(Context context, Report report, public static void processReport(Context context, Report report,
String myInput) String myInput)
@@ -527,6 +538,7 @@ public class ReportGenerator
* actions which are more understandable to humans * actions which are more understandable to humans
* *
* @param map the map file * @param map the map file
* @throws IOException if IO error
*/ */
public static void readMap(String map) public static void readMap(String map)
throws IOException throws IOException
@@ -612,6 +624,8 @@ public class ReportGenerator
* The values that come from this file form the basis of the analysis report * The values that come from this file form the basis of the analysis report
* *
* @param input the aggregator file * @param input the aggregator file
* @throws IOException if IO error
* @throws ParseException if parse error
*/ */
public static void readInput(String input) public static void readInput(String input)
throws IOException, ParseException throws IOException, ParseException
@@ -783,6 +797,7 @@ public class ReportGenerator
* *
* @return a string containing a reference (almost citation) to the * @return a string containing a reference (almost citation) to the
* article * article
* @throws SQLException if database error
*/ */
public static String getItemInfo(Context context, String handle) public static String getItemInfo(Context context, String handle)
throws SQLException throws SQLException

View File

@@ -66,6 +66,7 @@ public class StatisticsLoader
/** /**
* Get an array of the dates of the report files. * Get an array of the dates of the report files.
* @return array of dates
*/ */
public static Date[] getMonthlyReportDates() public static Date[] getMonthlyReportDates()
{ {
@@ -74,6 +75,7 @@ public class StatisticsLoader
/** /**
* Get an array of the dates of the analysis files. * Get an array of the dates of the analysis files.
* @return array of dates
*/ */
public static Date[] getMonthlyAnalysisDates() public static Date[] getMonthlyAnalysisDates()
{ {
@@ -82,7 +84,8 @@ public class StatisticsLoader
/** /**
* Convert the formatted dates that are the keys of the map into a date array. * Convert the formatted dates that are the keys of the map into a date array.
* @param monthlyMap * @param monthlyMap map
* @return array of dates
*/ */
protected static Date[] getDatesFromMap(Map<String, StatsFile> monthlyMap) protected static Date[] getDatesFromMap(Map<String, StatsFile> monthlyMap)
{ {
@@ -107,7 +110,7 @@ public class StatisticsLoader
/** /**
* Sort the date array in descending (reverse chronological) order. * Sort the date array in descending (reverse chronological) order.
* @param dates * @param dates array of dates
* @return sorted dates. * @return sorted dates.
*/ */
protected static Date[] sortDatesDescending(Date[] dates) protected static Date[] sortDatesDescending(Date[] dates)
@@ -145,7 +148,8 @@ public class StatisticsLoader
/** /**
* Get the analysis file for a given date. * Get the analysis file for a given date.
* @param date * @param date date
* @return File
*/ */
public static File getAnalysisFor(String date) public static File getAnalysisFor(String date)
{ {
@@ -156,7 +160,8 @@ public class StatisticsLoader
/** /**
* Get the report file for a given date. * Get the report file for a given date.
* @param date * @param date date
* @return File
*/ */
public static File getReportFor(String date) public static File getReportFor(String date)
{ {
@@ -167,6 +172,7 @@ public class StatisticsLoader
/** /**
* Get the current general analysis file. * Get the current general analysis file.
* @return File
*/ */
public static File getGeneralAnalysis() public static File getGeneralAnalysis()
{ {
@@ -176,6 +182,7 @@ public class StatisticsLoader
/** /**
* Get the current general report file. * Get the current general report file.
* @return File
*/ */
public static File getGeneralReport() public static File getGeneralReport()
{ {
@@ -213,7 +220,7 @@ public class StatisticsLoader
/** /**
* Generate the cached file list from the array of files * Generate the cached file list from the array of files
* @param fileList * @param fileList array of files
*/ */
private static synchronized void loadFileList(File[] fileList) private static synchronized void loadFileList(File[] fileList)
{ {
@@ -305,9 +312,10 @@ public class StatisticsLoader
* formatters are used to identify the file as a particular type, * formatters are used to identify the file as a particular type,
* and extract the relevant information. If the file is not identified * and extract the relevant information. If the file is not identified
* by the formatter provided, then we return null. * by the formatter provided, then we return null.
* @param thisFile * @param thisFile file
* @param thisPattern * @param thisPattern patter
* @param sdf * @param sdf date format
* @return StatsFile
*/ */
private static StatsFile makeStatsFile(File thisFile, Pattern thisPattern, DateFormat sdf) private static StatsFile makeStatsFile(File thisFile, Pattern thisPattern, DateFormat sdf)
{ {
@@ -336,10 +344,11 @@ public class StatisticsLoader
/** /**
* Get an array of all the analysis and report files. * Get an array of all the analysis and report files.
* @return array of files
*/ */
private static File[] getAnalysisAndReportFileList() private static File[] getAnalysisAndReportFileList()
{ {
File reportDir = new File(ConfigurationManager.getProperty("log.dir")); File reportDir = new File(ConfigurationManager.getProperty("log.report.dir"));
if (reportDir != null) if (reportDir != null)
{ {
return reportDir.listFiles(new AnalysisAndReportFilter()); return reportDir.listFiles(new AnalysisAndReportFilter());

View File

@@ -43,10 +43,10 @@ public class AuthorizeUtil
* the DSpace Context Object * the DSpace Context Object
* @param bitstream * @param bitstream
* the bitstream that the policy refer to * the bitstream that the policy refer to
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* if the current context (current user) is not allowed to * if the current context (current user) is not allowed to
* manage the bitstream's policies * manage the bitstream's policies
* @throws SQLException * @throws SQLException if database error
* if a db error occur * if a db error occur
*/ */
public static void authorizeManageBitstreamPolicy(Context context, public static void authorizeManageBitstreamPolicy(Context context,
@@ -64,10 +64,10 @@ public class AuthorizeUtil
* the DSpace Context Object * the DSpace Context Object
* @param bundle * @param bundle
* the bundle that the policy refer to * the bundle that the policy refer to
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* if the current context (current user) is not allowed to * if the current context (current user) is not allowed to
* manage the bundle's policies * manage the bundle's policies
* @throws SQLException * @throws SQLException if database error
* if a db error occur * if a db error occur
*/ */
public static void authorizeManageBundlePolicy(Context context, public static void authorizeManageBundlePolicy(Context context,
@@ -85,10 +85,10 @@ public class AuthorizeUtil
* the DSpace Context Object * the DSpace Context Object
* @param item * @param item
* the item that the policy refer to * the item that the policy refer to
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* if the current context (current user) is not allowed to * if the current context (current user) is not allowed to
* manage the item's policies * manage the item's policies
* @throws SQLException * @throws SQLException if database error
* if a db error occur * if a db error occur
*/ */
public static void authorizeManageItemPolicy(Context context, Item item) public static void authorizeManageItemPolicy(Context context, Item item)
@@ -124,10 +124,10 @@ public class AuthorizeUtil
* the DSpace Context Object * the DSpace Context Object
* @param collection * @param collection
* the collection that the policy refer to * the collection that the policy refer to
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* if the current context (current user) is not allowed to * if the current context (current user) is not allowed to
* manage the collection's policies * manage the collection's policies
* @throws SQLException * @throws SQLException if database error
* if a db error occur * if a db error occur
*/ */
public static void authorizeManageCollectionPolicy(Context context, public static void authorizeManageCollectionPolicy(Context context,
@@ -159,10 +159,10 @@ public class AuthorizeUtil
* the DSpace Context Object * the DSpace Context Object
* @param community * @param community
* the community that the policy refer to * the community that the policy refer to
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* if the current context (current user) is not allowed to * if the current context (current user) is not allowed to
* manage the community's policies * manage the community's policies
* @throws SQLException * @throws SQLException if database error
* if a db error occur * if a db error occur
*/ */
public static void authorizeManageCommunityPolicy(Context context, public static void authorizeManageCommunityPolicy(Context context,
@@ -185,9 +185,9 @@ public class AuthorizeUtil
* *
* @param context * @param context
* the DSpace Context Object * the DSpace Context Object
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* if the current user is not a System Admin * if the current user is not a System Admin
* @throws SQLException * @throws SQLException if database error
* if a db error occur * if a db error occur
*/ */
public static void requireAdminRole(Context context) public static void requireAdminRole(Context context)
@@ -208,10 +208,10 @@ public class AuthorizeUtil
* the DSpace Context Object * the DSpace Context Object
* @param item * @param item
* the item that the CC License refer to * the item that the CC License refer to
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* if the current user is not allowed to * if the current user is not allowed to
* manage the item's CC License * manage the item's CC License
* @throws SQLException * @throws SQLException if database error
* if a db error occur * if a db error occur
*/ */
public static void authorizeManageCCLicense(Context context, Item item) public static void authorizeManageCCLicense(Context context, Item item)
@@ -254,10 +254,10 @@ public class AuthorizeUtil
* the DSpace Context Object * the DSpace Context Object
* @param collection * @param collection
* the collection * the collection
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* if the current user is not allowed to manage the collection's * if the current user is not allowed to manage the collection's
* template item * template item
* @throws SQLException * @throws SQLException if database error
* if a db error occur * if a db error occur
*/ */
public static void authorizeManageTemplateItem(Context context, public static void authorizeManageTemplateItem(Context context,
@@ -296,10 +296,10 @@ public class AuthorizeUtil
* the DSpace Context Object * the DSpace Context Object
* @param collection * @param collection
* the collection * the collection
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* if the current user is not allowed to manage the collection's * if the current user is not allowed to manage the collection's
* submitters group * submitters group
* @throws SQLException * @throws SQLException if database error
* if a db error occur * if a db error occur
*/ */
public static void authorizeManageSubmittersGroup(Context context, public static void authorizeManageSubmittersGroup(Context context,
@@ -331,10 +331,10 @@ public class AuthorizeUtil
* the DSpace Context Object * the DSpace Context Object
* @param collection * @param collection
* the collection * the collection
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* if the current user is not allowed to manage the collection's * if the current user is not allowed to manage the collection's
* workflow groups * workflow groups
* @throws SQLException * @throws SQLException if database error
* if a db error occur * if a db error occur
*/ */
public static void authorizeManageWorkflowsGroup(Context context, public static void authorizeManageWorkflowsGroup(Context context,
@@ -368,10 +368,10 @@ public class AuthorizeUtil
* the DSpace Context Object * the DSpace Context Object
* @param collection * @param collection
* the collection * the collection
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* if the current user is not allowed to create/edit the * if the current user is not allowed to create/edit the
* collection's admins group * collection's admins group
* @throws SQLException * @throws SQLException if database error
* if a db error occur * if a db error occur
*/ */
public static void authorizeManageAdminGroup(Context context, public static void authorizeManageAdminGroup(Context context,
@@ -405,10 +405,10 @@ public class AuthorizeUtil
* the DSpace Context Object * the DSpace Context Object
* @param collection * @param collection
* the collection * the collection
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* if the current user is not allowed to remove the * if the current user is not allowed to remove the
* collection's admins group * collection's admins group
* @throws SQLException * @throws SQLException if database error
* if a db error occur * if a db error occur
*/ */
public static void authorizeRemoveAdminGroup(Context context, public static void authorizeRemoveAdminGroup(Context context,
@@ -439,10 +439,10 @@ public class AuthorizeUtil
* the DSpace Context Object * the DSpace Context Object
* @param community * @param community
* the community * the community
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* if the current user is not allowed to create/edit the * if the current user is not allowed to create/edit the
* community's admins group * community's admins group
* @throws SQLException * @throws SQLException if database error
* if a db error occur * if a db error occur
*/ */
public static void authorizeManageAdminGroup(Context context, public static void authorizeManageAdminGroup(Context context,
@@ -470,10 +470,10 @@ public class AuthorizeUtil
* the DSpace Context Object * the DSpace Context Object
* @param community * @param community
* the community * the community
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* if the current user is not allowed to remove the * if the current user is not allowed to remove the
* collection's admins group * collection's admins group
* @throws SQLException * @throws SQLException if database error
* if a db error occur * if a db error occur
*/ */
public static void authorizeRemoveAdminGroup(Context context, public static void authorizeRemoveAdminGroup(Context context,
@@ -505,10 +505,10 @@ public class AuthorizeUtil
* the DSpace Context Object * the DSpace Context Object
* @param rp * @param rp
* a resource policy * a resource policy
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* if the current context (current user) is not allowed to * if the current context (current user) is not allowed to
* remove/edit the policy * remove/edit the policy
* @throws SQLException * @throws SQLException if database error
* if a db error occur * if a db error occur
*/ */
public static void authorizeManagePolicy(Context c, ResourcePolicy rp) public static void authorizeManagePolicy(Context c, ResourcePolicy rp)
@@ -546,9 +546,9 @@ public class AuthorizeUtil
* the DSpace Context Object * the DSpace Context Object
* @param item * @param item
* the item * the item
* @throws SQLException * @throws SQLException if database error
* if a db error occur * if a db error occur
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* if the current user is not allowed to perform the item * if the current user is not allowed to perform the item
* withdraw * withdraw
*/ */
@@ -589,9 +589,9 @@ public class AuthorizeUtil
* the DSpace Context Object * the DSpace Context Object
* @param item * @param item
* the item * the item
* @throws SQLException * @throws SQLException if database error
* if a db error occur * if a db error occur
* @throws AuthorizeException * @throws AuthorizeException if authorization error
* if the current user is not allowed to perform the item * if the current user is not allowed to perform the item
* reinstatement * reinstatement
*/ */

View File

@@ -27,6 +27,7 @@ public class CollectionDropDown {
* @param col * @param col
* Get full path for this collection * Get full path for this collection
* @return Full path to the collection * @return Full path to the collection
* @throws SQLException if database error
*/ */
public static String collectionPath(Collection col) throws SQLException public static String collectionPath(Collection col) throws SQLException
{ {
@@ -42,6 +43,7 @@ public class CollectionDropDown {
* @param maxchars * @param maxchars
* Truncate the full path to maxchar characters. 0 means do not truncate. * Truncate the full path to maxchar characters. 0 means do not truncate.
* @return Full path to the collection (truncated) * @return Full path to the collection (truncated)
* @throws SQLException if database error
*/ */
public static String collectionPath(Collection col, int maxchars) throws SQLException public static String collectionPath(Collection col, int maxchars) throws SQLException
{ {

View File

@@ -415,12 +415,12 @@ public class DCInput
* The closed attribute of the vocabulary tag for this field as set in * The closed attribute of the vocabulary tag for this field as set in
* input-forms.xml * input-forms.xml
* *
* <code> * {@code
* <field> * <field>
* ..... * .....
* <vocabulary closed="true">nsrc</vocabulary> * <vocabulary closed="true">nsrc</vocabulary>
* </field> * </field>
* </code> * }
* @return the closedVocabulary flags: true if the entry should be restricted * @return the closedVocabulary flags: true if the entry should be restricted
* only to vocabulary terms, false otherwise * only to vocabulary terms, false otherwise
*/ */

View File

@@ -25,7 +25,11 @@ public class DCInputSet
/** the inputs ordered by page and row position */ /** the inputs ordered by page and row position */
private DCInput[][] inputPages = null; private DCInput[][] inputPages = null;
/** constructor */ /** constructor
* @param formName form name
* @param pages pages
* @param listMap map
*/
public DCInputSet(String formName, List<List<Map<String, String>>> pages, Map<String, List<String>> listMap) public DCInputSet(String formName, List<List<Map<String, String>>> pages, Map<String, List<String>> listMap)
{ {
this.formName = formName; this.formName = formName;
@@ -116,6 +120,7 @@ public class DCInputSet
* Does the current input set define the named field? * Does the current input set define the named field?
* Scan through every field in every page of the input set * Scan through every field in every page of the input set
* *
* @param fieldName
* @return true if the current set has the named field * @return true if the current set has the named field
*/ */
public boolean isFieldPresent(String fieldName) public boolean isFieldPresent(String fieldName)
@@ -141,6 +146,8 @@ public class DCInputSet
* and is valid for the specified document type * and is valid for the specified document type
* Scan through every field in every page of the input set * Scan through every field in every page of the input set
* *
* @param fieldName field name
* @param documentType doc type
* @return true if the current set has the named field * @return true if the current set has the named field
*/ */
public boolean isFieldPresent(String fieldName, String documentType) public boolean isFieldPresent(String fieldName, String documentType)

View File

@@ -82,6 +82,7 @@ public class DCInputsReader
* level structures: a map between collections and forms, the definition for * level structures: a map between collections and forms, the definition for
* each page of each form, and lists of pairs of values that populate * each page of each form, and lists of pairs of values that populate
* selection boxes. * selection boxes.
* @throws DCInputsReaderException if input reader error
*/ */
public DCInputsReader() public DCInputsReader()

View File

@@ -15,15 +15,27 @@ package org.dspace.app.util;
*/ */
public interface DSpaceWebappMXBean public interface DSpaceWebappMXBean
{ {
/** Is this webapp a user interface? False if machine interface such as SWORD. */ /**
* Is this webapp a user interface? False if machine interface such as SWORD.
* @return true/false
*/
public boolean isUI(); public boolean isUI();
/** What kind of webapp? XMLUI, OAI, etc. */ /**
* What kind of webapp? XMLUI, OAI, etc.
* @return kind of webapp
*/
public String getKind(); public String getKind();
/** What is the base URL of this application? */ /**
* What is the base URL of this application?
* @return base url
*/
public String getURL(); public String getURL();
/** When did this application start? */ /**
* When did this application start?
* @return start time
*/
public String getStarted(); public String getStarted();
} }

View File

@@ -235,7 +235,7 @@ public class DailyFileAppender extends FileAppender
/** /**
* This function is responsible for performing the actual file rollover. * This function is responsible for performing the actual file rollover.
* @param pstrName The name of the new folder based on current system date. * @param pstrName The name of the new folder based on current system date.
* @throws IOException * @throws IOException if IO error
*/ */
private static boolean deletingFiles = false; private static boolean deletingFiles = false;
private void cleanupOldFiles() private void cleanupOldFiles()

View File

@@ -31,10 +31,8 @@ import java.io.File;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set;
import org.dspace.core.Constants; import org.dspace.core.Constants;
import org.dspace.core.Context; import org.dspace.core.Context;
@@ -212,8 +210,9 @@ public class GoogleMetadata
* Wrap the item, parse all configured fields and generate metadata field * Wrap the item, parse all configured fields and generate metadata field
* values. * values.
* *
* @param item * @param context context
* - The item being viewed to extract metadata from * @param item The item being viewed to extract metadata from
* @throws SQLException if database error
*/ */
public GoogleMetadata(Context context, Item item) throws SQLException public GoogleMetadata(Context context, Item item) throws SQLException
{ {
@@ -330,7 +329,7 @@ public class GoogleMetadata
* *
* @param configFilter * @param configFilter
* @param returnType * @param returnType
* @return Array of configuration -> item-field matches * @return Array of configuration to item-field matches
*/ */
protected ArrayList<MetadataValue> resolveMetadata(String configFilter, protected ArrayList<MetadataValue> resolveMetadata(String configFilter,
int returnType) int returnType)
@@ -658,7 +657,7 @@ public class GoogleMetadata
/** /**
* Using metadata field mappings contained in the loaded configuration, * Using metadata field mappings contained in the loaded configuration,
* parse through configured metadata fields, building valid Google metadata * parse through configured metadata fields, building valid Google metadata
* value strings. Field names & values contained in metadataMappings. * value strings. Field names and values contained in metadataMappings.
* *
*/ */
protected void parseItem() protected void parseItem()
@@ -769,8 +768,8 @@ public class GoogleMetadata
* Fetch retaining the order of the values for any given key in which they * Fetch retaining the order of the values for any given key in which they
* where added (like authors). * where added (like authors).
* *
* Usage: GoogleMetadata gmd = new GoogleMetadata(item); for(Entry<String, * Usage: {@code GoogleMetadata gmd = new GoogleMetadata(item); for(Entry<String,
* String> mapping : googlemd.getMappings()) { ... } * String> mapping : googlemd.getMappings()) ...}
* *
* @return Iterable of metadata fields mapped to Google-formatted values * @return Iterable of metadata fields mapped to Google-formatted values
*/ */
@@ -781,6 +780,7 @@ public class GoogleMetadata
/** /**
* Produce meta elements that can easily be put into the head. * Produce meta elements that can easily be put into the head.
* @return List of elements
*/ */
public List<Element> disseminateList() public List<Element> disseminateList()
{ {
@@ -1047,7 +1047,7 @@ public class GoogleMetadata
* Additionally, this bitstream must be publicly viewable. * Additionally, this bitstream must be publicly viewable.
* @param item * @param item
* @return * @return
* @throws SQLException * @throws SQLException if database error
*/ */
protected Bitstream findLinkableFulltext(Item item) throws SQLException { protected Bitstream findLinkableFulltext(Item item) throws SQLException {
Bitstream bestSoFar = null; Bitstream bestSoFar = null;
@@ -1089,9 +1089,9 @@ public class GoogleMetadata
/** /**
* *
* *
* @param FIELD * @param field
* to aggregate all values of in a matching option * to aggregate all values of in a matching option
* @param delim * @param delimiter
* to delimit field values with * to delimit field values with
*/ */
protected void addAggregateValues(String field, String delimiter) protected void addAggregateValues(String field, String delimiter)

View File

@@ -21,10 +21,10 @@ import org.apache.lucene.util.Version;
* so that they can be upgraded to the latest version. * so that they can be upgraded to the latest version.
* <p> * <p>
* You must pass it the full path of the index directory, e.g. * You must pass it the full path of the index directory, e.g.
* [dspace]/solr/statistics/data/index/ * {@code [dspace]/solr/statistics/data/index/}
* <p> * <p>
* The response is simply a version number (e.g. 4.4), as this is utilized by * The response is simply a version number (e.g. 4.4), as this is utilized by
* the "ant update_solr_indexes" target in [src]/dspace/src/main/config/build.xml * the {@code ant update_solr_indexes} target in {@code [src]/dspace/src/main/config/build.xml}
* *
* @author tdonohue * @author tdonohue
*/ */
@@ -106,7 +106,7 @@ public class IndexVersion
* Full path of the Solr/Lucene index directory * Full path of the Solr/Lucene index directory
* @return version as a string (e.g. "4.4"), empty string ("") if index directory is empty, * @return version as a string (e.g. "4.4"), empty string ("") if index directory is empty,
* or null if directory doesn't exist. * or null if directory doesn't exist.
* @throws IOException * @throws IOException if IO error
*/ */
public static String getIndexVersion(String indexDirPath) public static String getIndexVersion(String indexDirPath)
throws IOException throws IOException
@@ -218,14 +218,14 @@ public class IndexVersion
* <P> * <P>
* NOTE: In case it is not obvious, software version numbering does NOT * NOTE: In case it is not obvious, software version numbering does NOT
* behave like normal decimal numbers. For example, in software versions * behave like normal decimal numbers. For example, in software versions
* the following statement is TRUE: 4.1 < 4.4 < 4.5 < 4.10 < 4.21 < 4.51 * the following statement is TRUE: {@code 4.1 < 4.4 < 4.5 < 4.10 < 4.21 < 4.51}
* *
* @param firstVersion * @param firstVersion
* First version to compare, as a String * First version to compare, as a String
* @param secondVersion * @param secondVersion
* Second version to compare as a String * Second version to compare as a String
* @return -1 if first < second, 1 if first > second, 0 if equal * @return -1 if first less than second, 1 if first greater than second, 0 if equal
* @throws IOException * @throws IOException if IO error
*/ */
public static int compareSoftwareVersions(String firstVersion, String secondVersion) public static int compareSoftwareVersions(String firstVersion, String secondVersion)
throws IOException throws IOException

View File

@@ -127,7 +127,7 @@ public class OpenSearchServiceImpl implements OpenSearchService, InitializingBea
@Override @Override
public String getResultsString(Context context, String format, String query, int totalResults, int start, int pageSize, public String getResultsString(Context context, String format, String query, int totalResults, int start, int pageSize,
DSpaceObject scope, DSpaceObject[] results, DSpaceObject scope, List<DSpaceObject> results,
Map<String, String> labels) throws IOException Map<String, String> labels) throws IOException
{ {
try try
@@ -143,7 +143,7 @@ public class OpenSearchServiceImpl implements OpenSearchService, InitializingBea
@Override @Override
public Document getResultsDoc(Context context, String format, String query, int totalResults, int start, int pageSize, public Document getResultsDoc(Context context, String format, String query, int totalResults, int start, int pageSize,
DSpaceObject scope, DSpaceObject[] results, Map<String, String> labels) DSpaceObject scope, List<DSpaceObject> results, Map<String, String> labels)
throws IOException throws IOException
{ {
try try
@@ -158,7 +158,7 @@ public class OpenSearchServiceImpl implements OpenSearchService, InitializingBea
} }
protected SyndicationFeed getResults(Context context, String format, String query, int totalResults, int start, int pageSize, protected SyndicationFeed getResults(Context context, String format, String query, int totalResults, int start, int pageSize,
DSpaceObject scope, DSpaceObject[] results, Map<String, String> labels) DSpaceObject scope, List<DSpaceObject> results, Map<String, String> labels)
{ {
// Encode results in requested format // Encode results in requested format
if ("rss".equals(format)) if ("rss".equals(format))
@@ -283,7 +283,7 @@ public class OpenSearchServiceImpl implements OpenSearchService, InitializingBea
* Converts a JDOM document to a W3C one * Converts a JDOM document to a W3C one
* @param jdomDoc * @param jdomDoc
* @return W3C Document object * @return W3C Document object
* @throws IOException * @throws IOException if IO error
*/ */
protected Document jDomToW3(org.jdom.Document jdomDoc) throws IOException protected Document jDomToW3(org.jdom.Document jdomDoc) throws IOException
{ {

View File

@@ -88,6 +88,7 @@ public class SubmissionConfigReader
/** /**
* Load Submission Configuration from the * Load Submission Configuration from the
* item-submission.xml configuration file * item-submission.xml configuration file
* @throws ServletException if servlet error
*/ */
public SubmissionConfigReader() throws ServletException public SubmissionConfigReader() throws ServletException
{ {
@@ -206,7 +207,7 @@ public class SubmissionConfigReader
/** /**
* Returns a particular global step definition based on its ID. * Returns a particular global step definition based on its ID.
* <P> * <P>
* Global step definitions are those defined in the <step-definitions> * Global step definitions are those defined in the {@code <step-definitions>}
* section of the configuration file. * section of the configuration file.
* *
* @param stepID * @param stepID

View File

@@ -213,7 +213,7 @@ public class SubmissionInfo extends HashMap
/** /**
* Returns a particular global step definition based on its ID. * Returns a particular global step definition based on its ID.
* <P> * <P>
* Global step definitions are those defined in the <step-definitions> * Global step definitions are those defined in the {@code <step-definitions>}
* section of the configuration file. * section of the configuration file.
* *
* @param stepID * @param stepID

View File

@@ -100,8 +100,8 @@ public class SubmissionStepConfig implements Serializable
/** /**
* Get the ID for this step. An ID is only defined if the step exists in the * Get the ID for this step. An ID is only defined if the step exists in the
* <step-definitions> section. This ID field is used to reference special * {@code <step-definitions>} section. This ID field is used to reference special
* steps (like the required step with id="collection") * steps (like the required step with {@code id="collection"})
* *
* @return the step ID * @return the step ID
*/ */

View File

@@ -165,9 +165,14 @@ public class SyndicationFeed
/** /**
* Fills in the feed and entry-level metadata from DSpace objects. * Fills in the feed and entry-level metadata from DSpace objects.
* @param request request
* @param context context
* @param dso DSpaceObject
* @param items array of objects
* @param labels label map
*/ */
public void populate(HttpServletRequest request, Context context, DSpaceObject dso, public void populate(HttpServletRequest request, Context context, DSpaceObject dso,
DSpaceObject items[], Map<String, String> labels) List<?extends DSpaceObject> items, Map<String, String> labels)
{ {
String logoURL = null; String logoURL = null;
String objectURL = null; String objectURL = null;
@@ -450,6 +455,7 @@ public class SyndicationFeed
* Sets the feed type for XML delivery, e.g. "rss_1.0", "atom_1.0" * Sets the feed type for XML delivery, e.g. "rss_1.0", "atom_1.0"
* Must match one of ROME's configured generators, see rome.properties * Must match one of ROME's configured generators, see rome.properties
* (currently rss_1.0, rss_2.0, atom_1.0, atom_0.3) * (currently rss_1.0, rss_2.0, atom_1.0, atom_0.3)
* @param feedType feed type
*/ */
public void setType(String feedType) public void setType(String feedType)
{ {
@@ -463,6 +469,7 @@ public class SyndicationFeed
/** /**
* @return the feed we built as DOM Document * @return the feed we built as DOM Document
* @throws FeedException if feed error
*/ */
public Document outputW3CDom() public Document outputW3CDom()
throws FeedException throws FeedException
@@ -481,6 +488,7 @@ public class SyndicationFeed
/** /**
* @return the feed we built as serialized XML string * @return the feed we built as serialized XML string
* @throws FeedException if feed error
*/ */
public String outputString() public String outputString()
throws FeedException throws FeedException
@@ -491,6 +499,9 @@ public class SyndicationFeed
/** /**
* send the output to designated Writer * send the output to designated Writer
* @param writer Writer
* @throws FeedException if feed error
* @throws IOException if IO error
*/ */
public void output(java.io.Writer writer) public void output(java.io.Writer writer)
throws FeedException, IOException throws FeedException, IOException
@@ -501,6 +512,7 @@ public class SyndicationFeed
/** /**
* Add a ROME plugin module (e.g. for OpenSearch) at the feed level. * Add a ROME plugin module (e.g. for OpenSearch) at the feed level.
* @param m module
*/ */
public void addModule(Module m) public void addModule(Module m)
{ {
@@ -523,17 +535,17 @@ public class SyndicationFeed
logo.getID()+"/"+(name == null?"":name); logo.getID()+"/"+(name == null?"":name);
} }
protected String baseURL = null; // cache the result for null
/** /**
* Return a url to the DSpace object, either use the official * Return a url to the DSpace object, either use the official
* handle for the item or build a url based upon the current server. * handle for the item or build a url based upon the current server.
* *
* If the dspaceobject is null then a local url to the repository is generated. * If the dspaceobject is null then a local url to the repository is generated.
* *
* @param request current servlet request
* @param dso The object to reference, null if to the repository. * @param dso The object to reference, null if to the repository.
* @return * @return URL
*/ */
protected String baseURL = null; // cache the result for null
protected String resolveURL(HttpServletRequest request, DSpaceObject dso) protected String resolveURL(HttpServletRequest request, DSpaceObject dso)
{ {
// If no object given then just link to the whole repository, // If no object given then just link to the whole repository,

View File

@@ -89,6 +89,7 @@ public class Util {
* @param encoding * @param encoding
* character encoding, e.g. UTF-8 * character encoding, e.g. UTF-8
* @return the encoded string * @return the encoded string
* @throws java.io.UnsupportedEncodingException if encoding error
*/ */
public static String encodeBitstreamName(String stringIn, String encoding) throws java.io.UnsupportedEncodingException { public static String encodeBitstreamName(String stringIn, String encoding) throws java.io.UnsupportedEncodingException {
// FIXME: This should be moved elsewhere, as it is used outside the UI // FIXME: This should be moved elsewhere, as it is used outside the UI
@@ -164,6 +165,7 @@ public class Util {
* @param stringIn * @param stringIn
* input string to encode * input string to encode
* @return the encoded string * @return the encoded string
* @throws java.io.UnsupportedEncodingException if encoding error
*/ */
public static String encodeBitstreamName(String stringIn) throws java.io.UnsupportedEncodingException { public static String encodeBitstreamName(String stringIn) throws java.io.UnsupportedEncodingException {
return encodeBitstreamName(stringIn, Constants.DEFAULT_ENCODING); return encodeBitstreamName(stringIn, Constants.DEFAULT_ENCODING);
@@ -455,7 +457,10 @@ public class Util {
* A String with the element name of the metadata field * A String with the element name of the metadata field
* @param qualifier * @param qualifier
* A String with the qualifier name of the metadata field * A String with the qualifier name of the metadata field
* @param locale locale
* @return A list of the respective "displayed-values" * @return A list of the respective "displayed-values"
* @throws SQLException if database error
* @throws DCInputsReaderException if reader error
*/ */
public static List<String> getControlledVocabulariesDisplayValueLocalized( public static List<String> getControlledVocabulariesDisplayValueLocalized(

View File

@@ -8,6 +8,7 @@
package org.dspace.app.util; package org.dspace.app.util;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.ReloadableEntity;
import javax.persistence.*; import javax.persistence.*;
import java.util.Date; import java.util.Date;
@@ -19,7 +20,7 @@ import java.util.Date;
*/ */
@Entity @Entity
@Table(name="webapp") @Table(name="webapp")
public class WebApp { public class WebApp implements ReloadableEntity<Integer> {
@Id @Id
@@ -50,7 +51,7 @@ public class WebApp {
} }
public Integer getId() { public Integer getID() {
return id; return id;
} }

View File

@@ -25,9 +25,9 @@ public class XMLUtils
{ {
/** /**
* *
* @param rootElement * @param dataRoot
* the starting node * the starting node
* @param subElementName * @param name
* the name of the subelement to find * the name of the subelement to find
* @return the list of all DOM Element with the provided name direct child * @return the list of all DOM Element with the provided name direct child
* of the starting node * of the starting node

View File

@@ -13,7 +13,7 @@ import org.dspace.core.GenericDAO;
/** /**
* Database Access Object interface class for the WebApp object. * Database Access Object interface class for the WebApp object.
* The implementation of this class is responsible for all database calls for the WebApp object and is autowired by spring * The implementation of this class is responsible for all database calls for the WebApp object and is autowired by spring
* This class should only be accessed from a single service & should never be exposed outside of the API * This class should only be accessed from a single service and should never be exposed outside of the API
* *
* @author kevinvandevelde at atmire.com * @author kevinvandevelde at atmire.com
*/ */

View File

@@ -58,7 +58,7 @@ public interface MetadataExposureService {
* @param qualifier metadata field qualifier * @param qualifier metadata field qualifier
* *
* @return true (hidden) or false (exposed) * @return true (hidden) or false (exposed)
* @throws java.sql.SQLException * @throws SQLException if database error
*/ */
public boolean isHidden(Context context, String schema, String element, String qualifier) public boolean isHidden(Context context, String schema, String element, String qualifier)
throws SQLException; throws SQLException;

View File

@@ -55,7 +55,7 @@ public interface OpenSearchService {
* *
* @param scope - null for entire repository, or handle or community or collection * @param scope - null for entire repository, or handle or community or collection
* @return document the service document * @return document the service document
* @throws java.io.IOException * @throws IOException if IO error
*/ */
public Document getDescriptionDoc(String scope) throws IOException; public Document getDescriptionDoc(String scope) throws IOException;
@@ -71,6 +71,7 @@ public interface OpenSearchService {
/** /**
* Returns a formatted set of search results as a string * Returns a formatted set of search results as a string
* *
* @param context DSpace Context
* @param format results format - html, rss or atom * @param format results format - html, rss or atom
* @param query - the search query * @param query - the search query
* @param totalResults - the hit count * @param totalResults - the hit count
@@ -80,14 +81,15 @@ public interface OpenSearchService {
* @param results the retreived DSpace objects satisfying search * @param results the retreived DSpace objects satisfying search
* @param labels labels to apply - format specific * @param labels labels to apply - format specific
* @return formatted search results * @return formatted search results
* @throws java.io.IOException * @throws IOException if IO error
*/ */
public String getResultsString(Context context, String format, String query, int totalResults, int start, int pageSize, public String getResultsString(Context context, String format, String query, int totalResults, int start, int pageSize,
DSpaceObject scope, DSpaceObject[] results, DSpaceObject scope, List<DSpaceObject> results,
Map<String, String> labels) throws IOException; Map<String, String> labels) throws IOException;
/** /**
* Returns a formatted set of search results as a document * Returns a formatted set of search results as a document
* *
* @param context DSpace Context
* @param format results format - html, rss or atom * @param format results format - html, rss or atom
* @param query - the search query * @param query - the search query
* @param totalResults - the hit count * @param totalResults - the hit count
@@ -97,10 +99,10 @@ public interface OpenSearchService {
* @param results the retreived DSpace objects satisfying search * @param results the retreived DSpace objects satisfying search
* @param labels labels to apply - format specific * @param labels labels to apply - format specific
* @return formatted search results * @return formatted search results
* @throws IOException * @throws IOException if IO error
*/ */
public Document getResultsDoc(Context context, String format, String query, int totalResults, int start, int pageSize, public Document getResultsDoc(Context context, String format, String query, int totalResults, int start, int pageSize,
DSpaceObject scope, DSpaceObject[] results, Map<String, String> labels) DSpaceObject scope, List<DSpaceObject> results, Map<String, String> labels)
throws IOException; throws IOException;
public DSpaceObject resolveScope(Context context, String scope) throws SQLException; public DSpaceObject resolveScope(Context context, String scope) throws SQLException;

View File

@@ -74,6 +74,7 @@ public interface AuthenticationMethod {
* @param username * @param username
* Username, if available. May be null. * Username, if available. May be null.
* @return true if new ePerson should be created. * @return true if new ePerson should be created.
* @throws SQLException if database error
*/ */
public boolean canSelfRegister(Context context, public boolean canSelfRegister(Context context,
HttpServletRequest request, HttpServletRequest request,
@@ -92,6 +93,7 @@ public interface AuthenticationMethod {
* @param eperson * @param eperson
* newly created EPerson record - email + information from the * newly created EPerson record - email + information from the
* registration form will have been filled out. * registration form will have been filled out.
* @throws SQLException if database error
*/ */
public void initEPerson(Context context, public void initEPerson(Context context,
HttpServletRequest request, HttpServletRequest request,
@@ -111,6 +113,7 @@ public interface AuthenticationMethod {
* @param username * @param username
* Username, if available. May be null. * Username, if available. May be null.
* @return true if this method allows user to change ePerson password. * @return true if this method allows user to change ePerson password.
* @throws SQLException if database error
*/ */
public boolean allowSetPassword(Context context, public boolean allowSetPassword(Context context,
HttpServletRequest request, HttpServletRequest request,
@@ -149,6 +152,7 @@ public interface AuthenticationMethod {
* *
* @return array of EPerson-group IDs, possibly 0-length, but never * @return array of EPerson-group IDs, possibly 0-length, but never
* <code>null</code>. * <code>null</code>.
* @throws SQLException if database error
*/ */
public List<Group> getSpecialGroups(Context context, HttpServletRequest request) public List<Group> getSpecialGroups(Context context, HttpServletRequest request)
throws SQLException; throws SQLException;
@@ -185,6 +189,7 @@ public interface AuthenticationMethod {
* <br>CERT_REQUIRED - not allowed to login this way without X.509 cert. * <br>CERT_REQUIRED - not allowed to login this way without X.509 cert.
* <br>NO_SUCH_USER - user not found using this method. * <br>NO_SUCH_USER - user not found using this method.
* <br>BAD_ARGS - user/pw not appropriate for this method * <br>BAD_ARGS - user/pw not appropriate for this method
* @throws SQLException if database error
*/ */
public int authenticate(Context context, public int authenticate(Context context,

View File

@@ -69,6 +69,7 @@ public class LDAPAuthentication
/** /**
* Let a real auth method return true if it wants. * Let a real auth method return true if it wants.
* @throws SQLException if database error
*/ */
@Override @Override
public boolean canSelfRegister(Context context, public boolean canSelfRegister(Context context,
@@ -81,7 +82,8 @@ public class LDAPAuthentication
} }
/** /**
* Nothing here, initialization is done when auto-registering. * Nothing here, initialization is done when auto-registering.
* @throws SQLException if database error
*/ */
@Override @Override
public void initEPerson(Context context, HttpServletRequest request, public void initEPerson(Context context, HttpServletRequest request,
@@ -94,6 +96,7 @@ public class LDAPAuthentication
/** /**
* Cannot change LDAP password through dspace, right? * Cannot change LDAP password through dspace, right?
* @throws SQLException if database error
*/ */
@Override @Override
public boolean allowSetPassword(Context context, public boolean allowSetPassword(Context context,

View File

@@ -59,6 +59,8 @@ public class PasswordAuthentication
* <p> * <p>
* Example - aber.ac.uk domain : @aber.ac.uk * Example - aber.ac.uk domain : @aber.ac.uk
* Example - MIT domain and all .ac.uk domains: @mit.edu, .ac.uk * Example - MIT domain and all .ac.uk domains: @mit.edu, .ac.uk
* @param email email
* @throws SQLException if database error
*/ */
@Override @Override
public boolean canSelfRegister(Context context, public boolean canSelfRegister(Context context,
@@ -95,6 +97,7 @@ public class PasswordAuthentication
/** /**
* Nothing extra to initialize. * Nothing extra to initialize.
* @throws SQLException if database error
*/ */
@Override @Override
public void initEPerson(Context context, HttpServletRequest request, public void initEPerson(Context context, HttpServletRequest request,
@@ -105,6 +108,7 @@ public class PasswordAuthentication
/** /**
* We always allow the user to change their password. * We always allow the user to change their password.
* @throws SQLException if database error
*/ */
@Override @Override
public boolean allowSetPassword(Context context, public boolean allowSetPassword(Context context,
@@ -196,6 +200,7 @@ public class PasswordAuthentication
* <br>CERT_REQUIRED - not allowed to login this way without X.509 cert. * <br>CERT_REQUIRED - not allowed to login this way without X.509 cert.
* <br>NO_SUCH_USER - no EPerson with matching email address. * <br>NO_SUCH_USER - no EPerson with matching email address.
* <br>BAD_ARGS - missing username, or user matched but cannot login. * <br>BAD_ARGS - missing username, or user matched but cannot login.
* @throws SQLException if database error
*/ */
@Override @Override
public int authenticate(Context context, public int authenticate(Context context,

View File

@@ -159,6 +159,7 @@ public class ShibAuthentication implements AuthenticationMethod
* <br> * <br>
* NO_SUCH_USER - user not found using this method. <br> * NO_SUCH_USER - user not found using this method. <br>
* BAD_ARGS - user/pw not appropriate for this method * BAD_ARGS - user/pw not appropriate for this method
* @throws SQLException if database error
*/ */
@Override @Override
public int authenticate(Context context, String username, String password, public int authenticate(Context context, String username, String password,
@@ -266,7 +267,7 @@ public class ShibAuthentication implements AuthenticationMethod
* *
* The values extracted (a user may have multiple roles) will be used to look * The values extracted (a user may have multiple roles) will be used to look
* up which groups to place the user into. The groups are defined as * up which groups to place the user into. The groups are defined as
* "authentication.shib.role.<role-name>" which is a comma separated list of * {@code authentication.shib.role.<role-name>} which is a comma separated list of
* DSpace groups. * DSpace groups.
* *
* @param context * @param context
@@ -400,6 +401,7 @@ public class ShibAuthentication implements AuthenticationMethod
* HTTP request, in case anything in that is used to decide * HTTP request, in case anything in that is used to decide
* @param email * @param email
* e-mail address of user attempting to register * e-mail address of user attempting to register
* @throws SQLException if database error
* *
*/ */
@Override @Override
@@ -434,6 +436,7 @@ public class ShibAuthentication implements AuthenticationMethod
* HTTP request, in case anything in that is used to decide * HTTP request, in case anything in that is used to decide
* @param username * @param username
* e-mail address of user attempting to register * e-mail address of user attempting to register
* @throws SQLException if database error
* *
*/ */
@Override @Override
@@ -456,6 +459,7 @@ public class ShibAuthentication implements AuthenticationMethod
* @param eperson * @param eperson
* newly created EPerson record - email + information from the * newly created EPerson record - email + information from the
* registration form will have been filled out. * registration form will have been filled out.
* @throws SQLException if database error
* *
*/ */
@Override @Override
@@ -578,6 +582,8 @@ public class ShibAuthentication implements AuthenticationMethod
* @param context The DSpace database context * @param context The DSpace database context
* @param request The current HTTP Request * @param request The current HTTP Request
* @return The EPerson identified or null. * @return The EPerson identified or null.
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
*/ */
protected EPerson findEPerson(Context context, HttpServletRequest request) throws SQLException, AuthorizeException { protected EPerson findEPerson(Context context, HttpServletRequest request) throws SQLException, AuthorizeException {
@@ -676,6 +682,8 @@ public class ShibAuthentication implements AuthenticationMethod
* @param context The current DSpace database context * @param context The current DSpace database context
* @param request The current HTTP Request * @param request The current HTTP Request
* @return A new eperson object or null if unable to create a new eperson. * @return A new eperson object or null if unable to create a new eperson.
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
*/ */
protected EPerson registerNewEPerson(Context context, HttpServletRequest request) throws SQLException, AuthorizeException { protected EPerson registerNewEPerson(Context context, HttpServletRequest request) throws SQLException, AuthorizeException {
@@ -765,6 +773,8 @@ public class ShibAuthentication implements AuthenticationMethod
* @param context The current DSpace database context * @param context The current DSpace database context
* @param request The current HTTP Request * @param request The current HTTP Request
* @param eperson The eperson object to update. * @param eperson The eperson object to update.
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
*/ */
protected void updateEPerson(Context context, HttpServletRequest request, EPerson eperson) throws SQLException, AuthorizeException { protected void updateEPerson(Context context, HttpServletRequest request, EPerson eperson) throws SQLException, AuthorizeException {
@@ -855,6 +865,7 @@ public class ShibAuthentication implements AuthenticationMethod
* @param password The password * @param password The password
* @param request The HTTP Request * @param request The HTTP Request
* @return A valid DSpace Authentication Method status code. * @return A valid DSpace Authentication Method status code.
* @throws SQLException if database error
*/ */
protected int swordCompatibility(Context context, String username, String password, HttpServletRequest request) throws SQLException { protected int swordCompatibility(Context context, String username, String password, HttpServletRequest request) throws SQLException {
@@ -902,7 +913,8 @@ public class ShibAuthentication implements AuthenticationMethod
* the field will be automatically created. * the field will be automatically created.
* *
* It is safe to call this methods multiple times. * It is safe to call this methods multiple times.
* @param context * @param context context
* @throws SQLException if database error
*/ */
protected synchronized void initialize(Context context) throws SQLException { protected synchronized void initialize(Context context) throws SQLException {
@@ -964,8 +976,9 @@ public class ShibAuthentication implements AuthenticationMethod
* Check if a MetadataField for an eperson is available. * Check if a MetadataField for an eperson is available.
* *
* @param metadataName The name of the metadata field. * @param metadataName The name of the metadata field.
* @param context * @param context context
* @return True if a valid metadata field, otherwise false. * @return True if a valid metadata field, otherwise false.
* @throws SQLException if database error
*/ */
protected synchronized boolean checkIfEpersonMetadataFieldExists(Context context, String metadataName) throws SQLException { protected synchronized boolean checkIfEpersonMetadataFieldExists(Context context, String metadataName) throws SQLException {
@@ -984,10 +997,12 @@ public class ShibAuthentication implements AuthenticationMethod
protected final String COLUMN_NAME_REGEX = "^[_A-Za-z0-9]+$"; protected final String COLUMN_NAME_REGEX = "^[_A-Za-z0-9]+$";
/** /**
* Automattically create a new metadataField for an eperson * Automatically create a new metadataField for an eperson
* *
* @param context context
* @param metadataName The name of the new metadata field. * @param metadataName The name of the new metadata field.
* @return True if successful, otherwise false. * @return True if successful, otherwise false.
* @throws SQLException if database error
*/ */
protected synchronized boolean autoCreateEpersonMetadataField(Context context, String metadataName) throws SQLException { protected synchronized boolean autoCreateEpersonMetadataField(Context context, String metadataName) throws SQLException {

View File

@@ -387,6 +387,7 @@ public class X509Authentication implements AuthenticationMethod
* configuration value. You'll probably want this to be true to take * configuration value. You'll probably want this to be true to take
* advantage of a Web certificate infrastructure with many more users than * advantage of a Web certificate infrastructure with many more users than
* are already known by DSpace. * are already known by DSpace.
* @throws SQLException if database error
*/ */
@Override @Override
public boolean canSelfRegister(Context context, HttpServletRequest request, public boolean canSelfRegister(Context context, HttpServletRequest request,
@@ -398,6 +399,7 @@ public class X509Authentication implements AuthenticationMethod
/** /**
* Nothing extra to initialize. * Nothing extra to initialize.
* @throws SQLException if database error
*/ */
@Override @Override
public void initEPerson(Context context, HttpServletRequest request, public void initEPerson(Context context, HttpServletRequest request,
@@ -407,6 +409,7 @@ public class X509Authentication implements AuthenticationMethod
/** /**
* We don't use EPerson password so there is no reason to change it. * We don't use EPerson password so there is no reason to change it.
* @throws SQLException if database error
*/ */
@Override @Override
public boolean allowSetPassword(Context context, public boolean allowSetPassword(Context context,
@@ -486,11 +489,12 @@ public class X509Authentication implements AuthenticationMethod
* Return special groups configured in dspace.cfg for X509 certificate * Return special groups configured in dspace.cfg for X509 certificate
* authentication. * authentication.
* *
* @param context * @param context context
* @param request * @param request
* object potentially containing the cert * object potentially containing the cert
* *
* @return An int array of group IDs * @return An int array of group IDs
* @throws SQLException if database error
* *
*/ */
@Override @Override
@@ -558,6 +562,7 @@ public class X509Authentication implements AuthenticationMethod
* </ul> * </ul>
* *
* @return One of: SUCCESS, BAD_CREDENTIALS, NO_SUCH_USER, BAD_ARGS * @return One of: SUCCESS, BAD_CREDENTIALS, NO_SUCH_USER, BAD_ARGS
* @throws SQLException if database error
*/ */
@Override @Override
public int authenticate(Context context, String username, String password, public int authenticate(Context context, String username, String password,

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