Skip to content

Commit

Permalink
Fix origin determination in ImportController
Browse files Browse the repository at this point in the history
This fixes failing TestCsvReportImportClassic.
  • Loading branch information
mederly committed Aug 7, 2023
1 parent e102f53 commit 0dd0659
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.*;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.schema.config.ConfigurationItemOrigin;
import com.evolveum.midpoint.schema.config.ExecuteScriptConfigItem;

import org.apache.commons.csv.CSVFormat;
Expand Down Expand Up @@ -89,7 +90,16 @@ public ImportController(
this.compiledCollection = compiledCollection;
ReportBehaviorType behavior = report.getBehavior();
ExecuteScriptType importScript = behavior != null ? behavior.getImportScript() : null;
this.script = importScript != null ? ExecuteScriptConfigItem.embedded(importScript) : null;
if (importScript != null) {
// We cannot use "embedded" origin for property real values, as they have no notion of the parent.
// Hence, we have to start with the origin "behavior" (containerable), and derive our origin from it.
ConfigurationItemOrigin origin =
ConfigurationItemOrigin.embedded(behavior)
.child(ReportBehaviorType.F_IMPORT_SCRIPT);
this.script = ExecuteScriptConfigItem.of(importScript, origin);
} else {
this.script = null;
}
this.support = new CommonCsvSupport(report.getFileFormat());
}

Expand Down

0 comments on commit 0dd0659

Please sign in to comment.