Package com.axelor.data.xml
Class XMLImporter
java.lang.Object
com.axelor.data.xml.XMLImporter
- All Implemented Interfaces:
Importer
XML data importer.
This class also provides
For example:
This class also provides
run(ImportTask)
method to import data programmatically. For example:
XMLImporter importer = new XMLImporter("path/to/xml-config.xml"); importer.runTask(new ImportTask(){ public void configure() throws IOException { input("contacts.xml", new File("data/xml/contacts.xml")); input("contacts.xml", new File("data/xml/contacts2.xml")); } public boolean handle(ImportException e) { System.err.println("Import error: " + e); return true; } }
-
Field Summary
Fields inherited from interface com.axelor.data.Importer
defaultAdapters
-
Constructor Summary
ConstructorsConstructorDescriptionXMLImporter
(String configFile) XMLImporter
(String configFile, String dataDir) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(Listener listener) Add a data import event listener.void
Clear listeners.void
run()
Run the data import task.void
run
(ImportTask task) Run the specified import task.void
setCanClear
(boolean canClear) void
setContext
(Map<String, Object> context) Set global context.
-
Constructor Details
-
XMLImporter
-
XMLImporter
-
-
Method Details
-
setContext
Description copied from interface:Importer
Set global context.- Specified by:
setContext
in interfaceImporter
- Parameters:
context
- the global context
-
addListener
Description copied from interface:Importer
Add a data import event listener.- Specified by:
addListener
in interfaceImporter
- Parameters:
listener
- the listener
-
clearListener
public void clearListener()Description copied from interface:Importer
Clear listeners.- Specified by:
clearListener
in interfaceImporter
-
setCanClear
public void setCanClear(boolean canClear) -
run
public void run()Description copied from interface:Importer
Run the data import task. -
run
Description copied from interface:Importer
Run the specified import task.
-