Search in sources :

Example 21 with ValueListElement

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

the class PersonAction method load.

@TransactionDemarcate(joinToken = true)
public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    PersonActionForm personActionForm = (PersonActionForm) form;
    Short officeId = getShortValue(personActionForm.getOfficeId());
    OfficeBO office = this.officeDao.findOfficeById(officeId);
    SessionUtils.setAttribute(PersonnelConstants.OFFICE, office, request);
    personActionForm.clear();
    //Shahid - keeping the previous session objects for the sake of existing tests, once fully converted to spring
    //then we can get rid of the session objects made redundant by the dto
    DefinePersonnelDto definePersonnelDto = this.personnelServiceFacade.retrieveInfoForNewUserDefinition(officeId);
    SessionUtils.setAttribute("definePersonnelDto", definePersonnelDto, request);
    List<ValueListElement> titles = this.customerDao.retrieveTitles();
    List<ValueListElement> genders = this.customerDao.retrieveGenders();
    List<ValueListElement> maritalStatuses = this.customerDao.retrieveMaritalStatuses();
    List<ValueListElement> languages = Localization.getInstance().getLocaleForUI();
    List<RoleBO> roles = legacyRolesPermissionsDao.getRoles();
    List<PersonnelLevelEntity> personnelLevels = this.customerDao.retrievePersonnelLevels();
    SessionUtils.setCollectionAttribute(PersonnelConstants.TITLE_LIST, titles, request);
    SessionUtils.setCollectionAttribute(PersonnelConstants.PERSONNEL_LEVEL_LIST, personnelLevels, request);
    SessionUtils.setCollectionAttribute(PersonnelConstants.GENDER_LIST, genders, request);
    SessionUtils.setCollectionAttribute(PersonnelConstants.MARITAL_STATUS_LIST, maritalStatuses, request);
    SessionUtils.setCollectionAttribute(PersonnelConstants.LANGUAGE_LIST, languages, request);
    SessionUtils.setCollectionAttribute(PersonnelConstants.ROLES_LIST, roles, request);
    SessionUtils.setCollectionAttribute(PersonnelConstants.ROLEMASTERLIST, roles, request);
    List<CustomFieldDefinitionEntity> customFieldDefs1 = new ArrayList<CustomFieldDefinitionEntity>();
    SessionUtils.setCollectionAttribute(CustomerConstants.CUSTOM_FIELDS_LIST, customFieldDefs1, request);
    List<CustomFieldDto> customFields = new ArrayList<CustomFieldDto>();
    personActionForm.setCustomFields(customFields);
    if (office.getOfficeLevel() != OfficeLevel.BRANCHOFFICE) {
        for (MasterDataEntity level : personnelLevels) {
            if (level.getId().equals(PersonnelLevel.LOAN_OFFICER.getValue())) {
                personnelLevels.remove(level);
                break;
            }
        }
    }
    personActionForm.setCustomFields(new ArrayList<CustomFieldDto>());
    personActionForm.setDateOfJoiningMFI(DateUtils.makeDateAsSentFromBrowser());
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : MasterDataEntity(org.mifos.application.master.business.MasterDataEntity) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) ArrayList(java.util.ArrayList) PersonnelLevelEntity(org.mifos.customers.personnel.business.PersonnelLevelEntity) DefinePersonnelDto(org.mifos.dto.screen.DefinePersonnelDto) CustomFieldDefinitionEntity(org.mifos.application.master.business.CustomFieldDefinitionEntity) PersonActionForm(org.mifos.customers.personnel.struts.actionforms.PersonActionForm) OfficeBO(org.mifos.customers.office.business.OfficeBO) ValueListElement(org.mifos.dto.domain.ValueListElement) RoleBO(org.mifos.security.rolesandpermission.business.RoleBO) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 22 with ValueListElement

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

the class PersonAction method get.

