3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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.
19 /*@file: IntBookmarkPresentationModel.h
20 *@brief: This is the header file for BookmarkPresentationModel class
23 #ifndef _INT_BOOKMARK_PRESENTATION_MODEL_H
24 #define _INT_BOOKMARK_PRESENTATION_MODEL_H
30 #include "IntBookmarkData.h"
31 #include "IntPresentationModelBase.h"
40 BOOKMARK_CREATIONDATE,
45 BOOKMARK_ACCESSACCOUNT,
47 BOOKMARK_FAVICON_LENGTH,
50 BOOKMARK_CREATED_DATE,
51 BOOKMARK_ACCOUNT_NAME,
52 BOOKMARK_ACCOUNT_TYPE,
54 BOOKMARK_THUMBNAIL_LENGTH,
67 HISTORY_VISITED_COUNT*/
71 * @class BookmarkPresentationModel
72 * @brief This class declares functions which will manage database
74 class BookmarkPresentationModel
75 :public PresentationModelBase
79 * @brief The method used to get the already created instance of the FaviconManager
81 static BookmarkPresentationModel* GetInstance(void);
83 * This function deletes the bookmark from the bookmark table
85 * @return An error code
86 * @param bookmarkId The bookmarkId
87 * @exception E_SUCCESS The bookmark is successfully deleted
88 * @exception E_FAILURE The bookmark deletion is unsuccessful
90 result DeleteBookmark(int bookmarkId);
93 * This function deletes the bookmark from the bookmark table
95 * @return An error code
96 * @param url URL of the bookmark
97 * @exception E_SUCCESS The bookmark is successfully deleted
98 * @exception E_FAILURE The bookmark deletion is unsuccessful
100 result DeleteBookmark(const Tizen::Base::String& url);
103 * This function deletes the bookmark from the bookmark table
105 * @return An error code
106 * @param folderId The folderID
107 * @exception E_SUCCESS The bookmark is successfully deleted
108 * @exception E_FAILURE The bookmark deletion is unsuccessful
110 result DeleteBookmarkByFolderId(int folderId);
113 * This function deletes the folder from the folder table
115 * @return An error code
116 * @param bookmarkId The folderId
117 * @exception E_SUCCESS The folder is successfully deleted
118 * @exception E_FAILURE The folder deletion is unsuccessful
120 result DeleteFolder(int folderId);
124 * This function checks whether the Bookmark with given URl already exists or not
126 * @return An error code
128 * @exception E_SUCCESS The method is successful
129 * @exception E_FAILURE The method is not successful as the list is not being created
130 * @remarks To check whether the Bookmark with given URl already exists or not
132 result DoesBookmarkExist(const Tizen::Base::String& Url, bool &exist, const Tizen::Base::String& parentId = L"-1", bool checkParentId = false);
134 * This function selects the bookmarks from the table
136 * @return An error code
137 * @param parentID parentId for bookmark : Folder or URL
138 * @param startIndex the OFFSET value
139 * @param limit The LIMIT till which the select statement will be executed
140 * @param bookmarkList The arraylist where the selected bookmarks will be saved
142 result GetBookmark(const Tizen::Base::String& parentID, const int startIndex, const int limit, Tizen::Base::Collection::ArrayList& bookmarkList);
145 result GetBookmarkForHistory(int startIndex, Tizen::Base::Collection::ArrayList& bookmarkList);
148 * This function returns the no of bookmarks
150 * @return An error code
151 * @param parentID Folder or URL
153 result GetBookmarkCount(const Tizen::Base::String& parentID, int& count);
156 * This function selects the bookmark folders from the table
158 * @return An error code
159 * @param parentID parentId for bookmark : Folder or URL
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 bookmarks will be saved
164 result GetFolder(const Tizen::Base::String& parentID, int startIndex,int limit, Tizen::Base::Collection::ArrayList& bookmarkList);
168 * This function returns the no of bookmark folders
170 * @return An error code
171 * @param parentID Folder or URL
173 result GetFolderBookmarkCount(const Tizen::Base::String& parentID, int& Count);
176 * This function selects the bookmark folders from the table
178 * @return An error code
179 * @param parentID parentId for bookmark : Folder or URL
180 * @param startIndex the OFFSET value
181 * @param limit The LIMIT till which the select statement will be executed
182 * @param bookmarkList The arraylist where the selected bookmarks will be saved
184 result GetFoldersBookmarks(const Tizen::Base::String& parentID, const int startIndex, const int limit, Tizen::Base::Collection::ArrayList& bookmarkList);
187 * This function returns the no of bookmark folders.
189 * @return An error code
190 * @param parentID Folder or URL
192 result GetFolderCount(const Tizen::Base::String& parentID, int& count);
195 * This function selects the searched bookmarks from the table
197 * @return An error code
198 * @param startIndex the OFFSET value
199 * @param limit The LIMIT till which the select statement will be executed
200 * @param BookmarkList The arraylist where the selected searched bookmarks will be saved
202 result GetSearchBookmark(int startIndex,int limit, Tizen::Base::Collection::ArrayList& BookmarkList, Tizen::Base::String& text);
206 * This function returns the no of searched Bookmarks
208 * @return An error code
209 * @param count The no of matching bookmarks will be returned in count.
211 result GetSearchBookmarkCount(int& count, Tizen::Base::String& text);
214 * This function selects the searched folders from the table
216 * @return An error code
217 * @param startIndex the OFFSET value
218 * @param limit The LIMIT till which the select statement will be executed
219 * @param FolderList The arraylist where the selected searched folders will be saved
221 result GetSearchFolder(int startIndex,int limit, Tizen::Base::Collection::ArrayList& FolderList, Tizen::Base::String& text);
224 * This function returns the no of searched Bookmarks and Folders
226 * @return An error code
227 * @param count The no of matching bookmarks and folders will be returned in count.
229 result GetSearchFolderBookmarkCount(int& count, Tizen::Base::String& text);
232 * This function returns the no of searched Folders
234 * @return An error code
235 * @param count The no of matching Folders will be returned in count.
237 result GetSearchFolderCount(int& count, Tizen::Base::String& text);
240 * This function selects the searched bookmark folders from the table
242 * @return An error code
243 * @param startIndex the OFFSET value
244 * @param limit The LIMIT till which the select statement will be executed
245 * @param BookmarkList The arraylist where the selected searched bookmarks will be saved
247 result GetSearchFoldersBookmarks(int startIndex,int limit, Tizen::Base::Collection::ArrayList& BookmarkList, Tizen::Base::String& text);
250 * This function adds the folder to the folder table
252 * @return An error code
253 * @param bookmark The folder
254 * @exception E_SUCCESS The folder is inserted successfully to the table
255 * @exception E_FAILURE The folder is not inserted successfully
257 result SaveFolder(BookmarkData& bookmark);
260 * This function adds the bookmarks to the bookmark table
262 * @return An error code
263 * @param bookmark The bookmark
264 * @exception E_SUCCESS The bookmark is inserted successfully to the table
265 * @exception E_FAILURE The bookmark is not inserted successfully
267 result SaveBookmark(BookmarkData& bookmark);
269 result SaveTempBookmark(BookmarkData& bookmark);
272 * @brief The Default Constructor
274 BookmarkPresentationModel(void);
277 * @brief The Default Destructor
279 ~BookmarkPresentationModel(void);
284 BookmarkPresentationModel(const BookmarkPresentationModel& settingModelObj);
287 * assignment operator
290 BookmarkPresentationModel& operator=(const BookmarkPresentationModel& settingModelObj);
293 *@brief Initialize storage service
295 result Construct(void);
298 * @brief The method used to create the instance of the SettingsManager class
300 static void CreateInstance(void);
303 * @brief The method used to remove the already created instance of the SettingsManager
305 static void DestroyInstance(void);
308 * This function creates the list of BookMark
310 * @return An error code
311 * @param nBookmarkCount The no of BookMark present
312 * @param bookmarkList An ArrayList where the BookMark will be stored
313 * @exception E_SUCCESS The method is successful
314 * @exception E_FAILURE The method is not successful as the list is not being created
315 * @remarks To work properly , the bookmark count and and existing list should be passed
317 result CreateBookmarkList(int nBookmarkCount, Tizen::Base::Collection::ArrayList& bookmarkList);
319 * This function creates the list of BookMark folders
321 * @return An error code
322 * @param bookmarkCount The no of BookMark folders present
323 * @param bookmarkList An ArrayList where the BookMark will be stored
324 * @exception E_SUCCESS The method is successful
325 * @exception E_FAILURE The method is not successful as the list is not being created
326 * @remarks To work properly , the bookmark count and and existing list should be passed
329 result CreateFolderList(int bookmarkCount, Tizen::Base::Collection::ArrayList& bookmarkList);
332 static BookmarkPresentationModel* __pBookmarkPresentationModel;
336 #endif //_INT_BOOKMARK_PRESENTATION_MODEL_H