Package org.opennms.netmgt.graph.api
Class NodeRef
- java.lang.Object
-
- org.opennms.netmgt.graph.api.NodeRef
-
public class NodeRef extends Object
Object to reference a node. This can either be done by setting thenodeIdorforeignSourceANDforeignIdfields. 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 booleanequals(Object o)static NodeReffrom(int nodeId)Creates aNodeRefwith only thenodeIdfield set.static NodeReffrom(int nodeId, String foreignSource, String foreignId)Creates aNodeRefwith all fields populatedstatic NodeReffrom(String nodeRefCriteria)Creates a newNodeRefobject from a string.static NodeReffrom(String foreignSource, String foreignId)Explicitly use foreignSource and foreignId to create aNodeRefobject.static List<NodeRef>from(GenericVertex vertex)CreatesNodeRefs from aGenericVertex.StringgetForeignId()StringgetForeignSource()IntegergetNodeId()List<NodeRef>getVariants()If nodeId, foreignSource and foreignId are set, this returns multiple variants: nodeId and foreignSource/foreignId node refsinthashCode()booleanmatches(OnmsNode node)
-
-
-
Method Detail
-
getNodeId
public Integer getNodeId()
-
getForeignSource
public String getForeignSource()
-
getForeignId
public String getForeignId()
-
matches
public boolean matches(OnmsNode node)
-
getVariants
public 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(String nodeRefCriteria)
Creates a newNodeRefobject 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(String foreignSource, String foreignId)
Explicitly use foreignSource and foreignId to create aNodeRefobject.
-
from
public static NodeRef from(int nodeId, String foreignSource, String foreignId)
Creates aNodeRefwith all fields populated
-
from
public static List<NodeRef> from(GenericVertex vertex)
CreatesNodeRefs 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
-
-