mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-18 15:33:09 +00:00
Merge pull request #432 from coelhoe/DS-1838
DS-1838 - add context to two methods to have monthly statistics local...
This commit is contained in:
@@ -978,7 +978,7 @@ public class SolrLogger
|
||||
*/
|
||||
public static ObjectCount[] queryFacetDate(String query,
|
||||
String filterQuery, int max, String dateType, String dateStart,
|
||||
String dateEnd, boolean showTotal) throws SolrServerException
|
||||
String dateEnd, boolean showTotal, Context context) throws SolrServerException
|
||||
{
|
||||
QueryResponse queryResponse = query(query, filterQuery, null, 0, max,
|
||||
dateType, dateStart, dateEnd, null, null, false);
|
||||
@@ -998,7 +998,7 @@ public class SolrLogger
|
||||
FacetField.Count dateCount = dateFacet.getValues().get(i);
|
||||
result[i] = new ObjectCount();
|
||||
result[i].setCount(dateCount.getCount());
|
||||
result[i].setValue(getDateView(dateCount.getName(), dateType));
|
||||
result[i].setValue(getDateView(dateCount.getName(), dateType, context));
|
||||
}
|
||||
if (showTotal)
|
||||
{
|
||||
@@ -1031,7 +1031,7 @@ public class SolrLogger
|
||||
return objCount;
|
||||
}
|
||||
|
||||
private static String getDateView(String name, String type)
|
||||
private static String getDateView(String name, String type, Context context)
|
||||
{
|
||||
if (name != null && name.matches("^[0-9]{4}\\-[0-9]{2}.*"))
|
||||
{
|
||||
@@ -1046,7 +1046,7 @@ public class SolrLogger
|
||||
Date date = null;
|
||||
try
|
||||
{
|
||||
SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT_8601);
|
||||
SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT_8601, context.getCurrentLocale());
|
||||
date = format.parse(name);
|
||||
}
|
||||
catch (ParseException e)
|
||||
@@ -1056,7 +1056,7 @@ public class SolrLogger
|
||||
// We should use the dcdate (the dcdate is used when
|
||||
// generating random data)
|
||||
SimpleDateFormat format = new SimpleDateFormat(
|
||||
DATE_FORMAT_DCDATE);
|
||||
DATE_FORMAT_DCDATE, context.getCurrentLocale());
|
||||
date = format.parse(name);
|
||||
}
|
||||
catch (ParseException e1)
|
||||
@@ -1080,7 +1080,7 @@ public class SolrLogger
|
||||
dateformatString = "yyyy";
|
||||
}
|
||||
SimpleDateFormat simpleFormat = new SimpleDateFormat(
|
||||
dateformatString);
|
||||
dateformatString, context.getCurrentLocale());
|
||||
if (date != null)
|
||||
{
|
||||
name = simpleFormat.format(date);
|
||||
|
Reference in New Issue
Block a user