Search in sources :

Example 11 with Address

use of org.mifos.framework.business.util.Address in project head by mifos.

the class OffActionForm method populate.

public void populate(OfficeBO officeBO) throws OfficeException {
    this.officeId = officeBO.getOfficeId().toString();
    this.officeLevel = officeBO.getOfficeLevel().getValue().toString();
    this.officeStatus = officeBO.getOfficeStatus().getValue().toString();
    this.officeName = officeBO.getOfficeName();
    this.shortName = officeBO.getShortName();
    if (officeBO.getAddress() != null && officeBO.getAddress().getAddress() != null) {
        this.address.setLine1(officeBO.getAddress().getAddress().getLine1());
        this.address.setLine2(officeBO.getAddress().getAddress().getLine2());
        this.address.setLine3(officeBO.getAddress().getAddress().getLine3());
        this.address.setPhoneNumber(officeBO.getAddress().getAddress().getPhoneNumber());
        this.address.setCity(officeBO.getAddress().getAddress().getCity());
        this.address.setState(officeBO.getAddress().getAddress().getState());
        this.address.setCountry(officeBO.getAddress().getAddress().getCountry());
        this.address.setZip(officeBO.getAddress().getAddress().getZip());
    } else {
        this.address = new Address();
    }
    if (officeBO.getParentOffice() != null) {
        this.parentOfficeId = officeBO.getParentOffice().getOfficeId().toString();
    } else {
        this.parentOfficeId = null;
    }
}
Also used : Address(org.mifos.framework.business.util.Address)

Example 12 with Address

use of org.mifos.framework.business.util.Address in project head by mifos.

the class GroupCreationUsingCustomerServiceIntegrationTest method shouldSaveAllDetailsToDoWithGroup.

@Test
public void shouldSaveAllDetailsToDoWithGroup() throws Exception {
    // setup
    Address address = new Address("line1", "line2", "line3", "city", "state", "country", "zip", "phonenumber");
    GroupBO group = new GroupBuilder().withName("newGroup").withAddress(address).withStatus(CustomerStatus.GROUP_ACTIVE).withParentCustomer(existingCenter).formedBy(existingUser).build();
    // exercise test
    customerService.createGroup(group, existingMeeting, noAccountFees);
    // verification
    assertThat(group.getDisplayName(), is("newGroup"));
    assertThat(group.getAddress().getDisplayAddress(), is("line1, line2, line3"));
    assertThat(group.getSearchId(), is("1." + group.getParentCustomer().getCustomerId() + ".3"));
    assertThat(group.getStatus(), is(CustomerStatus.GROUP_ACTIVE));
    assertThat(group.getGroupPerformanceHistory().getGroup().getCustomerId(), is(group.getCustomerId()));
    assertThat(group.getCustomFields().size(), is(0));
    assertThat(group.getMaxChildCount(), is(0));
    assertThat(existingCenter.getMaxChildCount(), is(3));
}
Also used : Address(org.mifos.framework.business.util.Address) GroupBuilder(org.mifos.domain.builders.GroupBuilder) GroupBO(org.mifos.customers.group.business.GroupBO) Test(org.junit.Test)

Example 13 with Address

use of org.mifos.framework.business.util.Address in project head by mifos.

the class ClientCustActionStrutsTest method createClientForAuditLog.

