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

  • Type Parameters:
    S - schema type of the mapped object (potentially in nested mapping)
    Q - query entity type
    R - row type related to the SqaleUpdateContext
    Direct Known Subclasses:
    ContainerTableUpdateContext, ExtensionUpdateContext, NestedContainerUpdateContext, RootUpdateContext

    public abstract class SqaleUpdateContext<S,​Q extends FlexibleRelationalPathBase<R>,​R>
    extends Object
    Update context manages state information related to the currently executed modify operation. Contexts can be nested for any non-trivial updates where each instance matches the changed item and its mapping. RootUpdateContext is the top level parent context that holds the main object. For example, given a path `assignment/1/metadata/channel`: * RootUpdateContext is created for the object, imagine it at the root of the path. * ContainerTableUpdateContext is created for `assignment/1` part under the root context. * NestedContainerUpdateContext is created for `metadata` part. * One of ItemDeltaValueProcessor is then created for `channel` based on the type of the property (in this case UriItemDeltaProcessor) which processes actual values and uses the context above to do so. In this example channel is single-valued property and will be changed adding a `SET` clause to the `UPDATE` held by the container table update context. This `UPDATE` will use proper `WHERE` clause negotiated between this context and its parent, which in this case is the root context, using also the container ID provided in the item path. Nested container context merely "focuses" from assignment container to its metadata, but the table is still the same. This class also coordinates final update execution for the whole context tree implemented as a template method finishExecution() called from the RootUpdateContext. Subclasses implement their specific logic in finishExecutionOwn().
    • Field Detail

      • logger

        protected final Trace logger
      • row

        protected final R row
      • parentContext

        protected final SqaleUpdateContext<?,​?,​?> parentContext
        Parent is typically used to do some work for the child like when nested container uses the parent's UPDATE clause.
      • subcontexts

        protected final Map<ItemPath,​SqaleUpdateContext<?,​?,​?>> subcontexts
        Map of subcontext for known ItemPath sub-paths relative to this context. ItemName is not enough to represent multi-value container paths like `assignment/1`. PathKeyedMap is used to ignore rare, but possible, namespace discrepancies (MID-8258). Ignoring namespaces here is acceptable, because it is only used for known built-in containers.
    • Method Detail

      • row

        public R row()
      • entityPath

        public abstract Q entityPath()
        Returns entity path (table) for the context. This is NOT the path for item column, which can be actually multiple columns (ref, poly) or just part of the value in the column (JSONB).
      • set

        public abstract <P extends com.querydsl.core.types.Path<T>,​T> void set​(P path,
                                                                                     T value)
      • set

        public abstract <P extends com.querydsl.core.types.Path<T>,​T> void set​(P path,
                                                                                     com.querydsl.core.types.Expression<T> value)
      • setNull

        public abstract <P extends com.querydsl.core.types.Path<T>,​T> void setNull​(P path)
      • findValueOrItem

        public final <O> O findValueOrItem​(@NotNull
                                           @NotNull Object... path)
      • findValueOrItem

        public <O> O findValueOrItem​(@NotNull
                                     @NotNull ItemPath path)
      • isOverwrittenId

        public boolean isOverwrittenId​(Long id)