Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.compoze.contact
Class Contacts

    java.lang.Object
      |
      +--com.compoze.contact.Contacts

All Implemented Interfaces:
  com.compoze.common.IPagination, java.io.Serializable

Direct Known Subclasses:
  ListContacts

public class Contacts
extends java.lang.Object
implements com.compoze.common.IPagination, java.io.Serializable

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();
    	...
      }

See Also:
  Serialized Form

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

### m_distList

    protected DistributionList m_distList

### m_session

    protected ContactSession m_session

Method Detail

### batchAdd

    public long[] batchAdd(java.util.List contactList)

  Adds a batch of contact to the collection. The specified list contains `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);
       ...

  Parameters:
    `contactList` - the list contact property maps to add
  Returns:
    the list of contact ids of the newly create contacts

### add

    public Contact add()
                throws java.security.AccessControlException

  Adds a contact to the collection.
  Returns:
    the new contact or `null` if create fails
  Throws:
    `java.security.AccessControlException` - an error occurs setting the permissions on the new contact

### setFilter

    public void setFilter(ContactFilter filter)

  Sets the contact filter. The filter may be used to restrict the contacts that are returned by the collection. To clear the filter, use `clearFilter()`.
  Returns:
    the contact filter (may not be `null`)

### getFilter

    public ContactFilter getFilter()

  Gets the contact filter. The filter may be used to restrict the contacts that are returned by the collection.
  Returns:
    the contact filter or `null` if no filter is set

### clearFilter

    public void clearFilter()

  Clears the contact filter for this collection of contacts.

### getPageSize

    public int getPageSize()

  Gets the number of contacts to appear on a single page.
  Specified by:
    `getPageSize` in interface `com.compoze.common.IPagination`
  Returns:
    the number of contacts or 0 for all contacts

### setPageSize

    public void setPageSize(int iPageSize)

  Sets the number of contacts to appear on a single page.
  Specified by:
    `setPageSize` in interface `com.compoze.common.IPagination`
  Parameters:
    `iPageSize` - the number of contacts on a single page or 0 for all contacts

### getShowingFrom

    public int getShowingFrom()

  Gets the from index. Based on the last call to any of the `contacts()` methods, the from index is returned.
  Specified by:
    `getShowingFrom` in interface `com.compoze.common.IPagination`
  Returns:
    the from index or -1 if all contacts were returned
  See Also:
    `contacts()`, `contacts(int)`, `contacts(int, int)`

### getShowingTo

    public int getShowingTo()

  Gets the to index. Based on the last call to any of the `contacts()` methods, the to index is returned.
  Specified by:
    `getShowingTo` in interface `com.compoze.common.IPagination`
  Returns:
    the from index or -1 if all contacts were returned
  See Also:
    `contacts()`, `contacts(int)`, `contacts(int, int)`

### getPageCount

    public int getPageCount()

  Gets the total number of pages in the object for pagination.
  Specified by:
    `getPageCount` in interface `com.compoze.common.IPagination`
  Returns:
    the total number of pages (0 for none)

### getCurrentPageNumber

    public int getCurrentPageNumber()

  Gets the number of the current page.
  Specified by:
    `getCurrentPageNumber` in interface `com.compoze.common.IPagination`
  Returns:
    the current page number

### getNextPageNumber

    public int getNextPageNumber()

  Gets the number of the next page.
  Specified by:
    `getNextPageNumber` in interface `com.compoze.common.IPagination`
  Returns:
    the next page number

### getPreviousPageNumber

    public int getPreviousPageNumber()

  Gets the number of the previous page.
  Specified by:
    `getPreviousPageNumber` in interface `com.compoze.common.IPagination`
  Returns:
    the previous page

### isFirstPage

    public boolean isFirstPage()

  Checks if current page is the first page.
  Specified by:
    `isFirstPage` in interface `com.compoze.common.IPagination`
  Returns:
    `true` if this is the first page; `false` otherwise

### isLastPage

    public boolean isLastPage()

  Checks if current page is the last page.
  Specified by:
    `isLastPage` in interface `com.compoze.common.IPagination`
  Returns:
    `true` if this is the last page; `false` otherwise

### contacts

    public java.util.List contacts(int iPageNumber)

  Gets the sublist of contacts on the specified page number. The number of contacts returned will be equaled to the page size (see `getPageSize()`.
  Parameters:
    `iPageNumber` - the page number (must be greater than zero and less than the total page count)
  Returns:
    the un-modifiable list of `Contact` objects
  See Also:
    `getPageCount()`, `getPageSize()`

### contacts

    public java.util.List contacts()

  Gets the list of all contacts the authenticated user has `READ` access to.
  Returns:
    the un-modifiable list of `Contact` objects

### contacts

    public java.util.List contacts(int iFromIndex,
                                   int iToIndex)

  Gets the sublist of contacts between the specified `iFromIndex` and `iToIndex`.
  Parameters:
    `iFromIndex` - the from index endpoint (inclusive) of the contact list
    `iToIndex` - the to index highpoint (exclusive) of the contact list
  Returns:
    the un-modifiable list of `Contact` objects

### subList

    public java.util.List subList(Contacts contacts)

  Gets the sublist of contacts after subtracting the contacts from the specified contact collection.
  Parameters:
    `contacts` - the contact collection to subtract
  Returns:
    the un-modifiable list of `Contact` objects

### getCount

    public int getCount()

  Gets the number of contacts in the collection. The filter for this collection is applied if one exists; therefore, the number represents the number of contacts satisfying the filter, not the total number of contacts.
  Returns:
    the number of contacts or -1 if a count is not available

### getContact

    public Contact getContact(long id)
                       throws java.security.AccessControlException

  Gets a contact with the given contact id.
  Parameters:
    `id` - the contact id
  Returns:
    the contact or `null` if not found

### sort

    public void sort(SortOrder order,
                     ContactProperty property)

  Sorts the contacts in the collection.
  Parameters:
    `sortOrder` - the sort order
    `property` - the property to sort by

### sort

    public void sort(SortOrder order,
                     ContactProperty[] properties)

  Sorts the contacts in the collection. The first index in the property array is the primary sorting property, the second index is the secondary and so forth.
  Parameters:
    `sortOrder` - the sort order
    `props` - the properties to sort by

### clearSort

    public void clearSort()

  Clears the contact sorting for this collection of contacts.

### getSort

    public SortOrder getSort()

  Gets the sort order.
  Returns:
    the sort order or `null` if not sorting is imposed

### getSortProperty

    public ContactProperty getSortProperty()

  Gets the sort property. If there is more than one sort property set, the primary (first) property is returned.
  Returns:
    the property to sort by or `null` if no property set
  See Also:
    `getSortProperties()`

### getSortProperties

    public ContactProperty[] getSortProperties()

  Gets the sort properties.
  Returns:
    the properties to sort by or `null` if no property set

### deleteContacts

    public void deleteContacts(long[] contactIDs)

  Deletes the specified contacts. The contacts are not archived by default.
  Parameters:
    `contactIDs` - the contact IDs to delete
  See Also:
    `deleteContacts(long[],boolean)`

### deleteContacts

    public void deleteContacts(long[] contactIDs,
                               boolean bArchive)

  Deletes the specified contacts.
  Parameters:
    `contactIDs` - the contact IDs to delete
    `bArchive` - `true` to archive the contacts; `false` to delete

### toString

    public java.lang.String toString()

  Returns the string representation of this object.
  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    the string representation of this object

Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright ©1999-2003 Compoze Software, Inc. All rights reserved.