1 /*
2  * Copyright (c) 2022 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 FOUNDATION_BUNDLE_FRAMEWORK_SERVICE_INCLUDE_QUICK_FIX_QUICK_FIX_MANAGER_RDB_H
17 #define FOUNDATION_BUNDLE_FRAMEWORK_SERVICE_INCLUDE_QUICK_FIX_QUICK_FIX_MANAGER_RDB_H
18 
19 #include "quick_fix_manager_db_interface.h"
20 #include "rdb_data_manager.h"
21 
22 namespace OHOS {
23 namespace AppExecFwk {
24 class QuickFixManagerRdb final :
25     public IQuickFixManagerDb,
26     public std::enable_shared_from_this<QuickFixManagerRdb> {
27 public:
28     QuickFixManagerRdb();
29     ~QuickFixManagerRdb();
30 
31     bool QueryAllInnerAppQuickFix(std::map<std::string, InnerAppQuickFix> &innerAppQuickFixes) override;
32     bool QueryInnerAppQuickFix(const std::string &bundleName, InnerAppQuickFix &innerAppQuickFix) override;
33     bool SaveInnerAppQuickFix(const InnerAppQuickFix &innerAppQuickFix) override;
34     bool DeleteInnerAppQuickFix(const std::string &bundleName) override;
35 
36 private:
37     bool GetAllDataFromDb(std::map<std::string, InnerAppQuickFix> &innerAppQuickFixes);
38     bool GetDataFromDb(const std::string &bundleName, InnerAppQuickFix &innerAppQuickFix);
39     bool SaveDataToDb(const InnerAppQuickFix &innerAppQuickFix);
40     bool DeleteDataFromDb(const std::string &bundleName);
41 
42     std::shared_ptr<RdbDataManager> rdbDataManager_;
43 };
44 } // namespace AppExecFwk
45 } // namespace OHOS
46 #endif // FOUNDATION_BUNDLE_FRAMEWORK_SERVICE_INCLUDE_QUICK_FIX_QUICK_FIX_MANAGER_RDB_H
47