Class AbstractObject

  • Direct Known Subclasses:
    GenericObject

    public abstract class AbstractObject
    extends Object
    Abstract base class for all NetXMS objects (both built-in and provided by extensions)
    • Constructor Detail

      • AbstractObject

        protected AbstractObject​(long id,
                                 NXCSession session)
        Create dummy object of GENERIC class
        Parameters:
        id - object ID to set
        session - associated session
      • AbstractObject

        public AbstractObject​(org.netxms.base.NXCPMessage msg,
                              NXCSession session)
        Create object from NXCP message
        Parameters:
        msg - Message to create object from
        session - Associated client session
    • Method Detail

      • isDefaultImage

        public boolean isDefaultImage()
        Check if object should be represented by class default image
        Returns:
        true if default image should be used
      • getParentCount

        public int getParentCount()
        Get number of parent objects
        Returns:
        number of parent objects
      • getParents

        public Iterator<Long> getParents()
        Returns:
        Iterator for list of parent objects
      • getChildren

        public Iterator<Long> getChildren()
        Returns:
        Iterator for list of child objects
      • getUrls

        public List<ObjectUrl> getUrls()
        Get associated URLs
        Returns:
        associated URLs
      • hasUrls

        public boolean hasUrls()
        Check if object has associated URLs
        Returns:
        true if object has associated URLs
      • getComments

        public String getComments()
        Get object's comments.
        Returns:
        object's comments
      • getObjectId

        public long getObjectId()
        Get object ID (unique within single NetXMS server).
        Returns:
        object ID
      • getObjectName

        public String getObjectName()
        Get object name.
        Returns:
        object name
      • getStatus

        public ObjectStatus getStatus()
        Get object status.
        Returns:
        object status
      • isDeleted

        public boolean isDeleted()
        Returns:
        the isDeleted
      • isInheritAccessRights

        public boolean isInheritAccessRights()
        Check setting of "inherit access rights" flag
        Returns:
        true if "inherit access rights" flag is set
      • isChildOf

        public boolean isChildOf​(long objectId)
        Check if given object is direct or indirect parent
        Parameters:
        objectId - ID of object to check
        Returns:
        true if given object is direct or indirect parent of this object
      • isChildOf

        public boolean isChildOf​(long[] objects)
        Check if at least one of given objects is direct or indirect parent
        Parameters:
        objects - List of object ID to check
        Returns:
        true if at least one of given objects is direct or indirect parent of this object
      • isDirectChildOf

        public boolean isDirectChildOf​(long objectId)
        Check if given object is direct parent
        Parameters:
        objectId - ID of object to check
      • isParentOf

        public boolean isParentOf​(long objectId)
        Check if given object is direct or indirect child
        Parameters:
        objectId - ID of object to check
        Returns:
        true if given object is direct or indirect child of this object
      • isParentOf

        public boolean isParentOf​(long[] objects)
        Check if at least one of given objects is direct or indirect child
        Parameters:
        objects - List of object identifiers to check
        Returns:
        true if at least one of given objects is direct or indirect child of this object
      • isDirectParentOf

        public boolean isDirectParentOf​(long objectId)
        Check if given object is direct child
        Parameters:
        objectId - ID of object to check
        Returns:
        true if given object is direct child of this object
      • getParentsAsArray

        public AbstractObject[] getParentsAsArray()
        Returns:
        List of parent objects
      • getChildrenAsArray

        public AbstractObject[] getChildrenAsArray()
        Get all child objects as array.
        Returns:
        Array of child objects
      • getChildIdList

        public long[] getChildIdList()
        Return identifiers of all child objects
        Returns:
        list of children
      • getParentIdList

        public long[] getParentIdList()
        Return identifiers of all parent objects
        Returns:
        list of object parents
      • getAllChildren

        public Set<AbstractObject> getAllChildren​(int classFilter)
        Get all child objects, direct and indirect
        Parameters:
        classFilter - -1 to get all childs, or NetXMS class id to retrieve objects of given class
        Returns:
        set of child objects
      • getAllChildren

        public Set<AbstractObject> getAllChildren​(int[] classFilter)
        Get all child objects, direct and indirect
        Parameters:
        classFilter - null to get all childs, or NetXMS class id(s) to retrieve objects of given class(es)
        Returns:
        set of child objects
      • getAllParents

        public Set<AbstractObject> getAllParents​(int classFilter)
        Get all parent objects, direct and indirect
        Parameters:
        classFilter - -1 to get all parents, or NetXMS class id to retrieve objects of given class
        Returns:
        set of parent objects
      • getAllParents

        public Set<AbstractObject> getAllParents​(int[] classFilter)
        Get all parent objects, direct and indirect
        Parameters:
        classFilter - null to get all parents, or NetXMS class id(s) to retrieve objects of given class(es)
        Returns:
        set of parent objects
      • getTrustedNodes

        public List<AbstractObject> getTrustedNodes()
        Get list of trusted nodes
        Returns:
        List of trusted nodes
      • getDashboards

        public List<AbstractObject> getDashboards​(boolean accessibleOnly)
        Get list of associated dashboards
        Parameters:
        accessibleOnly - if set to true, only accessible dashboards will be returned
        Returns:
        list of the dashboard objects
      • hasParents

        public boolean hasParents()
        Returns:
        true if object has parents
      • hasChildren

        public boolean hasChildren()
        Returns:
        true if object has children
      • hasAccessibleChildren

        public boolean hasAccessibleChildren()
        Returns:
        true if object has children accessible by this session
      • isAllowedOnMap

        public boolean isAllowedOnMap()
        If this method returns true object is allowed to be on custom network map. Default implementation always returns false.
        Returns:
        true if object is allowed to be on custom network map
      • isAlarmsVisible

        public boolean isAlarmsVisible()
        If this method returns true object can have visible alarms. Default implementation always returns false.
        Returns:
        true if object can contain visible alarms
      • getObjectClass

        public int getObjectClass()
        Returns:
        the objectClass
      • getObjectClassName

        public String getObjectClassName()
        Returns:
        Name of NetXMS object's class
      • getCustomAttribute

        public CustomAttribute getCustomAttribute​(String key)
        Get object's custom attribute by key
        Returns:
        custom attribute object or null
      • getCustomAttributeValue

        public String getCustomAttributeValue​(String key)
        Get object's custom attribute's value by key
        Returns:
        custom attribute's value or null
      • getGeolocation

        public org.netxms.base.GeoLocation getGeolocation()
        Returns:
        the geolocation
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getGuid

        public UUID getGuid()
        Returns:
        the guid
      • getImage

        public UUID getImage()
        Returns:
        the image
      • getDrillDownObjectId

        public long getDrillDownObjectId()
        Returns:
        the submapId
      • getStatusCalculationMethod

        public int getStatusCalculationMethod()
        Returns:
        the statusCalculationMethod
      • getStatusPropagationMethod

        public int getStatusPropagationMethod()
        Returns:
        the statusPropagationMethod
      • getFixedPropagatedStatus

        public ObjectStatus getFixedPropagatedStatus()
        Returns:
        the fixedPropagatedStatus
      • getStatusShift

        public int getStatusShift()
        Returns:
        the statusShift
      • getStatusTransformation

        public ObjectStatus[] getStatusTransformation()
        Returns:
        the statusTransformation
      • getStatusSingleThreshold

        public int getStatusSingleThreshold()
        Returns:
        the statusSingleThreshold
      • getStatusThresholds

        public int[] getStatusThresholds()
        Returns:
        the statusThresholds
      • setSession

        public final void setSession​(NXCSession session)
        Update internal session reference during session handover. This method should not be called directly!
        Parameters:
        session - new session object
      • getEffectiveRights

        public int getEffectiveRights()
        Get effective rights for this object. On first call this method will do request to server, and on all subsequent calls will return cached value obtained at first call.
        Returns:
        effective user rights on this object
      • getModuleData

        public Object getModuleData​(String module)
        Get module-specific data
        Parameters:
        module - module name
        Returns:
        custom data in module-specific format
      • getPostalAddress

        public org.netxms.base.PostalAddress getPostalAddress()
        Returns:
        the postalAddress
      • isInMaintenanceMode

        public boolean isInMaintenanceMode()
        Returns:
        the inMaintenanceMode
      • getPrimaryZoneProxyId

        public long getPrimaryZoneProxyId()
        Get primary zone proxy ID
        Returns:
        primary zone proxy ID
      • getBackupZoneProxyId

        public long getBackupZoneProxyId()
        Get backup zone proxy ID
        Returns:
        backup zone proxy ID
      • addString

        protected static void addString​(Set<String> strings,
                                        String s)
        Add string to string set
        Parameters:
        strings -
        s -
      • getStrings

        public Set<String> getStrings()
        Get all strings in object
        Returns:
        set of all strings in object
      • getResponsibleUsers

        public List<Long> getResponsibleUsers()
        Get direct responsible users
        Returns:
        responsible users list
      • getCreationTime

        public Date getCreationTime()
        Returns:
        the creationTime