// Path: app/src/main/java/com/futurice/android/reservator/model/AddressBook.java
// public abstract class AddressBook {
//     private Vector<AddressBookEntry> entries;
//     private Set<AddressBookUpdatedListener> listeners = new HashSet<AddressBookUpdatedListener>();
// 
//     public AddressBook() {
//     }
// 
//     protected abstract Vector<AddressBookEntry> fetchEntries() throws ReservatorException;
// 
//     public abstract void setCredentials(String username, String password);
// 
//     public Vector<AddressBookEntry> getEntries() throws ReservatorException {
//         return entries;
//     }
// 
//     public void prefetchEntries() {
//         if (entries == null) {
//             new PrefetchEntriesTask().execute();
//         }
//     }
// 
//     public AddressBookEntry getEntryByName(String name) {
//         if (entries == null) {
//             return null; // no entries, no win
//         }
// 
//         for (AddressBookEntry entry : entries) {
//             if (entry.getName().equals(name)) {
//                 return entry;
//             }
//         }
//         return null;
//     }
// 
//     public String toString() {
//         if (entries != null)
//             return entries.toString();
//         return "";
//     }
// 
//     /**
//      * Add a listener for this proxy. The listener will be notified after calls to refreshRooms and refreshRoomReservations finish or fail.
//      *
//      * @param listener
//      */
//     public void addDataUpdatedListener(AddressBookUpdatedListener listener) {
//         listeners.add(listener);
//     }
// 
//     /**
//      * Remove a listener from this proxy.
//      *
//      * @param listener
//      */
//     public void removeDataUpdatedListener(AddressBookUpdatedListener listener) {
//         listeners.remove(listener);
//     }
// 
//     private void notifyEntriesUpdated() {
//         synchronized (listeners) {
//             for (AddressBookUpdatedListener l : listeners) {
//                 l.addressBookUpdated();
//             }
//         }
//     }
// 
//     private void notifyAddressBookUpdateFailed(ReservatorException e) {
//         synchronized (listeners) {
//             for (AddressBookUpdatedListener l : listeners) {
//                 l.addressBookUpdateFailed(e);
//             }
//         }
//     }
// 
//     public void refetchEntries() {
//         entries = null;
//         prefetchEntries();
//     }
// 
//     private class PrefetchEntriesTask extends AsyncTask<Void, Void, Vector<AddressBookEntry>> {
//         ReservatorException e = null;
// 
//         @Override
//         protected Vector<AddressBookEntry> doInBackground(Void... params) {
//             try {
//                 return fetchEntries();
//             } catch (ReservatorException e) {
//                 this.e = e;
//                 return null;
//             }
//         }
// 
//         @Override
//         protected void onPostExecute(Vector<AddressBookEntry> entries) {
//             if (entries != null) {
//                 AddressBook.this.entries = entries;
//                 notifyEntriesUpdated();
//             } else {
//                 notifyAddressBookUpdateFailed(e);
//             }
//         }
//     }
// }
// 
// Path: app/src/main/java/com/futurice/android/reservator/model/AddressBookEntry.java
// public class AddressBookEntry {
//     private String name, email;
// 
//     public AddressBookEntry(String name, String email) {
//         this.name = name;
//         this.email = email;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public String getEmail() {
//         return email;
//     }
// 
//     public String toString() {
//         return getName() + " <" + getEmail() + ">";
//     }
// }


import android.content.ContentResolver;
import android.database.Cursor;
import android.provider.ContactsContract;
import com.futurice.android.reservator.model.AddressBook;
import com.futurice.android.reservator.model.AddressBookEntry;
import com.futurice.android.reservator.model.ReservatorException;
import java.util.Vector;
package com.futurice.android.reservator.model.platformcontacts;




public class PlatformContactsAddressBook extends AddressBook {
    private final String GOOGLE_ACCOUNT_TYPE = "com.google";
    private String account = null;
    private ContentResolver resolver;

    public PlatformContactsAddressBook(ContentResolver resolver) {
        super();
        this.resolver = resolver;
    }

