• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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_APPEXECFWK_SERVICES_FORMMGR_INCLUDE_FORM_CONFIG_INFO_H
17 #define FOUNDATION_APPEXECFWK_SERVICES_FORMMGR_INCLUDE_FORM_CONFIG_INFO_H
18 
19 #include <stdint.h>
20 #include <string>
21 #include <vector>
22 #include <unordered_map>
23 #include "form_info_base.h"
24 #include "form_record.h"
25 
26 namespace OHOS {
27 namespace AppExecFwk {
28 class FormItemInfo {
29 public:
30     /**
31      * @brief Get formId_.
32      * @return formId_.
33      */
34     int64_t GetFormId() const;
35     /**
36      * @brief Set value of formId_.
37      * @param formId Form Id.
38      */
39     void SetFormId(int64_t formId);
40     /**
41      * @brief Get packageName_.
42      * @return packageName_.
43      */
44     std::string GetPackageName() const;
45     /**
46      * @brief Set value of packageName_.
47      * @param packageName Package name.
48      */
49     void SetPackageName(const std::string &packageName);
50     /**
51      * @brief Get providerBundleName_.
52      * @return providerBundleName_.
53      */
54     std::string GetProviderBundleName() const;
55     /**
56      * @brief Set value of providerBundleName_.
57      * @param providerBundleName Provider bundle Name.
58      */
59     void SetProviderBundleName(const std::string &providerBundleName_);
60     /**
61      * @brief Get hostBundleName_.
62      * @return hostBundleName_.
63      */
64     std::string GetHostBundleName() const;
65     /**
66      * @brief Set value of hostBundleName_.
67      * @param hostBundleName_ Host bundle Name.
68      */
69     void SetHostBundleName(const std::string &hostBundleName_);
70     /**
71      * @brief Get moduleName_.
72      * @return moduleName_.
73      */
74     std::string GetModuleName() const;
75     /**
76      * @brief Set value of moduleName_.
77      * @param moduleName Module Name.
78      */
79     void SetModuleName(const std::string &moduleName);
80     /**
81      * @brief Get abilityName_.
82      * @return abilityName_.
83      */
84     std::string GetAbilityName() const;
85     /**
86      * @brief Set value of abilityName_.
87      * @param abilityName Ability name.
88      */
89     void SetAbilityName(const std::string &abilityName);
90     /**
91      * @brief Get formName_.
92      * @return formName_.
93      */
94     std::string GetFormName() const;
95     /**
96      * @brief Set value of formName_.
97      * @param formName Form name.
98      */
99     void SetFormName(const std::string &formName);
100     /**
101      * @brief Get jsComponentName_.
102      * @return jsComponentName_.
103      */
104     std::string GetJsComponentName() const;
105     /**
106      * @brief Set value of jsComponentName_.
107      * @param jsComponentName Js component name.
108      */
109     void SetJsComponentName(const std::string &jsComponentName);
110     /**
111      * @brief Get abilityModuleName_.
112      * @return abilityModuleName_.
113      */
114     std::string GetAbilityModuleName() const;
115     /**
116      * @brief Set value of abilityModuleName_.
117      * @param abilityModuleName ability module name_.
118      */
119     void SetAbilityModuleName(const std::string &abilityModuleName);
120     /**
121      * @brief Get specificationId_.
122      * @return specificationId_.
123      */
124     int GetSpecificationId() const;
125     /**
126      * @brief Set value of specificationId_.
127      * @param specificationId Specification id.
128      */
129     void SetSpecificationId(const int specificationId);
130 
131     /**
132      * @brief Obtains the updageFlag.
133      * @return Returns updageFlag.
134      */
135     bool IsEnableUpdateFlag() const;
136     /**
137      * @brief Set value of updateFlag_.
138      * @param IsEnableUpdateFlag Enable update flag or not.
139      */
140     void SetEnableUpdateFlag(bool IsEnableUpdateFlag);
141     /**
142      * @brief Get updateDuration_.
143      * @return updateDuration_.
144      */
145     int GetUpdateDuration() const;
146     /**
147      * @brief Set value of updateDuration_.
148      * @param updateDuration Update duration.
149      */
150     void SetUpdateDuration(int updateDuration);
151     /**
152      * @brief Get scheduledUpdateTime_.
153      * @return scheduledUpdateTime_.
154      */
155     std::string GetScheduledUpdateTime() const;
156     /**
157      * @brief Set value of scheduledUpdateTime_.
158      * @param scheduledUpdateTime Scheduled update time.
159      */
160     void SetScheduledUpdateTime(const std::string &scheduledUpdateTime);
161     /**
162      * @brief Get hapSourceDirs_.
163      * @param dirs Hap source dirs.
164      * @return Returns true on success, false on failure.
165      */
166     bool GetHapSourceDirs(std::vector<std::string> &dirs) const;
167     /**
168      * @brief Add hap source dir.
169      * @param hapSourceDir Hap source dir.
170      */
171     void AddHapSourceDirs(const std::string &hapSourceDir);
172     /**
173      * @brief Set value of hapSourceDirs_.
174      * @param hapSourceDirs Hap source dirs.
175      */
176     void SetHapSourceDirs(const std::vector<std::string> &hapSourceDirs);
177     /**
178      * @brief Obtains the temporaryFlag.
179      * @return Returns temporaryFlag.
180      */
181     bool IsTemporaryForm() const;
182     /**
183      * @brief Set value of temporaryFlag_.
184      * @param temporaryFlag Temporary flag.
185      */
186     void SetTemporaryFlag(bool temporaryFlag);
187     /**
188      * @brief Obtains the hap source by ability module name.
189      * @param moduleName ability module name
190      * @return Returns hap source.
191      */
192     std::string GetHapSourceByModuleName(const std::string &moduleName) const;
193     /**
194      * @brief Add module info.
195      * @param moduleName Module name.
196      * @param moduleSourceDir Module source dir.
197      */
198     void AddModuleInfo(const std::string &moduleName, const std::string &moduleSourceDir);
199     /**
200      * @brief Check if item valid or not.
201      * @return Valid or not
202      */
203     bool IsValidItem() const;
204     /**
205      * @brief Check if item match or not.
206      * @return Match or not
207      */
208     bool IsMatch(const FormRecord &record) const;
209     /**
210      * @brief Check if form config same or not.
211      * @return Same or not
212      */
213     bool IsSameFormConfig(const FormRecord &record) const;
214     /**
215      * @brief Check if visible notify or not.
216      * @return visible notify or not
217      */
218     bool IsFormVisibleNotify() const;
219     /**
220      * @brief Set value of formVisibleNotify_.
221      * @param isFormVisibleNotify visible notify or not.
222      */
223     void SetFormVisibleNotify(bool isFormVisibleNotify);
224     /**
225      * @brief Get formSrc_.
226      * @return formSrc_.
227      */
228     std::string GetFormSrc() const;
229     /**
230      * @brief Set value of formSrc_.
231      * @param formSrc form src.
232      */
233     void SetFormSrc(const std::string &formSrc);
234     /**
235      * @brief Get formWindow_.
236      * @return formWindow_.
237      */
238     FormWindow GetFormWindow() const;
239     /**
240      * @brief Set value of formWindow_.
241      * @param formWindow form window.
242      */
243     void SetFormWindow(const FormWindow &formWindow);
244     /**
245      * @brief Get versionCode_.
246      * @return versionCode_.
247      */
248     uint32_t GetVersionCode() const;
249     /**
250      * @brief Set value of versionCode_.
251      * @param versionCode bundle version code.
252      */
253     void SetVersionCode(const uint32_t versionCode);
254     /**
255      * @brief Get versionName_.
256      * @return versionName_.
257      */
258     std::string GetVersionName() const;
259     /**
260      * @brief Set value of versionName_.
261      * @param versionName bundle version name.
262      */
263     void SetVersionName(const std::string &versionName);
264     /**
265      * @brief Get compatibleVersion_.
266      * @return compatibleVersion_.
267      */
268     uint32_t GetCompatibleVersion() const;
269     /**
270      * @brief Set value of compatibleVersion_.
271      * @param compatibleVersion API compatible version.
272      */
273     void SetCompatibleVersion(const uint32_t &compatibleVersion);
274     /**
275      * @brief Get icon_.
276      * @return icon_.
277      */
278     std::string GetIcon() const;
279     /**
280      * @brief Set value of icon_.
281      * @param icon ability icon.
282      */
283     void SetIcon(const std::string &icon);
284     /**
285      * @brief Get deviceId_.
286      * @return deviceId_.
287      */
288     std::string GetDeviceId();
289     /**
290      * @brief Set value of  deviceId_.
291      * @param deviceId.
292      */
293     void SetDeviceId(const std::string &deviceId);
294 private:
295     /**
296      * @brief Equal or not.
297      * @param left left string.
298      * @param right right string.
299      * @return Equal or not
300      */
301     bool IsEqual(const std::string &left, const std::string &right);
302 
303 private:
304     int64_t formId_ = -1;
305     std::string packageName_ = "";
306     std::string providerBundleName_ = "";
307     std::string hostBundleName_ = "";
308     std::string moduleName_ = "";
309     std::string abilityName_ = "";
310     std::string formName_ = "";
311     int32_t specificationId_ = 0;
312     bool updateFlag_ = false;
313     int32_t updateDuration_ = 0;
314     std::string scheduledUpdateTime_ = "";
315     std::vector<std::string> hapSourceDirs_;
316     bool temporaryFlag_ = false;
317     bool formVisibleNotify_ = false;
318     std::string formSrc_ = "";
319     FormWindow formWindow_;
320     uint32_t versionCode_ = 0;
321     std::string versionName_ = "";
322     uint32_t compatibleVersion_ = 0;
323     std::string icon_ = "";
324 
325     std::string jsComponentName_ = "";
326     std::string abilityModuleName_ = "";
327     std::unordered_map<std::string, std::string> moduleInfoMap_;
328     std::string deviceId_ = "";
329 };
330 } // namespace AppExecFwk
331 } // namespace OHOS
332 
333 #endif // FOUNDATION_APPEXECFWK_SERVICES_FORMMGR_INCLUDE_FORM_CONFIG_INFO_H
334