"WEBNMS_5 API Docs"

com.adventnet.nms.alertdb
Class Alert

java.lang.Object
  extended by com.adventnet.nms.alertdb.Alert
All Implemented Interfaces:
com.adventnet.nms.alertdb.corba.Alert_CIOperations, DBExtendedInterface, DBInterface, ConfigurableObj, java.io.Serializable, java.lang.Cloneable

public class Alert
extends java.lang.Object
implements java.io.Serializable, ConfigurableObj, DBExtendedInterface, com.adventnet.nms.alertdb.corba.Alert_CIOperations

This class forms the basis of every Alert generated within Web NMS. For every alert reported or generated within Web NMS system, a corresponding instance of this class will be created.

Events are set of notifications from the network and are the source of information for all the management happenings that take place within the Web NMS system. Alerts are correlation of set of events representing a common failure / fault. Events are correlated to alerts based on entity field. i.e. for all events with the same entity field there will only be one alert and the severity of the alert will be the severity of the latest event with the same failure object.

A new alert will be generated from an event, if the following two conditions are met by the generated Event.

 If there exists no other alert matching the same entity, as that of the event within the Web NMS system 
 If the criticality of the Event is greater than that of 'Clear' severity. 
 
Subsequently when a new event gets generated for the same failure object the existing alert will be updated. An event could update an alert only if any one of the following conditions are met
 If either the criticality of the event is greater than or equal to that of Clear and is different from the
 current status of the corresponding alert. (or) 
 If either the message field of the event is different from the message field of the corresponding alert. (or) 
 If either the source field of the event is different from the source field of the corresponding alert. 
 
The Alert class has a basic set of data fields (or standard properties) to hold values that are vital for Web NMS Management. Apart from these standard properties, additional properties (data) can also be added into the Alert object either by extending the object or using the concept of User Properties.

Often applications do not need to create their own subclasses of Alert, since it allows for easily storing custom properties in Alert itself. Alert contains a member field userProperties and methods setUserProperty(String, Object) and getUserProperty(String) which allow applications to store their data in an instance of this class, and access the data efficiently.

Like

 alert.setUserProperty("userProp","NMS"); 
 
and retrieve it using the property by doing a call
 String nmsString = alert.getUserProperty("userProp");

See Also:
AlertAPI, Serialized Form

Constructor Summary
Alert()
          default constructor.
 
