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"
35 * @class BookmarkPresentationModel
36 * @brief This class declares functions which will manage database
38 class BookmarkPresentationModel
39 :public PresentationModelBase
43 * @brief The method used to get the already created instance of the FaviconManager
45 static BookmarkPresentationModel* GetInstance(void);
47 * This function deletes the bookmark from the bookmark table
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
54 result DeleteBookmark(int bookmarkId);
57 * This function deletes the bookmark from the bookmark table
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
64 result DeleteBookmark(const Tizen::Base::String& url);
67 * This function deletes the bookmark from the bookmark table
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
74 result DeleteBookmarkByFolderId(int folderId);
77 * This function deletes the folder from the folder table
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
84 result DeleteFolder(int folderId);
88 * This function checks whether the Bookmark with given URl already exists or not
90 * @return An error code
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
96 result DoesBookmarkExist(const Tizen::Base::String& Url, bool &exist, const Tizen::Base::String& parentId = L"-1", bool checkParentId = false);
98 * This function selects the bookmarks from the table
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
106 result GetBookmark(const Tizen::Base::String& parentID, const int startIndex, const int limit, Tizen::Base::Collection::ArrayList& bookmarkList);
110 * This function returns the no of bookmarks
112 * @return An error code
113 * @param parentID Folder or URL
115 result GetBookmarkCount(const Tizen::Base::String& parentID, int& count);
118 * This function selects the bookmark folders from the table
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
126 result GetFolder(const Tizen::Base::String& parentID, int startIndex,int limit, Tizen::Base::Collection::ArrayList& bookmarkList);
130 * This function returns the no of bookmark folders
132 * @return An error code
133 * @param parentID Folder or URL
135 result GetFolderBookmarkCount(const Tizen::Base::String& parentID, int& Count);
138 * This function selects the bookmark folders from the table
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
146 result GetFoldersBookmarks(const Tizen::Base::String& parentID, const int startIndex, const int limit, Tizen::Base::Collection::ArrayList& bookmarkList);
149 * This function returns the no of bookmark folders.
151 * @return An error code
152 * @param parentID Folder or URL
154 result GetFolderCount(const Tizen::Base::String& parentID, int& count);
157 * This function selects the searched bookmarks from the table
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
164 result GetSearchBookmark(int startIndex,int limit, Tizen::Base::Collection::ArrayList& BookmarkList, Tizen::Base::String& text);
168 * This function returns the no of searched Bookmarks
170 * @return An error code
171 * @param count The no of matching bookmarks will be returned in count.
173 result GetSearchBookmarkCount(int& count, Tizen::Base::String& text);
176 * This function selects the searched folders from the table
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
183 result GetSearchFolder(int startIndex,int limit, Tizen::Base::Collection::ArrayList& FolderList, Tizen::Base::String& text);
186 * This function returns the no of searched Bookmarks and Folders
188 * @return An error code
189 * @param count The no of matching bookmarks and folders will be returned in count.
191 result GetSearchFolderBookmarkCount(int& count, Tizen::Base::String& text);
194 * This function returns the no of searched Folders
196 * @return An error code
197 * @param count The no of matching Folders will be returned in count.
199 result GetSearchFolderCount(int& count, Tizen::Base::String& text);
202 * This function selects the searched bookmark folders from the table
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
209 result GetSearchFoldersBookmarks(int startIndex,int limit, Tizen::Base::Collection::ArrayList& BookmarkList, Tizen::Base::String& text);
212 * This function adds the folder to the folder table
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
219 result SaveFolder(BookmarkData& bookmark);
222 * This function adds the bookmarks to the bookmark table
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
229 result SaveBookmark(BookmarkData& bookmark);
233 * @brief The Default Constructor
235 BookmarkPresentationModel(void);
238 * @brief The Default Destructor
240 ~BookmarkPresentationModel(void);
245 BookmarkPresentationModel(const BookmarkPresentationModel& settingModelObj);
248 * assignment operator
251 BookmarkPresentationModel& operator=(const BookmarkPresentationModel& settingModelObj);
254 *@brief Initialize storage service
256 result Construct(void);
259 * @brief The method used to create the instance of the SettingsManager class
261 static void CreateInstance(void);
264 * @brief The method used to remove the already created instance of the SettingsManager
266 static void DestroyInstance(void);
269 * This function creates the list of BookMark
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
278 result CreateBookmarkList(int nBookmarkCount, Tizen::Base::Collection::ArrayList& bookmarkList);
280 * This function creates the list of BookMark folders
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
290 result CreateFolderList(int bookmarkCount, Tizen::Base::Collection::ArrayList& bookmarkList);
293 static BookmarkPresentationModel* __pBookmarkPresentationModel;
297 #endif //_INT_BOOKMARK_PRESENTATION_MODEL_H