| | |
| | | |
| | | boolean isFirst = true; |
| | | for (ManagedObjectDefinition<?, ?> mod : getSubTypes(d).values()) { |
| | | // Only display advanced types and custom types in advanced mode. |
| | | if (!app.isAdvancedMode() |
| | | && (mod.hasOption(ManagedObjectOption.ADVANCED) |
| | | || CLIProfile.getInstance().isForCustomization(mod))) { |
| | | if (cannotDisplayAdvancedOrCustomTypes(app, mod)) { |
| | | continue; |
| | | } |
| | | |
| | |
| | | if (app.isInteractive()) { |
| | | SortedSet<PropertyDefinition<?>> properties = new TreeSet<>(); |
| | | for (PropertyDefinition<?> pd : d.getAllPropertyDefinitions()) { |
| | | if (pd.hasOption(PropertyOption.HIDDEN) |
| | | || (!app.isAdvancedMode() && pd.hasOption(PropertyOption.ADVANCED))) { |
| | | if (cannotDisplay(app, pd)) { |
| | | continue; |
| | | } |
| | | properties.add(pd); |
| | |
| | | } |
| | | } |
| | | |
| | | private static boolean cannotDisplay(ConsoleApplication app, PropertyDefinition<?> pd) { |
| | | return pd.hasOption(PropertyOption.HIDDEN) |
| | | || (!app.isAdvancedMode() && pd.hasOption(PropertyOption.ADVANCED)); |
| | | } |
| | | |
| | | /** Interactively create the child by prompting for the name. */ |
| | | private static <C extends ConfigurationClient, S |
| | | extends Configuration> ManagedObject<? extends C> createChildInteractively( |
| | |
| | | Iterator<ManagedObjectDefinition<? extends C, ? extends S>> i; |
| | | for (i = filteredTypes.iterator(); i.hasNext();) { |
| | | ManagedObjectDefinition<? extends C, ? extends S> cd = i.next(); |
| | | |
| | | if (prohibitedTypes.contains(cd.getName())) { |
| | | // Remove filtered types. |
| | | if (prohibitedTypes.contains(cd.getName()) |
| | | || cannotDisplayAdvancedOrCustomTypes(app, cd)) { |
| | | i.remove(); |
| | | } else if (!app.isAdvancedMode()) { |
| | | // Only display advanced types and custom types in advanced mode. |
| | | if (cd.hasOption(ManagedObjectOption.ADVANCED)) { |
| | | i.remove(); |
| | | } else if (CLIProfile.getInstance().isForCustomization(cd)) { |
| | | i.remove(); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | /** Only display advanced types and custom types in advanced mode. */ |
| | | private static boolean cannotDisplayAdvancedOrCustomTypes( |
| | | ConsoleApplication app, ManagedObjectDefinition<?, ?> defn) { |
| | | return !app.isAdvancedMode() |
| | | && (defn.hasOption(ManagedObjectOption.ADVANCED) || CLIProfile.getInstance().isForCustomization(defn)); |
| | | } |
| | | |
| | | /** The sub-commands naming arguments. */ |
| | | private final List<StringArgument> namingArgs; |
| | | |