Search in sources :

Example 41 with ClientNameDetailDto

use of org.mifos.dto.screen.ClientNameDetailDto in project head by mifos.

the class TestObjectFactory method createClient.

public static ClientBO createClient(final String customerName, final MeetingBO meeting, final CustomerStatus status) {
    ClientBO client;
    try {
        PersonnelBO systemUser = getPersonnel(PersonnelConstants.SYSTEM_USER);
        ClientNameDetailDto clientNameDetailDto = new ClientNameDetailDto(NameType.CLIENT.getValue(), SAMPLE_SALUTATION, customerName, "middle", customerName, "secondLast");
        clientNameDetailDto.setNames(ClientRules.getNameSequence());
        ClientNameDetailDto spouseNameDetailView = new ClientNameDetailDto(NameType.SPOUSE.getValue(), SAMPLE_SALUTATION, customerName, "middle", customerName, "secondLast");
        ClientPersonalDetailDto clientPersonalDetailDto = new ClientPersonalDetailDto(1, 1, 1, 1, 1, 1, Short.valueOf("1"), Short.valueOf("1"), Short.valueOf("41"));
        client = new ClientBO(TestUtils.makeUserWithLocales(), clientNameDetailDto.getDisplayName(), status, null, null, null, null, getFees(), null, systemUser, new OfficePersistence().getOffice(SAMPLE_BRANCH_OFFICE), meeting, systemUser, new DateTimeService().getCurrentJavaDateTime(), null, null, null, YesNoFlag.NO.getValue(), clientNameDetailDto, spouseNameDetailView, clientPersonalDetailDto, null);
        ApplicationContextProvider.getBean(LegacyClientDao.class).saveClient(client);
        StaticHibernateUtil.flushSession();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return client;
}
Also used : MifosRuntimeException(org.mifos.core.MifosRuntimeException) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) ClientNameDetailDto(org.mifos.dto.screen.ClientNameDetailDto) ClientBO(org.mifos.customers.client.business.ClientBO) ClientPersonalDetailDto(org.mifos.dto.screen.ClientPersonalDetailDto) LegacyClientDao(org.mifos.customers.client.persistence.LegacyClientDao) OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence) DateTimeService(org.mifos.framework.util.DateTimeService) SystemException(org.mifos.framework.exceptions.SystemException) MifosRuntimeException(org.mifos.core.MifosRuntimeException) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) ApplicationException(org.mifos.framework.exceptions.ApplicationException) CustomerException(org.mifos.customers.exceptions.CustomerException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) MeetingException(org.mifos.application.meeting.exceptions.MeetingException) OfficeException(org.mifos.customers.office.exceptions.OfficeException)

Aggregations

ClientNameDetailDto (org.mifos.dto.screen.ClientNameDetailDto)41 ClientPersonalDetailDto (org.mifos.dto.screen.ClientPersonalDetailDto)26 CustomerException (org.mifos.customers.exceptions.CustomerException)15 Test (org.junit.Test)14 ClientBO (org.mifos.customers.client.business.ClientBO)14 ArrayList (java.util.ArrayList)12 ClientFamilyDetailDto (org.mifos.dto.screen.ClientFamilyDetailDto)10 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)9 OfficePersistence (org.mifos.customers.office.persistence.OfficePersistence)8 Address (org.mifos.framework.business.util.Address)8 ClientCustActionForm (org.mifos.customers.client.struts.actionforms.ClientCustActionForm)7 OfficeBO (org.mifos.customers.office.business.OfficeBO)7 AddressDto (org.mifos.dto.domain.AddressDto)7 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)7 DateTime (org.joda.time.DateTime)6 MeetingBO (org.mifos.application.meeting.business.MeetingBO)6 UserContext (org.mifos.security.util.UserContext)6 InputStream (java.io.InputStream)5 ClientCreationDetail (org.mifos.dto.domain.ClientCreationDetail)5 MeetingDto (org.mifos.dto.domain.MeetingDto)5