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);
146 * This function returns the no of bookmarks
148 * @return An error code
149 * @param parentID Folder or URL
151 result GetBookmarkCount(const Tizen::Base::String& parentID, int& count);
154 * This function selects the bookmark folders from the table
156 * @return An error code
157 * @param parentID parentId for bookmark : Folder or URL
158 * @param startIndex the OFFSET value
159 * @param limit The LIMIT till which the select statement will be executed
160 * @param bookmarkList The arraylist where the selected bookmarks will be saved
162 result GetFolder(const Tizen::Base::String& parentID, int startIndex,int limit, Tizen::Base::Collection::ArrayList& bookmarkList);
166 * This function returns the no of bookmark folders
168 * @return An error code
169 * @param parentID Folder or URL
171 result GetFolderBookmarkCount(const Tizen::Base::String& parentID, int& Count);
174 * This function selects the bookmark folders from the table
176 * @return An error code
177 * @param parentID parentId for bookmark : Folder or URL
178 * @param startIndex the OFFSET value
179 * @param limit The LIMIT till which the select statement will be executed
180 * @param bookmarkList The arraylist where the selected bookmarks will be saved
182 result GetFoldersBookmarks(const Tizen::Base::String& parentID, const int startIndex, const int limit, Tizen::Base::Collection::ArrayList& bookmarkList);
185 * This function returns the no of bookmark folders.
187 * @return An error code
188 * @param parentID Folder or URL
190 result GetFolderCount(const Tizen::Base::String& parentID, int& count);
193 * This function selects the searched bookmarks from the table
195 * @return An error code
196 * @param startIndex the OFFSET value
197 * @param limit The LIMIT till which the select statement will be executed
198 * @param BookmarkList The arraylist where the selected searched bookmarks will be saved
200 result GetSearchBookmark(int startIndex,int limit, Tizen::Base::Collection::ArrayList& BookmarkList, Tizen::Base::String& text);
204 * This function returns the no of searched Bookmarks
206 * @return An error code
207 * @param count The no of matching bookmarks will be returned in count.
209 result GetSearchBookmarkCount(int& count, Tizen::Base::String& text);
212 * This function selects the searched folders from the table
214 * @return An error code
215 * @param startIndex the OFFSET value
216 * @param limit The LIMIT till which the select statement will be executed
217 * @param FolderList The arraylist where the selected searched folders will be saved
219 result GetSearchFolder(int startIndex,int limit, Tizen::Base::Collection::ArrayList& FolderList, Tizen::Base::String& text);
222 * This function returns the no of searched Bookmarks and Folders
224 * @return An error code
225 * @param count The no of matching bookmarks and folders will be returned in count.
227 result GetSearchFolderBookmarkCount(int& count, Tizen::Base::String& text);
230 * This function returns the no of searched Folders
232 * @return An error code
233 * @param count The no of matching Folders will be returned in count.
235 result GetSearchFolderCount(int& count, Tizen::Base::String& text);
238 * This function selects the searched bookmark folders from the table
240 * @return An error code
241 * @param startIndex the OFFSET value
242 * @param limit The LIMIT till which the select statement will be executed
243 * @param BookmarkList The arraylist where the selected searched bookmarks will be saved
245 result GetSearchFoldersBookmarks(int startIndex,int limit, Tizen::Base::Collection::ArrayList& BookmarkList, Tizen::Base::String& text);
248 * This function adds the folder to the folder table
250 * @return An error code
251 * @param bookmark The folder
252 * @exception E_SUCCESS The folder is inserted successfully to the table
253 * @exception E_FAILURE The folder is not inserted successfully
255 result SaveFolder(BookmarkData& bookmark);
258 * This function adds the bookmarks to the bookmark table
260 * @return An error code
261 * @param bookmark The bookmark
262 * @exception E_SUCCESS The bookmark is inserted successfully to the table
263 * @exception E_FAILURE The bookmark is not inserted successfully
265 result SaveBookmark(BookmarkData& bookmark);
267 result SaveTempBookmark(BookmarkData& bookmark);
270 * @brief The Default Constructor
272 BookmarkPresentationModel(void);
275 * @brief The Default Destructor
277 ~BookmarkPresentationModel(void);
282 BookmarkPresentationModel(const BookmarkPresentationModel& settingModelObj);
285 * assignment operator
288 BookmarkPresentationModel& operator=(const BookmarkPresentationModel& settingModelObj);
291 *@brief Initialize storage service
293 result Construct(void);
296 * @brief The method used to create the instance of the SettingsManager class
298 static void CreateInstance(void);
301 * @brief The method used to remove the already created instance of the SettingsManager
303 static void DestroyInstance(void);
306 * This function creates the list of BookMark
308 * @return An error code
309 * @param nBookmarkCount The no of BookMark present
310 * @param bookmarkList An ArrayList where the BookMark will be stored
311 * @exception E_SUCCESS The method is successful
312 * @exception E_FAILURE The method is not successful as the list is not being created
313 * @remarks To work properly , the bookmark count and and existing list should be passed
315 result CreateBookmarkList(int nBookmarkCount, Tizen::Base::Collection::ArrayList& bookmarkList);
317 * This function creates the list of BookMark folders
319 * @return An error code
320 * @param bookmarkCount The no of BookMark folders present
321 * @param bookmarkList An ArrayList where the BookMark will be stored
322 * @exception E_SUCCESS The method is successful
323 * @exception E_FAILURE The method is not successful as the list is not being created
324 * @remarks To work properly , the bookmark count and and existing list should be passed
327 result CreateFolderList(int bookmarkCount, Tizen::Base::Collection::ArrayList& bookmarkList);
330 static BookmarkPresentationModel* __pBookmarkPresentationModel;
334 #endif //_INT_BOOKMARK_PRESENTATION_MODEL_H