Search in sources :

Example 21 with OfficeDetailsDto

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

the class CollectionSheetEntryAction method logBeforeSave.

private void logBeforeSave(final HttpServletRequest request, final BulkEntryActionForm bulkEntryActionForm, final CollectionSheetEntryGridDto bulkEntry) {
    String logMsg = "before saveData().";
    logMsg += " session id:" + request.getSession().getId();
    logMsg += ", date:" + bulkEntry.getTransactionDate();
    logMsg += ", office id:" + bulkEntryActionForm.getOfficeId();
    final OfficeDetailsDto officeDetailsDto = bulkEntry.getOffice();
    if (null != officeDetailsDto) {
        logMsg += ", office name:" + officeDetailsDto.getOfficeName();
    }
    logMsg += ", center id:" + bulkEntryActionForm.getCustomerId();
    logMsg += ".";
    logger.info(logMsg);
}
Also used : OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto)

Example 22 with OfficeDetailsDto

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

the class OfficeServiceFacadeWebTier method retrieveBranchOnlyOfficeHierarchy.

@Override
public OnlyBranchOfficeHierarchyDto retrieveBranchOnlyOfficeHierarchy() {
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    OfficeDto office = officeDao.findOfficeDtoById(user.getBranchId());
    List<OfficeBO> branchParents = officeDao.findBranchsOnlyWithParentsMatching(office.getSearchId());
    List<OfficeDetailsDto> levels = officeDao.findActiveOfficeLevels();
    List<OfficeHierarchyDto> branchOnlyOfficeHierarchy = OfficeBO.convertToBranchOnlyHierarchyWithParentsOfficeHierarchy(branchParents);
    return new OnlyBranchOfficeHierarchyDto(Locale.getDefault(), 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) MifosUser(org.mifos.security.MifosUser) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto)

Example 23 with OfficeDetailsDto

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

the class OfficeServiceFacadeWebTier method retrieveOfficeFormInformation.

@Override
public OfficeFormDto retrieveOfficeFormInformation(Short officeLevelId) {
    try {
        List<CustomFieldDto> customFields = new ArrayList<CustomFieldDto>();
        OfficeLevel officeLevel = OfficeLevel.HEADOFFICE;
        if (officeLevelId != null) {
            officeLevel = OfficeLevel.getOfficeLevel(officeLevelId);
        }
        List<OfficeDto> parents = this.officeDao.findActiveParents(officeLevel);
        for (OfficeDto office : parents) {
            String levelName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(office.getLookupNameKey());
            office.setLevelName(levelName);
        }
        List<OfficeDetailsDto> officeLevels = new OfficePersistence().getActiveLevels();
        for (OfficeDetailsDto officeDetailsDto : officeLevels) {
            String levelName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(officeDetailsDto.getLevelNameKey());
            officeDetailsDto.setLevelName(levelName);
        }
        return new OfficeFormDto(customFields, parents, officeLevels);
    } catch (PersistenceException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : OfficeDto(org.mifos.dto.domain.OfficeDto) OfficeFormDto(org.mifos.dto.screen.OfficeFormDto) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) ArrayList(java.util.ArrayList) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto) MessageLookup(org.mifos.application.master.MessageLookup) PersistenceException(org.mifos.framework.exceptions.PersistenceException) OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence) OfficeLevel(org.mifos.customers.office.util.helpers.OfficeLevel) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 24 with OfficeDetailsDto

use of org.mifos.dto.domain.OfficeDetailsDto 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 25 with OfficeDetailsDto

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

the class PersonAction method manage.

