Search in sources :

Example 41 with Person

use of sqlite.feature.many2many.case6.model.Person 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)

Aggregations

Person (com.google.api.services.people.v1.model.Person)25 VCard (ezvcard.VCard)20 Test (org.junit.Test)16 EmailAddress (com.google.api.services.people.v1.model.EmailAddress)15 PhoneNumber (com.google.api.services.people.v1.model.PhoneNumber)13 Email (ezvcard.property.Email)13 Telephone (ezvcard.property.Telephone)13 Person (model.Person)13 List (java.util.List)12 Collectors (java.util.stream.Collectors)12 Name (com.google.api.services.people.v1.model.Name)11 StructuredName (ezvcard.property.StructuredName)11 Truth.assertThat (com.google.common.truth.Truth.assertThat)10 Pair (com.google.gdata.util.common.base.Pair)10 Collections (java.util.Collections)10 Function (java.util.function.Function)10 Address (com.google.api.services.people.v1.model.Address)9 Nullable (com.google.gdata.util.common.base.Nullable)8 Before (org.junit.Before)8 SOURCE_PARAM_NAME_TYPE (org.dataportabilityproject.datatransfer.google.common.GoogleStaticObjects.SOURCE_PARAM_NAME_TYPE)6