use of org.pentaho.reporting.engine.classic.core.parameters.ParameterValues in project head by mifos.
the class PentahoParamParser method updatePossibleValuesForParam.
private Map<String, String> updatePossibleValuesForParam(ListParameter paramDefEntry, ParameterContext paramContext, Map<String, AbstractPentahoParameter> selectedValues) throws ReportDataFactoryException {
Map<String, String> result = new HashMap<String, String>();
String id;
if (parameterIsOffice(paramDefEntry.getName())) {
ParameterValues paramValues = paramDefEntry.getValues(paramContext);
for (int i = 0; i < paramValues.getRowCount(); i++) {
String key = String.valueOf(paramValues.getKeyValue(i));
String value = String.valueOf(paramValues.getTextValue(i));
result.put(key, value);
}
} else if (parameterIsCenter(paramDefEntry.getName())) {
String keyValue = searchKey("(.*officer$)|(.*officer_id$)", selectedValues, paramDefEntry.getName());
if (!keyValue.equals("")) {
id = (String) selectedValues.get(keyValue).getParamValue();
if (!id.equals("-1")) {
List<CustomerDetailDto> customerList = ApplicationContextProvider.getBean(CenterServiceFacade.class).retrieveCustomersUnderUser(new Short(id));
for (CustomerDetailDto office : customerList) {
String key = office.getCustomerId().toString();
String value = office.getDisplayName();
result.put(key, value);
}
} else {
ParameterValues paramValues = paramDefEntry.getValues(paramContext);
for (int i = 0; i < paramValues.getRowCount(); i++) {
String key = String.valueOf(paramValues.getKeyValue(i));
String value = String.valueOf(paramValues.getTextValue(i));
result.put(key, value);
}
}
} else {
keyValue = searchKey("(selected_office$)|(.*BRANCH_NAME.*)", selectedValues, paramDefEntry.getName());
if (!keyValue.equals("")) {
id = (String) selectedValues.get(keyValue).getParamValue();
if (!id.equals("-1")) {
List<CustomerDetailDto> customerList = ApplicationContextProvider.getBean(CenterServiceFacade.class).retrieveCustomersUnderBranch(new Short(id));
for (CustomerDetailDto office : customerList) {
String key = office.getCustomerId().toString();
String value = office.getDisplayName();
result.put(key, value);
}
} else {
ParameterValues paramValues = paramDefEntry.getValues(paramContext);
for (int i = 0; i < paramValues.getRowCount(); i++) {
String key = String.valueOf(paramValues.getKeyValue(i));
String value = String.valueOf(paramValues.getTextValue(i));
result.put(key, value);
}
}
} else {
ParameterValues paramValues = paramDefEntry.getValues(paramContext);
for (int i = 0; i < paramValues.getRowCount(); i++) {
String key = String.valueOf(paramValues.getKeyValue(i));
String value = String.valueOf(paramValues.getTextValue(i));
result.put(key, value);
}
}
}
String key = "-1";
String value = "All";
result.put(key, value);
} else if (parameterIsGroup(paramDefEntry.getName())) {
String keyValue = searchKey("(.*officer*)", selectedValues, paramDefEntry.getName());
if (!keyValue.equals("")) {
id = (String) selectedValues.get(keyValue).getParamValue();
if (!id.equals("-1")) {
List<CustomerDetailDto> customerList = ApplicationContextProvider.getBean(CenterServiceFacade.class).retrieveGroupForPentahoReport(new Short(id));
for (CustomerDetailDto office : customerList) {
String key = office.getCustomerId().toString();
String value = office.getDisplayName();
result.put(key, value);
}
} else {
ParameterValues paramValues = paramDefEntry.getValues(paramContext);
for (int i = 0; i < paramValues.getRowCount(); i++) {
String key = String.valueOf(paramValues.getKeyValue(i));
String value = String.valueOf(paramValues.getTextValue(i));
result.put(key, value);
}
}
} else {
ParameterValues paramValues = paramDefEntry.getValues(paramContext);
for (int i = 0; i < paramValues.getRowCount(); i++) {
String key = String.valueOf(paramValues.getKeyValue(i));
String value = String.valueOf(paramValues.getTextValue(i));
result.put(key, value);
}
}
String key = "-1";
String value = "All";
result.put(key, value);
} else if (parameterIsOfficer(paramDefEntry.getName())) {
String keyValue = searchKey("(.*office$)|(.*office_id$)|(.*branch_id$)|(.*office$)|(.*selectedBranch.*)", selectedValues, paramDefEntry.getName());
if (!keyValue.equals("")) {
id = (String) selectedValues.get(keyValue).getParamValue();
if (!id.equals("-1")) {
ChangeAccountStatusDto changeAccountStatusDto = ApplicationContextProvider.getBean(LoanAccountServiceFacade.class).retrieveLoanOfficerDetailsForBranch(new Short(id));
List<PersonnelDto> officers = changeAccountStatusDto.getLoanOfficers();
for (PersonnelDto officer : officers) {
String key = officer.getPersonnelId().toString();
String value = officer.getDisplayName();
result.put(key, value);
}
}
String key = "-1";
String value = "All";
result.put(key, value);
}
} else {
ParameterValues paramValues = paramDefEntry.getValues(paramContext);
for (int i = 0; i < paramValues.getRowCount(); i++) {
String key = String.valueOf(paramValues.getKeyValue(i));
String value = String.valueOf(paramValues.getTextValue(i));
result.put(key, value);
}
}
return result;
}
use of org.pentaho.reporting.engine.classic.core.parameters.ParameterValues in project head by mifos.
the class PentahoParamParser method getPossibleValuesForParam.
private Map<String, String> getPossibleValuesForParam(ListParameter paramDefEntry, ParameterContext paramContext) throws ReportDataFactoryException {
ParameterValues paramValues = paramDefEntry.getValues(paramContext);
Map<String, String> result = new HashMap<String, String>();
for (int i = 0; i < paramValues.getRowCount(); i++) {
String key = String.valueOf(paramValues.getKeyValue(i));
String value = String.valueOf(paramValues.getTextValue(i));
result.put(key, value);
}
return result;
}
Aggregations