Search in sources :

Example 1 with UserDetailDto

use of org.mifos.dto.domain.UserDetailDto in project head by mifos.

the class DashboardServiceFacadeWebTier method getLoanOfficerId.

private Short getLoanOfficerId() {
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    Short uId = new Short((short) user.getUserId());
    UserDetailDto uDetails = centerServiceFacade.retrieveUsersDetails(uId);
    Short loanOfficerId = null;
    if (uDetails.isLoanOfficer()) {
        loanOfficerId = uId;
    }
    return loanOfficerId;
}
Also used : UserDetailDto(org.mifos.dto.domain.UserDetailDto) MifosUser(org.mifos.security.MifosUser)

Example 2 with UserDetailDto

use of org.mifos.dto.domain.UserDetailDto in project head by mifos.

the class PersonnelSettingsAction method manage.

@TransactionDemarcate(joinToken = true)
public ActionForward manage(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    PersonnelBO personnel = (PersonnelBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
    // FIXME - provide all details through userDetailDto
    UserDetailDto userInfo = this.personnelServiceFacade.retrieveUserInformation(personnel.getPersonnelId());
    PersonnelSettingsActionForm form1 = (PersonnelSettingsActionForm) form;
    form1.setFirstName(userInfo.getFirstName());
    form1.setMiddleName(personnel.getPersonnelDetails().getName().getMiddleName());
    form1.setSecondLastName(personnel.getPersonnelDetails().getName().getSecondLastName());
    form1.setLastName(userInfo.getLastName());
    form1.setGender(getStringValue(personnel.getPersonnelDetails().getGender()));
    form1.setUserName(personnel.getUserName());
    form1.setEmailId(personnel.getEmailId());
    form1.setGovernmentIdNumber(personnel.getPersonnelDetails().getGovernmentIdNumber());
    form1.setAddress(personnel.getPersonnelDetails().getAddress());
    form1.setDob(personnel.getPersonnelDetails().getDob().toString());
    form1.setPreferredLocale(personnel.getPreferredLocale().toString());
    form1.setPreferredSiteTypeId(personnel.getSitePreference());
    form1.setMaritalStatus(getStringValue(personnel.getPersonnelDetails().getMaritalStatus()));
    return mapping.findForward(ActionForwards.manage_success.toString());
}
Also used : PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) UserDetailDto(org.mifos.dto.domain.UserDetailDto) PersonnelSettingsActionForm(org.mifos.customers.personnel.struts.actionforms.PersonnelSettingsActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 3 with UserDetailDto

use of org.mifos.dto.domain.UserDetailDto in project head by mifos.

the class CustSearchAction method getHomePage.

@TransactionDemarcate(saveToken = true)
public ActionForward getHomePage(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    CustSearchActionForm actionForm = (CustSearchActionForm) form;
    actionForm.setSearchString(null);
    cleanUpSearch(request);
    UserContext userContext = getUserContext(request);
    UserDetailDto userDetails = this.centerServiceFacade.retrieveUsersDetails(userContext.getId());
    SessionUtils.setAttribute("isCenterHierarchyExists", ClientRules.getCenterHierarchyExists(), request);
    loadMasterData(userContext.getId(), request, actionForm);
    if (userDetails.isLoanOfficer()) {
        loadLoanOfficerCustomersHierarchyForSelectedDay(userContext.getId(), request, actionForm);
    }
    DashboardDto dashboardDto = dashboardServiceFacade.getDashboardDto();
    SessionUtils.setAttribute("dashboard", dashboardDto, request);
    HashMap<String, ArrayList<CustomerStatusDetailDto>> customerStates = new HashMap<String, ArrayList<CustomerStatusDetailDto>>();
    customerStates.putAll(customerSearchServiceFacade.getAvailibleCustomerStates());
    SessionUtils.setMapAttribute("availibleCustomerStates", customerStates, request);
    List<ValueListElement> availibleClientGenders = clientServiceFacade.getClientGenders();
    SessionUtils.setCollectionAttribute("availibleClientGenders", availibleClientGenders, request);
    return mapping.findForward(CustomerConstants.GETHOMEPAGE_SUCCESS);
}
Also used : CustomerStatusDetailDto(org.mifos.dto.screen.CustomerStatusDetailDto) CustSearchActionForm(org.mifos.customers.struts.actionforms.CustSearchActionForm) HashMap(java.util.HashMap) UserContext(org.mifos.security.util.UserContext) UserDetailDto(org.mifos.dto.domain.UserDetailDto) ArrayList(java.util.ArrayList) ValueListElement(org.mifos.dto.domain.ValueListElement) DashboardDto(org.mifos.dto.domain.DashboardDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 4 with UserDetailDto

use of org.mifos.dto.domain.UserDetailDto in project head by mifos.

the class PersonAction method create.

@TransactionDemarcate(validateAndResetToken = true)
public ActionForward create(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    PersonActionForm personActionForm = (PersonActionForm) form;
    CreateOrUpdatePersonnelInformation perosonnelInfo = translateFormToCreatePersonnelInformationDto(request, personActionForm);
    try {
        UserDetailDto userDetails = this.personnelServiceFacade.createPersonnelInformation(perosonnelInfo);
        String globalPersonnelNum = userDetails.getSystemId();
        Name name = new Name(personActionForm.getFirstName(), personActionForm.getMiddleName(), personActionForm.getSecondLastName(), personActionForm.getLastName());
        request.setAttribute("displayName", name.getDisplayName());
        request.setAttribute("globalPersonnelNum", globalPersonnelNum);
        createGroupQuestionnaire.saveResponses(request, personActionForm, userDetails.getId());
        return mapping.findForward(ActionForwards.create_success.toString());
    } catch (BusinessRuleException e) {
        throw new PersonnelException(e.getMessageKey(), e, e.getMessageValues());
    }
}
Also used : PersonActionForm(org.mifos.customers.personnel.struts.actionforms.PersonActionForm) BusinessRuleException(org.mifos.service.BusinessRuleException) CreateOrUpdatePersonnelInformation(org.mifos.dto.domain.CreateOrUpdatePersonnelInformation) UserDetailDto(org.mifos.dto.domain.UserDetailDto) PersonnelException(org.mifos.customers.personnel.exceptions.PersonnelException) Name(org.mifos.framework.business.util.Name) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 5 with UserDetailDto

use of org.mifos.dto.domain.UserDetailDto in project head by mifos.

the class SystemUserSearchController method displaySystemUsers.

@RequestMapping(method = RequestMethod.GET)
public ModelAndView displaySystemUsers(ModelMap model) {
    ModelAndView mav = new ModelAndView("viewSystemUsers");
    SystemUserSearchFormBean formBean = (SystemUserSearchFormBean) model.get("searchResults");
    SystemUserSearchResultsDto result = (SystemUserSearchResultsDto) model.get("pagedResults");
    if (result == null) {
        List<UserDetailDto> pagedUserDetails = new ArrayList<UserDetailDto>();
        result = new SystemUserSearchResultsDto(0, 0, 0, 0, pagedUserDetails);
        formBean = new SystemUserSearchFormBean();
    }
    mav.addObject("searchResults", formBean);
    mav.addObject("pagedResults", result);
    return mav;
}
Also used : UserDetailDto(org.mifos.dto.domain.UserDetailDto) ModelAndView(org.springframework.web.servlet.ModelAndView) ArrayList(java.util.ArrayList) SystemUserSearchResultsDto(org.mifos.dto.screen.SystemUserSearchResultsDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

UserDetailDto (org.mifos.dto.domain.UserDetailDto)10 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)4 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)3 ValueListElement (org.mifos.dto.domain.ValueListElement)3 MifosUser (org.mifos.security.MifosUser)3 PersonnelException (org.mifos.customers.personnel.exceptions.PersonnelException)2 PersonActionForm (org.mifos.customers.personnel.struts.actionforms.PersonActionForm)2 CreateOrUpdatePersonnelInformation (org.mifos.dto.domain.CreateOrUpdatePersonnelInformation)2 CustomerStatusDetailDto (org.mifos.dto.screen.CustomerStatusDetailDto)2 SystemUserSearchResultsDto (org.mifos.dto.screen.SystemUserSearchResultsDto)2 Name (org.mifos.framework.business.util.Name)2 BusinessRuleException (org.mifos.service.BusinessRuleException)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ModelAndView (org.springframework.web.servlet.ModelAndView)2 IncludePage (freemarker.ext.servlet.IncludePage)1 HashSet (java.util.HashSet)1 Criteria (org.hibernate.Criteria)1 Session (org.hibernate.Session)1