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