/android/import-contacts

To get this branch, use:
bzr branch http://bzr.ed.am/android/import-contacts

« back to all changes in this revision

Viewing changes to src/am/ed/importcontacts/Backend.java

  • Committer: Tim Marston
  • Date: 2014-03-02 10:58:49 UTC
  • Revision ID: tim@ed.am-20140302105849-m542carzc1d4m1t2
added permission to write to sdcard (how did this ever work!?)

Show diffs side-by-side

added added

removed removed

1
1
/*
2
2
 * Backend.java
3
3
 *
4
 
 * Copyright (C) 2012 Tim Marston <tim@ed.am>
 
4
 * Copyright (C) 2012 to 2013 Tim Marston <tim@ed.am>
5
5
 *
6
6
 * This file is part of the Import Contacts program (hereafter referred
7
 
 * to as "this program"). For more information, see
 
7
 * to as "this program").  For more information, see
8
8
 * http://ed.am/dev/android/import-contacts
9
9
 *
10
10
 * This program is free software: you can redistribute it and/or modify
29
29
{
30
30
        /**
31
31
         * Build-up our contacts cache, using contacts on the device.
 
32
         *
32
33
         * @param cache the contacts cache to populate
33
34
         */
34
35
        public void populateCache( ContactsCache cache );
35
36
 
36
37
        /**
37
38
         * Delete a contact from the device.
 
39
         *
38
40
         * @param id of the contact to delete
39
41
         */
40
42
        public void deleteContact( Long id );
41
43
 
 
44
        @SuppressWarnings("serial")
 
45
        public class ContactCreationException extends Exception { };
 
46
 
42
47
        /**
43
48
         * Add a contact to the device.
44
 
         * @param name name of the new contact
45
 
         * @return the new contact's id, or null on failure
 
49
         *
 
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
53
         */
47
 
        public Long addContact( String name );
 
54
        public Long addContact( String name ) throws ContactCreationException;
48
55
 
49
56
        /**
50
57
         * Add a phone number to an existing contact on the device.
 
58
         *
51
59
         * @param id the existing contact's id
52
60
         * @param number the phone number
53
61
         * @param data data about the number
 
62
         * @throws ContactCreationException
54
63
         */
55
64
        public void addContactPhone( Long id, String number,
56
 
                ContactData.PreferredDetail data );
 
65
                ContactData.PreferredDetail data ) throws ContactCreationException;
57
66
 
58
67
        /**
59
68
         * Add an email address to an existing contact on the device.
 
69
         *
60
70
         * @param id the existing contact's id
61
71
         * @param email the email address
62
72
         * @param data data about the email address
 
73
         * @throws ContactCreationException
63
74
         */
64
75
        public void addContactEmail( Long id, String email,
65
 
                ContactData.PreferredDetail data );
 
76
                ContactData.PreferredDetail data ) throws ContactCreationException;
66
77
 
67
78
        /**
68
79
         * Add an address to an existing contact on the device.
 
80
         *
69
81
         * @param id the existing contact's id
70
82
         * @param address the address
71
83
         * @param data data about the address
 
84
         * @throws ContactCreationException
72
85
         */
73
86
        public void addContactAddresses( Long id, String address,
74
 
                ContactData.TypeDetail data );
 
87
                ContactData.TypeDetail data ) throws ContactCreationException;
75
88
 
76
89
        /**
77
90
         * Add a title and organisation to an existing contact on the device.
 
91
         *
78
92
         * @param id the existing contact's id
79
93
         * @param organisation the organisation
80
94
         * @param data data about the organisation
 
95
         * @throws ContactCreationException
81
96
         */
82
97
        public void addContactOrganisation( Long id, String organisation,
83
 
                ContactData.ExtraDetail data );
 
98
                ContactData.ExtraDetail data ) throws ContactCreationException;
 
99
 
 
100
        /**
 
101
         * Add a note to an existing contact on the device.
 
102
         *
 
103
         * @param id the existing contact's id
 
104
         * @param note the note
 
105
         * @throws ContactCreationException
 
106
         */
 
107
        public void addContactNote( Long id, String note )
 
108
                throws ContactCreationException;
 
109
 
 
110
        /**
 
111
         * Add a birthday to an existing contact on the device.
 
112
         *
 
113
         * @param id the existing contact's id
 
114
         * @param birthday the birthday
 
115
         * @throws ContactCreationException
 
116
         */
 
117
        public void addContactBirthday( Long id, String birthday )
 
118
                throws ContactCreationException;
84
119
}