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;
15 public class SouthboundEvent {
16 public enum Type { NODE, ROW };
17 public enum Action { ADD, UPDATE, DELETE };
19 private Action action;
21 private String tableName;
24 private Object context;
25 public SouthboundEvent(Node node, Action action) {
27 this.type = Type.NODE;
31 public SouthboundEvent(Node node, String tableName, String uuid, Row row, Action action) {
36 this.tableName = tableName;
40 public SouthboundEvent(Node node, String tableName, String uuid, Row row, Object context, Action action) {
45 this.tableName = tableName;
48 this.context = context;
50 public Type getType() {
53 public Action getAction() {
56 public Node getNode() {
59 public String getTableName() {
62 public String getUuid() {
68 public Object getContext() {
72 public String toString() {
73 return "SouthboundEvent [type=" + type + ", action=" + action + ", node=" + node + ", tableName=" + tableName
74 + ", uuid=" + uuid + ", row=" + row + ", context=" + context.toString() + "]";
77 public int hashCode() {
80 result = prime * result + ((action == null) ? 0 : action.hashCode());
81 result = prime * result + ((node == null) ? 0 : node.hashCode());
82 result = prime * result + ((tableName == null) ? 0 : tableName.hashCode());
83 result = prime * result + ((type == null) ? 0 : type.hashCode());
84 result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
88 public boolean equals(Object obj) {
93 if (getClass() != obj.getClass())
95 SouthboundEvent other = (SouthboundEvent) obj;
96 if (action != other.action)
99 if (other.node != null)
101 } else if (!node.equals(other.node))
103 if (tableName == null) {
104 if (other.tableName != null)
106 } else if (!tableName.equals(other.tableName))
108 if (type != other.type)
111 if (other.uuid != null)
113 } else if (!uuid.equals(other.uuid))