Method Summary
 void clientDecodeObj(byte[] bytes)
          This method is used to contruct Alert object from byte array obtained using clientEncodedObj().
 byte[] clientEncodeObj()
          This method is used to serialize the fields of this Alert to be sent to the client.
 java.lang.Object clone()
          Creates and returns a copy of this object.
 java.lang.String dateString()
          Returns the create time of this alert as a string.
 void decodeObj(byte[] bytes)
          This method is used to deserialize the Alert object.
 byte[] encodeObj()
          This method is used to save this object for persistence.
 AlertAnnotation getAnnotation()
          Constructs and returns an Alert Annotation object for this alert object.
 java.lang.String getCategory()
          Accessor method to return the Category of the alert.
 java.awt.Color getColor()
          Returns the color corresponding to the severity of this alert.
 long getCreateTime()
          Get the time stamp at which this alert was created.
 java.lang.Object getDynamicUserProperty(java.lang.String nam)
           
 java.lang.String getEntity()
          Returns the entity field of the alert.
 Event getEvent()
          To get the Event object from which the corresponding Alert is generated or updated.
 java.lang.String getGroupName()
          Returns the Group Name to which this alert belongs.
 int getId()
          Get the id of the corresponding event from which this alert is generated.
 java.lang.String getKey()
          Method to get the key value of this Alert.
 java.lang.String getKeyName()
          Returns the field names used as the unique key of this Alert object.
 java.lang.Object getLockId()
          Gets the current lock object associated with the Alert.
 java.lang.String getMapname()
          Get the the mapname of the MapSymbol corresponding to the source of this alert.
 java.util.Map getMappedProperties()
           
 java.lang.String getMessage()
          Returns the message describing this alert.
 long getModTime()
          Get the time at which this alert was last modified.
 java.lang.String getNotes()
          Get the detailed annotations about updates on this alert.
 java.lang.String getOwnerName()
          Returns the name of the owner to which the corresponding Alert object belongs.
 int getPreviousSeverity()
          The previous severity of this alert.
 int getPriority()
          Returns the priority field of this Alert.
 com.adventnet.nms.common.corba.Property_CT[] getProperties_CT()
          corba: Alert_CIOperations interface method
 java.util.Properties getProperties()
          This method returns the values of all the fields in this alert object as a key,value pair in a java.util.Properties object.
 int getSeverity()
          Gets the severity of the alert.
 java.lang.String getSource()
          Get the source of the alert.
 com.adventnet.nms.common.corba.Property_CT[] getUserProperties_CT()
          corba: Alert_CIOperations interface method
 java.util.Properties getUserProperties()
          Get the user Properties object .
 java.lang.String getUserProperty(java.lang.String nam)
          To get any other user property
 java.lang.String getWebNMS()
          The WebNMS server where this alert is generated.
 java.lang.String getWho()
          Returns the user name who has picked up this alert.
 java.lang.String removeUserProperty(java.lang.String nam)
          To remove any other user property
 void setAnnotation(AlertAnnotation altan)
          Sets the AlertAnnotation for this alert object.
 void setCategory(java.lang.String category)
          This method is used to set the category of the alert, like Topology alert or Threshold alert etc.
 void setCreateTime(long createTime)
          Set the time stamp at which this alert was created.
 void setDynamicUserProperty(java.lang.String key, java.lang.Object value)
           
 void setEntity(java.lang.String entity)
          Sets the entity field of this alert.
 void setEvent(Event event)
          To set the Event object from which the corresponding Alert is generated or updated.
 void setGroupName(java.lang.String group)
          Method to set the Group Name to which this alert belongs.
 void setId(int id)
          Sets the id of this alert.
 void setLockId(java.lang.Object lockId)
          Sets the current lock object associated with the Alert.
 void setMapname(java.lang.String mapname)
          Sets the mapname of the MapSymbol corresponding to the source of this alert.
 void setMappedProperties(java.util.Map mappedProps)
           
 void setMessage(java.lang.String message)
          Sets the message describing this alert.
 void setModTime(long modTime)
          Sets the time at which this alert was last modified.
 void setNotes(java.lang.String notes)
          Sets the detailed annotations about updates on this alert.
 void setOwnerName(java.lang.String owner)
          To set the owner to which the corresponding Alert object belongs.
 void setPreviousSeverity(int previousSeverity)
          The previous severity of this alert.
 void setPriority(int priority)
          Sets the priority of the Alert.
 void setProperties_CT(com.adventnet.nms.common.corba.Property_CT[] property_array)
          corba: Alert_CIOperations interface method
 void setProperties(java.util.Properties p)
          This method sets the properties of the Alert Object.
 void setSeverity(int severity)
          Sets the severity of the alert.
 void setSource(java.lang.String source)
          sets the source of the alert.
 void setUserProperty(java.lang.String nam, java.lang.String val)
          To set any other user property
 void setValues()
          Used in the client.
 void setWebNMS(java.lang.String webNMS)
          The WebNMS server where this alert is generated.
 void setWho(java.lang.String who)
          Sets the user name who has picked up this alert.
 java.lang.String severityStr()
          Returns the severity of this alert as a string
 java.lang.String toLogString()
          Returns all relevant fields of this alert in one concatinated string.
 java.lang.String toString()
          Returns the a String which will be the concatenation of the entity field of the alert and the message field of the alert.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Alert

public Alert()
default constructor.

Method Detail

getId

