-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathEngagement.java
124 lines (94 loc) · 2.93 KB
/
Engagement.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
package io.securecodebox.persistence.defectdojo.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;
import java.util.List;
import java.util.Map;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
@JsonInclude(JsonInclude.Include.NON_NULL)
public final class Engagement implements Model {
@JsonProperty("branch_tag")
private String branch;
@JsonProperty
private Long id;
@JsonProperty
private String name;
@JsonProperty
private Long product;// FIXME: Use native type here.
@JsonProperty("target_start")
private String targetStart;
@JsonProperty("target_end")
private String targetEnd;
@JsonProperty
private Long lead;// FIXME: Use native type here.
@JsonProperty("engagement_type")
@Builder.Default
private String engagementType = "CI/CD";
@JsonProperty
@Builder.Default
private Status status = Status.IN_PROGRESS;
@JsonProperty
private List<String> tags;
@JsonProperty
private String tracker;
@JsonProperty("build_id")
private String buildID;
@JsonProperty("commit_hash")
private String commitHash;
@JsonProperty("source_code_management_uri")
private String repo;
@JsonProperty("build_server")
private Long buildServer; // FIXME: Use native type here.
@JsonProperty("source_code_management_server")
private Long scmServer; // FIXME: Use natvive type here.
@JsonProperty("orchestration_engine")
private Long orchestrationEngine; // FIXME: Use natvive type here.
@JsonProperty
private String description;
@JsonProperty("deduplication_on_engagement")
private boolean deduplicationOnEngagement;
@JsonProperty("threat_model")
@Builder.Default // FIXME: Use native type here.
private Boolean threatModel = false;
@JsonProperty("api_test")
@Builder.Default // FIXME: Use native type here.
private Boolean apiTest = false;
@JsonProperty("pen_test")
@Builder.Default // FIXME: Use native type here.
private Boolean penTest = false;
@JsonProperty("check_list")
@Builder.Default // FIXME: Use native type here.
private Boolean checkList = false;
@JsonProperty
private String version;
@Override
public boolean equalsQueryString(Map<String, Object> queryParams) {
if (queryParams == null) {
return false;
}
if (queryParams.containsKey("id") && queryParams.get("id") != null && queryParams.get("id").equals(this.id)) {
return true;
}
if (queryParams.containsKey("name") && queryParams.get("name") != null && queryParams.get("name").equals(this.name)) {
return true;
}
return false;
}
/**
* Currently only contains the statuses relevant to us.
* If you need others, feel free to add them ;)
*/
public enum Status {
@JsonProperty("Completed")
COMPLETED,
@JsonProperty("In Progress")
IN_PROGRESS
}
}