本文整理了Java中com.atlassian.fugue.Option
类的一些代码示例,展示了Option
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Option
类的具体详情如下:
包路径:com.atlassian.fugue.Option
类名称:Option
暂无
代码示例来源:origin: com.atlassian.jira/jira-core
@Nonnull
@Override
public Option<ErrorCollection> errors()
{
return Option.none();
}
代码示例来源:origin: com.atlassian.jira/jira-tests
@Override
public Option<GlobalPermissionType> getGlobalPermission(@Nonnull final String permissionKey)
{
for(GlobalPermissionType gpt: SYSTEM_PERMISSIONS)
{
if(gpt.getKey().equals(permissionKey))
{
return Option.some(gpt);
}
}
return Option.none();
}
代码示例来源:origin: com.atlassian.jira/jira-core
private Option<Query> convertClauseToWorklogQuery(Clause clause)
{
if (clause instanceof TerminalClause)
{
Option<WorklogClauseQueryFactory> worklogClauseFactory = queryRegistry.getClauseQueryFactory(queryCreationContext, (TerminalClause) clause);
if (worklogClauseFactory.isDefined())
{
return some(worklogClauseFactory.get().getWorklogQuery(queryCreationContext, (TerminalClause) clause));
}
}
return none();
}
代码示例来源:origin: com.atlassian.jira/jira-core
protected static Option<JiraWorkflow> getWorkflow(Map<String, Object> context) {
final Object maybeWorkflow = context.get(WORKFLOW_KEY);
return maybeWorkflow instanceof JiraWorkflow ? Option.some((JiraWorkflow) maybeWorkflow) : Option.<JiraWorkflow>none();
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
private Option<ApplicationKey> getAppToSetAsDefault(final Set<ApplicationKey> licensedApps)
{
if (licensedApps.contains(SOFTWARE))
{
return Option.option(SOFTWARE);
}
else if (licensedApps.contains(CORE))
{
return Option.option(CORE);
}
return Option.none();
}
代码示例来源:origin: com.atlassian.jira/jira-api
private static String toShortLicenseString(Option<? extends LicenseDetails> details)
{
return details.map(LicenseDetails::getLicenseString)
.map(str -> StringUtils.abbreviate(str, 100))
.getOrNull();
}
代码示例来源:origin: com.atlassian.jira/jira-core
@Nonnull
public List<SimpleLinkSection> getSectionsForLocation(@Nonnull final String location, final ApplicationUser remoteUser, @Nonnull final JiraHelper jiraHelper)
{
final Iterable<WebSection> sections = SafePluginPointAccess.call(() -> webInterfaceManager.getDisplayableWebSections(location, makeContext(remoteUser, jiraHelper))).getOrElse(Collections.emptyList());
final List<SimpleLinkSection> returnSections = new ArrayList<SimpleLinkSection>(Iterables.size(sections));
for (final WebSection section : sections)
{
returnSections.add(convertWebSectionToSimpleLinkSection(section));
}
return returnSections;
}
代码示例来源:origin: com.atlassian.jira/jira-core
public static PermissionHolderType permissionHolderType(@Nonnull String key, @Nullable String parameter)
{
Option<JiraPermissionHolderType> jiraHolderType = JiraPermissionHolderType.fromKey(key, parameter);
if (jiraHolderType.isDefined())
{
return jiraHolderType.get();
}
else
{
return new CustomPermissionHolderType(key, parameter != null);
}
}
代码示例来源:origin: com.atlassian.jira/jira-rest-plugin
private List<ApplicationSelection> getApplicationForUser(@Nonnull final ApplicationUpdateResult applicationUpdateResult)
{
final Option<ApplicationUser> applicationUser = applicationUpdateResult.getApplicationUser();
if (applicationUser.isEmpty())
{
return ImmutableList.of();
}
return userApplicationHelper.getApplicationsForUser(applicationUser.get());
}
代码示例来源:origin: com.atlassian.jira/jira-tests
@Nonnull
@Override
public Set<Group> getDefaultGroups(@Nonnull final ApplicationKey key)
{
final Supplier<Set<Group>> of = ImmutableSet::of;
return getRole(key).map(ApplicationRole::getDefaultGroups).getOrElse(of);
}
代码示例来源:origin: com.atlassian.jira/jira-api
private VersionDeleteEvent(@Nonnull Version version,
@Nullable Version mergedTo,
@Nullable Version affectsVersionSwappedTo,
@Nullable Version fixSwapVersion)
{
super(version);
this.mergedTo = option(mergedTo);
this.affectsVersionSwappedTo = option(affectsVersionSwappedTo);
this.fixVersionSwappedTo = option(fixSwapVersion);
}
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
@Nonnull
public Option<String> getHelpSpace(@Nonnull final ApplicationKey applicationKey)
{
return Option.some(jiraProductInformation.getSetupHelpApplicationHelpSpace());
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
private Option<LicenseDetails> findExistingLicenseDetails(@Nonnull final LicenseDetails licenseDetails)
{
for (ApplicationKey licensedApplication : licenseDetails.getLicensedApplications().getKeys())
{
final Option<LicenseDetails> license = getLicense(licensedApplication);
if (license.isDefined())
{
return license;
}
}
return Option.none();
}
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
public void deleteIssueType(final ApplicationUser user, @Nonnull final DeleteValidationResult validationResult)
{
checkNotNull(validationResult);
checkArgument(validationResult.isValid());
checkNotNull(validationResult.getDeleteIssueTypeInput());
checkArgument(validationResult.getDeleteIssueTypeInput().isDefined());
final String issueTypeToDeleteId = validationResult.getDeleteIssueTypeInput().get().getIssueTypeToDeleteId();
issueTypeManager.removeIssueType(issueTypeToDeleteId,
validationResult.getDeleteIssueTypeInput().get().getAlternativeIssueTypeId().getOrNull());
}
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
@Nonnull
public Option<String> getHelpSpace(@Nonnull final ApplicationKey applicationKey)
{
return applicationManager.getApplication(applicationKey)
.flatMap(app -> featureManager.isOnDemand() ? app.getProductHelpCloudSpaceURI() : app.getProductHelpServerSpaceURI())
.map(uri -> uri.toString());
}
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
public IssueTypeResult createIssueType(final ApplicationUser user, @Nonnull final CreateValidationResult validationResult)
{
checkArgument(validationResult.isValid());
checkArgument(validationResult.getIssueTypeInput().isDefined());
final IssueTypeCreateInput issueTypeCreateInput = validationResult.getIssueTypeInput().get();
final String name = issueTypeCreateInput.getName();
final IssueTypeCreateInput.Type type = issueTypeCreateInput.getType();
final String description = issueTypeCreateInput.getDescription().getOrElse(StringUtils.EMPTY);
final IssueType issueType = createIssueTypeOrSubTaskType(name, type, description);
return new IssueTypeResult(issueType);
}
代码示例来源:origin: com.atlassian.jira/jira-core
private Option<Avatar> transformToJIRAAvatar(final Avatar avatar)
{
final Option<Long> avatarId = Option.option(avatar.getId());
if (avatarId.isEmpty())
{
//this could happen if for some reason we try to process avatar data via this (old) API for a new
//pluggable avatar. In theory we should never hit this method since 'new' avatars should simply be
//included via a URL or use the {@code com.atlassian.plugins.avatar.PluginAvatar#getBytes()} method.
return Option.none();
}
return option(getByIdTagged(avatarId.get()));
}
代码示例来源:origin: com.atlassian.jira/jira-core
/**
* Returns I18n key representing action description for field for Bulk Edit Wizard Confirmation screen.
*
* @param field The field for which action description is retrieved.
* @return I18n key representing action description
*/
public String getMultiSelectFieldActionDescription(final OrderableField field)
{
Option<BulkEditMultiSelectFieldOption> option = getChangeModeForField(field);
return option.isDefined() ? option.get().getDescriptionI18nKey() : StringUtils.EMPTY;
}
代码示例来源:origin: com.atlassian.jira/jira-core
public static PluginInfo addFailures(final PluginInfo pluginInfo, final Throwable cause)
{
final List<String> copiedCauses = copyPreviousCauses(pluginInfo);
Option<List<String>> capturedCauses = option(cause).flatMap(CAPTURE_CAUSES);
if (capturedCauses.isDefined())
{
copiedCauses.addAll(capturedCauses.get());
}
return new PluginInfo(pluginInfo.pluginKey, pluginInfo.pluginName, pluginInfo.pluginArtifact, option(copiedCauses), pluginInfo.dependencies);
}
代码示例来源:origin: com.atlassian.jira/jira-core
private Option<ErrorCollection> validateName(final String name, final Option<IssueType> issueTypeToUpdate)
{
final Option<Pair<String, ErrorCollection.Reason>> nameValidation = constantsManager.validateName(name, issueTypeToUpdate);
if (nameValidation.isDefined())
{
return errorCollection("name", nameValidation.get().first(), nameValidation.get().second());
}
return none();
}
内容来源于网络,如有侵权,请联系作者删除!