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;
}
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);
}
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;
}
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);
}
Aggregations