|
PIM Optional Package 1.0 Final Release |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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 PIMItems contained in the
list.
PIMList maintain categories and fields. 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.
Field Summary | |
static java.lang.String |
UNCATEGORIZED
Constant for the itemsByCategory(java.lang.String) method to indicate to
search for uncategorized items. |
Method Summary | |
void |
addCategory(java.lang.String category)
Adds the provided category to the PIM list. |
void |
close()
Closes the list, releasing any resources for this list. |
void |
deleteCategory(java.lang.String category,
boolean deleteUnassignedItems)
Deletes the indicated category from the PIM list. |
java.lang.String |
getArrayElementLabel(int stringArrayField,
int arrayElement)
Returns a String label associated with the given array element. |
java.lang.String |
getAttributeLabel(int attribute)
Returns a String label associated with the given attribute. |
java.lang.String[] |
getCategories()
Returns the categories defined for the PIM list. |
int |
getFieldDataType(int field)
Returns an int representing the data type of the data associated with the given field. |
java.lang.String |
getFieldLabel(int field)
Returns a String label associated with the given field. |
java.lang.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(java.lang.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. |
java.util.Enumeration |
items()
Return an Enumeration of all items in the list. |
java.util.Enumeration |
items(PIMItem matchingItem)
Return an Enumeration of all items in the list that contain fields that match all of those fields specified in the given matching item. |
java.util.Enumeration |
items(java.lang.String matchingValue)
Return an Enumeration of all items in the list that contain at least one String field data value that matches the string value provided. |
java.util.Enumeration |
itemsByCategory(java.lang.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(java.lang.String currentCategory,
java.lang.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 |
public static final java.lang.String UNCATEGORIZED
itemsByCategory(java.lang.String)
method to indicate to
search for uncategorized items. The value null
is assigned to the
string UNCATEGORIZED
.
Method Detail |
public java.lang.String getName()
public void close() throws PIMException
PIMException
is thrown for any subsequent method invocations for the class instance.
PIMException
- If the list is no longer accessible.public java.util.Enumeration items() throws PIMException
PIMException
- If an error occurs or the list is no longer accessible or closed.
java.lang.SecurityException
- if the application is not given
permission to read the PIM list or the list is opened WRITE_ONLY.public java.util.Enumeration items(PIMItem matchingItem) throws PIMException
PIMItem.getFields()
for the matching item).
Matching is done with the following rules and may be locale dependent:
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 maching 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
isSupportedAttribute(int, int)
prior to setting the attribute in the searched-for PIMItem.matchingItem
- 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.
java.lang.IllegalArgumentException
- If the item provided did not
originate from this list.
java.lang.NullPointerException
- if matching
is null
.
java.lang.SecurityException
- if the application is not given
permission to read the PIM list or the list is opened WRITE_ONLY.public java.util.Enumeration items(java.lang.String matchingValue) throws PIMException
PIMItem.getFields()
for the matching item). NOTE: this
method may not be as optimized as
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:
matchingValue
- 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.
java.lang.NullPointerException
- if matching
is null
.
java.lang.SecurityException
- if the application is not given
permission to read the PIM list or the list is opened WRITE_ONLY.public java.util.Enumeration itemsByCategory(java.lang.String category) throws PIMException
Category matching rules:
UNCATEGORIZED
returns an enumeration of all PIM items of the PIM list that have no category
assignments.
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. PIMException
- If an error occurs or the list is no longer accessible or closed.
java.lang.SecurityException
- If the application is not given
permission to read the PIM list or the list is opened WRITE_ONLY.public java.lang.String[] getCategories() throws PIMException
PIMException
- If an error occurs or the list is no longer accessible or closed.public boolean isCategory(java.lang.String category) throws PIMException
category
- a String representing the category to
query for. java.lang.NullPointerException
- if category
is null
.
PIMException
- If an error occurs or the list is no longer accessible or closed.public void addCategory(java.lang.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 is thrown when trying to add it.
category
- a String representing a category to
add. PIMException
- If categories are unsupported, an error occurs, or the list is no longer
accessible or closed. Also returned if the max number of categories for this
list is exceeded, or if the category name is invalid.
java.lang.SecurityException
- if the application is not given
permission to write to the PIM list or the list is opened READ_ONLY.
java.lang.NullPointerException
- if category
is null
.public void deleteCategory(java.lang.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 category.deleteUnassignedItems
- boolean flag where true indicates to delete items that no longer have any
categories assigned to them as a result of this method, and where false
indicates that 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.
java.lang.SecurityException
- if the application is not given
permission to write to the PIM list or the list is opened READ_ONLY.
java.lang.NullPointerException
- if category
is null
.public void renameCategory(java.lang.String currentCategory, java.lang.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
- String representing the
current category name.newCategory
- 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.
java.lang.SecurityException
- if the application is not given
permission to write to the PIM list or the list is opened READ_ONLY.
java.lang.NullPointerException
- if currentCategory
or
newCategory
is null
.public int maxCategories()
public boolean isSupportedField(int field)
field
- The field to check, as defined by in the
class implementing the PIMItem. public int[] getSupportedFields()
public boolean isSupportedAttribute(int field, int attribute)
field
- The field against which the attribute is
checked.attribute
- The single attribute to check public int[] getSupportedAttributes(int field)
field
- the field to check java.lang.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.public 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. public int[] getSupportedArrayElements(int stringArrayField)
stringArrayField
- the field to check java.lang.IllegalArgumentException
- if field is not a valid
StringArray 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.public int getFieldDataType(int field)
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. java.lang.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.public java.lang.String getFieldLabel(int field)
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. java.lang.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.public java.lang.String getAttributeLabel(int attribute)
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. java.lang.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.public java.lang.String getArrayElementLabel(int stringArrayField, int arrayElement)
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.arrayElement
- The element in the array, as defined in
the classes implementing the PIMItem interface. java.lang.IllegalArgumentException
- if the array element or the
field is not valid for the implementing class. IllegalArgumentException takes
precedence over UnsupportedFieldException when checking the provided
parameters.
UnsupportedFieldException
- if the field or array element is not supported in the implementing instance
of the class.public int maxValues(int field)
field
- The field to check for multiple value
support. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class.public int stringArraySize(int stringArrayField)
stringArrayField
- The string array field for
which its array size is returned. java.lang.IllegalArgumentException
- if the field is not valid for
the implementing class or not a string array field.
|
Final Release Rev. 1.00 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |