use of org.mifos.application.master.business.CustomValueDto 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.CustomValueDto in project head by mifos.
the class LegacyMasterDao method getLookUpEntity.
/**
* Only two non-test usages, one that may never be called and one for getting labels.
*/
@Transactional
public CustomValueDto getLookUpEntity(final String entityName) throws SystemException {
Session session = getSession();
Query queryEntity = session.getNamedQuery("masterdata.entityvalue");
queryEntity.setString("entityType", entityName);
CustomValueDto entity = (CustomValueDto) queryEntity.uniqueResult();
entity.setCustomValueListElements(lookUpValue(entityName, session));
return entity;
}
use of org.mifos.application.master.business.CustomValueDto in project head by mifos.
the class LookupOptionsAction method populateConfigurationListBox.
private void populateConfigurationListBox(String configurationEntity, LegacyMasterDao legacyMasterDao, Short localeId, HttpServletRequest request, LookupOptionsActionForm lookupOptionsActionForm, String configurationEntityConst) throws Exception {
CustomValueDto valueList = legacyMasterDao.getLookUpEntity(configurationEntity);
Short valueListId = valueList.getEntityId();
// save this value and will be retrieved when update the data to db
SessionUtils.setAttribute(configurationEntityConst, valueListId, request);
if (configurationEntity.equals(MasterConstants.SALUTATION)) {
lookupOptionsActionForm.setSalutations(valueList.getCustomValueListElements());
} else if (configurationEntity.equals(MasterConstants.PERSONNEL_TITLE)) {
lookupOptionsActionForm.setUserTitles(valueList.getCustomValueListElements());
} else if (configurationEntity.equals(MasterConstants.MARITAL_STATUS)) {
lookupOptionsActionForm.setMaritalStatuses(valueList.getCustomValueListElements());
} else if (configurationEntity.equals(MasterConstants.ETHNICITY)) {
lookupOptionsActionForm.setEthnicities(valueList.getCustomValueListElements());
} else if (configurationEntity.equals(MasterConstants.EDUCATION_LEVEL)) {
lookupOptionsActionForm.setEducationLevels(valueList.getCustomValueListElements());
} else if (configurationEntity.equals(MasterConstants.CITIZENSHIP)) {
lookupOptionsActionForm.setCitizenships(valueList.getCustomValueListElements());
} else if (configurationEntity.equals(MasterConstants.BUSINESS_ACTIVITIES)) {
lookupOptionsActionForm.setBusinessActivities(valueList.getCustomValueListElements());
} else if (configurationEntity.equals(MasterConstants.LOAN_PURPOSES)) {
lookupOptionsActionForm.setPurposesOfLoan(valueList.getCustomValueListElements());
} else if (configurationEntity.equals(MasterConstants.COLLATERAL_TYPES)) {
lookupOptionsActionForm.setCollateralTypes(valueList.getCustomValueListElements());
} else if (configurationEntity.equals(MasterConstants.HANDICAPPED)) {
lookupOptionsActionForm.setHandicappeds(valueList.getCustomValueListElements());
} else if (configurationEntity.equals(MasterConstants.OFFICER_TITLES)) {
lookupOptionsActionForm.setOfficerTitles(valueList.getCustomValueListElements());
} else if (configurationEntity.equals(MasterConstants.PAYMENT_TYPE)) {
lookupOptionsActionForm.setPaymentTypes(valueList.getCustomValueListElements());
} else {
throw new Exception("Invalid configuration type in LookupOptionAction. Type is " + configurationEntity);
}
}
use of org.mifos.application.master.business.CustomValueDto in project head by mifos.
the class LegacyMasterDao method getCustomValueList.
/**
* Used once in getMasterData, otherwise, test usage and one other method
* MifosPropertyMessageResources.getCustomValueListElements (and that method may never be called)
*/
public CustomValueDto getCustomValueList(final String entityName, final String classPath, final String column) throws SystemException {
Session session = null;
session = getSession();
Query queryEntity = session.getNamedQuery("masterdata.entityvalue");
queryEntity.setString("entityType", entityName);
CustomValueDto entity = (CustomValueDto) queryEntity.uniqueResult();
List<CustomValueListElementDto> listElements = getCustomValueListElements(entityName, classPath, column, session);
entity.setCustomValueListElements(listElements);
return entity;
}
use of org.mifos.application.master.business.CustomValueDto in project head by mifos.
the class LookupOptionsActionStrutsTest method setupNoSelectionForOneList.
private void setupNoSelectionForOneList(String masterConstant, String configurationConstant, String listName) throws SystemException, ApplicationException {
CustomValueDto valueList = legacyMasterDao.getLookUpEntity(masterConstant);
Short valueListId = valueList.getEntityId();
addRequestParameter(ConfigurationConstants.ENTITY, configurationConstant);
addRequestParameter(ConfigurationConstants.ADD_OR_EDIT, EDIT);
SessionUtils.setAttribute(configurationConstant, valueListId, request);
addRequestParameter(listName, "");
}
Aggregations