com.hp.ucmdb.api.topology
Interface QueryLink<QL extends QueryLink<QL>>

Type Parameters:
QL - The query link actual interface type, used for method chaining.
All Superinterfaces:
SupportsInvisibility<QueryLink<QL>>
All Known Subinterfaces:
DirectLink, OnPropertiesLink

public interface QueryLink<QL extends QueryLink<QL>>
extends SupportsInvisibility<QueryLink<QL>>

A link in the query definition.

A link in the query definition may add to the result, be used to constraint the result or both.
A link has:

Cardinality

In addition to conditions and information about the link itself, a query link is also a part of two expression trees - the source node expression tree and the target node expression tree.

By default, a link is added with an "and" condition to the top of both expression trees, with cardinality 1..* (unbounded), which is the same as saying:
"A CI is valid as a result of the source node only if there is at least one outgoing link between it and a CI matching the target node. A CI is valid as a result of the target node only if there is at least one incoming link between it and a CI matching the source node."

These conditions may be changed either:

Since:
UCMDB 9.0

Field Summary
static int UNBOUNDED
          Represents an unbounded cardinality value.
 
Method Summary
 DirectLink asDirectLink()
          Returns this object as a DirectLink.
 com.hp.ucmdb.api.topology.indirectlink.IndirectLink asIndirectLink()
          Returns this object as an IndirectLink.
 OnPropertiesLink asOnPropertiesLink()
          Returns this object as an OnPropertiesLink.
 QL atLeast(int minSourceCardinality)
          Replaces the minimum cardinality of all instances of this query link in the source expression tree with the new values.
 QL atMost(int maxSourceCardinality)
          Replaces the maximum cardinality of all instances of this query link in the source expression tree with the new value.
 QL exactly(int sourceCardinality)
          Replaces the minimum cardinality of all instances of this query link in the source expression tree with the new value.
 QueryNode getFromNode()
          Deprecated. use sourceNode().
 QueryNode getToNode()
          Deprecated. use targetNode().
 java.lang.String name()
          The name of this link in the query definition it belongs to.
 QueryLinkType queryLinkType()
          The link type.
 QL restrictToSelfLinks()
          Sets the self link filter to "restrict to self links" mode.
 SelfLinkFilter selfLinkFilter()
          Returns the self link filter.
 QL setSelfLinkFilter(SelfLinkFilter selfLinkMode)
          Sets the self link filter.
 int sourceMaxCardinality()
          Returns the maximum of all of the maximum cardinalities set for this query link in the source expression tree.
 int sourceMinCardinality()
          Returns the minimum of all of the minimum cardinalities set for this query link in the source expression tree.
 QueryNode sourceNode()
          Returns the node the link of this link comes from.
 int targetMaxCardinality()
          Returns the maximum of all of the maximum cardinalities set for this query link in the target expression tree.
 int targetMinCardinality()
          Returns the minimum of all of the minimum cardinalities set for this query link in the target expression tree.
 QueryNode targetNode()
          Returns the node the link of this link goes to.
 QL withName(java.lang.String name)
          Sets the name of this link.
Setting the name does not change any bind-by-name resource (non-query definition resources) to match the new name.
Changing the name changes the #hashCode of this object.
 QL withoutSelfLinks()
          Sets the self link filter to "restrict to non-self links" mode.
 QL withSourceCardinality(int minimumCardinality, int maximumCardinality)
          Replaces the cardinality of all instances of this query link in the source expression tree with the new values.
 QL withTargetCardinality(int minimumCardinality, int maximumCardinality)
          Replaces the cardinality of all the instances of this query link in the target expression tree with the new values.
 
Methods inherited from interface com.hp.ucmdb.api.topology.SupportsInvisibility
invisible, isInvisible
 

Field Detail

UNBOUNDED

static final int UNBOUNDED
Represents an unbounded cardinality value.

See Also:
Constant Field Values
Method Detail

name

java.lang.String name()
The name of this link in the query definition it belongs to.

See Also:
withName(String)

withName

QL withName(java.lang.String name)
Sets the name of this link.
Setting the name does not change any bind-by-name resource (non-query definition resources) to match the new name.
Changing the name changes the #hashCode of this object.

Returns:
this object. The returned object can be used for method chaining.
See Also:
name()

getFromNode

@Deprecated
QueryNode getFromNode()
Deprecated. use sourceNode().

Returns the node the link of this link comes from.


sourceNode

QueryNode sourceNode()
Returns the node the link of this link comes from.


getToNode

@Deprecated
QueryNode getToNode()
Deprecated. use targetNode().

Returns the node the link of this link goes to.


targetNode

QueryNode targetNode()
Returns the node the link of this link goes to.


withSourceCardinality

QL withSourceCardinality(int minimumCardinality,
                         int maximumCardinality)
Replaces the cardinality of all instances of this query link in the source expression tree with the new values.

Parameters:
minimumCardinality - the minimum number of links.
maximumCardinality - the maximum number of links.
Returns:
this object. The returned object can be used for method chaining.

withTargetCardinality

QL withTargetCardinality(int minimumCardinality,
                         int maximumCardinality)
Replaces the cardinality of all the instances of this query link in the target expression tree with the new values.

Parameters:
minimumCardinality - the minimum number of links.
maximumCardinality - the maximum number of links.
Returns:
this object. The returned object can be used for method chaining.

sourceMinCardinality

int sourceMinCardinality()
Returns the minimum of all of the minimum cardinalities set for this query link in the source expression tree.


sourceMaxCardinality

int sourceMaxCardinality()
Returns the maximum of all of the maximum cardinalities set for this query link in the source expression tree.


targetMinCardinality

int targetMinCardinality()
Returns the minimum of all of the minimum cardinalities set for this query link in the target expression tree.


targetMaxCardinality

int targetMaxCardinality()
Returns the maximum of all of the maximum cardinalities set for this query link in the target expression tree.


atLeast

QL atLeast(int minSourceCardinality)
Replaces the minimum cardinality of all instances of this query link in the source expression tree with the new values.

Equivalent to withSourceCardinality(minSourceCardinality, sourceMaxCardinality());

Parameters:
minSourceCardinality - the minimum number of links.
Returns:
this object. The returned object can be used for method chaining.

atMost

QL atMost(int maxSourceCardinality)
Replaces the maximum cardinality of all instances of this query link in the source expression tree with the new value.

Equivalent to withSourceCardinality(sourceMinCardinality(), maxSourceCardinality);

Parameters:
maxSourceCardinality - the maximum number of links.
Returns:
this object. The returned object can be used for method chaining.

exactly

QL exactly(int sourceCardinality)
Replaces the minimum cardinality of all instances of this query link in the source expression tree with the new value.

Equivalent to withSourceCardinality(sourceMinCardinality(), sourceMaxCardinality());

Parameters:
SourceCardinality - the minimum number of links.
Returns:
this object. The returned object can be used for method chaining.

queryLinkType

QueryLinkType queryLinkType()
The link type.

Returns:
the type of the link.

asDirectLink

DirectLink asDirectLink()
                        throws java.lang.ClassCastException
Returns this object as a DirectLink.

Returns:
this object as a DirectLink. If queryLinkType() is not QueryLinkType.DIRECT_LINK, a class cast exception is thrown.
Throws:
java.lang.ClassCastException

asIndirectLink

com.hp.ucmdb.api.topology.indirectlink.IndirectLink asIndirectLink()
                                                                   throws java.lang.ClassCastException
Returns this object as an IndirectLink.

Returns:
this object as an IndirectLink. If queryLinkType() is not QueryLinkType.INDIRECT_LINK, a class cast exception is thrown.
Throws:
java.lang.ClassCastException

asOnPropertiesLink

OnPropertiesLink asOnPropertiesLink()
                                    throws java.lang.ClassCastException
Returns this object as an OnPropertiesLink.

Returns:
this object as an OnPropertiesLink. If queryLinkType() is not QueryLinkType.ON_PROPERTIES_LINK, a class cast exception is thrown.
Throws:
java.lang.ClassCastException

restrictToSelfLinks

QL restrictToSelfLinks()
Sets the self link filter to "restrict to self links" mode.

Calling this method restricts links answering this QueryLink to have the same CI as both source and target. The CI can come from different QueryNodes, but its ID must be the same.

Returns:
this object. The returned object can be used for method chaining.

withoutSelfLinks

QL withoutSelfLinks()
Sets the self link filter to "restrict to non-self links" mode.

Calling this method restricts links answering this QueryLink to links that do not have the same CI as both source and target. Links that start and end with the same CI, even if from different QueryNodes, will be omitted from the result of this QueryLink.

Returns:
this object. The returned object can be used for method chaining.

setSelfLinkFilter

QL setSelfLinkFilter(SelfLinkFilter selfLinkMode)
Sets the self link filter.

The self link filter may, if set, filter self-links (identical source and target) or filter non-self links (different source and target).

Returns:
this object. The returned object can be used for method chaining.

selfLinkFilter

SelfLinkFilter selfLinkFilter()
Returns the self link filter.

Returns:
the self link filter.
See Also:
setSelfLinkFilter(SelfLinkFilter)


Documentation Feedback
Copyright 2010 Hewlett-Packard Development Company, L.P.