Interface PerspectiveBasedViewReferenceDefinition

All Superinterfaces:
BundledResource<ViewDefinition>, SupportsClientProperties<ViewDefinition>, ViewDefinition<PerspectiveBasedViewReferenceDefinition>

@NotFinalAPI public interface PerspectiveBasedViewReferenceDefinition extends ViewDefinition<PerspectiveBasedViewReferenceDefinition>
A reference view definition that uses several "enhancing" definitions (perspectives) on a base query or colleciton of CIs.

Perspectives (perspective views in this context) are views connected to queries (perspective query) with at least one node defined as "perspective contact" node (PerspectiveContactable.setAsPerspectiveContact()). On execution, a perspective contact node is restricted by the "previous result" (see below) while the rest of the perspective is not restricted. This can allow perspectives to enrich the "previous result" with more information.

Perspectives are executed in partial order, defined by a List of Set. Each perspective from a specific "level" in the list (N) is restricted by the results of the unioned previous level (N-1). The results of all perspectives from the level are then unioned with the results of the previous level. The "zeroth" perspective "level" is considered the seed query.

* The "zero-th" level of the perspective hierarchy is a set of IDs. These IDs may be explicitly set using withBaseCIsIds(java.util.Collection<com.hp.ucmdb.api.types.UcmdbId>) or implicitly generated from base query (withBaseQueryName(java.lang.String)).

After calculation the result, folding is done by the relevant perspective view. Example:

 Perspective query A: X(contact)-->Y
 Perspective view A:
   X
     Y
 _
 Perspective query B: Y(contact)-->Z
 Perspective view B:
   Y
     Z
 _
 Perspective based view: Ids (x1, x2),
   Perspective hierarchy: {{A},{B}} (ordered levels (list), each level is unordered (set)).
 _
 Result:
   x1     (from ids, from A.X)
     y1   (from A.Y, from B.Y)
       z1 (from B.Z)
   x2     (from ids, from A.X)
     y2   (from A.Y, not from B.y since y2 has no Z connected to it)
 

Perspectives (views and queries) must be saved before execution or save of the perspective based view definition.

In addition to the view name, it is also possible to define a "query name". In this definition, the query name refers to the "top level query" (see QueryManagementService.savePerspectiveApplication(java.lang.String, java.util.List<java.util.Set<java.lang.String>>, java.lang.String, com.hp.ucmdb.api.topology.QueryDefinitionRecalcPriority, com.hp.ucmdb.api.topology.QueryDefinitionFirstLoadStrategy)). This query can be executed independently of the view using the relevant TopologyQueryService.executeQuery() methods. The query options (first load strategy / recalculation priority) refer to this query.

Since:
UCMDB 9.0
  • Method Details

    • perspectives

      List<Set<String>> perspectives()
      The perspective hierarchy (view names).

      This defines the hierarchy of view names that represent perspectives. Each level in the hierarchy is an unordered set and each element acts over the results from the previous hierarchy level. The zero-th level is the IDs, either explicitly set or from the base query name.

    • baseCIsIds

      Collection<UcmdbId> baseCIsIds()
      The base CIs IDs, if set, or empty collection is none is set. Either this must be non-empty or the base query name must be not null for the perspective based view to be valid.
    • withBaseCIsIds

      Sets the base CIs IDs, or resets them if empty collection passed.
      Parameters:
      baseCIsIds - the IDs, or empty collection to reset IDs.
    • baseQueryName

      String baseQueryName()
      The base query name for generating CIs. Either this must not be null or the base CIs IDs must be non-empty for the perspective based view to be valid.
    • withBaseQueryName

      PerspectiveBasedViewReferenceDefinition withBaseQueryName(String baseQueryName)
      Sets the base query name, or resets it if the name is null.

      Either this must not be null or the base CIs IDs must be non-empty for the perspective based view to be valid.

      Parameters:
      baseQueryName - the base query name, or null to reset.
    • excludedCIs

      Collection<UcmdbId> excludedCIs()
      The set of IDs excluded from the result.
    • withExcludedCIs

      Sets the excluded IDs collection, or resets it if passed an empty collection.
      Parameters:
      excludedCIs - the IDs to be excluded, or empty collection.
    • queryName

      String queryName()
      The top level query name. This query may be executed independently of the view to get the underlying topology (perspective already integrated).

      If null when view is saved, the name is created automatically.

      Specified by:
      queryName in interface ViewDefinition<PerspectiveBasedViewReferenceDefinition>
      Returns:
      The name of the query this view is based on.
    • withQueryName

      PerspectiveBasedViewReferenceDefinition withQueryName(String topLevelQueryName)
      The top level query name. This query may be executed independently of the view to get the underlying topology (perspective already integrated).

      If null when view is saved, the name is created automatically.

    • recalcPriority

      Determines how soon the top level query is recalculated after data change.
    • withQueryRecalcPriority

      Sets how soon the top level query is recalculated after data change.

      This is relevant only to perspective based views. Perspective based views that are executed 'ad-hoc' ignore this parameter.

      The default is QueryDefinitionRecalcPriority.LOW.

    • firstLoadStrategy

      Determines when the top level query should first be loaded and calculated.
    • withFirstLoadStrategy

      Sets when the top level query should first be loaded and calculated.

      This is relevant only to perspective based views. Perspective based views that are executed 'ad-hoc' ignore this parameter.

      The default is QueryDefinitionFirstLoadStrategy.LOAD_ON_FIRST_REQUEST.