Skip to content

Commit

Permalink
MAT-6576: Use Spotify formatter. Run formatter.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotanchik-SB committed May 21, 2024
1 parent ef7d1fc commit 6649152
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 31 deletions.
23 changes: 7 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
<mvnsite.version>3.11.0</mvnsite.version>
<okta.springboot.starter.version>3.0.6</okta.springboot.starter.version>
<puppycrawl.checkstyle.version>10.1</puppycrawl.checkstyle.version>
<theoryinpractise.googleformatter.version>1.7.5</theoryinpractise.googleformatter.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -210,26 +209,18 @@
</executions>
</plugin>
<plugin>
<groupId>com.theoryinpractise</groupId>
<artifactId>googleformatter-maven-plugin</artifactId>
<version>${theoryinpractise.googleformatter.version}</version>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.23</version>
<configuration>
<skipSortingImports>true</skipSortingImports>
<style>google</style>
</configuration>
<executions>
<execution>
<id>reformat-sources</id>
<goals>
<goal>format</goal>
</goals>
<phase>process-sources</phase>
<configuration>
<includeStale>false</includeStale>
<style>GOOGLE</style>
<formatMain>true</formatMain>
<formatTest>true</formatTest>
<filterModified>false</filterModified>
<skip>false</skip>
<fixImports>false</fixImports>
<maxLineLength>100</maxLineLength>
</configuration>
</execution>
</executions>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ public List<ValueSetForSearch> searchValueSets(String apiKey, Map<String, String
.forEach(
entry -> {
Resource resource = entry.getResource();
ValueSet vs = (ValueSet) resource;
if (resource instanceof ValueSet) {
ValueSet vs = (ValueSet) resource;
if (resource instanceof ValueSet) {
String oid = "";
for (Identifier identifier : ((ValueSet) resource).getIdentifier()) {
if (identifier.getValue() != null && !identifier.getValue().isEmpty()) {
Expand All @@ -139,17 +139,32 @@ public List<ValueSetForSearch> searchValueSets(String apiKey, Map<String, String
ValueSetForSearch valueSet =
ValueSetForSearch.builder()
.title(vs.getTitle())
.author(String.valueOf(vs.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/valueset-author").getValue()))
.author(
String.valueOf(
vs.getExtensionByUrl(
"http://hl7.org/fhir/StructureDefinition/valueset-author")
.getValue()))
.name(vs.getName())
.composedOf(vs.getCompose().getInclude().stream().map(x -> x.getSystem()).collect(Collectors.joining(",")))
.effectiveDate(String.valueOf(vs.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/valueset-effectiveDate").getValue()))
.lastReviewDate(String.valueOf(vs.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/resource-lastReviewDate").getValue()))
.lastUpdated(vs.getMeta().getLastUpdated().toString())
.composedOf(
vs.getCompose().getInclude().stream()
.map(x -> x.getSystem())
.collect(Collectors.joining(",")))
.effectiveDate(
String.valueOf(
vs.getExtensionByUrl(
"http://hl7.org/fhir/StructureDefinition/valueset-effectiveDate")
.getValue()))
.lastReviewDate(
String.valueOf(
vs.getExtensionByUrl(
"http://hl7.org/fhir/StructureDefinition/resource-lastReviewDate")
.getValue()))
.lastUpdated(vs.getMeta().getLastUpdated().toString())
.url(vs.getUrl())
.version(vs.getVersion())
.status(vs.getStatus())
.publisher(vs.getPublisher())
.purpose(vs.getPurpose())
.publisher(vs.getPublisher())
.purpose(vs.getPurpose())
.steward(vs.getPublisher())
.oid(oid)
.build();
Expand Down Expand Up @@ -287,6 +302,7 @@ private void recursiveRetrieveCodeSystems(
}
});
}

// one to call only, one to mutate and build
private Bundle retrieveCodeSystemsPage(UmlsUser umlsUser, Integer offset, Integer count) {
IParser parser = fhirContext.newJsonParser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,26 @@ void testGetCodesList() {
@Test
void testSearchValueSets() {
List<ValueSetForSearch> mockValueSets = new ArrayList<>();
ValueSetForSearch v1 = ValueSetForSearch.builder().title("title 1").name("title1").url("url").oid("oid")
.steward("steward").version("version").codeSystem("cs").build();
ValueSetForSearch v2 = ValueSetForSearch.builder().title("title 2").name("title2").url("url").oid("oid")
.steward("steward").version("version").codeSystem("cs").build();
ValueSetForSearch v1 =
ValueSetForSearch.builder()
.title("title 1")
.name("title1")
.url("url")
.oid("oid")
.steward("steward")
.version("version")
.codeSystem("cs")
.build();
ValueSetForSearch v2 =
ValueSetForSearch.builder()
.title("title 2")
.name("title2")
.url("url")
.oid("oid")
.steward("steward")
.version("version")
.codeSystem("cs")
.build();
mockValueSets.add(v1);
mockValueSets.add(v2);
Principal principal = mock(Principal.class);
Expand All @@ -272,7 +288,7 @@ void testSearchValueSets() {
queryParams.put("param1", "value1");
queryParams.put("param2", "value2");
ResponseEntity<List<ValueSetForSearch>> response =
vsacFhirTerminologyController.searchValueSets(principal, queryParams);
vsacFhirTerminologyController.searchValueSets(principal, queryParams);
assertEquals(response.getStatusCode(), HttpStatus.OK);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.util.Objects;

Expand Down

0 comments on commit 6649152

Please sign in to comment.