Merge "Don't build OVSDB Distribution in Jenkins"
[ovsdb.git] / openstack / net-virt / src / main / java / org / opendaylight / ovsdb / openstack / netvirt / SouthboundEvent.java
1 /*
2  * Copyright (C) 2013 Red Hat, Inc.
3  *
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
7  *
8  * Authors : Madhu Venugopal, Brent Salisbury
9  */
10 package org.opendaylight.ovsdb.openstack.netvirt;
11
12 import org.opendaylight.controller.sal.core.Node;
13 import org.opendaylight.ovsdb.lib.notation.Row;
14
15 public class SouthboundEvent extends AbstractEvent {
16     public enum Type { NODE, ROW };
17     private Type type;
18     private Node node;
19     private String tableName;
20     private String uuid;
21     private Row row;
22     private Object context;
23     public SouthboundEvent(Node node, Action action) {
24         super(HandlerType.SOUTHBOUND, action);
25         this.type = Type.NODE;
26         this.node = node;
27     }
28     public SouthboundEvent(Node node, String tableName, String uuid, Row row, Action action) {
29         super(HandlerType.SOUTHBOUND, action);
30         this.type = Type.ROW;
31         this.node = node;
32         this.tableName = tableName;
33         this.uuid = uuid;
34         this.row = row;
35     }
36     public SouthboundEvent(Node node, String tableName, String uuid, Row row, Object context, Action action) {
37         super(HandlerType.SOUTHBOUND, action);
38         this.type = Type.ROW;
39         this.node = node;
40         this.tableName = tableName;
41         this.uuid = uuid;
42         this.row = row;
43         this.context = context;
44     }
45     public Type getType() {
46         return type;
47     }
48     public Node getNode() {
49         return node;
50     }
51     public String getTableName() {
52         return tableName;
53     }
54     public String getUuid() {
55         return uuid;
56     }
57     public Row getRow() {
58         return row;
59     }
60     public Object getContext() {
61         return context;
62     }
63     @Override
64     public String toString() {
65         return "SouthboundEvent [type=" + type + ", action=" + super.getAction() + ", node=" + node + ", tableName=" + tableName
66                 + ", uuid=" + uuid + ", row=" + row + ", context=" + context.toString() + "]";
67     }
68     @Override
69     public int hashCode() {
70         final int prime = 31;
71         int result = super.hashCode();
72         result = prime * result + ((node == null) ? 0 : node.hashCode());
73         result = prime * result + ((tableName == null) ? 0 : tableName.hashCode());
74         result = prime * result + ((type == null) ? 0 : type.hashCode());
75         result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
76         return result;
77     }
78     @Override
79     public boolean equals(Object obj) {
80         if (this == obj)
81             return true;
82         if (obj == null)
83             return false;
84         if (getClass() != obj.getClass())
85             return false;
86         if (!super.equals(obj))
87             return false;
88         SouthboundEvent other = (SouthboundEvent) obj;
89         if (node == null) {
90             if (other.node != null)
91                 return false;
92         } else if (!node.equals(other.node))
93             return false;
94         if (tableName == null) {
95             if (other.tableName != null)
96                 return false;
97         } else if (!tableName.equals(other.tableName))
98             return false;
99         if (type == null) {
100             if (other.type != null)
101                 return false;
102         } else if (!type.equals(other.type))
103             return false;
104         if (uuid == null) {
105             if (other.uuid != null)
106                 return false;
107         } else if (!uuid.equals(other.uuid))
108             return false;
109         return true;
110     }
111 }