|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PIMList
Represents the common functionality of a PIM list. PIMLists contain zero or
more PIMItems (represented by the class PIMItem
). A
PIMList
allows retrieval of all or some of the
PIMItem
s contained in the list.
PIMList
s maintain categories. Categories are logical
groupings for the PIMItems contained in the list. Each PIMList can support
zero or more categories. Categories are represented by unique String names.
Each PIMList
also defines what fields are included in the
items that get stored in the list. While the definition of all possible
fields reside in PIMItem
, each PIMList
dictates which fields are supported for storage and retrieval in the list's
items at runtime.
PIMList
implementations are defined
in BlackBerryPIMList
. The sub-interfaces
of BlackBerryPIMList
provide the RIM extensions to each
individual PIM list (for example,
BlackBerryEventList
provides the RIM
extensions to EventList
).
Any PIMList
instance retrieved from
PIM.openPIMList()
can be successfully
cast into a BlackBerryPIMList
in order to use these RIM
extensions.
Field Summary | ||
---|---|---|
static String |
UNCATEGORIZED
Constant for the PIMList.itemsByCategory(String) method to indicate to
search for uncategorized items. |
Method Summary | ||
---|---|---|
void |
addCategory(String category)
Adds the provided category to the PIM list. |
|
void |
close()
Closes the list, releasing any resources for this list. |
|
void |
deleteCategory(String category,
boolean deleteUnassignedItems)
Deletes the indicated category from the PIM list. |
|
String |
getArrayElementLabel(int stringArrayField,
int arrayElement)
Returns a String label associated with the given array element. |
|
String |
getAttributeLabel(int attribute)
Returns a String label associated with the given attribute. |
|
String[] |
getCategories()
Returns the categories defined for the PIM list. |
|
int |
getFieldDataType(int field)
Returns the data type of the data associated with the given field. |
|
String |
getFieldLabel(int field)
Returns a String label associated with the given field. |
|
String |
getName()
Provides the name of the list. |
|
int[] |
getSupportedArrayElements(int stringArrayField)
Returns an integer array containing all of the supported elements of a string array for the given field. |
|
int[] |
getSupportedAttributes(int field)
Returns an integer array containing all of the supported attributes for the given field. |
|
int[] |
getSupportedFields()
Gets all fields that are supported in this list. |
|
boolean |
isCategory(String category)
Returns indication of whether the given category is a valid existing category for this list. |
|
boolean |
isSupportedArrayElement(int stringArrayField,
int arrayElement)
Indicates whether or not the given element in a array is supported for the indicated field in this PIM list. |
|
boolean |
isSupportedAttribute(int field,
int attribute)
Indicates whether or not the given attribute is supported in this PIM list for the indicated field. |
|
boolean |
isSupportedField(int field)
Indicates whether or not the given field is supported in this PIM list. |
|
Enumeration |
items()
Returns an Enumeration of all items in the list. |
|
Enumeration |
items(String matching)
Return an Enumeration of items with String field data
that contains the matching string argument. |
|
Enumeration |
items(PIMItem matching)
Returns an Enumeration of all items in the list that
contain fields that match all of those fields specified in the given
"matching" item. |
|
Enumeration |
itemsByCategory(String category)
Returns an enumeration of all items in the PIM list that match the provided category. |
|
int |
maxCategories()
Returns the maximum number of categories that this list can have. |
|
int |
maxValues(int field)
Indicates the total number of data values that a particular field supports in this list. |
|
void |
renameCategory(String currentCategory,
String newCategory)
Renames a category from an old name to a new name. |
|
int |
stringArraySize(int stringArrayField)
Returns the size of the array for the given string array field. |
Field Detail |
---|
static final String UNCATEGORIZED
PIMList.itemsByCategory(String)
method to indicate to
search for uncategorized items. The value of this constant is
null
.
Method Detail |
---|
void addCategory(String category) throws PIMException
The category names are case sensitive in this API, but not necessarily in the underlying implementation. For example, "Work" and "WORK" map to the same underlying category if the platform's implementation of categories is case-insensitive; adding both separately would result in only one category being created in this case.
A string with no characters ("") may or may not be a valid category on a
particular platform. If the string is not a valid category as defined by
the platform, a PIMException
will be thrown when trying to
add it.
category
- a String representing the category to add.
PIMException
- If categories are unsupported, an error occurs, or the
list is no longer accessible or closed. Also thrown if
the maximum number of categories for this list is
exceeded, or if the category name is invalid.
SecurityException
- if the application is not given permission to write to
the PIM list or the list is opened READ_ONLY
.
NullPointerException
- if category
is null.PIMList.deleteCategory(String, boolean)
,
PIMList.renameCategory(String, String)
,
PIMList.getCategories()
,
PIMList.isCategory(String)
,
PIMList.maxCategories()
void close() throws PIMException
PIMException
is thrown for any subsequent method
invocations for the class instance.
PIMException
- If the list is no longer accessible.void deleteCategory(String category, boolean deleteUnassignedItems) throws PIMException
The category names are case sensitive in this API, but not necessarily in the underlying implementation. For example, "Work" and "WORK" map to the same underlying category if the platform's implementation of categories is case-insensitive; removing both separately would result in only one category being removed in this case.
category
- a String representing the category to delete.deleteUnassignedItems
- if true
then delete all items in this list
that no longer have any categories assigned to them as a
result of this method; if false
then no
items are deleted as a result of this method.
PIMException
- If categories are unsupported, an error occurs, or the
list is no longer accessible or closed.
SecurityException
- if the application is not given permission to write to
the PIM list or the list is opened READ_ONLY
.
NullPointerException
- if category
is null.PIMList.addCategory(String)
,
PIMList.renameCategory(String, String)
,
PIMList.getCategories()
,
PIMList.isCategory(String)
,
PIMList.maxCategories()
String getArrayElementLabel(int stringArrayField, int arrayElement)
PIMList.isSupportedArrayElement(int, int)
should be used to verify the
array elements's validity for this item prior to invoking this method.
stringArrayField
- The field which has a STRING_ARRAY
data
type, as defined by classes implementing the
PIMItem
interface, whose element's label to
return.arrayElement
- The element in the array whose label to return, as defined
in the classes implementing the PIMItem
interface.
IllegalArgumentException
- if the field or array element is not valid for the
implementing class. IllegalArgumentException
takes precedence over
UnsupportedFieldException
when checking
the provided field.
UnsupportedFieldException
- if the field or array element is not supported in the
implementing instance of the class.PIMList.getSupportedArrayElements(int)
,
PIMList.isSupportedArrayElement(int, int)
String getAttributeLabel(int attribute)
PIMList.isSupportedAttribute(int, int)
should be used to verify the
attribute's validity for this item prior to invoking this method.
attribute
- The attribute for which the label is being queried.
IllegalArgumentException
- if the attribute is not valid for the implementing class.
IllegalArgumentException
takes precedence
over UnsupportedFieldException
when
checking the provided field.
UnsupportedFieldException
- if the attribute is not supported in the implementing
instance of the class.PIMList.isSupportedAttribute(int, int)
,
PIMList.getSupportedAttributes(int)
String[] getCategories() throws PIMException
PIMException
- If an error occurs or the list is no longer accessible or
closed.PIMList.addCategory(String)
,
PIMList.deleteCategory(String, boolean)
,
PIMList.renameCategory(String, String)
,
PIMList.isCategory(String)
,
PIMList.maxCategories()
int getFieldDataType(int field)
PIMList.isSupportedField(int)
should be used to verify the field
validity for this item prior to invoking this method.
field
- The field for which the data type is being queried.
PIMItem.INT
, PIMItem.BOOLEAN
,
PIMItem.STRING
, PIMItem.STRING_ARRAY
,
PIMItem.BINARY
, and PIMItem.DATE
.
IllegalArgumentException
- if the field is not valid for the implementing class.
IllegalArgumentException
takes precedence
over UnsupportedFieldException
when
checking the provided field.
UnsupportedFieldException
- if the field is not supported in the implementing
instance of the class.PIMList.isSupportedField(int)
,
PIMList.getSupportedFields()
,
PIMList.maxValues(int)
String getFieldLabel(int field)
PIMList.isSupportedField(int)
should be used to verify the field
validity for this item prior to invoking this method.
field
- The field for which the label is being queried.
IllegalArgumentException
- if the field is not valid for the implementing class.
IllegalArgumentException
takes precedence
over UnsupportedFieldException
when
checking the provided field.
UnsupportedFieldException
- if the field is not supported in the implementing
instance of the class.PIMList.getSupportedFields()
,
PIMList.isSupportedField(int)
String getName()
PIMList
s have a
non-null name associated with it.
RIM Implementation Note: In the case where the underlying database that this list accesses is removed this method returns the empty string.
null
.PIM.listPIMLists(int)
,
PIM.openPIMList(int, int, String)
int[] getSupportedArrayElements(int stringArrayField)
stringArrayField
- The field which has a STRING_ARRAY
data
type, as defined by classes implementing the
PIMItem
interface, whose list of supported
array elements to return.
IllegalArgumentException
- if field
is not a valid
STRING_ARRAY
field (i.e. not a standard
field and not an extended field that has a data type of
StringArray). IllegalArgumentException
takes precedence over
UnsupportedFieldException
when checking
the provided field.
UnsupportedFieldException
- if the field is not supported in the implementing
instance of the class.PIMList.getArrayElementLabel(int, int)
,
PIMList.isSupportedArrayElement(int, int)
int[] getSupportedAttributes(int field)
field
- the field whose supported attributes list to return.
IllegalArgumentException
- if field
is not a valid field (i.e. not a
standard field and not an extended field).
IllegalArgumentException
takes precedence
over UnsupportedFieldException
when
checking the provided field.
UnsupportedFieldException
- if the field is not supported in the implementing
instance of the class.PIMList.getAttributeLabel(int)
,
PIMList.isSupportedAttribute(int, int)
int[] getSupportedFields()
PIMList.getFieldLabel(int)
,
PIMList.isSupportedField(int)
,
PIMList.maxValues(int)
boolean isCategory(String category) throws PIMException
category
- a String representing the category to query.
true
if the specified category is a valid existing
category for this list; false
otherwise.
PIMException
- If an error occurs or the list is no longer accessible or
closed.PIMList.addCategory(String)
,
PIMList.deleteCategory(String, boolean)
,
PIMList.renameCategory(String, String)
,
PIMList.getCategories()
,
PIMList.maxCategories()
boolean isSupportedArrayElement(int stringArrayField, int arrayElement)
stringArrayField
- The field which has a STRING_ARRAY
data
type, as defined by classes implementing the
PIMItem
interface.arrayElement
- The element in the array to check, as defined in the
classes implementing the PIMItem
interface.
true
if the specified array element is supported
in the specified string array field, false
otherwise. Invalid fields and invalid array elements return
false
.PIMList.getArrayElementLabel(int, int)
,
PIMList.getSupportedArrayElements(int)
boolean isSupportedAttribute(int field, int attribute)
field
- The field against which the attribute is checked.attribute
- The single attribute to check.
true
if the specified attribute is supported for
values in the specified field, false
otherwise.
Invalid fields and invalid attributes return false
.PIMList.getAttributeLabel(int)
,
PIMList.getSupportedAttributes(int)
boolean isSupportedField(int field)
field
- The field to check, as defined by in the class
implementing the PIMItem
.
true
if the specified field is supported in this
list, false
otherwise. Invalid fields return
false
.PIMList.getSupportedFields()
,
PIMList.getFieldLabel(int)
,
PIMList.getFieldDataType(int)
,
PIMList.maxValues(int)
Enumeration items() throws PIMException
Enumeration
of all items in the list. The order
is undefined.
Enumeration
of all items.
PIMException
- If an error occurs or the list is no longer accessible or
closed.
SecurityException
- if the application is not given permission to read the
PIM list or the list is opened WRITE_ONLY
.PIMList.items(PIMItem)
,
PIMList.items(String)
,
PIMList.itemsByCategory(String)
Enumeration items(PIMItem matching) throws PIMException
Enumeration
of all items in the list that
contain fields that match all of those fields specified in the given
"matching" item. An item that matches may have more data than is
specified in the matching item, but must at least match all fields
specified in the matching item. Only fields that have values set within
the matching item are used for matching comparisons (i.e. fields returned
by PIMItem.getFields()
for the matching item).
Matching is done with the following rules and may be locale dependent:
PIMItem
field matches "Bob" at index 0, index 1, or any
index in that field in another PIMItem
.ATTR_HOME
were specified with
the searched-for value, then values with attributes
ATTR_HOME
or ATTR_HOME|ATTR_MOBILE
(or any
other attributes OR'd with ATTR_HOME
) would satisfy this
attribute matching rule.PIMItem.ATTR_NONE
is an exception to the above rule
such that PIMItem.ATTR_NONE
is an unspecified member of
every attribute set and therefore matches all attribute sets. For
example, if ATTR_NONE
were specified with a searched-for
value of "Bob", then all "Bob" values regardless of its actual assigned
attributes would satisfy this attribute matching rule.ATTR_HOME|ATTR_MOBILE
were specified with the searched-for
value but ATTR_MOBILE
was not supported in the particular
list being searched, then this method would use ATTR_HOME
as the attribute to match for according to the other attribute matching
rules. To avoid this situation in which the attribute sets used may
different than intended, it is recommended to verify the attribute's
validity using PIMList.isSupportedAttribute(int, int)
prior to setting
the attribute in the searched-for PIMItem
.NOTE
field is set to "pho", a positive match occurs in the
strings "Mobile phone" and "THIS IS A PHONE NOTE" as well as the string
"telephone". If an empty string is provided in the matching item (i.e.
String("")), the empty string matches all set values for the field.
matching
- the item whose set fields are used for finding matching
items. This item must have been created using this same
list.
PIMException
- If an error occurs or the list is no longer accessible or
closed.
IllegalArgumentException
- If the item provided did not originate from this list.
NullPointerException
- if matching
is null.
SecurityException
- if the application is not given permission to read the
PIM list or the list is opened WRITE_ONLY
.PIMList.items()
,
PIMList.items(String)
,
PIMList.itemsByCategory(String)
Enumeration items(String matching) throws PIMException
Enumeration
of items with String field data
that contains the matching string argument.
NOTE: this method may not be as optimized as PIMList.items(PIMItem)
so
that method should be used instead of this one if applicable.
Matching is done with the following rules and may be locale dependent:
matching
- a string value to which all set String field values are
compared.
PIMException
- If an error occurs or the list is no longer accessible or
closed.
NullPointerException
- if matching
is null.
SecurityException
- if the application is not given permission to read the
PIM list or the list is opened WRITE_ONLY
.PIMList.items()
,
PIMList.items(PIMItem)
,
PIMList.itemsByCategory(String)
Enumeration itemsByCategory(String category) throws PIMException
Category matching rules:
PIMList.UNCATEGORIZED
returns an
enumeration of all PIM items of the PIM list that have no category
assignments. null
category string is equivalent to the category
string UNCATEGORIZED
. ""
is considered a valid
string parameter for comparison with existing categories, e.g. "" matches
only a category also named "". String.equals()
comparison.
category
- A string category to find matching items with; may be
null
.
PIMException
- If an error occurs or the list is no longer accessible or
closed.
SecurityException
- If the application is not given permission to read the
PIM list or the list is opened WRITE_ONLY
.PIMList.items()
,
PIMList.items(PIMItem)
,
PIMList.items(String)
int maxCategories()
0
(zero) indicates no category support and -1
indicates there is no limit the the number of categories that
this list can have.PIMList.addCategory(String)
,
PIMList.deleteCategory(String, boolean)
,
PIMList.renameCategory(String, String)
,
PIMList.getCategories()
,
PIMList.isCategory(String)
int maxValues(int field)
field
- the field whose maximum number of supported values to
return.
-1
indicates this field supports
having an unlimited number of added values in it, and
0
(zero) indicates the field is not supported by
this list.
IllegalArgumentException
- if the field is not valid for the implementing class.PIMList.getSupportedFields()
,
PIMList.isSupportedField(int)
,
PIMList.getFieldDataType(int)
void renameCategory(String currentCategory, String newCategory) throws PIMException
A string with no characters ("") may or may not be a valid category on a
particular platform. If the string is not a category on a platform, a
PIMException
is thrown when trying to rename a category to
it.
currentCategory
- a String representing the category to rename.newCategory
- a String representing the new category name to use.
PIMException
- If categories are unsupported, an error occurs, the list
is no longer accessible or closed, or the category name
is invalid.
SecurityException
- if the application is not given permission to write to
the PIM list or the list is opened READ_ONLY
.
NullPointerException
- if currentCategory
or
newCategory
is null.PIMList.addCategory(String)
,
PIMList.deleteCategory(String, boolean)
,
PIMList.getCategories()
,
PIMList.isCategory(String)
,
PIMList.maxCategories()
int stringArraySize(int stringArrayField)
stringArrayField
- The field which has a STRING_ARRAY
data
type, as defined by classes implementing the
PIMItem
interface, whose array size to
return.
IllegalArgumentException
- if the field is not valid for the implementing class or
not a string array field.PIMList.isSupportedField(int)
,
PIMList.getFieldDataType(int)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal