use of org.mifos.application.master.business.CustomValueDto in project head by mifos.
the class LookupOptionsActionStrutsTest method prepareForUpdate.
private String prepareForUpdate(String masterConstant, String configurationConstant, String listName, String addOrEdit, LookupOptionData data, String nameString) throws SystemException, ApplicationException {
CustomValueDto valueList = legacyMasterDao.getLookUpEntity(masterConstant);
Short valueListId = valueList.getEntityId();
CustomValueListElementDto valueListElement = valueList.getCustomValueListElements().get(0);
CustomValueListElementDto valueListElement1 = valueList.getCustomValueListElements().get(1);
data.setValueListId(valueListId);
String originalName = "";
if (addOrEdit.equals(ADD)) {
data.setLookupId(0);
} else {
// edit
data.setLookupId(valueListElement.getLookUpId());
originalName = valueListElement.getLookUpValue();
}
LookupOptionsActionForm form = new LookupOptionsActionForm();
// error
if (nameString.equals(DUPLICATE) && valueListElement1 != null) {
form.setLookupValue(valueListElement1.getLookUpValue());
} else {
form.setLookupValue(nameString);
}
form.setOneList(configurationConstant, valueList.getCustomValueListElements());
setActionForm(form);
return originalName;
}
use of org.mifos.application.master.business.CustomValueDto in project head by mifos.
the class LegacyMasterDaoIntegrationTest method testEntityMasterRetrieval.
@Test
public void testEntityMasterRetrieval() throws Exception {
CustomValueDto paymentTypes = legacyMasterDao.getCustomValueList(MasterConstants.ATTENDENCETYPES, "org.mifos.application.master.business.CustomerAttendanceType", "attendanceId");
List<CustomValueListElementDto> paymentValues = paymentTypes.getCustomValueListElements();
Assert.assertEquals(4, paymentValues.size());
}
use of org.mifos.application.master.business.CustomValueDto in project head by mifos.
the class LegacyMasterDaoIntegrationTest method testAddAndDeleteValueListElement.
@Test
public void testAddAndDeleteValueListElement() throws Exception {
// get the CustomValueDto that we want to add to
CustomValueDto salutationValueList = legacyMasterDao.getLookUpEntity(MasterConstants.SALUTATION);
// add a CustomValueListElementDto to the list
final String NEW_SALUTATION_STRING = "Sir";
legacyMasterDao.addValueListElementForLocale(DynamicLookUpValueCreationTypes.LookUpOption, salutationValueList.getEntityId(), NEW_SALUTATION_STRING);
StaticHibernateUtil.flushSession();
// verify that the new salutation was created
Integer newSalutationId = findValueListElementId(legacyMasterDao, MasterConstants.SALUTATION, NEW_SALUTATION_STRING);
Assert.assertTrue(newSalutationId != null);
StaticHibernateUtil.flushAndClearSession();
// remove the new salutation
legacyMasterDao.deleteValueListElement(newSalutationId);
// verify that the new salutation was deleted
Assert.assertFalse(foundStringInCustomValueList(MasterConstants.SALUTATION, NEW_SALUTATION_STRING));
}
Aggregations