Interface QueryReferenceDefinition<T extends QueryReferenceDefinition>

All Superinterfaces:
BundledResource<QueryReferenceDefinition>
All Known Subinterfaces:
MultipleReferencesWithFunctionDefinition, SingleQueryReferenceDefinition

@NotFinalAPI public interface QueryReferenceDefinition<T extends QueryReferenceDefinition> extends BundledResource<QueryReferenceDefinition>
Parent interface for reference definitions.

Reference definitions rely on other queries which may be reference or "regular". References act recursively, but not in a cycle. If the original query changes, the reference definition is updated.

The query or queries the reference definition relies on are called "base queries".
The reference definition is sometimes called "QueryRef".

The actual details of the relation between the reference query and the base query depend on the definition used, which can be learned using the referenceDefinitionType() method.

Since:
UCMDB 9.0
  • Method Details

    • name

      String name()
      The name of the query definition.
      Returns:
      The name of the query definition.
    • description

      String description()
      A human-readable description of the query definition purpose.
      Returns:
      A human-readable description of the query definition purpose.
    • withDescription

      T withDescription(String description)
      Sets a human-readable description of the query definition purpose.
      Parameters:
      description - the description.
      Returns:
      this object for method chaining.
    • recalcPriority

      The value that determines how soon a saved query is recalculated after data change.
      Returns:
      the value that determines how soon a saved query is recalculated after data change.
      See Also:
    • withRecalcPriority

      T withRecalcPriority(QueryDefinitionRecalcPriority recalcPriority)
      Sets how soon a saved query is recalculated after data change.

      This applies only to saved queries. Query definitions that are executed 'ad-hoc' ignore this parameter.

      The default is QueryDefinitionRecalcPriority.LOW.

      The recalcPriority value cannot be higher than the referenced query or queries.

    • firstLoadStrategy

      The values that determines when a saved query should first be loaded and calculated.
      Returns:
      The values that determines when a saved query should first be loaded and calculated.
      See Also:
    • withFirstLoadStrategy

      T withFirstLoadStrategy(QueryDefinitionFirstLoadStrategy firstLoadStrategy)
      Sets when a saved query should first be loaded and calculated.

      This applies only to saved queries. Query definitions that are executed 'ad-hoc' ignore this parameter.

      The default is QueryDefinitionFirstLoadStrategy.LOAD_ON_FIRST_REQUEST.

      The firstLoadStrategy value used cannot be higher than the referenced query or queries.

    • toExecutable

      ExecutableQuery toExecutable()
      Converts this query definition into an executable query object for passing to TopologyQueryService.executeQuery(ExecutableQuery).
    • referenceDefinitionType

      QueryType referenceDefinitionType()
      Returns the type of this reference definition.

      This method never returns QueryType.DEFINITION_BASED.

      Returns:
      the reference definition type.
    • asSingleQueryReferenceDefinition

      SingleQueryReferenceDefinition asSingleQueryReferenceDefinition() throws ClassCastException
      Returns this interface as a SingleQueryReferenceDefinition. Throws ClassCastException if the type from referenceDefinitionType() is not QueryType.SINGLE_REFERENCE
      Returns:
      this interface, cast to SingleQueryReferenceDefinition.
      Throws:
      ClassCastException - if referenceDefinitionType() is not QueryType.SINGLE_REFERENCE.
    • asMultipleReferencesWithFunctionDefinition

      MultipleReferencesWithFunctionDefinition asMultipleReferencesWithFunctionDefinition() throws ClassCastException
      Returns this interface as a MultipleReferencesWithFunctionDefinition . Throws ClassCastException if the type from referenceDefinitionType() is not QueryType.MULTIPLE_REFERENCES_WITH_FUNCTION
      Returns:
      this interface, cast to MultipleReferencesWithFunctionDefinition.
      Throws:
      ClassCastException - if referenceDefinitionType() is not QueryType.MULTIPLE_REFERENCES_WITH_FUNCTION.