com.teamscale.commons.links.TeamscaleLinkProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of teamscale-commons Show documentation
Show all versions of teamscale-commons Show documentation
Provides common DTOs for Teamscale
package com.teamscale.commons.links;
import org.conqat.lib.commons.string.StringUtils;
/**
* Helper class for obtaining links to global services of the current Teamscale
* instance.
*/
public class TeamscaleLinkProvider {
/** The base URL of the Teamscale instance. */
protected final String baseUrl;
public TeamscaleLinkProvider(String baseUrl) {
if (StringUtils.isEmpty(baseUrl)) {
baseUrl = "https://no-teamscale-base-url-configured-in-teamscale-server-options.com";
}
this.baseUrl = StringUtils.ensureEndsWith(baseUrl, "/");
}
/** Returns the URL for the static findings badge. */
public String createStaticFindingsBadgeUrl(int addedFindings, int inChangedCodeFindings, int removedFindings) {
String badgeServiceUrl = "api/badges/findings/static";
return baseUrl + badgeServiceUrl + "?added=" + addedFindings + "&changed=" + inChangedCodeFindings + "&removed="
+ removedFindings;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy