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())); } }); } }
private void addPluginInfoParameterForPagesIfDeclared(PluginInformation pluginInfo, String addonKey) { ModuleCompleteKey configPageCompleteKey = new ModuleCompleteKey(pluginRetrievalService.getPlugin().getKey(), ModuleKeyUtils.prefixAndAddonAndModuleKey("upm-page", addonKey, "configure-page")); Optional<UpmPageMetadata> configurePageData = Optional.ofNullable(pluginAccessor.getEnabledPluginModule(configPageCompleteKey.getCompleteKey())) .map(ModuleDescriptor::getModule) .filter(UpmPageMetadata.class::isInstance) .map(UpmPageMetadata.class::cast); if (configurePageData.isPresent()) { pluginInfo.addParameter(PARAM_CONFIGURE_URL, ConnectIFrameServletPath.forModule(addonKey, configurePageData.get().getRawModuleKey())); } ModuleCompleteKey postInstallPageCompleteKey = new ModuleCompleteKey(pluginRetrievalService.getPlugin().getKey(), ModuleKeyUtils.prefixAndAddonAndModuleKey("upm-page", addonKey, "post-install-page")); Optional<UpmPageMetadata> postInstallPageData = Optional.ofNullable(pluginAccessor.getEnabledPluginModule(postInstallPageCompleteKey.getCompleteKey())) .map(ModuleDescriptor::getModule) .filter(UpmPageMetadata.class::isInstance) .map(UpmPageMetadata.class::cast); if (postInstallPageData.isPresent()) { pluginInfo.addParameter(PARAM_POST_INSTALL_URL, ConnectIFrameServletPath.forModule(addonKey, postInstallPageData.get().getRawModuleKey())); } } }
pluginInfo.addParameter(param.getKey(), param.getValue());
private PluginInformation createPluginInfo(ShallowConnectAddon addon) { PluginInformation pluginInfo = new PluginInformation(); pluginInfo.setDescription(addon.getDescription()); pluginInfo.setVendorName(addon.getVendor().getName()); pluginInfo.setVendorUrl(addon.getVendor().getUrl()); pluginInfo.setVersion(addon.getVersion()); pluginInfo.addParameter(PARAM_ATLASSIAN_CONNECT_INFO, "true"); if (addon.getEnableLicensing()) { pluginInfo.addParameter(PARAM_ATLASSIAN_LICENSING_ENABLED, "true"); } addPluginInfoParameterForPagesIfDeclared(pluginInfo, addon.getKey()); return pluginInfo; }
private PluginInformation createPluginInfo(ConnectAddonBean addon) { PluginInformation pluginInfo = new PluginInformation(); pluginInfo.setDescription(addon.getDescription()); pluginInfo.setVendorName(addon.getVendor().getName()); pluginInfo.setVendorUrl(addon.getVendor().getUrl()); pluginInfo.setVersion(addon.getVersion()); pluginInfo.addParameter(PARAM_ATLASSIAN_CONNECT_INFO, "true"); if (addon.getEnableLicensing()) { pluginInfo.addParameter(PARAM_ATLASSIAN_LICENSING_ENABLED, "true"); } addPluginInfoParameterForPageIfDeclared(pluginInfo, PARAM_CONFIGURE_URL, addon, new ConfigurePageModuleMeta().getDescriptorKey()); addPluginInfoParameterForPageIfDeclared(pluginInfo, PARAM_POST_INSTALL_URL, addon, new PostInstallPageModuleMeta().getDescriptorKey()); return pluginInfo; }