use of org.mifos.reports.pentaho.params.PentahoDateParameter in project head by mifos.
the class PentahoParamParser method parseDateParameter.
private PentahoDateParameter parseDateParameter(PlainParameter paramDefEntry) {
PentahoDateParameter result = new PentahoDateParameter();
Date defaultValue = (Date) paramDefEntry.getDefaultValue();
if (defaultValue != null) {
result.setDate(new LocalDate(defaultValue));
}
return result;
}
use of org.mifos.reports.pentaho.params.PentahoDateParameter in project head by mifos.
the class PentahoParamParser method parseParamValue.
public Object parseParamValue(AbstractPentahoParameter param, ParameterDefinitionEntry paramDefEntry) throws ReflectionException {
Object result = null;
Class<?> clazz = paramDefEntry.getValueType();
if (param instanceof PentahoDateParameter) {
PentahoDateParameter dateParam = (PentahoDateParameter) param;
LocalDate date = dateParam.getDate();
Date javaDate = (date == null) ? null : date.toDateMidnight().toDate();
result = ReflectionUtil.parseDateToClass(javaDate, clazz);
} else if (param instanceof PentahoInputParameter) {
PentahoInputParameter inputParam = (PentahoInputParameter) param;
result = ReflectionUtil.parseStringToClass(inputParam.getValue(), clazz);
} else if (param instanceof PentahoSingleSelectParameter) {
PentahoSingleSelectParameter singleSelectParam = (PentahoSingleSelectParameter) param;
result = ReflectionUtil.parseStringToClass(singleSelectParam.getSelectedValue(), clazz);
} else if (param instanceof PentahoMultiSelectParameter) {
PentahoMultiSelectParameter multiSelectParam = (PentahoMultiSelectParameter) param;
Class<?> componentType = (clazz.isArray()) ? clazz.getComponentType() : clazz;
result = ReflectionUtil.parseStringsToClass(multiSelectParam.getSelectedValues(), componentType);
}
return result;
}
Aggregations