Package com.axelor.data.xml
Class XMLImporter
- java.lang.Object
-
- com.axelor.data.xml.XMLImporter
-
- All Implemented Interfaces:
Importer
public class XMLImporter extends Object implements Importer
XML data importer.
This class also providesrun(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
Constructors Constructor Description XMLImporter(String configFile)
XMLImporter(String configFile, String dataDir)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(Listener listener)
Add a data import event listener.void
clearListener()
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.
-
-
-
Method Detail
-
setContext
public void setContext(Map<String,Object> context)
Description copied from interface:Importer
Set global context.- Specified by:
setContext
in interfaceImporter
- Parameters:
context
- the global context
-
addListener
public void addListener(Listener listener)
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
public void run(ImportTask task)
Description copied from interface:Importer
Run the specified import task.
-
-