-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from ts4nfdi/refacotor/generlize-federation-ca…
…lls-service Refacotor: generlize federation calls service
- Loading branch information
Showing
28 changed files
with
550 additions
and
484 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Tests Ci | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: Build with Maven | ||
run: mvn clean install | ||
|
||
- name: Run tests | ||
run: mvn test |
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 |
---|---|---|
|
@@ -42,4 +42,8 @@ build/ | |
# System files | ||
.DS_Store | ||
|
||
node_modules/ | ||
|
||
src/frontend/.next/ | ||
|
||
/src/frontend/ |
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
89 changes: 0 additions & 89 deletions
89
src/main/java/org/semantics/apigateway/config/Mapping.java
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
src/main/java/org/semantics/apigateway/config/MappingConfig.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
62 changes: 62 additions & 0 deletions
62
src/main/java/org/semantics/apigateway/controller/SearchController.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,62 @@ | ||
package org.semantics.apigateway.controller; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import org.apache.http.HttpStatus; | ||
import org.apache.lucene.queryparser.classic.ParseException; | ||
import org.semantics.apigateway.model.Database; | ||
import org.semantics.apigateway.model.ResponseFormat; | ||
import org.semantics.apigateway.model.TargetDbSchema; | ||
import org.semantics.apigateway.service.search.SearchService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.io.IOException; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
|
||
@RestController | ||
@RequestMapping("/") | ||
public class SearchController { | ||
private final SearchService searchService; | ||
|
||
@Autowired | ||
public SearchController(SearchService searchService) { | ||
this.searchService = searchService; | ||
} | ||
|
||
|
||
@Operation(summary = "Search all of the content in a catalogue.", description = "The returned data should include a description of the type of data that is being returned. For example the returned content could be SKOS Concepts or OWL Classes.", tags = {"Search"}) | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = ""), | ||
|
||
@ApiResponse(responseCode = "404", description = "")}) | ||
@CrossOrigin | ||
@GetMapping("/search") | ||
public CompletableFuture<ResponseEntity<?>> performDynFederatedSearch( | ||
@Parameter(description = "The text to search", example = "plant") | ||
@RequestParam String query, | ||
@Parameter(description = "Source to run search against") | ||
@RequestParam(required = false) Database database, | ||
@RequestParam(required = false) ResponseFormat format, | ||
@Parameter(description = "Transform the response result to a specific schema") | ||
@RequestParam(required = false) TargetDbSchema targetDbSchema) { | ||
|
||
|
||
return searchService.performSearch(query, database, format, targetDbSchema) | ||
.<ResponseEntity<?>>thenApply(ResponseEntity::ok) | ||
.exceptionally(e -> { | ||
if (e.getCause() instanceof IllegalArgumentException) { | ||
return ResponseEntity | ||
.status(HttpStatus.SC_BAD_REQUEST) | ||
.body("Error: " + e.getCause().getMessage()); | ||
} | ||
return ResponseEntity | ||
.status(HttpStatus.SC_INTERNAL_SERVER_ERROR) | ||
.body("Error: An internal server error occurred"); | ||
}); | ||
} | ||
} |
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,7 @@ | ||
package org.semantics.apigateway.model; | ||
|
||
public enum Database { | ||
ontoportal, | ||
ols, | ||
skosmos; | ||
} |
Oops, something went wrong.