summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers/partnerbookmarks/PartnerBookmarksContract.java
blob: 2b860628463521992c1284f45a5fb1f8ce5656db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.providers.partnerbookmarks;

import android.content.ContentUris;
import android.net.Uri;

/**
 * <p>
 * The contract between the partner bookmarks provider and applications.
 * Contains the definition for the supported URIs and columns.
 * </p>
 * <p>
 * Authority URI: content://com.android.partnerbookmarks
 * </p>
 * <p>
 * Partner bookmarks URI: content://com.android.partnerbookmarks/bookmarks
 * </p>
 * <p>
 * If the provider is found, and the set of bookmarks is non-empty, exactly one
 * top-level folder with “parent” set to {@link #BOOKMARK_PARENT_ROOT_ID}
 * shall be provided; more than one bookmark with “parent” set to
 * {@link #BOOKMARK_PARENT_ROOT_ID} will cause the import to fail.
 * </p>
 */
public class PartnerBookmarksContract {
    /** The authority for the partner bookmarks provider */
    public static final String AUTHORITY = "com.android.partnerbookmarks";

    /** A content:// style uri to the authority for the partner bookmarks provider */
    public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);

    /**
     * A parameter for use when querying any table that allows specifying
     * a limit on the number of rows returned.
     */
    public static final String PARAM_LIMIT = "limit";

    /**
     * A parameter for use when querying any table that allows specifying
     * grouping of the rows returned.
     */
    public static final String PARAM_GROUP_BY = "groupBy";

    /**
     * The bookmarks table, which holds the partner bookmarks.
     */
    public static final class Bookmarks {
        /**
         * This utility class cannot be instantiated.
         */
        private Bookmarks() {}

        /**
         * The content:// style URI for this table
         */
        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "bookmarks");

        /**
         * The content:// style URI for the root partner bookmarks folder
         */
        public static final Uri CONTENT_URI_PARTNER_BOOKMARKS_FOLDER =
                Uri.withAppendedPath(CONTENT_URI, "folder");

        /**
         * Builds a URI that points to a specific folder.
         * @param folderId the ID of the folder to point to
         */
        public static final Uri buildFolderUri(long folderId) {
            return ContentUris.withAppendedId(CONTENT_URI_PARTNER_BOOKMARKS_FOLDER, folderId);
        }

        /**
         * The MIME type of {@link #CONTENT_URI} providing a directory of bookmarks.
         */
        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/partnerbookmark";

        /**
         * The MIME type of a {@link #CONTENT_URI} of a single bookmark.
         */
        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/partnerbookmark";

        /**
         * Used in {@link #TYPE} column and indicates the row is a bookmark.
         */
        public static final int BOOKMARK_TYPE_BOOKMARK = 1;

        /**
         * Used in {@link #TYPE} column and indicates the row is a folder.
         */
        public static final int BOOKMARK_TYPE_FOLDER = 2;

        /**
         * Used in {@link #PARENT} column and indicates the row doesn't have a parent.
         */
        public static final int BOOKMARK_PARENT_ROOT_ID = 0;

        /**
         * The type of the item.
         * <p>Type: INTEGER</p>
         * <p>Allowed values are:</p>
         * <p>
         * <ul>
         * <li>{@link #BOOKMARK_TYPE_BOOKMARK}</li>
         * <li>{@link #BOOKMARK_TYPE_FOLDER}</li>
         * </ul>
         * </p>
         */
        public static final String TYPE = "type";

        /**
         * The unique ID for a row.  Cannot be BOOKMARK_PARENT_ROOT_ID.
         * <p>Type: INTEGER (long)</p>
         */
        public static final String ID = "_id";

        /**
         * This column is valid when the row is not a folder.
         * <p>Type: TEXT (URL)</p>
         */
        public static final String URL = "url";

        /**
         * The user visible title.
         * <p>Type: TEXT</p>
         */
        public static final String TITLE = "title";

        /**
         * The favicon of the bookmark, may be NULL.
         * Must decode via {@link BitmapFactory#decodeByteArray}.
         * <p>Type: BLOB (image)</p>
         */
        public static final String FAVICON = "favicon";

        /**
         * The touch icon for the web page, may be NULL.
         * Must decode via {@link BitmapFactory#decodeByteArray}.
         * <p>Type: BLOB (image)</p>
         */
        public static final String TOUCHICON = "touchicon";

        /**
         * The ID of the parent folder. BOOKMARK_PARENT_ROOT_ID is the root folder.
         * <p>Type: INTEGER (long) (reference to item in the same table)</p>
         */
        public static final String PARENT = "parent";
    }
}