本文整理了Java中com.atlassian.streams.api.common.Option.isDefined()
方法的一些代码示例,展示了Option.isDefined()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Option.isDefined()
方法的具体详情如下:
包路径:com.atlassian.streams.api.common.Option
类名称:Option
方法名:isDefined
暂无
代码示例来源:origin: com.atlassian.streams/streams-confluence-plugin
public boolean apply(AttachmentActivityItem.Entry attachment)
{
return attachment.getPreview().isDefined();
}
};
代码示例来源:origin: com.atlassian.streams/streams-jira-plugin
private boolean removed(URI baseUri, JiraActivityItem item)
{
return !newValue(baseUri, getFirstChangeItem(item)).isDefined();
}
代码示例来源:origin: com.atlassian.streams/streams-common
public Html apply(StreamsEntry entry)
{
String key = entry.getTarget().isDefined() ? "streams.title.commented.on" : "streams.title.commented";
return rendererFactory.newTitleRenderer(key).apply(entry);
}
}
代码示例来源:origin: com.atlassian.streams/streams-jira-plugin
public Html apply(StreamsEntry entry)
{
String key = entry.getTarget().isDefined() ? "streams.title.commented.on" : "streams.title.commented";
return newIssueTitleRenderer(item, key).apply(entry);
}
代码示例来源:origin: com.atlassian.streams/streams-core-plugin
public Html apply(StreamsEntry entry)
{
String key = entry.getTarget().isDefined() ? "streams.title.commented.on" : "streams.title.commented";
return rendererFactory.newTitleRenderer(key).apply(entry);
}
}
代码示例来源:origin: com.atlassian.streams/streams-jira-plugin
/**
* Create an <code>a</code> tag from a URI and a label. If the URI is {@code Option.none()}, then an <code>a</code>
* tag is not created and the original label is returned. In all cases the original label is HTML encoded.
*
* @param uri uri to link to
* @param label may not be null
* @return an <code>a</code> with <code>uri</code> as the URI and <code>label</code> as the label or just the label
* if the <code>uri</code> is blank.
* @throws IllegalArgumentException if the label is null
*/
public static Html link(Option<URI> uri, Html label)
{
if(label == null)
{
// we don't want the text "null" to appear as a label.
throw new IllegalArgumentException("Label is null");
}
return uri.isDefined() ? new Html("<a href=\"" + uri.get().toASCIIString() + "\">" + label + "</a>") : label;
}
代码示例来源:origin: com.atlassian.streams/streams-thirdparty-api
public Option<String> checkString(Option<String> value, String propertyName, int maxLength)
{
if (value.isDefined())
{
checkString(value.get(), propertyName, maxLength);
}
return value;
}
代码示例来源:origin: com.atlassian.streams/streams-jira-plugin
private boolean updated(JiraActivityItem item)
{
return helper.getOldChangeItemNameTranslation(getFirstChangeItem(item)).isDefined();
}
代码示例来源:origin: com.atlassian.streams/streams-thirdparty-api
public Option<Html> checkHtml(Option<Html> value, String propertyName, int maxLength)
{
checkNotNull(value, propertyName);
if (value.isDefined())
{
checkString(value.get().toString(), propertyName, maxLength);
}
return value;
}
代码示例来源:origin: com.atlassian.streams/streams-crucible-plugin
private Option<Pair<ActivityObjectType, ActivityVerb>> typeAndVerb(StreamsCrucibleActivityItem activityItem)
{
Option<ActivityObjectType> type = type(activityItem);
Option<ActivityVerb> verb = verb(activityItem);
if (!type.isDefined() || !verb.isDefined())
{
return none();
}
return some(pair(type.get(), verb.get()));
}
代码示例来源:origin: com.atlassian.streams/streams-jira-plugin
Option<StreamsEntry> build(URI baseUri, AggregatedJiraActivityItem aggregatedItem)
{
if (aggregatedItem.getRelatedActivityItems().isDefined())
{
return buildMultipleActivityItem(baseUri, aggregatedItem);
}
return buildSingleActivityItem(baseUri, aggregatedItem.getActivityItem());
}
代码示例来源:origin: com.atlassian.streams/streams-jira-plugin
private boolean isTransitionVerb(AggregatedJiraActivityItem aggregatedItem)
{
if (!aggregatedItem.getRelatedActivityItems().isDefined())
{
ActivityVerb verb = aggregatedItem.getActivity().second();
if (transition().equals(verb))
{
return true;
}
for (ActivityVerb childVerb : verb.parent())
{
return transition().equals(childVerb);
}
}
return false;
}
}
代码示例来源:origin: com.atlassian.streams/streams-confluence-plugin
private Function<StreamsEntry, Html> renderTitle(final ContentEntityObject entity)
{
if (isComment(entity))
{
return rendererFactory.newCommentTitleRenderer();
}
else
{
return entry -> {
Option<ActivityObjectType> objectType = get(entry.getActivityObjects(), 0).getActivityObjectType();
String key = String.format("streams.item.confluence.%s.%s",
objectType.isDefined() ? objectType.get().key() : "unknown",
entry.getVerb().key());
return rendererFactory.newTitleRenderer(key).apply(entry);
};
}
}
private Option<String> getPageDiffUri(final URI baseUri,
代码示例来源:origin: com.atlassian.streams/streams-spi
/**
* Determines the maximum date filter based on the {@code ActivityRequest}. Returns null if none is specified.
*
* @param request the {@code ActivityRequest} containing the filter information
* @return the maximum date
*/
public static Option<Date> getMaxDate(ActivityRequest request)
{
Collection<Pair<Operator, Iterable<String>>> filters = request.getStandardFilters().get(UPDATE_DATE.getKey());
//first try with BEFORE operator
Option<Long> maxDate = parseLongSafely(getFirstValue(BEFORE, filters));
if (!maxDate.isDefined() && size(filters) > 0)
{
return getDateRange(filters).map(Pairs.<Date, Date>second());
}
return maxDate.map(toDate);
}
代码示例来源:origin: com.atlassian.streams/streams-spi
/**
* Determines the minimum date filter based on the {@code ActivityRequest}. Returns null if none is specified.
*
* @param request the {@code ActivityRequest} containing the filter information
* @return the minimum date
*/
public static Option<Date> getMinDate(ActivityRequest request)
{
Collection<Pair<Operator, Iterable<String>>> filters = request.getStandardFilters().get(UPDATE_DATE.getKey());
//first try with BEFORE operator
Option<Long> minDate = parseLongSafely(getFirstValue(AFTER, filters));
if (!minDate.isDefined() && size(filters) > 0)
{
return getDateRange(filters).map(Pairs.<Date, Date>first());
}
return minDate.map(toDate);
}
代码示例来源:origin: com.atlassian.streams/streams-jira-plugin
private StreamsEntry.Parameters<HasId, HasPostedDate, HasAlternateLinkUri, HasApplicationType, NeedsRenderer, NeedsVerb, NeedsAuthors>
newParams(JiraActivityItem item, URI itemUri, URI baseUri, boolean issueLinked)
{
final StreamsUriBuilder uriBuilder = new StreamsUriBuilder().setUrl(itemUri.toASCIIString());
if (item.getChangeHistory().isDefined() || item.getComment().isDefined())
{
uriBuilder.setTimestamp(item.getDate());
}
// The following things are constant across all types of activity
return StreamsEntry.params()
.id(uriBuilder.getUri())
.postedDate(new DateTime(item.getDate()))
.applicationType(JIRA_APPLICATION_TYPE)
.alternateLinkUri(itemUri)
.baseUri(baseUri)
.addLinks(buildLinks(item, issueLinked));
}
代码示例来源:origin: com.atlassian.streams/streams-jira-plugin
public Option<Pair<Comment, Html>> get()
{
if (!item.getComment().isDefined())
{
return none();
}
return some(pair(item.getComment().get(), item.getComment().map(commentRenderer).get()));
}
});
代码示例来源:origin: com.atlassian.streams/streams-jira-plugin
private void fetchMetadata(final AggregatedJiraActivityItem aggregatedItem)
{
JiraActivityItem activityItem = aggregatedItem.getActivityItem();
if (activityItem.getChangeHistory().isDefined())
{
HistoryMetadataManager.HistoryMetadataResult historyMetadata = historyMetadataManager.getHistoryMetadata(activityItem.getChangeHistory().get(), authenticationContext.getUser());
activityItem.setHistoryMetadata(option(historyMetadata.getHistoryMetadata()));
}
}
代码示例来源:origin: com.atlassian.streams/streams-jira-plugin
@Override
public UserProfile apply(final UserProfile userProfile)
{
if (historyMetadata.isDefined())
{
final HistoryMetadata data = historyMetadata.get();
final HistoryMetadataParticipant actor = data.getActor();
final boolean useActor = actor != null && isAnonymous;
final Option<URI> generatorAvatar = (data.getGenerator() != null ? makeUri(data.getGenerator().getAvatarUrl()) : Option.<URI>none());
return new UserProfile.Builder(useActor && actor.getId() != null ? actor.getId() : userProfile.getUsername())
.fullName(useActor ? find(asList(actor.getDisplayName(), actor.getId()), notNull(), userProfile.getFullName()) : userProfile.getFullName())
.profilePageUri(makeUri(useActor ? actor.getUrl() : null).orElse(userProfile.getProfilePageUri()))
.profilePictureUri(generatorAvatar.orElse(makeUri(useActor ? actor.getAvatarUrl() : null)).orElse(userProfile.getProfilePictureUri()))
.email(userProfile.getEmail())
.build();
}
return userProfile;
}
};
代码示例来源:origin: com.atlassian.streams/streams-jira-plugin
private Option<StreamsEntry> buildRemoteLink(JiraActivityItem item, URI baseUri, Iterable<GenericValue> changeItems)
{
final Option<RemoteIssueLink> remoteLink = helper.extractRemoteIssueLink(changeItems);
if (remoteLink.isDefined())
{
return some(new StreamsEntry(helper.newBuilder(item, baseUri).
authors(helper.getUserProfiles(baseUri, item)).
addActivityObject(helper.buildActivityObject(item.getIssue(), baseUri, item.getDisplaySummary())).
verb(update()).
renderer(issueUpdateRendererFactory.newRemoteIssueLinkEntryRenderer(baseUri, item, remoteLink.get())), i18nResolver));
}
else
{
// If remote link has been deleted, we shouldn't display any streams entry (STRM-913)
return none();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!