Squashed commit of the following:
[ovsdb.git] / openstack / net-virt / src / main / java / org / opendaylight / ovsdb / openstack / netvirt / NodeCacheManagerEvent.java
index e471be2d1025f32cca52fa236be134511d794cf9..5c2bb38d0588903a10eea46ff037dbe57bcb08ae 100644 (file)
@@ -1,33 +1,39 @@
 /*
- * Copyright (C) 2015 Red Hat, Inc.
+ * Copyright (c) 2015 Red Hat, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Flavio Fernandes
  */
 package org.opendaylight.ovsdb.openstack.netvirt;
 
 import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
 
+/**
+ * @author Flavio Fernandes (ffernand@redhat.com)
+ * @author Sam Hague (shague@redhat.com)
+ */
 public class NodeCacheManagerEvent extends AbstractEvent {
+    private Node node;
 
-    private String nodeIdentifier;
-
-    public NodeCacheManagerEvent(String nodeIdentifier, Action action) {
+    public NodeCacheManagerEvent(Node node, Action action) {
         super(HandlerType.NODE, action);
-        this.nodeIdentifier = nodeIdentifier;
+        this.node = node;
+    }
+
+    public Node getNode() {
+        return node;
     }
 
     public String getNodeIdentifier() {
-        return nodeIdentifier;
+        return node.getNodeId().getValue();
     }
 
     @Override
     public String toString() {
         return "NodeCacheManagerEvent [action=" + super.getAction()
-               + ", nodeIdentifier=" + nodeIdentifier
+               + ", node=" + node
                + "]";
     }
 
@@ -35,7 +41,7 @@ public class NodeCacheManagerEvent extends AbstractEvent {
     public int hashCode() {
         final int prime = 31;
         int result = super.hashCode();
-        result = prime * result + ((nodeIdentifier == null) ? 0 : nodeIdentifier.hashCode());
+        result = prime * result + ((node == null) ? 0 : node.hashCode());
         return result;
     }
 
@@ -54,11 +60,11 @@ public class NodeCacheManagerEvent extends AbstractEvent {
             return false;
         }
         NodeCacheManagerEvent other = (NodeCacheManagerEvent) obj;
-        if (nodeIdentifier == null) {
-            if (other.nodeIdentifier != null) {
+        if (node == null) {
+            if (other.node != null) {
                 return false;
             }
-        } else if (!nodeIdentifier.equals(other.nodeIdentifier)) {
+        } else if (!node.equals(other.node)) {
             return false;
         }
         return true;