1 /* 2 * Copyright (C) 2023 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 MEDIALIBRARY_FORMMAP_OPERATIONS_H 17 #define MEDIALIBRARY_FORMMAP_OPERATIONS_H 18 19 #include <memory> 20 #include <shared_mutex> 21 #include <string> 22 #include <vector> 23 #include <mutex> 24 25 #include "abs_shared_result_set.h" 26 #include "file_asset.h" 27 #include "medialibrary_asset_operations.h" 28 #include "medialibrary_command.h" 29 #include "rdb_predicates.h" 30 31 namespace OHOS { 32 namespace Media { 33 #define EXPORT __attribute__ ((visibility ("default"))) 34 using namespace OHOS::NativeRdb; 35 class MediaLibraryFormMapOperations : public MediaLibraryAssetOperations { 36 public: 37 EXPORT static int32_t RemoveFormIdOperations(RdbPredicates &predicates); 38 EXPORT static int32_t HandleStoreFormIdOperation(MediaLibraryCommand &cmd); 39 EXPORT static void PublishedChange(const std::string newUri, const std::vector<int64_t> &formIds, 40 const bool &isSave); 41 EXPORT static void GetFormMapFormId(const std::string &uri, std::vector<int64_t> &formIds); 42 EXPORT static std::string GetUriByFileId(const int32_t &fileId, const std::string &path); 43 EXPORT static std::string GetFilePathById(const std::string &fileId); 44 45 private: 46 EXPORT static void ModifyFormMapMessage(const std::string &uri, const int64_t &formId, const bool &isSave); 47 EXPORT static bool CheckQueryIsInDb(const OperationObject &operationObject, const std::string &queryId); 48 EXPORT static std::mutex mutex_; 49 }; 50 } // namespace Media 51 } // namespace OHOS 52 #endif // MEDIALIBRARY_FORMMAP_OPERATIONS_H