Search in sources :

Example 11 with CustomValueListElementDto

use of org.mifos.application.master.business.CustomValueListElementDto in project head by mifos.

the class LookupOptionsActionStrutsTest method verifyOneListAndRestoreOriginalValues.

/**
     * Verify that the name of the first element has been changed, restore the
     * original name, then verify that an element was added to the list, then
     * remove it to leave the list in its original state.
     */
private void verifyOneListAndRestoreOriginalValues(String masterConstant, String configurationConstant, String listName, String originalName) throws SystemException, ApplicationException {
    CustomValueDto valueList = legacyMasterDao.getLookUpEntity(masterConstant);
    List<CustomValueListElementDto> elementList = valueList.getCustomValueListElements();
    // compare the updated element
    CustomValueListElementDto valueListElement = elementList.get(0);
    Assert.assertEquals(UPDATE_NAME, valueListElement.getLookUpValue());
    // restore the original name
    legacyMasterDao.updateValueListElementForLocale(valueListElement.getLookUpId(), originalName);
    // compare the added element
    valueListElement = elementList.get(elementList.size() - 1);
    Assert.assertEquals(NEW_ELEMENT_NAME, valueListElement.getLookUpValue());
    // remove the added element from the list
    legacyMasterDao.deleteValueListElement(Integer.valueOf(valueListElement.getLookUpId()));
}
Also used : CustomValueListElementDto(org.mifos.application.master.business.CustomValueListElementDto) CustomValueDto(org.mifos.application.master.business.CustomValueDto)

Example 12 with CustomValueListElementDto

use of org.mifos.application.master.business.CustomValueListElementDto in project head by mifos.

the class LookupOptionsActionStrutsTest method setupAddOrEditForOneList.

private String setupAddOrEditForOneList(String masterConstant, String configurationConstant, String listName, String addOrEdit) throws SystemException, ApplicationException {
    CustomValueDto valueList = legacyMasterDao.getLookUpEntity(masterConstant);
    Short valueListId = valueList.getEntityId();
    CustomValueListElementDto valueListElement = valueList.getCustomValueListElements().get(0);
    addRequestParameter(ConfigurationConstants.ENTITY, configurationConstant);
    addRequestParameter(ConfigurationConstants.ADD_OR_EDIT, addOrEdit);
    SessionUtils.setAttribute(configurationConstant, valueListId, request);
    String originalName = "";
    if (addOrEdit.equals(ADD)) {
        CustomValueListElementDto newValueListElement = new CustomValueListElementDto();
        newValueListElement.setLookupValue(NEW_ELEMENT_NAME);
        String[] changesList = { MifosValueList.mapAddedCustomValueListElementToString(newValueListElement) };
        addRequestParameter(listName, changesList);
    } else {
        // edit
        originalName = valueListElement.getLookUpValue();
        valueListElement.setLookupValue(UPDATE_NAME);
        String[] changesList = { MifosValueList.mapUpdatedCustomValueListElementToString(valueListElement) };
        addRequestParameter(listName, changesList);
    }
    return originalName;
}
Also used : CustomValueListElementDto(org.mifos.application.master.business.CustomValueListElementDto) CustomValueDto(org.mifos.application.master.business.CustomValueDto)

Example 13 with CustomValueListElementDto

use of org.mifos.application.master.business.CustomValueListElementDto in project head by mifos.

the class CollectionSheetServiceFacadeWebTier method generateCollectionSheetEntryGridView.

