com.atlassian.plugin.web.WebInterfaceManager.getDisplayableWebPanelDescriptors()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(63)

本文整理了Java中com.atlassian.plugin.web.WebInterfaceManager.getDisplayableWebPanelDescriptors()方法的一些代码示例,展示了WebInterfaceManager.getDisplayableWebPanelDescriptors()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebInterfaceManager.getDisplayableWebPanelDescriptors()方法的具体详情如下:
包路径:com.atlassian.plugin.web.WebInterfaceManager
类名称:WebInterfaceManager
方法名:getDisplayableWebPanelDescriptors

WebInterfaceManager.getDisplayableWebPanelDescriptors介绍

暂无

代码示例

代码示例来源:origin: com.atlassian.jira/jira-core

@Override
public List<WebPanelModuleDescriptor> getPanels(String key, Map<String, Object> params)
{
  return webInterfaceManager.getDisplayableWebPanelDescriptors(key + "/panels", params);
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Override
  public List<WebPanelModuleDescriptor> call() throws Exception
  {
    return webInterfaceManager.getDisplayableWebPanelDescriptors(TAB_PANELS_LOCATION, context);
  }
}).getOrElse(Collections.<WebPanelModuleDescriptor>emptyList()), Predicates.notNull());

代码示例来源:origin: com.atlassian.jira/jira-core

private List<WebPanelModuleDescriptor> getWebPanels(final String location)
{
  return webInterfaceManager.getDisplayableWebPanelDescriptors(location, webPanelParams);
}

代码示例来源:origin: com.atlassian.refapp/atlassian-refapp-web-item-plugin

public List<WebPanelModuleDescriptor> getDisplayableWebPanelDescriptors(String location, Map<String, Object> context) {
  return webInterfaceManager.getDisplayableWebPanelDescriptors(location, context);
}

代码示例来源:origin: com.atlassian.jira/jira-core

private WebPanelModuleDescriptor getFirstDescriptor(final String location, final Map<String, Object> context) {
    final List<WebPanelModuleDescriptor> descriptors = webInterfaceManager.getDisplayableWebPanelDescriptors(location, context);
    if (!descriptors.isEmpty())
    {
      return descriptors.get(0);
    } else {
      return null;
    }
  }
}

代码示例来源:origin: com.atlassian.jira/jira-core

