Language: Deutsch · English
Run CSV imports from rules – run() with structure definition and ImportResult.
REFERENZ DEVELOPER UPDATED: JUL 2026 APPLIES TO NUCLOS 4.2026.X
On this page
The ImportProvider runs a data import (CSV) from within a rule.
Imports the data from a NuclosFile (CSV). With isTransactional = true an error causes a full rollback. Structure definitions are generated classes (suffix ISD) from Configuration → Import & Export → Structure definition. Returns an ImportResult with log/text output.
public static ImportResult run(NuclosFile importFile, boolean isTransactional,
Class<? extends ImportStructureDefinition>... structureDefClasses) throws BusinessException;
import org.nuclos.api.provider.ImportProvider;
import de.customer.SEPACodeStrukturDefinitionISD;
public void insert(InsertContext context) throws BusinessException {
try {
// Get data from file system
NuclosFile sourceFile = FileProvider.newFile("/home/ftp/documents/SEPA-Code.csv");
// Execute import
ImportResult run = ImportProvider.run(sourceFile, false, SEPACodeStrukturDefinitionISD.class);
if(run.hasErrors()) {
throw new BusinessException(run.getMessages());
}
else {
NuclosMail nuclosMail = new NuclosMail("automaticImport@myCompany.de", "Datenimport fuer " + sourceFile.getName());
nuclosMail.addAttachment(sourceFile);
nuclosMail.addAttachment(run.getLogFile());
nuclosMail.setMessage("Erfolgreicher Datenimport fuer " + sourceFile.getName() + "\n\n" + run.getMessages());
MailProvider.send(nuclosMail);
}
} catch (Exception e) {
throw new BusinessException(e);
}
}
Finding the structure definition
The structure definition class name ends in ISD (Import Data Structure). Generated classes are located under data/codegenerator/IDS in the Nuclos base directory.