public int getId()
Get the id of the corresponding event from which this alert is generated. The 'id' field is the key for Event object and Alert objects are uniquely identified by 'entity' field.

Specified by:
getId in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
The value of the id field of this alert.

setId

public void setId(int id)
Sets the id of this alert. The 'id' field is the key for Event object and Alert objects are uniquely identified by 'entity' field.

Specified by:
setId in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Parameters:
id - The value of the id field.

getEvent

public Event getEvent()
To get the Event object from which the corresponding Alert is generated or updated. The user should be informed that the Event reference set to this Alert object will not be stored in persistent storage of Web NMS, and is transient. Hence, when this alert is retrieved back from the Data Store or using the Alert API calls, the Event reference within the alert object will be 'null'. The transient reference could be used at the level of Alert filters to access the properties of the Event or its derived class to get additional properties needed to create / update Alert or its extended class. This method returns event object only at the level of Alert Filters. Once the Alert is returned from Alert filters, the Event object reference will be set with 'null'.

Returns:
The Event object from which the corresponding Alert is generated of updated

setEvent

public void setEvent(Event event)
To set the Event object from which the corresponding Alert is generated or updated. The user should be informed that the Event reference for this Alert object will not be stored in persistent storage of Web NMS, and is transient. Hence, when this alert is retrieved back from the Data Store or using the Alert API calls, the Event reference within the alert object will be 'null'.

The transient reference could be used at the level of Alert filters to access the properties of the Event or its derived class to get additional properties needed to create / update Alert or its extended class.

This Event object is accessible only at the level of Alert Filters. Once the Alert is returned from Alert filters, the Event object reference will be set with 'null'.

Parameters:
event - The Event object from which the corresponding Alert is generated or updated.

getGroupName

public java.lang.String getGroupName()
Returns the Group Name to which this alert belongs. This field could hold the information that is helpful in grouping of Alerts. The Group Name could be copied on to this Alert created by the event and used in the grouping of Alerts. or could be set at the level of Alert filters.

Alerts with same 'groupName' field will be grouped while displaying Alerts in the client. All the alerts belonging to the same group can be correlated as a single failure in the client. The Group Name could be set using the corresponding modifier method present in this class. This method will return 'null' if the 'groupName' field is not set.

Specified by:
getGroupName in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
The group name to which this alert belongs.
See Also:
setGroupName(String)

setGroupName

public void setGroupName(java.lang.String group)
Method to set the Group Name to which this alert belongs. This field could hold the information that is helpful in grouping of Alerts. The Group Name for this alert could be copied from the Event with which the Alert is created. Alerts with same 'groupName' field will be grouped while displaying Alerts in the client. All the alerts belonging to the same group can be correlated as a single failure in the client. The 'groupName' field set and added to the server can be modified only through Alert filters.

Specified by:
setGroupName in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Parameters:
group - The group name to be set for this Event object.
See Also:
getGroupName()

getCategory

public java.lang.String getCategory()
Accessor method to return the Category of the alert. The category field could be helpful in useful categorization of Alerts which would got copied from the 'category' field of alert. This method will return 'null' if the 'category' field is not set.

Specified by:
getCategory in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
The category to which this alert belongs too.
See Also:
setCategory(String)

getLockId

public java.lang.Object getLockId()
Gets the current lock object associated with the Alert. The WebNMS supports locking of Alert Objects at the application level. Currently, WebNMS uses the lockId property of the Alert Object internally to support the application level locking. This method should not be used by the users, as it might break the locks applied, if any, over the AlertObject.

Returns:
The lock object associated with the AlertObject.
See Also:
LockableObject

setLockId

public void setLockId(java.lang.Object lockId)
Sets the current lock object associated with the Alert. The WebNMS supports locking of AlertObjects at the application level. Currently, the WebNMS uses the lockId property of the AlertObject internally to support the application level locking. This method should not be used by the users, as it might break the locks applied, if any, over the AlertObject.

