001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. The ASF licenses this file to You
004: * under the Apache License, Version 2.0 (the "License"); you may not
005: * use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License. For additional information regarding
015: * copyright in this work, please see the NOTICE file in the top level
016: * directory of this distribution.
017: */
018:
019: package org.apache.roller.business;
020:
021: import java.util.List;
022: import org.apache.roller.RollerException;
023: import org.apache.roller.pojos.Assoc;
024: import org.apache.roller.pojos.BookmarkData;
025: import org.apache.roller.pojos.FolderData;
026: import org.apache.roller.pojos.WebsiteData;
027:
028: /**
029: * Interface to Bookmark Management. Provides methods for retrieving, storing,
030: * moving, removing and querying for folders and bookmarks.
031: */
032: public interface BookmarkManager {
033:
034: public void saveBookmark(BookmarkData bookmark)
035: throws RollerException;
036:
037: /**
038: * Delete bookmark.
039: */
040: public void removeBookmark(BookmarkData bookmark)
041: throws RollerException;
042:
043: /**
044: * Retrieve bookmark by ID, a persistent instance.
045: */
046: public BookmarkData getBookmark(String id) throws RollerException;
047:
048: /**
049: * @param data
050: * @param subfolders
051: * @return
052: */
053: public List getBookmarks(FolderData data, boolean subfolders)
054: throws RollerException;
055:
056: public void saveFolder(FolderData folder) throws RollerException;
057:
058: public void removeFolder(FolderData folder) throws RollerException;
059:
060: /**
061: * Retrieve folder by ID, a persistent instance.
062: */
063: public FolderData getFolder(String id) throws RollerException;
064:
065: /**
066: * Get all folders for a website.
067: *
068: * @param website Website.
069: */
070: public List getAllFolders(WebsiteData wd) throws RollerException;
071:
072: /**
073: * Get top level folders for a website.
074: *
075: * @param website Website.
076: */
077: public FolderData getRootFolder(WebsiteData website)
078: throws RollerException;
079:
080: /**
081: * Get folder specified by website and folderPath.
082: *
083: * @param website Website of folder.
084: * @param folderPath Path of folder, relative to folder root.
085: */
086: public FolderData getFolder(WebsiteData website, String folderPath)
087: throws RollerException;
088:
089: /**
090: * Get absolute path to folder, appropriate for use by getFolderByPath().
091: *
092: * @param folder Folder.
093: * @return Forward slash separated path string.
094: */
095: public String getPath(FolderData folder) throws RollerException;
096:
097: /**
098: * Get subfolder by path relative to specified folder.
099: *
100: * @param folder Root of path or null to start at top of folder tree.
101: * @param path Path of folder to be located.
102: * @param website Website of folders.
103: * @return FolderData specified by path or null if not found.
104: */
105: public FolderData getFolderByPath(WebsiteData wd,
106: FolderData folder, String string) throws RollerException;
107:
108: /**
109: * Determine if folder is in use. A folder is <em>in use</em> if it contains any bookmarks
110: * or has any children.
111: *
112: * @param folder
113: * @return true if the folder contains bookmarks or has children, false otherwise.
114: * @throws RollerException
115: */
116: public boolean isFolderInUse(FolderData folder)
117: throws RollerException;
118:
119: /**
120: * Check duplicate folder name.
121: */
122: public boolean isDuplicateFolderName(FolderData data)
123: throws RollerException;
124:
125: /**
126: * Determines if folder is descendent of folder.
127: */
128: public boolean isDescendentOf(FolderData data, FolderData ancestor)
129: throws RollerException;
130:
131: /**
132: */
133: public Assoc getFolderParentAssoc(FolderData data)
134: throws RollerException;
135:
136: /**
137: */
138: public List getFolderChildAssocs(FolderData data)
139: throws RollerException;
140:
141: /**
142: */
143: public List getAllFolderDecscendentAssocs(FolderData data)
144: throws RollerException;
145:
146: /**
147: */
148: public List getFolderAncestorAssocs(FolderData data)
149: throws RollerException;
150:
151: /**
152: * Import bookmarks from OPML string into specified folder.
153: *
154: * @param site Website.
155: * @param folder Name of folder to hold bookmarks.
156: * @param opml OPML data to be imported.
157: */
158: public void importBookmarks(WebsiteData site, String folder,
159: String opml) throws RollerException;
160:
161: /**
162: * Move contents of folder to another folder.
163: *
164: * @param src Source folder.
165: * @param dest Destination folder.
166: */
167: public void moveFolderContents(FolderData src, FolderData dest)
168: throws RollerException;
169:
170: /**
171: * Delete contents of specified folder.
172: */
173: public void removeFolderContents(FolderData src)
174: throws RollerException;
175:
176: /**
177: * Release all resources associated with Roller session.
178: */
179: public void release();
180:
181: }
|