Skip to content

Commit 7c312a6

Browse files
authored
Merge pull request #28 from imsweb/new-naaccr-endpoints
Added support for new NAACCR endpoints.
2 parents 0e01ea2 + 1b5f16f commit 7c312a6

File tree

11 files changed

+274
-124
lines changed

11 files changed

+274
-124
lines changed

build.gradle

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ plugins {
66
id 'signing'
77
id "io.codearte.nexus-staging" version "0.22.0"
88
id 'com.adarshr.test-logger' version '2.1.1'
9-
id "com.github.ben-manes.versions" version "0.34.0"
10-
id "org.owasp.dependencycheck" version "6.0.3"
9+
id "com.github.ben-manes.versions" version "0.36.0"
10+
id 'org.sonatype.gradle.plugins.scan' version '2.0.3'
1111
}
1212

1313
group = 'com.imsweb'
@@ -32,13 +32,16 @@ repositories {
3232
}
3333

3434
dependencies {
35-
spotbugs 'com.github.spotbugs:spotbugs:4.1.4'
35+
spotbugs 'com.github.spotbugs:spotbugs:4.2.1'
3636

3737
api 'com.squareup.retrofit2:retrofit:2.9.0'
3838
api 'com.squareup.retrofit2:converter-jackson:2.9.0'
3939

40-
testImplementation 'junit:junit:4.13.1'
41-
testImplementation 'org.assertj:assertj-core:3.18.0'
40+
// newer version of dependency to fix vulnerability until converter-jackson is updated
41+
api 'com.fasterxml.jackson.core:jackson-databind:2.10.5.1'
42+
43+
testImplementation 'junit:junit:4.13.2'
44+
testImplementation 'org.assertj:assertj-core:3.19.0'
4245
}
4346

