net.sourceforge.java.feednread.backend.importer
Class NewsFeedWatchesTreeImport

java.lang.Object
  extended bynet.sourceforge.java.feednread.backend.importer.NewsFeedWatchesTreeImport
All Implemented Interfaces:
INewsFeedWatchesTreeExportIdentifiers

public class NewsFeedWatchesTreeImport
extends Object
implements INewsFeedWatchesTreeExportIdentifiers

Imports a NewsFeedWatchesTree serialized as xml structure into an arbitrary WatchFolder. Note that a NewsFeedFavoritesTreeOPMLImport has to be precede a NewsFeedWatchesTreeImport to create the required back references to the corresponding watched Favorites during the import.

Author:
Sebastian Machhausen

Field Summary
private  Map elements
           Maps guids to IMutableTreeElements
private  IProgressMonitor monitor
           The IProgressMonitor to report the progress of the import to
private  WatchFolder targetFolder
           The WatchFolder to import into
 
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
NewsFeedWatchesTreeImport(IProgressMonitor monitor, WatchFolder targetFolder, Map elements)
           Creates a new NewsFeedWatchesTreeImport that imports into the specified targetFolder.
 
Method Summary
 void doImport(String fileName)
           Imports the NewsFeedWatchesTree Document from the File with the specified fileName.
protected  void importWatch(Element watchElem, WatchFolder parent)
           Imports the Watch specified by the given watchElem and hangs it in the given parent WatchFolder.
protected  void importWatchedElements(Element watchedElementsElem, Watch watch)
           Imports the watched IMutableTreeElements specified by the given watchElementsElem and associates them to the given Watch.
protected  void importWatchFolder(Element folderElem, WatchFolder parent)
           Imports the WatchFolder specified by the given folderElem and hangs it in the given parent WatchFolder.
protected  void importWatchSettings(Element settingsElem, Watch watch)
           Imports the WatchSettings specified by the given settingsElem and associates it to the given Watch.
protected  void importWatchSettingsEntry(Element entryElem, WatchSettings settings)
           Imports the WatchSettingsEntry specified by the given entryElem and adds it to the given WatchSettings.
protected  void parseDocument(Document doc)
           Parses the NewsFeedWatchesTree Document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

monitor

private IProgressMonitor monitor

The IProgressMonitor to report the progress of the import to


targetFolder

private WatchFolder targetFolder

The WatchFolder to import into


elements

private Map elements

Maps guids to IMutableTreeElements

Constructor Detail

NewsFeedWatchesTreeImport

public NewsFeedWatchesTreeImport(IProgressMonitor monitor,
                                 WatchFolder targetFolder,
                                 Map elements)

Creates a new NewsFeedWatchesTreeImport that imports into the specified targetFolder.

Parameters:
monitor - the IProgressMonitor to report the progress of this NewsFeedWatchesTreeImport to
targetFolder - the WatchFolder to import into
elements - the list of IMutableTreeElements backed up by a Map; A single IMutableTreeElement is accessible in the Map via its guid
Method Detail

doImport

public void doImport(String fileName)
              throws JDOMException,
                     IOException

Imports the NewsFeedWatchesTree Document from the File with the specified fileName.

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

parseDocument

protected void parseDocument(Document doc)

Parses the NewsFeedWatchesTree Document.

Parameters:
doc - the NewsFeedWatchesTree Document to parse

importWatchFolder

protected void importWatchFolder(Element folderElem,
                                 WatchFolder parent)

Imports the WatchFolder specified by the given folderElem and hangs it in the given parent WatchFolder.

Parameters:
folderElem - the Element specifying a WatchFolder
parent - the parent WatchFolder to import into

importWatchSettings

protected void importWatchSettings(Element settingsElem,
                                   Watch watch)

Imports the WatchSettings specified by the given settingsElem and associates it to the given Watch.

Parameters:
settingsElem - the Element specifying the WatchSettings
watch - the Watch to associate the imported WatchSettings to

importWatchSettingsEntry

protected void importWatchSettingsEntry(Element entryElem,
                                        WatchSettings settings)

Imports the WatchSettingsEntry specified by the given entryElem and adds it to the given WatchSettings.

Parameters:
entryElem - the Element specifying a WatchSettingsEntry
settings - the WatchSettings to add the imported WatchSettingsEntry to

importWatchedElements

protected void importWatchedElements(Element watchedElementsElem,
                                     Watch watch)

Imports the watched IMutableTreeElements specified by the given watchElementsElem and associates them to the given Watch.

Parameters:
watchedElementsElem - the Element specifying the watched IMutableTreeElements
watch - the Watch to associate the imported watched IMutableTreeElements to

importWatch

protected void importWatch(Element watchElem,
                           WatchFolder parent)

Imports the Watch specified by the given watchElem and hangs it in the given parent WatchFolder.

Parameters:
watchElem - the Element specifying a Watch
parent - the parent WatchFolder to import into