Search in sources :

Example 6 with Address

use of com.google.api.services.people.v1.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)

Example 7 with Address

use of com.google.api.services.people.v1.model.Address in project gpconnect-demonstrator by nhsconnect.

the class OrganizationResourceProvider method getValidAddress.

private Address getValidAddress(Organization organization) {
    List<LocationDetails> locationsDetails = locationSearch.findAllLocations();
    LocationDetails location = null;
    for (LocationDetails locationDetails : locationsDetails) {
        if (locationDetails.getOrgOdsCode().equals(organization.getIdentifierFirstRep().getValue())) {
            location = locationDetails;
            break;
        }
    }
    Address orgAddress = null;
    if (location != null) {
        orgAddress = new Address();
        orgAddress.setUse(AddressUse.WORK);
        // #152
        // this looks very odd but is deliberate, there's a similar issue in locationResourceProvider.createAddress
        // 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
        orgAddress.addLine(location.getAddressLine());
        orgAddress.addLine(location.getAddressCity());
        orgAddress.setCity(location.getAddressDistrict());
        orgAddress.setDistrict(location.getAddressState());
        orgAddress.setPostalCode(location.getAddressPostalCode());
    }
    return orgAddress;
}
Also used : Address(org.hl7.fhir.dstu3.model.Address) LocationDetails(uk.gov.hscic.model.location.LocationDetails)

Example 8 with Address

use of com.google.api.services.people.v1.model.Address in project GNS by MobilityFirst.

the class AWSEC2 method associateAddress.

/**
   *
   * @param ec2
   * @param ip
   * @param instance
   */
public static void associateAddress(AmazonEC2 ec2, String ip, Instance instance) {
    Address address;
    if ((address = findElasticIP(ec2, ip)) != null) {
        if (address.getDomain().equals("vpc")) {
            System.out.println("VPC Elastic IP:  " + ip);
            ec2.associateAddress(new AssociateAddressRequest().withInstanceId(instance.getInstanceId()).withAllocationId(address.getAllocationId()));
        } else {
            System.out.println("EC2 Classic Elastic IP:  " + ip);
            ec2.associateAddress(new AssociateAddressRequest(instance.getInstanceId(), ip));
        }
    }
}
Also used : Address(com.amazonaws.services.ec2.model.Address) AssociateAddressRequest(com.amazonaws.services.ec2.model.AssociateAddressRequest)

Example 9 with Address

use of com.google.api.services.people.v1.model.Address in project BachelorPraktikum by lucasbuschlinger.

the class GooglePeople method getAllProfiles.

/**
 * Fetches the list of all profiles from the currently logged in user and passes them into the address book controller.
 */
public void getAllProfiles() {
    try {
        List<Person> persons = peopleService.people().connections().list("people/me").setPersonFields("names,addresses").setPageSize(PAGE_SIZE).execute().getConnections();
        for (Person p : persons) {
            if (p.getAddresses() != null) {
                Contact c = new Contact(p.getNames().get(0).getDisplayName(), p.getAddresses());
                AddressBook.getInstance().addContact(c);
            }
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : IOException(java.io.IOException) Person(com.google.api.services.people.v1.model.Person) Contact(de.opendiabetes.vault.plugin.importer.googlecrawler.models.Contact)

Example 10 with Address

use of com.google.api.services.people.v1.model.Address in project data-transfer-project by google.

the class GoogleContactsImporter method importItem.

@Override
public ImportResult importItem(UUID jobId, TokensAndUrlAuthData authData, ContactsModelWrapper data) {
    JCardReader reader = new JCardReader(data.getVCards());
    try {
        // TODO(olsona): address any other problems that might arise in conversion
        List<VCard> vCardList = reader.readAll();
        for (VCard vCard : vCardList) {
            Person person = convert(vCard);
            getOrCreatePeopleService(authData).people().createContact(person).execute();
        }
        return ImportResult.OK;
    } catch (IOException e) {
        return new ImportResult(ImportResult.ResultType.ERROR, e.getMessage());
    }
}
Also used : ImportResult(org.dataportabilityproject.spi.transfer.provider.ImportResult) IOException(java.io.IOException) JCardReader(ezvcard.io.json.JCardReader) VCard(ezvcard.VCard) Person(com.google.api.services.people.v1.model.Person)

Aggregations

Address (com.amazonaws.services.ec2.model.Address)7 Person (com.google.api.services.people.v1.model.Person)7 DescribeAddressesResult (com.amazonaws.services.ec2.model.DescribeAddressesResult)5 VCard (ezvcard.VCard)5 Test (org.junit.Test)5 DescribeAddressesRequest (com.amazonaws.services.ec2.model.DescribeAddressesRequest)4 EmailAddress (com.google.api.services.people.v1.model.EmailAddress)4 Address (org.hl7.fhir.dstu3.model.Address)4 AmazonEC2 (com.amazonaws.services.ec2.AmazonEC2)3 Address (com.google.api.services.people.v1.model.Address)3 AssociateAddressRequest (com.amazonaws.services.ec2.model.AssociateAddressRequest)2 DisassociateAddressRequest (com.amazonaws.services.ec2.model.DisassociateAddressRequest)2 Name (com.google.api.services.people.v1.model.Name)2 PhoneNumber (com.google.api.services.people.v1.model.PhoneNumber)2 Truth.assertThat (com.google.common.truth.Truth.assertThat)2 Nullable (com.google.gdata.util.common.base.Nullable)2 Pair (com.google.gdata.util.common.base.Pair)2 InstanceInfo (com.netflix.appinfo.InstanceInfo)2 Contact (de.opendiabetes.vault.plugin.importer.googlecrawler.models.Contact)2 Address (ezvcard.property.Address)2