-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract REST schema/interface classes into rest package. Add pretty p…
…rinting config (by default off).
- Loading branch information
Showing
10 changed files
with
132 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/eu/clarin/sru/fcs/aggregator/rest/InitSchema.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package eu.clarin.sru.fcs.aggregator.rest; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import eu.clarin.sru.fcs.aggregator.scan.Resource; | ||
|
||
public class InitSchema { | ||
@JsonProperty(required = true) | ||
List<Resource> resources; | ||
|
||
@JsonProperty(required = true) | ||
List<String> languages; | ||
|
||
@JsonProperty(required = true) | ||
List<String> weblichtLanguages; | ||
|
||
@JsonProperty | ||
String query; | ||
|
||
@JsonProperty | ||
String mode; | ||
|
||
@JsonProperty("x-aggregation-context") | ||
Map<String, List<String>> contextString; | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/eu/clarin/sru/fcs/aggregator/rest/JsonMetaOnlySearch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package eu.clarin.sru.fcs.aggregator.rest; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import eu.clarin.sru.fcs.aggregator.search.MetaOnlyResult; | ||
|
||
public class JsonMetaOnlySearch { | ||
@JsonProperty(required = true) | ||
int inProgress = 0; | ||
|
||
@JsonProperty(required = true) | ||
List<MetaOnlyResult> results; | ||
|
||
public JsonMetaOnlySearch(List<MetaOnlyResult> results) { | ||
this.results = results; | ||
} | ||
|
||
public static JsonMetaOnlySearch fromJsonSearch(JsonSearch search) { | ||
final List<MetaOnlyResult> results = search.results.stream().map(r -> new MetaOnlyResult(r)) | ||
.collect(Collectors.toList()); | ||
final JsonMetaOnlySearch js = new JsonMetaOnlySearch(results); | ||
js.inProgress = search.inProgress; | ||
return js; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/eu/clarin/sru/fcs/aggregator/rest/JsonSearch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package eu.clarin.sru.fcs.aggregator.rest; | ||
|
||
import java.util.List; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import eu.clarin.sru.fcs.aggregator.search.Result; | ||
|
||
public class JsonSearch { | ||
@JsonProperty(required = true) | ||
int inProgress = 0; | ||
|
||
@JsonProperty(required = true) | ||
List<Result> results; | ||
|
||
public JsonSearch(List<Result> results) { | ||
this.results = results; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/eu/clarin/sru/fcs/aggregator/rest/LanguageMap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package eu.clarin.sru.fcs.aggregator.rest; | ||
|
||
import java.util.Map; | ||
|
||
public abstract class LanguageMap implements Map<String, String> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/eu/clarin/sru/fcs/aggregator/rest/ScanSearchStatisticsSchema.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package eu.clarin.sru.fcs.aggregator.rest; | ||
|
||
import java.util.Date; | ||
import java.util.Map; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import eu.clarin.sru.fcs.aggregator.scan.Statistics.EndpointStats; | ||
|
||
public class ScanSearchStatisticsSchema { | ||
public static class StatisticsSchema { | ||
@JsonProperty(required = true) | ||
int timeout; | ||
|
||
@JsonProperty(required = true) | ||
Boolean isScan; | ||
|
||
@JsonProperty(required = true) | ||
Map<String, Map<String, EndpointStats>> institutions; | ||
|
||
@JsonProperty(required = true) | ||
Date date; | ||
} | ||
|
||
@JsonProperty(value = "Last Scan", required = true) | ||
StatisticsSchema scans; | ||
|
||
@JsonProperty(value = "Recent Searches", required = true) | ||
StatisticsSchema searches; | ||
} |