@TransactionDemarcate(saveToken = true)
public ActionForward get(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    PersonActionForm personActionForm = (PersonActionForm) form;
    String globalId = request.getParameter("globalPersonnelNum");
    if (globalId == null) {
        globalId = personActionForm.getGlobalPersonnelNum();
    }
    PersonnelInformationDto personnelInformationDto = this.personnelServiceFacade.getPersonnelInformationDto(null, globalId);
    SessionUtils.removeThenSetAttribute("personnelInformationDto", personnelInformationDto, request);
    // John W - for other actions downstream (like edit) business_key set (until all actions refactored)
    PersonnelBO personnelBO = this.personnelDao.findPersonnelById(personnelInformationDto.getPersonnelId());
    SessionUtils.removeThenSetAttribute(Constants.BUSINESS_KEY, personnelBO, request);
    String url = String.format("PersonAction.do?globalPersonnelNum=%s", personnelBO.getGlobalPersonnelNum());
    SessionUtils.removeThenSetAttribute("currentPageUrl", url, request);
    List<ValueListElement> titles = this.customerDao.retrieveTitles();
    List<ValueListElement> genders = this.customerDao.retrieveGenders();
    List<ValueListElement> maritalStatuses = this.customerDao.retrieveMaritalStatuses();
    List<ValueListElement> languages = Localization.getInstance().getLocaleForUI();
    List<RoleBO> roles = legacyRolesPermissionsDao.getRoles();
    List<PersonnelLevelEntity> personnelLevels = this.customerDao.retrievePersonnelLevels();
    for (PersonnelLevelEntity personnelLevelEntity : personnelLevels) {
        String messageTextLookup = ApplicationContextProvider.getBean(MessageLookup.class).lookup(personnelLevelEntity.getLookUpValue().getPropertiesKey());
        personnelLevelEntity.setName(messageTextLookup);
    }
    SessionUtils.setCollectionAttribute(PersonnelConstants.TITLE_LIST, titles, request);
    SessionUtils.setCollectionAttribute(PersonnelConstants.PERSONNEL_LEVEL_LIST, personnelLevels, request);
    SessionUtils.setCollectionAttribute(PersonnelConstants.GENDER_LIST, genders, request);
    SessionUtils.setCollectionAttribute(PersonnelConstants.MARITAL_STATUS_LIST, maritalStatuses, request);
    SessionUtils.setCollectionAttribute(PersonnelConstants.LANGUAGE_LIST, languages, request);
    SessionUtils.setCollectionAttribute(PersonnelConstants.ROLES_LIST, roles, request);
    SessionUtils.setCollectionAttribute(PersonnelConstants.ROLEMASTERLIST, roles, request);
    List<CustomFieldDefinitionEntity> customFieldDefs1 = new ArrayList<CustomFieldDefinitionEntity>();
    SessionUtils.setCollectionAttribute(CustomerConstants.CUSTOM_FIELDS_LIST, customFieldDefs1, request);
    List<CustomFieldDto> customFields = new ArrayList<CustomFieldDto>();
    personActionForm.setCustomFields(customFields);
    return mapping.findForward(ActionForwards.get_success.toString());
}
Also used : PersonnelInformationDto(org.mifos.dto.screen.PersonnelInformationDto) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) ArrayList(java.util.ArrayList) PersonnelLevelEntity(org.mifos.customers.personnel.business.PersonnelLevelEntity) CustomFieldDefinitionEntity(org.mifos.application.master.business.CustomFieldDefinitionEntity) PersonActionForm(org.mifos.customers.personnel.struts.actionforms.PersonActionForm) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) MessageLookup(org.mifos.application.master.MessageLookup) ValueListElement(org.mifos.dto.domain.ValueListElement) RoleBO(org.mifos.security.rolesandpermission.business.RoleBO) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 23 with ValueListElement

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

the class ClientServiceFacadeWebTier method retrieveClientDropdownData.

private ClientDropdownsDto retrieveClientDropdownData() {
    List<ValueListElement> salutations = this.customerDao.retrieveSalutations();
    List<ValueListElement> genders = this.customerDao.retrieveGenders();
    List<ValueListElement> maritalStatuses = this.customerDao.retrieveMaritalStatuses();
    List<ValueListElement> citizenship = this.customerDao.retrieveCitizenship();
    List<ValueListElement> ethnicity = this.customerDao.retrieveEthnicity();
    List<ValueListElement> educationLevels = this.customerDao.retrieveEducationLevels();
    List<ValueListElement> businessActivity = this.customerDao.retrieveBusinessActivities();
    List<ValueListElement> poverty = this.customerDao.retrievePoverty();
    List<ValueListElement> handicapped = this.customerDao.retrieveHandicapped();
    List<ValueListElement> livingStatus = this.customerDao.retrieveLivingStatus();
    ClientDropdownsDto clientDropdowns = new ClientDropdownsDto(salutations, genders, maritalStatuses, citizenship, ethnicity, educationLevels, businessActivity, poverty, handicapped, livingStatus);
    return clientDropdowns;
}
Also used : ClientDropdownsDto(org.mifos.dto.screen.ClientDropdownsDto) ValueListElement(org.mifos.dto.domain.ValueListElement)

