Search in sources :

Example 41 with MifosRuntimeException

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());
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) InformationOrderServiceFacade(org.mifos.platform.questionnaire.service.InformationOrderServiceFacade) ApplicationException(org.mifos.framework.exceptions.ApplicationException) ClientBO(org.mifos.customers.client.business.ClientBO) ArrayList(java.util.ArrayList) ClientInformationDto(org.mifos.dto.screen.ClientInformationDto) QuestionnaireServiceFacade(org.mifos.platform.questionnaire.service.QuestionnaireServiceFacade) MifosRuntimeException(org.mifos.core.MifosRuntimeException) QuestionGroupInstanceDetail(org.mifos.platform.questionnaire.service.QuestionGroupInstanceDetail) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 42 with MifosRuntimeException

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);
    }
}
Also used : SystemInfo(org.mifos.application.admin.system.SystemInfo) HibernateException(org.hibernate.HibernateException) SQLException(java.sql.SQLException) DatabaseMetaData(java.sql.DatabaseMetaData) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 43 with MifosRuntimeException

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);
    }
}
Also used : SystemInfo(org.mifos.application.admin.system.SystemInfo) HibernateException(org.hibernate.HibernateException) SQLException(java.sql.SQLException) DatabaseMetaData(java.sql.DatabaseMetaData) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 44 with MifosRuntimeException

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;
}
Also used : Locale(java.util.Locale) AccountBO(org.mifos.accounts.business.AccountBO) AccountBusinessService(org.mifos.accounts.business.service.AccountBusinessService) ServiceException(org.mifos.framework.exceptions.ServiceException) ActionErrors(org.apache.struts.action.ActionErrors) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 45 with MifosRuntimeException

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);
    }
}
Also used : TaskSystemException(org.mifos.framework.components.batchjobs.exceptions.TaskSystemException) MifosScheduler(org.mifos.framework.components.batchjobs.MifosScheduler) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Aggregations

MifosRuntimeException (org.mifos.core.MifosRuntimeException)305 PersistenceException (org.mifos.framework.exceptions.PersistenceException)136 ArrayList (java.util.ArrayList)102 BusinessRuleException (org.mifos.service.BusinessRuleException)95 UserContext (org.mifos.security.util.UserContext)94 MifosUser (org.mifos.security.MifosUser)87 AccountException (org.mifos.accounts.exceptions.AccountException)79 ServiceException (org.mifos.framework.exceptions.ServiceException)69 ApplicationException (org.mifos.framework.exceptions.ApplicationException)48 LoanBO (org.mifos.accounts.loan.business.LoanBO)41 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)39 UserContextFactory (org.mifos.accounts.servicefacade.UserContextFactory)37 MeetingException (org.mifos.application.meeting.exceptions.MeetingException)36 LocalDate (org.joda.time.LocalDate)35 CustomerBO (org.mifos.customers.business.CustomerBO)29 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)28 InvalidDateException (org.mifos.application.admin.servicefacade.InvalidDateException)27 CustomerException (org.mifos.customers.exceptions.CustomerException)27 Money (org.mifos.framework.util.helpers.Money)27 AccountBO (org.mifos.accounts.business.AccountBO)25