Class AbstractObject

java.lang.Object
org.netxms.client.objects.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)
  • Field Details

    • NETWORK

      public static final long NETWORK
      Entire network
      See Also:
    • SERVICEROOT

      public static final long SERVICEROOT
      Infrastructure Services
      See Also:
    • TEMPLATEROOT

      public static final long TEMPLATEROOT
      Templates
      See Also:
    • ZONE0

      public static final long ZONE0
      Default zone
      See Also:
    • ASSETS

      public static final long ASSETS
      Assets
      See Also:
    • NETWORKMAPROOT

      public static final long NETWORKMAPROOT
      Network Maps
      See Also:
    • DASHBOARDROOT

      public static final long DASHBOARDROOT
      Dashboards
      See Also:
    • BUSINESSSERVICEROOT

      public static final long BUSINESSSERVICEROOT
      Business Services
      See Also:
    • CONTEXT

      public static final long CONTEXT
      Context object indicator
      See Also:
    • OBJECT_GENERIC

      public static final int OBJECT_GENERIC
      See Also:
    • OBJECT_SUBNET

      public static final int OBJECT_SUBNET
      See Also:
    • OBJECT_NODE

      public static final int OBJECT_NODE
      See Also:
    • OBJECT_INTERFACE

      public static final int OBJECT_INTERFACE
      See Also:
    • OBJECT_NETWORK

      public static final int OBJECT_NETWORK
      See Also:
    • OBJECT_CONTAINER

      public static final int OBJECT_CONTAINER
      See Also:
    • OBJECT_ZONE

      public static final int OBJECT_ZONE
      See Also:
    • OBJECT_SERVICEROOT

      public static final int OBJECT_SERVICEROOT
      See Also:
    • OBJECT_TEMPLATE

      public static final int OBJECT_TEMPLATE
      See Also:
    • OBJECT_TEMPLATEGROUP

      public static final int OBJECT_TEMPLATEGROUP
      See Also:
    • OBJECT_TEMPLATEROOT

      public static final int OBJECT_TEMPLATEROOT
      See Also:
    • OBJECT_NETWORKSERVICE

      public static final int OBJECT_NETWORKSERVICE
      See Also:
    • OBJECT_VPNCONNECTOR

      public static final int OBJECT_VPNCONNECTOR
      See Also:
    • OBJECT_CONDITION

      public static final int OBJECT_CONDITION
      See Also:
    • OBJECT_CLUSTER

      public static final int OBJECT_CLUSTER
      See Also:
    • OBJECT_BUSINESSSERVICEPROTOTYPE

      public static final int OBJECT_BUSINESSSERVICEPROTOTYPE
      See Also:
    • OBJECT_ASSET

      public static final int OBJECT_ASSET
      See Also:
    • OBJECT_ASSETGROUP

      public static final int OBJECT_ASSETGROUP
      See Also:
    • OBJECT_ASSETROOT

      public static final int OBJECT_ASSETROOT
      See Also:
    • OBJECT_NETWORKMAPROOT

      public static final int OBJECT_NETWORKMAPROOT
      See Also:
    • OBJECT_NETWORKMAPGROUP

      public static final int OBJECT_NETWORKMAPGROUP
      See Also:
    • OBJECT_NETWORKMAP

      public static final int OBJECT_NETWORKMAP
      See Also:
    • OBJECT_DASHBOARDROOT

      public static final int OBJECT_DASHBOARDROOT
      See Also:
    • OBJECT_DASHBOARD

      public static final int OBJECT_DASHBOARD
      See Also:
    • OBJECT_BUSINESSSERVICEROOT

      public static final int OBJECT_BUSINESSSERVICEROOT
      See Also:
    • OBJECT_BUSINESSSERVICE

      public static final int OBJECT_BUSINESSSERVICE
      See Also:
    • OBJECT_COLLECTOR

      public static final int OBJECT_COLLECTOR
      See Also:
    • OBJECT_MOBILEDEVICE

      public static final int OBJECT_MOBILEDEVICE
      See Also:
    • OBJECT_RACK

      public static final int OBJECT_RACK
      See Also:
    • OBJECT_ACCESSPOINT

      public static final int OBJECT_ACCESSPOINT
      See Also:
    • OBJECT_WIRELESSDOMAIN

      public static final int OBJECT_WIRELESSDOMAIN
      See Also:
    • OBJECT_CHASSIS

      public static final int OBJECT_CHASSIS
      See Also:
    • OBJECT_DASHBOARDGROUP

      public static final int OBJECT_DASHBOARDGROUP
      See Also:
    • OBJECT_SENSOR

      public static final int OBJECT_SENSOR
      See Also:
    • OBJECT_CUSTOM

      public static final int OBJECT_CUSTOM
      See Also:
    • CALCULATE_DEFAULT

      public static final int CALCULATE_DEFAULT
      See Also:
    • CALCULATE_MOST_CRITICAL

      public static final int CALCULATE_MOST_CRITICAL
      See Also:
    • CALCULATE_SINGLE_THRESHOLD

      public static final int CALCULATE_SINGLE_THRESHOLD
      See Also:
    • CALCULATE_MULTIPLE_THRESHOLDS

      public static final int CALCULATE_MULTIPLE_THRESHOLDS
      See Also:
    • PROPAGATE_DEFAULT

      public static final int PROPAGATE_DEFAULT
      See Also:
    • PROPAGATE_UNCHANGED

      public static final int PROPAGATE_UNCHANGED
      See Also:
    • PROPAGATE_FIXED

      public static final int PROPAGATE_FIXED
      See Also:
    • PROPAGATE_RELATIVE

      public static final int PROPAGATE_RELATIVE
      See Also:
    • PROPAGATE_TRANSLATED

      public static final int PROPAGATE_TRANSLATED
      See Also:
    • session

      protected NXCSession session
    • objectId

      protected long objectId
    • guid

      protected UUID guid
    • objectName

      protected String objectName
    • alias

      protected String alias
    • nameOnMap

      protected String nameOnMap
    • objectClass

      protected int objectClass
    • categoryId

      protected int categoryId
    • flags

      protected int flags
    • status

      protected ObjectStatus status
    • isDeleted

      protected boolean isDeleted
    • inMaintenanceMode

      protected boolean inMaintenanceMode
    • maintenanceInitiatorId

      protected int maintenanceInitiatorId
    • primaryZoneProxyId

      protected long primaryZoneProxyId
    • backupZoneProxyId

      protected long backupZoneProxyId
    • comments

      protected String comments
    • commentsSource

      protected String commentsSource
    • geolocation

      protected GeoLocation geolocation
    • postalAddress

      protected PostalAddress postalAddress
    • mapImage

      protected UUID mapImage
    • drillDownObjectId

      protected long drillDownObjectId
    • assetId

      protected long assetId
    • trustedObjects

      protected final HashSet<Long> trustedObjects
    • inheritAccessRights

      protected boolean inheritAccessRights
    • accessList

      protected HashSet<AccessListElement> accessList
    • statusCalculationMethod

      protected int statusCalculationMethod
    • statusPropagationMethod

      protected int statusPropagationMethod
    • fixedPropagatedStatus

      protected ObjectStatus fixedPropagatedStatus
    • statusShift

      protected int statusShift
    • statusTransformation

      protected ObjectStatus[] statusTransformation
    • statusSingleThreshold

      protected int statusSingleThreshold
    • statusThresholds

      protected int[] statusThresholds
    • creationTime

      protected Date creationTime
    • parents

      protected final HashSet<Long> parents
    • children

      protected final HashSet<Long> children
    • dashboards

      protected final List<Long> dashboards
    • customAttributes

      protected final Map<String,CustomAttribute> customAttributes
    • urls

      protected final List<ObjectUrl> urls
    • responsibleUsers

      protected final List<ResponsibleUser> responsibleUsers
    • moduleData

      protected Map<String,Object> moduleData
    • pollStates

      protected PollState[] pollStates
    • partialObject

      protected boolean partialObject
  • Constructor Details

    • 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(NXCPMessage msg, NXCSession session)
      Create object from NXCP message
      Parameters:
      msg - Message to create object from
      session - Associated client session
  • Method Details

    • 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
    • getAccessList

      public AccessListElement[] getAccessList()
      Returns:
      Access list
    • 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
    • getCommentsSource

      public String getCommentsSource()
      Get object's commentsSource.
      Returns:
      object's commentsSource
    • 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
    • getObjectNameWithPath

      public String getObjectNameWithPath()
      Get object name with parent path to it
      Returns:
      object name with path
    • getAlias

      public String getAlias()
      Get object's alias.
      Returns:
      object's alias
    • getNameOnMap

      public String getNameOnMap()
      Get object's name on network map. If not set (empty or null) then object's name will be returned.
      Returns:
      object's name on network map
    • getConfiguredNameOnMap

      public String getConfiguredNameOnMap()
      Get object's name on network map as it is configured.
      Returns:
      object's name on network map as configured
    • getNameWithAlias

      public String getNameWithAlias()
      Get name concatenated with alias in brackets if alias is not empty or just name otherwise.
      Returns:
      name concatenated with alias in brackets if alias is not empty or just name otherwise
    • getCategoryId

      public int getCategoryId()
      Get object category ID (0 if category is not set).
      Returns:
      object category ID or 0 if category is not set
    • getCategory

      public ObjectCategory getCategory()
      Get object category. This method will return null if category is not set for this object or if categories were not synchronized by calling NXCSession methods syncObjects or syncObjectCategories.
      Returns:
      object category or null if category not set or cannot be retrieved
    • getStatus

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

      public boolean isDeleted()
      Check if this object has "deleted" flag set.
      Returns:
      true if this object has "deleted" flag set
    • 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 for this object.
      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 of this object.
      Parameters:
      objectId - ID of object to check
      Returns:
      true if this object is a direct child of given object
    • 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()
      Get list of all direct parent objects as array.
      Returns:
      Array of parent objects
    • getChildrenAsArray

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

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

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

      public int getChildCount()
      Get number of child objects
      Returns:
      number of child objects
    • 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
    • getParentChain

      public List<AbstractObject> getParentChain(int[] classFilter)
      Get chain of parent objects. Only one possible chain is returned.
      Parameters:
      classFilter - null to get any parent chain, or NetXMS class id(s) to retrieve objects of given class(es)
      Returns:
      chain of parent objects, with topmost object at the end of the list
    • getTrustedObjects

      public List<AbstractObject> getTrustedObjects()
      Get list of trusted objects
      Returns:
      List of trusted objects
    • 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
    • hasDashboard

      public boolean hasDashboard(long dashboardId)
      Check if this object has dashboard with give ID in its dashboarsd list
      Parameters:
      dashboardId - dashboard ID to check
      Returns:
      true if provided dashboard ID is in object's dashboard list
    • 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()
      Get name of NetXMS object's class.
      Returns:
      Name of NetXMS object's class
    • getCustomAttributes

      public Map<String,CustomAttribute> getCustomAttributes()
      Get object's custom attributes.
      Returns:
      object's custom attributes
    • getCustomAttribute

      public CustomAttribute getCustomAttribute(String name)
      Get object's custom attribute by name
      Parameters:
      name - attribute's name
      Returns:
      custom attribute object or null
    • getCustomAttributeValue

      public String getCustomAttributeValue(String name)
      Get object's custom attribute's value by name
      Parameters:
      name - attribute's name
      Returns:
      custom attribute's value or null
    • getCustomAttributeValueAsBoolean

      public boolean getCustomAttributeValueAsBoolean(String name)
      Get object's custom attribute's value as boolean (will interpret string value as boolean value)
      Parameters:
      name - attribute's name
      Returns:
      custom attribute's value as boolean (false if custom attribute does not exist)
    • hasCustomAttribute

      public boolean hasCustomAttribute(String name)
      Check if object has custom attribute with given name.
      Parameters:
      name - attribute name
      Returns:
      true if object has custom attribute with given name.
    • getGeolocation

      public GeoLocation getGeolocation()
      Returns:
      the geolocation
    • hashCode

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

      public UUID getGuid()
      Returns:
      the guid
    • getMapImage

      public UUID getMapImage()
      Get UUID of this objects's map image. Will return null if map image is not set.
      Returns:
      UUID of this objects's map image or null
    • getIcon

      public UUID getIcon()
      Get UUID of UI icon for this object. Will return null if category or object specific icon is not set.
      Returns:
      UUID of UI icon or null
    • getDrillDownObjectId

      public long getDrillDownObjectId()
      Returns:
      the submapId
    • getAssetId

      public long getAssetId()
      Get ID of linked asset object.
      Returns:
      ID of linked asset object or 0
    • 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 PostalAddress getPostalAddress()
      Returns:
      the postalAddress
    • isInMaintenanceMode

      public boolean isInMaintenanceMode()
      Returns:
      the inMaintenanceMode
    • getMaintenanceInitiatorId

      public int getMaintenanceInitiatorId()
      Get ID of the user that initiated maintenance mode for this object.
      Returns:
      ID of the user that initiated maintenance mode for this object
    • 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 - set of strings
      s - string to add
    • getStrings

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

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

      public Date getCreationTime()
      Get object's creation time.
      Returns:
      object's creation time
    • areChildrenSynchronized

      public boolean areChildrenSynchronized()
      Check if children of this object are synchronized
      Returns:
      true if children of this object are synchronized
    • isPartialObject

      public boolean isPartialObject()
      Partial object flag
      Returns:
      will return true if object is partial