Added breadcrumbs array to topo2CurrentLayout response.
Included Region name in "closed region" data structures.
Change-Id: I1d4c223255b7ea8239f38c63d4caebe1bdeddf32
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 87d5036..40dec55 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
@@ -29,6 +29,7 @@
import java.util.Set;
import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Strings.isNullOrEmpty;
import static org.onosproject.net.region.RegionId.regionId;
/**
@@ -36,7 +37,8 @@
*/
public class UiRegion extends UiNode {
- private static final String NULL_NAME = "<null-region>";
+ private static final String NULL_NAME = "(root)";
+ private static final String NO_NAME = "???";
/**
* The identifier for the null-region. That is, a container for devices,
@@ -271,4 +273,20 @@
public List<String> layerOrder() {
return Collections.unmodifiableList(layerOrder);
}
+
+ /**
+ * Guarantees to return a string for the name of the specified region.
+ * If region is null, we return the null region name, else we return
+ * the name as configured on the region.
+ *
+ * @param region the region whose name we require
+ * @return the region's name
+ */
+ public static String safeName(Region region) {
+ if (region == null) {
+ return NULL_NAME;
+ }
+ String name = region.name();
+ return isNullOrEmpty(name) ? NO_NAME : name;
+ }
}