/*
- * Copyright (C) 2013 Red Hat, Inc.
+ * Copyright (c) 2013, 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 : Madhu Venugopal, Brent Salisbury
*/
+
package org.opendaylight.ovsdb.northbound;
import java.io.IOException;
import java.util.Iterator;
import java.util.concurrent.ExecutionException;
-import javax.xml.bind.annotation.XmlElement;
-
import org.opendaylight.ovsdb.lib.OvsdbClient;
import org.opendaylight.ovsdb.lib.notation.Row;
import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
-@Deprecated
public class OvsdbRow {
private static final String PARENTUUID = "parent_uuid";
+ private static final String PARENTTABLE = "parent_table";
+ private static final String PARENTCOLUMN = "parent_column";
private static final String ROW = "row";
- @XmlElement(name=PARENTUUID)
- String parentUuid;
-
- String tableName;
-
- @XmlElement(name=ROW)
- Row<GenericTableSchema> row;
+ private String parentUuid;
+ private String parentTable;
+ private String parentColumn;
+ private String tableName;
+ private Row<GenericTableSchema> row;
public OvsdbRow() {
}
this.row = row;
}
+ public OvsdbRow(String parentTable, String parentUuid, String parentColumn, String tableName, Row<GenericTableSchema> row) {
+ this.parentTable = parentTable;
+ this.parentColumn = parentColumn;
+ this.parentUuid = parentUuid;
+ this.tableName = tableName;
+ this.row = row;
+ }
+
public static OvsdbRow fromJsonNode(OvsdbClient client, String dbName, JsonNode json) {
JsonNode parentUuidNode = json.get(PARENTUUID);
String parentUuid = null;
- if (parentUuidNode != null) parentUuid = parentUuidNode.asText();
-
+ if (parentUuidNode != null) {
+ parentUuid = parentUuidNode.asText();
+ }
+ JsonNode parentTableNode = json.get(PARENTTABLE);
+ String parentTable = null;
+ if (parentTableNode != null) {
+ parentTable = parentTableNode.asText();
+ }
+ JsonNode parentColumnNode = json.get(PARENTCOLUMN);
+ String parentColumn = null;
+ if (parentColumnNode != null) {
+ parentColumn = parentColumnNode.asText();
+ }
JsonNode rowNode = json.get(ROW);
- if (rowNode == null) return null;
+ if (rowNode == null) {
+ return null;
+ }
for(Iterator<String> fieldNames = rowNode.fieldNames(); fieldNames.hasNext();) {
String tableName = fieldNames.next();
Row<GenericTableSchema> row = null;
e.printStackTrace();
return null;
}
- return new OvsdbRow(parentUuid, tableName, row);
+ return new OvsdbRow(parentTable, parentUuid, parentColumn, tableName, row);
}
return null;
}
return schema.createRow((ObjectNode)rowJson);
}
+ public String getParentTable() {
+ return parentTable;
+ }
+
public String getParentUuid() {
return parentUuid;
}
+ public String getParentColumn() {
+ return parentColumn;
+ }
+
public String getTableName() {
return tableName;
}
public Row<GenericTableSchema> getRow() {
return row;
}
-
- @Override
- public String toString() {
- return "OVSDBRow [parentUuid=" + parentUuid + ", tableName="
- + tableName + ", row=" + row + "]";
- }
}