/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:50:33 UTC
  • Revision ID: tim@ed.am-20121219175033-61acsxzjulqpnian
made contacts backend throw exceptions when it can't create contacts on the device; specified Locale in lower/upper case conversions; stripped old Contacts types from Importer (and replaced with our own types, which are now converted in the backend; switched using Integer() constructors to Integer.valueOf(); rewrote the main importer routine a bit

Show diffs side-by-side

added added

removed removed

39
39
         */
40
40
        public void deleteContact( Long id );
41
41
 
 
42
        @SuppressWarnings("serial")
 
43
        public class ContactCreationException extends Exception { };
 
44
 
42
45
        /**
43
46
         * 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
 
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
46
50
         */
47
 
        public Long addContact( String name );
 
51
        public Long addContact( String name ) throws ContactCreationException;
48
52
 
49
53
        /**
50
54
         * Add a phone number to an existing contact on the device.
51
55
         * @param id the existing contact's id
52
56
         * @param number the phone number
53
57
         * @param data data about the number
 
58
         * @throws ContactCreationException
54
59
         */
55
60
        public void addContactPhone( Long id, String number,
56
 
                ContactData.PreferredDetail data );
 
61
                ContactData.PreferredDetail data ) throws ContactCreationException;
57
62
 
58
63
        /**
59
64
         * Add an email address to an existing contact on the device.
60
65
         * @param id the existing contact's id
61
66
         * @param email the email address
62
67
         * @param data data about the email address
 
68
         * @throws ContactCreationException
63
69
         */
64
70
        public void addContactEmail( Long id, String email,
65
 
                ContactData.PreferredDetail data );
 
71
                ContactData.PreferredDetail data ) throws ContactCreationException;
66
72
 
67
73
        /**
68
74
         * Add an address to an existing contact on the device.
69
75
         * @param id the existing contact's id
70
76
         * @param address the address
71
77
         * @param data data about the address
 
78
         * @throws ContactCreationException
72
79
         */
73
80
        public void addContactAddresses( Long id, String address,
74
 
                ContactData.TypeDetail data );
 
81
                ContactData.TypeDetail data ) throws ContactCreationException;
75
82
 
76
83
        /**
77
84
         * Add a title and organisation to an existing contact on the device.
78
85
         * @param id the existing contact's id
79
86
         * @param organisation the organisation
80
87
         * @param data data about the organisation
 
88
         * @throws ContactCreationException
81
89
         */
82
90
        public void addContactOrganisation( Long id, String organisation,
83
 
                ContactData.ExtraDetail data );
 
91
                ContactData.ExtraDetail data ) throws ContactCreationException;
84
92
}