net.sourceforge.java.feednread.backend.exporter
Class NewsFeedWatchesTreeExport

java.lang.Object
  extended bynet.sourceforge.java.feednread.backend.exporter.NewsFeedWatchesTreeExport
All Implemented Interfaces:
INewsFeedWatchesTreeExportIdentifiers

public class NewsFeedWatchesTreeExport
extends Object
implements INewsFeedWatchesTreeExportIdentifiers

Exports the NewsFeedWatchesTree, i.e. its hierarchical WatchFolder structure to an xml JDOM Document which can on his part be exported to a File .

Author:
Sebastian Machhausen

Field Summary
private  WatchFolder rootFolder
           The root WatchFolderto export
 
Fields inherited from interface net.sourceforge.java.feednread.backend.exporter.INewsFeedWatchesTreeExportIdentifiers
CASE_SENSITIVE, DEFAULT_NAMESPACE, DESCRIPTION, ELEMENTS, ENTRY, FOLDER, GUID_ATTRIBUTE, ITEM, KEYWORD, SETTINGS, TITLE_ATTRIBUTE, VERSION_ATTRIBUTE, WATCH, WATCH_LIST_ROOT, WHOLE_WORD
 
Constructor Summary
NewsFeedWatchesTreeExport(WatchFolder rootFolder)
           Creates a new NewsFeedWatchesTreeExport instance.
 
Method Summary
protected  Document createDocument()
           Creates a Dcoument from the set rootFolder.
protected  void createFolder(WatchFolder folder, Element parent)
           Creates a watch folder Element from the specified WatchFolder inside the denoted parent.
protected  void createWatch(Watch watch, Element folderElem)
           Creates a watch Element from the specified Watch inside the denoted folderElem.
protected  void createWatchedElements(IMutableTreeElement[] watchedElements, Element elementsElem)
           Creates the watched elements Elements inside the denoted elementsElem using the given watchedElements.
protected  void createWatchSettings(Watch watch, Element watchElem)
           Creates the watch settings Element for the specified Watch inside the denoted watchElem.
protected  void createWatchSettingsEntries(WatchSettingsEntry[] entries, Element settingsElem)
           Creates the watch settings entries Elements inside the denoted settingsElem using the given entries.
 void doExport(String fileName)
           Exports the specified rootFolder to a File with the specified fileName.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootFolder

private WatchFolder rootFolder

The root WatchFolderto export

Constructor Detail

NewsFeedWatchesTreeExport

public NewsFeedWatchesTreeExport(WatchFolder rootFolder)

Creates a new NewsFeedWatchesTreeExport instance.

Parameters:
rootFolder - the root WatchFolder to export
Method Detail

doExport

public void doExport(String fileName)
              throws IOException

Exports the specified rootFolder to a File with the specified fileName.

Parameters:
fileName - the name of the file to export to
Throws:
IOException - if the export failed due to an IO error

createDocument

protected Document createDocument()

Creates a Dcoument from the set rootFolder.

Returns:
the created Document

createFolder

protected void createFolder(WatchFolder folder,
                            Element parent)

Creates a watch folder Element from the specified WatchFolder inside the denoted parent.

Parameters:
folder - the WatchFolder for which to create a watch folder Element
parent - the parent Element

createWatch

protected void createWatch(Watch watch,
                           Element folderElem)

Creates a watch Element from the specified Watch inside the denoted folderElem.

Parameters:
watch - the Watch for which to create a watch Element
folderElem - the watch folder Element to embed the created Element in

createWatchSettings

protected void createWatchSettings(Watch watch,
                                   Element watchElem)

Creates the watch settings Element for the specified Watch inside the denoted watchElem.

Parameters:
watch - the Watch for which to create the watch settings Element
watchElem - the watch Element to embed the created Element in

createWatchSettingsEntries

protected void createWatchSettingsEntries(WatchSettingsEntry[] entries,
                                          Element settingsElem)

Creates the watch settings entries Elements inside the denoted settingsElem using the given entries.

Parameters:
entries - an array of WatchSettingsEntry instances
settingsElem - the watch settings Element to embed the created Elements in

createWatchedElements

protected void createWatchedElements(IMutableTreeElement[] watchedElements,
                                     Element elementsElem)

Creates the watched elements Elements inside the denoted elementsElem using the given watchedElements.

Parameters:
watchedElements - an array of IMutableTreeElement instances
elementsElem - the watched elements Element to embed the created Elements in