Skip to content

Commit

Permalink
repo-sqlbase: nestedMapping moved to general QueryModelMapping
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Feb 16, 2021
1 parent 6b8b10d commit ef983aa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Expand Up @@ -21,6 +21,7 @@
import com.evolveum.midpoint.repo.sqlbase.mapping.item.ItemFilterProcessor;
import com.evolveum.midpoint.repo.sqlbase.mapping.item.ItemRelationResolver;
import com.evolveum.midpoint.repo.sqlbase.mapping.item.ItemSqlMapper;
import com.evolveum.midpoint.repo.sqlbase.mapping.item.NestedMappingResolver;
import com.evolveum.midpoint.repo.sqlbase.querydsl.FlexibleRelationalPathBase;
import com.evolveum.midpoint.util.QNameUtil;

Expand Down Expand Up @@ -133,4 +134,17 @@ public final QueryModelMapping<S, Q, R> addRelationResolver(
}
return resolver;
}

/**
* Creates relation resolver for nested mapping and returns the mapping so the nested items
* can be mapped in a fluent matter.
*/
public final <N> QueryModelMapping<N, Q, R> nestedMapping(
@NotNull ItemName itemName,
@NotNull Class<N> nestedSchemaType) {
QueryModelMapping<N, Q, R> nestedMapping =
new QueryModelMapping<>(nestedSchemaType, queryType());
addRelationResolver(itemName, new NestedMappingResolver<>(nestedMapping));
return nestedMapping;
}
}
Expand Up @@ -23,7 +23,6 @@
import com.evolveum.midpoint.repo.sqlbase.SqlQueryContext;
import com.evolveum.midpoint.repo.sqlbase.SqlTransformerContext;
import com.evolveum.midpoint.repo.sqlbase.mapping.item.ItemSqlMapper;
import com.evolveum.midpoint.repo.sqlbase.mapping.item.NestedMappingResolver;
import com.evolveum.midpoint.repo.sqlbase.querydsl.FlexibleRelationalPathBase;
import com.evolveum.midpoint.schema.GetOperationOptions;
import com.evolveum.midpoint.schema.SelectorOptions;
Expand Down Expand Up @@ -86,19 +85,6 @@ protected QueryTableMapping(
this.defaultAliasName = defaultAliasName;
}

/**
* Creates relation resolver for nested mapping and returns the mapping so the nested items
* can be mapped in a fluent matter.
*/
public final <N> QueryModelMapping<N, Q, R> nestedMapping(
@NotNull ItemName itemName,
@NotNull Class<N> nestedSchemaType) {
QueryModelMapping<N, Q, R> nestedMapping =
new QueryModelMapping<>(nestedSchemaType, queryType());
addRelationResolver(itemName, new NestedMappingResolver<>(nestedMapping));
return nestedMapping;
}

/**
* Fetcher/mappers for detail tables take care of loading to-many details related to
* this mapped entity (master).
Expand Down

0 comments on commit ef983aa

Please sign in to comment.