Search in sources :

Example 1 with ChangeAccountStatusDto

use of org.mifos.dto.screen.ChangeAccountStatusDto in project head by mifos.

the class LoanAccountServiceFacadeWebTier method retrieveAllActiveBranchesAndLoanOfficerDetails.

@Override
public ChangeAccountStatusDto retrieveAllActiveBranchesAndLoanOfficerDetails() {
    MifosUser mifosUser = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = new UserContextFactory().create(mifosUser);
    List<PersonnelDto> loanOfficers = new ArrayList<PersonnelDto>();
    List<OfficeDetailsDto> activeBranches = this.officeDao.findActiveBranches(userContext.getBranchId());
    if (onlyOneActiveBranchExists(activeBranches)) {
        OfficeDetailsDto singleOffice = activeBranches.get(0);
        CenterCreation officeDetails = new CenterCreation(singleOffice.getOfficeId(), userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
        loanOfficers = this.personnelDao.findActiveLoanOfficersForOffice(officeDetails);
    }
    boolean loanPendingApprovalStateEnabled = ProcessFlowRules.isLoanPendingApprovalStateEnabled();
    Short accountState = AccountState.LOAN_PARTIAL_APPLICATION.getValue();
    if (loanPendingApprovalStateEnabled) {
        accountState = AccountState.LOAN_PENDING_APPROVAL.getValue();
    }
    boolean centerHierarchyExists = ClientRules.getCenterHierarchyExists();
    return new ChangeAccountStatusDto(activeBranches, loanOfficers, loanPendingApprovalStateEnabled, accountState, centerHierarchyExists);
}
Also used : ChangeAccountStatusDto(org.mifos.dto.screen.ChangeAccountStatusDto) UserContext(org.mifos.security.util.UserContext) CenterCreation(org.mifos.dto.domain.CenterCreation) ArrayList(java.util.ArrayList) PersonnelDto(org.mifos.dto.domain.PersonnelDto) MifosUser(org.mifos.security.MifosUser) UserContextFactory(org.mifos.accounts.servicefacade.UserContextFactory) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto)

Example 2 with ChangeAccountStatusDto

use of org.mifos.dto.screen.ChangeAccountStatusDto in project head by mifos.

the class LoanAccountServiceFacadeWebTier method retrieveLoanOfficerDetailsForBranch.

@Override
public ChangeAccountStatusDto retrieveLoanOfficerDetailsForBranch(Short officeId) {
    MifosUser mifosUser = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = new UserContextFactory().create(mifosUser);
    CenterCreation officeDetails = new CenterCreation(officeId, userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
    List<PersonnelDto> loanOfficers = this.personnelDao.findActiveLoanOfficersForOffice(officeDetails);
    boolean loanPendingApprovalStateEnabled = ProcessFlowRules.isLoanPendingApprovalStateEnabled();
    Short accountState = AccountState.LOAN_PARTIAL_APPLICATION.getValue();
    if (loanPendingApprovalStateEnabled) {
        accountState = AccountState.LOAN_PENDING_APPROVAL.getValue();
    }
    boolean centerHierarchyExists = ClientRules.getCenterHierarchyExists();
    return new ChangeAccountStatusDto(new ArrayList<OfficeDetailsDto>(), loanOfficers, loanPendingApprovalStateEnabled, accountState, centerHierarchyExists);
}
Also used : ChangeAccountStatusDto(org.mifos.dto.screen.ChangeAccountStatusDto) UserContext(org.mifos.security.util.UserContext) CenterCreation(org.mifos.dto.domain.CenterCreation) PersonnelDto(org.mifos.dto.domain.PersonnelDto) MifosUser(org.mifos.security.MifosUser) UserContextFactory(org.mifos.accounts.servicefacade.UserContextFactory) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto)

Example 3 with ChangeAccountStatusDto

use of org.mifos.dto.screen.ChangeAccountStatusDto in project head by mifos.

the class MultipleLoanAccountsCreationAction method getLoanOfficers.

