src/com/beem/project/beem/provider/Beem.java
changeset 503 93e5d2d9953f
parent 502 3091acfe31f4
child 567 896533b277d5
equal deleted inserted replaced
502:3091acfe31f4 503:93e5d2d9953f
     6 /**
     6 /**
     7  * Convenience definitions for BEEM's providers.
     7  * Convenience definitions for BEEM's providers.
     8  */
     8  */
     9 public final class Beem {
     9 public final class Beem {
    10 
    10 
    11 	/**
    11     /**
    12 	 * Contacts table.
    12      * Contacts table.
    13 	 */
    13      */
    14 	public static final class Contacts implements BaseColumns {
    14     public static final class Contacts implements BaseColumns {
    15 
       
    16 		/**
       
    17 		 * The query used to create the table.
       
    18 		 */
       
    19 		public static final String QUERY_CREATE = "CREATE TABLE " + Beem.CONTACTS_TABLE_NAME + " (" + BaseColumns._ID
       
    20 				+ " INTEGER PRIMARY KEY AUTOINCREMENT," + Contacts.UID + " INTEGER, " + Contacts.JID + " INTEGER,"
       
    21 				+ Contacts.NICKNAME + " TEXT," + Contacts.ALIAS + " TEXT," + Contacts.DATE_CREATED + " INTEGER,"
       
    22 				+ Contacts.DATE_MODIFIED + " INTEGER" + ");";
       
    23 
       
    24 		/**
       
    25 		 * The content:// style URL for Contacts table.
       
    26 		 */
       
    27 		public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/contacts");
       
    28 
       
    29 		/**
       
    30 		 * The MIME type of {@link #CONTENT_URI} providing a directory of
       
    31 		 * contacts.
       
    32 		 */
       
    33 		public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.beem.project.contact";
       
    34 
       
    35 		/**
       
    36 		 * The MIME type of a {@link #CONTENT_URI} sub-directory of a single
       
    37 		 * contact.
       
    38 		 */
       
    39 		public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.beem.project.contact";
       
    40 
       
    41 		/**
       
    42 		 * The default sort order for this table.
       
    43 		 */
       
    44 		public static final String DEFAULT_SORT_ORDER = "nickname ASC";
       
    45 
       
    46 		/**
       
    47 		 * The user id having the contact
       
    48 		 * <P>
       
    49 		 * Type: INTEGER
       
    50 		 * </P>
       
    51 		 * .
       
    52 		 */
       
    53 		public static final String UID = "uid";
       
    54 
       
    55 		/**
       
    56 		 * The JabberID of the contact
       
    57 		 * <P>
       
    58 		 * Type: INTEGER
       
    59 		 * </P>
       
    60 		 * .
       
    61 		 */
       
    62 		public static final String JID = "jid";
       
    63 
       
    64 		/**
       
    65 		 * The nickname of the contact
       
    66 		 * <P>
       
    67 		 * Type: TEXT
       
    68 		 * </P>
       
    69 		 * .
       
    70 		 */
       
    71 		public static final String NICKNAME = "nickname";
       
    72 
       
    73 		/**
       
    74 		 * The alias of the contact
       
    75 		 * <P>
       
    76 		 * Type: TEXT
       
    77 		 * </P>
       
    78 		 * .
       
    79 		 */
       
    80 		public static final String ALIAS = "alias";
       
    81 
       
    82 		/**
       
    83 		 * The timestamp for when the contact was created
       
    84 		 * <P>
       
    85 		 * Type: INTEGER (long from System.curentTimeMillis())
       
    86 		 * </P>
       
    87 		 * .
       
    88 		 */
       
    89 		public static final String DATE_CREATED = "created";
       
    90 
       
    91 		/**
       
    92 		 * The timestamp for when the contact was last modified
       
    93 		 * <P>
       
    94 		 * Type: INTEGER (long from System.curentTimeMillis())
       
    95 		 * </P>
       
    96 		 * .
       
    97 		 */
       
    98 		public static final String DATE_MODIFIED = "modified";
       
    99 
       
   100 	}
       
   101 
    15 
   102 	/**
    16 	/**
   103 	 * Users table.
    17 	 * The query used to create the table.
   104 	 */
    18 	 */
   105 	public static final class Users implements BaseColumns {
    19 	public static final String QUERY_CREATE = "CREATE TABLE " + Beem.CONTACTS_TABLE_NAME + " (" + BaseColumns._ID
   106 
    20 	    + " INTEGER PRIMARY KEY AUTOINCREMENT," + Contacts.UID + " INTEGER, " + Contacts.JID + " INTEGER,"
   107 		/**
    21 	    + Contacts.NICKNAME + " TEXT," + Contacts.ALIAS + " TEXT," + Contacts.DATE_CREATED + " INTEGER,"
   108 		 * The query used to create the table.
    22 	    + Contacts.DATE_MODIFIED + " INTEGER" + ");";
   109 		 */
       
   110 		public static final String QUERY_CREATE = "CREATE TABLE " + Beem.USERS_TABLE_NAME + " (" + BaseColumns._ID
       
   111 				+ " INTEGER PRIMARY KEY AUTOINCREMENT," + Users.JUSERNAME + " TEXT," + Users.DATE_CREATED + " INTEGER,"
       
   112 				+ Users.DATE_MODIFIED + " INTEGER" + ");";
       
   113 
       
   114 		/**
       
   115 		 * The content:// style URL for Contacts table.
       
   116 		 */
       
   117 		public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/users");
       
   118 
       
   119 		/**
       
   120 		 * The MIME type of {@link #CONTENT_URI} providing a directory of users.
       
   121 		 */
       
   122 		public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.beem.project.user";
       
   123 
       
   124 		/**
       
   125 		 * The MIME type of a {@link #CONTENT_URI} sub-directory of a single
       
   126 		 * user.
       
   127 		 */
       
   128 		public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.beem.project.user";
       
   129 
       
   130 		/**
       
   131 		 * The default sort order for this table.
       
   132 		 */
       
   133 		public static final String DEFAULT_SORT_ORDER = "_id ASC";
       
   134 
       
   135 		/**
       
   136 		 * The Jabber username of the user
       
   137 		 * <P>
       
   138 		 * Type: TEXT
       
   139 		 * </P>
       
   140 		 * .
       
   141 		 */
       
   142 		public static final String JUSERNAME = "username";
       
   143 
       
   144 		/**
       
   145 		 * The timestamp for when the user was created
       
   146 		 * <P>
       
   147 		 * Type: INTEGER (long from System.curentTimeMillis())
       
   148 		 * </P>
       
   149 		 * .
       
   150 		 */
       
   151 		public static final String DATE_CREATED = "created";
       
   152 
       
   153 		/**
       
   154 		 * The timestamp for when the user was last modified
       
   155 		 * <P>
       
   156 		 * Type: INTEGER (long from System.curentTimeMillis())
       
   157 		 * </P>
       
   158 		 * .
       
   159 		 */
       
   160 		public static final String DATE_MODIFIED = "modified";
       
   161 	}
       
   162 
    23 
   163 	/**
    24 	/**
   164 	 * AUTHORITY.
    25 	 * The content:// style URL for Contacts table.
   165 	 */
    26 	 */
   166 	public static final String AUTHORITY = "com.beem.project.provider";
    27 	public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/contacts");
   167 
    28 
   168 	/**
    29 	/**
   169 	 * DB Name.
    30 	 * The MIME type of {@link #CONTENT_URI} providing a directory of contacts.
   170 	 */
    31 	 */
   171 	public static final String DB_NAME = "beem.db";
    32 	public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.beem.project.contact";
   172 
    33 
   173 	/**
    34 	/**
   174 	 * DB Version.
    35 	 * The MIME type of a {@link #CONTENT_URI} sub-directory of a single contact.
   175 	 */
    36 	 */
   176 	public static final int DB_VERSION = 2;
    37 	public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.beem.project.contact";
   177 
    38 
   178 	/**
    39 	/**
   179 	 * Name of the users table.
    40 	 * The default sort order for this table.
   180 	 */
    41 	 */
   181 	public static final String USERS_TABLE_NAME = "users";
    42 	public static final String DEFAULT_SORT_ORDER = "nickname ASC";
   182 
    43 
   183 	/**
    44 	/**
   184 	 * Name of the contacts table.
    45 	 * The user id having the contact
       
    46 	 * <P>
       
    47 	 * Type: INTEGER
       
    48 	 * </P>
       
    49 	 * .
   185 	 */
    50 	 */
   186 	public static final String CONTACTS_TABLE_NAME = "contacts";
    51 	public static final String UID = "uid";
   187 
    52 
   188 	/**
    53 	/**
   189 	 * Constructor.
    54 	 * The JabberID of the contact
       
    55 	 * <P>
       
    56 	 * Type: INTEGER
       
    57 	 * </P>
       
    58 	 * .
   190 	 */
    59 	 */
   191 	private Beem() {
    60 	public static final String JID = "jid";
   192 	}
    61 
       
    62 	/**
       
    63 	 * The nickname of the contact
       
    64 	 * <P>
       
    65 	 * Type: TEXT
       
    66 	 * </P>
       
    67 	 * .
       
    68 	 */
       
    69 	public static final String NICKNAME = "nickname";
       
    70 
       
    71 	/**
       
    72 	 * The alias of the contact
       
    73 	 * <P>
       
    74 	 * Type: TEXT
       
    75 	 * </P>
       
    76 	 * .
       
    77 	 */
       
    78 	public static final String ALIAS = "alias";
       
    79 
       
    80 	/**
       
    81 	 * The timestamp for when the contact was created
       
    82 	 * <P>
       
    83 	 * Type: INTEGER (long from System.curentTimeMillis())
       
    84 	 * </P>
       
    85 	 * .
       
    86 	 */
       
    87 	public static final String DATE_CREATED = "created";
       
    88 
       
    89 	/**
       
    90 	 * The timestamp for when the contact was last modified
       
    91 	 * <P>
       
    92 	 * Type: INTEGER (long from System.curentTimeMillis())
       
    93 	 * </P>
       
    94 	 * .
       
    95 	 */
       
    96 	public static final String DATE_MODIFIED = "modified";
       
    97 
       
    98     }
       
    99 
       
   100     /**
       
   101      * Users table.
       
   102      */
       
   103     public static final class Users implements BaseColumns {
       
   104 
       
   105 	/**
       
   106 	 * The query used to create the table.
       
   107 	 */
       
   108 	public static final String QUERY_CREATE = "CREATE TABLE " + Beem.USERS_TABLE_NAME + " (" + BaseColumns._ID
       
   109 	    + " INTEGER PRIMARY KEY AUTOINCREMENT," + Users.JUSERNAME + " TEXT," + Users.DATE_CREATED + " INTEGER,"
       
   110 	    + Users.DATE_MODIFIED + " INTEGER" + ");";
       
   111 
       
   112 	/**
       
   113 	 * The content:// style URL for Contacts table.
       
   114 	 */
       
   115 	public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/users");
       
   116 
       
   117 	/**
       
   118 	 * The MIME type of {@link #CONTENT_URI} providing a directory of users.
       
   119 	 */
       
   120 	public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.beem.project.user";
       
   121 
       
   122 	/**
       
   123 	 * The MIME type of a {@link #CONTENT_URI} sub-directory of a single user.
       
   124 	 */
       
   125 	public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.beem.project.user";
       
   126 
       
   127 	/**
       
   128 	 * The default sort order for this table.
       
   129 	 */
       
   130 	public static final String DEFAULT_SORT_ORDER = "_id ASC";
       
   131 
       
   132 	/**
       
   133 	 * The Jabber username of the user
       
   134 	 * <P>
       
   135 	 * Type: TEXT
       
   136 	 * </P>
       
   137 	 * .
       
   138 	 */
       
   139 	public static final String JUSERNAME = "username";
       
   140 
       
   141 	/**
       
   142 	 * The timestamp for when the user was created
       
   143 	 * <P>
       
   144 	 * Type: INTEGER (long from System.curentTimeMillis())
       
   145 	 * </P>
       
   146 	 * .
       
   147 	 */
       
   148 	public static final String DATE_CREATED = "created";
       
   149 
       
   150 	/**
       
   151 	 * The timestamp for when the user was last modified
       
   152 	 * <P>
       
   153 	 * Type: INTEGER (long from System.curentTimeMillis())
       
   154 	 * </P>
       
   155 	 * .
       
   156 	 */
       
   157 	public static final String DATE_MODIFIED = "modified";
       
   158     }
       
   159 
       
   160     /**
       
   161      * AUTHORITY.
       
   162      */
       
   163     public static final String AUTHORITY = "com.beem.project.provider";
       
   164 
       
   165     /**
       
   166      * DB Name.
       
   167      */
       
   168     public static final String DB_NAME = "beem.db";
       
   169 
       
   170     /**
       
   171      * DB Version.
       
   172      */
       
   173     public static final int DB_VERSION = 2;
       
   174 
       
   175     /**
       
   176      * Name of the users table.
       
   177      */
       
   178     public static final String USERS_TABLE_NAME = "users";
       
   179 
       
   180     /**
       
   181      * Name of the contacts table.
       
   182      */
       
   183     public static final String CONTACTS_TABLE_NAME = "contacts";
       
   184 
       
   185     /**
       
   186      * Constructor.
       
   187      */
       
   188     private Beem() {
       
   189     }
   193 }
   190 }