Class QueryModelMapping<S,​Q extends FlexibleRelationalPathBase<R>,​R>

    • Constructor Detail

      • QueryModelMapping

        public QueryModelMapping​(@NotNull
                                 @NotNull Class<S> schemaType,
                                 @NotNull
                                 @NotNull Class<Q> queryType)
    • Method Detail

      • schemaType

        public Class<S> schemaType()
        Returns schema type as class - refers to midPoint schema, not DB schema.
      • queryType

        public Class<Q> queryType()
      • addItemMapping

        public QueryModelMapping<S,​Q,​R> addItemMapping​(@NotNull
                                                                   @NotNull QName itemName,
                                                                   @NotNull
                                                                   @NotNull ItemSqlMapper itemMapper)
        Adds information how item (attribute) from schema type is mapped to query, especially for condition creating purposes. This is not usable for complex item path resolution, see addRelationResolver(ItemName, ItemRelationResolver) for that purpose. The ItemSqlMapper works as a factory for FilterProcessor that can process ObjectFilter related to the ItemName specified as the first parameter. It is not possible to use filter processor directly because at the time of mapping specification we don't have the actual query path representing the entity or the column. These paths are non-static properties of query class instances. The ItemSqlMapper also provides so called "primary mapping" to a column for ORDER BY part of the filter. But there can be additional column mappings specified as for some types (e.g. poly-strings) there may be other than 1-to-1 mapping. Construction of the ItemSqlMapper is typically simplified by static methods #mapper() provided on various *ItemFilterProcessor classes. This works as a "processor factory factory" and makes table mapping specification simpler.
        Parameters:
        itemName - item name from schema type (see F_* constants on schema types)
        itemMapper - mapper wrapping the information about column mappings working also as a factory for FilterProcessor
      • addRelationResolver

        public QueryModelMapping<S,​Q,​R> addRelationResolver​(@NotNull
                                                                        @NotNull ItemName itemName,
                                                                        @NotNull
                                                                        @NotNull ItemRelationResolver itemRelationResolver)
        Adds information how ItemName (attribute) from schema type is to be resolved when it appears as a component of a complex (non-single) ItemPath. This is in contrast with "item mapping" that is used for single (or last) component of the item path and helps with query interpretation.
      • addNestedMapping

        public <N> QueryModelMapping<N,​Q,​R> addNestedMapping​(@NotNull
                                                                         @NotNull ItemName itemName,
                                                                         @NotNull
                                                                         @NotNull Class<N> nestedSchemaType)
        Creates relation resolver for nested mapping and returns the mapping so the nested items can be mapped in a fluent matter.