1 /* 2 * Copyright (c) 2025 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_INSIGHT_INTENT_RDB_STORAGE_MGR_H 17 #define OHOS_INSIGHT_INTENT_RDB_STORAGE_MGR_H 18 19 #include <singleton.h> 20 #include <string> 21 #include "insight_intent_rdb_data_mgr.h" 22 #include "hilog_tag_wrapper.h" 23 #include "extract_insight_intent_profile.h" 24 25 namespace OHOS { 26 namespace AbilityRuntime { 27 class InsightRdbStorageMgr : public std::enable_shared_from_this<InsightRdbStorageMgr> { 28 DECLARE_DELAYED_SINGLETON(InsightRdbStorageMgr) 29 public: 30 int32_t LoadInsightIntentInfos(const int32_t userId, std::vector<ExtractInsightIntentInfo> &totalInfos); 31 int32_t LoadInsightIntentInfoByName(const std::string &bundleName, const int32_t userId, 32 std::vector<ExtractInsightIntentInfo> &totalInfos); 33 int32_t LoadInsightIntentInfo(const std::string &bundleName, const std::string &moduleName, 34 const std::string &intentName, const int32_t userId, ExtractInsightIntentInfo &totalInfo); 35 int32_t SaveStorageInsightIntentData(const std::string &bundleName, const std::string &moduleName, 36 const int32_t userId, ExtractInsightIntentProfileInfoVec &profileInfos); 37 int32_t DeleteStorageInsightIntentData(const std::string &bundleName, 38 const std::string &moduleName, const int32_t userId); 39 int32_t DeleteStorageInsightIntentByUserId(const int32_t userId); 40 41 private: 42 void Transform(std::unordered_map<std::string, std::string> value, 43 std::vector<ExtractInsightIntentInfo> &totalInfos); 44 mutable std::mutex rdbStorePtrMutex_; 45 }; 46 } // namespace AbilityRuntime 47 } // namespace OHOS 48 49 #endif // OHOS_INSIGHT_INTENT_RDB_STORAGE_MGR_H