private void createClientForAuditLog() throws Exception {
    OfficeBO office = new OfficePersistence().getOffice(TestObjectFactory.HEAD_OFFICE);
    PersonnelBO personnel = legacyPersonnelDao.getPersonnel(PersonnelConstants.TEST_USER);
    meeting = getMeeting();
    Integer salutation = 47;
    Integer ethnicity = 218;
    Integer citizenship = 130;
    Integer handicapped = 138;
    Integer businessActivities = 225;
    Integer educationLevel = 226;
    Short numChildren = Short.valueOf("1");
    Short gender = Short.valueOf("49");
    Short povertyStatus = Short.valueOf("41");
    StaticHibernateUtil.startTransaction();
    ClientNameDetailDto clientNameDetailDto = new ClientNameDetailDto(NameType.CLIENT.getValue(), salutation, "Client", "", "1", "");
    clientNameDetailDto.setNames(ClientRules.getNameSequence());
    ClientNameDetailDto spouseNameDetailView = new ClientNameDetailDto(NameType.SPOUSE.getValue(), TestObjectFactory.SAMPLE_SALUTATION, "first", "middle", "last", "secondLast");
    spouseNameDetailView.setNames(ClientRules.getNameSequence());
    ClientPersonalDetailDto clientPersonalDetailDto = new ClientPersonalDetailDto(ethnicity, citizenship, handicapped, businessActivities, ClientPersonalDetailDto.MARRIED, educationLevel, numChildren, gender, povertyStatus);
    client = new ClientBO(TestUtils.makeUser(), clientNameDetailDto.getDisplayName(), CustomerStatus.fromInt(new Short("1")), null, null, new Address(), getCustomFields(), null, null, personnel, office, meeting, personnel, new java.util.Date(), null, null, null, YesNoFlag.NO.getValue(), clientNameDetailDto, spouseNameDetailView, clientPersonalDetailDto, null);
    legacyClientDao.saveClient(client);
    StaticHibernateUtil.flushAndClearSession();
    client = TestObjectFactory.getClient(new Integer(client.getCustomerId()).intValue());
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, client, request);
}
Also used : Address(org.mifos.framework.business.util.Address) OfficeBO(org.mifos.customers.office.business.OfficeBO) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) ClientNameDetailDto(org.mifos.dto.screen.ClientNameDetailDto) ClientPersonalDetailDto(org.mifos.dto.screen.ClientPersonalDetailDto) ClientBO(org.mifos.customers.client.business.ClientBO) OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence) Date(java.util.Date)

Example 14 with Address

use of org.mifos.framework.business.util.Address in project head by mifos.

the class TestObjectFactory method getAddressHelper.

/**
     * This is just a helper method which returns a address object , this is just a helper it does not persist any data.
     */
public static Address getAddressHelper() {
    Address address = new Address();
    address.setLine1("line1");
    address.setCity("city");
    address.setCountry("country");
    return address;
}
Also used : Address(org.mifos.framework.business.util.Address)

Example 15 with Address

use of org.mifos.framework.business.util.Address in project head by mifos.

the class OfficeBO method update.

public void update(UserContext userContext, OfficeUpdateRequest officeUpdateRequest, OfficeBO newParentOffice) throws OfficeException {
    updateDetails(userContext);
    OfficeStatus officeStatus = OfficeStatus.getOfficeStatus(officeUpdateRequest.getNewStatus());
    OfficeLevel officeLevel = OfficeLevel.getOfficeLevel(officeUpdateRequest.getNewlevel());
    Address address = null;
    AddressDto dto = officeUpdateRequest.getAddress();
    if (dto != null) {
        address = new Address(dto.getLine1(), dto.getLine2(), dto.getLine3(), dto.getCity(), dto.getState(), dto.getCountry(), dto.getZip(), dto.getPhoneNumber());
    }
    update(officeUpdateRequest.getOfficeName(), officeUpdateRequest.getShortName(), officeStatus, officeLevel, newParentOffice, address, new ArrayList<CustomFieldDto>());
}
Also used : Address(org.mifos.framework.business.util.Address) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) AddressDto(org.mifos.dto.domain.AddressDto) OfficeStatus(org.mifos.customers.office.util.helpers.OfficeStatus) OfficeLevel(org.mifos.customers.office.util.helpers.OfficeLevel)

Aggregations

Address (org.mifos.framework.business.util.Address)42 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)22 ArrayList (java.util.ArrayList)17 OfficeBO (org.mifos.customers.office.business.OfficeBO)17 AddressDto (org.mifos.dto.domain.AddressDto)16 CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)14 DateTime (org.joda.time.DateTime)11 Date (java.util.Date)10 MifosRuntimeException (org.mifos.core.MifosRuntimeException)10 UserContext (org.mifos.security.util.UserContext)9 MeetingBO (org.mifos.application.meeting.business.MeetingBO)8 ClientNameDetailDto (org.mifos.dto.screen.ClientNameDetailDto)8 MifosUser (org.mifos.security.MifosUser)8 BusinessRuleException (org.mifos.service.BusinessRuleException)8 CustomerException (org.mifos.customers.exceptions.CustomerException)7 Name (org.mifos.framework.business.util.Name)7 HashSet (java.util.HashSet)5 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)5 ClientBO (org.mifos.customers.client.business.ClientBO)5 ApplicableAccountFeeDto (org.mifos.dto.domain.ApplicableAccountFeeDto)5