Parameters:
lockId - is random Integer object generated by WebNMS
See Also:
LockableObject

setCategory

public void setCategory(java.lang.String category)
This method is used to set the category of the alert, like Topology alert or Threshold alert etc. The category field could help in the useful categorization of Alerts. Category field could be set from the Event which generates / updates this Alert, or the category for the alert could be set at the level of Alert filters. Category field of this Alert could be same as the corresponding event object.

Specified by:
setCategory in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Parameters:
category - The category to which this alert belongs.
See Also:
getCategory()

getSeverity

public int getSeverity()
Gets the severity of the alert. This method returns the int value of the severities configured in the SeverityInfo.conf. Returns SpecialPurposeSeverity when the Alert is in deleted state. For example when the Alert is deleted it will be notified to the AlertObservers and AlertListeners with SpecialPurposeSeverity. Use SeverityInfo.getValue(String) to get the int representaion of the severity string.

Specified by:
getSeverity in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
int representation of the severity

setSeverity

public void setSeverity(int severity)
Sets the severity of the alert.

Specified by:
setSeverity in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Parameters:
severity - This severity value can be obtained using the SeverityInfo.getValue(String) method.

getPreviousSeverity

public int getPreviousSeverity()
The previous severity of this alert. i.e From what severity this alert changed to present severity.

Specified by:
getPreviousSeverity in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
The previous severity.

setPreviousSeverity

public void setPreviousSeverity(int previousSeverity)
The previous severity of this alert. i.e From what severity this alert changed to present severity.

Specified by:
setPreviousSeverity in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Parameters:
previousSeverity - The previous severity.

getEntity

public java.lang.String getEntity()
Returns the entity field of the alert. This field is the key for an alert. The 'entity' is the field which uniquely identifies the Alert object in the alert database. All events having the same entity value (which is referred to as Failure Object) will result in only one alert. Once the alert is generated, the entity cannot be modified.

Events will be correlated into Alerts based on the 'entity' field and Alerts will update the corresponding Managed Object based on the 'source' field.

The 'entity' field is more specific towards identifying the problem domain and 'source' field will be used to correlate the problem with the Managed object. The 'node' field could correspond to the node object.

For example: The Agent in the printer could be configured to send notification to the server on the following cases: when the Printer Toner level goes below 10%, when the paper count goes below 50 and when Interface for the printer has problems. When Alerts are generated based on the notification for toner level the entity, source, node fields could be set with entity - printer_toner source - printer node - printer When Alerts are generated based on the notification for Interface going down, the fields could be set with entity - IF-printer_down source - IF-printer node - printer Here entity specifies the problem domain, source identifies the Managed object and node corresponds to the network object.

Specified by:
getEntity in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
The entity of this alert.

setEntity

public void setEntity(java.lang.String entity)
Sets the entity field of this alert. This field is the key field for an alert. This field is used to do corelation of events into alerts. All events having the same entity value (which is referred to as Failure Object) will result in only one alert. (i.e. entity is the primary key for an Alert Object). The entity of an alert has be set in the Event Object itself from, either Trap parsers, event parsers or event filter. Once the entity field of alert is set, then the entity field cannot be modified.

Specified by:
setEntity in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Parameters:
entity - The value for the entity field.

getCreateTime

public long getCreateTime()
Get the time stamp at which this alert was created. The time is represented as the number of milliseconds that elapsed between Jan 1, 1970 00:00:00 GMT and the time at which the Alert got generated.

Specified by:
getCreateTime in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
long - The time at which this alert was created as the number of milliseconds that elapsed since Jan 1, 1970 00:00:00 GMT..

setCreateTime

public void setCreateTime(long createTime)
Set the time stamp at which this alert was created. The time is represented as the number of milliseconds that elapsed between Jan 1, 1970 00:00:00 GMT and the time at which the alert got generated.

