本文整理汇总了Java中org.eclipse.che.plugin.pullrequest.shared.dto.Repository类的典型用法代码示例。如果您正苦于以下问题:Java Repository类的具体用法?Java Repository怎么用?Java Repository使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Repository类属于org.eclipse.che.plugin.pullrequest.shared.dto包,在下文中一共展示了Repository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: valueOf
import org.eclipse.che.plugin.pullrequest.shared.dto.Repository; //导入依赖的package包/类
/**
* Converts an instance of {@link org.eclipse.che.ide.ext.bitbucket.shared.BitbucketRepository}
* into a {@link Repository}.
*
* @param bitbucketRepository the Bitbucket repository to convert.
* @return the corresponding {@link Repository} instance or {@code null} if given
* bitbucketRepository is {@code null}.
*/
private Repository valueOf(final BitbucketRepository bitbucketRepository) {
if (bitbucketRepository == null) {
return null;
}
final BitbucketRepository bitbucketRepositoryParent = bitbucketRepository.getParent();
final Repository parent =
bitbucketRepositoryParent == null
? null
: dtoFactory
.createDto(Repository.class)
.withFork(bitbucketRepositoryParent.getParent() != null)
.withName(bitbucketRepositoryParent.getName())
.withParent(null)
.withPrivateRepo(bitbucketRepositoryParent.isIsPrivate())
.withCloneUrl(getParentCloneHttpsUrl(bitbucketRepositoryParent));
return dtoFactory
.createDto(Repository.class)
.withFork(bitbucketRepositoryParent != null)
.withName(bitbucketRepository.getName())
.withParent(parent)
.withPrivateRepo(bitbucketRepository.isIsPrivate())
.withCloneUrl(getCloneHttpsUrl(bitbucketRepository));
}
示例2: getUserFork
import org.eclipse.che.plugin.pullrequest.shared.dto.Repository; //导入依赖的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)));
}
}
});
}
示例3: getForks
import org.eclipse.che.plugin.pullrequest.shared.dto.Repository; //导入依赖的package包/类
/**
* Returns the forks of the given repository for the given owner.
*
* @param owner the repository owner.
* @param repository the repository name.
* @param callback callback called when operation is done.
*/
private void getForks(
@NotNull final String owner,
@NotNull final String repository,
@NotNull final AsyncCallback<List<Repository>> callback) {
oAuthServiceClient
.getToken(SERVICE_NAME.toLowerCase())
.thenPromise(token -> gitHubClientService.getForks(token.getToken(), owner, repository))
.then(
gitHubRepositoryList -> {
final List<Repository> repositories = new ArrayList<>();
for (final GitHubRepository oneGitHubRepository :
gitHubRepositoryList.getRepositories()) {
repositories.add(valueOf(oneGitHubRepository));
}
callback.onSuccess(repositories);
})
.catchError(
error -> {
callback.onFailure(error.getCause());
});
}
示例4: valueOf
import org.eclipse.che.plugin.pullrequest.shared.dto.Repository; //导入依赖的package包/类
/**
* Converts an instance of {@link org.eclipse.che.plugin.github.shared.GitHubRepository} into a
* {@link Repository}.
*
* @param gitHubRepository the GitHub repository to convert.
* @return the corresponding {@link Repository} instance or {@code null} if given gitHubRepository
* is {@code null}.
*/
private Repository valueOf(final GitHubRepository gitHubRepository) {
if (gitHubRepository == null) {
return null;
}
final GitHubRepository gitHubRepositoryParent = gitHubRepository.getParent();
final Repository parent =
gitHubRepositoryParent == null
? null
: dtoFactory
.createDto(Repository.class)
.withFork(gitHubRepositoryParent.isFork())
.withName(gitHubRepositoryParent.getName())
.withParent(null)
.withPrivateRepo(gitHubRepositoryParent.isPrivateRepo())
.withCloneUrl(gitHubRepositoryParent.getCloneUrl());
return dtoFactory
.createDto(Repository.class)
.withFork(gitHubRepository.isFork())
.withName(gitHubRepository.getName())
.withParent(parent)
.withPrivateRepo(gitHubRepository.isPrivateRepo())
.withCloneUrl(gitHubRepository.getCloneUrl());
}
示例5: getRepository
import org.eclipse.che.plugin.pullrequest.shared.dto.Repository; //导入依赖的package包/类
@Override
public Promise<Repository> getRepository(String owner, String repositoryName) {
return bitbucketClientService
.getRepository(owner, repositoryName)
.then(
new Function<BitbucketRepository, Repository>() {
@Override
public Repository apply(BitbucketRepository bbRepo) throws FunctionException {
return valueOf(bbRepo);
}
});
}
示例6: getRepository
import org.eclipse.che.plugin.pullrequest.shared.dto.Repository; //导入依赖的package包/类
@Override
public Promise<Repository> getRepository(String owner, String repositoryName) {
return microsoftClient
.getRepository(account, collection, owner, repositoryName)
.then(
new Function<MicrosoftRepository, Repository>() {
@Override
public Repository apply(MicrosoftRepository msRepo) throws FunctionException {
return valueOf(msRepo);
}
});
}
示例7: valueOf
import org.eclipse.che.plugin.pullrequest.shared.dto.Repository; //导入依赖的package包/类
/**
* Converts an instance of {@link
* org.eclipse.che.ide.ext.microsoft.shared.dto.MicrosoftRepository} into a {@link Repository}.
*
* @param microsoftRepository the MicrosoftVstsRestClient repository to convert.
* @return the corresponding {@link Repository} instance or {@code null} if given
* microsoftRepository is {@code null}.
*/
private Repository valueOf(final MicrosoftRepository microsoftRepository) {
if (microsoftRepository == null) {
return null;
}
return dtoFactory
.createDto(Repository.class)
.withFork(false)
.withName(microsoftRepository.getName())
.withParent(null)
.withPrivateRepo(false)
.withCloneUrl(microsoftRepository.getUrl());
}
示例8: getRepository
import org.eclipse.che.plugin.pullrequest.shared.dto.Repository; //导入依赖的package包/类
@Override
public Promise<Repository> getRepository(String owner, String repositoryName) {
return oAuthServiceClient
.getToken(SERVICE_NAME.toLowerCase())
.thenPromise(
token -> gitHubClientService.getRepository(token.getToken(), owner, repositoryName))
.then((Function<GitHubRepository, Repository>) this::valueOf);
}
示例9: execute
import org.eclipse.che.plugin.pullrequest.shared.dto.Repository; //导入依赖的package包/类
@Override
public void execute(final WorkflowExecutor executor, final Context context) {
final VcsHostingService hostingService = context.getVcsHostingService();
hostingService
.getRepository(context.getOriginRepositoryOwner(), context.getOriginRepositoryName())
.then(
new Operation<Repository>() {
@Override
public void apply(Repository repo) throws OperationException {
if (repo.isFork()
&& context
.getOriginRepositoryOwner()
.equalsIgnoreCase(context.getHostUserLogin())) {
final String upstreamUrl = repo.getParent().getCloneUrl();
context.setUpstreamRepositoryName(
hostingService.getRepositoryNameFromUrl(upstreamUrl));
context.setUpstreamRepositoryOwner(
hostingService.getRepositoryOwnerFromUrl(upstreamUrl));
} else {
context.setUpstreamRepositoryName(context.getOriginRepositoryName());
context.setUpstreamRepositoryOwner(context.getOriginRepositoryOwner());
}
executor.done(DetermineUpstreamRepositoryStep.this, context);
}
})
.catchError(
new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
notificationManager.notify(error.getMessage(), FAIL, FLOAT_MODE);
executor.fail(DetermineUpstreamRepositoryStep.this, context, error.getMessage());
}
});
}
示例10: execute
import org.eclipse.che.plugin.pullrequest.shared.dto.Repository; //导入依赖的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);
}
}
示例11: createFork
import org.eclipse.che.plugin.pullrequest.shared.dto.Repository; //导入依赖的package包/类
private void createFork(
final WorkflowExecutor executor,
final Context context,
final String upstreamRepositoryOwner,
final String upstreamRepositoryName) {
context
.getVcsHostingService()
.fork(upstreamRepositoryOwner, upstreamRepositoryName)
.then(
new Operation<Repository>() {
@Override
public void apply(Repository result) throws OperationException {
proceed(result.getName(), executor, context);
}
})
.catchError(
new Operation<PromiseError>() {
@Override
public void apply(PromiseError err) throws OperationException {
final String errorMessage =
messages.stepCreateForkErrorCreatingFork(
upstreamRepositoryOwner,
upstreamRepositoryName,
err.getCause().getMessage());
executor.fail(CreateForkStep.this, context, errorMessage);
}
});
}
示例12: fork
import org.eclipse.che.plugin.pullrequest.shared.dto.Repository; //导入依赖的package包/类
@Override
public Promise<Repository> fork(String owner, String repository) {
return Promises.reject(JsPromiseError.create("Fork is not supported for " + getName()));
}
示例13: getUserFork
import org.eclipse.che.plugin.pullrequest.shared.dto.Repository; //导入依赖的package包/类
@Override
public Promise<Repository> getUserFork(
final String user, final String owner, final String repository) {
return Promises.reject(JsPromiseError.create("User forks is not supported for " + getName()));
}
示例14: fork
import org.eclipse.che.plugin.pullrequest.shared.dto.Repository; //导入依赖的package包/类
/**
* Forks the given repository for the current user.
*
* @param owner the repository owner.
* @param repository the repository name.
*/
Promise<Repository> fork(String owner, String repository);
示例15: getRepository
import org.eclipse.che.plugin.pullrequest.shared.dto.Repository; //导入依赖的package包/类
/**
* Returns the promise which either resolves repository or rejects with an error.
*
* @param owner the owner of the repositoryName
* @param repositoryName the name of the repository
*/
Promise<Repository> getRepository(String owner, String repositoryName);