@Override
public CollectionSheetEntryGridDto generateCollectionSheetEntryGridView(final CollectionSheetFormEnteredDataDto formEnteredDataDto, final MifosCurrency currency) {
    final CollectionSheetDto collectionSheet = getCollectionSheet(formEnteredDataDto.getCustomer().getCustomerId(), DateUtils.getLocalDateFromDate(formEnteredDataDto.getMeetingDate()));
    try {
        final List<CustomValueListElementDto> attendanceTypesList = legacyMasterDao.getCustomValueList(MasterConstants.ATTENDENCETYPES, "org.mifos.application.master.business.CustomerAttendanceType", "attendanceId").getCustomValueListElements();
        final CollectionSheetEntryGridDto translatedGridView = collectionSheetTranslator.toLegacyDto(collectionSheet, formEnteredDataDto, attendanceTypesList, currency);
        return translatedGridView;
    } catch (SystemException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : SystemException(org.mifos.framework.exceptions.SystemException) CustomValueListElementDto(org.mifos.application.master.business.CustomValueListElementDto) CollectionSheetEntryGridDto(org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 14 with CustomValueListElementDto

use of org.mifos.application.master.business.CustomValueListElementDto in project head by mifos.

the class LegacyMasterDao method getCustomValueListElements.

@SuppressWarnings("unchecked")
private List<CustomValueListElementDto> getCustomValueListElements(final String entityName, final String entityClass, final String column, final Session session) {
    Query queryEntity = session.createQuery("select new org.mifos.application.master.business.CustomValueListElementDto(" + "mainTable." + column + " ,lookup.lookUpId,lookupvalue.lookUpValue,lookup.lookUpName) " + "from org.mifos.application.master.business.LookUpValueEntity lookup," + "org.mifos.application.master.business.LookUpValueLocaleEntity lookupvalue," + entityClass + " mainTable " + "where mainTable.lookUpId = lookup.lookUpId" + " and lookup.lookUpEntity.entityType = ?" + " and lookup.lookUpId = lookupvalue.lookUpId" + " and lookupvalue.localeId = ?");
    queryEntity.setString(0, entityName);
    queryEntity.setShort(1, (short) 1);
    List<CustomValueListElementDto> entityList = queryEntity.list();
    return entityList;
}
Also used : Query(org.hibernate.Query) CustomValueListElementDto(org.mifos.application.master.business.CustomValueListElementDto)

Example 15 with CustomValueListElementDto

use of org.mifos.application.master.business.CustomValueListElementDto in project head by mifos.

the class BulkEntryTag method doStartTag.

@SuppressWarnings("unchecked")
@Override
public int doStartTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    JspWriter out = pageContext.getOut();
    StringBuilder builder = new StringBuilder();
    CollectionSheetEntryGridDto bulkEntry = null;
    try {
        bulkEntry = (CollectionSheetEntryGridDto) SessionUtils.getAttribute(CollectionSheetEntryConstants.BULKENTRY, request);
    } catch (PageExpiredException e) {
        logger.error("Page expired getting BulkEntryBO.");
    }
    if (null != bulkEntry) {
        List<ProductDto> loanProducts = bulkEntry.getLoanProducts();
        List<ProductDto> savingsProducts = bulkEntry.getSavingProducts();
        try {
            final List<CustomValueListElementDto> custAttTypes = (List<CustomValueListElementDto>) SessionUtils.getAttribute(CollectionSheetEntryConstants.CUSTOMERATTENDANCETYPES, request);
            String method = request.getParameter(CollectionSheetEntryConstants.METHOD);
            generateTagData(bulkEntry, loanProducts, savingsProducts, custAttTypes, method, builder);
        } catch (ApplicationException ae) {
            throw new JspException(ae);
        } catch (SystemException se) {
            throw new JspException(se);
        }
    }
    try {
        out.write(builder.toString());
    } catch (IOException ioe) {
        throw new JspException(ioe);
    }
    return SKIP_BODY;
}
Also used : CustomValueListElementDto(org.mifos.application.master.business.CustomValueListElementDto) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException) IOException(java.io.IOException) JspWriter(javax.servlet.jsp.JspWriter) HttpServletRequest(javax.servlet.http.HttpServletRequest) JspException(javax.servlet.jsp.JspException) ApplicationException(org.mifos.framework.exceptions.ApplicationException) SystemException(org.mifos.framework.exceptions.SystemException) List(java.util.List) ProductDto(org.mifos.application.servicefacade.ProductDto) CollectionSheetEntryGridDto(org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto)

Aggregations

CustomValueListElementDto (org.mifos.application.master.business.CustomValueListElementDto)20 CustomValueDto (org.mifos.application.master.business.CustomValueDto)9 ArrayList (java.util.ArrayList)7 CollectionSheetEntryGridDto (org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto)6 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)4 MeetingBO (org.mifos.application.meeting.business.MeetingBO)4 ProductDto (org.mifos.application.servicefacade.ProductDto)4 MifosRuntimeException (org.mifos.core.MifosRuntimeException)4 Query (org.hibernate.Query)3 Test (org.junit.Test)3 AccountException (org.mifos.accounts.exceptions.AccountException)3 LoanAccountDto (org.mifos.accounts.loan.util.helpers.LoanAccountDto)3 SavingsOfferingBO (org.mifos.accounts.productdefinition.business.SavingsOfferingBO)3 CollectionSheetEntryDto (org.mifos.application.collectionsheet.business.CollectionSheetEntryDto)3 OfficeDetailsDto (org.mifos.dto.domain.OfficeDetailsDto)3 PersonnelDto (org.mifos.dto.domain.PersonnelDto)3 SystemException (org.mifos.framework.exceptions.SystemException)3 Date (java.util.Date)2 HashSet (java.util.HashSet)2 JspException (javax.servlet.jsp.JspException)2