/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: edam
  • Date: 2012-12-19 17:51:35 UTC
  • Revision ID: tim@ed.am-20121219175135-1cpuafp76jg1ib1p
added preliminary (buggy) ContactsContract backend

Show diffs side-by-side

added added

removed removed

21
21
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
22
 */
23
23
 
24
 
 
25
24
package am.ed.importcontacts;
26
25
 
27
26
import am.ed.importcontacts.Importer.ContactData;
28
27
 
29
 
 
30
28
public interface Backend
31
29
{
32
30
        /**
36
34
        public void populateCache( ContactsCache cache );
37
35
 
38
36
        /**
39
 
         * Delete a contact
 
37
         * Delete a contact from the device.
40
38
         * @param id of the contact to delete
41
39
         */
42
40
        public void deleteContact( Long id );
43
41
 
 
42
        @SuppressWarnings("serial")
 
43
        public class ContactCreationException extends Exception { };
 
44
 
44
45
        /**
45
 
         * Add a contact
46
 
         * @param name name of the new contact
47
 
         * @return the new contact's id, or 0 on failure
 
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
48
50
         */
49
 
        public Long addContact( String name );
 
51
        public Long addContact( String name ) throws ContactCreationException;
50
52
 
51
53
        /**
52
 
         * Add a phone number to an existing contact
 
54
         * Add a phone number to an existing contact on the device.
53
55
         * @param id the existing contact's id
54
56
         * @param number the phone number
55
57
         * @param data data about the number
 
58
         * @throws ContactCreationException
56
59
         */
57
60
        public void addContactPhone( Long id, String number,
58
 
                ContactData.PreferredDetail data );
 
61
                ContactData.PreferredDetail data ) throws ContactCreationException;
59
62
 
60
63
        /**
61
 
         * Add an email address to an existing contact
 
64
         * Add an email address to an existing contact on the device.
62
65
         * @param id the existing contact's id
63
66
         * @param email the email address
64
67
         * @param data data about the email address
 
68
         * @throws ContactCreationException
65
69
         */
66
70
        public void addContactEmail( Long id, String email,
67
 
                ContactData.PreferredDetail data );
 
71
                ContactData.PreferredDetail data ) throws ContactCreationException;
68
72
 
69
73
        /**
70
 
         * Add an address to an existing contact
 
74
         * Add an address to an existing contact on the device.
71
75
         * @param id the existing contact's id
72
76
         * @param address the address
73
77
         * @param data data about the address
 
78
         * @throws ContactCreationException
74
79
         */
75
80
        public void addContactAddresses( Long id, String address,
76
 
                ContactData.TypeDetail data );
 
81
                ContactData.TypeDetail data ) throws ContactCreationException;
77
82
 
78
83
        /**
79
 
         * Add a title and organisation to an existing contact
 
84
         * Add a title and organisation to an existing contact on the device.
80
85
         * @param id the existing contact's id
81
86
         * @param organisation the organisation
82
87
         * @param data data about the organisation
 
88
         * @throws ContactCreationException
83
89
         */
84
90
        public void addContactOrganisation( Long id, String organisation,
85
 
                ContactData.ExtraDetail data );
 
91
                ContactData.ExtraDetail data ) throws ContactCreationException;
86
92
}