public boolean hasOnlyOneApplication()
{
  int jiraApplicationCount = roleManager.getRoles().size();
  int extraApplicationCount = webInterfaceManager.getDisplayableWebPanelDescriptors(APPLICATION_ACCESS_EXTENSION_WEB_PANEL_LOCATION, emptyMap()).size();
  return jiraApplicationCount + extraApplicationCount == 1;
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Override
public String getFragmentHtml(final ApplicationUser profileUser, final ApplicationUser currentUser)
{
  final Map<String, Object> context = ImmutableMap.<String,Object>of(AbstractUserProfileFragment.PROFILE_USER, profileUser, AbstractUserProfileFragment.CURRENT_USER, currentUser);
  final List<WebPanelModuleDescriptor> descriptors = Lists.newArrayList();
      descriptors.add(getFirstDescriptor(DETAILS_PANEL_LOCATION, context));
      descriptors.add(getFirstDescriptor(PREFERENCES_PANEL_LOCATION, context));
      descriptors.add(getFirstDescriptor(ASSIGNED_PANEL_LOCATION, context));
      descriptors.addAll(webInterfaceManager.getDisplayableWebPanelDescriptors(CUSTOM_PANEL_LOCATION, context));
  final List<WebPanelModuleDescriptor> filteredDescriptors = Lists.newArrayList(Iterables.filter(descriptors, Predicates.notNull()));
  Collections.sort(filteredDescriptors, WEIGHTED_DESCRIPTOR_COMPARATOR);
  return getHtmlFromDescriptors(filteredDescriptors, context);
}

代码示例来源:origin: com.atlassian.plugins/base-hipchat-integration-plugin

@Override
@SuppressWarnings("unchecked")
public List<String> apply(Object... args) {
  final String location = (String) args[0];
  final ImmutableMap.Builder<String, Object> contextBuilder = ImmutableMap.builder();
  if (args.length == 2) {
    contextBuilder.putAll((Map<String, ?>) args[1]);
  }
  final Map<String, Object> context = contextBuilder.build();
  final List<String> webPanels = new ArrayList<String>();
  for (WebPanelModuleDescriptor webPanelModuleDescriptor : webInterfaceManager.getDisplayableWebPanelDescriptors(location, context)) {
    try {
      webPanels.add(webPanelModuleDescriptor.getModule().getHtml(context));
    } catch (RuntimeException e) {
      LOG.warn(String.format("An error occurred rendering %s. Ignoring", webPanelModuleDescriptor.getCompleteKey()), e);
    }
  }
  return webPanels;
}

代码示例来源:origin: com.atlassian.jira/jira-core

private List<Map<String, Object>> getProjectAdminNavPanelSections()
{
  final List<WebPanelModuleDescriptor> webPanelDescriptors = webInterfaceManager.getDisplayableWebPanelDescriptors(NAV_PANEL_LOCATION, Collections.emptyMap());
  final List<Map<String, Object>> panelSectionList = Lists.newArrayListWithExpectedSize(webPanelDescriptors.size());
  for (final WebPanelModuleDescriptor panelDescriptor : webPanelDescriptors)
  {
    CollectionUtils.addIgnoreNull(panelSectionList,
        SafePluginPointAccess.call(() -> makeSideMenuSoyRenderDataForWebPanel(panelDescriptor)).getOrNull());
  }
  return panelSectionList;
}

代码示例来源:origin: com.atlassian.jira/jira-core

private String getPanels(final String panelLocation)
{
  final StringBuilder builder = new StringBuilder();
  final List<WebPanelModuleDescriptor> panels = webInterfaceManager.getDisplayableWebPanelDescriptors(panelLocation, Collections.<String, Object>emptyMap());
  for (final WebPanelModuleDescriptor panel : panels)
  {
    final Option<String> fragment = SafePluginPointAccess.call(new Callable<String>()
    {
      @Override
      public String call() throws Exception
      {
        if (panel == null || panel.getModule() == null)
        {
          return null;
        }
        else
        {
          return panel.getModule().getHtml(Collections.<String, Object>emptyMap());
        }
      }
    });
    if (fragment.isDefined())
    {
      builder.append(fragment.get());
    }
  }
  return builder.toString();
}

代码示例来源:origin: com.atlassian.jira/jira-core

public void writeBanners(Writer writer)
  {
    final Map<String, Object> context = contextSupplier.get();
    final Option<WebPanelModuleDescriptor> displayableWebPanelDescriptors =
        Iterables.first(webInterfaceManager.getDisplayableWebPanelDescriptors(LOCATION, context));
    for (WebPanelModuleDescriptor descriptor : displayableWebPanelDescriptors)
    {
      try
      {
        descriptor.getModule().writeHtml(writer, context);
      }
      catch (IOException | RuntimeException e)
      {
        LOG.debug(String.format("Unable to render banner '%s'.", descriptor.getCompleteKey()), e);
      }
    }
  }
}

代码示例来源:origin: com.atlassian.jira/jira-core

@ActionViewData ("success")
public String getInfoPanelHtml()
{
  final StringBuilder sb = new StringBuilder();
  final List<WebPanelModuleDescriptor> webPanelDescriptors = webInterfaceManager.getDisplayableWebPanelDescriptors("webpanels.browse.projects.info-panels", Collections.<String, Object>emptyMap());
  for (final WebPanelModuleDescriptor webPanelDescriptor : webPanelDescriptors)
  {
    final Option<String> result = SafePluginPointAccess.call(new Callable<String>()
    {
      @Override
      public String call() throws Exception
      {
        return webPanelDescriptor.getModule().getHtml(Collections.<String, Object>emptyMap());
      }
    });
    if (result.isDefined())
    {
      sb.append(result.get());
    }
  }
  return sb.toString();
}

代码示例来源:origin: com.atlassian.jira/jira-core

public String getHtml()
  {
    final Map<String, Object> webPanelContext = getWebPanelContext();
    final List<WebPanelModuleDescriptor> webPanels = webInterfaceManager.getDisplayableWebPanelDescriptors("atl.jira.view.issue.left.context", webPanelContext);

    for (final WebPanelModuleDescriptor webPanel : webPanels)
    {
      final Option<String> moduleOutput = SafePluginPointAccess.call(new Callable<String>() {
        @Override
        public String call() throws Exception
        {
          if (SUBTASK_PANEL_KEY.equals(webPanel.getCompleteKey()))
          {
            final WebPanel module = webPanel.getModule();
            return module != null ? module.getHtml(webPanelContext) : StringUtils.EMPTY;
          }
          return null;
        }
      });
      if (moduleOutput.isDefined())
      {
        return moduleOutput.get();
      }
    }
    return StringUtils.EMPTY;

  }
}

相关文章