4
* Copyright (C) 2012 Tim Marston <tim@ed.am>
6
* This file is part of the Import Contacts program (hereafter referred
7
* to as "this program"). For more information, see
8
* http://ed.am/dev/android/import-contacts
10
* This program is free software: you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation, either version 3 of the License, or
13
* (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program. If not, see <http://www.gnu.org/licenses/>.
24
package am.ed.importcontacts;
26
import am.ed.importcontacts.Importer.ContactData;
28
public interface Backend
31
* Build-up our contacts cache, using contacts on the device.
32
* @param cache the contacts cache to populate
34
public void populateCache( ContactsCache cache );
37
* Delete a contact from the device.
38
* @param id of the contact to delete
40
public void deleteContact( Long id );
42
@SuppressWarnings("serial")
43
public class ContactCreationException extends Exception { };
46
* Add a contact to the device.
47
* @param name name of the new contact, or null if there isn't one
48
* @return the new contact's id
49
* @throws ContactCreationException
51
public Long addContact( String name ) throws ContactCreationException;
54
* Add a phone number to an existing contact on the device.
55
* @param id the existing contact's id
56
* @param number the phone number
57
* @param data data about the number
58
* @throws ContactCreationException
60
public void addContactPhone( Long id, String number,
61
ContactData.PreferredDetail data ) throws ContactCreationException;
64
* Add an email address to an existing contact on the device.
65
* @param id the existing contact's id
66
* @param email the email address
67
* @param data data about the email address
68
* @throws ContactCreationException
70
public void addContactEmail( Long id, String email,
71
ContactData.PreferredDetail data ) throws ContactCreationException;
74
* Add an address to an existing contact on the device.
75
* @param id the existing contact's id
76
* @param address the address
77
* @param data data about the address
78
* @throws ContactCreationException
80
public void addContactAddresses( Long id, String address,
81
ContactData.TypeDetail data ) throws ContactCreationException;
84
* Add a title and organisation to an existing contact on the device.
85
* @param id the existing contact's id
86
* @param organisation the organisation
87
* @param data data about the organisation
88
* @throws ContactCreationException
90
public void addContactOrganisation( Long id, String organisation,
91
ContactData.ExtraDetail data ) throws ContactCreationException;
94
* Add a note to an existing contact on the device.
95
* @param id the existing contact's id
96
* @param note the note
97
* @throws ContactCreationException
99
public void addContactNote( Long id, String note )
100
throws ContactCreationException;