@Override public boolean equals(Object otherObj) { if (!(otherObj instanceof ConnectAddonBean)) { return false; } ConnectAddonBean other = (ConnectAddonBean) otherObj; return new EqualsBuilder().append(getModules(), other.getModules()).isEquals() && super.equals(otherObj); }
@Override public boolean equals(Object otherObj) { if (!(otherObj instanceof ConnectAddonBean)) { return false; } ConnectAddonBean other = (ConnectAddonBean) otherObj; return new EqualsBuilder().append(getModules(), other.getModules()).isEquals() && super.equals(otherObj); }
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(); }
public Map<String, List<ModuleBean>> validateModules(ConnectAddonBean addon, ModuleValidationExceptionHandler exceptionHandler) throws InvalidDescriptorException { Map<String, List<ModuleBean>> validModuleLists = addon.getModules().getValidModuleLists(exceptionHandler); Map<String, ConnectModuleProvider<? extends ModuleBean>> moduleProviders = getModuleProviders(); for (Map.Entry<String, List<ModuleBean>> validModuleList : validModuleLists.entrySet()) { @SuppressWarnings("unchecked") ConnectModuleProvider<ModuleBean> moduleProvider = (ConnectModuleProvider<ModuleBean>) moduleProviders.get(validModuleList.getKey()); List<ModuleBean> modules = validModuleList.getValue(); try { moduleProvider.validateDescriptorModuleDependencies(modules, addon); } catch (ConnectModuleValidationException e) { exceptionHandler.acceptModuleValidationCause(e); } catch (Exception e) { exceptionHandler.accept(e); } } return validModuleLists; }
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())); } }); } }
public Map<String, List<ModuleBean>> validateModules(ConnectAddonBean addon, ModuleValidationExceptionHandler exceptionHandler) throws InvalidDescriptorException { final Map<String, List<ModuleBean>> validModuleLists = addon.getModules().getValidModuleLists(exceptionHandler); for (ConnectAddonBeanModuleValidator validator : connectContainerUtil.getBeansOfType(ConnectAddonBeanModuleValidator.class)) { try { validator.validateModules(addon, validModuleLists); } catch (ConnectModuleValidationException e) { exceptionHandler.acceptModuleValidationCause(e); } catch (Exception e) { exceptionHandler.accept(e); } } return validModuleLists; }