Search in sources :

Example 1 with SavingsActionForm

use of org.mifos.accounts.savings.struts.actionforms.SavingsActionForm in project head by mifos.

the class SavingsAction method edit.

@TransactionDemarcate(joinToken = true)
public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    logger.debug("In SavingsAction::edit()");
    SavingsBO savings = (SavingsBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
    SavingsActionForm actionForm = (SavingsActionForm) form;
    List<CustomFieldDto> customFields = new ArrayList<CustomFieldDto>();
    actionForm.setRecommendedAmount(savings.getRecommendedAmount().toString());
    actionForm.setAccountCustomFieldSet(customFields);
    List<CustomFieldDefinitionEntity> customFieldDefinitions = new ArrayList<CustomFieldDefinitionEntity>();
    SessionUtils.setCollectionAttribute(SavingsConstants.CUSTOM_FIELDS, customFieldDefinitions, request);
    return mapping.findForward("edit_success");
}
Also used : SavingsActionForm(org.mifos.accounts.savings.struts.actionforms.SavingsActionForm) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) ArrayList(java.util.ArrayList) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) CustomFieldDefinitionEntity(org.mifos.application.master.business.CustomFieldDefinitionEntity) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 2 with SavingsActionForm

use of org.mifos.accounts.savings.struts.actionforms.SavingsActionForm in project head by mifos.

the class SavingsAction method waiveAmountOverDue.

