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 #ifndef OHOS_MEDIALIBRARY_URI_SENSITIVE_OPERATIONS_H
17 #define OHOS_MEDIALIBRARY_URI_SENSITIVE_OPERATIONS_H
18 
19 #include <vector>
20 #include <string>
21 
22 #include "datashare_values_bucket.h"
23 #include "medialibrary_command.h"
24 #include "values_bucket.h"
25 #include "rdb_predicates.h"
26 #include "medialibrary_rdb_transaction.h"
27 
28 namespace OHOS {
29 namespace Media {
30 #define EXPORT __attribute__ ((visibility ("default")))
31 using namespace OHOS::DataShare;
32 class UriSensitiveOperations {
33 public:
34     EXPORT static int32_t UpdateOperation(MediaLibraryCommand &cmd,
35         NativeRdb::RdbPredicates &rdbPredicate, std::shared_ptr<TransactionOperations> trans = nullptr);
36     EXPORT static int32_t InsertOperation(MediaLibraryCommand &cmd);
37     EXPORT static int32_t BatchInsertOperation(MediaLibraryCommand &cmd,
38         const std::vector<NativeRdb::ValuesBucket> &values,
39         std::shared_ptr<TransactionOperations> trans = nullptr);
40     EXPORT static int32_t DeleteOperation(MediaLibraryCommand &cmd);
41     EXPORT static int32_t GrantUriSensitive(MediaLibraryCommand &cmd,
42         const std::vector<DataShareValuesBucket> &values);
43     EXPORT static void DeleteAllSensitiveAsync();
44     EXPORT static int32_t QuerySensitiveType(const std::string &appId,
45         const std::string &fileId);
46     EXPORT static std::string QueryAppId(const std::string &fileId);
47 };
48 } // Media
49 } // OHOS
50 #endif // OHOS_MEDIALIBRARY_URI_SENSITIVE_OPERATIONS_H