use of org.mifos.reports.pentaho.params.PentahoMultiSelectParameter in project head by mifos.
the class PentahoReportFormBean method setReportParameters.
public void setReportParameters(List<AbstractPentahoParameter> params) {
Map<String, AbstractPentahoParameter> formParams = getAllParameteres();
for (AbstractPentahoParameter param : params) {
String paramName = param.getParamName();
if (formParams.containsKey(paramName)) {
if (param instanceof PentahoSingleSelectParameter) {
PentahoSingleSelectParameter singleSelectParam = (PentahoSingleSelectParameter) param;
PentahoSingleSelectParameter singleSelectFormParam = (PentahoSingleSelectParameter) formParams.get(paramName);
singleSelectFormParam.setPossibleValues(singleSelectParam.getPossibleValues());
} else if (param instanceof PentahoMultiSelectParameter) {
PentahoMultiSelectParameter multiSelectParam = (PentahoMultiSelectParameter) param;
PentahoMultiSelectParameter multiSelectFormParam = (PentahoMultiSelectParameter) formParams.get(paramName);
multiSelectFormParam.setPossibleValuesOptions(multiSelectParam.getPossibleValuesOptions());
for (String val : multiSelectFormParam.getSelectedValues()) {
String text = multiSelectFormParam.getPossibleValuesOptions().get(val);
multiSelectFormParam.getPossibleValuesOptions().remove(val);
multiSelectFormParam.getSelectedValuesOptions().put(val, text);
}
}
} else if (!param.getParamName().equals("mifosLogoPath")) {
addParameter(param);
}
}
}
use of org.mifos.reports.pentaho.params.PentahoMultiSelectParameter 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;
}
use of org.mifos.reports.pentaho.params.PentahoMultiSelectParameter in project head by mifos.
the class PentahoParamParser method parseMultiListParameter.
private PentahoMultiSelectParameter parseMultiListParameter(ListParameter paramDefEntry, ParameterContext paramContext) throws ReportDataFactoryException {
PentahoMultiSelectParameter result = new PentahoMultiSelectParameter();
Map<String, String> possibleValues = getPossibleValuesForParam(paramDefEntry, paramContext);
result.setPossibleValuesOptions(possibleValues);
return result;
}
Aggregations