当前位置: 首页>>代码示例>>Java>>正文


Java NoUserForkException类代码示例

本文整理汇总了Java中org.eclipse.che.plugin.pullrequest.client.vcs.hosting.NoUserForkException的典型用法代码示例。如果您正苦于以下问题:Java NoUserForkException类的具体用法?Java NoUserForkException怎么用?Java NoUserForkException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NoUserForkException类属于org.eclipse.che.plugin.pullrequest.client.vcs.hosting包,在下文中一共展示了NoUserForkException类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUserFork

import org.eclipse.che.plugin.pullrequest.client.vcs.hosting.NoUserForkException; //导入依赖的package包/类
@Override
public Promise<Repository> getUserFork(
    final String user, final String owner, final String repository) {
  return getForks(owner, repository)
      .thenPromise(
          new Function<List<Repository>, Promise<Repository>>() {
            @Override
            public Promise<Repository> apply(List<Repository> repositories)
                throws FunctionException {
              final Repository userFork = getUserFork(user, repositories);
              if (userFork != null) {
                return Promises.resolve(userFork);
              } else {
                return Promises.reject(JsPromiseError.create(new NoUserForkException(user)));
              }
            }
          });
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:GitHubHostingService.java

示例2: execute

import org.eclipse.che.plugin.pullrequest.client.vcs.hosting.NoUserForkException; //导入依赖的package包/类
@Override
public void execute(final WorkflowExecutor executor, final Context context) {
  final String originRepositoryOwner = context.getOriginRepositoryOwner();
  final String originRepositoryName = context.getOriginRepositoryName();
  final String upstreamRepositoryOwner = context.getUpstreamRepositoryOwner();
  final String upstreamRepositoryName = context.getUpstreamRepositoryName();

  // the upstream repository has been cloned a fork must be created
  if (originRepositoryOwner.equalsIgnoreCase(upstreamRepositoryOwner)
      && originRepositoryName.equalsIgnoreCase(upstreamRepositoryName)) {

    context
        .getVcsHostingService()
        .getUserFork(context.getHostUserLogin(), upstreamRepositoryOwner, upstreamRepositoryName)
        .then(
            new Operation<Repository>() {
              @Override
              public void apply(Repository fork) throws OperationException {
                proceed(fork.getName(), executor, context);
              }
            })
        .catchError(
            new Operation<PromiseError>() {
              @Override
              public void apply(PromiseError error) throws OperationException {
                if (error.getCause() instanceof NoUserForkException) {
                  createFork(executor, context, upstreamRepositoryOwner, upstreamRepositoryName);
                  return;
                }

                executor.fail(CreateForkStep.this, context, error.getCause().getMessage());
              }
            });
  } else {
    // user fork has been cloned
    proceed(originRepositoryName, executor, context);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:39,代码来源:CreateForkStep.java


注:本文中的org.eclipse.che.plugin.pullrequest.client.vcs.hosting.NoUserForkException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。