Clean up dspace-api doc comment warnings

This commit is contained in:
Mark H. Wood
2012-11-02 16:08:00 -04:00
parent 3cf7c59780
commit 255288a367
51 changed files with 1519 additions and 1678 deletions

View File

@@ -1128,11 +1128,10 @@ public class ItemExport
} }
/** /**
* 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 fileName * @param fileName
* name of the file to get the size * name of the file to get the size.
* @return
* @throws Exception * @throws Exception
*/ */
public static long getExportFileSize(String fileName) throws Exception public static long getExportFileSize(String fileName) throws Exception

View File

@@ -375,46 +375,46 @@ 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.
* *
* * @param f file of item metadata.
* @validate flag to verify matching files in tree * @validate flag to verify matching files in tree.
* @return * @return parsed content of {@code f}.
*/ */
public static List<ContentsEntry> readContentsFile(File f) public static List<ContentsEntry> readContentsFile(File f)
throws FileNotFoundException, IOException, ParseException throws FileNotFoundException, IOException, ParseException
{ {
List<ContentsEntry> list = new ArrayList<ContentsEntry>(); List<ContentsEntry> list = new ArrayList<ContentsEntry>();
BufferedReader in = null; BufferedReader in = null;
try try
{ {
in = new BufferedReader(new FileReader(f)); in = new BufferedReader(new FileReader(f));
String line = null; String line = null;
while ((line = in.readLine()) != null) while ((line = in.readLine()) != null)
{ {
line = line.trim(); line = line.trim();
if ("".equals(line)) if ("".equals(line))
{ {
continue; continue;
} }
ItemUpdate.pr("Contents entry: " + line); ItemUpdate.pr("Contents entry: " + line);
list.add(ContentsEntry.parse(line)); list.add(ContentsEntry.parse(line));
} }
} }
finally finally
{ {
try try
{ {
in.close(); in.close();
} }
catch(IOException e) catch(IOException e)
{ {
//skip //skip
} }
} }
return list; return list;
@@ -423,7 +423,6 @@ public class MetadataUtilities {
/** /**
* *
* @param f * @param f
* @return
* @throws FileNotFoundException * @throws FileNotFoundException
* @throws IOException * @throws IOException
*/ */
@@ -441,7 +440,7 @@ public class MetadataUtilities {
while ((line = in.readLine()) != null) while ((line = in.readLine()) != null)
{ {
line = line.trim(); line = line.trim();
if ("".equals(line)) if ("".equals(line))
{ {
continue; continue;
@@ -451,7 +450,7 @@ public class MetadataUtilities {
try try
{ {
n = Integer.parseInt(line); n = Integer.parseInt(line);
list.add(n); list.add(n);
} }
catch(NumberFormatException e) catch(NumberFormatException e)
{ {
@@ -461,13 +460,13 @@ public class MetadataUtilities {
} }
finally finally
{ {
try try
{ {
in.close(); in.close();
} }
catch(IOException e) catch(IOException e)
{ {
//skip //skip
} }
} }
@@ -476,7 +475,7 @@ public class MetadataUtilities {
/** /**
* Get display of DCValue * Get display of DCValue
* *
* @param dcv * @param dcv
* @return string displaying elements of the DCValue * @return string displaying elements of the DCValue
*/ */
@@ -486,47 +485,47 @@ public class MetadataUtilities {
"; language: " + dcv.language + "; value: " + dcv.value; "; language: " + dcv.language + "; value: " + dcv.value;
} }
/** /**
* *
* @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
*/ */
public static String getCompoundForm(String schema, String element, String qualifier) public static String getCompoundForm(String schema, String element, String qualifier)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(schema).append(".").append(element); sb.append(schema).append(".").append(element);
if (qualifier != null) if (qualifier != null)
{ {
sb.append(".").append(qualifier); sb.append(".").append(qualifier);
} }
return sb.toString(); return sb.toString();
} }
/** /**
* Parses metadata field given in the form <schema>.<element>[.<qualifier>|.*] * Parses metadata field given in the form "<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.
* *
* @return String Array * @return String Array
* @throws ParseException if validity checks fail * @throws ParseException if validity checks fail
* *
*/ */
public static String[] parseCompoundForm(String compoundForm) public static String[] parseCompoundForm(String compoundForm)
throws ParseException throws ParseException
{ {
String[] ar = compoundForm.split("\\s*\\.\\s*"); //trim ends String[] ar = compoundForm.split("\\s*\\.\\s*"); //trim ends
if ("".equals(ar[0])) if ("".equals(ar[0]))
{ {
throw new ParseException("schema is empty string: " + compoundForm, 0); throw new ParseException("schema is empty string: " + compoundForm, 0);
} }
if ((ar.length < 2) || (ar.length > 3) || "".equals(ar[1])) if ((ar.length < 2) || (ar.length > 3) || "".equals(ar[1]))
{ {
throw new ParseException("element is malformed or empty string: " + compoundForm, 0); throw new ParseException("element is malformed or empty string: " + compoundForm, 0);
} }
return ar; return ar;
} }
} }

View File

@@ -608,7 +608,6 @@ 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
* @param identifier identifier of main DSpace object to disseminate
* @throws IOException * @throws IOException
* @throws SQLException * @throws SQLException
* @throws FileNotFoundException * @throws FileNotFoundException
@@ -616,7 +615,9 @@ public class Packager
* @throws CrosswalkException * @throws CrosswalkException
* @throws PackageException * @throws PackageException
*/ */
protected void disseminate(Context context, PackageDisseminator dip, DSpaceObject dso, PackageParameters pkgParams, String outputFile) protected void disseminate(Context context, PackageDisseminator dip,
DSpaceObject dso, PackageParameters pkgParams,
String outputFile)
throws IOException, SQLException, FileNotFoundException, AuthorizeException, CrosswalkException, PackageException throws IOException, SQLException, FileNotFoundException, AuthorizeException, CrosswalkException, PackageException
{ {
// initialize output file // initialize output file

View File

@@ -94,18 +94,18 @@ public class SFXFileReader {
} }
/** /**
* Process the item * Process the item.
* *
* @param node * @param node
* @param item * @param item
* @return * @return processed fields.
* @throws IOException * @throws IOException
*/ */
public static String doNodes(Node node, Item item) throws IOException public static String doNodes(Node node, Item item) throws IOException
{ {
if (node == null) if (node == null)
{ {
log.error (" Empty Node "); log.error (" Empty Node ");
return null; return null;
} }
Node e = getElement(node); Node e = getElement(node);
@@ -135,11 +135,11 @@ public class SFXFileReader {
} }
/** /**
* Process the fields * Process the fields.
* *
* @param e * @param e
* @param item * @param item
* @return * @return assembled query.
* @throws IOException * @throws IOException
*/ */
private static String processFields(Node e, Item item) throws IOException private static String processFields(Node e, Item item) throws IOException
@@ -315,10 +315,10 @@ public class SFXFileReader {
short type = kid.getNodeType(); short type = kid.getNodeType();
if (type == Node.TEXT_NODE) if (type == Node.TEXT_NODE)
{ {
return kid.getNodeValue().trim(); return kid.getNodeValue().trim();
} }
} }
// Didn't find a text node // Didn't find a text node
return null; return null;
} }
} }

View File

@@ -855,9 +855,7 @@ public class LogAnalyser
} }
/** /**
* read in the given config file and populate the class globals * Read in the current config file and populate the class globals.
*
* @param configFile the config file to read in
*/ */
public static void readConfig() throws IOException public static void readConfig() throws IOException
{ {
@@ -865,7 +863,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
*/ */

View File

@@ -53,8 +53,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
*/ */
public static Date[] getMonthlyReportDates() public static Date[] getMonthlyReportDates()
{ {
@@ -62,8 +61,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
*/ */
public static Date[] getMonthlyAnalysisDates() public static Date[] getMonthlyAnalysisDates()
{ {
@@ -71,9 +69,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
* @return
*/ */
protected static Date[] getDatesFromMap(Map<String, StatsFile> monthlyMap) protected static Date[] getDatesFromMap(Map<String, StatsFile> monthlyMap)
{ {
@@ -97,9 +94,9 @@ 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
* @return * @return sorted dates.
*/ */
protected static Date[] sortDatesDescending(Date[] dates) protected static Date[] sortDatesDescending(Date[] dates)
{ {
@@ -134,9 +131,8 @@ public class StatisticsLoader
} }
/** /**
* Get the analysis file for a given date * Get the analysis file for a given date.
* @param date * @param date
* @return
*/ */
public static File getAnalysisFor(String date) public static File getAnalysisFor(String date)
{ {
@@ -146,9 +142,8 @@ public class StatisticsLoader
} }
/** /**
* Get the report file for a given date * Get the report file for a given date.
* @param date * @param date
* @return
*/ */
public static File getReportFor(String date) public static File getReportFor(String date)
{ {
@@ -158,8 +153,7 @@ public class StatisticsLoader
} }
/** /**
* Get the current general analysis file * Get the current general analysis file.
* @return
*/ */
public static File getGeneralAnalysis() public static File getGeneralAnalysis()
{ {
@@ -168,8 +162,7 @@ public class StatisticsLoader
} }
/** /**
* Get the current general report file * Get the current general report file.
* @return
*/ */
public static File getGeneralReport() public static File getGeneralReport()
{ {
@@ -295,13 +288,13 @@ public class StatisticsLoader
} }
/** /**
* Generate a StatsFile entry for this file. The pattern and date formatters are used to * Generate a StatsFile entry for this file. The pattern and date
* identify the file as a particular type, and extract the relevant information. * formatters are used to identify the file as a particular type,
* If the file is not identified by the formatter provided, then we return null * and extract the relevant information. If the file is not identified
* by the formatter provided, then we return null.
* @param thisFile * @param thisFile
* @param thisPattern * @param thisPattern
* @param sdf * @param sdf
* @return
*/ */
private static StatsFile makeStatsFile(File thisFile, Pattern thisPattern, SimpleDateFormat sdf) private static StatsFile makeStatsFile(File thisFile, Pattern thisPattern, SimpleDateFormat sdf)
{ {
@@ -329,8 +322,7 @@ public class StatisticsLoader
} }
/** /**
* Get an array of all the analysis and report files * Get an array of all the analysis and report files.
* @return
*/ */
private static File[] getAnalysisAndReportFileList() private static File[] getAnalysisAndReportFileList()
{ {
@@ -344,7 +336,7 @@ public class StatisticsLoader
} }
/** /**
* Simple class for holding information about an analysis/report file * Simple class for holding information about an analysis/report file.
*/ */
private static class StatsFile private static class StatsFile
{ {
@@ -355,7 +347,8 @@ public class StatisticsLoader
} }
/** /**
* Filter used to restrict files in the reports directory to just analysis or report types * Filter used to restrict files in the reports directory to just
* analysis or report types.
*/ */
private static class AnalysisAndReportFilter implements FilenameFilter private static class AnalysisAndReportFilter implements FilenameFilter
{ {

View File

@@ -11,37 +11,6 @@
<html> <html>
<head> <head>
<title>org.dspace.app.statistics package</title> <title>org.dspace.app.statistics package</title>
<!--
* Copyright (c) 2002-2009, The DSpace Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the DSpace Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
-->
</head> </head>
<body> <body>
@@ -67,11 +36,11 @@ class, defined in this package, to select an event processing implementation.
Three "stock" implementations are provided. Three "stock" implementations are provided.
</p> </p>
<dl> <dl>
<dt>{@link org.dspace.app.statistics.PassiveUsageEvent PassiveUsageEvent}</dt> <dt>{@link org.dspace.usage.PassiveUsageEventListener PassiveUsageEventListener}</dt>
<dd>absorbs events without taking action, resulting in behavior identical <dd>absorbs events without taking action, resulting in behavior identical
to that of DSpace before this package was added. This is the default to that of DSpace before this package was added. This is the default
if no plugin is configured.</dd> if no plugin is configured.</dd>
<dt>{@link org.dspace.app.statistics.UsageEventTabFileLogger UsageEventTabFileLogger}</dt> <dt>{@link org.dspace.usage.TabFileUsageEventListener TabFileUsageEventListener}</dt>
<dd>writes event records to a file in Tab Separated Values format.</dd> <dd>writes event records to a file in Tab Separated Values format.</dd>
<dt>{@link org.dspace.app.statistics.UsageEventXMLLogger UsageEventXMLLogger}</dt> <dt>{@link org.dspace.app.statistics.UsageEventXMLLogger UsageEventXMLLogger}</dt>
<dd>writes event records to a file in an XML format. Suitable mainly for <dd>writes event records to a file in an XML format. Suitable mainly for

View File

@@ -17,7 +17,6 @@ import org.dspace.content.MetadataSchema;
* Class representing a line in an input form. * Class representing a line in an input form.
* *
* @author Brian S. Hughes, based on work by Jenny Toves, OCLC * @author Brian S. Hughes, based on work by Jenny Toves, OCLC
* @version
*/ */
public class DCInput public class DCInput
{ {

View File

@@ -772,7 +772,6 @@ 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
*/ */
public List<Element> disseminateList() public List<Element> disseminateList()
{ {

View File

@@ -174,8 +174,6 @@ public class AuthorizeConfiguration
/** /**
* Are community admins allowed to create new, not strictly community * Are community admins allowed to create new, not strictly community
* related, group? * related, group?
*
* @return
*/ */
public static boolean canCommunityAdminPerformGroupCreation() public static boolean canCommunityAdminPerformGroupCreation()
{ {
@@ -184,8 +182,6 @@ public class AuthorizeConfiguration
/** /**
* Are community admins allowed to create collections or subcommunities? * Are community admins allowed to create collections or subcommunities?
*
* @return
*/ */
public static boolean canCommunityAdminPerformSubelementCreation() public static boolean canCommunityAdminPerformSubelementCreation()
{ {
@@ -194,8 +190,6 @@ public class AuthorizeConfiguration
/** /**
* Are community admins allowed to remove collections or subcommunities? * Are community admins allowed to remove collections or subcommunities?
*
* @return
*/ */
public static boolean canCommunityAdminPerformSubelementDeletion() public static boolean canCommunityAdminPerformSubelementDeletion()
{ {
@@ -205,8 +199,6 @@ public class AuthorizeConfiguration
/** /**
* Are community admins allowed to manage the community's and * Are community admins allowed to manage the community's and
* subcommunities' policies? * subcommunities' policies?
*
* @return
*/ */
public static boolean canCommunityAdminManagePolicies() public static boolean canCommunityAdminManagePolicies()
{ {
@@ -216,8 +208,6 @@ public class AuthorizeConfiguration
/** /**
* Are community admins allowed to create/edit them community's and * Are community admins allowed to create/edit them community's and
* subcommunities' admin groups? * subcommunities' admin groups?
*
* @return
*/ */
public static boolean canCommunityAdminManageAdminGroup() public static boolean canCommunityAdminManageAdminGroup()
{ {
@@ -227,8 +217,6 @@ public class AuthorizeConfiguration
/** /**
* Are community admins allowed to create/edit the community's and * Are community admins allowed to create/edit the community's and
* subcommunities' admin group? * subcommunities' admin group?
*
* @return
*/ */
public static boolean canCommunityAdminManageCollectionPolicies() public static boolean canCommunityAdminManageCollectionPolicies()
{ {
@@ -238,8 +226,6 @@ public class AuthorizeConfiguration
/** /**
* Are community admins allowed to manage the item template of them * Are community admins allowed to manage the item template of them
* collections? * collections?
*
* @return
*/ */
public static boolean canCommunityAdminManageCollectionTemplateItem() public static boolean canCommunityAdminManageCollectionTemplateItem()
{ {
@@ -249,8 +235,6 @@ public class AuthorizeConfiguration
/** /**
* Are community admins allowed to manage (create/edit/remove) the * Are community admins allowed to manage (create/edit/remove) the
* submitters group of them collections? * submitters group of them collections?
*
* @return
*/ */
public static boolean canCommunityAdminManageCollectionSubmitters() public static boolean canCommunityAdminManageCollectionSubmitters()
{ {
@@ -260,8 +244,6 @@ public class AuthorizeConfiguration
/** /**
* Are community admins allowed to manage (create/edit/remove) the workflows * Are community admins allowed to manage (create/edit/remove) the workflows
* group of them collections? * group of them collections?
*
* @return
*/ */
public static boolean canCommunityAdminManageCollectionWorkflows() public static boolean canCommunityAdminManageCollectionWorkflows()
{ {
@@ -271,8 +253,6 @@ public class AuthorizeConfiguration
/** /**
* Are community admins allowed to manage (create/edit/remove) the admin * Are community admins allowed to manage (create/edit/remove) the admin
* group of them collections? * group of them collections?
*
* @return
*/ */
public static boolean canCommunityAdminManageCollectionAdminGroup() public static boolean canCommunityAdminManageCollectionAdminGroup()
{ {
@@ -281,8 +261,6 @@ public class AuthorizeConfiguration
/** /**
* Are community admins allowed to remove an item from them collections? * Are community admins allowed to remove an item from them collections?
*
* @return
*/ */
public static boolean canCommunityAdminPerformItemDeletion() public static boolean canCommunityAdminPerformItemDeletion()
{ {
@@ -291,8 +269,6 @@ public class AuthorizeConfiguration
/** /**
* Are community admins allowed to withdrawn an item from them collections? * Are community admins allowed to withdrawn an item from them collections?
*
* @return
*/ */
public static boolean canCommunityAdminPerformItemWithdrawn() public static boolean canCommunityAdminPerformItemWithdrawn()
{ {
@@ -302,8 +278,6 @@ public class AuthorizeConfiguration
/** /**
* Are community admins allowed to reinstate an item from them * Are community admins allowed to reinstate an item from them
* collections? * collections?
*
* @return
*/ */
public static boolean canCommunityAdminPerformItemReinstatiate() public static boolean canCommunityAdminPerformItemReinstatiate()
{ {
@@ -313,8 +287,6 @@ public class AuthorizeConfiguration
/** /**
* Are community admins allowed to manage the policies of an item owned by * Are community admins allowed to manage the policies of an item owned by
* one of them collections? * one of them collections?
*
* @return
*/ */
public static boolean canCommunityAdminManageItemPolicies() public static boolean canCommunityAdminManageItemPolicies()
{ {
@@ -324,8 +296,6 @@ public class AuthorizeConfiguration
/** /**
* Are community admins allowed to add a bitstream to an item owned by one * Are community admins allowed to add a bitstream to an item owned by one
* of them collections? * of them collections?
*
* @return
*/ */
public static boolean canCommunityAdminPerformBitstreamCreation() public static boolean canCommunityAdminPerformBitstreamCreation()
{ {
@@ -335,8 +305,6 @@ public class AuthorizeConfiguration
/** /**
* Are community admins allowed to remove a bitstream from an item owned by * Are community admins allowed to remove a bitstream from an item owned by
* one of them collections? * one of them collections?
*
* @return
*/ */
public static boolean canCommunityAdminPerformBitstreamDeletion() public static boolean canCommunityAdminPerformBitstreamDeletion()
{ {
@@ -346,8 +314,6 @@ public class AuthorizeConfiguration
/** /**
* Are community admins allowed to perform CC License replace or addition to * Are community admins allowed to perform CC License replace or addition to
* an item owned by one of them collections? * an item owned by one of them collections?
*
* @return
*/ */
public static boolean canCommunityAdminManageCCLicense() public static boolean canCommunityAdminManageCCLicense()
{ {
@@ -356,8 +322,6 @@ public class AuthorizeConfiguration
/** /**
* Are collection admins allowed to manage the collection's policies? * Are collection admins allowed to manage the collection's policies?
*
* @return
*/ */
public static boolean canCollectionAdminManagePolicies() public static boolean canCollectionAdminManagePolicies()
{ {
@@ -367,8 +331,6 @@ public class AuthorizeConfiguration
/** /**
* Are collection admins allowed to manage (create/edit/delete) the * Are collection admins allowed to manage (create/edit/delete) the
* collection's item template? * collection's item template?
*
* @return
*/ */
public static boolean canCollectionAdminManageTemplateItem() public static boolean canCollectionAdminManageTemplateItem()
{ {
@@ -378,8 +340,6 @@ public class AuthorizeConfiguration
/** /**
* Are collection admins allowed to manage (create/edit/delete) the * Are collection admins allowed to manage (create/edit/delete) the
* collection's submitters group? * collection's submitters group?
*
* @return
*/ */
public static boolean canCollectionAdminManageSubmitters() public static boolean canCollectionAdminManageSubmitters()
{ {
@@ -389,8 +349,6 @@ public class AuthorizeConfiguration
/** /**
* Are collection admins allowed to manage (create/edit/delete) the * Are collection admins allowed to manage (create/edit/delete) the
* collection's workflows group? * collection's workflows group?
*
* @return
*/ */
public static boolean canCollectionAdminManageWorkflows() public static boolean canCollectionAdminManageWorkflows()
{ {
@@ -400,8 +358,6 @@ public class AuthorizeConfiguration
/** /**
* Are collection admins allowed to manage (create/edit) the collection's * Are collection admins allowed to manage (create/edit) the collection's
* admins group? * admins group?
*
* @return
*/ */
public static boolean canCollectionAdminManageAdminGroup() public static boolean canCollectionAdminManageAdminGroup()
{ {
@@ -410,8 +366,6 @@ public class AuthorizeConfiguration
/** /**
* Are collection admins allowed to remove an item from the collection? * Are collection admins allowed to remove an item from the collection?
*
* @return
*/ */
public static boolean canCollectionAdminPerformItemDeletion() public static boolean canCollectionAdminPerformItemDeletion()
{ {
@@ -420,8 +374,6 @@ public class AuthorizeConfiguration
/** /**
* Are collection admins allowed to withdrawn an item from the collection? * Are collection admins allowed to withdrawn an item from the collection?
*
* @return
*/ */
public static boolean canCollectionAdminPerformItemWithdrawn() public static boolean canCollectionAdminPerformItemWithdrawn()
{ {
@@ -431,8 +383,6 @@ public class AuthorizeConfiguration
/** /**
* Are collection admins allowed to reinstate an item from the * Are collection admins allowed to reinstate an item from the
* collection? * collection?
*
* @return
*/ */
public static boolean canCollectionAdminPerformItemReinstatiate() public static boolean canCollectionAdminPerformItemReinstatiate()
{ {
@@ -442,8 +392,6 @@ public class AuthorizeConfiguration
/** /**
* Are collection admins allowed to manage the policies of item owned by the * Are collection admins allowed to manage the policies of item owned by the
* collection? * collection?
*
* @return
*/ */
public static boolean canCollectionAdminManageItemPolicies() public static boolean canCollectionAdminManageItemPolicies()
{ {
@@ -453,8 +401,6 @@ public class AuthorizeConfiguration
/** /**
* Are collection admins allowed to add a bitstream to an item owned by the * Are collection admins allowed to add a bitstream to an item owned by the
* collections? * collections?
*
* @return
*/ */
public static boolean canCollectionAdminPerformBitstreamCreation() public static boolean canCollectionAdminPerformBitstreamCreation()
{ {
@@ -464,8 +410,6 @@ public class AuthorizeConfiguration
/** /**
* Are collection admins allowed to remove a bitstream from an item owned by * Are collection admins allowed to remove a bitstream from an item owned by
* the collections? * the collections?
*
* @return
*/ */
public static boolean canCollectionAdminPerformBitstreamDeletion() public static boolean canCollectionAdminPerformBitstreamDeletion()
{ {
@@ -475,8 +419,6 @@ public class AuthorizeConfiguration
/** /**
* Are collection admins allowed to replace or adding a CC License to an * Are collection admins allowed to replace or adding a CC License to an
* item owned by the collections? * item owned by the collections?
*
* @return
*/ */
public static boolean canCollectionAdminManageCCLicense() public static boolean canCollectionAdminManageCCLicense()
{ {
@@ -485,8 +427,6 @@ public class AuthorizeConfiguration
/** /**
* Are item admins allowed to manage the item's policies? * Are item admins allowed to manage the item's policies?
*
* @return
*/ */
public static boolean canItemAdminManagePolicies() public static boolean canItemAdminManagePolicies()
{ {
@@ -495,8 +435,6 @@ public class AuthorizeConfiguration
/** /**
* Are item admins allowed to add bitstreams to the item? * Are item admins allowed to add bitstreams to the item?
*
* @return
*/ */
public static boolean canItemAdminPerformBitstreamCreation() public static boolean canItemAdminPerformBitstreamCreation()
{ {
@@ -505,8 +443,6 @@ public class AuthorizeConfiguration
/** /**
* Are item admins allowed to remove bitstreams from the item? * Are item admins allowed to remove bitstreams from the item?
*
* @return
*/ */
public static boolean canItemAdminPerformBitstreamDeletion() public static boolean canItemAdminPerformBitstreamDeletion()
{ {
@@ -515,8 +451,6 @@ public class AuthorizeConfiguration
/** /**
* Are item admins allowed to replace or adding CC License to the item? * Are item admins allowed to replace or adding CC License to the item?
*
* @return
*/ */
public static boolean canItemAdminManageCCLicense() public static boolean canItemAdminManageCCLicense()
{ {

View File

@@ -332,7 +332,7 @@ public interface BrowseCreateDAO
* @param table the name of the distinct table which holds the target of the mapping * @param table the name of the distinct table which holds the target of the mapping
* @param map the name of the mapping table itself * @param map the name of the mapping table itself
* @param execute whether to execute the query or not * @param execute whether to execute the query or not
* @return * @return the instructions (SQL) which effect the creation.
* @throws BrowseException * @throws BrowseException
*/ */
public String createDistinctMap(String table, String map, boolean execute) throws BrowseException; public String createDistinctMap(String table, String map, boolean execute) throws BrowseException;

View File

@@ -8,8 +8,9 @@
package org.dspace.browse; package org.dspace.browse;
/** /**
* Utility class for retrieving the size of the columns to be used in the browse tables, * Utility class for retrieving the size of the columns to be used in the
* and applying truncation to the strings that will be inserted into the tables. * browse tables, and applying truncation to the strings that will be inserted
* into the tables.
* *
* Can be configured in dspace.cfg, with the following entries: * Can be configured in dspace.cfg, with the following entries:
* *
@@ -25,26 +26,23 @@ package org.dspace.browse;
* - a string to append to truncated values that will be entered into * - a string to append to truncated values that will be entered into
* the value columns (ie. '...') * the value columns (ie. '...')
* *
* By default, the column sizes are '0' (unlimited), and no truncation is applied, * By default, the column sizes are '0' (unlimited), and no truncation is
* EXCEPT for Oracle, where we have to truncate the columns for it to work! (in which * applied, EXCEPT for Oracle, where we have to truncate the columns for it
* case, both value and sort columns are by default limited to 2000 characters). * to work! (in which case, both value and sort columns are by default limited
* * to 2000 characters).
*
* @author Graham Triggs * @author Graham Triggs
* @author Richard Jones * @author Richard Jones
*/ */
public interface BrowseDAOUtils public interface BrowseDAOUtils
{ {
/** /**
* Get the size to use for the 'value' columns in characters * Get the size to use for the 'value' columns in characters
*
* @return
*/ */
public int getValueColumnMaxChars(); public int getValueColumnMaxChars();
/** /**
* Get the size to use for the sort columns in characters * Get the size to use for the sort columns in characters
*
* @return
*/ */
public int getSortColumnMaxChars(); public int getSortColumnMaxChars();
@@ -52,7 +50,7 @@ public interface BrowseDAOUtils
* Truncate strings that are to be used for the 'value' columns * Truncate strings that are to be used for the 'value' columns
* *
* @param value * @param value
* @return * @return the truncated value.
*/ */
public String truncateValue(String value); public String truncateValue(String value);
@@ -60,7 +58,7 @@ public interface BrowseDAOUtils
* Truncate strings that are to be used for sorting * Truncate strings that are to be used for sorting
* *
* @param value * @param value
* @return * @return the truncated value.
*/ */
public String truncateSortValue(String value); public String truncateSortValue(String value);
@@ -72,7 +70,7 @@ public interface BrowseDAOUtils
* *
* @param value * @param value
* @param chars * @param chars
* @return * @return the truncated value.
* @deprecated * @deprecated
*/ */
public String truncateValue(String value, int chars); public String truncateValue(String value, int chars);
@@ -85,7 +83,7 @@ public interface BrowseDAOUtils
* *
* @param value * @param value
* @param chars * @param chars
* @return * @return the truncated value.
* @deprecated * @deprecated
*/ */
public String truncateSortValue(String value, int chars); public String truncateSortValue(String value, int chars);

View File

@@ -10,8 +10,9 @@ package org.dspace.browse;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
/** /**
* Utility class for retrieving the size of the columns to be used in the browse tables, * Utility class for retrieving the size of the columns to be used in the
* and applying truncation to the strings that will be inserted into the tables. * browse tables, and applying truncation to the strings that will be inserted
* into the tables.
* *
* Can be configured in dspace.cfg, with the following entries: * Can be configured in dspace.cfg, with the following entries:
* *
@@ -27,16 +28,17 @@ import org.dspace.core.ConfigurationManager;
* - a string to append to truncated values that will be entered into * - a string to append to truncated values that will be entered into
* the value columns (ie. '...') * the value columns (ie. '...')
* *
* By default, the column sizes are '0' (unlimited), and no truncation is applied, * By default, the column sizes are '0' (unlimited), and no truncation is
* EXCEPT for Oracle, where we have to truncate the columns for it to work! (in which * applied, EXCEPT for Oracle, where we have to truncate the columns for it
* case, both value and sort columns are by default limited to 2000 characters). * to work! (in which case, both value and sort columns are by default limited
* * to 2000 characters).
*
* @author Graham Triggs * @author Graham Triggs
* @author Richard Jones * @author Richard Jones
*/ */
public class BrowseDAOUtilsDefault implements BrowseDAOUtils public class BrowseDAOUtilsDefault implements BrowseDAOUtils
{ {
/** Maximum number of characters for value columns */ /** Maximum number of characters for value columns */
public int valueColumnMaxChars; public int valueColumnMaxChars;
/** Maximum number of characters for sort columns */ /** Maximum number of characters for sort columns */
@@ -81,8 +83,6 @@ public class BrowseDAOUtilsDefault implements BrowseDAOUtils
/** /**
* Get the size to use for the 'value' columns in characters * Get the size to use for the 'value' columns in characters
*
* @return
*/ */
public int getValueColumnMaxChars() public int getValueColumnMaxChars()
{ {
@@ -91,8 +91,6 @@ public class BrowseDAOUtilsDefault implements BrowseDAOUtils
/** /**
* Get the size to use for the sort columns in characters * Get the size to use for the sort columns in characters
*
* @return
*/ */
public int getSortColumnMaxChars() public int getSortColumnMaxChars()
{ {
@@ -103,7 +101,7 @@ public class BrowseDAOUtilsDefault implements BrowseDAOUtils
* Truncate strings that are to be used for the 'value' columns * Truncate strings that are to be used for the 'value' columns
* *
* @param value * @param value
* @return * @return the truncated value.
*/ */
public String truncateValue(String value) public String truncateValue(String value)
{ {
@@ -114,7 +112,7 @@ public class BrowseDAOUtilsDefault implements BrowseDAOUtils
* Truncate strings that are to be used for sorting * Truncate strings that are to be used for sorting
* *
* @param value * @param value
* @return * @return the truncated value.
*/ */
public String truncateSortValue(String value) public String truncateSortValue(String value)
{ {
@@ -129,7 +127,7 @@ public class BrowseDAOUtilsDefault implements BrowseDAOUtils
* *
* @param value * @param value
* @param chars * @param chars
* @return * @return the truncated value.
* @deprecated * @deprecated
*/ */
public String truncateValue(String value, int chars) public String truncateValue(String value, int chars)
@@ -145,7 +143,7 @@ public class BrowseDAOUtilsDefault implements BrowseDAOUtils
* *
* @param value * @param value
* @param chars * @param chars
* @return * @return the truncated value.
* @deprecated * @deprecated
*/ */
public String truncateSortValue(String value, int chars) public String truncateSortValue(String value, int chars)
@@ -159,7 +157,7 @@ public class BrowseDAOUtilsDefault implements BrowseDAOUtils
* @param value * @param value
* @param maxChars * @param maxChars
* @param omissionMark * @param omissionMark
* @return * @return the truncated value.
*/ */
private String trunctateString(String value, int maxChars, String omissionMark) private String trunctateString(String value, int maxChars, String omissionMark)
{ {

View File

@@ -27,7 +27,7 @@ import org.dspace.sort.SortException;
*/ */
public final class BrowseIndex public final class BrowseIndex
{ {
/** the configuration number, as specified in the config */ /** the configuration number, as specified in the config */
/** used for single metadata browse tables for generating the table name */ /** used for single metadata browse tables for generating the table name */
private int number; private int number;
@@ -75,7 +75,7 @@ public final class BrowseIndex
} }
/** /**
* Constructor for creating generic / internal index objects * Constructor for creating generic / internal index objects.
* @param baseName The base of the table name * @param baseName The base of the table name
*/ */
private BrowseIndex(String baseName) private BrowseIndex(String baseName)
@@ -223,25 +223,25 @@ public final class BrowseIndex
} }
/** /**
* @return Returns the datatype. * @return Returns the datatype.
*/ */
public String getDataType() public String getDataType()
{ {
if (sortOption != null) if (sortOption != null)
{ {
return sortOption.getType(); return sortOption.getType();
} }
return datatype; return datatype;
} }
/** /**
* @return Returns the displayType. * @return Returns the displayType.
*/ */
public String getDisplayType() public String getDisplayType()
{ {
return displayType; return displayType;
} }
/** /**
* @return Returns the number of metadata fields for this index * @return Returns the number of metadata fields for this index
@@ -257,67 +257,67 @@ public final class BrowseIndex
} }
/** /**
* @return Returns the mdBits. * @return Returns the mdBits.
*/ */
public String[] getMdBits(int idx) public String[] getMdBits(int idx)
{ {
if (isMetadataIndex()) if (isMetadataIndex())
{ {
return mdBits[idx]; return mdBits[idx];
} }
return null;
}
/** return null;
* @return Returns the metadata. }
*/
public String getMetadata() /**
{ * @return Returns the metadata.
*/
public String getMetadata()
{
return metadataAll; return metadataAll;
} }
public String getMetadata(int idx) public String getMetadata(int idx)
{ {
return metadata[idx]; return metadata[idx];
} }
/** /**
* @return Returns the name. * @return Returns the name.
*/ */
public String getName() public String getName()
{ {
return name; return name;
} }
/** /**
* @param name The name to set. * @param name The name to set.
*/ */
// public void setName(String name) // public void setName(String name)
// { // {
// this.name = name; // this.name = name;
// } // }
/** /**
* Get the SortOption associated with this index. * Get the SortOption associated with this index.
*/ */
public SortOption getSortOption() public SortOption getSortOption()
{ {
return sortOption; return sortOption;
} }
public boolean isDisplayFrequencies() {
return displayFrequencies;
}
/** public boolean isDisplayFrequencies() {
* Populate the internal array containing the bits of metadata, for return displayFrequencies;
* ease of use later }
*/
public void generateMdBits() /**
* Populate the internal array containing the bits of metadata, for
* ease of use later
*/
public void generateMdBits()
{ {
try try
{ {
if (isMetadataIndex()) if (isMetadataIndex())
{ {
mdBits = new String[metadata.length][]; mdBits = new String[metadata.length][];
@@ -334,13 +334,13 @@ public final class BrowseIndex
} }
} }
/** /**
* Get the name of the sequence that will be used in the given circumstances * Get the name of the sequence that will be used in the given circumstances
* *
* @param isDistinct is a distinct table * @param isDistinct is a distinct table
* @param isMap is a map table * @param isMap is a map table
* @return the name of the sequence * @return the name of the sequence
*/ */
public String getSequenceName(boolean isDistinct, boolean isMap) public String getSequenceName(boolean isDistinct, boolean isMap)
{ {
if (isDistinct || isMap) if (isDistinct || isMap)
@@ -369,7 +369,6 @@ public final class BrowseIndex
* @param baseName * @param baseName
* @param isDistinct * @param isDistinct
* @param isMap * @param isMap
* @return
*/ */
private static String getSequenceName(String baseName, boolean isDistinct, boolean isMap) private static String getSequenceName(String baseName, boolean isDistinct, boolean isMap)
{ {
@@ -412,7 +411,7 @@ public final class BrowseIndex
* @param isCollection * @param isCollection
* @param isDistinct * @param isDistinct
* @param isMap * @param isMap
* @return * @return the name of the table.
*/ */
private static String getTableName(String baseName, boolean isCommunity, boolean isCollection, boolean isDistinct, boolean isMap) private static String getTableName(String baseName, boolean isCommunity, boolean isCollection, boolean isDistinct, boolean isMap)
{ {
@@ -443,7 +442,7 @@ public final class BrowseIndex
} }
/** /**
* Get the name of the table in the given circumstances * Get the name of the table in the given circumstances.
* *
* @param isCommunity whether this is a community constrained index (view) * @param isCommunity whether this is a community constrained index (view)
* @param isCollection whether this is a collection constrained index (view) * @param isCollection whether this is a collection constrained index (view)
@@ -486,7 +485,7 @@ public final class BrowseIndex
* getTableName(false, false, false, false); * getTableName(false, false, false, false);
* </code> * </code>
* *
* @return * @return the name of the table.
*/ */
public String getTableName() public String getTableName()
{ {
@@ -505,7 +504,7 @@ public final class BrowseIndex
* @param isDistinct is this a distinct table * @param isDistinct is this a distinct table
* @param isCommunity * @param isCommunity
* @param isCollection * @param isCollection
* @return * @return the name of the table.
* @deprecated 1.5 * @deprecated 1.5
*/ */
public String getTableName(boolean isDistinct, boolean isCommunity, boolean isCollection) public String getTableName(boolean isDistinct, boolean isCommunity, boolean isCollection)
@@ -520,7 +519,7 @@ public final class BrowseIndex
* getTableName(false, false, false, true); * getTableName(false, false, false, true);
* </code> * </code>
* *
* @return * @return the name of the table.
*/ */
public String getMapTableName() public String getMapTableName()
{ {
@@ -534,7 +533,7 @@ public final class BrowseIndex
* getTableName(false, false, true, false); * getTableName(false, false, true, false);
* </code> * </code>
* *
* @return * @return the name of the table.
*/ */
public String getDistinctTableName() public String getDistinctTableName()
{ {
@@ -629,8 +628,8 @@ public final class BrowseIndex
} }
/** /**
* Get the field for sorting associated with this index * Get the field for sorting associated with this index.
* @return * @return the name of the field.
* @throws BrowseException * @throws BrowseException
*/ */
public String getSortField(boolean isSecondLevel) throws BrowseException public String getSortField(boolean isSecondLevel) throws BrowseException
@@ -656,8 +655,11 @@ public final class BrowseIndex
} }
/** /**
* Get an array of the names of all the browse index tables in the current
* configuration.
*
* @deprecated * @deprecated
* @return * @return names of all the current browse index tables.
* @throws BrowseException * @throws BrowseException
*/ */
public static String[] tables() public static String[] tables()
@@ -731,7 +733,7 @@ public final class BrowseIndex
* Get the configured browse index that is defined to use this sort option * Get the configured browse index that is defined to use this sort option
* *
* @param so * @param so
* @return * @return the associated BrowseIndex.
* @throws BrowseException * @throws BrowseException
*/ */
public static BrowseIndex getBrowseIndex(SortOption so) throws BrowseException public static BrowseIndex getBrowseIndex(SortOption so) throws BrowseException
@@ -748,9 +750,7 @@ public final class BrowseIndex
} }
/** /**
* Get the internally defined browse index for archived items * Get the internally defined browse index for archived items.
*
* @return
*/ */
public static BrowseIndex getItemBrowseIndex() public static BrowseIndex getItemBrowseIndex()
{ {
@@ -758,8 +758,7 @@ public final class BrowseIndex
} }
/** /**
* Get the internally defined browse index for withdrawn items * Get the internally defined browse index for withdrawn items.
* @return
*/ */
public static BrowseIndex getWithdrawnBrowseIndex() public static BrowseIndex getWithdrawnBrowseIndex()
{ {
@@ -805,9 +804,7 @@ public final class BrowseIndex
} }
/** /**
* Does this browse index represent one of the internal item indexes * Does this browse index represent one of the internal item indexes?
*
* @return
*/ */
public boolean isInternalIndex() public boolean isInternalIndex()
{ {
@@ -815,9 +812,8 @@ public final class BrowseIndex
} }
/** /**
* Generate a base table name * Generate a base table name.
* @param number * @param number
* @return
*/ */
private static String makeTableBaseName(int number) private static String makeTableBaseName(int number)
{ {

View File

@@ -496,7 +496,7 @@ public class BrowseInfo
/** /**
* @deprecated * @deprecated
* @return * @return an empty array of Item.
*/ */
public Item[] getItemResults() public Item[] getItemResults()
{ {

View File

@@ -37,17 +37,17 @@ import java.util.List;
*/ */
public class BrowseItem extends DSpaceObject public class BrowseItem extends DSpaceObject
{ {
/** Logger */ /** Logger */
private static Logger log = Logger.getLogger(BrowseItem.class); private static Logger log = Logger.getLogger(BrowseItem.class);
/** DSpace context */ /** DSpace context */
private Context context; private Context context;
/** a List of all the metadata */ /** a List of all the metadata */
private List<DCValue> metadata = new ArrayList<DCValue>(); private List<DCValue> metadata = new ArrayList<DCValue>();
/** database id of the item */ /** database id of the item */
private int id = -1; private int id = -1;
/** is the item in the archive */ /** is the item in the archive */
private boolean in_archive = true; private boolean in_archive = true;
@@ -56,37 +56,37 @@ public class BrowseItem extends DSpaceObject
private boolean withdrawn = false; private boolean withdrawn = false;
/** item handle */ /** item handle */
private String handle = null; private String handle = null;
/** /**
* Construct a new browse item with the given context and the database id * Construct a new browse item with the given context and the database id
* *
* @param context the DSpace context * @param context the DSpace context
* @param id the database id of the item * @param id the database id of the item
* @param in_archive * @param in_archive
* @param withdrawn * @param withdrawn
*/ */
public BrowseItem(Context context, int id, boolean in_archive, boolean withdrawn) public BrowseItem(Context context, int id, boolean in_archive, boolean withdrawn)
{ {
this.context = context; this.context = context;
this.id = id; this.id = id;
this.in_archive = in_archive; this.in_archive = in_archive;
this.withdrawn = withdrawn; this.withdrawn = withdrawn;
} }
/** /**
* Get String array of metadata values matching the given parameters * Get String array of metadata values matching the given parameters
* *
* @param schema metadata schema * @param schema metadata schema
* @param element metadata element * @param element metadata element
* @param qualifier metadata qualifier * @param qualifier metadata qualifier
* @param lang metadata language * @param lang metadata language
* @return array of matching values * @return array of matching values
* @throws SQLException * @throws SQLException
*/ */
public DCValue[] getMetadata(String schema, String element, String qualifier, String lang) public DCValue[] getMetadata(String schema, String element, String qualifier, String lang)
throws SQLException throws SQLException
{ {
try try
{ {
BrowseItemDAO dao = BrowseDAOFactory.getItemInstance(context); BrowseItemDAO dao = BrowseDAOFactory.getItemInstance(context);
@@ -146,55 +146,55 @@ public class BrowseItem extends DSpaceObject
} }
} }
/** /**
* Get the type of object. This object masquerades as an Item, so this * Get the type of object. This object masquerades as an Item, so this
* returns the value of Constants.ITEM * returns the value of Constants.ITEM
* *
*@return Constants.ITEM *@return Constants.ITEM
*/ */
public int getType() public int getType()
{ {
return Constants.ITEM;
}
/**
* @deprecated
* @param real
* @return real type, or Constants.ITEM.
*/
public int getType(boolean real)
{
if (!real)
{
return Constants.ITEM; return Constants.ITEM;
} }
else
{
return getType();
}
}
/** /**
* @deprecated * get the database id of the item
* @param real *
* @return * @return database id of item
*/ */
public int getType(boolean real) public int getID()
{ {
if (!real) return id;
{ }
return Constants.ITEM;
}
else
{
return getType();
}
}
/**
* get the database id of the item
*
* @return database id of item
*/
public int getID()
{
return id;
}
/** /**
* Set the database id of the item * Set the database id of the item
* *
* @param id the database id of the item * @param id the database id of the item
*/ */
public void setID(int id) public void setID(int id)
{ {
this.id = id; this.id = id;
} }
/** /**
* Utility method for pattern-matching metadata elements. This * Utility method for pattern-matching metadata elements. This
* method will return <code>true</code> if the given schema, * method will return <code>true</code> if the given schema,
* element, qualifier and language match the schema, element, * element, qualifier and language match the schema, element,
@@ -273,37 +273,36 @@ public class BrowseItem extends DSpaceObject
return true; return true;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.dspace.content.DSpaceObject#getHandle() * @see org.dspace.content.DSpaceObject#getHandle()
*/ */
public String getHandle() public String getHandle()
{ {
// Get our Handle if any // Get our Handle if any
if (this.handle == null) if (this.handle == null)
{ {
try try
{ {
this.handle = HandleManager.findHandle(context, this); this.handle = HandleManager.findHandle(context, this);
} }
catch (SQLException e) catch (SQLException e)
{ {
log.error("caught exception: ", e); log.error("caught exception: ", e);
} }
} }
return this.handle; return this.handle;
} }
/** /**
* Get a thumbnail object out of the item. * Get a thumbnail object out of the item.
* *
* Warning: using this method actually instantiates an Item, which has a * Warning: using this method actually instantiates an Item, which has a
* corresponding performance hit on the database during browse listing * corresponding performance hit on the database during browse listing
* rendering. That's your own fault for wanting to put images on your * rendering. That's your own fault for wanting to put images on your
* browse page! * browse page!
* *
* @return * @throws SQLException
* @throws SQLException */
*/
public Thumbnail getThumbnail() public Thumbnail getThumbnail()
throws SQLException throws SQLException
{ {
@@ -370,19 +369,19 @@ public class BrowseItem extends DSpaceObject
return null; return null;
} }
public String getName() public String getName()
{ {
// FIXME: there is an exception handling problem here // FIXME: there is an exception handling problem here
try try
{ {
DCValue t[] = getMetadata("dc", "title", null, Item.ANY); DCValue t[] = getMetadata("dc", "title", null, Item.ANY);
return (t.length >= 1) ? t[0].value : null; return (t.length >= 1) ? t[0].value : null;
} }
catch (SQLException sqle) catch (SQLException sqle)
{ {
log.error("caught exception: ", sqle); log.error("caught exception: ", sqle);
return null; return null;
} }
} }
@Override @Override

View File

@@ -37,7 +37,7 @@ public interface BrowseItemDAO
* @param element * @param element
* @param qualifier * @param qualifier
* @param lang * @param lang
* @return * @return matching metadata values.
* @throws SQLException * @throws SQLException
*/ */
public DCValue[] queryMetadata(int itemId, String schema, String element, String qualifier, String lang) public DCValue[] queryMetadata(int itemId, String schema, String element, String qualifier, String lang)

View File

@@ -22,56 +22,55 @@ import org.dspace.core.ConfigurationManager;
*/ */
public class CrossLinks public class CrossLinks
{ {
/** a map of the desired links */ /** a map of the desired links */
private Map<String, String> links = new HashMap<String, String>(); private Map<String, String> links = new HashMap<String, String>();
/** /**
* Construct a new object which will obtain the configuration for itself * Construct a new object which will obtain the configuration for itself
* *
* @throws BrowseException * @throws BrowseException
*/ */
public CrossLinks() public CrossLinks()
throws BrowseException throws BrowseException
{ {
int i = 1; int i = 1;
while (true) while (true)
{ {
String field = "webui.browse.link." + i; String field = "webui.browse.link." + i;
String config = ConfigurationManager.getProperty(field); String config = ConfigurationManager.getProperty(field);
if (config == null) if (config == null)
{ {
break; break;
} }
String[] parts = config.split(":"); String[] parts = config.split(":");
if (parts.length != 2) if (parts.length != 2)
{ {
throw new BrowseException("Invalid configuration for " + field + ": " + config); throw new BrowseException("Invalid configuration for " + field + ": " + config);
} }
links.put(parts[1], parts[0]); links.put(parts[1], parts[0]);
i++; i++;
} }
} }
/** /**
* Is there a link for the given canonical form of metadata (i.e. schema.element.qualifier) * Is there a link for the given canonical form of metadata (i.e.
* * schema.element.qualifier)?
* @param metadata the metadata to check for a link on *
* @return * @param metadata the metadata to check for a link on
*/ */
public boolean hasLink(String metadata) public boolean hasLink(String metadata)
{ {
return links.containsKey(metadata); return links.containsKey(metadata);
} }
/** /**
* get the type of link that the bit of metadata has * get the type of link that the bit of metadata has.
* *
* @param metadata the metadata to get the link type for * @param metadata the metadata to get the link type for
* @return */
*/ public String getLinkType(String metadata)
public String getLinkType(String metadata) {
{ return links.get(metadata);
return links.get(metadata); }
}
} }

View File

@@ -594,27 +594,27 @@ public class IndexBrowse
throw new BrowseException("Error in SortOptions", se); throw new BrowseException("Error in SortOptions", se);
} }
} }
/** /**
* remove all the indices for the given item * remove all the indices for the given item
* *
* @param item the item to be removed * @param item the item to be removed
* @return * @return true if removed.
* @throws BrowseException * @throws BrowseException
*/ */
public boolean itemRemoved(Item item) public boolean itemRemoved(Item item)
throws BrowseException throws BrowseException
{ {
return itemRemoved(item.getID()); return itemRemoved(item.getID());
} }
public boolean itemRemoved(int itemID) public boolean itemRemoved(int itemID)
throws BrowseException throws BrowseException
{ {
// go over the indices and index the item // go over the indices and index the item
for (int i = 0; i < bis.length; i++) for (int i = 0; i < bis.length; i++)
{ {
if (bis[i].isMetadataIndex()) if (bis[i].isMetadataIndex())
{ {
log.debug("Removing indexing for removed item " + itemID + ", for index: " + bis[i].getTableName()); log.debug("Removing indexing for removed item " + itemID + ", for index: " + bis[i].getTableName());
dao.deleteByItemID(bis[i].getMapTableName(), itemID); dao.deleteByItemID(bis[i].getMapTableName(), itemID);
@@ -628,127 +628,127 @@ public class IndexBrowse
dao.deleteCommunityMappings(itemID); dao.deleteCommunityMappings(itemID);
return true; return true;
} }
/** /**
* Creates Browse indexes, destroying the old ones. * Creates Browse indexes, destroying the old ones.
* *
* @param argv * @param argv
* Command-line arguments * Command-line arguments
*/ */
public static void main(String[] argv) public static void main(String[] argv)
throws SQLException, BrowseException, ParseException throws SQLException, BrowseException, ParseException
{ {
Date startTime = new Date(); Date startTime = new Date();
try try
{ {
Context context = new Context(); Context context = new Context();
context.turnOffAuthorisationSystem(); context.turnOffAuthorisationSystem();
IndexBrowse indexer = new IndexBrowse(context); IndexBrowse indexer = new IndexBrowse(context);
// create an options object and populate it // create an options object and populate it
CommandLineParser parser = new PosixParser(); CommandLineParser parser = new PosixParser();
Options options = new Options(); Options options = new Options();
// these are mutually exclusive, and represent the primary actions // these are mutually exclusive, and represent the primary actions
options.addOption("t", "tables", false, "create the tables only, do not attempt to index. Mutually exclusive with -f and -i"); options.addOption("t", "tables", false, "create the tables only, do not attempt to index. Mutually exclusive with -f and -i");
options.addOption("i", "index", false, "actually do the indexing. Mutually exclusive with -t and -f"); options.addOption("i", "index", false, "actually do the indexing. Mutually exclusive with -t and -f");
options.addOption("f", "full", false, "make the tables, and do the indexing. This forces -x. Mutually exclusive with -t and -i"); options.addOption("f", "full", false, "make the tables, and do the indexing. This forces -x. Mutually exclusive with -t and -i");
// these options can be specified only with the -f option // these options can be specified only with the -f option
options.addOption("r", "rebuild", false, "should we rebuild all the indices, which removes old index tables and creates new ones. For use with -f. Mutually exclusive with -d"); options.addOption("r", "rebuild", false, "should we rebuild all the indices, which removes old index tables and creates new ones. For use with -f. Mutually exclusive with -d");
options.addOption("d", "delete", false, "delete all the indices, but don't create new ones. For use with -f. This is mutually exclusive with -r"); options.addOption("d", "delete", false, "delete all the indices, but don't create new ones. For use with -f. This is mutually exclusive with -r");
// these options can be specified only with the -t and -f options // these options can be specified only with the -t and -f options
options.addOption("o", "out", true, "[-o <filename>] write the remove and create SQL to the given file. For use with -t and -f"); // FIXME: not currently working options.addOption("o", "out", true, "[-o <filename>] write the remove and create SQL to the given file. For use with -t and -f"); // FIXME: not currently working
options.addOption("p", "print", false, "write the remove and create SQL to the stdout. For use with -t and -f"); options.addOption("p", "print", false, "write the remove and create SQL to the stdout. For use with -t and -f");
options.addOption("x", "execute", false, "execute all the remove and create SQL against the database. For use with -t and -f"); options.addOption("x", "execute", false, "execute all the remove and create SQL against the database. For use with -t and -f");
options.addOption("s", "start", true, "[-s <int>] start from this index number and work upward (mostly only useful for debugging). For use with -t and -f"); options.addOption("s", "start", true, "[-s <int>] start from this index number and work upward (mostly only useful for debugging). For use with -t and -f");
// this option can be used with any argument // this option can be used with any argument
options.addOption("v", "verbose", false, "print extra information to the stdout. If used in conjunction with -p, you cannot use the stdout to generate your database structure"); options.addOption("v", "verbose", false, "print extra information to the stdout. If used in conjunction with -p, you cannot use the stdout to generate your database structure");
// display the help. If this is spefified, it trumps all other arguments // display the help. If this is spefified, it trumps all other arguments
options.addOption("h", "help", false, "show this help documentation. Overrides all other arguments"); options.addOption("h", "help", false, "show this help documentation. Overrides all other arguments");
CommandLine line = parser.parse(options, argv); CommandLine line = parser.parse(options, argv);
// display the help // display the help
if (line.hasOption("h")) if (line.hasOption("h"))
{ {
indexer.usage(options); indexer.usage(options);
return; return;
} }
if (line.hasOption("v")) if (line.hasOption("v"))
{ {
indexer.setVerbose(true); indexer.setVerbose(true);
} }
if (line.hasOption("i")) if (line.hasOption("i"))
{ {
indexer.createIndex(); indexer.createIndex();
return; return;
} }
if (line.hasOption("f")) if (line.hasOption("f"))
{ {
if (line.hasOption('r')) if (line.hasOption('r'))
{ {
indexer.setRebuild(true); indexer.setRebuild(true);
} }
else if (line.hasOption("d")) else if (line.hasOption("d"))
{ {
indexer.setDelete(true); indexer.setDelete(true);
} }
} }
if (line.hasOption("f") || line.hasOption("t")) if (line.hasOption("f") || line.hasOption("t"))
{ {
if (line.hasOption("s")) if (line.hasOption("s"))
{ {
indexer.setStart(Integer.parseInt(line.getOptionValue("s"))); indexer.setStart(Integer.parseInt(line.getOptionValue("s")));
} }
if (line.hasOption("x")) if (line.hasOption("x"))
{ {
indexer.setExecute(true); indexer.setExecute(true);
} }
if (line.hasOption("p")) if (line.hasOption("p"))
{ {
indexer.setStdOut(true); indexer.setStdOut(true);
} }
if (line.hasOption("o")) if (line.hasOption("o"))
{ {
indexer.setFileOut(true); indexer.setFileOut(true);
indexer.setOutFile(line.getOptionValue("o")); indexer.setOutFile(line.getOptionValue("o"));
} }
} }
if (line.hasOption("t")) if (line.hasOption("t"))
{ {
indexer.prepTables(); indexer.prepTables();
return; return;
} }
if (line.hasOption("f")) if (line.hasOption("f"))
{ {
indexer.setExecute(true); indexer.setExecute(true);
indexer.initBrowse(); indexer.initBrowse();
return; return;
} }
indexer.usage(options); indexer.usage(options);
context.complete(); context.complete();
} }
finally finally
{ {
Date endTime = new Date(); Date endTime = new Date();
System.out.println("Started: " + startTime.getTime()); System.out.println("Started: " + startTime.getTime());
System.out.println("Ended: " + endTime.getTime()); System.out.println("Ended: " + endTime.getTime());
System.out.println("Elapsed time: " + ((endTime.getTime() - startTime.getTime()) / 1000) + " secs (" + (endTime.getTime() - startTime.getTime()) + " msecs)"); System.out.println("Elapsed time: " + ((endTime.getTime() - startTime.getTime()) / 1000) + " secs (" + (endTime.getTime() - startTime.getTime()) + " msecs)");
} }
} }
/** /**
* output the usage information * output the usage information

View File

@@ -21,50 +21,50 @@ import org.dspace.content.DSpaceObject;
*/ */
public interface ItemCountDAO public interface ItemCountDAO
{ {
/** /**
* Set the DSpace Context to use during data access * Set the DSpace Context to use during data access
* *
* @param context * @param context
* @throws ItemCountException * @throws ItemCountException
*/ */
public void setContext(Context context) throws ItemCountException; public void setContext(Context context) throws ItemCountException;
/** /**
* Set the given count as the number of items in the given community * Set the given count as the number of items in the given community
* *
* @param community * @param community
* @param count * @param count
* @throws ItemCountException * @throws ItemCountException
*/ */
public void communityCount(Community community, int count) throws ItemCountException; public void communityCount(Community community, int count) throws ItemCountException;
/** /**
* Set the given count as the number of items in the given collection * Set the given count as the number of items in the given collection
* *
* @param collection * @param collection
* @param count * @param count
* @throws ItemCountException * @throws ItemCountException
*/ */
public void collectionCount(Collection collection, int count) throws ItemCountException; public void collectionCount(Collection collection, int count) throws ItemCountException;
/** /**
* Get the number of items in the given DSpaceObject container. This method will * Get the number of items in the given DSpaceObject container.
* only succeed if the DSpaceObject is an instance of either a Community or a * This method will only succeed if the DSpaceObject is an instance of
* Collection. Otherwise it will throw an exception * either a Community or a Collection. Otherwise it will throw an
* * exception.
* @param dso *
* @return * @param dso
* @throws ItemCountException * @throws ItemCountException
*/ */
public int getCount(DSpaceObject dso) throws ItemCountException; public int getCount(DSpaceObject dso) throws ItemCountException;
/** /**
* Remove any cached data regarding the given DSpaceObject container. This method will * Remove any cached data regarding the given DSpaceObject container. This method will
* only succeed if the DSpaceObject is an instance of either a Community or a * only succeed if the DSpaceObject is an instance of either a Community or a
* Collection. Otherwise it will throw an exception * Collection. Otherwise it will throw an exception
* *
* @param dso * @param dso
* @throws ItemCountException * @throws ItemCountException
*/ */
public void remove(DSpaceObject dso) throws ItemCountException; public void remove(DSpaceObject dso) throws ItemCountException;
} }

View File

@@ -19,33 +19,32 @@ import org.dspace.core.ConfigurationManager;
*/ */
public class ItemCountDAOFactory public class ItemCountDAOFactory
{ {
/** /**
* Get an instance of ItemCountDAO which supports the correct database * Get an instance of ItemCountDAO which supports the correct database
* for the specific DSpace instance. * for the specific DSpace instance.
* *
* @param context * @param context
* @return * @throws ItemCountException
* @throws ItemCountException */
*/ public static ItemCountDAO getInstance(Context context)
public static ItemCountDAO getInstance(Context context) throws ItemCountException
throws ItemCountException {
{ String db = ConfigurationManager.getProperty("db.name");
String db = ConfigurationManager.getProperty("db.name"); ItemCountDAO dao;
ItemCountDAO dao; if ("postgres".equals(db))
if ("postgres".equals(db)) {
{ dao = new ItemCountDAOPostgres();
dao = new ItemCountDAOPostgres(); }
} else if ("oracle".equals(db))
else if ("oracle".equals(db)) {
{ dao = new ItemCountDAOOracle();
dao = new ItemCountDAOOracle(); }
} else
else {
{ throw new ItemCountException("Database type: " + db + " is not currently supported");
throw new ItemCountException("Database type: " + db + " is not currently supported"); }
}
dao.setContext(context);
dao.setContext(context); return dao;
return dao; }
}
} }

View File

@@ -28,305 +28,303 @@ import java.sql.SQLException;
*/ */
public class ItemCountDAOOracle implements ItemCountDAO public class ItemCountDAOOracle implements ItemCountDAO
{ {
/** Log4j logger */ /** Log4j logger */
private static Logger log = Logger.getLogger(ItemCountDAOOracle.class); private static Logger log = Logger.getLogger(ItemCountDAOOracle.class);
/** DSpace context */ /** DSpace context */
private Context context; private Context context;
/** SQL to select on a collection id */ /** SQL to select on a collection id */
private String collectionSelect = "SELECT * FROM collection_item_count WHERE collection_id = ?"; private String collectionSelect = "SELECT * FROM collection_item_count WHERE collection_id = ?";
/** SQL to insert a new collection record */
private String collectionInsert = "INSERT INTO collection_item_count (collection_id, count) VALUES (?, ?)";
/** SQL to insert a new collection record */ /** SQL to update an existing collection record */
private String collectionInsert = "INSERT INTO collection_item_count (collection_id, count) VALUES (?, ?)"; private String collectionUpdate = "UPDATE collection_item_count SET count = ? WHERE collection_id = ?";
/** SQL to update an existing collection record */ /** SQL to remove a collection record */
private String collectionUpdate = "UPDATE collection_item_count SET count = ? WHERE collection_id = ?"; private String collectionRemove = "DELETE FROM collection_item_count WHERE collection_id = ?";
/** SQL to remove a collection record */ /** SQL to select on a community id */
private String collectionRemove = "DELETE FROM collection_item_count WHERE collection_id = ?"; private String communitySelect = "SELECT * FROM community_item_count WHERE community_id = ?";
/** SQL to select on a community id */ /** SQL to insert a new community record */
private String communitySelect = "SELECT * FROM community_item_count WHERE community_id = ?"; private String communityInsert = "INSERT INTO community_item_count (community_id, count) VALUES (?, ?)";
/** SQL to insert a new community record */ /** SQL to update an existing community record */
private String communityInsert = "INSERT INTO community_item_count (community_id, count) VALUES (?, ?)"; private String communityUpdate = "UPDATE community_item_count SET count = ? WHERE community_id = ?";
/** SQL to update an existing community record */ /** SQL to remove a community record */
private String communityUpdate = "UPDATE community_item_count SET count = ? WHERE community_id = ?"; private String communityRemove = "DELETE FROM community_item_count WHERE community_id = ?";
/** SQL to remove a community record */ /**
private String communityRemove = "DELETE FROM community_item_count WHERE community_id = ?"; * Store the count of the given collection
*
/** * @param collection
* Store the count of the given collection * @param count
* * @throws ItemCountException
* @param collection */
* @param count public void collectionCount(Collection collection, int count)
* @throws ItemCountException throws ItemCountException
*/ {
public void collectionCount(Collection collection, int count)
throws ItemCountException
{
TableRowIterator tri = null; TableRowIterator tri = null;
try try
{ {
// first find out if we have a record // first find out if we have a record
Object[] sparams = { Integer.valueOf(collection.getID()) }; Object[] sparams = { Integer.valueOf(collection.getID()) };
tri = DatabaseManager.query(context, collectionSelect, sparams); tri = DatabaseManager.query(context, collectionSelect, sparams);
if (tri.hasNext())
{
Object[] params = { Integer.valueOf(count), Integer.valueOf(collection.getID()) };
DatabaseManager.updateQuery(context, collectionUpdate, params);
}
else
{
Object[] params = { Integer.valueOf(collection.getID()), Integer.valueOf(count) };
DatabaseManager.updateQuery(context, collectionInsert, params);
}
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
finally
{
if (tri != null)
{
tri.close();
}
}
}
/** if (tri.hasNext())
* Store the count of the given community {
* Object[] params = { Integer.valueOf(count), Integer.valueOf(collection.getID()) };
* @param community DatabaseManager.updateQuery(context, collectionUpdate, params);
* @param count }
* @throws ItemCountException
*/
public void communityCount(Community community, int count)
throws ItemCountException
{
TableRowIterator tri = null;
try
{
// first find out if we have a record
Object[] sparams = { Integer.valueOf(community.getID()) };
tri = DatabaseManager.query(context, communitySelect, sparams);
if (tri.hasNext())
{
Object[] params = { Integer.valueOf(count), Integer.valueOf(community.getID()) };
DatabaseManager.updateQuery(context, communityUpdate, params);
}
else
{
Object[] params = { Integer.valueOf(community.getID()), Integer.valueOf(count) };
DatabaseManager.updateQuery(context, communityInsert, params);
}
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
finally
{
if (tri != null)
{
tri.close();
}
}
}
/**
* Set the dspace context to use
*
* @param context
* @throws ItemCountException
*/
public void setContext(Context context)
throws ItemCountException
{
this.context = context;
}
/**
* get the count of the items in the given container
*
* @param dso
* @return
* @throws ItemCountException
*/
public int getCount(DSpaceObject dso)
throws ItemCountException
{
if (dso instanceof Collection)
{
return getCollectionCount((Collection) dso);
}
else if (dso instanceof Community)
{
return getCommunityCount((Community) dso);
}
else else
{ {
throw new ItemCountException("We can only count items in Communities or Collections"); Object[] params = { Integer.valueOf(collection.getID()), Integer.valueOf(count) };
} DatabaseManager.updateQuery(context, collectionInsert, params);
} }
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
finally
{
if (tri != null)
{
tri.close();
}
}
}
/** /**
* remove the cache for the given container * Store the count of the given community
* *
* @param dso * @param community
* @throws ItemCountException * @param count
*/ * @throws ItemCountException
public void remove(DSpaceObject dso) throws ItemCountException */
{ public void communityCount(Community community, int count)
if (dso instanceof Collection) throws ItemCountException
{ {
removeCollection((Collection) dso);
}
else if (dso instanceof Community)
{
removeCommunity((Community) dso);
}
else
{
throw new ItemCountException("We can only delete count of items from Communities or Collections");
}
}
/**
* remove the cache for the given collection
*
* @param collection
* @throws ItemCountException
*/
private void removeCollection(Collection collection)
throws ItemCountException
{
try
{
Object[] params = { Integer.valueOf(collection.getID()) };
DatabaseManager.updateQuery(context, collectionRemove, params);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
/**
* Remove the cache for the given community
*
* @param community
* @throws ItemCountException
*/
private void removeCommunity(Community community)
throws ItemCountException
{
try
{
Object[] params = { Integer.valueOf(community.getID()) };
DatabaseManager.updateQuery(context, communityRemove, params);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
/**
* Get the count for the given collection
*
* @param collection
* @return
* @throws ItemCountException
*/
private int getCollectionCount(Collection collection)
throws ItemCountException
{
TableRowIterator tri = null; TableRowIterator tri = null;
try try
{ {
Object[] params = { Integer.valueOf(collection.getID()) }; // first find out if we have a record
tri = DatabaseManager.query(context, collectionSelect, params); Object[] sparams = { Integer.valueOf(community.getID()) };
tri = DatabaseManager.query(context, communitySelect, sparams);
if (!tri.hasNext())
{
return 0;
}
TableRow tr = tri.next();
if (tri.hasNext())
{
throw new ItemCountException("More than one count row in the database");
}
return tr.getIntColumn("count"); if (tri.hasNext())
} {
catch (SQLException e) Object[] params = { Integer.valueOf(count), Integer.valueOf(community.getID()) };
{ DatabaseManager.updateQuery(context, communityUpdate, params);
log.error("caught exception: ", e); }
throw new ItemCountException(e); else
} {
Object[] params = { Integer.valueOf(community.getID()), Integer.valueOf(count) };
DatabaseManager.updateQuery(context, communityInsert, params);
}
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
finally finally
{ {
if (tri != null) if (tri != null)
{ {
tri.close(); tri.close();
} }
} }
}
/**
* Set the dspace context to use
*
* @param context
* @throws ItemCountException
*/
public void setContext(Context context)
throws ItemCountException
{
this.context = context;
}
/**
* get the count of the items in the given container.
*
* @param dso
* @throws ItemCountException
*/
public int getCount(DSpaceObject dso)
throws ItemCountException
{
if (dso instanceof Collection)
{
return getCollectionCount((Collection) dso);
}
else if (dso instanceof Community)
{
return getCommunityCount((Community) dso);
}
else
{
throw new ItemCountException("We can only count items in Communities or Collections");
}
}
/**
* remove the cache for the given container
*
* @param dso
* @throws ItemCountException
*/
public void remove(DSpaceObject dso) throws ItemCountException
{
if (dso instanceof Collection)
{
removeCollection((Collection) dso);
}
else if (dso instanceof Community)
{
removeCommunity((Community) dso);
}
else
{
throw new ItemCountException("We can only delete count of items from Communities or Collections");
}
}
/**
* remove the cache for the given collection
*
* @param collection
* @throws ItemCountException
*/
private void removeCollection(Collection collection)
throws ItemCountException
{
try
{
Object[] params = { Integer.valueOf(collection.getID()) };
DatabaseManager.updateQuery(context, collectionRemove, params);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
} }
/** /**
* get the count for the given community * Remove the cache for the given community
* *
* @param community * @param community
* @return * @throws ItemCountException
* @throws ItemCountException */
*/ private void removeCommunity(Community community)
private int getCommunityCount(Community community) throws ItemCountException
throws ItemCountException {
{ try
{
Object[] params = { Integer.valueOf(community.getID()) };
DatabaseManager.updateQuery(context, communityRemove, params);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
/**
* Get the count for the given collection
*
* @param collection
* @return
* @throws ItemCountException
*/
private int getCollectionCount(Collection collection)
throws ItemCountException
{
TableRowIterator tri = null; TableRowIterator tri = null;
try try
{ {
Object[] params = { Integer.valueOf(community.getID()) }; Object[] params = { Integer.valueOf(collection.getID()) };
tri = DatabaseManager.query(context, communitySelect, params); tri = DatabaseManager.query(context, collectionSelect, params);
if (!tri.hasNext())
{
return 0;
}
TableRow tr = tri.next();
if (tri.hasNext())
{
throw new ItemCountException("More than one count row in the database");
}
return tr.getIntColumn("count"); if (!tri.hasNext())
} {
catch (SQLException e) return 0;
{ }
log.error("caught exception: ", e);
throw new ItemCountException(e); TableRow tr = tri.next();
}
if (tri.hasNext())
{
throw new ItemCountException("More than one count row in the database");
}
return tr.getIntColumn("count");
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
finally finally
{ {
if (tri != null) if (tri != null)
{ {
tri.close(); tri.close();
} }
} }
}
/**
* get the count for the given community
*
* @param community
* @throws ItemCountException
*/
private int getCommunityCount(Community community)
throws ItemCountException
{
TableRowIterator tri = null;
try
{
Object[] params = { Integer.valueOf(community.getID()) };
tri = DatabaseManager.query(context, communitySelect, params);
if (!tri.hasNext())
{
return 0;
}
TableRow tr = tri.next();
if (tri.hasNext())
{
throw new ItemCountException("More than one count row in the database");
}
return tr.getIntColumn("count");
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
finally
{
if (tri != null)
{
tri.close();
}
}
} }
} }

View File

@@ -28,305 +28,302 @@ import java.sql.SQLException;
*/ */
public class ItemCountDAOPostgres implements ItemCountDAO public class ItemCountDAOPostgres implements ItemCountDAO
{ {
/** Log4j logger */ /** Log4j logger */
private static Logger log = Logger.getLogger(ItemCountDAOPostgres.class); private static Logger log = Logger.getLogger(ItemCountDAOPostgres.class);
/** DSpace context */ /** DSpace context */
private Context context; private Context context;
/** SQL to select on a collection id */ /** SQL to select on a collection id */
private String collectionSelect = "SELECT * FROM collection_item_count WHERE collection_id = ?"; private String collectionSelect = "SELECT * FROM collection_item_count WHERE collection_id = ?";
/** SQL to insert a new collection record */ /** SQL to insert a new collection record */
private String collectionInsert = "INSERT INTO collection_item_count (collection_id, count) VALUES (?, ?)"; private String collectionInsert = "INSERT INTO collection_item_count (collection_id, count) VALUES (?, ?)";
/** SQL to update an existing collection record */ /** SQL to update an existing collection record */
private String collectionUpdate = "UPDATE collection_item_count SET count = ? WHERE collection_id = ?"; private String collectionUpdate = "UPDATE collection_item_count SET count = ? WHERE collection_id = ?";
/** SQL to remove a collection record */ /** SQL to remove a collection record */
private String collectionRemove = "DELETE FROM collection_item_count WHERE collection_id = ?"; private String collectionRemove = "DELETE FROM collection_item_count WHERE collection_id = ?";
/** SQL to select on a community id */ /** SQL to select on a community id */
private String communitySelect = "SELECT * FROM community_item_count WHERE community_id = ?"; private String communitySelect = "SELECT * FROM community_item_count WHERE community_id = ?";
/** SQL to insert a new community record */ /** SQL to insert a new community record */
private String communityInsert = "INSERT INTO community_item_count (community_id, count) VALUES (?, ?)"; private String communityInsert = "INSERT INTO community_item_count (community_id, count) VALUES (?, ?)";
/** SQL to update an existing community record */ /** SQL to update an existing community record */
private String communityUpdate = "UPDATE community_item_count SET count = ? WHERE community_id = ?"; private String communityUpdate = "UPDATE community_item_count SET count = ? WHERE community_id = ?";
/** SQL to remove a community record */ /** SQL to remove a community record */
private String communityRemove = "DELETE FROM community_item_count WHERE community_id = ?"; private String communityRemove = "DELETE FROM community_item_count WHERE community_id = ?";
/** /**
* Store the count of the given collection * Store the count of the given collection
* *
* @param collection * @param collection
* @param count * @param count
* @throws ItemCountException * @throws ItemCountException
*/ */
public void collectionCount(Collection collection, int count) public void collectionCount(Collection collection, int count)
throws ItemCountException throws ItemCountException
{ {
TableRowIterator tri = null; TableRowIterator tri = null;
try try
{ {
// first find out if we have a record // first find out if we have a record
Object[] sparams = { Integer.valueOf(collection.getID()) }; Object[] sparams = { Integer.valueOf(collection.getID()) };
tri = DatabaseManager.query(context, collectionSelect, sparams); tri = DatabaseManager.query(context, collectionSelect, sparams);
if (tri.hasNext())
{
Object[] params = { Integer.valueOf(count), Integer.valueOf(collection.getID()) };
DatabaseManager.updateQuery(context, collectionUpdate, params);
}
else
{
Object[] params = { Integer.valueOf(collection.getID()), Integer.valueOf(count) };
DatabaseManager.updateQuery(context, collectionInsert, params);
}
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
finally
{
if (tri != null)
{
tri.close();
}
}
}
/** if (tri.hasNext())
* Store the count of the given community {
* Object[] params = { Integer.valueOf(count), Integer.valueOf(collection.getID()) };
* @param community DatabaseManager.updateQuery(context, collectionUpdate, params);
* @param count }
* @throws ItemCountException
*/
public void communityCount(Community community, int count)
throws ItemCountException
{
TableRowIterator tri = null;
try
{
// first find out if we have a record
Object[] sparams = { Integer.valueOf(community.getID()) };
tri = DatabaseManager.query(context, communitySelect, sparams);
if (tri.hasNext())
{
Object[] params = { Integer.valueOf(count), Integer.valueOf(community.getID()) };
DatabaseManager.updateQuery(context, communityUpdate, params);
}
else
{
Object[] params = { Integer.valueOf(community.getID()), Integer.valueOf(count) };
DatabaseManager.updateQuery(context, communityInsert, params);
}
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
finally
{
if (tri != null)
{
tri.close();
}
}
}
/**
* Set the dspace context to use
*
* @param context
* @throws ItemCountException
*/
public void setContext(Context context)
throws ItemCountException
{
this.context = context;
}
/**
* get the count of the items in the given container
*
* @param dso
* @return
* @throws ItemCountException
*/
public int getCount(DSpaceObject dso)
throws ItemCountException
{
if (dso instanceof Collection)
{
return getCollectionCount((Collection) dso);
}
else if (dso instanceof Community)
{
return getCommunityCount((Community) dso);
}
else else
{ {
throw new ItemCountException("We can only count items in Communities or Collections"); Object[] params = { Integer.valueOf(collection.getID()), Integer.valueOf(count) };
} DatabaseManager.updateQuery(context, collectionInsert, params);
} }
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
finally
{
if (tri != null)
{
tri.close();
}
}
}
/** /**
* remove the cache for the given container * Store the count of the given community
* *
* @param dso * @param community
* @throws ItemCountException * @param count
*/ * @throws ItemCountException
public void remove(DSpaceObject dso) throws ItemCountException */
{ public void communityCount(Community community, int count)
if (dso instanceof Collection) throws ItemCountException
{ {
removeCollection((Collection) dso);
}
else if (dso instanceof Community)
{
removeCommunity((Community) dso);
}
else
{
throw new ItemCountException("We can only delete count of items from Communities or Collections");
}
}
/**
* remove the cache for the given collection
*
* @param collection
* @throws ItemCountException
*/
private void removeCollection(Collection collection)
throws ItemCountException
{
try
{
Object[] params = { Integer.valueOf(collection.getID()) };
DatabaseManager.updateQuery(context, collectionRemove, params);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
/**
* Remove the cache for the given community
*
* @param community
* @throws ItemCountException
*/
private void removeCommunity(Community community)
throws ItemCountException
{
try
{
Object[] params = { Integer.valueOf(community.getID()) };
DatabaseManager.updateQuery(context, communityRemove, params);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
/**
* Get the count for the given collection
*
* @param collection
* @return
* @throws ItemCountException
*/
private int getCollectionCount(Collection collection)
throws ItemCountException
{
TableRowIterator tri = null; TableRowIterator tri = null;
try try
{ {
Object[] params = { Integer.valueOf(collection.getID()) }; // first find out if we have a record
tri = DatabaseManager.query(context, collectionSelect, params); Object[] sparams = { Integer.valueOf(community.getID()) };
tri = DatabaseManager.query(context, communitySelect, sparams);
if (!tri.hasNext())
{
return 0;
}
TableRow tr = tri.next();
if (tri.hasNext())
{
throw new ItemCountException("More than one count row in the database");
}
return tr.getIntColumn("count"); if (tri.hasNext())
} {
catch (SQLException e) Object[] params = { Integer.valueOf(count), Integer.valueOf(community.getID()) };
{ DatabaseManager.updateQuery(context, communityUpdate, params);
log.error("caught exception: ", e); }
throw new ItemCountException(e); else
} {
Object[] params = { Integer.valueOf(community.getID()), Integer.valueOf(count) };
DatabaseManager.updateQuery(context, communityInsert, params);
}
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
finally finally
{ {
if (tri != null) if (tri != null)
{ {
tri.close(); tri.close();
} }
} }
}
/**
* Set the dspace context to use
*
* @param context
* @throws ItemCountException
*/
public void setContext(Context context)
throws ItemCountException
{
this.context = context;
}
/**
* get the count of the items in the given container
*
* @param dso
* @throws ItemCountException
*/
public int getCount(DSpaceObject dso)
throws ItemCountException
{
if (dso instanceof Collection)
{
return getCollectionCount((Collection) dso);
}
else if (dso instanceof Community)
{
return getCommunityCount((Community) dso);
}
else
{
throw new ItemCountException("We can only count items in Communities or Collections");
}
}
/**
* remove the cache for the given container
*
* @param dso
* @throws ItemCountException
*/
public void remove(DSpaceObject dso) throws ItemCountException
{
if (dso instanceof Collection)
{
removeCollection((Collection) dso);
}
else if (dso instanceof Community)
{
removeCommunity((Community) dso);
}
else
{
throw new ItemCountException("We can only delete count of items from Communities or Collections");
}
}
/**
* remove the cache for the given collection
*
* @param collection
* @throws ItemCountException
*/
private void removeCollection(Collection collection)
throws ItemCountException
{
try
{
Object[] params = { Integer.valueOf(collection.getID()) };
DatabaseManager.updateQuery(context, collectionRemove, params);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
} }
/** /**
* get the count for the given community * Remove the cache for the given community
* *
* @param community * @param community
* @return * @throws ItemCountException
* @throws ItemCountException */
*/ private void removeCommunity(Community community)
private int getCommunityCount(Community community) throws ItemCountException
throws ItemCountException {
{ try
{
Object[] params = { Integer.valueOf(community.getID()) };
DatabaseManager.updateQuery(context, communityRemove, params);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
/**
* Get the count for the given collection
*
* @param collection
* @throws ItemCountException
*/
private int getCollectionCount(Collection collection)
throws ItemCountException
{
TableRowIterator tri = null; TableRowIterator tri = null;
try try
{ {
Object[] params = { Integer.valueOf(community.getID()) }; Object[] params = { Integer.valueOf(collection.getID()) };
tri = DatabaseManager.query(context, communitySelect, params); tri = DatabaseManager.query(context, collectionSelect, params);
if (!tri.hasNext())
{
return 0;
}
TableRow tr = tri.next();
if (tri.hasNext())
{
throw new ItemCountException("More than one count row in the database");
}
return tr.getIntColumn("count"); if (!tri.hasNext())
} {
catch (SQLException e) return 0;
{ }
log.error("caught exception: ", e);
throw new ItemCountException(e); TableRow tr = tri.next();
}
if (tri.hasNext())
{
throw new ItemCountException("More than one count row in the database");
}
return tr.getIntColumn("count");
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
finally finally
{ {
if (tri != null) if (tri != null)
{ {
tri.close(); tri.close();
} }
} }
}
/**
* get the count for the given community
*
* @param community
* @throws ItemCountException
*/
private int getCommunityCount(Community community)
throws ItemCountException
{
TableRowIterator tri = null;
try
{
Object[] params = { Integer.valueOf(community.getID()) };
tri = DatabaseManager.query(context, communitySelect, params);
if (!tri.hasNext())
{
return 0;
}
TableRow tr = tri.next();
if (tri.hasNext())
{
throw new ItemCountException("More than one count row in the database");
}
return tr.getIntColumn("count");
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
finally
{
if (tri != null)
{
tri.close();
}
}
} }
} }

View File

@@ -33,187 +33,185 @@ import java.sql.SQLException;
*/ */
public class ItemCounter public class ItemCounter
{ {
/** Log4j logger */ /** Log4j logger */
private static Logger log = Logger.getLogger(ItemCounter.class); private static Logger log = Logger.getLogger(ItemCounter.class);
/** DAO to use to store and retrieve data */ /** DAO to use to store and retrieve data */
private ItemCountDAO dao; private ItemCountDAO dao;
/** DSpace Context */ /** DSpace Context */
private Context context; private Context context;
/** /**
* method invoked by CLI which will result in the number of items * method invoked by CLI which will result in the number of items
* in each community and collection being cached. These counts will * in each community and collection being cached. These counts will
* not update themselves until this is run again. * not update themselves until this is run again.
* *
* @param args * @param args
*/ */
public static void main(String[] args) public static void main(String[] args)
throws ItemCountException, SQLException throws ItemCountException, SQLException
{ {
Context context = new Context(); Context context = new Context();
ItemCounter ic = new ItemCounter(context); ItemCounter ic = new ItemCounter(context);
ic.buildItemCounts(); ic.buildItemCounts();
context.complete(); context.complete();
} }
/** /**
* Construct a new item counter which will use the give DSpace Context * Construct a new item counter which will use the give DSpace Context
* *
* @param context * @param context
* @throws ItemCountException * @throws ItemCountException
*/ */
public ItemCounter(Context context) public ItemCounter(Context context)
throws ItemCountException throws ItemCountException
{
{ this.context = context;
this.context = context; this.dao = ItemCountDAOFactory.getInstance(this.context);
this.dao = ItemCountDAOFactory.getInstance(this.context); }
}
/** /**
* This method does the grunt work of drilling through and iterating * This method does the grunt work of drilling through and iterating
* over all of the communities and collections in the system and * over all of the communities and collections in the system and
* obtaining and caching the item counts for each one. * obtaining and caching the item counts for each one.
* *
* @throws ItemCountException * @throws ItemCountException
*/ */
public void buildItemCounts() public void buildItemCounts()
throws ItemCountException throws ItemCountException
{ {
try try
{ {
Community[] tlc = Community.findAllTop(context); Community[] tlc = Community.findAllTop(context);
for (int i = 0; i < tlc.length; i++) for (int i = 0; i < tlc.length; i++)
{ {
count(tlc[i]); count(tlc[i]);
} }
} }
catch (SQLException e) catch (SQLException e)
{ {
log.error("caught exception: ", e); log.error("caught exception: ", e);
throw new ItemCountException(e); throw new ItemCountException(e);
} }
} }
/** /**
* Get the count of the items in the given container. If the configuration * Get the count of the items in the given container. If the configuration
* value webui.strengths.cache is equal to 'true' this will return the * value webui.strengths.cache is equal to 'true' this will return the
* cached value if it exists. If it is equal to 'false' it will count * cached value if it exists. If it is equal to 'false' it will count
* the number of items in the container in real time * the number of items in the container in real time
* *
* @param dso * @param dso
* @return * @throws ItemCountException
* @throws ItemCountException * @throws SQLException
* @throws SQLException */
*/ public int getCount(DSpaceObject dso)
public int getCount(DSpaceObject dso) throws ItemCountException
throws ItemCountException {
{ boolean useCache = ConfigurationManager.getBooleanProperty("webui.strengths.cache");
boolean useCache = ConfigurationManager.getBooleanProperty("webui.strengths.cache");
if (useCache)
if (useCache) {
{ return dao.getCount(dso);
return dao.getCount(dso); }
// if we make it this far, we need to manually count
if (dso instanceof Collection)
{
try {
return ((Collection) dso).countItems();
} catch (SQLException e) {
log.error("caught exception: ", e);
throw new ItemCountException(e);
} }
}
// if we make it this far, we need to manually count
if (dso instanceof Collection) if (dso instanceof Community)
{ {
try { try {
return ((Collection) dso).countItems(); return ((Community) dso).countItems();
} catch (SQLException e) { } catch (SQLException e) {
log.error("caught exception: ", e); log.error("caught exception: ", e);
throw new ItemCountException(e); throw new ItemCountException(e);
}
} }
}
if (dso instanceof Community)
{ return 0;
try { }
return ((Community) dso).countItems();
} catch (SQLException e) {
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
return 0;
}
/** /**
* Remove any cached data for the given container * Remove any cached data for the given container
* *
* @param dso * @param dso
* @throws ItemCountException * @throws ItemCountException
*/ */
public void remove(DSpaceObject dso) public void remove(DSpaceObject dso)
throws ItemCountException throws ItemCountException
{ {
dao.remove(dso); dao.remove(dso);
} }
/** /**
* count and cache the number of items in the community. This * count and cache the number of items in the community. This
* will include all sub-communities and collections in the * will include all sub-communities and collections in the
* community. It will also recurse into sub-communities and * community. It will also recurse into sub-communities and
* collections and call count() on them also. * collections and call count() on them also.
* *
* Therefore, the count the contents of the entire system, it is * Therefore, the count the contents of the entire system, it is
* necessary just to call this method on each top level community * necessary just to call this method on each top level community
* *
* @param community * @param community
* @throws ItemCountException * @throws ItemCountException
*/ */
private void count(Community community) private void count(Community community)
throws ItemCountException throws ItemCountException
{ {
try try
{ {
// first count the community we are in // first count the community we are in
int count = community.countItems(); int count = community.countItems();
dao.communityCount(community, count); dao.communityCount(community, count);
// now get the sub-communities // now get the sub-communities
Community[] scs = community.getSubcommunities(); Community[] scs = community.getSubcommunities();
for (int i = 0; i < scs.length; i++) for (int i = 0; i < scs.length; i++)
{ {
count(scs[i]); count(scs[i]);
} }
// now get the collections // now get the collections
Collection[] cols = community.getCollections(); Collection[] cols = community.getCollections();
for (int i = 0; i < cols.length; i++) for (int i = 0; i < cols.length; i++)
{ {
count(cols[i]); count(cols[i]);
} }
} }
catch (SQLException e) catch (SQLException e)
{ {
log.error("caught exception: ", e); log.error("caught exception: ", e);
throw new ItemCountException(e); throw new ItemCountException(e);
} }
} }
/** /**
* count and cache the number of items in the given collection * count and cache the number of items in the given collection
* *
* @param collection * @param collection
* @throws ItemCountException * @throws ItemCountException
*/ */
private void count(Collection collection) private void count(Collection collection)
throws ItemCountException throws ItemCountException
{ {
try try
{ {
int ccount = collection.countItems(); int ccount = collection.countItems();
dao.collectionCount(collection, ccount); dao.collectionCount(collection, ccount);
} }
catch (SQLException e) catch (SQLException e)
{ {
log.error("caught exception: ", e); log.error("caught exception: ", e);
throw new ItemCountException(e); throw new ItemCountException(e);
} }
} }
} }

View File

@@ -22,90 +22,89 @@ import org.dspace.core.ConfigurationManager;
*/ */
public class ItemListConfig public class ItemListConfig
{ {
/** a map of column number to metadata value */ /** a map of column number to metadata value */
private Map<Integer, String[]> metadata = new HashMap<Integer, String[]>(); private Map<Integer, String[]> metadata = new HashMap<Integer, String[]>();
/** a map of column number to data type */ /** a map of column number to data type */
private Map<Integer, Integer> types = new HashMap<Integer, Integer>(); private Map<Integer, Integer> types = new HashMap<Integer, Integer>();
/** constant for a DATE column */ /** constant for a DATE column */
private static final int DATE = 1; private static final int DATE = 1;
/** constant for a TEXT column */ /** constant for a TEXT column */
private static final int TEXT = 2; private static final int TEXT = 2;
/** /**
* Create a new instance of the Item list configuration. This loads * Create a new instance of the Item list configuration. This loads
* all the required information from configuration * all the required information from configuration
* *
* @throws BrowseException * @throws BrowseException
*/ */
public ItemListConfig() public ItemListConfig()
throws BrowseException throws BrowseException
{ {
try try
{ {
String configLine = ConfigurationManager.getProperty("webui.itemlist.columns"); String configLine = ConfigurationManager.getProperty("webui.itemlist.columns");
if (configLine == null || "".equals(configLine))
{
throw new BrowseException("There is no configuration for webui.itemlist.columns");
}
// parse the config
StringTokenizer st = new StringTokenizer(configLine, ",");
int i = 1;
while (st.hasMoreTokens())
{
Integer key = Integer.valueOf(i);
String token = st.nextToken();
// find out if the field is a date
if (token.indexOf("(date)") > 0)
{
token = token.replaceAll("\\(date\\)", "");
types.put(key, Integer.valueOf(ItemListConfig.DATE));
}
else
{
types.put(key, Integer.valueOf(ItemListConfig.TEXT));
}
String[] mdBits = interpretField(token.trim(), null);
metadata.put(key, mdBits);
// don't forget to increment the key counter
i++;
}
}
catch (IOException e)
{
throw new BrowseException(e);
}
}
/** if (configLine == null || "".equals(configLine))
* how many columns are there? {
* throw new BrowseException("There is no configuration for webui.itemlist.columns");
* @return the number of columns }
*/
public int numCols() // parse the config
{ StringTokenizer st = new StringTokenizer(configLine, ",");
return metadata.size(); int i = 1;
} while (st.hasMoreTokens())
{
Integer key = Integer.valueOf(i);
String token = st.nextToken();
// find out if the field is a date
if (token.indexOf("(date)") > 0)
{
token = token.replaceAll("\\(date\\)", "");
types.put(key, Integer.valueOf(ItemListConfig.DATE));
}
else
{
types.put(key, Integer.valueOf(ItemListConfig.TEXT));
}
String[] mdBits = interpretField(token.trim(), null);
metadata.put(key, mdBits);
// don't forget to increment the key counter
i++;
}
}
catch (IOException e)
{
throw new BrowseException(e);
}
}
/**
* how many columns are there?
*
* @return the number of columns
*/
public int numCols()
{
return metadata.size();
}
/** /**
* what metadata is to go in the given column number * what metadata is to go in the given column number
* *
* @param col * @param col
* @return */
*/ public String[] getMetadata(int col)
public String[] getMetadata(int col) {
{ return metadata.get(Integer.valueOf(col));
return metadata.get(Integer.valueOf(col)); }
}
/**
/**
* Take a string representation of a metadata field, and return it as an array. * Take a string representation of a metadata field, and return it as an array.
* This is just a convenient utility method to basically break the metadata * This is just a convenient utility method to basically break the metadata
* representation up by its delimiter (.), and stick it in an array, inserting * representation up by its delimiter (.), and stick it in an array, inserting

View File

@@ -176,8 +176,6 @@ public class ChecksumHistory
/** /**
* Return the processing result. * Return the processing result.
*
* @return
*/ */
public String getResult() public String getResult()
{ {

View File

@@ -110,7 +110,6 @@ public final class ResultsPruner
* properties. * properties.
* *
* @param props * @param props
* @return
* @throws FileNotFoundException * @throws FileNotFoundException
*/ */
public static ResultsPruner getPruner(Properties props) public static ResultsPruner getPruner(Properties props)

View File

@@ -686,9 +686,11 @@ public class Bitstream extends DSpaceObject
} }
/** /**
* Get the parent object of a bitstream. It can either be an item if this is a normal * Get the parent object of a bitstream. The parent can be an item if this
* bitstream, otherwise it could be a collection or a community if it is a logo. * is a normal bitstream, or it could be a collection or a community if the
* @return * bitstream is a logo.
*
* @return this bitstream's parent.
* @throws SQLException * @throws SQLException
*/ */
public DSpaceObject getParentObject() throws SQLException public DSpaceObject getParentObject() throws SQLException

View File

@@ -32,8 +32,8 @@ public class LicenseUtils
* Return the text of the license that the user has granted/must grant * Return the text of the license that the user has granted/must grant
* before for submit the item. The license text is build using the template * before for submit the item. The license text is build using the template
* defined for the collection if any or the wide site configuration. In the * defined for the collection if any or the wide site configuration. In the
* license text the following substitution can be used. {0} the eperson * license text the following substitutions can be used.<br>
* firstname<br> * {0} the eperson firstname<br>
* {1} the eperson lastname<br> * {1} the eperson lastname<br>
* {2} the eperson email<br> * {2} the eperson email<br>
* {3} the current date<br> * {3} the current date<br>
@@ -46,7 +46,7 @@ public class LicenseUtils
* {x} any addition argument supplied wrapped in the * {x} any addition argument supplied wrapped in the
* LicenseArgumentFormatter based on his type (map key) * LicenseArgumentFormatter based on his type (map key)
* *
* @see LicenseArgumentFormatter * @see license.LicenseArgumentFormatter
* @param locale * @param locale
* @param collection * @param collection
* @param item * @param item
@@ -90,15 +90,15 @@ public class LicenseUtils
} }
/** /**
* Utility method if no additional arguments has need to be supplied to the * Utility method if no additional arguments are to be supplied to the
* license template. (i.e. call the full getLicenseText supplying * license template. (equivalent to calling the full getLicenseText
* <code>null</code> for the additionalInfo argument) * supplying {@code null} for the additionalInfo argument)
* *
* @param locale * @param locale
* @param collection * @param collection
* @param item * @param item
* @param eperson * @param eperson
* @return * @return the license text, with no custom substitutions.
*/ */
public static String getLicenseText(Locale locale, Collection collection, public static String getLicenseText(Locale locale, Collection collection,
Item item, EPerson eperson) Item item, EPerson eperson)

View File

@@ -661,7 +661,7 @@ public class MetadataField
* Return <code>true</code> if <code>other</code> is the same MetadataField * Return <code>true</code> if <code>other</code> is the same MetadataField
* as this object, <code>false</code> otherwise * as this object, <code>false</code> otherwise
* *
* @param other * @param obj
* object to compare to * object to compare to
* *
* @return <code>true</code> if object passed in represents the same * @return <code>true</code> if object passed in represents the same

View File

@@ -213,11 +213,11 @@ public abstract class AbstractMETSDisseminator
* a failure creating the package. * a failure creating the package.
* *
* @param context DSpace context. * @param context DSpace context.
* @param object DSpace object (item, collection, etc) * @param dso DSpace object (item, collection, etc)
* @param params Properties-style list of options specific to this packager * @param params Properties-style list of options specific to this packager
* @param pkgFile File where export package should be written * @param pkgFile File where export package should be written
* @throws PackageValidationException if package cannot be created or there is * @throws PackageValidationException if package cannot be created or there
* a fatal error in creating it. * is a fatal error in creating it.
*/ */
@Override @Override
public void disseminate(Context context, DSpaceObject dso, public void disseminate(Context context, DSpaceObject dso,
@@ -1219,7 +1219,7 @@ public abstract class AbstractMETSDisseminator
* @param type - type attr value for the <div> * @param type - type attr value for the <div>
* @param dso - object for which to create the div * @param dso - object for which to create the div
* @param params * @param params
* @return * @return a new {@code Div} with {@code dso} as child.
*/ */
protected Div makeChildDiv(String type, DSpaceObject dso, PackageParameters params) protected Div makeChildDiv(String type, DSpaceObject dso, PackageParameters params)
{ {
@@ -1394,7 +1394,7 @@ public abstract class AbstractMETSDisseminator
* @param context current DSpace Context * @param context current DSpace Context
* @param params current Packager Parameters * @param params current Packager Parameters
* @param dso current DSpace Object * @param dso current DSpace Object
* @param ref the rightsMD <mdRef> element * @param mdRef the rightsMD <mdRef> element
* @throws SQLException * @throws SQLException
* @throws IOException * @throws IOException
* @throws AuthorizeException * @throws AuthorizeException

View File

@@ -1326,7 +1326,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
* DSpace Context * DSpace Context
* @param manifest * @param manifest
* METS manifest * METS manifest
* @returns a DSpace Object which is the parent (or null, if not found) * @return a DSpace Object which is the parent (or null, if not found)
* @throws PackageValidationException * @throws PackageValidationException
* if parent reference cannot be found in manifest * if parent reference cannot be found in manifest
* @throws MetadataValidationException * @throws MetadataValidationException
@@ -1377,7 +1377,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
* *
* @param manifest * @param manifest
* METS manifest * METS manifest
* @returns handle as a string (or null, if not found) * @return handle as a string (or null, if not found)
* @throws PackageValidationException * @throws PackageValidationException
* if handle cannot be found in manifest * if handle cannot be found in manifest
*/ */
@@ -1574,7 +1574,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester
/** /**
* Determines what type of DSpace object is represented in this METS doc. * Determines what type of DSpace object is represented in this METS doc.
* *
* @returns one of the object types in Constants. * @return one of the object types in Constants.
*/ */
public abstract int getObjectType(METSManifest manifest) public abstract int getObjectType(METSManifest manifest)
throws PackageValidationException; throws PackageValidationException;

View File

@@ -163,7 +163,7 @@ public abstract class AbstractPackageDisseminator
/** /**
* Add File to list of successfully disseminated package files * Add File to list of successfully disseminated package files
* @param file File * @param f added File.
*/ */
protected void addToPackageList(File f) protected void addToPackageList(File f)
{ {

View File

@@ -168,7 +168,6 @@ public class PackageParameters extends Properties
* Utility method to enable/disable workflow for Item ingestion. * Utility method to enable/disable workflow for Item ingestion.
* *
* @param value boolean value (true = workflow enabled, false = workflow disabled) * @param value boolean value (true = workflow enabled, false = workflow disabled)
* @return boolean result
*/ */
public void setWorkflowEnabled(boolean value) public void setWorkflowEnabled(boolean value)
{ {
@@ -212,7 +211,6 @@ public class PackageParameters extends Properties
* either skip-over (keep) or replace existing objects. * either skip-over (keep) or replace existing objects.
* *
* @param value boolean value (true = restore enabled, false = restore disabled) * @param value boolean value (true = restore enabled, false = restore disabled)
* @return boolean result
*/ */
public void setRestoreModeEnabled(boolean value) public void setRestoreModeEnabled(boolean value)
{ {
@@ -244,7 +242,6 @@ public class PackageParameters extends Properties
* of "restore", where the current object is being restored to a previous state. * of "restore", where the current object is being restored to a previous state.
* *
* @param value boolean value (true = replace enabled, false = replace disabled) * @param value boolean value (true = replace enabled, false = replace disabled)
* @return boolean result
*/ */
public void setReplaceModeEnabled(boolean value) public void setReplaceModeEnabled(boolean value)
{ {
@@ -276,7 +273,6 @@ public class PackageParameters extends Properties
* essentially restores all missing objects, but keeps existing ones intact. * essentially restores all missing objects, but keeps existing ones intact.
* *
* @param value boolean value (true = replace enabled, false = replace disabled) * @param value boolean value (true = replace enabled, false = replace disabled)
* @return boolean result
*/ */
public void setKeepExistingModeEnabled(boolean value) public void setKeepExistingModeEnabled(boolean value)
{ {
@@ -303,7 +299,6 @@ public class PackageParameters extends Properties
* Item Template * Item Template
* *
* @param value boolean value (true = template enabled, false = template disabled) * @param value boolean value (true = template enabled, false = template disabled)
* @return boolean result
*/ */
public void setUseCollectionTemplate(boolean value) public void setUseCollectionTemplate(boolean value)
{ {
@@ -336,7 +331,6 @@ public class PackageParameters extends Properties
* recursively performs the same action on all related objects. * recursively performs the same action on all related objects.
* *
* @param value boolean value (true = recursion enabled, false = recursion disabled) * @param value boolean value (true = recursion enabled, false = recursion disabled)
* @return boolean result
*/ */
public void setRecursiveModeEnabled(boolean value) public void setRecursiveModeEnabled(boolean value)
{ {

View File

@@ -561,10 +561,8 @@ public class Context
} }
/** /**
* gets an array of all of the special groups that current user is a member * Get an array of all of the special groups that current user is a member
* of * of.
*
* @return
* @throws SQLException * @throws SQLException
*/ */
public Group[] getSpecialGroups() throws SQLException public Group[] getSpecialGroups() throws SQLException

View File

@@ -95,7 +95,6 @@ public class I18nUtil
* return the default Locale for the repository. * return the default Locale for the repository.
* *
* @param ep * @param ep
* @return
*/ */
public static Locale getEPersonLocale(EPerson ep) public static Locale getEPersonLocale(EPerson ep)
{ {

View File

@@ -34,7 +34,7 @@ public class PluginInstantiationException extends RuntimeException
/** /**
* @param msg Error message text. * @param msg Error message text.
* @cause cause other exception that this one is wrapping. * @param cause other exception that this one is wrapping.
*/ */
public PluginInstantiationException(String msg, Throwable cause) public PluginInstantiationException(String msg, Throwable cause)
{ {
@@ -42,7 +42,7 @@ public class PluginInstantiationException extends RuntimeException
} }
/** /**
* @cause cause other exception that this one is wrapping. * @param cause other exception that this one is wrapping.
*/ */
public PluginInstantiationException(Throwable cause) public PluginInstantiationException(Throwable cause)
{ {

View File

@@ -133,7 +133,7 @@ public class Curator
* Assigns invocation mode. * Assigns invocation mode.
* *
* @param mode one of INTERACTIVE, BATCH, ANY * @param mode one of INTERACTIVE, BATCH, ANY
* @return * @return the Curator instance.
*/ */
public Curator setInvoked(Invoked mode) public Curator setInvoked(Invoked mode)
{ {

View File

@@ -31,13 +31,9 @@ public interface SearchService {
* repository) * repository)
* *
* @param context * @param context
* DSpace Context object * DSpace Context object.
* @param dso
* a DSpace Object to use as scope of the search (only results
* within this object)
* @param query * @param query
* the discovery query object * the discovery query object.
* @return
* @throws SearchServiceException * @throws SearchServiceException
*/ */
DiscoverResult search(Context context, DiscoverQuery query) DiscoverResult search(Context context, DiscoverQuery query)
@@ -54,7 +50,6 @@ public interface SearchService {
* within this object) * within this object)
* @param query * @param query
* the discovery query object * the discovery query object
* @return
* @throws SearchServiceException * @throws SearchServiceException
*/ */
DiscoverResult search(Context context, DSpaceObject dso, DiscoverQuery query) DiscoverResult search(Context context, DSpaceObject dso, DiscoverQuery query)
@@ -63,14 +58,12 @@ public interface SearchService {
/** /**
* *
* @param context * @param context
* DSpace Context object * DSpace Context object.
* @param dso * @param query
* a DSpace Object to use as scope of the search (only results * the discovery query object.
* within this object)
* @param includeWithdrawn * @param includeWithdrawn
* use <code>true</code> to include in the results also withdrawn * use <code>true</code> to include in the results also withdrawn
* items that match the query * items that match the query.
* @return
* @throws SearchServiceException * @throws SearchServiceException
*/ */
DiscoverResult search(Context context, DiscoverQuery query, DiscoverResult search(Context context, DiscoverQuery query,
@@ -89,7 +82,6 @@ public interface SearchService {
* use <code>true</code> to include in the results also withdrawn * use <code>true</code> to include in the results also withdrawn
* items that match the query * items that match the query
* *
* @return
* @throws SearchServiceException * @throws SearchServiceException
*/ */
DiscoverResult search(Context context, DSpaceObject dso, DiscoverQuery query, boolean includeWithdrawn) throws SearchServiceException; DiscoverResult search(Context context, DSpaceObject dso, DiscoverQuery query, boolean includeWithdrawn) throws SearchServiceException;

View File

@@ -343,12 +343,11 @@ public class Group extends DSpaceObject
} }
/** /**
* check to see if g is a direct group member. * Check to see if g is a direct group member.
* If g is a subgroup via another group will be returned <code>false</code> * If g is a subgroup via another group will be returned <code>false</code>
* *
* @param g * @param g
* group to check * group to check
* @return
*/ */
public boolean isMember(Group g) public boolean isMember(Group g)
{ {
@@ -381,11 +380,10 @@ public class Group extends DSpaceObject
} }
/** /**
* Get all of the groups that an eperson is a member of * Get all of the groups that an eperson is a member of.
* *
* @param c * @param c
* @param e * @param e
* @return
* @throws SQLException * @throws SQLException
*/ */
public static Group[] allMemberGroups(Context c, EPerson e) public static Group[] allMemberGroups(Context c, EPerson e)
@@ -1052,9 +1050,7 @@ public class Group extends DSpaceObject
} }
/** /**
* Return Group members of a Group * Return Group members of a Group.
*
* @return
*/ */
public Group[] getMemberGroups() public Group[] getMemberGroups()
{ {

View File

@@ -22,10 +22,10 @@ import org.slf4j.LoggerFactory;
/** /**
* For handling digested secrets (such as passwords). * For handling digested secrets (such as passwords).
* Use {@link PasswordHash(String, byte[], byte[])} to package and manipulate * Use {@link #PasswordHash(String, byte[], byte[])} to package and manipulate
* secrets that have already been hashed, and {@link PasswordHash(String)} for * secrets that have already been hashed, and {@link #PasswordHash(String)} for
* plaintext secrets. Compare a plaintext candidate to a hashed secret with * plaintext secrets. Compare a plaintext candidate to a hashed secret with
* {@link matches(String)}. * {@link #matches(String)}.
* *
* @author mwood * @author mwood
*/ */
@@ -78,7 +78,7 @@ public class PasswordHash
} }
/** /**
* Convenience: like {@link PasswordHash(String, byte[], byte[])} but with * Convenience: like {@link #PasswordHash(String, byte[], byte[])} but with
* hexadecimal-encoded {@code String}s. * hexadecimal-encoded {@code String}s.
* @param algorithm the digest algorithm used in producing {@code hash}. * @param algorithm the digest algorithm used in producing {@code hash}.
* If empty, set to null. Other methods will treat this as unsalted MD5. * If empty, set to null. Other methods will treat this as unsalted MD5.

View File

@@ -27,48 +27,48 @@ import java.util.List;
public class HarvestedCollection public class HarvestedCollection
{ {
private Context context; private Context context;
private TableRow harvestRow; private TableRow harvestRow;
public static final int TYPE_NONE = 0; public static final int TYPE_NONE = 0;
public static final int TYPE_DMD = 1; public static final int TYPE_DMD = 1;
public static final int TYPE_DMDREF = 2; public static final int TYPE_DMDREF = 2;
public static final int TYPE_FULL = 3; public static final int TYPE_FULL = 3;
public static final int STATUS_READY = 0; public static final int STATUS_READY = 0;
public static final int STATUS_BUSY = 1; public static final int STATUS_BUSY = 1;
public static final int STATUS_QUEUED = 2; public static final int STATUS_QUEUED = 2;
public static final int STATUS_OAI_ERROR = 3; public static final int STATUS_OAI_ERROR = 3;
public static final int STATUS_UNKNOWN_ERROR = -1; public static final int STATUS_UNKNOWN_ERROR = -1;
/* /*
* collection_id | integer | not null * collection_id | integer | not null
harvest_type | integer | * harvest_type | integer |
oai_source | text | * oai_source | text |
oai_set_id | text | * oai_set_id | text |
harvest_message | text | * harvest_message | text |
metadata_config_id | text | * metadata_config_id | text |
harvest_status | integer | * harvest_status | integer |
harvest_start_time | timestamp with time zone | * harvest_start_time | timestamp with time zone |
*/ */
// TODO: make sure this guy knows to lock people out if the status is not zero. // TODO: make sure this guy knows to lock people out if the status is not zero.
// i.e. someone editing a collection's setting from the admin menu should have // i.e. someone editing a collection's setting from the admin menu should have
// to stop an ongoing harvest before they can edit the settings. // to stop an ongoing harvest before they can edit the settings.
HarvestedCollection(Context c, TableRow row) HarvestedCollection(Context c, TableRow row)
{ {
context = c; context = c;
harvestRow = row; harvestRow = row;
} }
public static void exists(Context c) throws SQLException { public static void exists(Context c) throws SQLException {
DatabaseManager.queryTable(c, "harvested_collection", "SELECT COUNT(*) FROM harvested_collection"); DatabaseManager.queryTable(c, "harvested_collection", "SELECT COUNT(*) FROM harvested_collection");
} }
/** /**
* Find the harvest settings corresponding to this collection * Find the harvest settings corresponding to this collection
* @return a HarvestInstance object corresponding to this collection's settings, null if not found. * @return a HarvestInstance object corresponding to this collection's settings, null if not found.
@@ -76,14 +76,14 @@ public class HarvestedCollection
public static HarvestedCollection find(Context c, int collectionId) throws SQLException public static HarvestedCollection find(Context c, int collectionId) throws SQLException
{ {
TableRow row = DatabaseManager.findByUnique(c, "harvested_collection", "collection_id", collectionId); TableRow row = DatabaseManager.findByUnique(c, "harvested_collection", "collection_id", collectionId);
if (row == null) { if (row == null) {
return null; return null;
} }
return new HarvestedCollection(c, row); return new HarvestedCollection(c, row);
} }
/** /**
* Create a new harvest instance row for a specified collection. * Create a new harvest instance row for a specified collection.
* @return a new HarvestInstance object * @return a new HarvestInstance object
@@ -93,10 +93,10 @@ public class HarvestedCollection
row.setColumn("collection_id", collectionId); row.setColumn("collection_id", collectionId);
row.setColumn("harvest_type", 0); row.setColumn("harvest_type", 0);
DatabaseManager.insert(c, row); DatabaseManager.insert(c, row);
return new HarvestedCollection(c, row); return new HarvestedCollection(c, row);
} }
/** Returns whether the specified collection is harvestable, i.e. whether its harvesting /** Returns whether the specified collection is harvestable, i.e. whether its harvesting
* options are set up correctly. This is distinct from "ready", since this collection may * options are set up correctly. This is distinct from "ready", since this collection may
* be in process of being harvested. * be in process of being harvested.
@@ -105,12 +105,12 @@ public class HarvestedCollection
{ {
HarvestedCollection hc = HarvestedCollection.find(c, collectionId); HarvestedCollection hc = HarvestedCollection.find(c, collectionId);
if (hc != null && hc.getHarvestType() > 0 && hc.getOaiSource() != null && hc.getOaiSetId() != null && if (hc != null && hc.getHarvestType() > 0 && hc.getOaiSource() != null && hc.getOaiSetId() != null &&
hc.getHarvestStatus() != HarvestedCollection.STATUS_UNKNOWN_ERROR) { hc.getHarvestStatus() != HarvestedCollection.STATUS_UNKNOWN_ERROR) {
return true; return true;
} }
return false; return false;
} }
/** Returns whether this harvest instance is actually harvestable, i.e. whether its settings /** Returns whether this harvest instance is actually harvestable, i.e. whether its settings
* options are set up correctly. This is distinct from "ready", since this collection may * options are set up correctly. This is distinct from "ready", since this collection may
* be in process of being harvested. * be in process of being harvested.
@@ -118,13 +118,13 @@ public class HarvestedCollection
public boolean isHarvestable() throws SQLException public boolean isHarvestable() throws SQLException
{ {
if (this.getHarvestType() > 0 && this.getOaiSource() != null && this.getOaiSetId() != null && if (this.getHarvestType() > 0 && this.getOaiSource() != null && this.getOaiSetId() != null &&
this.getHarvestStatus() != HarvestedCollection.STATUS_UNKNOWN_ERROR) { this.getHarvestStatus() != HarvestedCollection.STATUS_UNKNOWN_ERROR) {
return true; return true;
} }
return false; return false;
} }
/** Returns whether the specified collection is ready for immediate harvest. /** Returns whether the specified collection is ready for immediate harvest.
*/ */
public static boolean isReady(Context c, int collectionId) throws SQLException public static boolean isReady(Context c, int collectionId) throws SQLException
@@ -132,18 +132,18 @@ public class HarvestedCollection
HarvestedCollection hc = HarvestedCollection.find(c, collectionId); HarvestedCollection hc = HarvestedCollection.find(c, collectionId);
return hc.isReady(); return hc.isReady();
} }
public boolean isReady() throws SQLException public boolean isReady() throws SQLException
{ {
if (this.isHarvestable() && (this.getHarvestStatus() == HarvestedCollection.STATUS_READY || this.getHarvestStatus() == HarvestedCollection.STATUS_OAI_ERROR)) if (this.isHarvestable() && (this.getHarvestStatus() == HarvestedCollection.STATUS_READY || this.getHarvestStatus() == HarvestedCollection.STATUS_OAI_ERROR))
{ {
return true; return true;
} }
return false; return false;
} }
/** Find all collections that are set up for harvesting /** Find all collections that are set up for harvesting
* *
* return: list of collection id's * return: list of collection id's
@@ -152,18 +152,18 @@ public class HarvestedCollection
public static List<Integer> findAll(Context c) throws SQLException public static List<Integer> findAll(Context c) throws SQLException
{ {
TableRowIterator tri = DatabaseManager.queryTable(c, "harvested_collection", TableRowIterator tri = DatabaseManager.queryTable(c, "harvested_collection",
"SELECT * FROM harvested_collection"); "SELECT * FROM harvested_collection");
List<Integer> collectionIds = new ArrayList<Integer>(); List<Integer> collectionIds = new ArrayList<Integer>();
while (tri.hasNext()) while (tri.hasNext())
{ {
TableRow row = tri.next(); TableRow row = tri.next();
collectionIds.add(row.getIntColumn("collection_id")); collectionIds.add(row.getIntColumn("collection_id"));
} }
return collectionIds; return collectionIds;
} }
/** Find all collections that are ready for harvesting /** Find all collections that are ready for harvesting
* *
* return: list of collection id's * return: list of collection id's
@@ -173,10 +173,10 @@ public class HarvestedCollection
{ {
int harvestInterval = ConfigurationManager.getIntProperty("oai", "harvester.harvestFrequency"); int harvestInterval = ConfigurationManager.getIntProperty("oai", "harvester.harvestFrequency");
if (harvestInterval == 0) if (harvestInterval == 0)
{ {
harvestInterval = 720; harvestInterval = 720;
} }
int expirationInterval = ConfigurationManager.getIntProperty("oai", "harvester.threadTimeout"); int expirationInterval = ConfigurationManager.getIntProperty("oai", "harvester.threadTimeout");
if (expirationInterval == 0) if (expirationInterval == 0)
{ {
@@ -185,69 +185,69 @@ public class HarvestedCollection
Date startTime; Date startTime;
Date expirationTime; Date expirationTime;
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date()); calendar.setTime(new Date());
calendar.add(Calendar.MINUTE, -1 * harvestInterval); calendar.add(Calendar.MINUTE, -1 * harvestInterval);
startTime = calendar.getTime(); startTime = calendar.getTime();
calendar.setTime(startTime); calendar.setTime(startTime);
calendar.add(Calendar.HOUR, -2 * expirationInterval); calendar.add(Calendar.HOUR, -2 * expirationInterval);
expirationTime = calendar.getTime(); expirationTime = calendar.getTime();
/* Select all collections whose last_harvest is before our start time, whose harvest_type *is not* 0 and whose status *is* 0 (available) or 3 (OAI Error). */ /* Select all collections whose last_harvest is before our start time, whose harvest_type *is not* 0 and whose status *is* 0 (available) or 3 (OAI Error). */
TableRowIterator tri = DatabaseManager.queryTable(c, "harvested_collection", TableRowIterator tri = DatabaseManager.queryTable(c, "harvested_collection",
"SELECT * FROM harvested_collection WHERE (last_harvested < ? or last_harvested is null) and harvest_type > ? and (harvest_status = ? or harvest_status = ? or (harvest_status=? and harvest_start_time < ?)) ORDER BY last_harvested", "SELECT * FROM harvested_collection WHERE (last_harvested < ? or last_harvested is null) and harvest_type > ? and (harvest_status = ? or harvest_status = ? or (harvest_status=? and harvest_start_time < ?)) ORDER BY last_harvested",
new java.sql.Timestamp(startTime.getTime()), 0, HarvestedCollection.STATUS_READY, HarvestedCollection.STATUS_OAI_ERROR, HarvestedCollection.STATUS_BUSY, new java.sql.Timestamp(expirationTime.getTime())); new java.sql.Timestamp(startTime.getTime()), 0, HarvestedCollection.STATUS_READY, HarvestedCollection.STATUS_OAI_ERROR, HarvestedCollection.STATUS_BUSY, new java.sql.Timestamp(expirationTime.getTime()));
List<Integer> collectionIds = new ArrayList<Integer>(); List<Integer> collectionIds = new ArrayList<Integer>();
while (tri.hasNext()) while (tri.hasNext())
{ {
TableRow row = tri.next(); TableRow row = tri.next();
collectionIds.add(row.getIntColumn("collection_id")); collectionIds.add(row.getIntColumn("collection_id"));
} }
return collectionIds; return collectionIds;
} }
/** /**
* Find all collections with the specified status flag * Find all collections with the specified status flag
* @param c * @param c
* @param status see HarvestInstance.STATUS_... * @param status see HarvestInstance.STATUS_...
* @return * @return matching Collection IDs.
* @throws SQLException * @throws SQLException
*/ */
public static List<Integer> findByStatus(Context c, int status) throws SQLException { public static List<Integer> findByStatus(Context c, int status) throws SQLException {
TableRowIterator tri = DatabaseManager.queryTable(c, "harvested_collection", TableRowIterator tri = DatabaseManager.queryTable(c, "harvested_collection",
"SELECT * FROM harvested_collection WHERE harvest_status = ?", status); "SELECT * FROM harvested_collection WHERE harvest_status = ?", status);
List<Integer> collectionIds = new ArrayList<Integer>(); List<Integer> collectionIds = new ArrayList<Integer>();
while (tri.hasNext()) while (tri.hasNext())
{ {
TableRow row = tri.next(); TableRow row = tri.next();
collectionIds.add(row.getIntColumn("collection_id")); collectionIds.add(row.getIntColumn("collection_id"));
} }
return collectionIds; return collectionIds;
} }
/** Find the collection that was harvested the longest time ago. /** Find the collection that was harvested the longest time ago.
* @throws SQLException * @throws SQLException
*/ */
public static Integer findOldestHarvest (Context c) throws SQLException { public static Integer findOldestHarvest (Context c) throws SQLException {
String query = "select collection_id from harvested_collection where harvest_type > ? and harvest_status = ? order by last_harvested asc limit 1"; String query = "select collection_id from harvested_collection where harvest_type > ? and harvest_status = ? order by last_harvested asc limit 1";
if ("oracle".equals(ConfigurationManager.getProperty("db.name"))) if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
{ {
query = "select collection_id from harvested_collection where harvest_type > ? and harvest_status = ? and rownum <= 1 order by last_harvested asc"; query = "select collection_id from harvested_collection where harvest_type > ? and harvest_status = ? and rownum <= 1 order by last_harvested asc";
} }
TableRowIterator tri = DatabaseManager.queryTable(c, "harvested_collection", TableRowIterator tri = DatabaseManager.queryTable(c, "harvested_collection",
query, 0, 0); query, 0, 0);
TableRow row = tri.next(); TableRow row = tri.next();
if (row != null) if (row != null)
{ {
return row.getIntColumn("collection_id"); return row.getIntColumn("collection_id");
@@ -257,7 +257,7 @@ public class HarvestedCollection
return -1; return -1;
} }
} }
/** Find the collection that was harvested most recently. /** Find the collection that was harvested most recently.
* @throws SQLException * @throws SQLException
*/ */

View File

@@ -23,25 +23,28 @@ import java.sql.SQLException;
public interface IdentifierService { public interface IdentifierService {
/** /**
* Get an identifier for a given object which is assignment-compatible
* with a given Identifier type.
* *
* @param context * @param context
* @param dso * @param dso the object to be identified.
* @param identifier * @param identifier instance of an Identifier of the required type.
* @return * @return the matching identifier, or the site identifier if the object
* is a Site, or null if no matching identifier is found.
*/ */
String lookup(Context context, DSpaceObject dso, Class<? extends Identifier> identifier); String lookup(Context context, DSpaceObject dso, Class<? extends Identifier> identifier);
/** /**
* *
* This will resolve a DSpaceObject based on a provided Identifier. The Service will interrogate the providers in * This will resolve a DSpaceObject based on a provided Identifier.
* no particular order and return the first successful result discovered. If no resolution is successful, * The Service will interrogate the providers in no particular order
* the method will return null if no object is found. * and return the first successful result discovered. If no resolution
* is successful, the method will return null if no object is found.
* *
* TODO: Verify null is returned. * TODO: Verify null is returned.
* *
* @param context * @param context
* @param identifier * @param identifier
* @return
* @throws IdentifierNotFoundException * @throws IdentifierNotFoundException
* @throws IdentifierNotResolvableException * @throws IdentifierNotResolvableException
*/ */
@@ -78,7 +81,6 @@ public interface IdentifierService {
* *
* @param context * @param context
* @param dso * @param dso
* @return
* @throws org.dspace.authorize.AuthorizeException * @throws org.dspace.authorize.AuthorizeException
* @throws java.sql.SQLException * @throws java.sql.SQLException
* @throws IdentifierException * @throws IdentifierException
@@ -87,14 +89,14 @@ public interface IdentifierService {
/** /**
* *
* Used to Register a Specific Identifier (for example a Handle, hdl:1234.5/6) The provider is responsible for * Used to Register a specific Identifier (for example a Handle, hdl:1234.5/6)
* Detecting and Processing the appropriate identifier, all Providers are interrogated, multiple providers * The provider is responsible for detecting and processing the appropriate
* identifier. All Providers are interrogated. Multiple providers
* can process the same identifier. * can process the same identifier.
* *
* @param context * @param context
* @param dso * @param dso
* @param identifier * @param identifier
* @return
* @throws org.dspace.authorize.AuthorizeException * @throws org.dspace.authorize.AuthorizeException
* @throws java.sql.SQLException * @throws java.sql.SQLException
* @throws IdentifierException * @throws IdentifierException

View File

@@ -153,7 +153,6 @@ public class CCLookup {
* @return A Collection of LicenseField objects. * @return A Collection of LicenseField objects.
* *
* @see CCLicense * @see CCLicense
* @see LicenseField
* *
*/ */
public Collection<CCLicenseField> getLicenseFields(String license) { public Collection<CCLicenseField> getLicenseFields(String license) {

View File

@@ -188,8 +188,8 @@ public class LicenseCleanup
/** /**
* Fast stream copy routine * Fast stream copy routine
* *
* @param b * @param b the Bitstream to be copied.
* @return * @return copy of the content of {@code b}.
* @throws IOException * @throws IOException
* @throws SQLException * @throws SQLException
* @throws AuthorizeException * @throws AuthorizeException

View File

@@ -264,9 +264,7 @@ public class SortOption
} }
/** /**
* Is this a date field * Is this a date field?
*
* @return
*/ */
public boolean isDate() public boolean isDate()
{ {
@@ -279,9 +277,7 @@ public class SortOption
} }
/** /**
* Is the default sort option * Is the default sort option?
*
* @return
*/ */
public boolean isDefault() public boolean isDefault()
{ {
@@ -293,8 +289,7 @@ public class SortOption
} }
/** /**
* Return all the configured sort options * Return all the configured sort options.
* @return
* @throws SortException * @throws SortException
*/ */
public static Set<SortOption> getSortOptions() throws SortException public static Set<SortOption> getSortOptions() throws SortException
@@ -308,9 +303,8 @@ public class SortOption
} }
/** /**
* Get the defined sort option by number (.1, .2, etc) * Get the defined sort option by number (.1, .2, etc).
* @param number * @param number
* @return
* @throws SortException * @throws SortException
*/ */
public static SortOption getSortOption(int number) throws SortException public static SortOption getSortOption(int number) throws SortException
@@ -327,8 +321,7 @@ public class SortOption
} }
/** /**
* Get the default sort option - initially, just the first one defined * Get the default sort option - initially, just the first one defined.
* @return
* @throws SortException * @throws SortException
*/ */
public static SortOption getDefaultSortOption() throws SortException public static SortOption getDefaultSortOption() throws SortException

View File

@@ -31,7 +31,7 @@ public class DataTermsFacet {
* *
* An example of the output could be of the format: * An example of the output could be of the format:
* [{"term":"247166","count":10},{"term":"247168","count":6}] * [{"term":"247166","count":10},{"term":"247168","count":6}]
* @return * @return JSON-formatted data.
*/ */
public String toJson() { public String toJson() {
Gson gson = new Gson(); Gson gson = new Gson();

View File

@@ -77,9 +77,7 @@ public class SpiderDetector {
} }
/** /**
* Get an immutable Set representing all the Spider Addresses here * Get an immutable Set representing all the Spider Addresses here.
*
* @return
*/ */
public static Set<String> getSpiderIpAddresses() { public static Set<String> getSpiderIpAddresses() {

View File

@@ -710,8 +710,8 @@ public class BitstreamStorageManager
/** /**
* *
* @param context * @param context
* @param id of the bitstream to clone * @param id of the bitstream to clone.
* @return * @return id of the clone bitstream.
* @throws SQLException * @throws SQLException
*/ */
public static int clone(Context context, int id) throws SQLException public static int clone(Context context, int id) throws SQLException

View File

@@ -995,7 +995,6 @@ public class DescribeStep extends AbstractProcessingStep
* Return the HTML / DRI field name for the given input. * Return the HTML / DRI field name for the given input.
* *
* @param input * @param input
* @return
*/ */
public static String getFieldName(DCInput input) public static String getFieldName(DCInput input)
{ {

View File

@@ -30,7 +30,7 @@ import org.dspace.submit.AbstractProcessingStep;
* </p> * </p>
* *
* @see org.dspace.submit.AbstractProcessingStep * @see org.dspace.submit.AbstractProcessingStep
* @see org.dspace.submit.step.InitialQuestionStep * @see org.dspace.submit.step.InitialQuestionsStep
* @see org.dspace.submit.step.DescribeStep * @see org.dspace.submit.step.DescribeStep
* *
* @author Andrea Bollini * @author Andrea Bollini