private static ImmutableMap<String, String> buildKeyMap(ConnectAddonBean addon) { ImmutableMap.Builder<String, String> keyMapBuilder = ImmutableMap.<String, String>builder(); Consumer<Exception> moduleValidationExceptionHandler = new ModuleValidationExceptionHandler(); { Optional<List<ModuleBean>> optionalWebItems = addon.getModules().getValidModuleListOfType("webItems", moduleValidationExceptionHandler); optionalWebItems.ifPresent( webItems -> keyMapBuilder.putAll(createKeyToQualifiedKeyMap(addon, webItems)) ); } { Optional<List<ModuleBean>> optionalWebSections = addon.getModules().getValidModuleListOfType("webSections", moduleValidationExceptionHandler); optionalWebSections.ifPresent( webSections -> keyMapBuilder.putAll(createKeyToQualifiedKeyMap(addon, webSections)) ); } return keyMapBuilder.build(); }
private static ImmutableMap<String, String> buildKeyMap(ConnectAddonBean addon) { ImmutableMap.Builder<String, String> keyMapBuilder = ImmutableMap.<String, String>builder(); Consumer<Exception> moduleValidationExceptionHandler = new ModuleValidationExceptionHandler(); { Optional<List<ModuleBean>> optionalWebItems = addon.getModules().getValidModuleListOfType("webItems", moduleValidationExceptionHandler); optionalWebItems.ifPresent( webItems -> keyMapBuilder.putAll(createKeyToQualifiedKeyMap(addon, webItems)) ); } { Optional<List<ModuleBean>> optionalWebSections = addon.getModules().getValidModuleListOfType("webSections", moduleValidationExceptionHandler); optionalWebSections.ifPresent( webSections -> keyMapBuilder.putAll(createKeyToQualifiedKeyMap(addon, webSections)) ); } return keyMapBuilder.build(); }
private void addPluginInfoParameterForPageIfDeclared(PluginInformation pluginInfo, String parameterKey, ConnectAddonBean addon, String moduleType) { Optional<List<ModuleBean>> optionalPages = addon.getModules().getValidModuleListOfType( moduleType, moduleValidationExceptionHandler); optionalPages.ifPresent(moduleBeans -> { ConnectPageModuleBean page = (ConnectPageModuleBean) moduleBeans.get(0); if (null != page && !Strings.isNullOrEmpty(page.getUrl())) { pluginInfo.addParameter(parameterKey, ConnectIFrameServletPath.forModule(addon.getKey(), page.getRawKey())); } }); } }