1 /*
2  * Copyright (C) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "media_app_uri_sensitive_column.h"
17 #include "media_column.h"
18 #include "base_column.h"
19 
20 namespace OHOS {
21 namespace Media {
22 
23 const std::string AppUriSensitiveColumn::ID = "id";
24 const std::string AppUriSensitiveColumn::APP_ID = "appid";
25 const std::string AppUriSensitiveColumn::FILE_ID = "file_id";
26 const std::string AppUriSensitiveColumn::URI_TYPE = "uri_type";
27 const std::string AppUriSensitiveColumn::HIDE_SENSITIVE_TYPE = "sensitive_type";
28 const std::string AppUriSensitiveColumn::DATE_MODIFIED = "date_modified";
29 
30 const int AppUriSensitiveColumn::URI_PHOTO = 1;
31 const int AppUriSensitiveColumn::URI_AUDIO = 2;
32 const std::set<int> AppUriSensitiveColumn::URI_TYPES_ALL = {
33     AppUriSensitiveColumn::URI_PHOTO, AppUriSensitiveColumn::URI_AUDIO};
34 
35 const int AppUriSensitiveColumn::SENSITIVE_ALL_DESENSITIZE = 0;
36 const int AppUriSensitiveColumn::SENSITIVE_GEOGRAPHIC_LOCATION_DESENSITIZE = 1;
37 const int AppUriSensitiveColumn::SENSITIVE_SHOOTING_PARAM_DESENSITIZE = 2;
38 const int AppUriSensitiveColumn::SENSITIVE_NO_DESENSITIZE = 3;
39 const std::set<int> AppUriSensitiveColumn::SENSITIVE_TYPES_ALL = {
40     AppUriSensitiveColumn::SENSITIVE_ALL_DESENSITIZE,
41     AppUriSensitiveColumn::SENSITIVE_GEOGRAPHIC_LOCATION_DESENSITIZE,
42     AppUriSensitiveColumn::SENSITIVE_SHOOTING_PARAM_DESENSITIZE,
43     AppUriSensitiveColumn::SENSITIVE_NO_DESENSITIZE};
44 
45 const std::string AppUriSensitiveColumn::URI_URITYPE_APPID_INDEX = "uri_uritype_appid_index";
46 
47 const std::string AppUriSensitiveColumn::APP_URI_SENSITIVE_TABLE = "UriSensitive";
48 
49 const std::set<std::string> AppUriSensitiveColumn::DEFAULT_FETCH_COLUMNS = {AppUriSensitiveColumn::ID};
50 
51 const std::string AppUriSensitiveColumn::CREATE_APP_URI_SENSITIVE_TABLE =
52     "CREATE TABLE IF NOT EXISTS " + AppUriSensitiveColumn::APP_URI_SENSITIVE_TABLE + "(" +
53     AppUriSensitiveColumn::ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
54     AppUriSensitiveColumn::APP_ID + " TEXT, " + AppUriSensitiveColumn::FILE_ID + " INTEGER, " +
55     AppUriSensitiveColumn::URI_TYPE + " INTEGER, " + AppUriSensitiveColumn::HIDE_SENSITIVE_TYPE + " INTEGER, " +
56     AppUriSensitiveColumn::DATE_MODIFIED + " BIGINT)";
57 
58 const std::string AppUriSensitiveColumn::CREATE_URI_URITYPE_APPID_INDEX = BaseColumn::CreateIndex() +
59     AppUriSensitiveColumn::URI_URITYPE_APPID_INDEX + " ON " +
60     AppUriSensitiveColumn::APP_URI_SENSITIVE_TABLE + " (" +
61     AppUriSensitiveColumn::FILE_ID + " DESC," +
62     AppUriSensitiveColumn::URI_TYPE + "," +
63     AppUriSensitiveColumn::APP_ID + " DESC)";
64 
65 const std::string AppUriSensitiveColumn::DELETE_APP_URI_SENSITIVE_TABLE =
66     "DELETE FROM " + AppUriSensitiveColumn::APP_URI_SENSITIVE_TABLE;
67 
68 const std::set<std::string> AppUriSensitiveColumn::ALL_COLUMNS = {
69     AppUriSensitiveColumn::ID, AppUriSensitiveColumn::APP_ID, AppUriSensitiveColumn::FILE_ID,
70     AppUriSensitiveColumn::URI_TYPE, AppUriSensitiveColumn::HIDE_SENSITIVE_TYPE,
71     AppUriSensitiveColumn::DATE_MODIFIED
72 };
73 } // namespace Media
74 } // namespace OHOS