Skip to content

Commit 48d2bb3

Browse files
authored
Merge pull request #16 from wurstbrot/feat/newModels
feat: add ProductGroup
2 parents 711b22b + 354eb0f commit 48d2bb3

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package io.securecodebox.persistence.defectdojo.models;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
import lombok.*;
6+
7+
import java.util.Map;
8+
9+
@Data
10+
@Builder
11+
@NoArgsConstructor
12+
@AllArgsConstructor
13+
@EqualsAndHashCode(callSuper = true)
14+
@JsonInclude(JsonInclude.Include.NON_NULL)
15+
public class ProductGroup extends DefectDojoModel {
16+
@JsonProperty
17+
Long id;
18+
19+
@JsonProperty
20+
Long product;
21+
22+
@JsonProperty
23+
Long group;
24+
25+
@JsonProperty
26+
Long role;
27+
28+
@Override
29+
public boolean equalsQueryString(Map<String, Object> queryParams) {
30+
if (queryParams.containsKey("id") && queryParams.get("id").equals(this.id)) {
31+
return true;
32+
}
33+
return false;
34+
}
35+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* secureCodeBox (SCB)
3+
* Copyright 2021 iteratec GmbH
4+
* https://www.iteratec.com
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
package io.securecodebox.persistence.defectdojo.service;
19+
20+
import com.fasterxml.jackson.core.JsonProcessingException;
21+
import com.fasterxml.jackson.core.type.TypeReference;
22+
import io.securecodebox.persistence.defectdojo.config.DefectDojoConfig;
23+
import io.securecodebox.persistence.defectdojo.models.DefectDojoResponse;
24+
import io.securecodebox.persistence.defectdojo.models.DojoGroupMember;
25+
import io.securecodebox.persistence.defectdojo.models.ProductGroup;
26+
27+
public class ProductGroupService extends GenericDefectDojoService<ProductGroup> {
28+
public ProductGroupService(DefectDojoConfig config) {
29+
super(config);
30+
}
31+
32+
@Override
33+
protected String getUrlPath() {
34+
return "product_groups";
35+
}
36+
37+
@Override
38+
protected Class<ProductGroup> getModelClass() {
39+
return ProductGroup.class;
40+
}
41+
42+
@Override
43+
protected DefectDojoResponse<ProductGroup> deserializeList(String response) throws JsonProcessingException {
44+
return this.objectMapper.readValue(response, new TypeReference<>() {
45+
});
46+
}
47+
}

0 commit comments

Comments
 (0)