4447
jar {
@@ -67,14 +70,24 @@ spotbugs {
6770
excludeFilter = file('config/spotbugs/spotbugs-exclude.xml')
6871
}
6972

70-
// OWASP check (https://jeremylong.github.io/DependencyCheck/index.html)
71-
dependencyCheck {
72-
failOnError = true
73-
format = 'ALL'
73+
// Nexus vulnerability scan (see https://github.com/sonatype-nexus-community/scan-gradle-plugin)
74+
ossIndexAudit {
75+
dependencyGraph = true
76+
printBanner = false
77+
78+
// only set proxy if running outside of Github Actions
79+
if (!System.getenv().GITHUB_ACTIONS) {
80+
proxyConfiguration {
81+
protocol = 'http'
82+
host = 'webproxy-btp.imsweb.com'
83+
port = 8080
84+
}
85+
}
7486
}
87+
check.dependsOn 'ossIndexAudit'
7588

7689
wrapper {
77-
gradleVersion = '6.7'
90+
gradleVersion = '6.8.2'
7891
distributionType = Wrapper.DistributionType.ALL
7992
}
8093

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/java/com/imsweb/seerapi/client/naaccr/NaaccrFieldName.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,22 @@
77

88
public class NaaccrFieldName {
99

10+
@JsonProperty("id")
11+
protected String _id;
1012
@JsonProperty("item")
1113
protected Integer _item;
1214
@JsonProperty("name")
1315
protected String _name;
1416

15-
public Integer getItem() {
16-
return _item;
17+
public String getNaaccrId() {
18+
return _id;
1719
}
1820

19-
public void setItem(Integer item) {
20-
_item = item;
21+
public Integer getItemNum() {
22+
return _item;
2123
}
2224

2325
public String getName() {
2426
return _name;
2527
}
26-
27-
public void setName(String name) {
28-
_name = name;
29-
}
3028
}

src/main/java/com/imsweb/seerapi/client/naaccr/NaaccrField.java renamed to src/main/java/com/imsweb/seerapi/client/naaccr/NaaccrFlatField.java

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
1010

1111
@JsonPropertyOrder({"item", "name", "section", "start_col", "end_col", "alignment", "padding_char", "default_value", "documentation", "subfield"})
12-
public class NaaccrField {
12+
public class NaaccrFlatField {
1313

14+
@JsonProperty("id")
15+
protected String _id;
1416
@JsonProperty("item")
1517
protected Integer _item;
1618
@JsonProperty("name")
@@ -32,83 +34,47 @@ public class NaaccrField {
3234
@JsonProperty("subfield")
3335
protected List<NaaccrSubField> _subFields;
3436

35-
public Integer getItem() {
36-
return _item;
37+
public String getNaaccrId() {
38+
return _id;
3739
}
3840

39-
public void setItem(Integer item) {
40-
_item = item;
41+
public Integer getItemNum() {
42+
return _item;
4143
}
4244

4345
public String getName() {
4446
return _name;
4547
}
4648

47-
public void setName(String name) {
48-
_name = name;
49-
}
50-
5149
public String getSection() {
5250
return _section;
5351
}
5452

55-
public void setSection(String section) {
56-
_section = section;
57-
}
58-
5953
public Integer getStart() {
6054
return _start;
6155
}
6256

63-
public void setStart(Integer start) {
64-
_start = start;
65-
}
66-
6757
public Integer getEnd() {
6858
return _end;
6959
}
7060

71-
public void setEnd(Integer end) {
72-
_end = end;
73-
}
74-
7561
public String getAlign() {
7662
return _align;
7763
}
7864

79-
public void setAlign(String align) {
80-
_align = align;
81-
}
82-
8365
public String getPadChar() {
8466
return _padChar;
8567
}
8668

87-
public void setPadChar(String padChar) {
88-
_padChar = padChar;
89-
}
90-
9169
public String getDefaultValue() {
9270
return _defaultValue;
9371
}
9472

95-
public void setDefaultValue(String defaultValue) {
96-
_defaultValue = defaultValue;
97-
}
98-
9973
public String getDocumentation() {
10074
return _documentation;
10175
}
10276

103-
public void setDocumentation(String documentation) {
104-
_documentation = documentation;
105-
}
106-
10777
public List<NaaccrSubField> getSubFields() {
10878
return _subFields;
10979
}
110-
111-
public void setSubFields(List<NaaccrSubField> subFields) {
112-
_subFields = subFields;
113-
}
11480
}

src/main/java/com/imsweb/seerapi/client/naaccr/NaaccrService.java

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,60 @@
1212
public interface NaaccrService {
1313

1414
/**
15-
* Return a collection of NaaccrVersion objects which descibe the available versions
15+
* Return a collection of NaaccrVersion objects which descibe the available flat file versions
1616
* @return a list of the available NAACCR versions and information about each of them
1717
*/
18-
@GET("naaccr/versions")
19-
Call<List<NaaccrVersion>> versions();
18+
@GET("naaccr/flat/versions")
19+
Call<List<NaaccrVersion>> flatVersions();
2020

2121
/**
22-
* Return a list of all the field identifiers and names from a specified NAACCR version
22+
* Return a collection of NaaccrVersion objects which descibe the available XML versions
23+
* @return a list of the available NAACCR versions and information about each of them
24+
*/
25+
@GET("naaccr/xml/versions")
26+
Call<List<NaaccrVersion>> xmlVersions();
27+
28+
/**
29+
* Return a list of all the field identifiers and names from a specified NAACCR flat file version
30+
* @param version NAACCR version
31+
* @return a list of NaaccrFieldName objects
32+
*/
33+
@GET("naaccr/flat/{version}")
34+
Call<List<NaaccrFieldName>> flatFieldNames(@Path("version") String version);
35+
36+
/**
37+
* Return a list of all the field identifiers and names from a specified NAACCR XML version
38+
* @param version NAACCR version
39+
* @return a list of NaaccrFieldName objects
40+
*/
41+
@GET("naaccr/xml/{version}")
42+
Call<List<NaaccrFieldName>> xmlFieldNames(@Path("version") String version);
43+
44+
/**
45+
* Return a list of all the field identifiers and names from a specified NAACCR flat file version
46+
* @param version NAACCR version
47+
* @param item NAACCR item number
48+
* @return a list of NaaccrFieldName objects
49+
*/
50+
@GET("naaccr/flat/{version}/item/{item}")
51+
Call<NaaccrFlatField> flatField(@Path("version") String version, @Path("item") Integer item);
52+
53+
/**
54+
* Return a list of all the field identifiers and names from a specified NAACCR XML version
2355
* @param version NAACCR version
56+
* @param id NAACCR XML id
2457
* @return a list of NaaccrFieldName objects
2558
*/
26-
@GET("naaccr/{version}")
27-
Call<List<NaaccrFieldName>> fieldNames(@Path("version") String version);
59+
@GET("naaccr/xml/{version}/id/{id}")
60+
Call<NaaccrXmlField> xmlField(@Path("version") String version, @Path("id") String id);
2861

2962
/**
30-
* Return a list of all the field identifiers and names from a specified NAACCR version
63+
* Return a list of all the field identifiers and names from a specified NAACCR XML version
3164
* @param version NAACCR version
3265
* @param item NAACCR item number
3366
* @return a list of NaaccrFieldName objects
3467
*/
35-
@GET("naaccr/{version}/item/{item}")
36-
Call<NaaccrField> field(@Path("version") String version, @Path("item") Integer item);
68+
@GET("naaccr/xml/{version}/item/{item}")
69+
Call<NaaccrXmlField> xmlField(@Path("version") String version, @Path("item") Integer item);
3770

3871
}

src/main/java/com/imsweb/seerapi/client/naaccr/NaaccrSubField.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,47 +24,23 @@ public Integer getItem() {
2424
return _item;
2525
}
2626

27-
public void setItem(Integer item) {
28-
_item = item;
29-
}
30-
3127
public String getName() {
3228
return _name;
3329
}
3430

35-
public void setName(String name) {
36-
_name = name;
37-
}
38-
3931
public Integer getStart() {
4032
return _start;
4133
}
4234

43-
public void setStart(Integer start) {
44-
_start = start;
45-
}
46-
4735
public Integer getEnd() {
4836
return _end;
4937
}
5038

51-
public void setEnd(Integer end) {
52-
_end = end;
53-
}
54-
5539
public String getAlign() {
5640
return _align;
5741
}
5842

59-
public void setAlign(String align) {
60-
_align = align;
61-
}
62-
6343
public String getPadChar() {
6444
return _padChar;
6545
}
66-
67-
public void setPadChar(String padChar) {
68-
_padChar = padChar;
69-
}
7046
}

src/main/java/com/imsweb/seerapi/client/naaccr/NaaccrVersion.java

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,41 @@ public class NaaccrVersion {
1414
protected String _description;
1515
@JsonProperty("style")
1616
protected String _style;
17+
@JsonProperty("dictionary_uri")
18+
protected String dictionaryUri;
19+
@JsonProperty("dictionary_description")
20+
protected String dictionaryDescription;
21+
@JsonProperty("specification_version")
22+
protected String specificationVersion;
1723

1824
public String getVersion() {
1925
return _version;
2026
}
2127

22-
public void setVersion(String version) {
23-
_version = version;
24-
}
25-
2628
public String getName() {
2729
return _name;
2830
}
2931

30-
public void setName(String name) {
31-
_name = name;
32-
}
33-
3432
public Integer getLength() {
3533
return _length;
3634
}
3735

38-
public void setLength(Integer length) {
39-
_length = length;
40-
}
41-
4236
public String getDescription() {
4337
return _description;
4438
}
4539

46-
public void setDescription(String description) {
47-
_description = description;
48-
}
49-
5040
public String getStyle() {
5141
return _style;
5242
}
5343

54-
public void setStyle(String style) {
55-
_style = style;
44+
public String getDictionaryUri() {
45+
return dictionaryUri;
46+
}
47+
48+
public String getDictionaryDescription() {
49+
return dictionaryDescription;
50+
}
51+
public String getSpecificationVersion() {
52+
return specificationVersion;
5653
}
5754
}

0 commit comments

Comments
 (0)