Inserted set and get controllers methods in ovsdb controller config

Change-Id: I791ff2ae159d0ac50beff22abda2b187913428f6
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Row.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Row.java
index 3326922..0060960 100644
--- a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Row.java
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Row.java
@@ -15,20 +15,21 @@
  */
 package org.onosproject.ovsdb.rfc.notation;
 
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.collect.Maps;
 
 import java.util.Collection;
 import java.util.Map;
 import java.util.Objects;
 
-import com.google.common.collect.Maps;
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
 
 /**
  * Row is the basic element of the OpenVswitch's table.
  */
 public final class Row {
     private String tableName;
+    private UUID uuid;
     private Map<String, Column> columns;
 
     /**
@@ -40,9 +41,11 @@
 
     /**
      * Row constructor.
+     *
      * @param tableName table name
      */
-    public Row(String tableName) {
+    @Deprecated
+    private Row(String tableName) {
         checkNotNull(tableName, "tableName cannot be null");
         this.tableName = tableName;
         this.columns = Maps.newHashMap();
@@ -50,18 +53,22 @@
 
     /**
      * Row constructor.
+     *
      * @param tableName table name
-     * @param columns Map of Column entity
+     * @param columns   Map of Column entity
      */
-    public Row(String tableName, Map<String, Column> columns) {
+    public Row(String tableName, UUID uuid, Map<String, Column> columns) {
         checkNotNull(tableName, "table name cannot be null");
+        checkNotNull(uuid, "uuid cannot be null");
         checkNotNull(columns, "columns cannot be null");
         this.tableName = tableName;
+        this.uuid = uuid;
         this.columns = columns;
     }
 
     /**
      * Returns tableName.
+     *
      * @return tableName
      */
     public String tableName() {
@@ -70,6 +77,7 @@
 
     /**
      * Set tableName value.
+     *
      * @param tableName table name
      */
     public void setTableName(String tableName) {
@@ -77,7 +85,26 @@
     }
 
     /**
+     * Returns uuid.
+     *
+     * @return uuid
+     */
+    public UUID uuid() {
+        return uuid;
+    }
+
+    /**
+     * Sets uuid value.
+     *
+     * @param uuid new uuid
+     */
+    public void setUuid(UUID uuid) {
+        this.uuid = uuid;
+    }
+
+    /**
      * Returns Column by ColumnSchema.
+     *
      * @param columnName column name
      * @return Column
      */
@@ -87,6 +114,7 @@
 
     /**
      * Returns Collection of Column.
+     *
      * @return Collection of Column
      */
     public Collection<Column> getColumns() {
@@ -95,8 +123,9 @@
 
     /**
      * add Column.
+     *
      * @param columnName column name
-     * @param data Column entity
+     * @param data       Column entity
      */
     public void addColumn(String columnName, Column data) {
         this.columns.put(columnName, data);
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Bridge.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Bridge.java
index bd589f0..0b5ffef 100644
--- a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Bridge.java
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Bridge.java
@@ -15,16 +15,17 @@
  */
 package org.onosproject.ovsdb.rfc.table;
 
-import java.util.Map;
-import java.util.Set;
-
 import org.onosproject.ovsdb.rfc.notation.Column;
+import org.onosproject.ovsdb.rfc.notation.OvsdbSet;
 import org.onosproject.ovsdb.rfc.notation.Row;
 import org.onosproject.ovsdb.rfc.notation.UUID;
 import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
 import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService;
 import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
 
+import java.util.Map;
+import java.util.Set;
+
 /**
  * This class provides operations of Bridge Table.
  */
@@ -351,7 +352,7 @@
      * of attributes.
      * @param controller the column data which column name is "controller"
      */
-    public void setController(Set<UUID> controller) {
+    public void setController(OvsdbSet controller) {
         ColumnDescription columndesc = new ColumnDescription(
                                                              BridgeColumn.CONTROLLER
                                                                      .columnName(),
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/TableGenerator.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/TableGenerator.java
index c1ae7c7..f5bd860 100644
--- a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/TableGenerator.java
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/TableGenerator.java
@@ -37,6 +37,7 @@
      * @param tableName table name
      * @return Object table entity
      */
+    //FIXME change the name, it creates a row object, such as a controller.
     public static Object createTable(DatabaseSchema dbSchema,
                                      OvsdbTable tableName) {
         Row row = new Row();
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/FromJsonUtil.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/FromJsonUtil.java
index 9744fb4..1dcf48f 100644
--- a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/FromJsonUtil.java
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/FromJsonUtil.java
@@ -15,12 +15,11 @@
  */
 package org.onosproject.ovsdb.rfc.utils;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import org.onosproject.ovsdb.rfc.exception.AbnormalJsonNodeException;
 import org.onosproject.ovsdb.rfc.exception.UnsupportedException;
 import org.onosproject.ovsdb.rfc.jsonrpc.Callback;
@@ -41,11 +40,11 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 /**
  * JsonNode utility class. convert JsonNode into Object.
@@ -247,7 +246,7 @@
         validateJsonNode(rowsNode, "rows");
         ArrayList<Row> rows = Lists.newArrayList();
         for (JsonNode rowNode : rowsNode.get("rows")) {
-            rows.add(createRow(tableSchema, rowNode));
+            rows.add(createRow(tableSchema, null, rowNode)); //FIXME null will throw exception
         }
         return rows;
     }
@@ -285,8 +284,8 @@
             UUID uuid = UUID.uuid(uuidStr);
             JsonNode newR = oldNewRow.getValue().get("new");
             JsonNode oldR = oldNewRow.getValue().get("old");
-            Row newRow = newR != null ? createRow(tableSchema, newR) : null;
-            Row oldRow = oldR != null ? createRow(tableSchema, oldR) : null;
+            Row newRow = newR != null ? createRow(tableSchema, uuid, newR) : null;
+            Row oldRow = oldR != null ? createRow(tableSchema, uuid, oldR) : null;
             RowUpdate rowUpdate = new RowUpdate(uuid, oldRow, newRow);
             rows.put(uuid, rowUpdate);
         }
@@ -299,7 +298,7 @@
      * @param rowNode JsonNode
      * @return Row
      */
-    private static Row createRow(TableSchema tableSchema, JsonNode rowNode) {
+    private static Row createRow(TableSchema tableSchema, UUID uuid, JsonNode rowNode) {
         if (tableSchema == null) {
             return null;
         }
@@ -314,7 +313,7 @@
                 columns.put(columnName, new Column(columnName, obj));
             }
         }
-        return new Row(tableSchema.name(), columns);
+        return new Row(tableSchema.name(), uuid, columns);
     }
 
 }