2 * Copyright (C) 2013 Red Hat, Inc.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 * Authors : Madhu Venugopal, Brent Salisbury
10 package org.opendaylight.ovsdb.openstack.netvirt;
12 import org.opendaylight.ovsdb.lib.notation.Row;
13 import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
14 //import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
15 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
17 public class SouthboundEvent extends AbstractEvent {
18 public enum Type { NODE, ROW }
21 private String tableName;
24 private Object context;
25 public SouthboundEvent(Node node, Action action) {
26 super(HandlerType.SOUTHBOUND, action);
27 this.type = Type.NODE;
30 public SouthboundEvent(Node node, String tableName, String uuid, Row row, Action action) {
31 super(HandlerType.SOUTHBOUND, action);
34 this.tableName = tableName;
38 public SouthboundEvent(Node node, String tableName, String uuid, Row row, Object context, Action action) {
39 super(HandlerType.SOUTHBOUND, action);
42 this.tableName = tableName;
45 this.context = context;
47 public Type getType() {
50 public Node getNode() {
53 public String getTableName() {
56 public String getUuid() {
62 public Object getContext() {
66 public String toString() {
67 if (type == Type.NODE) {
68 return "SouthboundEvent [type=" + type
69 + ", action=" + super.getAction()
70 + ", node=" + node + "]";
71 } else if (type == Type.ROW) {
72 return "SouthboundEvent [type=" + type
73 + ", action=" + super.getAction()
75 + ", tableName=" + tableName
78 + ", context=" + context + "]";
80 return "SouthboundEvent [type=" + type + "]";
85 public int hashCode() {
87 int result = super.hashCode();
88 result = prime * result + ((node == null) ? 0 : node.hashCode());
89 result = prime * result + ((tableName == null) ? 0 : tableName.hashCode());
90 result = prime * result + ((type == null) ? 0 : type.hashCode());
91 result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
95 public boolean equals(Object obj) {
102 if (getClass() != obj.getClass()) {
105 if (!super.equals(obj)) {
108 SouthboundEvent other = (SouthboundEvent) obj;
110 if (other.node != null) {
113 } else if (!node.equals(other.node)) {
116 if (tableName == null) {
117 if (other.tableName != null) {
120 } else if (!tableName.equals(other.tableName)) {
124 if (other.type != null) {
127 } else if (!type.equals(other.type)) {
131 if (other.uuid != null) {
134 } else if (!uuid.equals(other.uuid)) {