Skip to content

Commit

Permalink
add Optional/clean up surveillance-views
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Reed committed Mar 28, 2017
1 parent 08fed7d commit 5e6e9b2
Show file tree
Hide file tree
Showing 20 changed files with 349 additions and 1,619 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*******************************************************************************
* This file is part of OpenNMS(R).
*
* Copyright (C) 2017-2017 The OpenNMS Group, Inc.
* Copyright (C) 2017 The OpenNMS Group, Inc.
* OpenNMS(R) is Copyright (C) 1999-2017 The OpenNMS Group, Inc.
*
* OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
Expand Down Expand Up @@ -29,82 +29,65 @@
package org.opennms.netmgt.config.surveillanceViews;


import java.io.Serializable;
import java.util.Objects;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

import org.opennms.core.xml.ValidateUsing;
import org.opennms.netmgt.config.utils.ConfigUtils;

/**
* This element is used to specify OpenNMS specific categories. Note: currently,
* these categories are defined in a separate configuration file and are
* related directly to monitored services. I have separated out this element so
* that it can be refereneced by other entities (nodes, interfaces, etc.)
* that it can be referenced by other entities (nodes, interfaces, etc.)
* however, they will be ignored until the domain model is changed and the
* service layer is adapted for this behavior.
*
*
* @version $Revision$ $Date$
*/
@XmlRootElement(name = "category")
@XmlAccessorType(XmlAccessType.FIELD)
public class Category implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@ValidateUsing("surveillance-views.xsd")
public class Category implements Serializable {
private static final long serialVersionUID = 2L;

@XmlAttribute(name = "name", required = true)
private String name;
private String m_name;

public Category() {
}

/**
* Overrides the Object.equals method.
*
* @param obj
* @return true if the objects are equal.
*/
@Override
public boolean equals(final Object obj) {
if ( this == obj ) {
return true;
}

if (obj instanceof Category) {
Category temp = (Category)obj;
boolean equals = Objects.equals(temp.name, name);
return equals;
}
return false;
public Category(final String name) {
setName(name);
}

/**
* Returns the value of field 'name'.
*
* @return the value of field 'Name'.
*/
public String getName() {
return this.name;
return m_name;
}

public void setName(final String name) {
m_name = ConfigUtils.assertNotEmpty(name, "name");
}

/**
* Method hashCode.
*
* @return a hash code value for the object.
*/
@Override
public int hashCode() {
int hash = Objects.hash(
name);
return hash;
return Objects.hash(m_name);
}

/**
* Sets the value of field 'name'.
*
* @param name the value of field 'name'.
*/
public void setName(final String name) {
this.name = name;
@Override
public boolean equals(final Object obj) {
if ( this == obj ) {
return true;
}

if (obj instanceof Category) {
final Category that = (Category)obj;
return Objects.equals(this.m_name, that.m_name);
}
return false;
}

}
Loading

0 comments on commit 5e6e9b2

Please sign in to comment.