本文整理汇总了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)));
}
}
});
}
示例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);
}
}