    /**
     * This is a heavy query, and should be called rarely.
     */
    @Override
    protected Vector<AddressBookEntry> fetchEntries() throws ReservatorException {
// Path: app/src/main/java/com/futurice/android/reservator/model/AddressBook.java
// public abstract class AddressBook {
//     private Vector<AddressBookEntry> entries;
//     private Set<AddressBookUpdatedListener> listeners = new HashSet<AddressBookUpdatedListener>();
// 
//     public AddressBook() {
//     }
// 
//     protected abstract Vector<AddressBookEntry> fetchEntries() throws ReservatorException;
// 
//     public abstract void setCredentials(String username, String password);
// 
//     public Vector<AddressBookEntry> getEntries() throws ReservatorException {
//         return entries;
//     }
// 
//     public void prefetchEntries() {
//         if (entries == null) {
//             new PrefetchEntriesTask().execute();
//         }
//     }
// 
//     public AddressBookEntry getEntryByName(String name) {
//         if (entries == null) {
//             return null; // no entries, no win
//         }
// 
//         for (AddressBookEntry entry : entries) {
//             if (entry.getName().equals(name)) {
//                 return entry;
//             }
//         }
//         return null;
//     }
// 
//     public String toString() {
//         if (entries != null)
//             return entries.toString();
//         return "";
//     }
// 
//     /**
//      * Add a listener for this proxy. The listener will be notified after calls to refreshRooms and refreshRoomReservations finish or fail.
//      *
//      * @param listener
//      */
//     public void addDataUpdatedListener(AddressBookUpdatedListener listener) {
//         listeners.add(listener);
//     }
// 
//     /**
//      * Remove a listener from this proxy.
//      *
//      * @param listener
//      */
//     public void removeDataUpdatedListener(AddressBookUpdatedListener listener) {
//         listeners.remove(listener);
//     }
// 
//     private void notifyEntriesUpdated() {
//         synchronized (listeners) {
//             for (AddressBookUpdatedListener l : listeners) {
//                 l.addressBookUpdated();
//             }
//         }
//     }
// 
//     private void notifyAddressBookUpdateFailed(ReservatorException e) {
//         synchronized (listeners) {
//             for (AddressBookUpdatedListener l : listeners) {
//                 l.addressBookUpdateFailed(e);
//             }
//         }
//     }
// 
//     public void refetchEntries() {
//         entries = null;
//         prefetchEntries();
//     }
// 
//     private class PrefetchEntriesTask extends AsyncTask<Void, Void, Vector<AddressBookEntry>> {
//         ReservatorException e = null;
// 
//         @Override
//         protected Vector<AddressBookEntry> doInBackground(Void... params) {
//             try {
//                 return fetchEntries();
//             } catch (ReservatorException e) {
//                 this.e = e;
//                 return null;
//             }
//         }
// 
//         @Override
//         protected void onPostExecute(Vector<AddressBookEntry> entries) {
//             if (entries != null) {
//                 AddressBook.this.entries = entries;
//                 notifyEntriesUpdated();
//             } else {
//                 notifyAddressBookUpdateFailed(e);
//             }
//         }
//     }
// }
// 
// Path: app/src/main/java/com/futurice/android/reservator/model/AddressBookEntry.java
// public class AddressBookEntry {
//     private String name, email;
// 
//     public AddressBookEntry(String name, String email) {
//         this.name = name;
//         this.email = email;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public String getEmail() {
//         return email;
//     }
// 
//     public String toString() {
//         return getName() + " <" + getEmail() + ">";
//     }
// }


// Path: app/src/main/java/com/futurice/android/reservator/model/platformcontacts/PlatformContactsAddressBook.java
import android.content.ContentResolver;
import android.database.Cursor;
import android.provider.ContactsContract;
import com.futurice.android.reservator.model.AddressBook;
import com.futurice.android.reservator.model.AddressBookEntry;
import com.futurice.android.reservator.model.ReservatorException;
import java.util.Vector;

package com.futurice.android.reservator.model.platformcontacts;




public class PlatformContactsAddressBook extends AddressBook {
    private final String GOOGLE_ACCOUNT_TYPE = "com.google";
    private String account = null;
    private ContentResolver resolver;

    public PlatformContactsAddressBook(ContentResolver resolver) {
        super();
        this.resolver = resolver;
    }

    /**
     * This is a heavy query, and should be called rarely.
     */
    @Override
    protected Vector<AddressBookEntry> fetchEntries() throws ReservatorException {
        Vector<AddressBookEntry> entries = new Vector<AddressBookEntry>();