use of sonia.scm.api.v2.resources.LinkBuilder in project scm-review-plugin by scm-manager.
the class RepositoryConfigMapper method createForRepository.
@ObjectFactory
PullRequestConfigDto createForRepository(@Context Repository repository, @Context UriInfo uriInfo) {
LinkBuilder linkBuilder = new LinkBuilder(uriInfo::getBaseUri, RepositoryConfigResource.class);
Links links = new Links.Builder().self(linkBuilder.method("getRepositoryConfig").parameters(repository.getNamespace(), repository.getName()).href()).single(Link.link("update", linkBuilder.method("setRepositoryConfig").parameters(repository.getNamespace(), repository.getName()).href())).build();
return new PullRequestConfigDto(links);
}
use of sonia.scm.api.v2.resources.LinkBuilder in project scm-review-plugin by scm-manager.
the class IndexLinkEnricher method enrich.
@Override
public void enrich(HalEnricherContext context, HalAppender appender) {
if (PermissionCheck.mayReadGlobalConfig()) {
String globalConfigUrl = new LinkBuilder(scmPathInfoStore.get().get(), GlobalConfigResource.class).method("getGlobalConfig").parameters().href();
appender.appendLink("pullRequestConfig", globalConfigUrl);
}
if (PermissionCheck.mayReadGlobalWorkflowConfig()) {
String globalEngineConfigUrl = new LinkBuilder(scmPathInfoStore.get().get(), GlobalEngineConfigResource.class).method("getGlobalEngineConfig").parameters().href();
appender.appendLink("workflowConfig", globalEngineConfigUrl);
}
}
use of sonia.scm.api.v2.resources.LinkBuilder in project scm-review-plugin by scm-manager.
the class CommentPathBuilder method createDeleteCommentUri.
String createDeleteCommentUri(String namespace, String name, String pullRequestId, String commentId, BranchRevisionResolver.RevisionResult revisions) {
LinkBuilder linkBuilder = new LinkBuilder(pathInfoStore.get().get(), PullRequestRootResource.class, PullRequestResource.class, CommentRootResource.class, CommentResource.class);
String link = linkBuilder.method("getPullRequestResource").parameters(namespace, name, pullRequestId).method("comments").parameters().method("getCommentResource").parameters(commentId).method("deleteComment").parameters().href();
return append(link, revisions);
}
use of sonia.scm.api.v2.resources.LinkBuilder in project scm-review-plugin by scm-manager.
the class CommentPathBuilder method createUpdateCommentUri.
String createUpdateCommentUri(String namespace, String name, String pullRequestId, String commentId, BranchRevisionResolver.RevisionResult revisions) {
LinkBuilder linkBuilder = new LinkBuilder(pathInfoStore.get().get(), PullRequestRootResource.class, PullRequestResource.class, CommentRootResource.class, CommentResource.class);
String link = linkBuilder.method("getPullRequestResource").parameters(namespace, name, pullRequestId).method("comments").parameters().method("getCommentResource").parameters(commentId).method("updateComment").parameters().href();
return append(link, revisions);
}
Aggregations