-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathImportScanService.java
67 lines (55 loc) · 2.4 KB
/
ImportScanService.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
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
package io.securecodebox.persistence.defectdojo.service;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.securecodebox.persistence.defectdojo.ScanType;
import io.securecodebox.persistence.defectdojo.config.Config;
import io.securecodebox.persistence.defectdojo.http.ProxyConfig;
import io.securecodebox.persistence.defectdojo.http.ProxyConfigFactory;
import io.securecodebox.persistence.defectdojo.model.ScanFile;
import lombok.Data;
import lombok.NonNull;
import java.util.HashMap;
import java.util.Map;
/**
* Service to re/import findings into DefectDojo
*/
public interface ImportScanService {
/**
* Factory method to create new instance of service default implementation
*
* @param config must not be {@code null}
* @return never {@code null}
*/
static ImportScanService createDefault(final Config config) {
return createDefault(config, new ProxyConfigFactory().create());
}
/**
* Factory method to create new instance of service default implementation
*
* @param config must not be {@code null}
* @param proxyConfig must not be {@code null}
* @return never {@code null}
*/
static ImportScanService createDefault(@NonNull final Config config, @NonNull final ProxyConfig proxyConfig) {
return new DefaultImportScanService(config, proxyConfig);
}
default ImportScanResponse importScan(ScanFile scanFile, long engagementId, long lead, String currentDate, ScanType scanType, long testType) {
return this.importScan(scanFile, engagementId, lead, currentDate, scanType, testType, new HashMap<>());
}
ImportScanResponse importScan(ScanFile scanFile, long engagementId, long lead, String currentDate, ScanType scanType, long testType, Map<String, String> options);
default ImportScanResponse reimportScan(ScanFile scanFile, long testId, long lead, String currentDate, ScanType scanType, long testType) {
return this.reimportScan(scanFile, testId, lead, currentDate, scanType, testType, new HashMap<>());
}
ImportScanResponse reimportScan(ScanFile scanFile, long testId, long lead, String currentDate, ScanType scanType, long testType, Map<String, String> options);
@Data
class ImportScanResponse {
@JsonProperty
protected Boolean verified;
@JsonProperty
protected Boolean active;
@JsonProperty("test")
protected long testId;
}
}