Skip to content

Commit 350f5cf

Browse files
committed
Add custom states support
1 parent 2605a11 commit 350f5cf

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/main/java/com/checkmarx/ast/wrapper/CxConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public final class CxConstants {
4545
static final String STATE = "--state";
4646
static final String COMMENT = "--comment";
4747
static final String SEVERITY = "--severity";
48+
static final String CUSTOM_STATE_ID = "--custom-state-id";
4849
static final String REPORT_FORMAT = "--report-format";
4950
static final String OUTPUT_NAME = "--output-name";
5051
static final String OUTPUT_PATH = "--output-path";

src/main/java/com/checkmarx/ast/wrapper/CxWrapper.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,15 @@ public List<Predicate> triageGetStates() throws IOException, InterruptedExceptio
177177
}
178178

179179
public void triageUpdate(@NonNull UUID projectId, String similarityId, String scanType, String state, String comment, String severity) throws IOException, InterruptedException, CxException {
180+
triageUpdate(projectId, similarityId, scanType, state, comment, severity, null);
181+
}
182+
183+
public void triageUpdate(@NonNull UUID projectId, String similarityId, String scanType, String state, String comment, String severity, String customStateId) throws IOException, InterruptedException, CxException {
180184
this.logger.info("Executing 'triage update' command using the CLI.");
181-
this.logger.info("Updating the similarityId {} with state {} and severity {}.", similarityId, state, severity);
185+
this.logger.info("Updating the similarityId {} with state {} with customStateId {} and severity {}.", similarityId, state, customStateId, severity);
186+
187+
boolean emptyState = state == null || state.isEmpty();
188+
boolean emptyCustomStateId = customStateId == null || customStateId.isEmpty();
182189

183190
List<String> arguments = new ArrayList<>();
184191
arguments.add(CxConstants.CMD_TRIAGE);
@@ -189,8 +196,14 @@ public void triageUpdate(@NonNull UUID projectId, String similarityId, String sc
189196
arguments.add(similarityId);
190197
arguments.add(CxConstants.SCAN_TYPE);
191198
arguments.add(scanType);
192-
arguments.add(CxConstants.STATE);
193-
arguments.add(state);
199+
if (!emptyState) {
200+
arguments.add(CxConstants.STATE);
201+
arguments.add(state);
202+
}
203+
if (!emptyCustomStateId) {
204+
arguments.add(CxConstants.CUSTOM_STATE_ID);
205+
arguments.add(customStateId);
206+
}
194207
if (!StringUtils.isBlank(comment)) {
195208
arguments.add(CxConstants.COMMENT);
196209
arguments.add(comment);

0 commit comments

Comments
 (0)