1818import com .google .common .collect .ListMultimap ;
1919import de .ii .xtraplatform .features .domain .FeatureSchema ;
2020import de .ii .xtraplatform .features .domain .ImmutableFeatureSchema ;
21+ import de .ii .xtraserver .hale .io .writer .XtraServerMappingUtils ;
2122import de .ii .xtraserver .hale .io .writer .handler .TransformationHandler ;
2223import eu .esdihumboldt .hale .common .align .model .Cell ;
2324import eu .esdihumboldt .hale .common .align .model .ParameterValue ;
@@ -36,11 +37,11 @@ class SqlExpressionHandler extends RenameHandler {
3637 }
3738
3839 /**
39- * @see TransformationHandler#handle(Cell)
40+ * @see TransformationHandler#handle(Cell, String )
4041 */
4142 @ Override
4243 public Optional <ImmutableFeatureSchema .Builder > doHandle (
43- final Cell propertyCell , final Property targetProperty ) {
44+ final Cell propertyCell , final Property targetProperty , String providerId ) {
4445
4546 ImmutableFeatureSchema .Builder propertyBuilder =
4647 buildPropertyPath (propertyCell , targetProperty );
@@ -49,7 +50,19 @@ public Optional<ImmutableFeatureSchema.Builder> doHandle(
4950 propertyCell .getTransformationParameters ();
5051 final List <ParameterValue > expressions = parameters .get (PARAMETER_VALUE );
5152 final String expression = expressions .get (0 ).as (String .class );
52- final String sourcePath =String .format ("[EXPRESSION]{sql=%s}" , expression );
53+ String sourcePath = String .format ("[EXPRESSION]{sql=%s}" , expression );
54+
55+ Property sourceProperty = XtraServerMappingUtils .getSourceProperty (propertyCell );
56+
57+ Optional <String > joinSourcePath =
58+ this .mappingContext .computeJoinSourcePath (sourceProperty .getDefinition ());
59+ if (joinSourcePath .isPresent ()) {
60+ if (this .mappingContext .hasFirstObjectBuilderMapping (targetProperty )) {
61+ this .mappingContext .getFirstObjectBuilder (targetProperty ).sourcePath (joinSourcePath .get ());
62+ } else {
63+ sourcePath = joinSourcePath .get () + "/" + sourcePath ;
64+ }
65+ }
5366
5467 setTypesAndSourcePaths (propertyBuilder , targetProperty , sourcePath );
5568
0 commit comments