Search in sources :

Example 1 with Address

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);
}
Also used : Address(com.amazonaws.services.ec2.model.Address) DescribeAddressesResult(com.amazonaws.services.ec2.model.DescribeAddressesResult)

Example 2 with Address

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);
}
Also used : VCard(ezvcard.VCard) VCARD_PRIMARY_PREF(org.dataportabilityproject.serviceProviders.google.contacts.GoogleContactsConstants.VCARD_PRIMARY_PREF) EmailAddress(com.google.api.services.people.v1.model.EmailAddress) Telephone(ezvcard.property.Telephone) SOURCE_PARAM_NAME_TYPE(org.dataportabilityproject.serviceProviders.google.contacts.GoogleContactsConstants.SOURCE_PARAM_NAME_TYPE) Test(org.junit.Test) PhoneNumber(com.google.api.services.people.v1.model.PhoneNumber) Truth.assertThat(com.google.common.truth.Truth.assertThat) Function(java.util.function.Function) Collectors(java.util.stream.Collectors) StructuredName(ezvcard.property.StructuredName) Pair(com.google.gdata.util.common.base.Pair) Person(com.google.api.services.people.v1.model.Person) List(java.util.List) CONTACT_SOURCE_TYPE(org.dataportabilityproject.serviceProviders.google.contacts.GoogleContactsConstants.CONTACT_SOURCE_TYPE) Nullable(com.google.gdata.util.common.base.Nullable) Address(com.google.api.services.people.v1.model.Address) Email(ezvcard.property.Email) Name(com.google.api.services.people.v1.model.Name) Collections(java.util.Collections) Before(org.junit.Before) EmailAddress(com.google.api.services.people.v1.model.EmailAddress) Address(com.google.api.services.people.v1.model.Address) VCard(ezvcard.VCard) Person(com.google.api.services.people.v1.model.Person) Test(org.junit.Test)

Example 3 with Address

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());
    }
}
Also used : Address(com.amazonaws.services.ec2.model.Address) DescribeAddressesResult(com.amazonaws.services.ec2.model.DescribeAddressesResult) AmazonEC2(com.amazonaws.services.ec2.AmazonEC2)

Example 4 with Address

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));
            }
        }
    }
}
Also used : Address(com.google.api.services.people.v1.model.Address) Person(com.google.api.services.people.v1.model.Person) Contact(de.opendiabetes.vault.plugin.importer.googlecrawler.models.Contact)

Example 5 with 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;
}
Also used : Address(org.hl7.fhir.dstu3.model.Address) StringType(org.hl7.fhir.dstu3.model.StringType) LinkedList(java.util.LinkedList)

Aggregations

Address (org.hl7.fhir.r4.model.Address)70 Test (org.junit.Test)51 Test (org.junit.jupiter.api.Test)30 PersonAddress (org.openmrs.PersonAddress)27 Patient (org.hl7.fhir.r4.model.Patient)24 Address (org.hl7.fhir.dstu3.model.Address)22 Identifier (org.hl7.fhir.r4.model.Identifier)20 ArrayList (java.util.ArrayList)19 NotImplementedException (org.apache.commons.lang3.NotImplementedException)19 HumanName (org.hl7.fhir.r4.model.HumanName)19 ContactPoint (org.hl7.fhir.r4.model.ContactPoint)16 Location (org.hl7.fhir.r4.model.Location)13 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)13 IdType (org.hl7.fhir.dstu3.model.IdType)12 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)12 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)12 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)11 Organization (org.hl7.fhir.r4.model.Organization)10 IBundleProvider (ca.uhn.fhir.rest.api.server.IBundleProvider)9 Date (java.util.Date)9