public class AdaptiveComponent extends QueryComponent
QueryComponent to store additional
information needed when reverting an adaptive query from preselect to dynamic query mode.QueryComponent.ServerJoinData| Modifier and Type | Field and Description |
|---|---|
private DMOSorter |
dmoSorter
DMO sorter associated with this component's sort clause
|
private java.lang.Object[] |
dynamicArgs
Substitution arguments for this component when in dynamic mode
|
private FQLPreprocessor |
dynamicFQLPreprocessor
HQL preprocessor used for dynamic mode
|
private boolean |
dynamicSortMode
Flag denoting whether this component is already in dynamic sort mode or not.
|
private CompoundComponent |
fallback
Compound query component fallback for multi-table, dynamic operation
|
private java.lang.Long |
globalEventID
Event registration ID used to gather index modification events
|
private DataModelObject |
inverse
DMO to which this component should join via a foreign relation.
|
private long |
lastGlobalEventID
ID of last index modification event retrieved from clearinghouse
|
private static CentralLogger |
LOG
Logger
|
private java.lang.String |
originalSort
HQL sort clause associated with this query component, original.
|
private java.lang.String |
originalStaticSort
Copy of the original HQL sort clause associated with this query component.
|
private java.util.List<SortCriterion> |
sortCriteria
Sort criteria associated with this query component.
|
private java.util.List<SortCriterion> |
staticSortCriteria
Copy of the original sort criteria associated with this query component.
|
CURRENT, FIRST, ITERATE, LAST, NEXT, NONE, PREVIOUS, RETRIEVE_MODES, UNIQUE| Constructor and Description |
|---|
AdaptiveComponent(AdaptiveQuery query,
BufferReference proxy,
AbstractJoin join,
java.lang.String where,
java.util.function.Supplier<java.lang.String> translateWhere,
java.lang.String sort,
java.lang.String indexInfo,
LockType lockType,
java.lang.Object[] args,
int iteration,
boolean outer,
BufferReference inverse)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDynamicSortCriterion(FieldReference fr,
boolean asc)
Adds a new sorting criterion as the strongest criterion for sorting the result of this
query.
|
(package private) void |
cleanup()
Clean up when this component is no longer in use.
|
void |
clearDynamicSortCriteria()
Clears all dynamically added criteria.
|
protected java.lang.Object[] |
getArgs()
Get substitution arguments for this component, resolving them first if necessary.
|
(package private) DMOSorter |
getDMOSorter()
Get the DMO sorter associated with this the index used to sort for this query component.
|
(package private) CompoundComponent |
getFallback()
Get the fallback compound component, which is used in the event an optimized, compound,
adaptive query if forced from preselect mode to dynamic mode.
|
protected FQLPreprocessor |
getHQLPreprocessor()
Get the HQL preprocessor associated with this component.
|
(package private) DataModelObject |
getInverse()
Get DMO (proxy) to which this component should join via a foreign relation.
|
protected java.lang.String |
getOriginalSort()
Get sort criteria in HQL order by clause format for this component.
|
(package private) java.util.List<SortCriterion> |
getSortCriteria()
Get the list of sort criteria associated with this query component.
|
(package private) void |
initialize()
Initialize instance variables which could not be set at construction, because they
required a scope to first be opened on the backing buffer.
|
(package private) boolean |
isDirty(boolean localOnly)
Collect and process global events which describe changes made to DMO objects in other
sessions.
|
protected FQLPreprocessor |
prepareHQLPreprocessor(java.lang.Object[] queryArgs)
Create the
HQLPreprocessor which backs this component. |
(package private) void |
processGlobalEvents()
Collect and process global events which describe changes made to DMO objects in other
sessions.
|
private void |
registerForGlobalEvents()
Register to receive global DMO change events, which may cause the current result set of
the containing query to be invalidated.
|
protected void |
resetHQLPreprocessor()
Reset both the preselect and dynamic HQL preprocessors, so that they need to be recreated
the next time one is requested.
|
(package private) void |
setFallback(CompoundComponent fallback)
Set the fallback compound component, which is used in the event an optimized, compound,
adaptive query if forced from preselect mode to dynamic mode.
|
addDynamicFilter, clearDynamicFilters, compositeJoins, enableTranslateWhere, filterArgs, getBuffer, getDefinitionBuffer, getEnclosingQuery, getIndexInfo, getIteration, getJoin, getLockType, getOriginalWhere, getRawArgs, getReferencedBuffers, getRestrictionProperties, getSortIndex, getWhere, isIdOnly, isOuter, prepareServerJoinData, processDynamicFilters, resetArgs, setBuffer, setIteration, setNotTop, setReferenceSubs, setRelatedBuffers, setSortIndex, translateWhereprivate static final CentralLogger LOG
private java.lang.String originalSort
sortCriteria list.private java.lang.String originalStaticSort
originalSort) is only valid while dynamic
sorting criteria are in effect. It is not directly accessed otherwise except when the
dynamic sorting is reverted, the original originalSort is restored.private final DataModelObject inverse
private java.util.List<SortCriterion> sortCriteria
private java.util.List<SortCriterion> staticSortCriteria
sortCriteria) is only valid while dynamic
sorting criteria are in effect. It is not directly accessed otherwise except when the
dynamic sorting is reverted, the original sortCriteria is restored.private DMOSorter dmoSorter
private FQLPreprocessor dynamicFQLPreprocessor
private java.lang.Object[] dynamicArgs
private CompoundComponent fallback
private java.lang.Long globalEventID
private long lastGlobalEventID
private boolean dynamicSortMode
AdaptiveComponent(AdaptiveQuery query, BufferReference proxy, AbstractJoin join, java.lang.String where, java.util.function.Supplier<java.lang.String> translateWhere, java.lang.String sort, java.lang.String indexInfo, LockType lockType, java.lang.Object[] args, int iteration, boolean outer, BufferReference inverse)
query - Enclosing adaptive query.proxy - Reference to record buffer updated by this component of the query.join - Helper object for a join via a foreign key relation. May be null.where - Restriction criteria in HQL where clause format.translateWhere - A function to translate the where clause, just before it gets executed.sort - Sort criteria in HQL order by clause format.indexInfo - Index information string as it is returned by INDEX-INFORMATION. May be null if it is not an OPEN QUERY case or if you don't need debug information about
selected indexes.lockType - Requested record lock type.args - Default (unresolved) query substitution arguments.iteration - Type of iteration: FIRST, LAST, NEXT, PREVIOUS, or UNIQUE.outer - true if this component is joined with the previous component via an outer
join; false if there is no previous component, or if this component is
joined with the previous component via an inner join.inverse - DMO to which this query should join via a foreign relation. May be null.protected FQLPreprocessor getHQLPreprocessor() throws PersistenceException
getHQLPreprocessor in class QueryComponentPersistenceException - if the preprocessor must first be created, and there is an error during its creation.protected FQLPreprocessor prepareHQLPreprocessor(java.lang.Object[] queryArgs) throws PersistenceException
HQLPreprocessor which backs this component.
This method overrides the parent's implementation to also create a secondary HQL preprocessor for use in dynamic fetch mode. This secondary version does not inline any substitution parameters. If the primary version did not inline any such parameters, then both the primary and secondary preprocessors will be the same object.
prepareHQLPreprocessor in class QueryComponentqueryArgs - Query substitution parameters used in the preprocessor's creation.PersistenceException - if there is an error creating the preprocessor.protected java.lang.Object[] getArgs()
throws PersistenceException
getArgs in class QueryComponentPersistenceException - if there is any error creating the FQL preprocessor, which
is necessary to properly filter/order the arguments.protected void resetHQLPreprocessor()
resetHQLPreprocessor in class QueryComponentvoid initialize()
throws PersistenceException
PersistenceException - if there is a database or parsing error.CompoundComponent getFallback()
void setFallback(CompoundComponent fallback)
fallback - Compound query fallback component.void processGlobalEvents()
boolean isDirty(boolean localOnly)
localOnly - Check if the component is dirty only in the current dirty context.true if this component operated over a table with dirty changes.java.util.List<SortCriterion> getSortCriteria()
protected java.lang.String getOriginalSort()
SortCriterion class.DataModelObject getInverse()
null if no such join is defined for this query.DMOSorter getDMOSorter()
void cleanup()
private void registerForGlobalEvents()
public void addDynamicSortCriterion(FieldReference fr, boolean asc)
Use clearDynamicSortCriteria() to clean all dynamically added criteria and restore
the sorting order of the query to its original form.
fr - A reference to field used as new strongest criterion. The current criteria will
be kept, but with lower priority.asc - The direction of sorting for this criterion. Use true for ascending sort
and false for descending sorting.public void clearDynamicSortCriteria()