KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > model > BookmarkManager


1
2 package org.roller.model;
3
4 import org.roller.RollerException;
5 import org.roller.pojos.Assoc;
6 import org.roller.pojos.BookmarkData;
7 import org.roller.pojos.FolderData;
8 import org.roller.pojos.WebsiteData;
9
10 import java.io.Serializable JavaDoc;
11 import java.util.List JavaDoc;
12
13
14 /**
15  * Interface to Bookmark Management. Provides methods for retrieving, storing,
16  * moving, removing and querying for folders and bookmarks.
17  *
18  * @author David M Johnson
19  */

20 public interface BookmarkManager extends Serializable JavaDoc
21 {
22     //---------------------------------------------------------- Bookmark CRUD
23

24     /** Create new bookmark, NOT a persistent instance. */
25     public BookmarkData createBookmark();
26     
27     /** Create new bookmark, NOT a persistent instance. */
28     public BookmarkData createBookmark(
29         FolderData parent,
30         String JavaDoc name,
31         String JavaDoc desc,
32         String JavaDoc url,
33         String JavaDoc feedUrl,
34         Integer JavaDoc weight,
35         Integer JavaDoc priority,
36         String JavaDoc image) throws RollerException;
37
38     /** Retrieve bookmark by ID, a persistent instance. */
39     public BookmarkData retrieveBookmark(String JavaDoc id) throws RollerException;
40
41     /** Update or store bookmark object, becomes a persistent instance. */
42     //public void storeBookmark(BookmarkData data) throws RollerException;
43

44     /** Delete bookmark by ID. */
45     public void removeBookmark(String JavaDoc id) throws RollerException;
46
47     //------------------------------------------------------------ Folder CRUD
48

49     /** Create new folder, NOT a persistent instance. */
50     public FolderData createFolder();
51     
52     /** Create new folder, NOT a persistent instance. */
53     public FolderData createFolder(
54         FolderData parent,
55         String JavaDoc name,
56         String JavaDoc desc,
57         WebsiteData website) throws RollerException;
58
59     /** Retrieve folder by ID, a persistent instance. */
60     public FolderData retrieveFolder(String JavaDoc id) throws RollerException;
61
62     /**
63      * Determine if folder is in use. A folder is <em>in use</em> if it contains any bookmarks
64      * or has any children.
65      * @param folder
66      * @return true if the folder contains bookmarks or has children, false otherwise.
67      * @throws RollerException
68      */

69     public boolean isFolderInUse(FolderData folder) throws RollerException;
70     
71     /** Store folder object, becomes a persistent instance. */
72     //public void storeFolder(FolderData data) throws RollerException;
73

74     /**
75      * Remove folder by ID, does not cascade to subfolders and bookmarks.
76      * You should instead use FolderData.remove() to remove a folder.
77      */

78     //public void removeFolder(String id) throws RollerException;
79

80     //------------------------------------------------------------- Operations
81

82     /** Import bookmarks from OPML string into specified folder.
83       * @param site Website.
84       * @param folder Name of folder to hold bookmarks.
85       * @param opml OPML data to be imported.
86       */

87     public void importBookmarks(WebsiteData site, String JavaDoc folder, String JavaDoc opml)
88         throws RollerException;
89     
90     /** Move contents of folder to another folder.
91       * @param src Source folder.
92       * @param dest Destination folder.
93       */

94     public void moveFolderContents(FolderData src, FolderData dest)
95         throws RollerException;
96
97     /**
98      * Delete contents of specified folder.
99      */

100     public void deleteFolderContents(FolderData src) throws RollerException;
101     
102     //---------------------------------------------------------------- Queries
103

104     /** Get all folders for a website.
105       * @param website Website.
106       */

107     public List JavaDoc getAllFolders(WebsiteData wd) throws RollerException;
108
109     /** Get top level folders for a website.
110       * @param website Website.
111       */

112     public FolderData getRootFolder(WebsiteData website)
113         throws RollerException;
114
115     /** Get folder specified by website and folderPath.
116       * @param website Website of folder.
117       * @param folderPath Path of folder, relative to folder root.
118       */

119     public FolderData getFolder(WebsiteData website, String JavaDoc folderPath)
120         throws RollerException;
121
122     /**
123      * Get absolute path to folder, appropriate for use by getFolderByPath().
124      * @param folder Folder.
125      * @return Forward slash separated path string.
126      */

127     public String JavaDoc getPath(FolderData folder) throws RollerException;
128
129     /**
130      * Get subfolder by path relative to specified folder.
131      * @param folder Root of path or null to start at top of folder tree.
132      * @param path Path of folder to be located.
133      * @param website Website of folders.
134      * @return FolderData specified by path or null if not found.
135      */

136     public FolderData getFolderByPath(
137         WebsiteData wd, FolderData folder, String JavaDoc string)
138         throws RollerException;
139
140     /**
141      * @param folder
142      * @param ancestor
143      * @param relation
144      * @return
145      */

146     public Assoc createFolderAssoc(
147         FolderData folder, FolderData ancestor, String JavaDoc relation)
148         throws RollerException;
149         
150     /**
151      * @param data
152      * @param subfolders
153      * @return
154      */

155     public List JavaDoc retrieveBookmarks(FolderData data, boolean subfolders)
156         throws RollerException;
157
158     /**
159      * Check duplicate folder name.
160      */

161     public boolean isDuplicateFolderName(FolderData data) throws RollerException;
162
163     /**
164      */

165     public Assoc getFolderParentAssoc(FolderData data) throws RollerException;
166
167     /**
168      */

169     public List JavaDoc getFolderChildAssocs(FolderData data) throws RollerException;
170
171     /**
172      */

173     public List JavaDoc getAllFolderDecscendentAssocs(FolderData data) throws RollerException;
174
175     /**
176      */

177     public List JavaDoc getFolderAncestorAssocs(FolderData data) throws RollerException;
178
179     /**
180      * Release all resources associated with Roller session.
181      */

182     public void release();
183
184     /**
185      * Determines if folder is descendent of folder.
186      */

187     public boolean isDescendentOf(FolderData data, FolderData ancestor) throws RollerException;
188 }
189
190
Popular Tags