Specified by:
setCreateTime in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Parameters:
createTime - The create time of this alert, as the number of milliseconds that elapsed since Jan 1, 1970 00:00:00 GMT.

getModTime

public long getModTime()
Get the time at which this alert was last modified.

Specified by:
getModTime in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
The time this alert was last modified.

setModTime

public void setModTime(long modTime)
Sets the time at which this alert was last modified.

Specified by:
setModTime in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Parameters:
modTime - The modified time of this alert.

getMessage

public java.lang.String getMessage()
Returns the message describing this alert. This is same as the text in the corresponding Event Object, unless modified from an Alert Filter.

Specified by:
getMessage in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
The message describing this alert.

setMessage

public void setMessage(java.lang.String message)
Sets the message describing this alert. Internally used by NMS during creation and update of Alert.

Specified by:
setMessage in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Parameters:
message - The message which describes this alert.

getSource

public java.lang.String getSource()
Get the source of the alert. If the source matches any of the ManagedObject in the Topology Database, then the ManagedObject's status is updated with the severity of the alert. If there are multiple alerts with the same source, then the ManagedObject corresponding to the source will reflect the maximum severity of all the alerts.

Specified by:
getSource in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
The source of this alert.

setSource

public void setSource(java.lang.String source)
sets the source of the alert. If the source matches any of the ManagedObject in the Topology Database, then the ManagedObject's status is updated with the severity of the alert. If there are mutilple alerts with the same source, then the ManagedObject corresponding to the source will reflect the maximum severity of all the alerts.

Specified by:
setSource in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Parameters:
source - The source of this alert.

getMapname

public java.lang.String getMapname()
Get the the mapname of the MapSymbol corresponding to the source of this alert. This is useful to identify the MapSymbol corresponding to an alert in the client side. This is set automatically, when the source of the alert has any matching MapSymbol. The 'mapName' field is Not used as of now.

Specified by:
getMapname in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
The mapname in which the MapSymbol corresponding to the alert source belongs.

setMapname

public void setMapname(java.lang.String mapname)
Sets the mapname of the MapSymbol corresponding to the source of this alert. The 'mapName' field is Not used as of now.

Specified by:
setMapname in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Parameters:
mapname - The mapName of this alert.

getWho

public java.lang.String getWho()
Returns the user name who has picked up this alert. If no one has picked this Alert, this field will be 'null'. Alerts which are in unpicked state can alone be picked up. "Pick Up" mechanism helps in allocating a particular Alert i.e., the fault in the device to a work group or an user. Picking up an Alert can be used to inform others so that no other person need to spend time over the same issue. Thus pick up can be used to avoid duplication of work.

Specified by:
getWho in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
The name of the user who owns this alert. Will return 'null' if no one picked up the Alert.

setWho

public void setWho(java.lang.String who)
Sets the user name who has picked up this alert. "Pick Up" mechanism helps in allocating a particular Alert i.e., the fault in the device to a work group or an user. Picking up an Alert can be used to inform others so that no other person need to spend time over the same issue. Thus pick up can be used to avoid duplication of work.

Specified by:
setWho in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Parameters:
who - The name of the user who picks up this alert.

getNotes

public java.lang.String getNotes()
Get the detailed annotations about updates on this alert. Users could add their own annotations to an alert from the client.

Specified by:
getNotes in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
The detailed annotations about this alert.

setNotes

public void setNotes(java.lang.String notes)
Sets the detailed annotations about updates on this alert. Users could add their own annotations to an alert from the client. This will delete the old annotations.

Specified by:
setNotes in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Parameters:
notes - The annotations to be done from this alert.

getWebNMS

public java.lang.String getWebNMS()
The WebNMS server where this alert is generated.

Specified by:
getWebNMS in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
NMS from which alert was generated Not used as of WebNMS2.0

setWebNMS

public void setWebNMS(java.lang.String webNMS)
The WebNMS server where this alert is generated.

