use of org.mifos.core.MifosRuntimeException in project head by mifos.
the class PictureFormFile method get.
@TransactionDemarcate(saveToken = true)
public ActionForward get(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
String clientSystemId = ((ClientCustActionForm) form).getGlobalCustNum();
ClientInformationDto clientInformationDto;
try {
clientInformationDto = clientServiceFacade.getClientInformationDto(clientSystemId);
} catch (MifosRuntimeException e) {
if (e.getCause() instanceof ApplicationException) {
throw (ApplicationException) e.getCause();
}
throw e;
}
// John W - for breadcrumb or another other action downstream that exists business_key set (until refactored)
ClientBO clientBO = (ClientBO) this.customerDao.findCustomerById(clientInformationDto.getClientDisplay().getCustomerId());
SessionUtils.removeThenSetAttribute(Constants.BUSINESS_KEY, clientBO, request);
SessionUtils.setAttribute(ClientConstants.IS_PHOTO_FIELD_HIDDEN, FieldConfig.getInstance().isFieldHidden("Client.Photo"), request);
setCurrentPageUrl(request, clientBO);
setQuestionGroupInstances(request, clientBO);
InformationOrderServiceFacade informationOrderServiceFacade = ApplicationContextProvider.getBean(InformationOrderServiceFacade.class);
SessionUtils.removeThenSetAttribute("clientInformationDto", clientInformationDto, request);
request.getSession().setAttribute("guarantyClientInformation", loanAccountServiceFacade.retrieveGuarantyClientInformation(clientInformationDto));
QuestionnaireServiceFacade questionnaireServiceFacade = questionnaireServiceFacadeLocator.getService(request);
List<QuestionGroupInstanceDetail> questions = new ArrayList<QuestionGroupInstanceDetail>();
questions.addAll(questionnaireServiceFacade.getQuestionGroupInstancesWithUnansweredQuestionGroups(clientInformationDto.getClientDisplay().getCustomerId(), "Create", "Client"));
questions.addAll(questionnaireServiceFacade.getQuestionGroupInstancesWithUnansweredQuestionGroups(clientInformationDto.getClientDisplay().getCustomerId(), "View", "Client"));
questions.addAll(questionnaireServiceFacade.getQuestionGroupInstancesWithUnansweredQuestionGroups(clientInformationDto.getClientDisplay().getCustomerId(), "Close", "Client"));
SessionUtils.setCollectionAttribute("questionGroups", questions, request);
SessionUtils.setCollectionAttribute("personalInformationOrder", informationOrderServiceFacade.getInformationOrder("Client"), request);
return mapping.findForward(ActionForwards.get_success.toString());
}
use of org.mifos.core.MifosRuntimeException in project head by mifos.
the class SystemInformationServiceFacadeWebTier method getServerInformation.
@Override
public String getServerInformation(ServletContext context, Locale locale) {
try {
DatabaseMetaData metaData = StaticHibernateUtil.getSessionTL().connection().getMetaData();
final SystemInfo systemInfo = new SystemInfo(metaData, context, locale, true);
return systemInfo.getApplicationServerInfo();
} catch (HibernateException e) {
throw new MifosRuntimeException(e);
} catch (SQLException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.core.MifosRuntimeException in project head by mifos.
the class SystemInformationServiceFacadeWebTier method getSystemInformation.
@Override
public SystemInformationDto getSystemInformation(ServletContext context, Locale locale) {
try {
DatabaseMetaData metaData = StaticHibernateUtil.getSessionTL().connection().getMetaData();
final SystemInfo systemInfo = new SystemInfo(metaData, context, locale, true);
systemInfo.setCustomReportsDir(BirtReportsUploadAction.getCustomReportStorageDirectory());
return new SystemInformationDto(systemInfo.getApplicationServerInfo(), systemInfo.getApplicationVersion(), systemInfo.getBuildDate(), systemInfo.getBuildNumber(), systemInfo.getCommitIdentifier(), systemInfo.getCustomReportsDir(), systemInfo.getDatabaseName(), systemInfo.getDatabasePort(), systemInfo.getDatabaseServer(), systemInfo.getDatabaseUser(), systemInfo.getDatabaseVendor(), systemInfo.getDatabaseVersion(), systemInfo.getDriverName(), systemInfo.getDriverVersion(), systemInfo.getDateTimeString(), systemInfo.getDateTimeStringIso8601(), systemInfo.getInfoSource(), systemInfo.getInfoURL(), systemInfo.getJavaVendor(), systemInfo.getJavaVersion(), systemInfo.getOsArch(), systemInfo.getOsName(), systemInfo.getOsUser(), systemInfo.getOsVersion(), systemInfo.getReleaseName());
} catch (HibernateException e) {
throw new MifosRuntimeException(e);
} catch (SQLException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.core.MifosRuntimeException in project head by mifos.
the class ApplyChargeActionForm method validate.
@Override
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
Locale locale = getUserContext(request).getPreferredLocale();
ActionErrors errors = new ActionErrors();
String methodCalled = request.getParameter(MethodNameConstants.METHOD);
boolean groupLoanWithMembers = AccountingRules.isGroupLoanWithMembers();
AccountBusinessService service = new AccountBusinessService();
AccountBO accountBO = null;
if (groupLoanWithMembers) {
try {
accountBO = service.getAccount(Integer.valueOf(getAccountId()));
} catch (ServiceException e) {
throw new MifosRuntimeException(e);
}
}
if (groupLoanWithMembers && accountBO.isParentGroupLoanAccount()) {
if (methodCalled != null && methodCalled.equals("divide")) {
if (StringUtils.isNotBlank(selectedChargeFormula)) {
validateRate(errors, request);
}
validateAmount(errors, locale);
}
if (methodCalled != null && methodCalled.equals("update")) {
validateHashMap(errors);
}
if (!errors.isEmpty()) {
request.setAttribute(Globals.ERROR_KEY, errors);
if (methodCalled.equals("divide")) {
request.setAttribute("methodCalled", "update");
} else if (methodCalled.equals("update")) {
request.setAttribute("methodCalled", "create");
} else {
request.setAttribute("methodCalled", methodCalled);
}
}
} else {
if (null != methodCalled) {
if ((Methods.update.toString()).equals(methodCalled)) {
if (StringUtils.isNotBlank(selectedChargeFormula)) {
validateRate(errors, request);
}
validateAmount(errors, locale);
}
}
if (!errors.isEmpty()) {
request.setAttribute(Globals.ERROR_KEY, errors);
request.setAttribute("methodCalled", methodCalled);
}
}
return errors;
}
use of org.mifos.core.MifosRuntimeException in project head by mifos.
the class StandardTestingService method runAllBatchJobs.
@Override
public void runAllBatchJobs(final ServletContext ctx) {
logger.info("running all batch jobs");
MifosScheduler mifosScheduler = (MifosScheduler) ctx.getAttribute(MifosScheduler.class.getName());
try {
mifosScheduler.runAllTasks();
} catch (TaskSystemException se) {
throw new MifosRuntimeException("Scheduler's inner exception while running all batch jobs!", se);
}
}
Aggregations