Search in sources :

Example 1 with PentahoMultiSelectParameter

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);
        }
    }
}
Also used : AbstractPentahoParameter(org.mifos.reports.pentaho.params.AbstractPentahoParameter) PentahoSingleSelectParameter(org.mifos.reports.pentaho.params.PentahoSingleSelectParameter) PentahoMultiSelectParameter(org.mifos.reports.pentaho.params.PentahoMultiSelectParameter)

Example 2 with PentahoMultiSelectParameter

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;
}
Also used : PentahoDateParameter(org.mifos.reports.pentaho.params.PentahoDateParameter) PentahoSingleSelectParameter(org.mifos.reports.pentaho.params.PentahoSingleSelectParameter) PentahoInputParameter(org.mifos.reports.pentaho.params.PentahoInputParameter) PentahoMultiSelectParameter(org.mifos.reports.pentaho.params.PentahoMultiSelectParameter) LocalDate(org.joda.time.LocalDate) Date(java.util.Date) LocalDate(org.joda.time.LocalDate)

Example 3 with PentahoMultiSelectParameter

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;
}
Also used : PentahoMultiSelectParameter(org.mifos.reports.pentaho.params.PentahoMultiSelectParameter)

Aggregations

PentahoMultiSelectParameter (org.mifos.reports.pentaho.params.PentahoMultiSelectParameter)3 PentahoSingleSelectParameter (org.mifos.reports.pentaho.params.PentahoSingleSelectParameter)2 Date (java.util.Date)1 LocalDate (org.joda.time.LocalDate)1 AbstractPentahoParameter (org.mifos.reports.pentaho.params.AbstractPentahoParameter)1 PentahoDateParameter (org.mifos.reports.pentaho.params.PentahoDateParameter)1 PentahoInputParameter (org.mifos.reports.pentaho.params.PentahoInputParameter)1