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;
}
}
DEFAULT_BATCH_SIZE, 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)
ImportersetContext in interface Importercontext - the global contextpublic void addListener(Listener listener)
ImporteraddListener in interface Importerlistener - the listenerpublic void clearListener()
ImporterclearListener in interface Importerpublic void setCanClear(boolean canClear)
public void run()
Importerpublic void run(ImportTask task)
Importer