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

x33g5p2x  于2022-01-25 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(139)

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

Option.filter介绍

暂无

代码示例

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

private Option<License> sdLicenseForCloud()
  {
    return licenseDao.getLicenses().license(ApplicationKeys.SERVICE_DESK)
        .filter(LicenseUtils::isServiceDeskLicense)
        .orElse(licenseDao::get6xLicense)
        .filter(LicenseUtils::isServiceDeskLicense);
  }
}

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

/**
 * Return the Service Desk license stored in the UPM plugin store.
 *
 * @return the old Service Desk license from the UPM plugin store or {@link Option#none()}.
 */
private Option<License> retrieveOldSdLicense()
{
  return sdSupplier.get()
      .map(License::new)
      .filter(license -> license.isLicensed(ApplicationKeys.SERVICE_DESK));
}

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

private Option<License> get6xSdLicenseFromOldStoreSafely()
{
  try
  {
    return licenseDao.get6xLicense().filter(LicenseUtils::isServiceDeskLicense);
  }
  catch (MigrationFailedException e)
  {
    //We do not care if license is broken in old store here, as there might be valid one in multistore
    return Option.none();
  }
}

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

@Override
public <A extends Application> Option<A> getApplication(final ApplicationKey key, final Class<A> type)
{
  return getApplication(key).filter(type::isInstance).map(type::cast);
}

代码示例来源:origin: com.atlassian.plugins/base-hipchat-integration-plugin-api

@Override
  public Option<String> doInTransaction() {
    return hipChatAOUserManager.getByUserKey(userKey).filter(new Predicate<AOHipChatUser>() {
      @Override
      public boolean apply(AOHipChatUser input) {
        return !isExpired(input.getUserTokenExpiry());
      }
    }).map(new Function<AOHipChatUser, String>() {
      @Override
      public String apply(AOHipChatUser input) {
        return input.getUserToken();
      }
    });
  }
});

代码示例来源:origin: com.atlassian.plugins/base-hipchat-integration-plugin-api

@Override
  public Option<String> doInTransaction() {
    return hipChatAOLinkManager.getLinkById(hipChatLinkId).filter(new Predicate<AOHipChatLink>() {
      @Override
      public boolean apply(AOHipChatLink input) {
        return !isExpired(input.getAddonTokenExpiry());
      }
    }).map(new Function<AOHipChatLink, String>() {
      @Override
      public String apply(AOHipChatLink input) {
        return input.getToken();
      }
    });
  }
});

代码示例来源:origin: com.atlassian.plugins/base-hipchat-integration-plugin-api

@Override
  public Option<String> doInTransaction() {
    return hipChatAOLinkManager.getLinkById(hipChatLinkId).filter(new Predicate<AOHipChatLink>() {
      @Override
      public boolean apply(AOHipChatLink input) {
        return !isExpired(input.getSystemTokenExpiry());
      }
    }).map(new Function<AOHipChatLink, String>() {
      @Override
      public String apply(AOHipChatLink input) {
        return input.getSystemUserToken();
      }
    });
  }
});

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

/**
 * @see com.atlassian.jira.upgrade.tasks.role.Move6xServiceDeskLicenseTo70Store
 */
@Override
public Option<LicenseDetails> get()
{
  try
  {
    return encodedLicenseSupplier.get()
        .map(licenseDetailsFactory::getLicense)
        .filter(Jira6xServiceDeskPluginLicenseSupplier::isServiceDeskLicense);
  }
  catch (LicenseException invalidLicense)
  {
    LOG.debug("Invalid Service Desk plugin license", invalidLicense);
    return Option.none();
  }
}

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

@Override
MigrationState migrate(final MigrationState state, final boolean licenseSuppliedByUser)
{
  if (licenseSuppliedByUser)
  {
    return state.log(new AuditEntry(Move6xServiceDeskLicenseTo70Store.class,
        "Not moving old Service Desk license - license supplied by user",
        "The person importing JIRA has supplied a license to use; any existing Service Desk license" +
            "installed in your system will be ignored in preference of the new license.",
        AssociatedItem.Type.LICENSE, null, EVENT_SHOWS_IN_CLOUD_LOG));
  }
  else
  {
    return sdEncodedLicenseSupplier.get()
        .map(License::new)
        .filter(this::isValid6xServiceDeskLicense)
        .map(sdLicense -> addLicenseIfNotPresent(sdLicense, state))
        .getOrElse(state);
  }
}

相关文章