Modified UI model objects to be backed merely by IDs of the core model objects.
Change-Id: I4ca81fb1c877ee4ce4209d405fd8c6645c8f5d20
diff --git a/core/api/src/main/java/org/onosproject/ui/model/topo/UiRegion.java b/core/api/src/main/java/org/onosproject/ui/model/topo/UiRegion.java
index 7cd0da9..7a565fe 100644
--- a/core/api/src/main/java/org/onosproject/ui/model/topo/UiRegion.java
+++ b/core/api/src/main/java/org/onosproject/ui/model/topo/UiRegion.java
@@ -60,7 +60,7 @@
private final UiTopology topology;
- private final Region region;
+ private final RegionId regionId;
// keep track of hierarchy (inferred from UiTopoLayoutService)
private RegionId parent;
@@ -76,7 +76,7 @@
// Implementation Note: if region is null, this UiRegion is being used
// as a container for devices, hosts, links that belong to no region.
this.topology = topology;
- this.region = region;
+ this.regionId = region == null ? NULL_ID : region.id();
setLayerOrder(DEFAULT_LAYER_TAGS);
}
@@ -104,7 +104,7 @@
* @return region ID
*/
public RegionId id() {
- return region == null ? NULL_ID : region.id();
+ return regionId;
}
/**
@@ -169,6 +169,7 @@
@Override
public String name() {
+ Region region = backingRegion();
return region == null ? NULL_NAME : region.name();
}
@@ -179,7 +180,7 @@
* @return the backing region instance
*/
public Region backingRegion() {
- return region;
+ return topology.services.region().getRegion(regionId);
}
/**
@@ -210,6 +211,7 @@
* @return region type
*/
public Region.Type type() {
+ Region region = backingRegion();
return region == null ? null : region.type();
}