Class NodeRef


  • public class NodeRef
    extends Object
    Object to reference a node. This can either be done by setting the nodeId or foreignSource AND foreignId 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 Detail

      • getNodeId

        public Integer getNodeId()
      • getForeignSource

        public String getForeignSource()
      • getForeignId

        public String getForeignId()
      • matches

        public boolean matches​(OnmsNode node)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • 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 new NodeRef 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​(String foreignSource,
                                   String foreignId)
        Explicitly use foreignSource and foreignId to create a NodeRef object.
      • from

        public static NodeRef from​(int nodeId,
                                   String foreignSource,
                                   String foreignId)
        Creates a NodeRef with all fields populated
      • from

        public static NodeRef from​(int nodeId)
        Creates a NodeRef with only the nodeId field set.
      • from

        public static List<NodeRef> from​(GenericVertex vertex)
        Creates NodeRefs from a GenericVertex. 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