se.bjurr.violations.comments.gitlab.lib.ViolationCommentsToGitLabApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of violation-comments-to-gitlab-lib Show documentation
Show all versions of violation-comments-to-gitlab-lib Show documentation
Library that adds violation comments from static code analysis to GitLab.
package se.bjurr.violations.comments.gitlab.lib;
import static java.lang.Integer.MAX_VALUE;
import static se.bjurr.violations.comments.lib.CommentsCreator.createComments;
import java.util.List;
import org.gitlab.api.AuthMethod;
import org.gitlab.api.TokenType;
import se.bjurr.violations.comments.lib.model.CommentsProvider;
import se.bjurr.violations.lib.model.Violation;
public class ViolationCommentsToGitLabApi {
public static ViolationCommentsToGitLabApi violationCommentsToGitLabApi() {
return new ViolationCommentsToGitLabApi();
}
private List violations;
private boolean createCommentWithAllSingleFileComments = false;
private boolean commentOnlyChangedContent = false;
private String hostUrl;
private String apiToken;
private TokenType tokenType;
private AuthMethod method;
private boolean ignoreCertificateErrors;
private String projectId;
private Integer mergeRequestId;
private boolean shouldKeepOldComments;
private boolean shouldSetWIP;
public List getViolations() {
return violations;
}
public ViolationCommentsToGitLabApi setViolations(List violations) {
this.violations = violations;
return this;
}
public String getHostUrl() {
return hostUrl;
}
public ViolationCommentsToGitLabApi setHostUrl(String hostUrl) {
this.hostUrl = hostUrl;
return this;
}
public String getApiToken() {
return apiToken;
}
public ViolationCommentsToGitLabApi setApiToken(String apiToken) {
this.apiToken = apiToken;
return this;
}
public TokenType getTokenType() {
return tokenType;
}
public ViolationCommentsToGitLabApi setTokenType(TokenType tokenType) {
this.tokenType = tokenType;
return this;
}
public AuthMethod getMethod() {
return method;
}
public ViolationCommentsToGitLabApi setMethod(AuthMethod method) {
this.method = method;
return this;
}
public boolean isIgnoreCertificateErrors() {
return ignoreCertificateErrors;
}
public ViolationCommentsToGitLabApi setIgnoreCertificateErrors(boolean ignoreCertificateErrors) {
this.ignoreCertificateErrors = ignoreCertificateErrors;
return this;
}
public String getProjectId() {
return projectId;
}
public ViolationCommentsToGitLabApi setProjectId(String projectId) {
this.projectId = projectId;
return this;
}
public Integer getMergeRequestId() {
return mergeRequestId;
}
public ViolationCommentsToGitLabApi setMergeRequestId(Integer mergeRequestId) {
this.mergeRequestId = mergeRequestId;
return this;
}
public ViolationCommentsToGitLabApi setCreateCommentWithAllSingleFileComments(
boolean createCommentWithAllSingleFileComments) {
this.createCommentWithAllSingleFileComments = createCommentWithAllSingleFileComments;
return this;
}
public ViolationCommentsToGitLabApi setCommentOnlyChangedContent(
boolean commentOnlyChangedContent) {
this.commentOnlyChangedContent = commentOnlyChangedContent;
return this;
}
private ViolationCommentsToGitLabApi() {}
public boolean getCommentOnlyChangedContent() {
return commentOnlyChangedContent;
}
public boolean getCreateCommentWithAllSingleFileComments() {
return createCommentWithAllSingleFileComments;
}
public void toPullRequest() throws Exception {
final CommentsProvider commentsProvider = new GitLabCommentsProvider(this);
createComments(commentsProvider, violations, MAX_VALUE);
}
public ViolationCommentsToGitLabApi setShouldKeepOldComments(boolean shouldKeepOldComments) {
this.shouldKeepOldComments = shouldKeepOldComments;
return this;
}
public boolean getShouldKeepOldComments() {
return shouldKeepOldComments;
}
public ViolationCommentsToGitLabApi setShouldSetWIP(boolean shouldSetWIP) {
this.shouldSetWIP = shouldSetWIP;
return this;
}
public boolean getShouldSetWIP() {
return shouldSetWIP;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy