com.atlassian.fugue.Either.isRight()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(125)

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

Either.isRight介绍

暂无

代码示例

代码示例来源:origin: com.atlassian.plugins/atlassian-connect-api

public boolean isValid() {
  return result.isRight();
}

代码示例来源:origin: com.atlassian.plugins/atlassian-connect-server-api

public boolean isValid() {
  return result.isRight();
}

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

public boolean matchJql(final String filter, final Issue issue) {
  if (StringUtils.isBlank(filter)) {
    return true;
  }
  if (!jqlValidationUtil.isJqlValid(filter).isRight()) {
    log.error(String.format("The following JQL query '%-1.800s' defined for filtering webhook events is incorrect. Filtering has been disabled for webhook.", filter));
    return true;
  }
  try {
    final Query query = getQuery(issue.getKey(), filter);
    final long startTime = System.currentTimeMillis();
    final boolean matches = searchProvider.searchCountOverrideSecurity(query, null) > 0;
    long queryTime = System.currentTimeMillis() - startTime;
    if (queryTime > 50) {
      String logMessage = String.format("JQL query '%-1.800s' produced lucene query and took '%d' ms to run.", query.toString(), queryTime);
      slowLog.info(logMessage);
    }
    return matches;
  } catch (SearchException e) {
    return false;
  } catch (JqlParseException e) {
    log.error("Query could not be parsed", e);
    return false;
  }
}

代码示例来源: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.jira/jira-tests

@Override
protected boolean matchesSafely(final Either<L, R> item, final Description mismatchDescription)
{
  if (!item.isRight())
  {
    mismatchDescription.appendText("LEFT[")
        .appendValue(item.left().get())
        .appendText("]");
    return false;
  }
  else if (!matcher.matches(item.right().get()))
  {
    mismatchDescription.appendText("RIGHT[");
    matcher.describeMismatch(item.right().get(), mismatchDescription);
    mismatchDescription.appendText("]");
    return false;
  }
  else
  {
    return true;
  }
}

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

if (result.isRight())

代码示例来源:origin: com.atlassian.labs.hipchat/hipchat-for-jira-plugin

/**
 * We allow all users to create a room, but we need to check whether a user with their email address exists in
 * HipChat, so that they can become the owner of the new room.
 *
 * @param username the username
 * @return true if the user exists in HipChat with the same email address
 */
@Override
public boolean canUserCreateRoot(String username) {
  boolean canCreate = findHipChatIdForUser(username).isRight();
  eventPublisher.publish(
      canCreate ?
          new RoomCreationCheckboxShownEvent() :
          new RoomCreationCheckboxNotShownEvent(RoomCreationCheckboxNotShownEvent.Reason.USER_NOT_IN_HIPCHAT));
  return canCreate;
}

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

@SuppressWarnings("unchecked")
  @Override
  public RegistrationResult onModule(ConnectModuleProviderModuleDescriptor moduleDescriptor, ConnectModuleProvider<?> provider) {
    final String descriptorKey = provider.getMeta().getDescriptorKey();
    final Collection moduleBeans = builtModuleList.get(descriptorKey);
    if (moduleBeans == null) return RegistrationResult.emptyFor(provider);
    if (vertigoState.isVertigoSpiEnabled()) {
      final Either<GenerationResult, RegistrationResult> potentialDescriptors = BeanToModuleRegistrar.this.getDescriptorsToRegisterForModulesVertigoStyle(provider, moduleBeans, addon, translations);
      if (potentialDescriptors.isRight()) {
        return potentialDescriptors.right().get();
      } else {
        if (potentialDescriptors.left().get() != GenerationResult.NOT_IMPLEMENTED && systemPropertyService.isVertigoFallbackDisabled()) {
          throw new IllegalStateException("The module provider " + provider.getClass() + " implemented serializeToPluginModules but failed to run the whole process. Fallback disabled: failing hard.");
        }
      }
    }
    return new RegistrationResult(provider, provider.createPluginModuleDescriptors(ImmutableList.copyOf(moduleBeans), addon), ImmutableList.of());
  }
});

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

@Deprecated
public final static String getEntityToken(Either<Issue, Project> entity)
{
  if (entity == null)
  {
    return null;
  }
  if (entity.isLeft())
  {
    return getIssueToken(entity.left().get());
  }
  else if (entity.isRight())
  {
    return getProjectToken(entity.right().get());
  }
  else
  {
    return null;
  }
}

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

if (resultOrError.isRight())

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

@Override
  public ServiceResult perform() throws GenericEntityException
  {
    if (id.equals(permissionSchemeManager.getDefaultSchemeObject().getId()))
    {
      return fail(i18n.getText("admin.schemes.permissions.cannot.delete.default.scheme"), Reason.VALIDATION_FAILED);
    }
    Either<ServiceOutcome<Object>, PermissionScheme> schemeToDelete = getScheme(user, id);
    if (schemeToDelete.isRight())
    {
      if (!permissionSchemeManager.getProjects(representationConverter.scheme(schemeToDelete.right().get())).isEmpty())
      {
        return fail(i18n.getText("admin.schemes.permissions.cannot.delete.with.projects", id), Reason.VALIDATION_FAILED);
      }
      permissionSchemeManager.deleteScheme(id);
      return ok();
    }
    else
    {
      return schemeToDelete.left().get();
    }
  }
});

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

if (getActions.isRight())

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

@SuppressWarnings("unchecked")
@Override
public ErrorCollection setScreen(@Nonnull String transitionName, @Nullable FieldScreen screen, @Nonnull JiraWorkflow workflow)
{
  ErrorCollection errorCollection = checkArguments(transitionName, workflow);
  if (errorCollection.hasAnyErrors())
  {
    return errorCollection;
  }
  Option<JiraWorkflow> getDraft = draftOf(errorCollection, workflow);
  if (getDraft.isEmpty())
  {
    return errorCollection;
  }
  JiraWorkflow draftWorkflow = getDraft.get();
  Either<Collection<ActionDescriptor>, ErrorCollection> getActions = getActionsByName(transitionName, draftWorkflow);
  if (getActions.isRight())
  {
    return getActions.right().get();
  }
  for (ActionDescriptor action : getActions.left().get())
  {
    setActionScreen(action, screen);
  }
  workflowService.updateWorkflow(getServiceContext(errorCollection), draftWorkflow);
  return errorCollection;
}

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

@Override
public ErrorCollection addConditionToWorkflow(@Nonnull String transitionName, @Nonnull ConditionDescriptor condition, @Nonnull JiraWorkflow workflow)
{
  ErrorCollection errorCollection = checkArguments(transitionName, workflow, condition,
      "admin.workflowtransitions.service.error.null.condition");
  if (errorCollection.hasAnyErrors())
  {
    return errorCollection;
  }
  Option<JiraWorkflow> getDraft = draftOf(errorCollection, workflow);
  if (getDraft.isEmpty())
  {
    //Draft creation might fail, if so, return the resulting error.
    return errorCollection;
  }
  JiraWorkflow draftWorkflow = getDraft.get();
  Either<Collection<ActionDescriptor>, ErrorCollection> getActions = getActionsByName(transitionName, draftWorkflow);
  if (getActions.isRight())
  {
    return getActions.right().get();
  }
  for (ActionDescriptor action : getActions.left().get())
  {
    transitionConditionUtil.addCondition(action, "", condition);
  }
  workflowService.updateWorkflow(getServiceContext(errorCollection), draftWorkflow);
  return errorCollection;
}

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

final Either<Query, ErrorCollection> queryOrError = queryParser.getQuery(user, params.getJql());
if (queryOrError.isRight())
  if (versionResult.isRight())

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

protected <T> T handleGenericResponseStatus(JiraProxy jira, Either<NegativeResponseStatus, T> response, Function<NegativeResponseStatus, Void> errorOccuredHandler){
  if(response.isRight()){
    return response.right().get();
  } else {

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

@Override
public Either<List<ProjectVersionBean>, ErrorCollection> getVersions(@Nonnull final String jql)
{
  ApplicationUser user = authenticationContext.getUser();
  Either<Query, ErrorCollection> queryOrError = queryParser.getQuery(user, jql);
  if (queryOrError.isRight())
  {
    return Either.right(queryOrError.right().get());
  }
  Query query = queryOrError.left().get();
  Option<Query> filterQuery = projectOrFilterQueryParser.getFilterQuery(user, query);
  if (filterQuery.isDefined())
  {
    query = filterQuery.get();
  }
  Collection<Project> projects = getProjectsForQuery(user, query);
  List<ProjectVersionBean> projectVersionBeanList = getVersionsForProjects(query, projects);
  return Either.left(projectVersionBeanList);
}

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

if (scheme.isRight())

代码示例来源:origin: com.atlassian.plugin.deflection/deflection-suggestions

if (groupOrRole.isRight())

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

if (queryOrError.isRight())

相关文章

微信公众号

最新文章

更多