Specified by:
setWebNMS in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Parameters:
webNMS - NMS from which alert was generated Not used as of WebNMS2.0

getOwnerName

public java.lang.String getOwnerName()
Returns the name of the owner to which the corresponding Alert object belongs. The ownerName property could be used at a higher level to uniquely identify the Alert, when the entity field can no longer be used as the unique identification key for the Alert. In such case, ownerName can be used in conjunction with the entity to do so.

By Default the value of the OwnerName will be 'null'. This field is reserved for furture use. Currently users are requested not to set this field for holding any information as it may result in some undesirable effect..

Returns:
The owner name to which this Alert belongs.

setOwnerName

public void setOwnerName(java.lang.String owner)
To set the owner to which the corresponding Alert object belongs. The ownerName property could be used at a higher level to uniquely identify the Alert, when the entity field can no longer be used as the unique identification key for the Alert. By Default the value of the OwnerName will be 'null'. This field is reserved for furture use. Currently users are requested not to set this field for holding any information as it may result in some undesirable effect..

Parameters:
owner - The owner name to which this Alert belongs.

getPriority

public int getPriority()
Returns the priority field of this Alert. This field could be used to assign priorities among various failures in the network. The work group which is working on the fault could took high priority issue (most critacality) first.

Returns:
int - The priority of the Alert

setPriority

public void setPriority(int priority)
Sets the priority of the Alert. This field could be used to assign priorities among various failures in the network. The work group which is working on the fault could took high priority issue (most critacality) first.

Parameters:
priority - The priority field of this Alert

toString

public java.lang.String toString()
Returns the a String which will be the concatenation of the entity field of the alert and the message field of the alert. The Format of the string would be entity:message

Overrides:
toString in class java.lang.Object
Returns:
A string which is the concatenation of the entity and the message field of the alert.

toLogString

public java.lang.String toLogString()
Returns all relevant fields of this alert in one concatinated string. This concatenated string will be used by NMS while logging an alert. The Format of the concatenated string will be :id+:severity:modTime:category:entity:message

Specified by:
toLogString in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
Returns a concatenated string of the relevanant fields of the alert.

dateString

public java.lang.String dateString()
Returns the create time of this alert as a string. The Format of the returned string would be like Sat May 20 20:04:23 GMT+05:30 2000

Specified by:
dateString in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
String, representing the create time of this Alert.

severityStr

public java.lang.String severityStr()
Returns the severity of this alert as a string

Specified by:
severityStr in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
5-clear, 4-warning, 3-minor, 2-major, 1-critical

getAnnotation

public AlertAnnotation getAnnotation()
Constructs and returns an Alert Annotation object for this alert object. When the user does some operation on Alert like Pickup, unpick an AlertAnnotation object representing the Alert update by the user will be created and added to the server. AlertAnnotation object represents that some action has been performed by the user over Alert.

Returns:
AlertAnnotation object for the alert

setAnnotation

public void setAnnotation(AlertAnnotation altan)
Sets the AlertAnnotation for this alert object. The modTime of this Alert object will be updated with the modified time of the AlertAnnotation parameter.

Parameters:
altan - An instance of AlertAnnotation object for this alert object.

getColor

public java.awt.Color getColor()
Returns the color corresponding to the severity of this alert. The Color object for the Alert is obtained from SeverityInfo based on the color combination specified for the severity of the Alert in SeverityInfo.conf file.

Returns:
Color object corresponding to the severity of the alert

encodeObj

public byte[] encodeObj()
This method is used to save this object for persistence. Converts the fields of this alert to serialized form so that the object can be stored and retrieved. This method is mainly used to store this object in 'Flat file' storage mode.

Specified by:
encodeObj in interface ConfigurableObj
Returns:
byte [] - Alert object in serialized form.
See Also:
decodeObj(byte[])

decodeObj

public void decodeObj(byte[] bytes)
               throws java.io.IOException
