FileDocCategorySizeDatePackage
VToDoSupport.javaAPI DocphoneME MR2 API (J2ME)4786Wed May 02 18:00:28 BST 2007com.sun.kvem.midp.pim.formats

VToDoSupport

public class VToDoSupport extends Object
Helper methods for vToDo implementations.

Fields Summary
Constructors Summary
Methods Summary
public static intgetClassCode(java.lang.String s)
Gets the value of the ToDo.CLASS field for the given value of the vToDo CLASS property. This method encapsulates the following mapping: ToDo.CLASS_PUBLIC <- "PUBLIC" ToDo.CLASS_PRIVATE <- "PRIVATE" ToDo.CLASS_CONFIDENTIAL <- "CONFIDENTIAL"

param
s the value of the CLASS property
return
the corresponding field of ToDo, or -1 if s is not recognized

        switch (s.length()) {
            case 6:
                if (s.equals("PUBLIC")) {
                    return ToDo.CLASS_PUBLIC;
                }
                break;
            case 7:
                if (s.equals("PRIVATE")) {
                    return ToDo.CLASS_PRIVATE;
                }
                break;
            case 12:
                if (s.equals("CONFIDENTIAL")) {
                    return ToDo.CLASS_CONFIDENTIAL;
                }
                break;
        }
        return -1;
    
public static java.lang.StringgetClassType(int fieldValue)
Gets the value of the vToDo CLASS field for the given value of the ToDo.CLASS field. This method encapsulates the following mapping: ToDo.CLASS_PUBLIC -> "PUBLIC" ToDo.CLASS_PRIVATE -> "PRIVATE" ToDo.CLASS_CONFIDENTIAL -> "CONFIDENTIAL"

param
fieldValue the value of the ToDo.CLASS field
return
a string describing the class for the field value, or null if fieldValue is out of range

        switch (fieldValue) {
            case ToDo.CLASS_CONFIDENTIAL: return "CONFIDENTIAL";
            case ToDo.CLASS_PRIVATE: return "PRIVATE";
            case ToDo.CLASS_PUBLIC: return "PUBLIC";
        }
        return null;
    
public static intgetFieldCode(java.lang.String fieldName)
Converts a vToDo property name to a JSR75 field code.

param
fieldName label of requested field
return
identifier of requested field

        if (fieldName.equals("DESCRIPTION"))
            return ToDo.NOTE;
        else if (fieldName.equals("LAST-MODIFIED"))
            return ToDo.REVISION;
        else if (fieldName.equals("SUMMARY"))
            return ToDo.SUMMARY;
        else if (fieldName.equals("UID"))
            return ToDo.UID;
        else if (fieldName.equals("PRIORITY"))
            return ToDo.PRIORITY;
        else if (fieldName.equals("DESCRIPTION"))
            return ToDo.NOTE;
        else if (fieldName.equals("COMPLETED"))
            return ToDo.COMPLETION_DATE;
        else if (fieldName.equals("STATUS"))
            return ToDo.COMPLETED;
        else if (fieldName.equals("DUE"))
            return ToDo.DUE;
        else if (fieldName.equals("CLASS"))
            return ToDo.CLASS;
        else return -1;
    
public static java.lang.StringgetFieldLabel(int field)
Converts a JSR75 field code to a vToDo property name.

param
field identifier of requested field
return
label for requested field

        switch (field) {
            case ToDo.COMPLETED: return "STATUS";
            case ToDo.COMPLETION_DATE: return "COMPLETED";
            case ToDo.PRIORITY: return "PRIORITY";
            case ToDo.DUE: return "DUE";
            case ToDo.NOTE: return "DESCRIPTION";
            case ToDo.REVISION: return "LAST-MODIFIED";
            case ToDo.SUMMARY: return "SUMMARY";
            case ToDo.UID: return "UID";
            case ToDo.CLASS: return "CLASS";
            default:
                return null;
        }