CORD GUI - added CDN to both Basic and Family Bundles, but hide it from GUI display.
Change-Id: I5fa1ca6b34ba6b49e5c498f8b3b570715d51d088
Showing
2 changed files
with
25 additions
and
4 deletions
| ... | @@ -53,7 +53,8 @@ public class BundleFactory extends JsonFactory { | ... | @@ -53,7 +53,8 @@ public class BundleFactory extends JsonFactory { |
| 53 | new DefaultBundleDescriptor(BASIC_ID, BASIC_DISPLAY_NAME, | 53 | new DefaultBundleDescriptor(BASIC_ID, BASIC_DISPLAY_NAME, |
| 54 | BASIC_DESCRIPTION, | 54 | BASIC_DESCRIPTION, |
| 55 | XosFunctionDescriptor.INTERNET, | 55 | XosFunctionDescriptor.INTERNET, |
| 56 | - XosFunctionDescriptor.FIREWALL); | 56 | + XosFunctionDescriptor.FIREWALL, |
| 57 | + XosFunctionDescriptor.CDN); | ||
| 57 | 58 | ||
| 58 | /** | 59 | /** |
| 59 | * Designates the FAMILY bundle. | 60 | * Designates the FAMILY bundle. |
| ... | @@ -63,6 +64,7 @@ public class BundleFactory extends JsonFactory { | ... | @@ -63,6 +64,7 @@ public class BundleFactory extends JsonFactory { |
| 63 | FAMILY_DESCRIPTION, | 64 | FAMILY_DESCRIPTION, |
| 64 | XosFunctionDescriptor.INTERNET, | 65 | XosFunctionDescriptor.INTERNET, |
| 65 | XosFunctionDescriptor.FIREWALL, | 66 | XosFunctionDescriptor.FIREWALL, |
| 67 | + XosFunctionDescriptor.CDN, | ||
| 66 | XosFunctionDescriptor.URL_FILTER); | 68 | XosFunctionDescriptor.URL_FILTER); |
| 67 | 69 | ||
| 68 | // all bundles, in the order they should be listed in the GUI | 70 | // all bundles, in the order they should be listed in the GUI |
| ... | @@ -98,6 +100,8 @@ public class BundleFactory extends JsonFactory { | ... | @@ -98,6 +100,8 @@ public class BundleFactory extends JsonFactory { |
| 98 | 100 | ||
| 99 | /** | 101 | /** |
| 100 | * Returns an object node representation of the given bundle. | 102 | * Returns an object node representation of the given bundle. |
| 103 | + * Note that some functions (such as CDN) are not added to the output | ||
| 104 | + * as we don't want them to appear in the GUI. | ||
| 101 | * | 105 | * |
| 102 | * @param bundle the bundle | 106 | * @param bundle the bundle |
| 103 | * @return object node | 107 | * @return object node |
| ... | @@ -113,8 +117,10 @@ public class BundleFactory extends JsonFactory { | ... | @@ -113,8 +117,10 @@ public class BundleFactory extends JsonFactory { |
| 113 | 117 | ||
| 114 | ArrayNode funcs = arrayNode(); | 118 | ArrayNode funcs = arrayNode(); |
| 115 | for (XosFunctionDescriptor xfd: bundle.descriptor().functions()) { | 119 | for (XosFunctionDescriptor xfd: bundle.descriptor().functions()) { |
| 120 | + if (xfd.visible()) { | ||
| 116 | funcs.add(XosFunctionFactory.toObjectNode(xfd)); | 121 | funcs.add(XosFunctionFactory.toObjectNode(xfd)); |
| 117 | } | 122 | } |
| 123 | + } | ||
| 118 | bnode.set(FUNCTIONS, funcs); | 124 | bnode.set(FUNCTIONS, funcs); |
| 119 | root.set(BUNDLE, bnode); | 125 | root.set(BUNDLE, bnode); |
| 120 | 126 | ... | ... |
| ... | @@ -27,7 +27,8 @@ public enum XosFunctionDescriptor { | ... | @@ -27,7 +27,8 @@ public enum XosFunctionDescriptor { |
| 27 | INTERNET("internet", | 27 | INTERNET("internet", |
| 28 | "Internet", | 28 | "Internet", |
| 29 | "Basic internet connectivity.", | 29 | "Basic internet connectivity.", |
| 30 | - false), | 30 | + false, |
| 31 | + true), | ||
| 31 | 32 | ||
| 32 | /** | 33 | /** |
| 33 | * Firewall function. | 34 | * Firewall function. |
| ... | @@ -35,6 +36,7 @@ public enum XosFunctionDescriptor { | ... | @@ -35,6 +36,7 @@ public enum XosFunctionDescriptor { |
| 35 | FIREWALL("firewall", | 36 | FIREWALL("firewall", |
| 36 | "Firewall", | 37 | "Firewall", |
| 37 | "Normal firewall protection.", | 38 | "Normal firewall protection.", |
| 39 | + true, | ||
| 38 | true), | 40 | true), |
| 39 | 41 | ||
| 40 | /** | 42 | /** |
| ... | @@ -43,6 +45,7 @@ public enum XosFunctionDescriptor { | ... | @@ -43,6 +45,7 @@ public enum XosFunctionDescriptor { |
| 43 | URL_FILTER("url_filter", | 45 | URL_FILTER("url_filter", |
| 44 | "Parental Control", | 46 | "Parental Control", |
| 45 | "Variable levels of URL filtering.", | 47 | "Variable levels of URL filtering.", |
| 48 | + true, | ||
| 46 | true), | 49 | true), |
| 47 | 50 | ||
| 48 | /** | 51 | /** |
| ... | @@ -51,20 +54,23 @@ public enum XosFunctionDescriptor { | ... | @@ -51,20 +54,23 @@ public enum XosFunctionDescriptor { |
| 51 | CDN("cdn", | 54 | CDN("cdn", |
| 52 | "CDN", | 55 | "CDN", |
| 53 | "Content Distribution Network service.", | 56 | "Content Distribution Network service.", |
| 54 | - true); | 57 | + true, |
| 58 | + false); | ||
| 55 | 59 | ||
| 56 | 60 | ||
| 57 | private final String id; | 61 | private final String id; |
| 58 | private final String displayName; | 62 | private final String displayName; |
| 59 | private final String description; | 63 | private final String description; |
| 60 | private final boolean backend; | 64 | private final boolean backend; |
| 65 | + private final boolean visible; | ||
| 61 | 66 | ||
| 62 | XosFunctionDescriptor(String id, String displayName, String description, | 67 | XosFunctionDescriptor(String id, String displayName, String description, |
| 63 | - boolean backend) { | 68 | + boolean backend, boolean visible) { |
| 64 | this.id = id; | 69 | this.id = id; |
| 65 | this.displayName = displayName; | 70 | this.displayName = displayName; |
| 66 | this.description = description; | 71 | this.description = description; |
| 67 | this.backend = backend; | 72 | this.backend = backend; |
| 73 | + this.visible = visible; | ||
| 68 | } | 74 | } |
| 69 | 75 | ||
| 70 | /** | 76 | /** |
| ... | @@ -103,4 +109,13 @@ public enum XosFunctionDescriptor { | ... | @@ -103,4 +109,13 @@ public enum XosFunctionDescriptor { |
| 103 | return backend; | 109 | return backend; |
| 104 | } | 110 | } |
| 105 | 111 | ||
| 112 | + /** | ||
| 113 | + * Returns true if this function should be shown in the GUI, in the | ||
| 114 | + * bundle listing. | ||
| 115 | + * | ||
| 116 | + * @return true if to be displayed | ||
| 117 | + */ | ||
| 118 | + public boolean visible() { | ||
| 119 | + return visible; | ||
| 120 | + } | ||
| 106 | } | 121 | } | ... | ... |
-
Please register or login to post a comment