public class XMLImporter extends Object implements Importer
run(ImportTask)
method to import data programmatically. 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; } }
defaultAdapters
Constructor and Description |
---|
XMLImporter(String configFile) |
XMLImporter(String configFile,
String dataDir) |
Modifier and Type | Method and 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.
|
@Inject public XMLImporter(@Named(value="axelor.data.config") String configFile, @Named(value="axelor.data.dir") String dataDir)
public XMLImporter(String configFile)
public void setContext(Map<String,Object> context)
Importer
setContext
in interface Importer
context
- the global contextpublic void addListener(Listener listener)
Importer
addListener
in interface Importer
listener
- the listenerpublic void clearListener()
Importer
clearListener
in interface Importer
public void setCanClear(boolean canClear)
public void run()
Importer
public void run(ImportTask task)
Importer