com.teamscale.commons.links.TeamscaleCommitLinkProvider 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.engine.index.shared.CommitDescriptor;
import org.conqat.engine.service.shared.ServiceUtils;
import org.conqat.engine.service.shared.client.ServiceClientUris;
/**
* Helper class for obtaining links to global and project specific services of
* the current Teamscale instance. If a non-null {@link CommitDescriptor} is
* passed, all project services supporting the
* {@link ServiceClientUris#TIMESTAMP_PARAMETER_NAME} use this commit for
* queries.
*/
public class TeamscaleCommitLinkProvider extends TeamscaleProjectLinkProvider {
private final CommitDescriptor commit;
public TeamscaleCommitLinkProvider(String baseUrl, String projectAliasOrId, CommitDescriptor commit) {
super(baseUrl, projectAliasOrId);
this.commit = commit;
}
/** Returns a link to the findings detail view for the given finding. */
public String createFindingsDetailLink(String findingId) {
return baseUrl + "findings.html#details/" + ServiceUtils.encodePathSegment(projectAliasOrId)
+ createOptionString(findingId);
}
private String createOptionString(String findingId) {
if (commit == null) {
return ServiceClientUris.createOptionString("id", findingId);
}
return ServiceClientUris.createOptionString("id", findingId, ServiceClientUris.TIMESTAMP_PARAMETER_NAME,
commit.toServiceCallFormat());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy