-
Notifications
You must be signed in to change notification settings - Fork 7
CME-239 - Add GET reindexing tasks #1585
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
base: CME-238-patch
Are you sure you want to change the base?
Changes from all commits
764e68a
8eae7a8
6c0017e
db33162
c186109
9e4eaa1
434db9c
0cb50c5
46b8b3f
8cecdf1
6d27919
1b1835e
41708b4
b14b75b
36c9bb7
c9e1768
e3be5a6
aa1716a
29a26fa
64d0e22
2e585ef
d4aa313
60fbf84
3297c20
6ece42a
3e773cd
0d84d90
1061029
6d68668
c8bf2a9
b57eecb
d15f5d9
3044cf3
a4aafd0
453c3af
5246cf8
aa5a82f
f2358dd
54b7265
4046b65
956fa6b
4ccb25b
35dbf88
3deab9b
20c2ffc
f7c1d3d
576425f
283f295
82d0749
1a7d8bb
00e5241
73b2e5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| package uk.gov.hmcts.ccd.definition.store.elastic.endpoint; | ||
|
|
||
| import io.swagger.annotations.Api; | ||
| import io.swagger.annotations.ApiOperation; | ||
| import io.swagger.annotations.ApiResponse; | ||
| import io.swagger.annotations.ApiResponses; | ||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RequestParam; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
| import uk.gov.hmcts.ccd.definition.store.elastic.service.ReindexService; | ||
| import uk.gov.hmcts.ccd.definition.store.repository.model.ReindexTask; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @RestController | ||
| @RequestMapping(ReindexTaskController.REINDEX_TASKS_URI) | ||
| @Api(value = ReindexTaskController.REINDEX_TASKS_URI) | ||
| public class ReindexTaskController { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add test cases to cover the end point responses using MockMvc
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| public static final String REINDEX_TASKS_URI = "/elastic-support/reindex/tasks"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| private final ReindexService reindexService; | ||
|
|
||
| @Autowired | ||
| public ReindexTaskController(ReindexService reindexService) { | ||
| this.reindexService = reindexService; | ||
| } | ||
|
|
||
| @GetMapping | ||
| @ApiOperation(value = "Get all reindex tasks, optionally by case type", | ||
| response = ReindexTask.class, | ||
| responseContainer = "List") | ||
| @ApiResponses(value = { | ||
| @ApiResponse(code = 200, message = "Successfully retrieved reindex tasks"), | ||
| @ApiResponse(code = 500, message = "Internal Server Error") | ||
| }) | ||
| public ResponseEntity<List<ReindexTask>> getReindexTasksByCaseType( | ||
| @RequestParam(value = "caseType", required = false) String caseType | ||
| ) { | ||
| List<ReindexTask> response = reindexService.getTasksByCaseType(caseType); | ||
| return ResponseEntity.ok(response); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package uk.gov.hmcts.ccd.definition.store.elastic.service; | ||
|
|
||
| import uk.gov.hmcts.ccd.definition.store.event.DefinitionImportedEvent; | ||
| import uk.gov.hmcts.ccd.definition.store.repository.entity.CaseTypeEntity; | ||
| import uk.gov.hmcts.ccd.definition.store.repository.entity.ReindexEntity; | ||
| import uk.gov.hmcts.ccd.definition.store.repository.model.ReindexTask; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.List; | ||
|
|
||
| public interface ReindexService { | ||
| void asyncReindex(DefinitionImportedEvent event, String baseIndexName, CaseTypeEntity caseType) throws IOException; | ||
|
|
||
| String incrementIndexNumber(String indexName); | ||
|
|
||
| List<ReindexTask> getAll(); | ||
|
|
||
| List<ReindexTask> getTasksByCaseType(String caseType); | ||
|
|
||
| ReindexEntity saveEntity(Boolean deleteOldIndex, CaseTypeEntity caseType, | ||
| String newIndexName); | ||
|
|
||
| void updateEntity(String newIndexName, String response); | ||
|
|
||
| void updateEntity(String newIndexName, Exception exception); | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.