use of org.mifos.core.MifosRuntimeException in project head by mifos.
the class PentahoParamParser method parseReportParams.
public List<AbstractPentahoParameter> parseReportParams(MasterReport report, HttpServletRequest request, Map<String, AbstractPentahoParameter> selectedValues, boolean update) {
ParameterContext paramContext = null;
try {
paramContext = new DefaultParameterContext(report);
ReportParameterDefinition paramDefinition = report.getParameterDefinition();
List<AbstractPentahoParameter> result = new ArrayList<AbstractPentahoParameter>();
for (ParameterDefinitionEntry paramDefEntry : paramDefinition.getParameterDefinitions()) {
result.add(parseParam(paramDefEntry, paramContext, selectedValues, update));
}
return result;
} catch (ReportDataFactoryException ex) {
throw new JNDIException("Problem with Pentaho Reports", request);
} catch (Exception ex) {
throw new MifosRuntimeException(ex);
} finally {
if (paramContext != null) {
try {
paramContext.close();
} catch (ReportDataFactoryException ex) {
logger.error("Exception while closing parameter context", ex);
}
}
}
}
use of org.mifos.core.MifosRuntimeException in project head by mifos.
the class ImportClientsController method parseFile.
public ParsedClientsDto parseFile(ImportClientsFormBean importClientsFormBean) {
ParsedClientsDto result = null;
CommonsMultipartFile file = importClientsFormBean.getFile();
InputStream is = null;
if (file == null) {
throw new MifosRuntimeException("File cannot be null");
}
try {
is = file.getInputStream();
result = importClientsServiceFacade.parseImportClients(is);
} catch (IOException ex) {
result = importClientsServiceFacade.createDtoFromSingleError(ex.getMessage());
} finally {
closeStream(is);
importClientsFormBean.setFile(null);
}
return result;
}
use of org.mifos.core.MifosRuntimeException in project head by mifos.
the class ImportLoansController method parseFile.
/**
* Parse xls file.
* @param importLoansFormBean
* @return
*/
public ParsedLoansDto parseFile(ImportLoansFormBean importLoansFormBean) {
ParsedLoansDto result = null;
CommonsMultipartFile file = importLoansFormBean.getFile();
InputStream is = null;
if (file == null) {
throw new MifosRuntimeException("File cannot be null");
}
try {
is = file.getInputStream();
result = importLSServiceFacade.parseImportLoans(is);
} catch (IOException ex) {
result = importLSServiceFacade.createLoansDtoFromSingleError(ex.getMessage());
} finally {
closeStream(is);
importLoansFormBean.setFile(null);
}
return result;
}
use of org.mifos.core.MifosRuntimeException in project head by mifos.
the class ImportSavingsController method parseFile.
public ParsedSavingsDto parseFile(ImportSavingsFormBean importSavingsFormBean) {
ParsedSavingsDto result = null;
CommonsMultipartFile file = importSavingsFormBean.getFile();
InputStream is = null;
if (file == null) {
throw new MifosRuntimeException("File cannot be null");
}
try {
is = file.getInputStream();
result = importLoansSavingsFacade.parseImportSavings(is);
} catch (IOException ex) {
result = importLoansSavingsFacade.createSavingsDtoFromSingleError(ex.getMessage());
} finally {
closeStream(is);
importSavingsFormBean.setFile(null);
}
return result;
}
use of org.mifos.core.MifosRuntimeException in project head by mifos.
the class SaveCollectionSheetStructureValidatorIntegrationTest method testShouldGetINVALID_TOP_CUSTOMERIfTopCustomerNotFound.
@Test
public void testShouldGetINVALID_TOP_CUSTOMERIfTopCustomerNotFound() throws Exception {
LocalDate validDate = new LocalDate();
Short validPaymentType = PaymentTypes.CHEQUE.getValue();
Short validUserId = Short.valueOf("1");
Integer invalidCustomerId = 500000;
SaveCollectionSheetDto saveCollectionSheet = null;
try {
List<SaveCollectionSheetCustomerDto> saveCollectionSheetCustomers = new ArrayList<SaveCollectionSheetCustomerDto>();
SaveCollectionSheetCustomerDto saveCollectionSheetCustomer = new SaveCollectionSheetCustomerDto(invalidCustomerId, null, null, null, null, null, null);
saveCollectionSheetCustomers.add(saveCollectionSheetCustomer);
saveCollectionSheet = new SaveCollectionSheetDto(saveCollectionSheetCustomers, validPaymentType, validDate, null, null, validUserId);
} catch (SaveCollectionSheetException e) {
throw new MifosRuntimeException(e.printInvalidSaveCollectionSheetReasons());
}
verifyInvalidReason(saveCollectionSheet, InvalidSaveCollectionSheetReason.INVALID_TOP_CUSTOMER);
}
Aggregations