Search in sources :

Example 11 with CustomValueDto

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;
}
Also used : LookupOptionsActionForm(org.mifos.config.struts.actionform.LookupOptionsActionForm) CustomValueListElementDto(org.mifos.application.master.business.CustomValueListElementDto) CustomValueDto(org.mifos.application.master.business.CustomValueDto)

Example 12 with CustomValueDto

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());
}
Also used : CustomValueListElementDto(org.mifos.application.master.business.CustomValueListElementDto) CustomValueDto(org.mifos.application.master.business.CustomValueDto) Test(org.junit.Test)

Example 13 with CustomValueDto

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));
}
Also used : CustomValueDto(org.mifos.application.master.business.CustomValueDto) Test(org.junit.Test)

Aggregations

CustomValueDto (org.mifos.application.master.business.CustomValueDto)13 CustomValueListElementDto (org.mifos.application.master.business.CustomValueListElementDto)9 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)3 AccountException (org.mifos.accounts.exceptions.AccountException)3 MifosRuntimeException (org.mifos.core.MifosRuntimeException)3 HashSet (java.util.HashSet)2 Query (org.hibernate.Query)2 Session (org.hibernate.Session)2 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)2 AccountNotesEntity (org.mifos.accounts.business.AccountNotesEntity)2 AccountPenaltiesEntity (org.mifos.accounts.business.AccountPenaltiesEntity)2 LoanBO (org.mifos.accounts.loan.business.LoanBO)2 LoanPerformanceHistoryEntity (org.mifos.accounts.loan.business.LoanPerformanceHistoryEntity)2 UserContextFactory (org.mifos.accounts.servicefacade.UserContextFactory)2 CustomerNoteDto (org.mifos.dto.domain.CustomerNoteDto)2 SurveyDto (org.mifos.dto.domain.SurveyDto)2 AccountFeesDto (org.mifos.dto.screen.AccountFeesDto)2 AccountPenaltiesDto (org.mifos.dto.screen.AccountPenaltiesDto)2 LoanInformationDto (org.mifos.dto.screen.LoanInformationDto)2