@TransactionDemarcate(joinToken = true)
public ActionForward waiveAmountOverDue(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    logger.debug("In SavingsAction::waiveAmountOverDue()");
    UserContext uc = (UserContext) SessionUtils.getAttribute(Constants.USER_CONTEXT_KEY, request.getSession());
    SavingsBO savings = (SavingsBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
    Integer versionNum = savings.getVersionNo();
    savings = this.savingsDao.findBySystemId(((SavingsActionForm) form).getGlobalAccountNum());
    checkVersionMismatch(versionNum, savings.getVersionNo());
    savings.setUserContext(uc);
    Long savingsId = savings.getAccountId().longValue();
    this.savingsServiceFacade.waiveDepositAmountOverDue(savingsId);
    return mapping.findForward("waiveAmount_success");
}
Also used : SavingsActionForm(org.mifos.accounts.savings.struts.actionforms.SavingsActionForm) UserContext(org.mifos.security.util.UserContext) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 3 with SavingsActionForm

use of org.mifos.accounts.savings.struts.actionforms.SavingsActionForm in project head by mifos.

the class SavingsAction method getPrdOfferings.

@TransactionDemarcate(saveToken = true)
public ActionForward getPrdOfferings(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    SavingsActionForm savingsActionForm = ((SavingsActionForm) form);
    doCleanUp(savingsActionForm, request);
    Integer customerId = Integer.valueOf(savingsActionForm.getCustomerId());
    CustomerBO customer = this.customerDao.findCustomerById(customerId);
    SessionUtils.setAttribute(SavingsConstants.CLIENT, customer, request);
    List<PrdOfferingDto> savingPrds = this.savingsServiceFacade.retrieveApplicableSavingsProductsForCustomer(customerId);
    SessionUtils.setCollectionAttribute(SavingsConstants.SAVINGS_PRD_OFFERINGS, savingPrds, request);
    return mapping.findForward(AccountConstants.GET_PRDOFFERINGS_SUCCESS);
}
Also used : SavingsActionForm(org.mifos.accounts.savings.struts.actionforms.SavingsActionForm) CustomerBO(org.mifos.customers.business.CustomerBO) PrdOfferingDto(org.mifos.dto.domain.PrdOfferingDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 4 with SavingsActionForm

use of org.mifos.accounts.savings.struts.actionforms.SavingsActionForm in project head by mifos.

the class SavingsAction method getDepositDueDetails.

@TransactionDemarcate(saveToken = true)
public ActionForward getDepositDueDetails(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    logger.debug("In SavingsAction::getDepositDueDetails()");
    SavingsActionForm actionform = (SavingsActionForm) form;
    UserContext uc = (UserContext) SessionUtils.getAttribute(Constants.USER_CONTEXT_KEY, request.getSession());
    SessionUtils.removeAttribute(Constants.BUSINESS_KEY, request);
    String savingsSystemId = actionform.getGlobalAccountNum();
    SavingsBO savings = savingsDao.findBySystemId(savingsSystemId);
    for (AccountActionDateEntity actionDate : savings.getAccountActionDates()) {
        Hibernate.initialize(actionDate);
    }
    Hibernate.initialize(savings.getAccountNotes());
    for (AccountFlagMapping accountFlagMapping : savings.getAccountFlags()) {
        Hibernate.initialize(accountFlagMapping.getFlag());
    }
    Hibernate.initialize(savings.getAccountFlags());
    savings.setUserContext(uc);
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, savings, request);
    SavingsAccountDepositDueDto depositDueDetails = this.savingsServiceFacade.retrieveDepositDueDetails(savingsSystemId);
    return mapping.findForward("depositduedetails_success");
}
Also used : SavingsActionForm(org.mifos.accounts.savings.struts.actionforms.SavingsActionForm) AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) AccountFlagMapping(org.mifos.accounts.business.AccountFlagMapping) UserContext(org.mifos.security.util.UserContext) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) SavingsAccountDepositDueDto(org.mifos.dto.screen.SavingsAccountDepositDueDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 5 with SavingsActionForm

use of org.mifos.accounts.savings.struts.actionforms.SavingsActionForm in project head by mifos.

the class SavingsAction method load.

@TransactionDemarcate(joinToken = true)
public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    SavingsActionForm savingsActionForm = ((SavingsActionForm) form);
    logger.debug(" selectedPrdOfferingId: " + savingsActionForm.getSelectedPrdOfferingId());
    UserContext uc = (UserContext) SessionUtils.getAttribute(Constants.USER_CONTEXT_KEY, request.getSession());
    List<InterestCalcTypeEntity> interestCalculationTypes = this.savingsProductDao.retrieveInterestCalculationTypes();
    SessionUtils.setCollectionAttribute(MasterConstants.INTEREST_CAL_TYPES, interestCalculationTypes, request);
    Integer productId = Integer.valueOf(savingsActionForm.getSelectedPrdOfferingId());
    SavingsOfferingBO savingsOfferingBO = this.savingsProductDao.findById(productId);
    SessionUtils.setAttribute(SavingsConstants.PRDOFFERING, savingsOfferingBO, request);
    // NOTE - these details are included in SavingsProductReferenceDto but left as is to satisfy JSP at present
    SessionUtils.setCollectionAttribute(MasterConstants.SAVINGS_TYPE, legacyMasterDao.findMasterDataEntitiesWithLocale(SavingsTypeEntity.class), request);
    SessionUtils.setCollectionAttribute(MasterConstants.RECOMMENDED_AMOUNT_UNIT, legacyMasterDao.findMasterDataEntitiesWithLocale(RecommendedAmntUnitEntity.class), request);
    List<CustomFieldDefinitionEntity> customFieldDefinitions = new ArrayList<CustomFieldDefinitionEntity>();
    SessionUtils.setCollectionAttribute(SavingsConstants.CUSTOM_FIELDS, customFieldDefinitions, request);
    SavingsProductReferenceDto savingsProductReferenceDto = this.savingsServiceFacade.retrieveSavingsProductReferenceData(productId);
    savingsActionForm.setRecommendedAmount(savingsProductReferenceDto.getSavingsProductDetails().getAmountForDeposit().toString());
    List<CustomFieldDto> customFields = CustomFieldDefinitionEntity.toDto(customFieldDefinitions, uc.getPreferredLocale());
    savingsActionForm.setAccountCustomFieldSet(customFields);
    return mapping.findForward("load_success");
}
Also used : InterestCalcTypeEntity(org.mifos.accounts.productdefinition.business.InterestCalcTypeEntity) UserContext(org.mifos.security.util.UserContext) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) ArrayList(java.util.ArrayList) SavingsProductReferenceDto(org.mifos.dto.screen.SavingsProductReferenceDto) RecommendedAmntUnitEntity(org.mifos.accounts.productdefinition.business.RecommendedAmntUnitEntity) CustomFieldDefinitionEntity(org.mifos.application.master.business.CustomFieldDefinitionEntity) SavingsActionForm(org.mifos.accounts.savings.struts.actionforms.SavingsActionForm) SavingsTypeEntity(org.mifos.accounts.productdefinition.business.SavingsTypeEntity) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

SavingsActionForm (org.mifos.accounts.savings.struts.actionforms.SavingsActionForm)12 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)11 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)7 UserContext (org.mifos.security.util.UserContext)6 ArrayList (java.util.ArrayList)3 CustomFieldDefinitionEntity (org.mifos.application.master.business.CustomFieldDefinitionEntity)3 RecommendedAmntUnitEntity (org.mifos.accounts.productdefinition.business.RecommendedAmntUnitEntity)2 SavingsOfferingBO (org.mifos.accounts.productdefinition.business.SavingsOfferingBO)2 SavingsTypeEntity (org.mifos.accounts.productdefinition.business.SavingsTypeEntity)2 CustomerBO (org.mifos.customers.business.CustomerBO)2 CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)2 Test (org.junit.Test)1 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)1 AccountFlagMapping (org.mifos.accounts.business.AccountFlagMapping)1 InterestCalcTypeEntity (org.mifos.accounts.productdefinition.business.InterestCalcTypeEntity)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 PrdOfferingDto (org.mifos.dto.domain.PrdOfferingDto)1 SavingsAccountCreationDto (org.mifos.dto.domain.SavingsAccountCreationDto)1 SavingsAccountDetailDto (org.mifos.dto.domain.SavingsAccountDetailDto)1 SavingsAccountDepositDueDto (org.mifos.dto.screen.SavingsAccountDepositDueDto)1