org.conqat.engine.service.shared.data.FindingsServiceOptions Maven / Gradle / Ivy
package org.conqat.engine.service.shared.data;
import org.conqat.engine.index.shared.CommitDescriptor;
import org.conqat.engine.service.shared.client.ServiceClientUris;
import org.conqat.lib.commons.collections.ListMap;
/**
* Collects options for Teamscale's findings service into one place making it
* easy for writing tests.
*/
public class FindingsServiceOptions {
/**
* Optional commit descriptor (timestamp & branch info) at which findings should
* be retrieved.
*/
private final CommitDescriptor commitDescriptor;
/** Optional baseline at which findings should be retrieved */
private final String baseline;
/** Whether or not findings should be fetched for uniform paths recursively */
private final boolean recursive;
/** Optionally include (or not) findings in changed code */
private final boolean includeChangedCodeFindings;
/** Optionally have Teamscale fetch all findings or not */
private final boolean fetchAll;
public FindingsServiceOptions(boolean recursive, CommitDescriptor commitDescriptor, String baseline,
boolean includeChangedCodeFindings, boolean fetchAll) {
this.recursive = recursive;
this.commitDescriptor = commitDescriptor;
this.baseline = baseline;
this.includeChangedCodeFindings = includeChangedCodeFindings;
this.fetchAll = fetchAll;
}
/**
* Builds a list-map of options to be used for the
* ServiceClient.getFindings()
service call.
*/
public ListMap buildOptionsForServiceCall() {
ListMap options = ListMap.of(ServiceClientUris.RECURSIVE_PARAMETER, String.valueOf(recursive));
if (commitDescriptor != null) {
options.add(ServiceClientUris.TIMESTAMP_PARAMETER_NAME, commitDescriptor.toServiceCallFormat());
}
if (baseline != null) {
options.add(ServiceClientUris.BASELINE_PARAMETER, baseline);
options.add(ServiceClientUris.INCLUDE_CHANGED_CODE_FINDINGS_PARAMETER,
String.valueOf(includeChangedCodeFindings));
}
if (fetchAll) {
options.add("all", "true");
}
return options;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy