|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcorny.addressbook.NativeAddressBook
public final class NativeAddressBook
Central class of the Java Address Book API. Fetches all Groups and Contacts from the Apple Address Book and provides access. Implements all the functionality to access, search or edit the Address Book and to monitor the Address Book for changes.
Field Summary | |
---|---|
static Filter |
contactsWithAddressFilter
Filters Contacts which have Addresses. |
static Filter |
contactsWithBirthdayFilter
Filters Contacts which have a birthday set. |
static Filter |
contactsWithEmailFilter
Filters Contacts which have Email addresses. |
static Filter |
contactsWithNameFilter
Filters Contacts which have a displayed name (full name or organization name). |
static Filter |
contactsWithPhoneFilter
Filters Contacts which have phone numbers. |
static Filter |
contactsWithPictureFilter
Filters Contacts which have an attached picture. |
static Filter |
organizationsFilter
Filters Contacts which are organizations, not persons. |
static Filter |
personsFilter
Filters Contacts which are persons, not organizations. |
Method Summary | |
---|---|
void |
addAddressBookChangeListener(AddressBookChangeListener listener)
Adds the specified listener to receive notifications when the Address Book data changes. |
Contact |
addContact(Group parentGroup)
Adds a new, empty Contact (a person) to the Address Book. |
Contact |
addContact(java.lang.String fName,
java.lang.String mName,
java.lang.String lName,
java.lang.String title,
java.lang.String org,
java.util.List<MultiValue.KeyValuePair<java.lang.String>> email,
java.util.List<MultiValue.KeyValuePair<java.lang.String>> phone,
java.util.List<MultiValue.KeyValuePair<Address>> address,
java.util.List<MultiValue.KeyValuePair<java.lang.String>> chat,
java.util.Date birthday,
boolean isPerson,
Group group)
Adds a new Contact. |
Contact |
addContact(java.lang.String fName,
java.lang.String mName,
java.lang.String lName,
java.lang.String title,
java.lang.String org,
MultiValue.KeyValuePair<java.lang.String> email,
MultiValue.KeyValuePair<java.lang.String> phone,
MultiValue.KeyValuePair<Address> address,
MultiValue.KeyValuePair<java.lang.String> chat,
java.util.Date birthday,
boolean isPerson,
Group group)
Adds a new Contact. |
Group |
addGroup(java.lang.String name,
Group parentGroup)
Adds a new Group to the Address Book |
void |
addressBookChanged(AddressBookNotification noti)
Called when the Address Book data has changed externally, for example when editing the Address Book by using Apple's Address Book interface. |
void |
addressBookChangedInternally(AddressBookNotification noti)
Called when the Address Book data has changed by calling methods of this Java API. |
static java.util.List<java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>> |
addressListToMapList(java.util.List<MultiValue.KeyValuePair<Address>> address)
Converts a List of KeyValuePairs containing Addresses into native code comparible format |
void |
beginModification()
Call this method if you want to apply multiple modifications to the Address Book. |
void |
endModification()
Call this method if a series of modifications initiated by beginModification() has ended. |
java.util.List<Contact> |
findContacts(Filter search)
Searches for Contacts in the whole Address Book |
java.util.List<Contact> |
findContactsInGroup(Filter search,
Group g)
Searches for Contacts in a given Group |
java.util.List<Contact> |
getContactsWithAddress(java.lang.String address)
Searches the whole Address Book for Contacts whose addresses contain the given String. |
java.util.List<Contact> |
getContactsWithEmail(java.lang.String email)
Searches the whole Address Book for Contacts whose Email Addresses contain the given String. |
java.util.List<Contact> |
getContactsWithFirstName(java.lang.String firstName)
Searches the whole Address Book for Contacts whose first name contains the given String. |
java.util.List<Contact> |
getContactsWithLastName(java.lang.String lastName)
Searches the whole Address Book for Contacts whose last name contains the given String. |
java.util.List<Contact> |
getContactsWithNameElement(java.lang.String nameElement)
Searches the whole Address Book for Contacts whose full name contains the given String. |
java.util.List<Contact> |
getContactsWithPhone(java.lang.String phone)
Searches the whole Address Book for Contacts whose phone numbers contain the given String. |
java.util.List<Contact> |
getContactsWithSomeAttribute(java.lang.String attribute)
Searches the whole Address Book for Contacts which have any attribute which contains the given String. |
java.util.List<Contact> |
getEveryone()
|
Group |
getEveryoneGroup()
|
java.util.List<Group> |
getGroups()
|
Contact |
getMe()
Returns the Contact which represents the user |
Record |
getRecord(java.lang.String uid)
Returns the Record with the given UID or null if the the Record doesn't exist. |
void |
init()
Initializes the native address book to be able to send change notifications |
static NativeAddressBook |
instance()
Returns the singleton instance of the NativeAddressBook class. |
boolean |
isModificationSessionActive()
|
static java.util.List<java.util.Map<java.lang.String,java.lang.String>> |
keyValueListToMapList(java.util.List<MultiValue.KeyValuePair<java.lang.String>> list)
Converts a List of KeyValuePairs containing Strings into native code comparible format |
boolean |
modifyContact(Contact contact,
java.lang.String fName,
java.lang.String mName,
java.lang.String lName,
java.lang.String title,
java.lang.String org,
java.util.List<MultiValue.KeyValuePair<java.lang.String>> email,
java.util.List<MultiValue.KeyValuePair<java.lang.String>> phone,
java.util.List<MultiValue.KeyValuePair<Address>> address,
java.util.List<MultiValue.KeyValuePair<java.lang.String>> chat,
java.util.Date birthday,
java.lang.Boolean isPerson)
Modifies an existing Contact. |
boolean |
modifyContact(Contact contact,
java.lang.String fName,
java.lang.String mName,
java.lang.String lName,
java.lang.String title,
java.lang.String org,
MultiValue.KeyValuePair<java.lang.String> email,
MultiValue.KeyValuePair<java.lang.String> phone,
MultiValue.KeyValuePair<Address> address,
MultiValue.KeyValuePair<java.lang.String> chat,
java.util.Date birthday,
java.lang.Boolean isPerson)
Modifies an existing Contact. |
boolean |
removeContact(Contact c)
Permamently removes a Contact from the Address Book. |
boolean |
removeGroup(Group g)
Removes a Group from the Address Book. |
boolean |
removeRecord(Record r)
Permamently removes a Record from the Address book. |
void |
revealInAddressBook(Contact c,
boolean edit)
Opens the Address Book and selects the given Contact. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Filter personsFilter
public static final Filter organizationsFilter
public static final Filter contactsWithNameFilter
public static final Filter contactsWithEmailFilter
public static final Filter contactsWithPhoneFilter
public static final Filter contactsWithBirthdayFilter
public static final Filter contactsWithAddressFilter
public static final Filter contactsWithPictureFilter
Method Detail |
---|
public static NativeAddressBook instance()
public static java.util.List<java.util.Map<java.lang.String,java.lang.String>> keyValueListToMapList(java.util.List<MultiValue.KeyValuePair<java.lang.String>> list)
list
- List of KeyValuePairs
public static java.util.List<java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>> addressListToMapList(java.util.List<MultiValue.KeyValuePair<Address>> address)
address
- List of KeyValuePairs
public void init()
public Record getRecord(java.lang.String uid)
uid
- UID to search for
public Contact getMe()
public java.util.List<Contact> getEveryone()
public Group getEveryoneGroup()
public java.util.List<Group> getGroups()
public void revealInAddressBook(Contact c, boolean edit)
c
- Contact to revealedit
- If true, Address Book will open in editing modepublic java.util.List<Contact> findContactsInGroup(Filter search, Group g)
search
- Search filterg
- Group to search for matching Contacts
public java.util.List<Contact> findContacts(Filter search)
search
- Search filter
public java.util.List<Contact> getContactsWithLastName(java.lang.String lastName)
lastName
- Pattern the last name should contain
public java.util.List<Contact> getContactsWithFirstName(java.lang.String firstName)
firstName
- Pattern the first name should contain
public java.util.List<Contact> getContactsWithNameElement(java.lang.String nameElement)
nameElement
- Pattern the full name should contain
public java.util.List<Contact> getContactsWithPhone(java.lang.String phone)
phone
- Pattern the phone numbers should contain
public java.util.List<Contact> getContactsWithEmail(java.lang.String email)
email
- Pattern the Email Addresses should contain
public java.util.List<Contact> getContactsWithAddress(java.lang.String address)
address
- Pattern the addresses should contain
public java.util.List<Contact> getContactsWithSomeAttribute(java.lang.String attribute)
attribute
- Pattern the Contact's attributes should
public void beginModification()
endModification()
, the Address Book
won't be saved and no AddressBookNotification
will be sent. This
greatly improves performance.
endModification()
,
isModificationSessionActive()
public void endModification()
beginModification()
has ended.
beginModification()
,
isModificationSessionActive()
public boolean isModificationSessionActive()
beginModification()
,
endModification()
public Contact addContact(java.lang.String fName, java.lang.String mName, java.lang.String lName, java.lang.String title, java.lang.String org, java.util.List<MultiValue.KeyValuePair<java.lang.String>> email, java.util.List<MultiValue.KeyValuePair<java.lang.String>> phone, java.util.List<MultiValue.KeyValuePair<Address>> address, java.util.List<MultiValue.KeyValuePair<java.lang.String>> chat, java.util.Date birthday, boolean isPerson, Group group)
fName
- first namemName
- middle namelName
- last nametitle
- titleorg
- organizationemail
- E-Mailsphone
- Phonesaddress
- Addresseschat
- Chatsbirthday
- BirthdayisPerson
- Person flaggroup
- Parent group or null for no parent group
public Contact addContact(java.lang.String fName, java.lang.String mName, java.lang.String lName, java.lang.String title, java.lang.String org, MultiValue.KeyValuePair<java.lang.String> email, MultiValue.KeyValuePair<java.lang.String> phone, MultiValue.KeyValuePair<Address> address, MultiValue.KeyValuePair<java.lang.String> chat, java.util.Date birthday, boolean isPerson, Group group)
fName
- first namemName
- middle namelName
- last nametitle
- titleorg
- organizationemail
- E-Mailphone
- Phoneaddress
- Addressechat
- Chatbirthday
- BirthdayisPerson
- Person flaggroup
- Parent group or null for no parent group
public Contact addContact(Group parentGroup)
parentGroup
- The parent Group of the new Contact or null to add it to the
"Everyone" group.
public boolean modifyContact(Contact contact, java.lang.String fName, java.lang.String mName, java.lang.String lName, java.lang.String title, java.lang.String org, java.util.List<MultiValue.KeyValuePair<java.lang.String>> email, java.util.List<MultiValue.KeyValuePair<java.lang.String>> phone, java.util.List<MultiValue.KeyValuePair<Address>> address, java.util.List<MultiValue.KeyValuePair<java.lang.String>> chat, java.util.Date birthday, java.lang.Boolean isPerson)
contact
- Contact to modifyfName
- New first namemName
- New middle namelName
- New last nametitle
- New titleorg
- New organizationemail
- New E-Mailsphone
- New Phonesaddress
- New Addresseschat
- New Chatsbirthday
- BirthdayisPerson
- New Person flag
public boolean modifyContact(Contact contact, java.lang.String fName, java.lang.String mName, java.lang.String lName, java.lang.String title, java.lang.String org, MultiValue.KeyValuePair<java.lang.String> email, MultiValue.KeyValuePair<java.lang.String> phone, MultiValue.KeyValuePair<Address> address, MultiValue.KeyValuePair<java.lang.String> chat, java.util.Date birthday, java.lang.Boolean isPerson)
contact
- Contact to modifyfName
- New first namemName
- New middle namelName
- New last nametitle
- New titleorg
- New organizationemail
- New E-Mailphone
- New Phoneaddress
- New Addressechat
- New Chatbirthday
- BirthdayisPerson
- New Person flag
public Group addGroup(java.lang.String name, Group parentGroup)
name
- Name of the new GroupparentGroup
- Parent group. Usually null.
public boolean removeGroup(Group g)
g
- Group to remove
public boolean removeContact(Contact c)
c
- Contact to remove
public boolean removeRecord(Record r)
r
- Record to remove
public void addAddressBookChangeListener(AddressBookChangeListener listener)
listener
- New listenerpublic void addressBookChangedInternally(AddressBookNotification noti)
noti
- Notification containing the information about what has changedpublic void addressBookChanged(AddressBookNotification noti)
addressBookChanged
in interface AddressBookChangeListener
noti
- Notification containing the information about what has changed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |