com.moyosoft.exchange.item
Interface ItemsCollection

All Superinterfaces:
ExchangeCollection<ExchangeItem>, java.lang.Iterable<ExchangeItem>

public interface ItemsCollection
extends ExchangeCollection<ExchangeItem>

A collection of Exchange items.

The collection allows to get, iterate over, search and sort Exchange items.

This class implements the Iterable interface allowing it to be a target of the foreach statement.


Method Summary
 java.lang.Iterable<ExchangeItem> iterableForCalendar(java.util.Date startDate, java.util.Date endDate)
          Creates a special Iterable object for a Calendar folder containing items between the specified dates.
 java.lang.Iterable<ExchangeItem> iterableForCalendar(java.util.Date startDate, java.util.Date endDate, int maxItemsReturned)
          Creates a special Iterable object for a Calendar folder containing items between the specified dates, limiting the result set to the specified maximum.
 java.lang.Iterable<ExchangeItem> iterableFromIndex(int startFromIndex)
          Creates a new Iterable for items in this collection starting at the specified index.
 java.lang.Iterable<ExchangeItem> iterableFromIndex(int startFromIndex, int maxItemsReturned)
          Creates a new Iterable for items in this collection starting at the specified index and limits the returned result set to the specified maximum of items.
 ItemsIterator iterator()
          Creates an iterator for all items in this collection.
 ItemsIterator iteratorForCalendar(java.util.Date startDate, java.util.Date endDate)
          Creates a special iterator for a Calendar folder containing items between the specified dates.
 ItemsIterator iteratorForCalendar(java.util.Date startDate, java.util.Date endDate, int maxItemsReturned)
          Creates a special iterator for a Calendar folder containing items between the specified dates, limiting the result set to the specified maximum.
 ItemsIterator iteratorFromIndex(int startFromIndex)
          Creates a new iterator for items in this collection starting at the specified index.
 ItemsIterator iteratorFromIndex(int startFromIndex, int maxItemsReturned)
          Creates a new iterator for items in this collection starting at the specified index and limits the returned result set to the specified maximum of items.
 ItemsCollection restrict(Restriction restriction)
          Creates a new collection restricted to items that matches the specified restriction criteria.
 void setLoadAllProperties(boolean loadAllProperties)
           
 void setLoadOnlyItemId(boolean loadOnlyId)
           
 ItemsCollection sortBy(ExchangeItemField sortByField)
          Creates a new collection with items sorted by the specified field in ascending order.
 ItemsCollection sortBy(ExchangeItemField sortByField, boolean ascendingOrder)
          Creates a new collection with items sorted by the specified field in either ascending or descending order.
 
Methods inherited from interface com.moyosoft.exchange.util.ExchangeCollection
getAt, getCount
 

Method Detail

iterableFromIndex

java.lang.Iterable<ExchangeItem> iterableFromIndex(int startFromIndex)
                                                   throws ExchangeServiceException
Creates a new Iterable for items in this collection starting at the specified index. The items before this index will be skipped over and ignored.

This method never returns null, even if the collection is empty or there are no more items after the specified index. An empty Iterable will be returned in this case.

To iterate over all items in this collection use the method iterator().

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
See Also:
iterator()

iterableFromIndex

java.lang.Iterable<ExchangeItem> iterableFromIndex(int startFromIndex,
                                                   int maxItemsReturned)
                                                   throws ExchangeServiceException
Creates a new Iterable for items in this collection starting at the specified index and limits the returned result set to the specified maximum of items. The items before the start index will be skipped over and ignored. The item at the index (startFromIndex + maxItemsReturned) and all following items won't be provided by the Iterable.

This method never returns null, even if the collection is empty or there are no more items after the specified index. An empty Iterable will be returned in this case.

To iterate over all items in this collection use the method iterator().

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
See Also:
iterator()

iterator

ItemsIterator iterator()
Creates an iterator for all items in this collection.

This method never returns null, even if the collection is empty. An empty iterator will be returned in this case.

Specified by:
iterator in interface java.lang.Iterable<ExchangeItem>

iteratorFromIndex

ItemsIterator iteratorFromIndex(int startFromIndex)
                                throws ExchangeServiceException
Creates a new iterator for items in this collection starting at the specified index. The items before this index will be skipped over and ignored.

This method never returns null, even if the collection is empty or there are no more items after the specified index. An empty iterator will be returned in this case.

To iterate over all items in this collection use the method iterator().

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
See Also:
iterator()

iteratorFromIndex

ItemsIterator iteratorFromIndex(int startFromIndex,
                                int maxItemsReturned)
                                throws ExchangeServiceException
Creates a new iterator for items in this collection starting at the specified index and limits the returned result set to the specified maximum of items. The items before the start index will be skipped over and ignored. The item at the index (startFromIndex + maxItemsReturned) and all following items won't be reached by the iterator.

This method never returns null, even if the collection is empty or there are no more items after the specified index. An empty iterator will be returned in this case.

To iterate over all items in this collection use the method iterator().

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
See Also:
iterator()

restrict

ItemsCollection restrict(Restriction restriction)
                         throws ExchangeServiceException
Creates a new collection restricted to items that matches the specified restriction criteria.

To create the restriction criteria, use the class If. This class allows criteria to be specified on item's fields and creates the Restriction object.

Example code matching items with a Subject that starts with "Test":
ItemsCollection items = ...;
items = items.restrict(If.Item.Subject.startsWith("Test"));

Returns:
the restricted collection.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
See Also:
If

sortBy

ItemsCollection sortBy(ExchangeItemField sortByField)
Creates a new collection with items sorted by the specified field in ascending order.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

sortBy

ItemsCollection sortBy(ExchangeItemField sortByField,
                       boolean ascendingOrder)
Creates a new collection with items sorted by the specified field in either ascending or descending order.

Parameters:
ascendingOrder - if true items will be sorted in ascending order.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

iteratorForCalendar

ItemsIterator iteratorForCalendar(java.util.Date startDate,
                                  java.util.Date endDate)
                                  throws ExchangeServiceException
Creates a special iterator for a Calendar folder containing items between the specified dates. Unlike other iterators, the items returned by this iterator include all individual occurrences of recurring appointments.

This method never returns null, even if the collection is empty. An empty iterator will be returned in this case.

Throws:
ExchangeServiceException

iterableForCalendar

java.lang.Iterable<ExchangeItem> iterableForCalendar(java.util.Date startDate,
                                                     java.util.Date endDate)
                                                     throws ExchangeServiceException
Creates a special Iterable object for a Calendar folder containing items between the specified dates. The items contained by this Iterable include all individual occurrences of recurring appointments.

This method never returns null, even if the collection is empty. An empty Iterable will be returned in this case.

Throws:
ExchangeServiceException

iteratorForCalendar

ItemsIterator iteratorForCalendar(java.util.Date startDate,
                                  java.util.Date endDate,
                                  int maxItemsReturned)
                                  throws ExchangeServiceException
Creates a special iterator for a Calendar folder containing items between the specified dates, limiting the result set to the specified maximum. Unlike other iterators, the items returned by this iterator include all individual occurrences of recurring appointments.

This method never returns null, even if the collection is empty. An empty iterator will be returned in this case.

Throws:
ExchangeServiceException

iterableForCalendar

java.lang.Iterable<ExchangeItem> iterableForCalendar(java.util.Date startDate,
                                                     java.util.Date endDate,
                                                     int maxItemsReturned)
                                                     throws ExchangeServiceException
Creates a special Iterable object for a Calendar folder containing items between the specified dates, limiting the result set to the specified maximum. The items contained by this Iterable include all individual occurrences of recurring appointments.

This method never returns null, even if the collection is empty. An empty Iterable will be returned in this case.

Throws:
ExchangeServiceException

setLoadOnlyItemId

void setLoadOnlyItemId(boolean loadOnlyId)

setLoadAllProperties

void setLoadAllProperties(boolean loadAllProperties)