All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.teamscale.commons.links.TeamscaleLinkProvider Maven / Gradle / Ivy

There is a newer version: 2025.1.0-rc2
Show newest version
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