@TransactionDemarcate(joinToken = true)
public ActionForward getLoanOfficers(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    Short officeId = getShortValue(((MultipleLoanAccountsCreationActionForm) form).getBranchOfficeId());
    ChangeAccountStatusDto accountDetails = this.loanAccountServiceFacade.retrieveLoanOfficerDetailsForBranch(officeId);
    SessionUtils.setCollectionAttribute(LoanConstants.MULTIPLE_LOANS_LOAN_OFFICERS_LIST, accountDetails.getLoanOfficers(), request);
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : ChangeAccountStatusDto(org.mifos.dto.screen.ChangeAccountStatusDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 4 with ChangeAccountStatusDto

use of org.mifos.dto.screen.ChangeAccountStatusDto in project head by mifos.

the class MultipleLoanAccountsCreationAction method load.

@TransactionDemarcate(saveToken = true)
public ActionForward load(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ChangeAccountStatusDto accountDetails = this.loanAccountServiceFacade.retrieveAllActiveBranchesAndLoanOfficerDetails();
    SessionUtils.setCollectionAttribute(LoanConstants.MULTIPLE_LOANS_OFFICES_LIST, accountDetails.getActiveBranches(), request);
    Short centerHierarchyExistsValue = accountDetails.isCenterHierarchyExists() ? Constants.YES : Constants.NO;
    SessionUtils.setAttribute(LoanConstants.IS_CENTER_HIERARCHY_EXISTS, centerHierarchyExistsValue, request);
    request.getSession().setAttribute(LoanConstants.MULTIPLE_LOANS_ACTION_FORM, null);
    request.getSession().setAttribute(Constants.BUSINESS_KEY, null);
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : ChangeAccountStatusDto(org.mifos.dto.screen.ChangeAccountStatusDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 5 with ChangeAccountStatusDto

use of org.mifos.dto.screen.ChangeAccountStatusDto in project head by mifos.

the class AccountStatusAction method getLoanOfficers.

@TransactionDemarcate(joinToken = true)
public ActionForward getLoanOfficers(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse httpservletresponse) throws Exception {
    AccountStatusActionForm accountStatusActionForm = (AccountStatusActionForm) form;
    Short officeId = Short.valueOf(accountStatusActionForm.getOfficeId());
    ChangeAccountStatusDto changeAccountStatusDto = this.loanAccountServiceFacade.retrieveLoanOfficerDetailsForBranch(officeId);
    SessionUtils.setCollectionAttribute(LoanConstants.LOAN_OFFICERS, changeAccountStatusDto.getLoanOfficers(), request);
    if (officeId != null) {
        AccountStateEntity accountStateEntity = legacyMasterDao.getPersistentObject(AccountStateEntity.class, changeAccountStatusDto.getAccountState());
        SessionUtils.setAttribute(LoanConstants.LOANACCOUNTSTAES, accountStateEntity, request);
    }
    return mapping.findForward(ActionForwards.changeAccountStatus_success.toString());
}
Also used : ChangeAccountStatusDto(org.mifos.dto.screen.ChangeAccountStatusDto) AccountStatusActionForm(org.mifos.accounts.loan.struts.actionforms.AccountStatusActionForm) AccountStateEntity(org.mifos.accounts.business.AccountStateEntity) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

ChangeAccountStatusDto (org.mifos.dto.screen.ChangeAccountStatusDto)7 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)4 PersonnelDto (org.mifos.dto.domain.PersonnelDto)3 ArrayList (java.util.ArrayList)2 UserContextFactory (org.mifos.accounts.servicefacade.UserContextFactory)2 CenterCreation (org.mifos.dto.domain.CenterCreation)2 OfficeDetailsDto (org.mifos.dto.domain.OfficeDetailsDto)2 MifosUser (org.mifos.security.MifosUser)2 UserContext (org.mifos.security.util.UserContext)2 HashMap (java.util.HashMap)1 List (java.util.List)1 AccountStateEntity (org.mifos.accounts.business.AccountStateEntity)1 AccountStatusActionForm (org.mifos.accounts.loan.struts.actionforms.AccountStatusActionForm)1 CenterServiceFacade (org.mifos.application.servicefacade.CenterServiceFacade)1 CustomerDetailDto (org.mifos.dto.domain.CustomerDetailDto)1 ParameterValues (org.pentaho.reporting.engine.classic.core.parameters.ParameterValues)1