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 4c9e6212f1..2aa6f7cced 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 @@ public class BundleFactory extends JsonFactory { 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 @@ public class BundleFactory extends JsonFactory { 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 @@ public class BundleFactory extends JsonFactory { /** * 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 @@ public class BundleFactory extends JsonFactory { 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 8ed4666d6b..411a20893f 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 @@ public enum XosFunctionDescriptor { INTERNET("internet", "Internet", "Basic internet connectivity.", - false), + false, + true), /** * Firewall function. @@ -35,6 +36,7 @@ public enum XosFunctionDescriptor { FIREWALL("firewall", "Firewall", "Normal firewall protection.", + true, true), /** @@ -43,6 +45,7 @@ public enum XosFunctionDescriptor { URL_FILTER("url_filter", "Parental Control", "Variable levels of URL filtering.", + true, true), /** @@ -51,20 +54,23 @@ public enum XosFunctionDescriptor { 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 @@ public enum XosFunctionDescriptor { 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; + } }