Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDGFQM-5 Add new query contents endpoints #6

Merged
merged 2 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@
src/main/java/org/folio/fqm/edge/client/config/OkapiFeignClientErrorWrapperException.java

<!-- Boilerplate code with no logic -->
src/main/java/org/folio/fqm/edge/client/QueryClient.java
src/main/java/org/folio/fqm/edge/client/EntityTypesClient.java
src/main/java/org/folio/fqm/edge/controller/EdgeFqmTenantController.java
src/main/java/org/folio/fqm/edge/controller/EntityTypesController.java
src/main/java/org/folio/fqm/edge/controller/QueryController.java
src/main/java/org/folio/fqm/edge/service/EntityTypesService.java
src/main/java/org/folio/fqm/edge/service/QueryService.java

</sonar.exclusions>
<argLine/>

Expand Down
16 changes: 10 additions & 6 deletions src/main/java/org/folio/fqm/edge/client/QueryClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@

import jakarta.validation.constraints.NotNull;
import org.folio.fqm.edge.client.config.OkapiFeignClientConfig;
import org.folio.querytool.domain.dto.ContentsRequest;
import org.folio.querytool.domain.dto.QueryDetails;
import org.folio.querytool.domain.dto.QueryIdentifier;
import org.folio.querytool.domain.dto.ResultsetPage;
import org.folio.querytool.domain.dto.SubmitQuery;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;
import java.util.UUID;

@FeignClient(name = "query", configuration = OkapiFeignClientConfig.class)
Expand All @@ -39,4 +36,11 @@ QueryDetails getQuery(@PathVariable UUID queryId,
@PostMapping
QueryIdentifier runFqlQueryAsync(@RequestBody SubmitQuery submitQuery);

@PostMapping(path = "/contents")
List<Map<String, Object>> getContents(ContentsRequest contentsRequest);

@GetMapping(path = "/{queryId}/sortedIds")
List<UUID> getSortedIds(@PathVariable UUID queryId,
@RequestParam Integer offset,
@RequestParam Integer limit);
}
12 changes: 12 additions & 0 deletions src/main/java/org/folio/fqm/edge/controller/QueryController.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.folio.fqm.edge.service.QueryService;
import org.folio.querytool.domain.dto.ContentsRequest;
import org.folio.querytool.domain.dto.QueryDetails;
import org.folio.querytool.domain.dto.QueryIdentifier;
import org.folio.querytool.domain.dto.ResultsetPage;
Expand All @@ -15,6 +16,7 @@
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;
import java.util.UUID;

@RequiredArgsConstructor
Expand Down Expand Up @@ -43,4 +45,14 @@ public ResponseEntity<QueryDetails> getQuery(UUID queryId, @Valid Boolean includ
public ResponseEntity<QueryIdentifier> runFqlQueryAsync(@Valid SubmitQuery submitQuery) {
return ResponseEntity.ok(queryService.runFqlQueryAsync(submitQuery));
}

@Override
public ResponseEntity<List<Map<String, Object>>> getContents(ContentsRequest contentsRequest) {
return ResponseEntity.ok(queryService.getContents(contentsRequest));
}

@Override
public ResponseEntity<List<UUID>> getSortedIds(UUID queryId, Integer offset, Integer limit) {
return ResponseEntity.ok(queryService.getSortedIds(queryId, offset, limit));
}
}
10 changes: 10 additions & 0 deletions src/main/java/org/folio/fqm/edge/service/QueryService.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.folio.fqm.edge.client.QueryClient;
import org.folio.querytool.domain.dto.ContentsRequest;
import org.folio.querytool.domain.dto.QueryDetails;
import org.folio.querytool.domain.dto.QueryIdentifier;
import org.folio.querytool.domain.dto.ResultsetPage;
import org.folio.querytool.domain.dto.SubmitQuery;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.UUID;

@RequiredArgsConstructor
Expand All @@ -33,4 +35,12 @@ public QueryDetails getQuery(UUID queryId, Boolean includeResults, Integer offse
public QueryIdentifier runFqlQueryAsync(SubmitQuery submitQuery) {
return queryClient.runFqlQueryAsync(submitQuery);
}

public List<Map<String, Object>> getContents(ContentsRequest contentsRequest) {
return queryClient.getContents(contentsRequest);
}

public List<UUID> getSortedIds(UUID queryId, Integer offset, Integer limit) {
return queryClient.getSortedIds(queryId, offset, limit);
}
}