Java Reference
In-Depth Information
General PIM API Design
The basic idea of the API is to store entries such as contacts, events, and to-do elements in an
appropriate database. In order to achieve this, the PIM API contains an interface
PIMList
providing methods to add, delete, and enumerate all the entries contained in the list. The concrete
implementations of
PIMList
contained in the PIM API are
ContactList
s to store contacts,
EventList
s to store events, and
ToDoList
s to store to-do items. The PIM class provides static
methods such as openContactList() to access the different list types.
PIMList
s contain objects implementing the
PIMElement
interface.
PIMElement
encapsulates
the common properties of the different PIM elements such as
Contact
s,
Event
s, and
ToDo
s.
The interface provides methods for common functionality such as category access and vFormat
import and export, as well as access to the fields of an entry. Access to some specialized fields is
provided by the derived interfaces
Contact
,
Event
, and
ToDo
. For illegal PIM operations, a
PIMException
will be thrown. In the next sections, you will learn the details of the specialized
address book, event, and to-do functionality.
In contrast to vCard, vCalendar, and the JavaPhone API, the PDAP PIM API does not support
multiple fields with the same name and type combination. Although this restriction causes a slight
loss of flexibility, it makes the API much less complex than the JavaPhone API. Fields with a
single ID and multiple types are described in more detail in the following section.
Addressbook API
The functionality of the address book is achieved using the
ContactList
and
Contact
classes
only. Contacts in the PIM API support a subset of the fields of the vCard format version 3.0 specified
in IETF RFC 2426. The following example shows a vCard for John Smith in ASCII format:
BEGIN:VCARD
FN:John Smith
N:Smith;John;;;MD
TEL;TYPE=WORK:555-7352
TEL;TYPE=HOME:555-4321
END:VCARD
Note
More information about IETF RFC 2426 can be found at
Contacts and Their Fields
As mentioned earlier, the interface Contact extending the
PIMElement
interface represents a single
contact. A
contact
consists of several fields such as name, phone number, or birthday. These fields are
of different data types, depending on their purpose. For example, the name and address information is
stored in strings, whereas the birthday is stored in a date field. In the following subsections we will
describe the different field types and fields available in the PIM API.
Search WWH ::
Custom Search