Search in sources :

Example 1 with State

use of org.incode.module.country.dom.impl.State in project estatio by estatio.

the class PostalAddressDtoFactory method newDto.

@Programmatic
public PostalAddressDto newDto(final PostalAddress postalAddress) {
    PostalAddressDto dto = new PostalAddressDto();
    dto.setSelf(mappingHelper.oidDtoFor(postalAddress));
    dto.setAddress1(postalAddress.getAddress1());
    dto.setAddress2(postalAddress.getAddress2());
    dto.setAddress3(postalAddress.getAddress3());
    dto.setCity(postalAddress.getCity());
    final State postalAddressState = postalAddress.getState();
    if (postalAddressState != null) {
        dto.setStateReference(postalAddressState.getReference());
        dto.setStateName(postalAddressState.getName());
    }
    final Country postalAddressCountry = postalAddress.getCountry();
    if (postalAddressCountry != null) {
        dto.setCountryReference(postalAddressCountry.getReference());
        dto.setCountryAlpha2Code(postalAddressCountry.getAlpha2Code());
        dto.setCountryName(postalAddressCountry.getName());
    }
    return dto;
}
Also used : PostalAddressDto(org.estatio.canonical.communicationchannel.v1.PostalAddressDto) State(org.incode.module.country.dom.impl.State) Country(org.incode.module.country.dom.impl.Country) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 2 with State

use of org.incode.module.country.dom.impl.State in project estatio by estatio.

the class OrganisationCommsBuilder method createPostalAddress.

private void createPostalAddress(final ExecutionContext ec) {
    defaultParam("legalAddress", ec, true);
    final Country country = objectFor(this.country_d, ec);
    final State state = stateRepository.findState(stateReference);
    this.postalAddress = communicationChannelRepository.newPostal(organisation, CommunicationChannelType.POSTAL_ADDRESS, address1, address2, null, postalCode, city, state, country);
    postalAddress.setLegal(legalAddress);
    transactionService.flushTransaction();
    ec.addResult(this, organisation.getReference() + "/postalAddress", postalAddress);
}
Also used : State(org.incode.module.country.dom.impl.State) Country(org.incode.module.country.dom.impl.Country)

Example 3 with State

use of org.incode.module.country.dom.impl.State in project estatio by estatio.

the class CommunicationChannelOwner_newChannelContributions method default3NewPostal.

public State default3NewPostal() {
    final Country country = default2NewPostal();
    final List<State> statesInCountry = stateRepository.findStatesByCountry(country);
    return statesInCountry.size() > 0 ? statesInCountry.get(0) : null;
}
Also used : State(org.incode.module.country.dom.impl.State) Country(org.incode.module.country.dom.impl.Country)

Example 4 with State

use of org.incode.module.country.dom.impl.State in project estatio by estatio.

the class StatesRefData method createState.

private State createState(Country country, final String referenceSuffix, String name, ExecutionContext executionContext) {
    final String reference = country.getAlpha2Code() + referenceSuffix;
    final State state = stateRepository.newState(reference, name, country);
    return executionContext.addResult(this, state.getReference(), state);
}
Also used : State(org.incode.module.country.dom.impl.State)

Aggregations

State (org.incode.module.country.dom.impl.State)4 Country (org.incode.module.country.dom.impl.Country)3 Programmatic (org.apache.isis.applib.annotation.Programmatic)1 PostalAddressDto (org.estatio.canonical.communicationchannel.v1.PostalAddressDto)1