21
21
* along with this program. If not, see <http://www.gnu.org/licenses/>.
24
25
package am.ed.importcontacts;
26
27
import am.ed.importcontacts.Importer.ContactData;
28
30
public interface Backend
31
33
* Build-up our contacts cache, using contacts on the device.
33
34
* @param cache the contacts cache to populate
35
36
public void populateCache( ContactsCache cache );
38
* Delete a contact from the device.
40
40
* @param id of the contact to delete
42
42
public void deleteContact( Long id );
44
@SuppressWarnings("serial")
45
public class ContactCreationException extends Exception { };
48
* Add a contact to the device.
50
* @param name name of the new contact, or null if there isn't one
51
* @return the new contact's id
52
* @throws ContactCreationException
46
* @param name name of the new contact
47
* @return the new contact's id, or 0 on failure
54
public Long addContact( String name ) throws ContactCreationException;
49
public Long addContact( String name );
57
* Add a phone number to an existing contact on the device.
52
* Add a phone number to an existing contact
59
53
* @param id the existing contact's id
60
54
* @param number the phone number
61
55
* @param data data about the number
62
* @throws ContactCreationException
64
57
public void addContactPhone( Long id, String number,
65
ContactData.PreferredDetail data ) throws ContactCreationException;
58
ContactData.PreferredDetail data );
68
* Add an email address to an existing contact on the device.
61
* Add an email address to an existing contact
70
62
* @param id the existing contact's id
71
63
* @param email the email address
72
64
* @param data data about the email address
73
* @throws ContactCreationException
75
66
public void addContactEmail( Long id, String email,
76
ContactData.PreferredDetail data ) throws ContactCreationException;
67
ContactData.PreferredDetail data );
79
* Add an address to an existing contact on the device.
70
* Add an address to an existing contact
81
71
* @param id the existing contact's id
82
72
* @param address the address
83
73
* @param data data about the address
84
* @throws ContactCreationException
86
75
public void addContactAddresses( Long id, String address,
87
ContactData.TypeDetail data ) throws ContactCreationException;
76
ContactData.TypeDetail data );
90
* Add a title and organisation to an existing contact on the device.
79
* Add a title and organisation to an existing contact
92
80
* @param id the existing contact's id
93
81
* @param organisation the organisation
94
82
* @param data data about the organisation
95
* @throws ContactCreationException
97
84
public void addContactOrganisation( Long id, String organisation,
98
ContactData.ExtraDetail data ) throws ContactCreationException;
101
* Add a note to an existing contact on the device.
103
* @param id the existing contact's id
104
* @param note the note
105
* @throws ContactCreationException
107
public void addContactNote( Long id, String note )
108
throws ContactCreationException;
111
* Add a birthday to an existing contact on the device.
113
* @param id the existing contact's id
114
* @param birthday the birthday
115
* @throws ContactCreationException
117
public void addContactBirthday( Long id, String birthday )
118
throws ContactCreationException;
85
ContactData.ExtraDetail data );