|
Compoze Software, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.compoze.contact.Contacts
This class represents a collection of contacts. The contacts collection may be used to iterate through contacts. By default, the contacts are sorted by last name in ascending order.
The contacts collection may also be used for searching. The following code segment shows how to reduce the contacts that are returned in the collection to ones with a particular last name and implies sorting:
ContactSession s = ContactSession.getSession(user); Contacts contacts = s.getContacts(); ContactFilter filter = new ContactFilter(); filter.setLastName("jones"); contacts.setFilter(filter); contacts.sort(SortOrder.ASCENDING, ContactProperty.LAST_NAME); Iterator it = contacts.contacts().iterator(); while(it.hasNext()) { Contact c = (Contact) it.next(); ... }
Field Summary | |
protected DistributionList |
m_distList
|
protected ContactSession |
m_session
|
Method Summary | |
Contact |
add()
Adds a contact to the collection. |
long[] |
batchAdd(java.util.List contactList)
Adds a batch of contact to the collection. |
void |
clearFilter()
Clears the contact filter for this collection of contacts. |
void |
clearSort()
Clears the contact sorting for this collection of contacts. |
java.util.List |
contacts()
Gets the list of all contacts the authenticated user has READ access to. |
java.util.List |
contacts(int iPageNumber)
Gets the sublist of contacts on the specified page number. |
java.util.List |
contacts(int iFromIndex,
int iToIndex)
Gets the sublist of contacts between the specified iFromIndex and iToIndex . |
void |
deleteContacts(long[] contactIDs)
Deletes the specified contacts. |
void |
deleteContacts(long[] contactIDs,
boolean bArchive)
Deletes the specified contacts. |
Contact |
getContact(long id)
Gets a contact with the given contact id. |
int |
getCount()
Gets the number of contacts in the collection. |
int |
getCurrentPageNumber()
Gets the number of the current page. |
ContactFilter |
getFilter()
Gets the contact filter. |
int |
getNextPageNumber()
Gets the number of the next page. |
int |
getPageCount()
Gets the total number of pages in the object for pagination. |
int |
getPageSize()
Gets the number of contacts to appear on a single page. |
int |
getPreviousPageNumber()
Gets the number of the previous page. |
int |
getShowingFrom()
Gets the from index. |
int |
getShowingTo()
Gets the to index. |
SortOrder |
getSort()
Gets the sort order. |
ContactProperty[] |
getSortProperties()
Gets the sort properties. |
ContactProperty |
getSortProperty()
Gets the sort property. |
boolean |
isFirstPage()
Checks if current page is the first page. |
boolean |
isLastPage()
Checks if current page is the last page. |
void |
setFilter(ContactFilter filter)
Sets the contact filter. |
void |
setPageSize(int iPageSize)
Sets the number of contacts to appear on a single page. |
void |
sort(SortOrder order,
ContactProperty property)
Sorts the contacts in the collection. |
void |
sort(SortOrder order,
ContactProperty[] properties)
Sorts the contacts in the collection. |
java.util.List |
subList(Contacts contacts)
Gets the sublist of contacts after subtracting the contacts from the specified contact collection. |
java.lang.String |
toString()
Returns the string representation of this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected DistributionList m_distList
protected ContactSession m_session
Method Detail |
public long[] batchAdd(java.util.List contactList)
java.util.Map
objects. The maps
map a ContactProperty
to an object value.
Each bucket in the list represents a contact to add.
For example:
Map props = new HashMap(); props.put(ContactProperty.FIRST_NAME, "Joe"); props.put(ContactProperty.LAST_NAME, "Smith"); ... List contactList = new LinkedList(); contactList.add(props); ...
contactList
- the list contact property maps to addpublic Contact add() throws java.security.AccessControlException
null
if create failsjava.security.AccessControlException
- an error occurs setting the permissions on the new contactpublic void setFilter(ContactFilter filter)
clearFilter()
.null
)public ContactFilter getFilter()
null
if no filter is setpublic void clearFilter()
public int getPageSize()
getPageSize
in interface com.compoze.common.IPagination
public void setPageSize(int iPageSize)
setPageSize
in interface com.compoze.common.IPagination
iPageSize
- the number of contacts on a single page or 0 for all contactspublic int getShowingFrom()
contacts()
methods, the from index is returned.getShowingFrom
in interface com.compoze.common.IPagination
contacts()
,
contacts(int)
,
contacts(int, int)
public int getShowingTo()
contacts()
methods, the to index is returned.getShowingTo
in interface com.compoze.common.IPagination
contacts()
,
contacts(int)
,
contacts(int, int)
public int getPageCount()
getPageCount
in interface com.compoze.common.IPagination
public int getCurrentPageNumber()
getCurrentPageNumber
in interface com.compoze.common.IPagination
public int getNextPageNumber()
getNextPageNumber
in interface com.compoze.common.IPagination
public int getPreviousPageNumber()
getPreviousPageNumber
in interface com.compoze.common.IPagination
public boolean isFirstPage()
isFirstPage
in interface com.compoze.common.IPagination
true
if this is the first page; false
otherwisepublic boolean isLastPage()
isLastPage
in interface com.compoze.common.IPagination
true
if this is the last page; false
otherwisepublic java.util.List contacts(int iPageNumber)
getPageSize()
.iPageNumber
- the page number (must be greater than zero and less than the total page count)Contact
objectsgetPageCount()
,
getPageSize()
public java.util.List contacts()
READ
access to.Contact
objectspublic java.util.List contacts(int iFromIndex, int iToIndex)
iFromIndex
and iToIndex
.iFromIndex
- the from index endpoint (inclusive) of the contact listiToIndex
- the to index highpoint (exclusive) of the contact listContact
objectspublic java.util.List subList(Contacts contacts)
contacts
- the contact collection to subtractContact
objectspublic int getCount()
public Contact getContact(long id) throws java.security.AccessControlException
id
- the contact idnull
if not foundpublic void sort(SortOrder order, ContactProperty property)
sortOrder
- the sort orderproperty
- the property to sort bypublic void sort(SortOrder order, ContactProperty[] properties)
sortOrder
- the sort orderprops
- the properties to sort bypublic void clearSort()
public SortOrder getSort()
null
if not sorting is imposedpublic ContactProperty getSortProperty()
null
if no property setgetSortProperties()
public ContactProperty[] getSortProperties()
null
if no property setpublic void deleteContacts(long[] contactIDs)
contactIDs
- the contact IDs to deletedeleteContacts(long[],boolean)
public void deleteContacts(long[] contactIDs, boolean bArchive)
contactIDs
- the contact IDs to deletebArchive
- true
to archive the contacts; false
to deletepublic java.lang.String toString()
toString
in class java.lang.Object
|
Compoze Software, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |