|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.northwestern.at.wordhoard.swing.calculator.modelutils.ImportUtils
public class ImportUtils
Utilities for importing user-defined database objects from XML.
Field Summary | |
---|---|
protected static FileExtensionFilter |
xmlFilter
XML extension file filter. |
Constructor Summary | |
---|---|
protected |
ImportUtils()
Don't allow instantiation but do allow overrides. |
Method Summary | |
---|---|
static org.w3c.dom.Document |
getImportDocument(java.lang.String importFileName)
Parse import xml file to DOM document. |
static java.lang.String |
getImportFileName(java.awt.Window parentWindow)
Get name of import file. |
static boolean |
importObjects(UserDataObject[] objects,
boolean[] importedOK,
boolean renameDuplicates,
ProgressReporter progressReporter)
Import a list of objects from DOM document. |
static boolean |
isDuplicate(UserDataObject object)
Check for a duplicate import item. |
protected static boolean |
persistImportedObject(UserDataObject object)
Persist an imported object. |
static void |
renameDuplicate(UserDataObject object)
Rename a duplicate import item. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static FileExtensionFilter xmlFilter
Constructor Detail |
---|
protected ImportUtils()
Method Detail |
---|
public static java.lang.String getImportFileName(java.awt.Window parentWindow)
parentWindow
- Parent window for file dialog.
public static org.w3c.dom.Document getImportDocument(java.lang.String importFileName)
importFileName
- The name of the xml file containing
the WordHoard items to import.
public static boolean isDuplicate(UserDataObject object)
object
- The object to import.
public static void renameDuplicate(UserDataObject object)
object
- The object to import. protected static boolean persistImportedObject(UserDataObject object)
object
- The imported object to persist.
Handles any special persistence needs for different types of user data objects.
public static boolean importObjects(UserDataObject[] objects, boolean[] importedOK, boolean renameDuplicates, ProgressReporter progressReporter) throws ImportException
objects
- Objects to import.importedOK
- Array of booleans of same length as objects.
On output each element will be set true if
the corresponding object was successfully
persisted, false otherwise.renameDuplicates
- Rename duplicate items.
Items whose names already appear in
the database will not be persisted
unless renameDuplicates is true.progressReporter
- Progress reporter.
When renameDuplicates is true, the name of an import item which duplicates an existing item name of the same type will be changed to a non-duplicate name. The modified item name is constructed by appending "-n" to the existing item name, where "n" is an integer starting at 1.
ImportException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |