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.controller.sal.core.Node;
13 import org.opendaylight.ovsdb.lib.notation.Row;
14 import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
16 public class SouthboundEvent extends AbstractEvent {
17 public enum Type { NODE, ROW }
20 private String tableName;
23 private Object context;
24 public SouthboundEvent(Node node, Action action) {
25 super(HandlerType.SOUTHBOUND, action);
26 this.type = Type.NODE;
29 public SouthboundEvent(Node node, String tableName, String uuid, Row row, Action action) {
30 super(HandlerType.SOUTHBOUND, action);
33 this.tableName = tableName;
37 public SouthboundEvent(Node node, String tableName, String uuid, Row row, Object context, Action action) {
38 super(HandlerType.SOUTHBOUND, action);
41 this.tableName = tableName;
44 this.context = context;
46 public Type getType() {
49 public Node getNode() {
52 public String getTableName() {
55 public String getUuid() {
61 public Object getContext() {
65 public String toString() {
66 return "SouthboundEvent [type=" + type + ", action=" + super.getAction() + ", node=" + node + ", tableName=" + tableName
67 + ", uuid=" + uuid + ", row=" + row + ", context=" + context.toString() + "]";
70 public int hashCode() {
72 int result = super.hashCode();
73 result = prime * result + ((node == null) ? 0 : node.hashCode());
74 result = prime * result + ((tableName == null) ? 0 : tableName.hashCode());
75 result = prime * result + ((type == null) ? 0 : type.hashCode());
76 result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
80 public boolean equals(Object obj) {
87 if (getClass() != obj.getClass()) {
90 if (!super.equals(obj)) {
93 SouthboundEvent other = (SouthboundEvent) obj;
95 if (other.node != null) {
98 } else if (!node.equals(other.node)) {
101 if (tableName == null) {
102 if (other.tableName != null) {
105 } else if (!tableName.equals(other.tableName)) {
109 if (other.type != null) {
112 } else if (!type.equals(other.type)) {
116 if (other.uuid != null) {
119 } else if (!uuid.equals(other.uuid)) {