Class FetchContext
java.lang.Object
no.sikt.graphitron.generators.context.FetchContext
A helper class to handle traversal of nested types in queries. Since such queries will require nested layers of rows,
this class can generate the next "iteration" of itself for handling deeper layers.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionFetchContext(ProcessedSchema processedSchema, ObjectField referenceObjectField, RecordObjectSpecification<?> previousObject, boolean addAllJoinsToJoinSet) FetchContext(ProcessedSchema processedSchema, ObjectField referenceObjectField, RecordObjectSpecification<?> previousObject, boolean addAllJoinsToJoinSet, boolean useTableWithoutAliasInFirstStep) -
Method Summary
Modifier and TypeMethodDescriptioncreateJoinOnExplicitPathFor(FieldReference fRef, JOOQMapping keyOverride, JoinListSequence joinSequence, JOOQMapping tableNameBackup, boolean isNullable) List<no.sikt.graphitron.javapoet.CodeBlock> getGraphPath(GenerationField field) booleanbooleanbooleaniterateJoinSequence(JoinListSequence previousSequence) Iterate the table sequence as if several context layers were traversed.Iterate the table sequence as if several context layers were traversed with the provided references.nextContext(GenerationField referenceObjectField) Retrieves and removes a one-to-many EXISTS join along with any associated conditions (e.g., from @condition).no.sikt.graphitron.javapoet.CodeBlockrenderQuerySource(JOOQMapping localTable) voidOverride the previous layer's use of an expanded null check.boolean
-
Constructor Details
-
FetchContext
public FetchContext(ProcessedSchema processedSchema, ObjectField referenceObjectField, RecordObjectSpecification<?> previousObject, boolean addAllJoinsToJoinSet) - Parameters:
referenceObjectField- The referring field that contains an object.previousObject- Object of origin for this context.
-
FetchContext
public FetchContext(ProcessedSchema processedSchema, ObjectField referenceObjectField, RecordObjectSpecification<?> previousObject, boolean addAllJoinsToJoinSet, boolean useTableWithoutAliasInFirstStep)
-
-
Method Details
-
getJoinSet
- Returns:
- Set of joins created by this context.
-
pollExistsJoin
Retrieves and removes a one-to-many EXISTS join along with any associated conditions (e.g., from @condition). The join and conditions were diverted from joinSet/conditionList by resolveNextSequence to avoid row duplication. -
getAliasSet
- Returns:
- Set of aliases created by this and any other context created from this one.
-
getGraphPath
- Returns:
- The path to the schema field in this context. Used to correctly check selection sets.
-
getReferenceObject
- Returns:
- The referred object being processed in the current context.
-
getCurrentJoinSequence
- Returns:
- The table join path or alias where the columns are expected to be found.
-
getConditionList
- Returns:
- List of all conditions created up to this point.
-
getReferenceTable
- Returns:
- The reference table the reference field points to.
-
getPreviousTable
- Returns:
- The previously used reference table.
-
getTargetTable
- Returns:
- The target table of this context.
-
getTargetTableName
- Returns:
- The target table name of this context.
-
getSourceAlias
-
getTargetAlias
- Returns:
- The target table alias of this context.
-
getReferenceOrPreviousTable
- Returns:
- The reference table which fields on this layer are taken from.
-
getReferenceObjectField
- Returns:
- The reference field which points to the reference object for this layer.
-
getConditionSourceFields
- Returns:
- The sources for conditions that could not be applied in previous steps.
-
getResolverKey
-
hasApplicableTable
public boolean hasApplicableTable() -
hasNonSubqueryFields
public boolean hasNonSubqueryFields() -
hasPreviousContext
public boolean hasPreviousContext() -
shouldUseEnhancedNullOnAllNullCheck
public boolean shouldUseEnhancedNullOnAllNullCheck()- Returns:
- Should this layer apply an expanded null check?
-
setParentContextShouldUseEnhancedNullOnAllNullCheck
public void setParentContextShouldUseEnhancedNullOnAllNullCheck()Override the previous layer's use of an expanded null check. -
nextContext
- Returns:
- The next iteration of this context based on the provided reference field.
-
forVirtualField
-
iterateJoinSequenceFor
Iterate the table sequence as if several context layers were traversed with the provided references.- Returns:
- The new join sequence, with the provided join sequence extended by all references in this layer's reference field, or other appropriate start points for a sequence.
-
iterateJoinSequence
Iterate the table sequence as if several context layers were traversed.- Returns:
- The new join sequence, with the provided join sequence extended by all references in this layer's reference field, or other appropriate start points for a sequence.
-
createJoinOnExplicitPathFor
public SQLJoinStatement createJoinOnExplicitPathFor(FieldReference fRef, JOOQMapping keyOverride, JoinListSequence joinSequence, JOOQMapping tableNameBackup, boolean isNullable) - Returns:
- A join statement based on a key reference using path
-
renderQuerySource
-