}
@Override
public Object apply() throws WizardException {
if (source.getFile() == null)
throw new WizardException(DcResources.getText("msgNoFileSelected"));
if (!source.getFile().exists() || !source.getFile().canRead())
throw new WizardException(DcResources.getText("msgFileCannotBeUsed"));
wizard.getDefinition().getImporter().clearMappings();
// store the settings
// note: I have made sure this works for both module and application settings
for (String key : settings.keySet()) {
Setting setting = DcSettings.getSetting(key) != null ? DcSettings.getSetting(key) : wizard.getModule().getSettings().getSetting(key);
setting.setValue(settings.get(key).getValue());
}
try {
wizard.getDefinition().getImporter().setFile(source.getFile());
} catch (Exception e) {
throw new WizardException(e.getMessage());
}
wizard.getDefinition().setFile(source.getFile());
return wizard.getDefinition();
}