Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
*/
package org.openmrs.module.reporting.evaluation;

import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codehaus.jackson.annotate.JsonIgnore;
Expand All @@ -18,6 +24,7 @@
import org.openmrs.api.APIException;
import org.openmrs.api.context.Context;
import org.openmrs.calculation.patient.PatientCalculationContext;
import org.openmrs.module.reporting.ReportingConstants;
import org.openmrs.module.reporting.cohort.CohortUtil;
import org.openmrs.module.reporting.cohort.PatientIdSet;
import org.openmrs.module.reporting.common.DateUtil;
Expand All @@ -28,11 +35,6 @@
import org.openmrs.module.reporting.evaluation.parameter.Parameterizable;
import org.openmrs.module.reporting.query.IdSet;

import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

/**
* The EvaluationContext provides the following capabilities:
* - A baseCohort, i.e. the universe of patients relevant to this context (defaults to all patients)
Expand Down Expand Up @@ -235,6 +237,7 @@ public void setNow(Date date) {
/**
* Add a value to the cache with a given key
*/
@Override
public void addToCache(String key, Object value) {
getCache().put(key, value);
}
Expand All @@ -244,6 +247,7 @@ public void addToCache(String key, Object value) {
*
* @param key
*/
@Override
public void removeFromCache(String key) {
getCache().remove(key);
}
Expand All @@ -253,6 +257,7 @@ public void removeFromCache(String key) {
*
* @param key
*/
@Override
public Object getFromCache(String key) {
return getCache().get(key);
}
Expand Down Expand Up @@ -404,4 +409,12 @@ public long getEvaluationId() {
public int getEvaluationLevel() {
return evaluationLevel;
}

public static Locale getDefaultLocale(Locale locale) {
if (locale == null) {
locale = ReportingConstants.GLOBAL_PROPERTY_DEFAULT_LOCALE();
return locale;
}
return locale = Context.getLocale();
}
Comment on lines +413 to +419

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to write some unit tests for this method

}