本文整理了Java中com.atlassian.fugue.Either.left()
方法的一些代码示例,展示了Either.left()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Either.left()
方法的具体详情如下:
包路径:com.atlassian.fugue.Either
类名称:Either
方法名:left
暂无
代码示例来源:origin: com.atlassian.labs.hipchat/hipchat-for-jira-plugin
@Override
public Either<Throwable, Set<MentionRoom>> apply(final Throwable input) {
return Either.left(input);
}
},
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
public ServiceOutcome<Version> validateReleaseDate(ApplicationUser user, Version version, String releaseDate)
{
return setReleaseDate(user, version, Either.<String, Date>left(releaseDate));
}
代码示例来源:origin: com.atlassian.jira/jira-core
private PermissionGrantAsPureData(PermissionGrant grant, PermissionGrantInput grantData)
{
if (grant != null)
{
actual = left(grant);
}
else
{
actual = right(grantData);
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
public ServiceOutcome<Version> setReleaseDate(ApplicationUser user, Version version, String releaseDate)
{
return setReleaseDate(user, version, Either.<String, Date>left(releaseDate));
}
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
public ServiceOutcome<IssueSecurityLevelScheme> getIssueSecurityLevelSchemeForProject(final ApplicationUser user, final long projectId)
{
return getIssueSecurityLevelSchemeForProject(user, Either.left(projectId));
}
代码示例来源:origin: com.atlassian.jira/jira-core
private <T> Either<AttachmentError, T> attachmentError(final String logMessage, final String localizedMessage,
final String filename, final ErrorCollection.Reason reason)
{
log.warn(logMessage);
return Either.left(new AttachmentError(logMessage, localizedMessage, filename, Option.<Exception>none(), reason));
}
代码示例来源:origin: com.atlassian.jira/jira-core
private <T> Either<AttachmentError, T> attachmentError(final String logMessage, final String localizedMessage,
final String filename, final ErrorCollection.Reason reason)
{
log.warn(logMessage);
return Either.left(new AttachmentError(logMessage, localizedMessage, filename, Option.<Exception>none(), reason));
}
代码示例来源:origin: com.atlassian.jira/jira-core
private Either<ServiceOutcome<PermissionScheme>, String> validateSchemeName(@Nullable String oldName, String newName) throws GenericEntityException
{
if (!newName.equals(oldName) && permissionSchemeManager.schemeExists(newName))
{
return left(DefaultPermissionSchemeService.<PermissionScheme>fail(i18n.getText("admin.schemes.permissions.scheme.already.exists", newName), Reason.VALIDATION_FAILED));
}
else
{
return right(newName);
}
}
代码示例来源:origin: com.atlassian.jira/jira-webhooks-plugin
public void validateFilter(final MessageCollection.Builder errorCollectionBuilder, final Optional<String> filter) {
if (filter.isPresent() && StringUtils.isNotBlank(filter.get())) {
final String jql = filter.get();
final Either<JqlParseException, String> jqlValid = isJqlValid(jql);
if (!jqlValid.isRight()) {
final Message errorMessage = new ErrorMessage("jql", i18n.getText("webhooks.invalid.jql", jql, jqlValid.left().get()));
errorCollectionBuilder.addMessage(errorMessage, MessageCollection.Reason.VALIDATION_FAILED);
}
}
}
代码示例来源:origin: com.atlassian.cpji/cpji-jira-plugin
@Override
public Either<NegativeResponseStatus, Projects> apply(JiraProxy input) {
Either<NegativeResponseStatus, PluginVersion> version = input.isPluginInstalled();
if(version.isLeft())
return Either.left(version.left().get());
if(version.right().get().getResult().equals(PluginInfoResource.PLUGIN_VERSION)){
return input.getProjects();
} else {
return Either.left(NegativeResponseStatus.unsupportedVersion(input.getJiraLocation()));
}
}
});
代码示例来源:origin: com.atlassian.jira/jira-core
public boolean canCreateTemporaryAttachments(final JiraServiceContext jiraServiceContext, @Nullable final Issue issue)
{
return validateNonNullIssue(jiraServiceContext, issue) &&
attachmentValidator.canCreateTemporaryAttachments(
jiraServiceContext.getLoggedInApplicationUser(),
Either.<Issue, Project>left(issue),
jiraServiceContext.getErrorCollection());
}
代码示例来源:origin: com.atlassian.jira/jira-rest-plugin
private Either<ErrorCollection, PermissionSchemeBean> validated(final PermissionSchemeBean bean)
{
if (isNullOrEmpty(bean.getName()))
{
return left(ErrorCollections.validationError("name", i18n.getText("rest.missing.field", "name")));
}
return right(bean);
}
代码示例来源:origin: com.atlassian.jira/jira-rest-plugin
private Response.ResponseBuilder withApplicationRole(String key, Function<ApplicationRole, Response.ResponseBuilder> valid)
{
final Either<Response.ResponseBuilder, ApplicationRole> appRoleEither = getApplicationRole(key);
if (appRoleEither.isLeft())
{
return appRoleEither.left().get();
}
return valid.apply(appRoleEither.right().get());
}
代码示例来源:origin: com.atlassian.jira/jira-core
private Either<Project, ErrorCollection> notifyProjectTypeUpdated(ApplicationUser user, Project project, ProjectTypeKey oldProjectType, ProjectTypeKey newProjectType)
{
boolean notificationWasSuccessful = projectTypeUpdatedNotifier.notifyAllHandlers(user, project, oldProjectType, newProjectType);
if (!notificationWasSuccessful)
{
// rollback the project type update, since something went wrong on one of the project type update handlers
projectManager.updateProjectType(user, project, oldProjectType);
return Either.right(new SimpleErrorCollection("admin.errors.project.type.update.error", Reason.SERVER_ERROR));
}
return Either.left(project);
}
代码示例来源:origin: com.atlassian.cpji/cpji-jira-plugin
public static ResultWithJiraLocation<?> extract(Either<? extends ResultWithJiraLocation<?>, ? extends ResultWithJiraLocation<?>> either) {
if (either.isLeft()) {
return either.left().get();
} else {
return either.right().get();
}
}
}
代码示例来源:origin: com.atlassian.jira/jira-rest-plugin
@Override
public <T> Either<Response, T> validateOutcome(ServiceOutcome<T> outcome)
{
if (outcome.isValid())
{
return Either.right(outcome.get());
}
else
{
return Either.left(errorResponse(outcome.getErrorCollection()));
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
public ErrorCollection apply(final ApplicationUser user, final ChangeHistory changeGroup)
{
Either<ErrorCollection, Issue> issue = getIssueFromChangeHistory(changeGroup);
if (issue.isLeft()) {
return issue.left().get();
}
return issuePermissionFunction.apply(user, issue.right().get());
}
}
代码示例来源:origin: com.atlassian.jira/jira-rest-plugin
private Either<Response, Project> getEitherProjectOrErrors(final String projectIdOrKey, final ProjectAction action)
{
final ProjectService.GetProjectResult projectResult = projectFinder.getGetProjectForActionByIdOrKey(authContext.getLoggedInUser(),
projectIdOrKey, action);
if (projectResult.isValid())
{
return Either.right(projectResult.getProject());
}
return Either.left(responseFactory.errorResponse(projectResult.getErrorCollection()));
}
代码示例来源:origin: com.atlassian.jira/jira-rest-plugin
@Override
public Response apply(@Nullable final Project project)
{
Either<Project, com.atlassian.jira.util.ErrorCollection> updateResult = projectService.updateProjectType(authContext.getLoggedInUser(), project, new ProjectTypeKey(newProjectTypeKey));
if (updateResult.isLeft())
{
return responses.okNoCache(projectBeanFactory.fullProject(updateResult.left().get(), ""));
}
return responses.errorResponse(updateResult.right().get());
}
});
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
public Promise<Unit> moveTemporaryToAttachment(final TemporaryAttachmentId temporaryAttachmentId, final AttachmentKey destinationKey)
{
final Either<Exception, File> tempFileEitherException = localTemporaryFileStore.getTemporaryAttachmentFile(temporaryAttachmentId);
if (tempFileEitherException.isLeft())
{
return Promises.rejected(tempFileEitherException.left().get());
}
final File tempFile = tempFileEitherException.right().get();
final File destinationFile = getAttachmentFileHolder(destinationKey);
return moveFile(tempFile, destinationFile, true);
}
内容来源于网络,如有侵权,请联系作者删除!