public interface QueryDefinition extends BundledResource<QueryDefinition>
QueryDefinition queryDefinition = topologyQueryFactory.createQueryDefinition("Get Hosts by IDs"); QueryNode queryNode = queryDefinition.addNode("Hosts").ofType("host").withIds(ids); queryNode.queryPropertiesWithQualifier("COMPARABLE").queryProperties("host_key", "host_iscomplete");Full description: Retrieve all CIs of type "host" or a descendant type, using "ids". ids is assumed as a parameter for the code. Also retrieves all properties marked "comparable" and the properties "host_key" and "host_iscomplete" for all CIs in the result topology.
QueryDefinition queryDefinition = topologyQueryFactory.createQueryDefinition("Get Hosts"); QueryNode queryNode = queryDefinition.addNode("Hosts").ofType("host"); queryNode.property("host_key").like("T%").caseInsensitive(); queryNode.property("host_iscomplete").isNull(); queryNode.queryKeyProperties();Full description: Retrieve all CIs of type "host" or a descendant where:
QueryDefinition queryDefinition = topologyQueryFactory.createQueryDefinition("Get hosts' neighbors"); QueryNode cisNode = queryDefinition.addNode("CIs").ofType("host").withIdsOf(hosts_ids).invisible(); QueryNode neighborsNode = queryDefinition.addNode("Neighbors").ofType("configuration_item"); neighborsNode.queryKeyProperties(); cisNode.linkedTo(neighborsNode).ofITWorldType().invisible();Full description: Retreive all CIs that are neighbours if hosts with the given ids. host_ids assumed as a parameter the code. Both the host CIs and the link between the hosts and their neighbours are invisible - they do not return in the result topology. Also retrieves the key property for these neighbours CIs.
Modifier and Type | Method and Description |
---|---|
QueryNode |
addNode(String nodeName)
Adds a new node to the query.
|
String |
baseQueryName() |
QueryResultConsumingType |
consumingType()
Returns the setting for the consuming type and notification setting of the query..
|
String |
debugDescription()
Returns a human-readable full description of this query definition to be used debugging the query definition.
|
String |
description() |
QueryDefinitionFirstLoadStrategy |
firstLoadStrategy()
Returns the setting for when a saved query should first be loaded and calculated.
|
QueryLink |
getLink(String linkName)
Returns the query link with the specified name or null if node does not exist.
|
QueryNode |
getNode(String nodeName)
Returns the node with the specified name or null if node does not exist.
|
Map<String,? extends QueryLink> |
links()
Returns the links defined in this query as a map of names to links.
|
String |
name() |
Map<String,? extends QueryNode> |
nodes()
Returns the nodes defined in this query as a map of names to nodes.
|
QueryDefinitionRecalcPriority |
recalcPriority()
Returns the setting for how soon a saved query is recalculated after data change.
|
boolean |
removeLink(String linkName)
Removes the named link from this query definition.
|
boolean |
removeNode(String nodeName)
Removes the named node from this query definition.
|
ExecutableQuery |
toExecutable()
Converts this query definition into an executable query object for passing to
TopologyQueryService.executeQuery(ExecutableQuery) . |
QueryDefinition |
withBaseQueryName(String baseQueryName)
Sets this query to run over the result of another query.
|
QueryDefinition |
withDescription(String description)
Sets a human-readable description of the query definition purpose.
|
QueryDefinition |
withFirstLoadStrategy(QueryDefinitionFirstLoadStrategy firstLoadStrategy)
Sets when a saved query should first be loaded and calculated.
|
QueryDefinition |
withFullyCachedStoring()
Sets how a query should be saved and which of notifications are required.
|
NonCachedQueryResultConsumingType |
withNonCachedStoring()
Sets that a query result will not be cached in result-repository
Note: The default behavior for saved query id FULLY-CACHED.
|
PartiallyCachedQueryResultConsumingType |
withPartiallyCachedStoring()
Sets that a query result will not be partially cached in result-repository.
|
QueryDefinition |
withRecalcPriority(QueryDefinitionRecalcPriority recalcPriority)
Sets how soon a saved query is recalculated after data change.
|
bundleNames, withBundles
String name()
String description()
QueryDefinition withDescription(String description)
description
- the description.QueryNode addNode(String nodeName)
ofType
or the strictlyOfType
method.nodeName
- name of this node. The name must be unique in this query.QueryNode getNode(String nodeName)
QueryLink getLink(String linkName)
Map<String,? extends QueryNode> nodes()
Map<String,? extends QueryLink> links()
ExecutableQuery toExecutable()
TopologyQueryService.executeQuery(ExecutableQuery)
.QueryDefinitionRecalcPriority recalcPriority()
QueryDefinition withRecalcPriority(QueryDefinitionRecalcPriority recalcPriority)
QueryDefinitionFirstLoadStrategy firstLoadStrategy()
QueryDefinition withFirstLoadStrategy(QueryDefinitionFirstLoadStrategy firstLoadStrategy)
QueryResultConsumingType consumingType()
QueryDefinition withFullyCachedStoring()
NonCachedQueryResultConsumingType withNonCachedStoring()
PartiallyCachedQueryResultConsumingType withPartiallyCachedStoring()
String debugDescription()
@NotFinalAPI QueryDefinition withBaseQueryName(String baseQueryName)
baseQueryName
- name of the query that specifies the "universe" for this query to run on, or null to disable
this feature. May not be empty string.ExecutableQuery.onTopOfQuery(java.lang.String)
@NotFinalAPI String baseQueryName()
withBaseQueryName(String)
@NotFinalAPI boolean removeLink(String linkName)
linkName
- the name of the link to remove.@NotFinalAPI boolean removeNode(String nodeName)
nodeName
- the name of the node to remove. Documentation Feedback
Copyright 2011 - 2018 Micro Focus or one of its affiliates.