Tizen 2.0 Release
[apps/osp/Internet.git] / inc / IntBookmarkPresentationModel.h
1 //
2
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 //!Internet
19 /*@file: IntBookmarkPresentationModel.h
20  *@brief: This is the header file for BookmarkPresentationModel class
21  */
22
23 #ifndef _INT_BOOKMARK_PRESENTATION_MODEL_H
24 #define _INT_BOOKMARK_PRESENTATION_MODEL_H
25
26 #include <FAppApp.h>
27 #include <FBase.h>
28 #include <FIo.h>
29
30 #include "IntBookmarkData.h"
31 #include "IntPresentationModelBase.h"
32 #include "IntTypes.h"
33
34 /**
35  * @class BookmarkPresentationModel
36  * @brief This class declares functions which will manage database
37  */
38 class BookmarkPresentationModel
39 :public PresentationModelBase
40  {
41 public:
42         /**
43          * @brief               The method used to get the already created instance of the FaviconManager
44          */
45         static BookmarkPresentationModel* GetInstance(void);
46         /**
47          * This function deletes the bookmark from the bookmark table
48          *
49          * @return      An error code
50          * @param               bookmarkId              The bookmarkId
51          * @exception   E_SUCCESS               The bookmark is successfully deleted
52          * @exception   E_FAILURE               The bookmark deletion is unsuccessful
53          */
54         result DeleteBookmark(int bookmarkId);
55
56         /**
57          * This function deletes the bookmark from the bookmark table
58          *
59          * @return      An error code
60          * @param               url                 URL of the bookmark
61          * @exception   E_SUCCESS               The bookmark is successfully deleted
62          * @exception   E_FAILURE               The bookmark deletion is unsuccessful
63          */
64         result DeleteBookmark(const Tizen::Base::String& url);
65
66         /**
67          * This function deletes the bookmark from the bookmark table
68          *
69          * @return      An error code
70          * @param               folderId                The folderID
71          * @exception   E_SUCCESS               The bookmark is successfully deleted
72          * @exception   E_FAILURE               The bookmark deletion is unsuccessful
73          */
74         result DeleteBookmarkByFolderId(int folderId);
75
76         /**
77          * This function deletes the folder from the folder table
78          *
79          * @return      An error code
80          * @param               bookmarkId              The folderId
81          * @exception   E_SUCCESS               The folder is successfully deleted
82          * @exception   E_FAILURE               The folder deletion is unsuccessful
83          */
84         result DeleteFolder(int folderId);
85
86
87         /**
88          * This function checks whether the Bookmark with given URl already exists or not
89          *
90          * @return      An error code
91          * @param               URl
92          * @exception   E_SUCCESS               The method is successful
93          * @exception   E_FAILURE               The method is not successful as the list is not being created
94          * @remarks             To check whether the Bookmark with given URl already exists or not
95          */
96         result DoesBookmarkExist(const Tizen::Base::String& Url, bool &exist, const Tizen::Base::String& parentId = L"-1", bool checkParentId = false);
97         /**
98          * This function selects the bookmarks from the table
99          *
100          * @return      An error code
101          * @param               parentID                parentId for bookmark : Folder or URL
102          * @param               startIndex              the OFFSET value
103          * @param               limit                   The LIMIT till which the select statement will be executed
104          * @param               bookmarkList    The arraylist where the selected bookmarks will be saved
105          */
106         result GetBookmark(const Tizen::Base::String& parentID, const int startIndex, const int limit, Tizen::Base::Collection::ArrayList& bookmarkList);
107
108
109         /**
110          * This function returns the no of bookmarks
111          *
112          * @return      An error code
113          * @param               parentID                Folder or URL
114          */
115         result GetBookmarkCount(const Tizen::Base::String& parentID, int& count);
116
117         /**
118          * This function selects the bookmark folders  from the table
119          *
120          * @return      An error code
121          * @param               parentID                parentId for bookmark : Folder or URL
122          * @param               startIndex              the OFFSET value
123          * @param               limit                   The LIMIT till which the select statement will be executed
124          * @param               bookmarkList    The arraylist where the selected bookmarks will be saved
125          */
126         result GetFolder(const Tizen::Base::String& parentID, int startIndex,int limit, Tizen::Base::Collection::ArrayList& bookmarkList);
127
128
129         /**
130          * This function returns the no of bookmark folders
131          *
132          * @return      An error code
133          * @param               parentID                Folder or URL
134          */
135         result GetFolderBookmarkCount(const Tizen::Base::String& parentID, int& Count);
136
137         /**
138          * This function selects the bookmark folders from the table
139          *
140          * @return      An error code
141          * @param               parentID                parentId for bookmark : Folder or URL
142          * @param               startIndex              the OFFSET value
143          * @param               limit                   The LIMIT till which the select statement will be executed
144          * @param               bookmarkList    The arraylist where the selected bookmarks will be saved
145          */
146         result GetFoldersBookmarks(const Tizen::Base::String& parentID, const int startIndex, const int limit, Tizen::Base::Collection::ArrayList& bookmarkList);
147
148         /**
149          * This function returns the no of bookmark folders.
150          *
151          * @return      An error code
152          * @param               parentID                Folder or URL
153          */
154         result GetFolderCount(const Tizen::Base::String& parentID, int& count);
155
156         /**
157          * This function selects the searched bookmarks from the table
158          *
159          * @return      An error code
160          * @param               startIndex              the OFFSET value
161          * @param               limit                   The LIMIT till which the select statement will be executed
162          * @param               BookmarkList            The arraylist where the selected searched bookmarks will be saved
163          */
164         result GetSearchBookmark(int startIndex,int limit, Tizen::Base::Collection::ArrayList& BookmarkList, Tizen::Base::String& text);
165
166
167         /**
168          * This function returns the no of searched Bookmarks
169          *
170          * @return      An error code
171          * @param               count                   The no of matching bookmarks will be returned in count.
172          */
173         result GetSearchBookmarkCount(int& count, Tizen::Base::String& text);
174
175         /**
176          * This function selects the searched folders from the table
177          *
178          * @return      An error code
179          * @param               startIndex              the OFFSET value
180          * @param               limit                   The LIMIT till which the select statement will be executed
181          * @param               FolderList              The arraylist where the selected searched folders will be saved
182          */
183         result GetSearchFolder(int startIndex,int limit, Tizen::Base::Collection::ArrayList& FolderList, Tizen::Base::String& text);
184
185         /**
186          * This function returns the no of searched Bookmarks and Folders
187          *
188          * @return      An error code
189          * @param               count                   The no of matching bookmarks and folders will be returned in count.
190          */
191         result GetSearchFolderBookmarkCount(int& count, Tizen::Base::String& text);
192
193         /**
194          * This function returns the no of searched Folders
195          *
196          * @return      An error code
197          * @param               count                   The no of matching Folders will be returned in count.
198          */
199         result GetSearchFolderCount(int& count, Tizen::Base::String& text);
200
201         /**
202          * This function selects the searched bookmark folders from the table
203          *
204          * @return      An error code
205          * @param               startIndex              the OFFSET value
206          * @param               limit                   The LIMIT till which the select statement will be executed
207          * @param               BookmarkList            The arraylist where the selected searched bookmarks will be saved
208          */
209         result GetSearchFoldersBookmarks(int startIndex,int limit, Tizen::Base::Collection::ArrayList& BookmarkList, Tizen::Base::String& text);
210
211         /**
212          * This function adds the folder to the folder table
213          *
214          * @return      An error code
215          * @param               bookmark                The folder
216          * @exception   E_SUCCESS               The folder is inserted successfully to the table
217          * @exception   E_FAILURE               The folder is not inserted successfully
218          */
219         result SaveFolder(BookmarkData& bookmark);
220
221         /**
222          * This function adds the bookmarks to the bookmark table
223          *
224          * @return      An error code
225          * @param               bookmark                The bookmark
226          * @exception   E_SUCCESS               The bookmark is inserted successfully to the table
227          * @exception   E_FAILURE               The bookmark is not inserted successfully
228          */
229         result SaveBookmark(BookmarkData& bookmark);
230
231 private:
232         /**
233          * @brief The Default Constructor
234          */
235         BookmarkPresentationModel(void);
236
237         /**
238         * @brief                The Default Destructor
239         */
240         ~BookmarkPresentationModel(void);
241
242         /**
243          * copy constructor
244          */
245         BookmarkPresentationModel(const BookmarkPresentationModel& settingModelObj);
246
247         /**
248          * assignment operator
249          */
250
251         BookmarkPresentationModel& operator=(const BookmarkPresentationModel& settingModelObj);
252
253         /**
254          *@brief Initialize storage service
255          */
256         result Construct(void);
257
258         /**
259          * @brief               The method used to create the instance of the SettingsManager class
260          */
261         static void CreateInstance(void);
262
263         /**
264          * @brief               The method used to remove the already created instance of the SettingsManager
265          */
266         static void DestroyInstance(void);
267
268         /**
269          * This function creates the list of BookMark
270          *
271          * @return      An error code
272          * @param               nBookmarkCount  The no of BookMark present
273          * @param               bookmarkList    An ArrayList where the BookMark will be stored
274          * @exception   E_SUCCESS               The method is successful
275          * @exception   E_FAILURE               The method is not successful as the list is not being created
276          * @remarks             To work properly , the bookmark count and and existing list should be passed
277          */
278         result CreateBookmarkList(int nBookmarkCount, Tizen::Base::Collection::ArrayList& bookmarkList);
279         /**
280          * This function creates the list of BookMark folders
281          *
282          * @return      An error code
283          * @param               bookmarkCount  The no of BookMark folders present
284          * @param               bookmarkList    An ArrayList where the BookMark will be stored
285          * @exception   E_SUCCESS               The method is successful
286          * @exception   E_FAILURE               The method is not successful as the list is not being created
287          * @remarks             To work properly , the bookmark count and and existing list should be passed
288          */
289
290         result CreateFolderList(int bookmarkCount, Tizen::Base::Collection::ArrayList& bookmarkList);
291
292 private:
293         static BookmarkPresentationModel* __pBookmarkPresentationModel;
294
295  };
296
297 #endif //_INT_BOOKMARK_PRESENTATION_MODEL_H