start.setZip(zip);
return start;
}
private Tour.Destination createDestination(GoPalPosition position) {
ObjectFactory objectFactory = new ObjectFactory();
Tour.Destination destination = objectFactory.createTourDestination();
Tour.Destination.Coordinates coordinates = objectFactory.createTourDestinationCoordinates();
if (position.getX() != null)
coordinates.setMercatorx(position.getX());
if (position.getY() != null)
coordinates.setMercatory(position.getY());
if (position.getLongitude() != null)
coordinates.setLongitude(formatPosition(position.getLongitude()));
if (position.getLatitude() != null)
coordinates.setLatitude(formatPosition(position.getLatitude()));
destination.setCoordinates(coordinates);
Tour.Destination.City city = objectFactory.createTourDestinationCity();
city.setName(position.getCity());
city.setSuburb(position.getSuburb());
destination.setCity(city);
Tour.Destination.Country country = objectFactory.createTourDestinationCountry();
country.setCode(formatCountry(position));
destination.setCountry(country);
Tour.Destination.State state = objectFactory.createTourDestinationState();
if (position.getState() != null)
state.setName(position.getState());
destination.setState(state);
Tour.Destination.HouseNumber houseNumber = objectFactory.createTourDestinationHouseNumber();
if (position.getHouseNumber() != null) {
houseNumber.setValue(position.getHouseNumber());
houseNumber.setType("middle_of_street");
}
destination.setHouseNumber(houseNumber);
Tour.Destination.Street street = objectFactory.createTourDestinationStreet();
street.setName(position.getStreet());
if (position.getHouseNumber() != null)
street.setHouseNumberAvailable("no");
destination.setStreet(street);
Tour.Destination.SideStreet sideStreet = objectFactory.createTourDestinationSideStreet();
sideStreet.setName(position.getSideStreet());
destination.setSideStreet(sideStreet);
Tour.Destination.Zip zip = objectFactory.createTourDestinationZip();
zip.setCode(position.getZipCode());
destination.setZip(zip);
return destination;
}