Inhalt · Anhänge (0)
Von Version 7.1
bearbeitet von ludwig
am 24.02.2017
Auf Version 8.1
bearbeitet von ludwig
am 28.02.2017
Änderungskommentar: Es gibt keinen Kommentar für diese Version

Metadatenänderungen

Titel
SAdd files tarto Multi File Import via script

Inhaltsänderungen

... ... @@ -3,12 +3,18 @@
3 3
4 4 = Start Multi File Import via script or API =
5 5
6 -Sometimes {{jbeam-sign/}} has to work headless and the postprecessing should be startet by script. To start an Multi-File-Import inside the script via Script you can use the following source:
6 +With "mfi" as instance of Multi File Import you can use the following source:
7 7
8 8 {{code language="java"}}
9 -import com.AMS.jBEAM.*;
10 -import com.google.common.collect.Iterables;
11 -MultiFileImport mfi = Iterables.getOnlyElement(jC.getComponentsByClass(MultiFileImport.class));
12 -mfi.refreshImportDataFiles();
13 -mfi.startSequence(true);
9 +MultiFileImport.ImportSettings settings = mfi.getImportSettings(); // gets a copy of “ImportSettings”
10 +List<File> currentImportDataFiles = settings.getImportDataFiles(); // current existing files in Multi File Import
11 +List<File> newImportDataFiles = … // add new Files
12 +for (File file : newImportDataFiles) {
13 + if (currentImportDataFiles != null && currentImportDataFiles.contains(file) {
14 + continue; // file exists
15 +}
16 +settings.addImportDataFile(file);
17 +}
18 +mfi.setImportSettings(settings);
19 +
14 14 {{/code}}

Copyright by Kistler Chemnitz GmbH 2021
XWiki Enterprise 4.4 - Documentation