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