Simon Hunt

CORD GUI - added CDN to both Basic and Family Bundles, but hide it from GUI display.

Change-Id: I5fa1ca6b34ba6b49e5c498f8b3b570715d51d088
......@@ -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,8 +117,10 @@ public class BundleFactory extends JsonFactory {
ArrayNode funcs = arrayNode();
for (XosFunctionDescriptor xfd: bundle.descriptor().functions()) {
if (xfd.visible()) {
funcs.add(XosFunctionFactory.toObjectNode(xfd));
}
}
bnode.set(FUNCTIONS, funcs);
root.set(BUNDLE, bnode);
......
......@@ -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;
}
}
......