Search in sources :

Example 6 with LinkBuilder

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);
}
Also used : LinkBuilder(sonia.scm.api.v2.resources.LinkBuilder) Links(de.otto.edison.hal.Links) ObjectFactory(org.mapstruct.ObjectFactory)

Example 7 with LinkBuilder

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);
    }
}
Also used : LinkBuilder(sonia.scm.api.v2.resources.LinkBuilder) GlobalEngineConfigResource(com.cloudogu.scm.review.workflow.GlobalEngineConfigResource) GlobalConfigResource(com.cloudogu.scm.review.config.api.GlobalConfigResource)

Example 8 with LinkBuilder

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);
}
Also used : LinkBuilder(sonia.scm.api.v2.resources.LinkBuilder)

Example 9 with LinkBuilder

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);
}
Also used : LinkBuilder(sonia.scm.api.v2.resources.LinkBuilder)

Aggregations

LinkBuilder (sonia.scm.api.v2.resources.LinkBuilder)9 Links (de.otto.edison.hal.Links)2 ObjectFactory (org.mapstruct.ObjectFactory)2 GlobalConfigResource (com.cloudogu.scm.review.config.api.GlobalConfigResource)1 GlobalEngineConfigResource (com.cloudogu.scm.review.workflow.GlobalEngineConfigResource)1 Repository (sonia.scm.repository.Repository)1