Methods Summary |
---|
public void | addCategory(java.lang.Object listHandle, java.lang.String category)Adds a category to the categories defined for a list.
if (getCategories(listHandle).length ==
getListMaxCategories0(((List)listHandle).handle)) {
throw new PIMException("Maximum number of categories exceeded",
PIMException.MAX_CATEGORIES_EXCEEDED);
}
if (!addListCategory0(((List)listHandle).handle, category)) {
throw new PIMException("Unable to add category",
PIMException.UPDATE_ERROR);
}
|
private native int | addItem0(int listHandle, byte[] data, java.lang.String categories)Adds item to the list.
|
private native boolean | addListCategory0(int listHandle, java.lang.String category)Adds category to the specified list.
|
public void | closeList(java.lang.Object listHandle)Closes list.
if (!listClose0(((List)listHandle).handle)) {
throw new PIMException();
}
|
private native boolean | commitItemData0(int listHandle, int itemHandle, byte[] data, java.lang.String categories)Writes modified item data to persistent storage.
|
public synchronized java.lang.Object | commitListElement(java.lang.Object listHandle, java.lang.Object elementKey, byte[] element, java.lang.String[] categories)Commit a list element.
Item item = (Item)elementKey;
List list = (List)listHandle;
if (elementKey == null) {
/* Add new item */
int itemHandle = addItem0(list.handle, element, categories == null ?
null : FormatSupport.join(categories, ","));
if (itemHandle == 0) {
throw new PIMException("Unable to add new item");
}
item = new Item(list, itemHandle, element.length, categories);
item.rawData = element;
} else if (element == null) {
/* Remove item */
if (!removeItem0(list.handle, item.handle)) {
throw new PIMException("Unable to delete item");
}
} else {
item.rawData = element;
if (!commitItemData0(list.handle, item.handle,
element, categories == null ?
null : FormatSupport.join(categories, ","))) {
throw new PIMException("Unable to update",
PIMException.UPDATE_ERROR);
}
}
return item;
|
public void | deleteCategory(java.lang.Object listHandle, java.lang.String category)Deletes a category from the categories defined for a list.
if (!deleteListCategory0(((List)listHandle).handle, category)) {
throw new PIMException("Unable to delete category",
PIMException.UPDATE_ERROR);
}
|
private native boolean | deleteListCategory0(int listHandle, java.lang.String category)Removes category from the specified list.
|
public java.lang.String | getArrayElementLabel(java.lang.Object listHandle, int field, int arrayElement)Gets the array element label.
initialize(listHandle);
return getFieldDescriptor(field).getElementlabel(arrayElement);
|
public java.lang.String | getAttributeLabel(java.lang.Object listHandle, int attribute)Gets attribute label for the given field attribute.
initialize(listHandle);
if (attribute == PIMItem.ATTR_NONE) {
String tag = "PIM.Attributes.None";
return Configuration.getPropertyDefault(tag, "Label_" + tag);
}
try {
return ((PIMAttribute)listAttributes.
get(new Integer(attribute))).getLabel();
} catch (NullPointerException npe) {
return null;
}
|
private native void | getAttributes0(int listHandle, PIMAttribute[] attr, int dataHandle)Retrieves information about all attributes supported by the list.
|
private native int | getAttributesCount0(int listHandle, int[] dataHandle)Returns number of attributes supported by the given list.
|
public java.lang.String[] | getCategories(java.lang.Object listHandle)Gets the set of categories defined for a list.
String categories = getListCategories0(((List)listHandle).handle);
return categories != null ? FormatSupport.split(categories, ',", 0) :
new String[0];
|
public byte[] | getDefaultBinaryValue(java.lang.Object listHandle, int field)Gets the default byte[] value for the given field. This will
only
return a valid value if hasDefaultValue(listType, field) returns true.
initialize(listHandle);
return null;
|
public boolean | getDefaultBooleanValue(java.lang.Object listHandle, int field)Gets the default boolean value for the given field. This will
only
return a valid value if hasDefaultValue(listType, field) returns true.
initialize(listHandle);
return false;
|
public long | getDefaultDateValue(java.lang.Object listHandle, int field)Gets the default date value for the given field. This will only
return a valid value if hasDefaultValue(listType, field) returns true.
initialize(listHandle);
return 0;
|
public int | getDefaultIntValue(java.lang.Object listHandle, int field)Gets the default integer value for the given field. This will
only
return a valid value if hasDefaultValue(listType, field) returns true.
initialize(listHandle);
PIMFieldDescriptor descriptor = getFieldDescriptor(field);
return ((Integer) descriptor.getDefaultValue()).intValue();
|
public java.lang.String | getDefaultListName(int listType)Get the name of the default list for the given type.
String propertyName;
if (listType == PIM.CONTACT_LIST) {
propertyName = "DefaultContactList";
} else if (listType == PIM.EVENT_LIST) {
propertyName = "DefaultEventList";
} else if (listType == PIM.TODO_LIST) {
propertyName = "DefaultTodoList";
} else {
return null;
}
return Configuration
.getProperty(propertyName);
|
public java.lang.String[] | getDefaultStringArrayValue(java.lang.Object listHandle, int field)Gets the default String[] value for the given field. This will
only
return a valid value if hasDefaultValue(listType, field) returns true.
int length = getStringArraySize(listHandle, field);
return new String[length];
|
public java.lang.String | getDefaultStringValue(java.lang.Object listHandle, int field)Gets the default string value for the given field. This will
only
return a valid value if hasDefaultValue(listType, field) returns true.
initialize(listHandle);
return null;
|
public int | getFieldDataType(java.lang.Object listHandle, int field)Gets the data type of the field.
initialize(listHandle);
try {
return getFieldDescriptor(field).getDataType();
} catch (NullPointerException npe) {
return -1;
}
|
private PIMFieldDescriptor | getFieldDescriptor(int field)Gets the descriptor for given field.
return (PIMFieldDescriptor)listFields.get(new Integer(field));
|
public java.lang.String | getFieldLabel(java.lang.Object listHandle, int field)Gets the label of the field.
initialize(listHandle);
try {
return getFieldDescriptor(field).getLabel();
} catch (NullPointerException npe) {
return null;
}
|
private native int | getFieldLabelsCount0(int listHandle, int fieldIndex, int dataHandle)Returns number of labels for the specified field.
|
private native void | getFields0(int listHandle, PIMFieldDescriptor[] desc, int dataHandle)Retrieves information about all fields supported by the list.
|
private native int | getFieldsCount0(int listHandle, int[] dataHandle)Returns number of fields supported by the given list.
|
private native java.lang.String | getItemCategories0(int itemHandle, int dataHandle)Retrieves list of categories the specified item belongs to.
|
private native java.lang.String | getListCategories0(int listHandle)Retrieves categories defined for the specified list.
|
public byte[] | getListElement(java.lang.Object listHandle, java.lang.Object elementKey)Get the data for a list element.
return ((Item)elementKey).rawData;
|
public java.lang.String[] | getListElementCategories(java.lang.Object listHandle, java.lang.Object elementKey)Get categories for the specified list element.
return ((Item)elementKey).getCategories();
|
public synchronized java.lang.Object[] | getListKeys(java.lang.Object listHandle)Get list element keys.
Vector keys = new Vector();
int[] itemDesc = new int[4];
int handle = ((List)listHandle).handle;
while (getNextItemDescription0(handle, itemDesc)) {
Item nextItem = new Item((List)listHandle, itemDesc[0],
itemDesc[1]);
getNextItemData0(nextItem.handle, nextItem.rawData, itemDesc[3]);
keys.addElement(nextItem);
String catList = getItemCategories0(nextItem.handle, itemDesc[3]);
if (catList != null) {
nextItem.setCategories(FormatSupport.split(catList, ',", 0));
}
}
Item[] items = new Item[keys.size()];
for (int index = 0; index < items.length; index++) {
items[index] = (Item)keys.elementAt(index);
}
return items;
|
private native int | getListMaxCategories0(int listHandle)Returns maximum number of categories supported for the given list.
|
public synchronized java.lang.String[] | getListNames(int listType)Get the supported list names for the given list type. All list elements
must be unique within the list.
int namesCount = getListNamesCount0(listType);
String[] listNames = new String[namesCount];
if (namesCount != 0) {
getListNames0(listNames);
}
return listNames;
|
private native void | getListNames0(java.lang.String[] names)Retrieves list names for the selected list type.
|
private native int | getListNamesCount0(int listType)Returns number of lists of the specified type.
|
public int | getMaximumValues(java.lang.Object listHandle, int field)Get the maximum number of values that can be stored in the given field.
initialize(listHandle);
return getFieldDescriptor(field).getMaximumValues();
|
private native boolean | getNextItemData0(int itemHandle, byte[] data, int dataHandle)Retrieves next item's data from the list.
|
private native boolean | getNextItemDescription0(int listHandle, int[] description)Retrieves general information about the next item in the list.
|
public int | getStringArraySize(java.lang.Object listHandle, int field)Checks if size of the string array.
initialize(listHandle);
try {
return getFieldDescriptor(field).getStringArraySize();
} catch (NullPointerException e) {
// debug.exception(Debug.LIGHT, e);
return 0;
}
|
public int[] | getSupportedArrayElements(java.lang.Object listHandle, int field)Gets the array of supported elements.
int size = getStringArraySize(listHandle, field);
int[] result = new int[size];
for (int i = 0; i < size; i++) {
result[i] = i;
}
return result;
|
public int[] | getSupportedAttributes(java.lang.Object listHandle, int field)Gets the supported attributes for the given field.
initialize(listHandle);
long attributes = getFieldDescriptor(field).getSupportedAttributes();
int listType = ((List)listHandle).type;
// ATTR_NONE is supported for all Contact fields
int elementCount = listType == PIM.CONTACT_LIST ? 1 : 0;
for (long a = attributes; a > 0; a >>= 1) {
if ((a & 1) == 1) {
elementCount++;
}
}
int[] result = new int[elementCount];
if (elementCount > 0) {
int a = 1;
int i;
if (listType == PIM.CONTACT_LIST) {
result[0] = PIMItem.ATTR_NONE;
i = 1;
} else {
i = 0;
}
for (; i < elementCount; i++) {
while ((attributes & a) == 0) a <<= 1;
result[i] = a;
a <<= 1;
}
}
return result;
|
public int | getSupportedAttributesMask(java.lang.Object listHandle, int field)Gets a mask containing all possible attributes for the given field.
initialize(listHandle);
return (int)getFieldDescriptor(field).getSupportedAttributes();
|
public int[] | getSupportedFields(java.lang.Object listHandle)Gets all fields that are supported in this list. All fields supported by
this list, including both standard and extended, are returned in this
array.
initialize(listHandle);
int[] result = new int[listFields.size()];
Enumeration fieldNumbers = listFields.keys();
for (int i = 0; i < result.length; i++) {
result[i] = ((Integer)fieldNumbers.nextElement()).intValue();
}
return result;
|
public boolean | hasDefaultValue(java.lang.Object listHandle, int field)Checks if field has default value.
initialize(listHandle);
return getFieldDescriptor(field).hasDefaultValue();
|
private synchronized void | initialize(java.lang.Object listHandle)Set up field and attribute descriptions.
if (initialized != listHandle) {
listFields.clear();
listAttributes.clear();
int list = ((List)listHandle).handle;
int [] tmpArray = new int [1];
int numFields = getFieldsCount0(list, tmpArray);
if (numFields <= 0) {
return;
}
PIMFieldDescriptor[] desc = new PIMFieldDescriptor[numFields];
for (int i = 0; i < numFields; i++) {
int numLabels = getFieldLabelsCount0(list, i, tmpArray[0]);
desc[i] = new PIMFieldDescriptor(0, 0, false, null, " ",
new String[numLabels], 0L, 0);
}
getFields0(list, desc, tmpArray[0]);
for (int i = 0; i < numFields; i++) {
listFields.put(new Integer(desc[i].getField()), desc[i]);
}
tmpArray[0] = 0;
int numAttributes = getAttributesCount0(list, tmpArray);
PIMAttribute[] attr = new PIMAttribute[numAttributes];
for (int i = 0; i < numAttributes; i++) {
attr[i] = new PIMAttribute();
}
getAttributes0(list, attr, tmpArray[0]);
for (int i = 0; i < numAttributes; i++) {
listAttributes.put(new Integer(attr[i].getAttr()), attr[i]);
}
initialized = listHandle;
}
|
public boolean | isSupportedArrayElement(java.lang.Object listHandle, int field, int arrayElement)Checks if the array element is supported.
return arrayElement >= 0 &&
arrayElement < getStringArraySize(listHandle, field);
|
public boolean | isSupportedAttribute(java.lang.Object listHandle, int field, int attribute)Checks if attribute is supported.
initialize(listHandle);
if (attribute == PIMItem.ATTR_NONE) {
return true;
} else {
long attributes = getFieldDescriptor(field).
getSupportedAttributes();
return (attributes & attribute) != 0;
}
|
public boolean | isSupportedField(java.lang.Object listHandle, int field)Checks if field is supported in list.
initialize(listHandle);
return getFieldDescriptor(field) != null;
|
private native boolean | listClose0(int listHandle)Closes the specified list.
|
private native int | listOpen0(int listType, java.lang.String listName, int mode)Opens the specified list.
|
public java.lang.Object | openList(int listType, java.lang.String listName, int openMode)Opens list.
int listHandle = listOpen0(listType, listName, openMode);
if (listHandle == 0) {
throw new PIMException("Unable to open list");
}
return new List(listHandle, listType);
|
private native boolean | removeItem0(int listHandle, int itemHandle)Removes specified item from the list.
|
public void | renameCategory(java.lang.Object listHandle, java.lang.String currentCategory, java.lang.String newCategory)Rename a category.
if (!renameListCategory0(((List)listHandle).handle, currentCategory,
newCategory)) {
throw new PIMException("Unable to rename category",
PIMException.UPDATE_ERROR);
}
|
private native boolean | renameListCategory0(int listHandle, java.lang.String currentCategory, java.lang.String newCategory)Renames category supported by the given list.
|