Package org.opennms.netmgt.graph.api
Class NodeRef
- java.lang.Object
-
- org.opennms.netmgt.graph.api.NodeRef
-
public class NodeRef extends java.lang.Object
Object to reference a node. This can either be done by setting thenodeId
orforeignSource
ANDforeignId
fields. If created from an OnmsNode all fields may be populated. Note: This should allow for easier node referencing, however it is no guarantee that the node referenced actually exists.- Author:
- mvrueden
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
static NodeRef
from(int nodeId)
Creates aNodeRef
with only thenodeId
field set.static NodeRef
from(int nodeId, java.lang.String foreignSource, java.lang.String foreignId)
Creates aNodeRef
with all fields populatedstatic NodeRef
from(java.lang.String nodeRefCriteria)
Creates a newNodeRef
object from a string.static NodeRef
from(java.lang.String foreignSource, java.lang.String foreignId)
Explicitly use foreignSource and foreignId to create aNodeRef
object.static java.util.List<NodeRef>
from(GenericVertex vertex)
CreatesNodeRef
s from aGenericVertex
.java.lang.String
getForeignId()
java.lang.String
getForeignSource()
java.lang.Integer
getNodeId()
java.util.List<NodeRef>
getVariants()
If nodeId, foreignSource and foreignId are set, this returns multiple variants: nodeId and foreignSource/foreignId node refsint
hashCode()
boolean
matches(OnmsNode node)
-
-
-
Method Detail
-
getNodeId
public java.lang.Integer getNodeId()
-
getForeignSource
public java.lang.String getForeignSource()
-
getForeignId
public java.lang.String getForeignId()
-
matches
public boolean matches(OnmsNode node)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getVariants
public java.util.List<NodeRef> getVariants()
If nodeId, foreignSource and foreignId are set, this returns multiple variants: nodeId and foreignSource/foreignId node refs
-
from
public static NodeRef from(java.lang.String nodeRefCriteria)
Creates a newNodeRef
object from a string. This can be a nodeId, but also a fs:fid string.- Parameters:
nodeRefCriteria
- the criteria- Returns:
- the reference to a node
-
from
public static NodeRef from(java.lang.String foreignSource, java.lang.String foreignId)
Explicitly use foreignSource and foreignId to create aNodeRef
object.
-
from
public static NodeRef from(int nodeId, java.lang.String foreignSource, java.lang.String foreignId)
Creates aNodeRef
with all fields populated
-
from
public static java.util.List<NodeRef> from(GenericVertex vertex)
CreatesNodeRef
s from aGenericVertex
. If multiple properties are set, they are returned in the following order: - reference defined by node id - reference defined by foreignSource/foreignId - reference defined by node criteria string
-
-