This method is used to deserialize the Alert object. Mainly used to deserialize Alert object from 'Flat file' storage mode.

Specified by:
decodeObj in interface ConfigurableObj
Parameters:
bytes[] - Alert object in serialized form.
Throws:
java.io.IOException - - IO Exception when any problem arises during deserializing.
See Also:
encodeObj()

clientEncodeObj

public byte[] clientEncodeObj()
This method is used to serialize the fields of this Alert to be sent to the client. Only relevant information required by the client will be serialized here. When Alert details is to be sent to client, will be serialized using this method, sent to client and will be deserialized at the other end (client).

Returns:
byte [] - Array of bytes containing details of this Alert object in serialized form.
See Also:
clientDecodeObj(byte [])

clientDecodeObj

public void clientDecodeObj(byte[] bytes)
                     throws java.io.IOException
This method is used to contruct Alert object from byte array obtained using clientEncodedObj(). When the serialized byte array is obtained by the client, construct the Alert object using this method.

Parameters:
bytes - - Alert details in the form of byte array.
Throws:
java.io.IOException - - When there is any IO exception while re constructing the Alert object.
See Also:
clientEncodeObj()

getProperties

public java.util.Properties getProperties()
This method returns the values of all the fields in this alert object as a key,value pair in a java.util.Properties object. The properties returned also includes the user properties of the alert Object. The keys of the Properties object returned will be the same as that of the names of the property fields in the alert Object.

Derived classes should override this method and invoke the super.getProperties() in the beginning of the method inorder to correctly return super classes' properties.

 For example : Let us suppose a class called MyAlert extends Alert
 and has a property String myfield = "";
 The getProperties method code should be,
 
 public Properties getProperties() 
 {
    Properties p = super.getProperties();
    p.put("myfield", myfield);
    return p;
 }
 
 
The Properties object returned from this method will have the following keys, to get the values of the corresponding Alert properties.

id, severity,previsouseverity,createTime,modTime,state,groupName,category, entity,ownerName,priority,message,who,notes,source,mapname, stringseverity, stringpreviousseverity and all user properties. Note : All values returned will be of type String. Users have to cast the String value into appropriate type.

Specified by:
getProperties in interface DBInterface
Returns:
The values of all the fields in this alert object as a key,value pair in a java.lang.Properties object.
See Also:
setProperties(Properties)

clone

public java.lang.Object clone()
Creates and returns a copy of this object. Return a new Alert object which is a clone of 'this' alert object.

Specified by:
clone in interface DBInterface
Overrides:
clone in class java.lang.Object
Returns:
The cloned copy of this alert.

setProperties

public void setProperties(java.util.Properties p)
This method sets the properties of the Alert Object. This method can be used to set the values of more than one property in one go, instead of using the get/set methods for each property. The java.lang.Properties object passed as an argument should contain the properties of the Alert to be set as a key,value pair, where key should exactly match the name of the property field in the Alert object. All the keys that do not match the names of any of the standard property field defined in the Alert object, will be set as User property with the name in the Alert Object.

Derived classes should override this method and invoke super.setProperties() at the end of this method. It is required that after the Derived classes have set their properties they remove it from the properties object they pass when calling super.setProperties(); This is to ensure the properties are not duplicated in the userProperties too. This will ensure that the user properties reflect correctly and do not contain redundant information.

 For example : Let us suppose a class called MyAlert extends 
 Alert and has a field String myfield = "";
 In the setProperties() method (of class MyAlert) the proper code could likely be
 
 public void setProperties(Properties p) {
    if (p == null) return;
    if ((s = p.getProperty("myfield")) != null)  {
         myfield= s;
         p.remove("myfield");
    }
    super.setProperties(p);
  }
 
 

It should be noted that for the properties of the alert that are not passed within the Properties object arguement, the previous values or default values will be retained.

Specified by:
setProperties in interface DBInterface
Parameters:
p - The java.lang.Properties object that contains the properties to be set for the Alert Object. The key value should either exactly match the name of any standard property field in the Alert Object or it will be considered as a User property to be set for the Alert Object.

The following are the keys to be used in the argument Properties object, for the corresponding property of the Alert.

 
 id, severity,previsouseverity,createTime,modTime,state,groupName,category,
 entity,ownerName,priority,message,who,notes,source,mapname, stringseverity, 
 stringpreviousseverity and all user properties.
 
 Note : All values must be specified as strings. The setProperties() method
 implementation should take care of casting the values to the appropriate type.
 
See Also:
getProperties()

setValues

public void setValues()
Used in the client.

Specified by:
setValues in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations

getKey

public java.lang.String getKey()
Method to get the key value of this Alert. The key field could be entity field or a combination of entity field along with ownerName field. A particular Alert object can be uniquely identified with the help of the return value from this method.

Since the key field could be either entity when ownerName field is 'null' and combination of entity and ownerName when ownerName field is not 'null', users are suggested to use this method to get the key value for an Alert.

Specified by:
getKey in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Specified by:
getKey in interface DBInterface
Returns:
Returns the value of the key field of this Alert object.

getKeyName

public java.lang.String getKeyName()
Returns the field names used as the unique key of this Alert object. This method is used to form the primary key of the alert table, when the alert object is stored in RDBMS table.

The fields names returned will be entity when the ownerName field is 'null' or combination of entity and ownerName when the ownerName field is not 'null'. This method is used internally by Web NMS.

Specified by:
getKeyName in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Specified by:
getKeyName in interface DBInterface
Returns:
The combination of field names used as the unique (primary) key of the alert object.

getUserProperties

public java.util.Properties getUserProperties()
Get the user Properties object . Can return null

Specified by:
getUserProperties in interface DBExtendedInterface
Returns:
userproperties of alert

setUserProperty

public void setUserProperty(java.lang.String nam,
                            java.lang.String val)
To set any other user property

Specified by:
setUserProperty in interface DBExtendedInterface
Parameters:
nam - key for userproperty
val - corresponding value to key as an Object

getUserProperty

public java.lang.String getUserProperty(java.lang.String nam)
To get any other user property

Specified by:
getUserProperty in interface DBExtendedInterface
Parameters:
nam - key for userproperty
Returns:
userproperties of alert as an Object

getDynamicUserProperty

public java.lang.Object getDynamicUserProperty(java.lang.String nam)

setDynamicUserProperty

public void setDynamicUserProperty(java.lang.String key,
                                   java.lang.Object value)

removeUserProperty

public java.lang.String removeUserProperty(java.lang.String nam)
To remove any other user property

Specified by:
removeUserProperty in interface DBExtendedInterface
Parameters:
nam - key for userproperty
Returns:
removed property value(as an Object).

getProperties_CT

public com.adventnet.nms.common.corba.Property_CT[] getProperties_CT()
corba: Alert_CIOperations interface method

Specified by:
getProperties_CT in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
com.adventnet.nms.common.corba.Property_CT

getUserProperties_CT

public com.adventnet.nms.common.corba.Property_CT[] getUserProperties_CT()
corba: Alert_CIOperations interface method

Specified by:
getUserProperties_CT in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Returns:
com.adventnet.nms.common.corba.Property_CT

setProperties_CT

public void setProperties_CT(com.adventnet.nms.common.corba.Property_CT[] property_array)
corba: Alert_CIOperations interface method

Specified by:
setProperties_CT in interface com.adventnet.nms.alertdb.corba.Alert_CIOperations
Parameters:
property_array - array of com.adventnet.nms.common.corba.Property_CT

getMappedProperties

public java.util.Map getMappedProperties()

setMappedProperties

public void setMappedProperties(java.util.Map mappedProps)

"WEBNMS_5 API Docs"

Copyright © 2011 ZOHO Corp., All Rights Reserved.