CORD GUI - added CDN to both Basic and Family Bundles, but hide it from GUI display.
Change-Id: I5fa1ca6b34ba6b49e5c498f8b3b570715d51d088
diff --git a/apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/model/BundleFactory.java b/apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/model/BundleFactory.java
index 4c9e621..2aa6f7c 100644
--- a/apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/model/BundleFactory.java
+++ b/apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/model/BundleFactory.java
@@ -53,7 +53,8 @@
new DefaultBundleDescriptor(BASIC_ID, BASIC_DISPLAY_NAME,
BASIC_DESCRIPTION,
XosFunctionDescriptor.INTERNET,
- XosFunctionDescriptor.FIREWALL);
+ XosFunctionDescriptor.FIREWALL,
+ XosFunctionDescriptor.CDN);
/**
* Designates the FAMILY bundle.
@@ -63,6 +64,7 @@
FAMILY_DESCRIPTION,
XosFunctionDescriptor.INTERNET,
XosFunctionDescriptor.FIREWALL,
+ XosFunctionDescriptor.CDN,
XosFunctionDescriptor.URL_FILTER);
// all bundles, in the order they should be listed in the GUI
@@ -98,6 +100,8 @@
/**
* Returns an object node representation of the given bundle.
+ * Note that some functions (such as CDN) are not added to the output
+ * as we don't want them to appear in the GUI.
*
* @param bundle the bundle
* @return object node
@@ -113,7 +117,9 @@
ArrayNode funcs = arrayNode();
for (XosFunctionDescriptor xfd: bundle.descriptor().functions()) {
- funcs.add(XosFunctionFactory.toObjectNode(xfd));
+ if (xfd.visible()) {
+ funcs.add(XosFunctionFactory.toObjectNode(xfd));
+ }
}
bnode.set(FUNCTIONS, funcs);
root.set(BUNDLE, bnode);
diff --git a/apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/model/XosFunctionDescriptor.java b/apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/model/XosFunctionDescriptor.java
index 8ed4666..411a208 100644
--- a/apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/model/XosFunctionDescriptor.java
+++ b/apps/demo/cord-gui/src/main/java/org/onosproject/cord/gui/model/XosFunctionDescriptor.java
@@ -27,7 +27,8 @@
INTERNET("internet",
"Internet",
"Basic internet connectivity.",
- false),
+ false,
+ true),
/**
* Firewall function.
@@ -35,6 +36,7 @@
FIREWALL("firewall",
"Firewall",
"Normal firewall protection.",
+ true,
true),
/**
@@ -43,6 +45,7 @@
URL_FILTER("url_filter",
"Parental Control",
"Variable levels of URL filtering.",
+ true,
true),
/**
@@ -51,20 +54,23 @@
CDN("cdn",
"CDN",
"Content Distribution Network service.",
- true);
+ true,
+ false);
private final String id;
private final String displayName;
private final String description;
private final boolean backend;
+ private final boolean visible;
XosFunctionDescriptor(String id, String displayName, String description,
- boolean backend) {
+ boolean backend, boolean visible) {
this.id = id;
this.displayName = displayName;
this.description = description;
this.backend = backend;
+ this.visible = visible;
}
/**
@@ -103,4 +109,13 @@
return backend;
}
+ /**
+ * Returns true if this function should be shown in the GUI, in the
+ * bundle listing.
+ *
+ * @return true if to be displayed
+ */
+ public boolean visible() {
+ return visible;
+ }
}