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 voidaddListener(Listener listener)Add a data import event listener.voidclearListener()Clear listeners.voidrun()Run the data import task.voidrun(ImportTask task)Run the specified import task.voidsetCanClear(boolean canClear)voidsetContext(Map<String,Object> context)Set global context.
-
-
-
Method Detail
-
setContext
public void setContext(Map<String,Object> context)
Description copied from interface:ImporterSet global context.- Specified by:
setContextin interfaceImporter- Parameters:
context- the global context
-
addListener
public void addListener(Listener listener)
Description copied from interface:ImporterAdd a data import event listener.- Specified by:
addListenerin interfaceImporter- Parameters:
listener- the listener
-
clearListener
public void clearListener()
Description copied from interface:ImporterClear listeners.- Specified by:
clearListenerin interfaceImporter
-
setCanClear
public void setCanClear(boolean canClear)
-
run
public void run()
Description copied from interface:ImporterRun the data import task.
-
run
public void run(ImportTask task)
Description copied from interface:ImporterRun the specified import task.
-
-