diff --git a/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/CSVOutputter.java b/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/CSVOutputter.java index 494c8cc60d..6fe1abddb3 100644 --- a/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/CSVOutputter.java +++ b/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/CSVOutputter.java @@ -40,11 +40,8 @@ import java.text.SimpleDateFormat; import java.util.*; /** - * Created by IntelliJ IDEA. - * User: peterdietz - * Date: 4/20/12 - * Time: 3:28 PM - * To change this template use File | Settings | File Templates. + * Provides the usage statistics in CSV form + * @author Peter Dietz (pdietz84@gmail.com) */ public class CSVOutputter extends AbstractReader implements Recyclable { diff --git a/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/ElasticSearchStatsViewer.java b/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/ElasticSearchStatsViewer.java index 9eb058bb19..73db5a6002 100644 --- a/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/ElasticSearchStatsViewer.java +++ b/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/ElasticSearchStatsViewer.java @@ -37,11 +37,9 @@ import java.util.*; import java.util.List; /** - * Created by IntelliJ IDEA. - * User: peterdietz - * Date: 3/7/12 - * Time: 11:54 AM - * To change this template use File | Settings | File Templates. + * Usage Statistics viewer, powered by Elastic Search. + * Allows for the user to dig deeper into the statistics for topDownloads, topCountries, etc. + * @author Peter Dietz (pdietz84@gmail.com) */ public class ElasticSearchStatsViewer extends AbstractDSpaceTransformer { private static Logger log = Logger.getLogger(ElasticSearchStatsViewer.class); diff --git a/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/ReportGenerator.java b/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/ReportGenerator.java index bd65f204ba..9dad056bdf 100644 --- a/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/ReportGenerator.java +++ b/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/ReportGenerator.java @@ -26,6 +26,7 @@ import java.util.Map; * Use a form to dynamically generate a variety of reports. * * @author "Ryan McGowan" ("mcgowan.98@osu.edu") + * @author Peter Dietz (pdietz84@gmail.com) * @version */ public class ReportGenerator @@ -153,77 +154,4 @@ public class ReportGenerator } } - /** - * Checks the parameters of the given request to see if they fit the - * necessary criteria to run generate a report. The following must be true: - * - * * from - Must be convertable to a valid date that is greater than the - * miniumum date and also less than or equal to the current date. - * * to - Must be convertable to a valid date that is greater than from - * and equal to or less than the current date. - * - * @return A map of valid parameters to their values. - * @throws InvalidFormatException - * @throws ParseException - */ - private Map checkAndNormalizeParameters(Map params) { - try { - - //Create dateValidator and min and max dates - DateValidator dateValidator = new DateValidator(false, DateFormat.SHORT); - SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); - - Date maximumDate = new Date(); - Date minimumDate = dateFormat.parse(ReportGenerator.MINIMUM_DATE); - - //Check the to and from dates - Date fromDate = null; - Date toDate = null; - boolean validToAndFrom = true; - boolean hasFrom = params.containsKey("from") && params.get("from").length() > 0; - boolean hasTo = params.containsKey("to") && params.get("to").length() > 0; - - if (hasFrom || hasTo) { - if (hasFrom) { - fromDate = tryParse(params.get("from")); - params.put("from", dateFormat.format(fromDate)); - validToAndFrom = validToAndFrom && dateValidator.compareDates(minimumDate, fromDate, null) <= 0; - } - if (hasTo) { - toDate = tryParse(params.get("to")); - params.put("to", dateFormat.format(toDate)); - validToAndFrom = validToAndFrom && dateValidator.compareDates(toDate, maximumDate, null) <= 0; - } - if (hasFrom && hasTo) { - //Make sure hasFrom <= hasTo - validToAndFrom = validToAndFrom && dateValidator.compareDates(fromDate, toDate, null) <= 0; - } else if (hasFrom && !hasTo) { - //Make sure hasFrom <= the max date - validToAndFrom = validToAndFrom && dateValidator.compareDates(fromDate, maximumDate, null) <= 0; - } else { - //hasTo && !hasFrom - //Make sure hasTo >= the min date - validToAndFrom = validToAndFrom && dateValidator.compareDates(minimumDate, toDate, null) <= 0; - } - // Short circuit if the to and from dates are not valid - if (!validToAndFrom) { - log.error("To and from dates are not within max/min or are not in order. "+ params.get("from") + " -> " + params.get("to")); - return null; - } - - //Check fiscal - if (params.containsKey("fiscal")) { - log.debug("fiscal: " + params.get("fiscal")); - if (Integer.parseInt(params.get("fiscal")) != 1) { - log.error("Fiscal field did not contain a proper value: " + params.get("fiscal")); - } - } - - } - return params; - } catch (ParseException e) { - log.error("ParseFormatException likely means a date format failed. "+e.getMessage()); //To change body of catch statement use File | Settings | File Templates. - return null; - } - } } diff --git a/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/SpecifiedGroupAuthenticatedSelector.java b/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/SpecifiedGroupAuthenticatedSelector.java index dae2c26cf1..c7fb79c0fe 100644 --- a/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/SpecifiedGroupAuthenticatedSelector.java +++ b/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/SpecifiedGroupAuthenticatedSelector.java @@ -20,9 +20,7 @@ import java.util.Map; /** * Part of cocoon authentication for resource. Requires that user (eperson) is a member of a specified group. * - * Author: Peter Dietz dietz.72@osu.edu - The Ohio State University Libraries - * Date: 5/11/12 - * Time: 2:29 PM + * @author Peter Dietz (pdietz84@gmailcom) */ public class SpecifiedGroupAuthenticatedSelector implements Selector { private static Logger log = Logger.getLogger(SpecifiedGroupAuthenticatedSelector.class);