use of org.hl7.fhir.r4.model.Address in project GNS by MobilityFirst.
the class AWSEC2 method describeElasticIPs.
/**
*
* @param ec2
*/
public static void describeElasticIPs(AmazonEC2 ec2) {
StringBuilder output = new StringBuilder();
String prefix = currentTab + "Elastic IPs: ";
DescribeAddressesResult describeAddressesResult = ec2.describeAddresses();
for (Address address : describeAddressesResult.getAddresses()) {
output.append(prefix);
prefix = ", ";
output.append(address.getPublicIp());
}
System.out.println(output);
}
use of org.hl7.fhir.r4.model.Address in project data-transfer-project by google.
the class VCardToGoogleContactConverterTest method testConversionToGoogleAddresses.
@Test
public void testConversionToGoogleAddresses() {
// Set up vCard with a primary address and a secondary address
String primaryStreet = "221B Baker St";
String primaryLocality = "London";
ezvcard.property.Address primaryAddress = new ezvcard.property.Address();
primaryAddress.setStreetAddress(primaryStreet);
primaryAddress.setLocality(primaryLocality);
primaryAddress.setPref(VCARD_PRIMARY_PREF);
String altStreet = "42 Wallaby Way";
String altLocality = "Sydney";
ezvcard.property.Address altAddress = new ezvcard.property.Address();
altAddress.setStreetAddress(altStreet);
altAddress.setLocality(altLocality);
altAddress.setPref(VCARD_PRIMARY_PREF + 1);
// Add addresses to vCard. Order shouldn't matter.
VCard vCard = defaultVCard;
vCard.addAddress(primaryAddress);
vCard.addAddress(altAddress);
// Run test
Person person = VCardToGoogleContactConverter.convert(vCard);
// Check results
// Check correct number of addresses
assertThat(person.getAddresses().size()).isEqualTo(2);
// Check primary address
List<Address> actualPrimaryAddresses = person.getAddresses().stream().filter(a -> a.getMetadata().getPrimary()).collect(Collectors.toList());
List<String> actualPrimaryAddressStreets = getValuesFromFields(actualPrimaryAddresses, Address::getStreetAddress);
assertThat(actualPrimaryAddressStreets).containsExactly(primaryStreet);
// Check secondary address
List<Address> actualSecondaryAddresses = person.getAddresses().stream().filter(a -> !a.getMetadata().getPrimary()).collect(Collectors.toList());
List<String> actualSecondaryAddressStreets = getValuesFromFields(actualSecondaryAddresses, Address::getStreetAddress);
assertThat(actualSecondaryAddressStreets).containsExactly(altStreet);
}
use of org.hl7.fhir.r4.model.Address in project aws-doc-sdk-examples by awsdocs.
the class DescribeAddresses method main.
public static void main(String[] args) {
final AmazonEC2 ec2 = AmazonEC2ClientBuilder.defaultClient();
DescribeAddressesResult response = ec2.describeAddresses();
for (Address address : response.getAddresses()) {
System.out.printf("Found address with public IP %s, " + "domain %s, " + "allocation id %s " + "and NIC id %s", address.getPublicIp(), address.getDomain(), address.getAllocationId(), address.getNetworkInterfaceId());
}
}
use of org.hl7.fhir.r4.model.Address in project BachelorPraktikum by lucasbuschlinger.
the class GooglePlaces method fetchOwnAddresses.
// /**
// * Setter for the query keyword search params.
// * @param keywordSearchParams valid search params that will be appended to the query
// */
// public void setKeywordSearchParams(final String[] keywordSearchParams) {
// for (String param : keywordSearchParams) {
// keywordSearch = keywordSearch + " OR (" + param.toLowerCase() + ")";
// }
// }
//
// /**
// * Searches the context with the previously set keyword search params
// * and the given location (latitude, longitude) and radius (accuracy).
// * @param latitude a valid latitude
// * @param longitude a valid longitude
// * @param accuracy a radius in meters
// * @return The name of the result if there was a place found with the given query params, otherwise "AWAY"
// */
// public String keywordSearch(final double latitude, final double longitude, final int accuracy) {
// try {
// PlacesSearchResult[] results = PlacesApi
// .nearbySearchQuery(context, new LatLng(latitude, longitude))
// .radius(accuracy)
// .keyword(keywordSearch)
// .await().results;
// if (results.length == 1) {
// return results[0].name;
// } else {
// for (PlacesSearchResult sr : results) {
// boolean isPolitical = false;
// for (String st : sr.types) {
// if (st.equals("political")) {
// isPolitical = true;
// }
// }
//
// if (!isPolitical) {
// return sr.name;
// }
// }
// }
// } catch (ApiException | InterruptedException | IOException e) {
// e.printStackTrace();
// }
//
// return "AWAY";
// }
/**
* Retrieves the own addresses of the current user.
*/
public void fetchOwnAddresses() {
if (context != null) {
Person me = GooglePeople.getInstance().getProfile();
if (me.getAddresses() != null) {
for (Address res : me.getAddresses()) {
String name = res.getFormattedType();
List<Address> address = Arrays.asList(res);
ownAddresses.add(new Contact(name, address));
}
}
}
}
use of org.hl7.fhir.r4.model.Address in project gpconnect-demonstrator by nhsconnect.
the class LocationResourceProvider method createAddress.
/**
* Some of the assignments look rather odd but they are deliberate.
* They result from a change to spec to remove the state attribute from the address
* See the commit cd26528 by James Cox 6/3/18 see also OrganizationResourceProvider.getValidAddress
* @param locationDetails
* @return Address Resource
*/
private Address createAddress(LocationDetails locationDetails) {
Address address = new Address();
List<StringType> list = new LinkedList<>();
list.add(new StringType(locationDetails.getAddressLine()));
list.add(new StringType(locationDetails.getAddressCity()));
address.setLine(list);
address.setCity(locationDetails.getAddressDistrict());
address.setDistrict(locationDetails.getAddressState());
address.setPostalCode(locationDetails.getAddressPostalCode());
address.setCountry(locationDetails.getAddressCountry());
return address;
}
Aggregations