/*******************************************************************************
* This file is part of OpenNMS(R).
*
* Copyright (C) 2006-2011 The OpenNMS Group, Inc.
* OpenNMS(R) is Copyright (C) 1999-2011 The OpenNMS Group, Inc.
*
* OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
*
* OpenNMS(R) is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* OpenNMS(R) is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenNMS(R). If not, see:
* http://www.gnu.org/licenses/
*
* For more information contact:
* OpenNMS(R) Licensing <license@opennms.org>
* http://www.opennms.org/
* http://www.opennms.com/
*******************************************************************************/
package org.opennms.netmgt.model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.springframework.core.style.ToStringCreator;
/*
This is not properly annotated so comment out the annotations so it not discovered during scanning
@Entity
@Table(name="vulnerabilities")
*/
public class OnmsVulnerability extends OnmsEntity implements Serializable {
/**
*
*/
private static final long serialVersionUID = -2212905105927237801L;
/** identifier field */
private Integer m_vulnerabilityId;
/** nullable persistent field */
private OnmsNode m_node;
/** nullable persistent field */
private OnmsMonitoredService m_monitoredService;
/** persistent field */
private Date m_creationTime;
/** persistent field */
private Date m_lastAttemptTime;
/** persistent field */
private Date m_lastScanTime;
/** nullable persistent field */
private Date m_resolvedTime;
/** persistent field */
private Integer m_severity;
/** persistent field */
private OnmsVulnPlugin m_vulnPlugin;
/** nullable persistent field */
private String m_logMsg;
/** nullable persistent field */
private String m_descr;
/** nullable persistent field */
private Integer m_port;
/** nullable persistent field */
private String m_protocol;
/** nullable persistent field */
private String m_cveEntry;
/**
* full constructor
*
* @param vulnerabilityId a {@link java.lang.Integer} object.
* @param node a {@link org.opennms.netmgt.model.OnmsNode} object.
* @param monitoredService a {@link org.opennms.netmgt.model.OnmsMonitoredService} object.
* @param creationTime a {@link java.util.Date} object.
* @param lastAttemptTime a {@link java.util.Date} object.
* @param lastScanTime a {@link java.util.Date} object.
* @param resolvedTime a {@link java.util.Date} object.
* @param severity a {@link java.lang.Integer} object.
* @param vulnPlugin a {@link org.opennms.netmgt.model.OnmsVulnPlugin} object.
* @param pluginSubId a int.
* @param logMsg a {@link java.lang.String} object.
* @param descr a {@link java.lang.String} object.
* @param port a {@link java.lang.Integer} object.
* @param protocol a {@link java.lang.String} object.
* @param cveEntry a {@link java.lang.String} object.
*/
public OnmsVulnerability(Integer vulnerabilityId, OnmsNode node, OnmsMonitoredService monitoredService, Date creationTime, Date lastAttemptTime, Date lastScanTime, Date resolvedTime, Integer severity, OnmsVulnPlugin vulnPlugin, int pluginSubId, String logMsg, String descr, Integer port, String protocol, String cveEntry) {
m_vulnerabilityId = vulnerabilityId;
m_node = node;
m_monitoredService = monitoredService;
m_creationTime = creationTime;
m_lastAttemptTime = lastAttemptTime;
m_lastScanTime = lastScanTime;
m_resolvedTime = resolvedTime;
m_severity = severity;
m_vulnPlugin = vulnPlugin;
m_logMsg = logMsg;
m_descr = descr;
m_port = port;
m_protocol = protocol;
m_cveEntry = cveEntry;
}
/**
* default constructor
*/
public OnmsVulnerability() {
}
/**
* minimal constructor
*
* @param vulnerabilityId a {@link java.lang.Integer} object.
* @param creationTime a {@link java.util.Date} object.
* @param lastAttemptTime a {@link java.util.Date} object.
* @param lastScanTime a {@link java.util.Date} object.
* @param severity a {@link java.lang.Integer} object.
* @param vulnPlugin a {@link org.opennms.netmgt.model.OnmsVulnPlugin} object.
* @param pluginSubId a {@link java.lang.Integer} object.
*/
public OnmsVulnerability(Integer vulnerabilityId, Date creationTime, Date lastAttemptTime, Date lastScanTime, Integer severity, OnmsVulnPlugin vulnPlugin, Integer pluginSubId) {
m_vulnerabilityId = vulnerabilityId;
m_creationTime = creationTime;
m_lastAttemptTime = lastAttemptTime;
m_lastScanTime = lastScanTime;
m_severity = severity;
m_vulnPlugin = vulnPlugin;
}
/**
* <p>getVulnerabilityId</p>
*
* @return a {@link java.lang.Integer} object.
*/
@Id
@SequenceGenerator(name="vulnerabilitySequence", sequenceName="vulnerabilityId")
@GeneratedValue(generator="vulnerabilitySequence")
@Column(name="vulnerabilityId")
public Integer getVulnerabilityId() {
return m_vulnerabilityId;
}
/**
* <p>setVulnerabilityId</p>
*
* @param vulnerabilityId a {@link java.lang.Integer} object.
*/
public void setVulnerabilityId(Integer vulnerabilityId) {
m_vulnerabilityId = vulnerabilityId;
}
/**
* <p>getNode</p>
*
* @return a {@link org.opennms.netmgt.model.OnmsNode} object.
*/
@ManyToOne
@JoinColumn(name="nodeid")
public OnmsNode getNode() {
return m_node;
}
/**
* <p>setNode</p>
*
* @param node a {@link org.opennms.netmgt.model.OnmsNode} object.
*/
public void setNode(OnmsNode node) {
m_node = node;
}
// /**
// * @hibernate.property
// * column="ipaddr"
// * length="16"
// *
// */
// public OnmsIpInterface getIpInterface() {
// return m_ipInterface;
// }
//
// public void setIpInterface(OnmsIpInterface ipInterface) {
// m_ipInterface = ipInterface;
// }
//TODO: Add this column to create.sql, should remove node column, may
//need trigger for refactoring
/**
* <p>getMonitoredService</p>
*
* @return a {@link org.opennms.netmgt.model.OnmsMonitoredService} object.
*/
@ManyToOne
@JoinColumn(name="ifServiceId")
public OnmsMonitoredService getMonitoredService() {
return m_monitoredService;
}
/**
* <p>setMonitoredService</p>
*
* @param monitoredService a {@link org.opennms.netmgt.model.OnmsMonitoredService} object.
*/
public void setMonitoredService(OnmsMonitoredService monitoredService) {
m_monitoredService = monitoredService;
}
/**
* <p>getCreationTime</p>
*
* @return a {@link java.util.Date} object.
*/
@Temporal(TemporalType.TIMESTAMP)
@Column(name="creationTime", nullable=false)
public Date getCreationTime() {
return m_creationTime;
}
/**
* <p>setCreationTime</p>
*
* @param creationTime a {@link java.util.Date} object.
*/
public void setCreationTime(Date creationTime) {
m_creationTime = creationTime;
}
/**
* <p>getLastAttemptTime</p>
*
* @return a {@link java.util.Date} object.
*/
@Temporal(TemporalType.TIMESTAMP)
@Column(name="lastAttemptTime", nullable=false)
public Date getLastAttemptTime() {
return m_lastAttemptTime;
}
/**
* <p>setLastAttemptTime</p>
*
* @param lastAttemptTime a {@link java.util.Date} object.
*/
public void setLastAttemptTime(Date lastAttemptTime) {
m_lastAttemptTime = lastAttemptTime;
}
/**
* <p>getLastScanTime</p>
*
* @return a {@link java.util.Date} object.
*/
@Temporal(TemporalType.TIMESTAMP)
@Column(name="lastScanTime", nullable=false)
public Date getLastScanTime() {
return m_lastScanTime;
}
/**
* <p>setLastScanTime</p>
*
* @param lastScanTime a {@link java.util.Date} object.
*/
public void setLastScanTime(Date lastScanTime) {
m_lastScanTime = lastScanTime;
}
/**
* <p>getResolvedTime</p>
*
* @return a {@link java.util.Date} object.
*/
@Temporal(TemporalType.TIMESTAMP)
@Column(name="resolvedTime")
public Date getResolvedTime() {
return m_resolvedTime;
}
/**
* <p>setResolvedTime</p>
*
* @param resolvedTime a {@link java.util.Date} object.
*/
public void setResolvedTime(Date resolvedTime) {
m_resolvedTime = resolvedTime;
}
/**
* <p>getSeverity</p>
*
* @return a {@link java.lang.Integer} object.
*/
@Column(name="severity")
public Integer getSeverity() {
return m_severity;
}
/**
* <p>setSeverity</p>
*
* @param severity a {@link java.lang.Integer} object.
*/
public void setSeverity(Integer severity) {
m_severity = severity;
}
/**
* <p>getVulnPlugin</p>
*
* @return a {@link org.opennms.netmgt.model.OnmsVulnPlugin} object.
*/
@ManyToOne
@JoinColumn(name="pluginId", nullable=false)
public OnmsVulnPlugin getVulnPlugin() {
return m_vulnPlugin;
}
/**
* <p>setVulnPlugin</p>
*
* @param vulnPlugin a {@link org.opennms.netmgt.model.OnmsVulnPlugin} object.
*/
public void setVulnPlugin(OnmsVulnPlugin vulnPlugin) {
m_vulnPlugin = vulnPlugin;
}
/**
* <p>getLogMsg</p>
*
* @return a {@link java.lang.String} object.
*/
@Column(name="logMsg", length=1024)
public String getLogMsg() {
return m_logMsg;
}
/**
* <p>setLogMsg</p>
*
* @param logMsg a {@link java.lang.String} object.
*/
public void setLogMsg(String logMsg) {
m_logMsg = logMsg;
}
/**
* <p>getDescr</p>
*
* @return a {@link java.lang.String} object.
*/
@Column(name="descr", length=1024)
public String getDescr() {
return m_descr;
}
/**
* <p>setDescr</p>
*
* @param descr a {@link java.lang.String} object.
*/
public void setDescr(String descr) {
m_descr = descr;
}
/**
* <p>getPort</p>
*
* @return a {@link java.lang.Integer} object.
*/
@Column(name="port")
public Integer getPort() {
return m_port;
}
/**
* <p>setPort</p>
*
* @param port a {@link java.lang.Integer} object.
*/
public void setPort(Integer port) {
m_port = port;
}
/**
* <p>getProtocol</p>
*
* @return a {@link java.lang.String} object.
*/
@Column(name="protocol", length=32)
public String getProtocol() {
return m_protocol;
}
/**
* <p>setProtocol</p>
*
* @param protocol a {@link java.lang.String} object.
*/
public void setProtocol(String protocol) {
m_protocol = protocol;
}
/**
* <p>getCveEntry</p>
*
* @return a {@link java.lang.String} object.
*/
@Column(name="cveEntry", length=14)
public String getCveEntry() {
return m_cveEntry;
}
/**
* <p>setCveEntry</p>
*
* @param cveEntry a {@link java.lang.String} object.
*/
public void setCveEntry(String cveEntry) {
m_cveEntry = cveEntry;
}
/**
* <p>toString</p>
*
* @return a {@link java.lang.String} object.
*/
public String toString() {
return new ToStringCreator(this)
.append("vulnerabilityId", getVulnerabilityId())
.toString();
}
/** {@inheritDoc} */
public void visit(EntityVisitor visitor) {
// TODO Auto-generated method stub
throw new RuntimeException("visitor method not implemented");
}
}