@TransactionDemarcate(joinToken = true)
public ActionForward manage(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    PersonActionForm actionform = (PersonActionForm) form;
    actionform.clear();
    PersonnelBO personnelInSession = (PersonnelBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
    PersonnelBO personnel = this.personnelDao.findPersonnelById(personnelInSession.getPersonnelId());
    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> customFieldDefs = new ArrayList<CustomFieldDefinitionEntity>();
    SessionUtils.setCollectionAttribute(CustomerConstants.CUSTOM_FIELDS_LIST, customFieldDefs, request);
    UserContext userContext = getUserContext(request);
    List<PersonnelStatusEntity> statuses = legacyMasterDao.findMasterDataEntitiesWithLocale(PersonnelStatusEntity.class);
    for (PersonnelStatusEntity personnelStatusEntity : statuses) {
        String messageTextLookup = ApplicationContextProvider.getBean(MessageLookup.class).lookup(personnelStatusEntity.getLookUpValue().getPropertiesKey());
        personnelStatusEntity.setName(messageTextLookup);
    }
    SessionUtils.setCollectionAttribute(PersonnelConstants.STATUS_LIST, statuses, request);
    OfficeBO loggedInOffice = this.officeDao.findOfficeById(userContext.getBranchId());
    List<OfficeDetailsDto> officeHierarchy = new OfficePersistence().getChildOffices(loggedInOffice.getSearchId());
    SessionUtils.setCollectionAttribute(PersonnelConstants.OFFICE_LIST, officeHierarchy, request);
    actionform.setPersonnelId(personnel.getPersonnelId().toString());
    if (personnel.getOffice() != null) {
        actionform.setOfficeId(personnel.getOffice().getOfficeId().toString());
    }
    if (personnel.getTitle() != null) {
        actionform.setTitle(personnel.getTitle().toString());
    }
    if (personnel.getLevel() != null) {
        actionform.setLevel(personnel.getLevelEnum().getValue().toString());
    }
    if (personnel.getStatus() != null) {
        actionform.setStatus(personnel.getStatus().getId().toString());
    }
    actionform.setLoginName(personnel.getUserName());
    actionform.setGlobalPersonnelNum(personnel.getGlobalPersonnelNum());
    actionform.setCustomFields(new ArrayList<CustomFieldDto>());
    if (personnel.getPersonnelDetails() != null) {
        PersonnelDetailsEntity personnelDetails = personnel.getPersonnelDetails();
        actionform.setFirstName(personnelDetails.getName().getFirstName());
        actionform.setMiddleName(personnelDetails.getName().getMiddleName());
        actionform.setSecondLastName(personnelDetails.getName().getSecondLastName());
        actionform.setLastName(personnelDetails.getName().getLastName());
        if (personnelDetails.getGender() != null) {
            actionform.setGender(personnelDetails.getGender().toString());
        }
        if (personnelDetails.getMaritalStatus() != null) {
            actionform.setMaritalStatus(personnelDetails.getMaritalStatus().toString());
        }
        actionform.setAddress(personnelDetails.getAddress());
        if (personnelDetails.getDateOfJoiningMFI() != null) {
            actionform.setDateOfJoiningMFI(DateUtils.makeDateAsSentFromBrowser(personnelDetails.getDateOfJoiningMFI()));
        }
        if (personnelDetails.getDob() != null) {
            actionform.setDob(DateUtils.makeDateAsSentFromBrowser(personnelDetails.getDob()));
        }
    }
    actionform.setEmailId(personnel.getEmailId());
    if (personnel.getPreferredLocale() != null) {
        actionform.setPreferredLocale(personnel.getPreferredLocale());
    }
    if (personnel.getPasswordExpirationDate() != null) {
        actionform.setPasswordExpirationDate(DateUtils.makeDateAsSentFromBrowser(personnel.getPasswordExpirationDate()));
    }
    List<RoleBO> selectList = new ArrayList<RoleBO>();
    for (PersonnelRoleEntity personnelRole : personnel.getPersonnelRoles()) {
        selectList.add(personnelRole.getRole());
    }
    SessionUtils.setCollectionAttribute(PersonnelConstants.PERSONNEL_ROLES_LIST, selectList, request);
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, personnel, request);
    return mapping.findForward(ActionForwards.manage_success.toString());
}
Also used : PersonnelDetailsEntity(org.mifos.customers.personnel.business.PersonnelDetailsEntity) UserContext(org.mifos.security.util.UserContext) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) ArrayList(java.util.ArrayList) PersonnelLevelEntity(org.mifos.customers.personnel.business.PersonnelLevelEntity) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto) CustomFieldDefinitionEntity(org.mifos.application.master.business.CustomFieldDefinitionEntity) PersonnelStatusEntity(org.mifos.customers.personnel.business.PersonnelStatusEntity) PersonActionForm(org.mifos.customers.personnel.struts.actionforms.PersonActionForm) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) OfficeBO(org.mifos.customers.office.business.OfficeBO) PersonnelRoleEntity(org.mifos.customers.personnel.business.PersonnelRoleEntity) MessageLookup(org.mifos.application.master.MessageLookup) OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence) ValueListElement(org.mifos.dto.domain.ValueListElement) RoleBO(org.mifos.security.rolesandpermission.business.RoleBO) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

OfficeDetailsDto (org.mifos.dto.domain.OfficeDetailsDto)37 PersonnelDto (org.mifos.dto.domain.PersonnelDto)19 ArrayList (java.util.ArrayList)13 Test (org.junit.Test)13 CustomerDto (org.mifos.dto.domain.CustomerDto)10 Date (java.util.Date)7 OfficeBO (org.mifos.customers.office.business.OfficeBO)7 UserContext (org.mifos.security.util.UserContext)6 CollectionSheetEntryGridDto (org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto)5 OfficePersistence (org.mifos.customers.office.persistence.OfficePersistence)5 OfficeDto (org.mifos.dto.domain.OfficeDto)5 CollectionSheetEntryDto (org.mifos.application.collectionsheet.business.CollectionSheetEntryDto)4 MessageLookup (org.mifos.application.master.MessageLookup)4 MeetingBO (org.mifos.application.meeting.business.MeetingBO)4 MifosRuntimeException (org.mifos.core.MifosRuntimeException)4 MifosUser (org.mifos.security.MifosUser)4 LoanAccountDto (org.mifos.accounts.loan.util.helpers.LoanAccountDto)3 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)3 SavingsOfferingBO (org.mifos.accounts.productdefinition.business.SavingsOfferingBO)3 CustomValueListElementDto (org.mifos.application.master.business.CustomValueListElementDto)3