Package com.qfs.snl.dtos
Class AlertDto
java.lang.Object
com.qfs.snl.dtos.AlertDto
- All Implemented Interfaces:
ISentinelAlert
,ILocatedResource
,ISiteLocated
,IIdentifiable
,Serializable
The data transfer object for an alert.
- Author:
- ActiveViam
- See Also:
-
Field Summary
Fields inherited from interface com.qfs.snl.persistence.IIdentifiable
NO_ID
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
equals
(ISentinelAlert alert, Object obj) Tests the equality between a ISentinelAlert and an object.boolean
Return the information related to that alert.Gets the id of the event that created the alert.long
getId()
Gets the resource id.long
Return the id of the monitor that produced the alert.getSite()
Gets the site where the element is located.getStart()
Gets the start time of the alert.getStop()
Gets the stop time of the alert.int
hashCode()
static int
hashCode
(ISentinelAlert alert) Computes the hashcode of aISentinelAlert
.setContent
(String content) Sets the content of the alert.setEventId
(Long eventId) Sets the eventId.setId
(long id) Sets the unique alert identifier.setMonitorId
(long monitorId) Sets the id of the monitor.Sets the site.Sets the started.Sets the stopped.toString()
static String
toString
(ISentinelAlert alert) Returns the string representation of the given alert.
-
Constructor Details
-
AlertDto
public AlertDto()Default constructor. -
AlertDto
public AlertDto(long id, String site, long monitorId, Long eventId, Long start, Long stop, String content) Constructor.- Parameters:
id
- alert idsite
- agent sitemonitorId
- id of the monitor triggering this alerteventId
- id of the event related to the alertstart
- timestamp in milliseconds at which this alert startedstop
- timestamp in milliseconds at which this alert stoppedcontent
- full string content of the alert
-
AlertDto
Constructor.- Parameters:
alert
- the ISentinelAlert used to generate this Dto
-
-
Method Details
-
getId
public long getId()Description copied from interface:IIdentifiable
Gets the resource id.- Specified by:
getId
in interfaceIIdentifiable
- Returns:
- the id
-
setId
Sets the unique alert identifier.- Returns:
- this
-
getSite
Description copied from interface:ISiteLocated
Gets the site where the element is located.- Specified by:
getSite
in interfaceISiteLocated
- Returns:
- the site
-
setSite
Sets the site.- Parameters:
site
- The site to set- Returns:
- this
-
getStart
Description copied from interface:ISentinelAlert
Gets the start time of the alert.- Specified by:
getStart
in interfaceISentinelAlert
- Returns:
- the audit of the alert start
-
setStart
Sets the started.- Parameters:
start
- The started to set- Returns:
- this
-
getStop
Description copied from interface:ISentinelAlert
Gets the stop time of the alert.- Specified by:
getStop
in interfaceISentinelAlert
- Returns:
- the audit of the alert stop
-
setStop
Sets the stopped.- Parameters:
stop
- The stopped to set- Returns:
- this
-
getContent
Description copied from interface:ISentinelAlert
Return the information related to that alert.- Specified by:
getContent
in interfaceISentinelAlert
- Returns:
- the content of the alert
-
setContent
Sets the content of the alert.- Returns:
- this
-
getMonitorId
public long getMonitorId()Description copied from interface:ISentinelAlert
Return the id of the monitor that produced the alert.- Specified by:
getMonitorId
in interfaceISentinelAlert
- Returns:
- the id of the monitor
-
setMonitorId
Sets the id of the monitor.- Returns:
- this
-
getEventId
Description copied from interface:ISentinelAlert
Gets the id of the event that created the alert.- Specified by:
getEventId
in interfaceISentinelAlert
- Returns:
- the event id, null if the alert is not related to an event
-
setEventId
Sets the eventId.- Parameters:
eventId
- The eventId to set- Returns:
- this
-
hashCode
public int hashCode() -
hashCode
Computes the hashcode of aISentinelAlert
.- Parameters:
alert
- underlying ISentinelAlert- Returns:
- the hash code
- See Also:
-
equals
-
equals
Tests the equality between a ISentinelAlert and an object.Two alerts are equals if they concern the same monitor (id + site), started at the same time and describes the same content and stemmed from the same event.
This is consistent for an append-only resource.- Parameters:
alert
- the reference alertobj
- the object to test- Returns:
- true for equality
-
toString
-
toString
Returns the string representation of the given alert.
-