|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object corny.addressbook.data.Contact
public class Contact
Data model class for Contacts vended from the Mac OS X address book. Provides access to most of the data fields of Address Book Contacts. Also implements methods to modify these fields. The modifications will be applied to Apple's Address Book automatically.
Constructor Summary | |
---|---|
Contact(java.util.Map<java.lang.String,?> rawAttributes)
Creates a new Contact from the data provided by the native code. |
|
Contact(java.lang.String uid,
Group parentGroup,
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)
Creates a new Contact and sets every available field. |
Method Summary | |
---|---|
void |
addSearchStringsToList(java.util.List<java.lang.Object> searchObjects,
java.lang.String propertyLabel)
Used by Filter classes to fetch the searchable fields of an object. |
boolean |
addToGroup(Group g)
Adds this Contact to a Group |
int |
compareTo(Contact o)
Compares this Contact to another by comparing the last names. |
boolean |
equals(java.lang.Object o)
Compared the UIDs. |
MultiValue<Address> |
getAddress()
|
java.util.Date |
getBirthday()
|
MultiValue<java.lang.String> |
getChat()
|
java.util.Date |
getCreationDate()
|
java.lang.String |
getDisplayedName()
|
java.lang.String |
getDisplayedName(boolean lastNameFirst)
The Contact's displayed name. |
MultiValue<java.lang.String> |
getEmail()
|
java.lang.String |
getFirstName()
|
static java.util.Comparator<Contact> |
getFirstNameSorter()
|
java.lang.String |
getFullName()
|
java.lang.String |
getFullNameLastNameFirst()
|
java.lang.String |
getLastName()
|
static java.util.Comparator<Contact> |
getLastNameSorter()
|
java.lang.String |
getMiddleName()
|
java.util.Date |
getModificationDate()
|
java.lang.String |
getOrganization()
|
java.util.Set<Group> |
getParentGroups()
|
MultiValue<java.lang.String> |
getPhone()
|
java.awt.image.BufferedImage |
getPicture()
|
java.lang.String |
getTitle()
|
java.lang.String |
getUID()
|
java.lang.Object |
getValueForProperty(ContactProperty prop)
Returns the value for the given ContactProperty of this Contact. |
java.lang.Object |
getValueForProperty(ContactProperty prop,
java.lang.String label)
Returns the value for the given ContactProperty of this Contact. |
boolean |
hasPicture()
|
void |
initializeWith(Record o)
Used by NativeAddressBook to re-initialize this Contact if it was modified externally. |
boolean |
isPerson()
|
void |
reInitialize(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)
Called by NativeAddressBook.modifyContact(...). |
boolean |
removeFromGroup(Group g)
Removes this Contact from a Group |
void |
revealInAddressBook(boolean edit)
Opens the Address Book and selects this Contact. |
boolean |
setAddress(MultiValue.KeyValuePair<Address> oldValue,
java.lang.String newKey,
Address newValue)
Modifies a given address. |
boolean |
setAddresses(java.util.List<MultiValue.KeyValuePair<Address>> addresses)
Replaces the current addresses with the addresses in the given List of KeyValuePairs. |
boolean |
setAddresses(MultiValue<Address> addresses)
Replaces the current addresses with the content of the given MultiValue instance. |
boolean |
setBirthday(java.util.Date birthday)
Changes the Birthday of this Contact. |
boolean |
setChat(MultiValue.KeyValuePair<java.lang.String> oldValue,
java.lang.String newKey,
java.lang.String newValue)
Modifies a given chat. |
boolean |
setChats(java.util.List<MultiValue.KeyValuePair<java.lang.String>> chats)
Replaces the current chats with the chats in the given List of KeyValuePairs. |
boolean |
setChats(MultiValue<java.lang.String> chats)
Replaces the current chats with the content of the given MultiValue instance. |
boolean |
setEmail(MultiValue.KeyValuePair<java.lang.String> oldValue,
java.lang.String newKey,
java.lang.String newValue)
Modifies a given Email address. |
boolean |
setEmails(java.util.List<MultiValue.KeyValuePair<java.lang.String>> emails)
Replaces the current Emails with the Emails in the given List of KeyValuePairs. |
boolean |
setEmails(MultiValue<java.lang.String> emails)
Replaces the current Emails with the content of the given MultiValue instance. |
boolean |
setFirstName(java.lang.String firstName)
Changes the first name of this Contact. |
boolean |
setIsPerson(boolean isPerson)
Changes the person flag of this Contact. |
boolean |
setLastName(java.lang.String lastName)
Changes the last name of this Contact. |
boolean |
setMiddleName(java.lang.String middleName)
Changes the middle name of this Contact. |
boolean |
setOrganitation(java.lang.String organization)
Changes the organization of this Contact. |
boolean |
setPhone(MultiValue.KeyValuePair<java.lang.String> oldValue,
java.lang.String newKey,
java.lang.String newValue)
Modifies a given phone number. |
boolean |
setPhones(java.util.List<MultiValue.KeyValuePair<java.lang.String>> phones)
Replaces the current phone numbers with the phone numbers in the given List of KeyValuePairs. |
boolean |
setPhones(MultiValue<java.lang.String> phones)
Replaces the current phone numbers with the content of the given MultiValue instance. |
boolean |
setTitle(java.lang.String title)
Changes the title of this Contact. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Contact(java.util.Map<java.lang.String,?> rawAttributes)
rawAttributes
- Data provided by the native codepublic Contact(java.lang.String uid, Group parentGroup, 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)
uid
- UID of the ContactparentGroup
- Parent GroupfName
- First namemName
- Middle namelName
- Last nametitle
- Titleorg
- Organizationemail
- Emailphone
- Phoneaddress
- Addresschat
- Chatbirthday
- BirthdayisPerson
- true: Person, false: OrganizationMethod Detail |
---|
public static java.util.Comparator<Contact> getLastNameSorter()
public static java.util.Comparator<Contact> getFirstNameSorter()
public java.lang.Object getValueForProperty(ContactProperty prop, java.lang.String label)
ContactProperty
of this Contact.
prop
- ContactPropertylabel
- Specific label for a multi value property
public java.lang.Object getValueForProperty(ContactProperty prop)
ContactProperty
of this Contact.
prop
- ContactProperty
public java.lang.String getFirstName()
public java.lang.String getMiddleName()
public java.lang.String getLastName()
public java.lang.String getTitle()
public java.lang.String getOrganization()
public MultiValue<java.lang.String> getEmail()
public MultiValue<java.lang.String> getPhone()
public MultiValue<Address> getAddress()
public MultiValue<java.lang.String> getChat()
public java.util.Date getBirthday()
public java.util.Set<Group> getParentGroups()
getParentGroups
in interface Record
public java.util.Date getCreationDate()
public java.util.Date getModificationDate()
public java.lang.String getUID()
getUID
in interface Record
public boolean isPerson()
public boolean hasPicture()
public java.awt.image.BufferedImage getPicture()
public java.lang.String getFullName()
public java.lang.String getFullNameLastNameFirst()
public java.lang.String getDisplayedName(boolean lastNameFirst)
lastNameFirst
- If and the Contact is a Person, the full name will be return
with the last name first.
public java.lang.String getDisplayedName()
public boolean setFirstName(java.lang.String firstName)
firstName
- New first name
public boolean setMiddleName(java.lang.String middleName)
middleName
- New first name
public boolean setLastName(java.lang.String lastName)
lastName
- New first name
public boolean setTitle(java.lang.String title)
title
- New first name
public boolean setIsPerson(boolean isPerson)
isPerson
- true: Contact is a Person, false: Contact is a Company
public boolean setBirthday(java.util.Date birthday)
birthday
- New birthday
public boolean setOrganitation(java.lang.String organization)
organization
- New first name
public boolean setEmails(MultiValue<java.lang.String> emails)
emails
- New Emails
public boolean setEmails(java.util.List<MultiValue.KeyValuePair<java.lang.String>> emails)
emails
- New Emails
public boolean setEmail(MultiValue.KeyValuePair<java.lang.String> oldValue, java.lang.String newKey, java.lang.String newValue)
oldValue
- Old Email address to modifynewKey
- New key or null to leave the old keynewValue
- New value or null to leave the old value
public boolean setPhones(MultiValue<java.lang.String> phones)
phones
- New phone numbers
public boolean setPhones(java.util.List<MultiValue.KeyValuePair<java.lang.String>> phones)
phones
- New phone numbers
public boolean setPhone(MultiValue.KeyValuePair<java.lang.String> oldValue, java.lang.String newKey, java.lang.String newValue)
oldValue
- Old phone number to modifynewKey
- New key or null to leave the old keynewValue
- New value or null to leave the old value
public boolean setAddresses(MultiValue<Address> addresses)
addresses
- New addresses
public boolean setAddresses(java.util.List<MultiValue.KeyValuePair<Address>> addresses)
addresses
- New addresses
public boolean setAddress(MultiValue.KeyValuePair<Address> oldValue, java.lang.String newKey, Address newValue)
oldValue
- Old address to modifynewKey
- New key or null to leave the old keynewValue
- New value or null to leave the old value
public boolean setChats(MultiValue<java.lang.String> chats)
chats
- New chats
public boolean setChats(java.util.List<MultiValue.KeyValuePair<java.lang.String>> chats)
chats
- New chats
public boolean setChat(MultiValue.KeyValuePair<java.lang.String> oldValue, java.lang.String newKey, java.lang.String newValue)
oldValue
- Old chat to modifynewKey
- New key or null to leave the old keynewValue
- New value or null to leave the old value
public boolean addToGroup(Group g)
g
- Group to add this Contact to
public boolean removeFromGroup(Group g)
g
- Group to remove this Contact from
public void revealInAddressBook(boolean edit)
edit
- If true, Address Book will open in editing modepublic void reInitialize(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)
fName
- 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 flagNativeAddressBook.modifyContact(Contact, String, String, String,
String, String, List, List, List, List, Date, Boolean)
public int compareTo(Contact o)
compareTo
in interface java.lang.Comparable<Contact>
public java.lang.String toString()
toString
in class java.lang.Object
public void addSearchStringsToList(java.util.List<java.lang.Object> searchObjects, java.lang.String propertyLabel)
Searchable
addSearchStringsToList
in interface Searchable
searchObjects
- List to add the searchable fields topropertyLabel
- If this is set, only the properties with a specific label
should be added to the list.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public void initializeWith(Record o)
initializeWith
in interface Record
o
- Record to take data from
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |