com.atlassian.streams.api.common.Option.getOrElse()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(137)

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

Option.getOrElse介绍

暂无

代码示例

代码示例来源:origin: com.atlassian.streams/streams-common

public CommentRenderer(final TemplateRenderer templateRenderer,
    final Function<StreamsEntry, Html> titleRenderer,
    final Option<String> wikiComment,
    final Option<Html> htmlComment,
    Option<URI> styleLink)
{
  this.templateRenderer = checkNotNull(templateRenderer, "templateRenderer");
  this.titleRenderer = checkNotNull(titleRenderer, "titleRenderer");
  this.commentRenderer = htmlComment.map(renderHtml).getOrElse(renderWiki(wikiComment));
  this.styleLink = checkNotNull(styleLink, "styleLink");
}

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

public CommentRenderer(final TemplateRenderer templateRenderer,
    final Function<StreamsEntry, Html> titleRenderer,
    final Option<String> wikiComment,
    final Option<Html> htmlComment,
    Option<URI> styleLink)
{
  this.templateRenderer = checkNotNull(templateRenderer, "templateRenderer");
  this.titleRenderer = checkNotNull(titleRenderer, "titleRenderer");
  this.commentRenderer = htmlComment.map(renderHtml).getOrElse(renderWiki(wikiComment));
  this.styleLink = checkNotNull(styleLink, "styleLink");
}

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

@HtmlSafe
public Html apply(final Iterable<UserProfile> authors)
{
  return compoundRenderer.apply(authors).getOrElse(renderUnknownAuthor());
}

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

private Iterable<Html> getAggregatedComments(AggregatedJiraActivityItem aggregatedItem)
{
  Iterable<JiraActivityItem> items = ImmutableList.<JiraActivityItem>builder()
      .add(aggregatedItem.getActivityItem())
      .addAll(aggregatedItem.getRelatedActivityItems().getOrElse(ImmutableList.<JiraActivityItem>of()))
      .build();
  return catOptions(transform(items, toCommentHtml));
}

代码示例来源:origin: com.atlassian.streams/streams-common

@HtmlSafe
public Html apply(final Iterable<UserProfile> authors)
{
  return compoundRenderer.apply(authors).getOrElse(renderUnknownAuthor());
}

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

@Override
  public <T> T withSession(Supplier<T> s)
  {
    return getService().getOrElse(defaultSessionManager).withSession(s);
  }
}

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

@Override
  public Option<Pair<String, String>> get()
  {
    return getService().getOrElse(defaultProvider).get();
  }
}

代码示例来源:origin: com.atlassian.streams/streams-thirdparty-api

public Builder(String urlString)
{
  url = errors.checkAbsoluteUriString(some(urlString), "url").getOrElse((URI)null);
}

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

@Override
  public ThumbnailItem apply(@Nullable Attachment attachment) {
    return option(thumbnailManager.getThumbnail(attachment)).
        map(mkThumbnailItem(attachment, baseUri)).
        getOrElse(brokenThumbnailItem(attachment, baseUri));
  }
};

代码示例来源:origin: com.atlassian.streams/streams-crucible-plugin

public Set<Review> apply(Set<Review> reviews)
  {
    Pair<Set<String>, Set<String>> isAndNotIssueKeys = getIsAndNotValues(request.getStandardFilters().get(ISSUE_KEY.getKey()));
    Iterable<String> issueKeys = isAndNotIssueKeys.first();
    Iterable<String> notIssueKeys = isAndNotIssueKeys.second();
    return Sets.filter(reviews, and(
        nameOrDescription(containsIssueKeys(issueKeys).getOrElse(Predicates.<String>alwaysTrue())),
        not(nameOrDescription(containsIssueKeys(notIssueKeys).getOrElse(Predicates.<String>alwaysFalse())))));
  }
};

代码示例来源:origin: com.atlassian.streams/streams-confluence-plugin

private boolean shouldIncludeItem(ActivityItem item)
{
  Option<String> author = option(item.getChangedBy());
  return any(getActivities(item), inActivities)
      && item.getSpaceKey().map(forPredicate(inProjectKeys)).getOrElse(!hasSpaceFilter)
      && anyUsers.apply(author)
      && notInUsers.apply(author)
      && followedUsers.apply(item.getChangedBy())
      && inDateRange.apply(item.getModified());
}

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

public Html renderTitleAsHtml(StreamsEntry entry)
{
  if (removed)
  {
    return new Html(i18nResolver.getText("streams.item.jira.title.remove.linked",
        authorsRenderer.apply(entry.getAuthors()),
        some(aggregatedItem.getActivityItem()).flatMap(issueRenderer).get(),
        issuesRenderer.apply(aggregatedItem.getRelatedActivityItems().getOrElse(
          ImmutableList.<JiraActivityItem>of()))));
  }
  return new Html(i18nResolver.getText("streams.item.jira.title.linked",
      authorsRenderer.apply(entry.getAuthors()),
      size(aggregatedItem.getRelatedActivityItems().getOrElse(ImmutableList.<JiraActivityItem>of())) + 1));
}

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

public Html apply(StreamsEntry entry)
{
  Option<Html> objectHtml = activityObjectRenderer.flatMap(render(entry.getActivityObjects()));
  Option<Html> targetHtml = targetRenderer.flatMap(render(entry.getTarget()));
  return new Html(getText(
      key,
      concat(
        ImmutableList.of(authorsRenderer.apply(entry.getAuthors())),
        objectHtml.map(singletonList(Html.class)).getOrElse(ImmutableList.<Html>of()),
        targetHtml.map(singletonList(Html.class)).getOrElse(ImmutableList.<Html>of()))));
}

代码示例来源:origin: com.atlassian.streams/streams-common

public Html apply(StreamsEntry entry)
{
  Option<Html> objectHtml = activityObjectRenderer.flatMap(render(entry.getActivityObjects()));
  Option<Html> targetHtml = targetRenderer.flatMap(render(entry.getTarget()));
  return new Html(getText(
      key,
      concat(
        ImmutableList.of(authorsRenderer.apply(entry.getAuthors())),
        objectHtml.map(singletonList(Html.class)).getOrElse(ImmutableList.<Html>of()),
        targetHtml.map(singletonList(Html.class)).getOrElse(ImmutableList.<Html>of()))));
}

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

private String getEscapedApplicationName()
  {
    // application name is entered manually hence encode it before display to avoid XSS.
    return htmlEncode(option(remoteIssueLink.getApplicationName()).getOrElse(
        i18nResolver.getText("remotelink.manager.changeitem.applicationname.default")));
  }
}

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

@Override
public Html renderTitleAsHtml(StreamsEntry entry)
{
  return getResolution(item()).map(transitionWithResolution(entry)).getOrElse(transitionWithoutResolution(entry));
}

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

public NonEmptyIterable<UserProfile> getUserProfiles(URI baseUri, JiraActivityItem jiraActivityItem)
{
  Iterable<String> usernames = jiraActivityItem.getChangeHistoryAuthors();
  final NonEmptyIterable<UserProfile> userProfiles = NonEmptyIterables.from(transform(usernames, getUserProfile(baseUri)))
      .getOrElse(ImmutableNonEmptyList.of(userProfileAccessor.getAnonymousUserProfile(baseUri)));
  return NonEmptyIterables.from(transform(userProfiles, addProfileMetadata(jiraActivityItem.getHistoryMetadata(), Iterables.isEmpty(usernames), baseUri))).get();
}

代码示例来源:origin: com.atlassian.streams/streams-confluence-plugin

@Override
public Html renderTitleAsHtml(StreamsEntry entry)
{
  return entry.getTarget().flatMap(targetRenderer).map(renderAttachedTo(entry)).getOrElse(renderAttached(entry));
}

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

@Override
public Option<Html> renderContentAsHtml(StreamsEntry entry)
{
  if (!removed)
  {
    return some(new Html(render(templateRenderer, "jira-link-field-update.vm", ImmutableMap.of(
      "comment", getAggregatedComments(aggregatedItem),
      "issueKeyHtml", some(aggregatedItem.getActivityItem()).flatMap(issueRenderer).get(),
      "linkText", linkingText(aggregatedItem.getActivityItem()),
      "linkedIssueKeysHtml", issuesRenderer.apply(aggregatedItem.getRelatedActivityItems()
          .getOrElse(ImmutableList.<JiraActivityItem>of()))))));
  }
  return none();
}

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

private Renderer newSingleFieldChangedEntryRenderer(JiraActivityItem item, URI baseUri, GenericValue changeItem)
{
  Function<ActivityObject, Option<Html>> activityObjectRenderer = updatedSummary(changeItem) ?
      issueActivityObjectRendererFactory.newIssueActivityObjectRendererWithoutSummary(item.getIssue()) :
      issueActivityObjectRendererFactory.newIssueActivityObjectRendererWithSummary(item.getIssue());
  Function<StreamsEntry, Html> titleRenderer = new SingleFieldChangeTitleRenderer(item, baseUri, changeItem,
      activityObjectRenderer);
  if (worklogField(changeItem))
  {
    return rendererFactory.newCommentRenderer(titleRenderer,
        worklogComment(item).map(helper.renderCommentString(item.getIssue())).flatMap(trimHtmlToNone()).getOrElse(new Html("")));
  }
  return rendererFactory.newCommentRenderer(titleRenderer,
      item.getComment().map(commentRenderer).flatMap(trimHtmlToNone()).getOrElse(new Html("")));
}

相关文章