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 TypeMethodDescriptionvoidaddListener(Listener listener) Add a data import event listener.voidClear 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.
-
Constructor Details
-
XMLImporter
-
XMLImporter
-
-
Method Details
-
setContext
Description copied from interface:ImporterSet global context.- Specified by:
setContextin interfaceImporter- Parameters:
context- the global context
-
addListener
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
Description copied from interface:ImporterRun the specified import task.
-