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()));
}
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;
}
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);
}
}
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;
}
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;
}
Aggregations