forked from secureCodeBox/defectdojo-client-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEngagement.java
More file actions
140 lines (108 loc) · 3.47 KB
/
Engagement.java
File metadata and controls
140 lines (108 loc) · 3.47 KB
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
// 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.ArrayList;
import java.util.List;
import java.util.Map;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
@JsonInclude(JsonInclude.Include.NON_NULL)
public final class Engagement implements Model, HasId, HasName {
/**
* Uniq id of model type
* <p>
* May be {@code null} for newly created objects because in DefectDojo's Open API specification i.
* It is mandatory to use a boxed object type instead of a native type. A native type would result in 0 by
* default which is a valid id for DefectDojo. Thus creating this type via POST request would try to create
* one with id 0. Instead the id must be {@code null}, so that DefectDojo uses a newly generated uniq id.
* </p>
*/
@JsonProperty
private Long id;
@JsonProperty
private String name;
@JsonProperty("branch_tag")
@Builder.Default
private String branch = "";
@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
@Builder.Default
private List<String> tags = new ArrayList<>();
@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
@Builder.Default
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
@Builder.Default
private String version = "";
@Override
public boolean equalsQueryString(Map<String, Object> queryParams) {
if (QueryParamsComparator.isNull(queryParams)) {
return false;
}
if (QueryParamsComparator.isIdEqual(this, queryParams)) {
return true;
}
if (QueryParamsComparator.isNameEqual(this, queryParams)) {
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
}
}