Example 24 with ValueListElement

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

the class ClientServiceFacadeWebTier method retrieveClientFamilyDetails.

@Override
public ClientFamilyDetailsDto retrieveClientFamilyDetails() {
    List<ValueListElement> genders = new ArrayList<ValueListElement>();
    List<ValueListElement> livingStatus = new ArrayList<ValueListElement>();
    List<FamilyDetailDto> familyDetails = new ArrayList<FamilyDetailDto>();
    boolean familyDetailsRequired = ClientRules.isFamilyDetailsRequired();
    if (familyDetailsRequired) {
        genders = this.customerDao.retrieveGenders();
        livingStatus = this.customerDao.retrieveLivingStatus();
        familyDetails.add(new FamilyDetailDto());
    }
    return new ClientFamilyDetailsDto(familyDetailsRequired, familyDetails, genders, livingStatus);
}
Also used : ArrayList(java.util.ArrayList) ClientFamilyDetailsDto(org.mifos.dto.domain.ClientFamilyDetailsDto) ClientFamilyDetailDto(org.mifos.dto.screen.ClientFamilyDetailDto) FamilyDetailDto(org.mifos.dto.domain.FamilyDetailDto) ValueListElement(org.mifos.dto.domain.ValueListElement)

Example 25 with ValueListElement

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

the class LoanAccountServiceFacadeWebTier method retrieveMultipleLoanAccountDetails.

@Override
public MultipleLoanAccountDetailsDto retrieveMultipleLoanAccountDetails(String searchId, Short branchId, Integer productId) {
    List<ClientBO> clients = this.customerDao.findActiveClientsUnderParent(searchId, branchId);
    if (clients.isEmpty()) {
        throw new BusinessRuleException(LoanConstants.NOSEARCHRESULTS);
    }
    LoanOfferingBO loanOffering = this.loanProductDao.findById(productId);
    // FIXME - Refactor MultipleLoanCreationDto into proper Dto
    List<MultipleLoanCreationDto> multipleLoanDetails = buildClientViewHelper(loanOffering, clients);
    List<ValueListElement> allLoanPruposes = this.loanProductDao.findAllLoanPurposes();
    boolean loanPendingApprovalStateEnabled = ProcessFlowRules.isLoanPendingApprovalStateEnabled();
    return new MultipleLoanAccountDetailsDto(allLoanPruposes, loanPendingApprovalStateEnabled);
}
Also used : BusinessRuleException(org.mifos.service.BusinessRuleException) MultipleLoanAccountDetailsDto(org.mifos.dto.screen.MultipleLoanAccountDetailsDto) ClientBO(org.mifos.customers.client.business.ClientBO) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) MultipleLoanCreationDto(org.mifos.accounts.loan.util.helpers.MultipleLoanCreationDto) ValueListElement(org.mifos.dto.domain.ValueListElement)

Aggregations

ValueListElement (org.mifos.dto.domain.ValueListElement)32 ArrayList (java.util.ArrayList)25 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)10 UserContext (org.mifos.security.util.UserContext)10 HashMap (java.util.HashMap)8 LoanAccountDetailsDto (org.mifos.dto.domain.LoanAccountDetailsDto)8 CustomerStatusDetailDto (org.mifos.dto.screen.CustomerStatusDetailDto)8 MessageLookup (org.mifos.application.master.MessageLookup)7 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)7 LoanBO (org.mifos.accounts.loan.business.LoanBO)6 MifosRuntimeException (org.mifos.core.MifosRuntimeException)6 ClientBO (org.mifos.customers.client.business.ClientBO)6 LocalDate (org.joda.time.LocalDate)5 CustomFieldDefinitionEntity (org.mifos.application.master.business.CustomFieldDefinitionEntity)5 PersonnelLevelEntity (org.mifos.customers.personnel.business.PersonnelLevelEntity)4 CustSearchActionForm (org.mifos.customers.struts.actionforms.CustSearchActionForm)4 ApplicationException (org.mifos.framework.exceptions.ApplicationException)4 MifosUser (org.mifos.security.MifosUser)4 RoleBO (org.mifos.security.rolesandpermission.business.RoleBO)4 Date (java.util.Date)3