Search in sources :

Example 1 with OnlyBranchOfficeHierarchyDto

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

the class GroupCustAction method chooseOffice.

@TransactionDemarcate(saveToken = true)
public ActionForward chooseOffice(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    OnlyBranchOfficeHierarchyDto officeHierarchy = customerServiceFacade.retrieveBranchOnlyOfficeHierarchy();
    SessionUtils.setAttribute(OnlyBranchOfficeHierarchyDto.IDENTIFIER, officeHierarchy, request);
    return mapping.findForward(ActionForwards.chooseOffice_success.toString());
}
Also used : OnlyBranchOfficeHierarchyDto(org.mifos.dto.screen.OnlyBranchOfficeHierarchyDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 2 with OnlyBranchOfficeHierarchyDto

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

the class CustomerServiceFacadeWebTier method retrieveBranchOnlyOfficeHierarchy.

@Override
public OnlyBranchOfficeHierarchyDto retrieveBranchOnlyOfficeHierarchy() {
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = toUserContext(user);
    OfficeDto office = officeDao.findOfficeDtoById(userContext.getBranchId());
    List<OfficeBO> branchParents = officeDao.findBranchsOnlyWithParentsMatching(office.getSearchId());
    List<OfficeDetailsDto> levels = officeDao.findActiveOfficeLevels();
    List<OfficeHierarchyDto> branchOnlyOfficeHierarchy = OfficeBO.convertToBranchOnlyHierarchyWithParentsOfficeHierarchy(branchParents);
    return new OnlyBranchOfficeHierarchyDto(userContext.getPreferredLocale(), levels, office.getSearchId(), branchOnlyOfficeHierarchy);
}
Also used : OfficeHierarchyDto(org.mifos.dto.domain.OfficeHierarchyDto) OnlyBranchOfficeHierarchyDto(org.mifos.dto.screen.OnlyBranchOfficeHierarchyDto) OfficeDto(org.mifos.dto.domain.OfficeDto) OfficeBO(org.mifos.customers.office.business.OfficeBO) OnlyBranchOfficeHierarchyDto(org.mifos.dto.screen.OnlyBranchOfficeHierarchyDto) UserContext(org.mifos.security.util.UserContext) MifosUser(org.mifos.security.MifosUser) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto)

Example 3 with OnlyBranchOfficeHierarchyDto

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

the class CenterCustAction method chooseOffice.

@TransactionDemarcate(saveToken = true)
public ActionForward chooseOffice(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    OnlyBranchOfficeHierarchyDto officeHierarchy = customerServiceFacade.retrieveBranchOnlyOfficeHierarchy();
    SessionUtils.setAttribute(OnlyBranchOfficeHierarchyDto.IDENTIFIER, officeHierarchy, request);
    SessionUtils.setAttribute(CustomerConstants.URL_MAP, null, request.getSession(false));
    return mapping.findForward(ActionForwards.chooseOffice_success.toString());
}
Also used : OnlyBranchOfficeHierarchyDto(org.mifos.dto.screen.OnlyBranchOfficeHierarchyDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 4 with OnlyBranchOfficeHierarchyDto

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

the class OfficeListTag method doStartTag.

@Override
public int doStartTag() throws JspException {
    try {
        String officeListString = "";
        OnlyBranchOfficeHierarchyDto officeHierarchyDto = (OnlyBranchOfficeHierarchyDto) pageContext.getAttribute(OnlyBranchOfficeHierarchyDto.IDENTIFIER);
        if (officeHierarchyDto != null) {
            officeListString = getOfficeList(officeHierarchyDto);
        } else {
            // FIXME - #00006 - keithw - personnel creation use this still
            UserContext userContext = (UserContext) pageContext.getSession().getAttribute(Constants.USERCONTEXT);
            OfficePersistence officePersistence = new OfficePersistence();
            OfficeBO officeBO = officePersistence.getOffice(userContext.getBranchId());
            List<OfficeDetailsDto> levels = officePersistence.getActiveLevels();
            OfficeBO loggedInOffice = officePersistence.getOffice(userContext.getBranchId());
            List<OfficeBO> branchParents = officePersistence.getBranchParents(officeBO.getSearchId());
            List<OfficeHierarchyDto> officeHierarchy = OfficeBO.convertToBranchOnlyHierarchyWithParentsOfficeHierarchy(branchParents);
            List<OfficeBO> officesTillBranchOffice = officePersistence.getOfficesTillBranchOffice(officeBO.getSearchId());
            officeListString = getOfficeList(userContext.getPreferredLocale(), levels, loggedInOffice.getSearchId(), officeHierarchy, officesTillBranchOffice);
        }
        TagUtils.getInstance().write(pageContext, officeListString);
    } catch (Exception e) {
        /**
             * This turns into a (rather ugly) error 500. TODO: make it more reasonable.
             */
        throw new JspException(e);
    }
    return EVAL_PAGE;
}
Also used : OfficeHierarchyDto(org.mifos.dto.domain.OfficeHierarchyDto) OnlyBranchOfficeHierarchyDto(org.mifos.dto.screen.OnlyBranchOfficeHierarchyDto) JspException(javax.servlet.jsp.JspException) OnlyBranchOfficeHierarchyDto(org.mifos.dto.screen.OnlyBranchOfficeHierarchyDto) OfficeBO(org.mifos.customers.office.business.OfficeBO) UserContext(org.mifos.security.util.UserContext) OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto) JspException(javax.servlet.jsp.JspException)

Example 5 with OnlyBranchOfficeHierarchyDto

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

the class PictureFormFile method chooseOffice.

@TransactionDemarcate(saveToken = true)
public ActionForward chooseOffice(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ClientCustActionForm actionForm = (ClientCustActionForm) form;
    actionForm.setGroupFlag(ClientConstants.NO);
    OnlyBranchOfficeHierarchyDto officeHierarchy = customerServiceFacade.retrieveBranchOnlyOfficeHierarchy();
    SessionUtils.setAttribute(OnlyBranchOfficeHierarchyDto.IDENTIFIER, officeHierarchy, request);
    return mapping.findForward(ActionForwards.chooseOffice_success.toString());
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) OnlyBranchOfficeHierarchyDto(org.mifos.dto.screen.OnlyBranchOfficeHierarchyDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

OnlyBranchOfficeHierarchyDto (org.mifos.dto.screen.OnlyBranchOfficeHierarchyDto)7 OfficeHierarchyDto (org.mifos.dto.domain.OfficeHierarchyDto)4 OfficeBO (org.mifos.customers.office.business.OfficeBO)3 OfficeDetailsDto (org.mifos.dto.domain.OfficeDetailsDto)3 OfficeDto (org.mifos.dto.domain.OfficeDto)3 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)3 MifosUser (org.mifos.security.MifosUser)2 UserContext (org.mifos.security.util.UserContext)2 ArrayList (java.util.ArrayList)1 JspException (javax.servlet.jsp.JspException)1 ClientCustActionForm (org.mifos.customers.client.struts.actionforms.ClientCustActionForm)1 OfficePersistence (org.mifos.customers.office.persistence.OfficePersistence)1 ListElement (org.mifos.dto.screen.ListElement)1