generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 1165 activity search endpoint #1186
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
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
ca4e5df
Add activity search DTO, service, and endpoint
craigyu 4bb78da
feat: search endpoint for oracle
craigyu 6e49d86
remove redundant description fetching
craigyu 0f129b0
feat: postgres search and all tests
craigyu 153aba9
fix: adjust tests
craigyu 66c5e31
Merge branch 'main' into feat/1165-activity-search-endpoint
craigyu 17902e1
fix: better date handling
craigyu 00eeed6
fix: remove no arg constructor
craigyu 0c23e9d
fix: add filter back
craigyu 9c1bcf4
fix: date search compare
craigyu 0746458
fix: add empty search test
craigyu 8538910
Merge branch 'feat/1165-activity-search-endpoint' of https://github.c…
craigyu 7d12559
fix bracket
craigyu c1352fe
fix: remove redundant test
craigyu 9526b2b
fix: better sql for isComplete
craigyu cb2c197
Merge branch 'main' into feat/1165-activity-search-endpoint
craigyu 7465198
fix is complete filter on postgres
craigyu e68a5b3
Merge branch 'feat/1165-activity-search-endpoint' of https://github.c…
craigyu 7099e6e
Merge branch 'main' into feat/1165-activity-search-endpoint
craigyu 9a21012
Merge branch 'main' into feat/1165-activity-search-endpoint
craigyu b9f6080
Mark AbstractActivityService as abstract
craigyu 5794dd8
fix: getting rid of service unit test
craigyu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
118 changes: 118 additions & 0 deletions
118
...src/main/java/ca/bc/gov/restapi/results/common/dto/activity/ActivitySearchFiltersDto.java
This file contains hidden or 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,118 @@ | ||
| package ca.bc.gov.restapi.results.common.dto.activity; | ||
|
|
||
| import ca.bc.gov.restapi.results.common.SilvaConstants; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import java.util.List; | ||
| import java.util.Objects; | ||
| import lombok.Getter; | ||
| import lombok.ToString; | ||
| import org.springframework.util.CollectionUtils; | ||
|
|
||
| /** This class contains all possible filters when using the Activity Search API. */ | ||
| @Getter | ||
| @ToString | ||
| public class ActivitySearchFiltersDto { | ||
|
|
||
| @Schema(type = "array", nullable = true) | ||
| private final List<String> bases; | ||
|
|
||
| @Schema(type = "array", nullable = true) | ||
| private final List<String> techniques; | ||
|
|
||
| @Schema(type = "array", nullable = true) | ||
| private final List<String> methods; | ||
|
|
||
| @Schema(type = "boolean", nullable = true) | ||
| private final Boolean isComplete; | ||
|
|
||
| @Schema(type = "array", nullable = true) | ||
| private final List<String> objectives; | ||
|
|
||
| @Schema(type = "array", nullable = true) | ||
| private final List<String> fundingSources; | ||
|
|
||
| @Schema(type = "array", nullable = true) | ||
| private final List<String> orgUnits; | ||
|
|
||
| @Schema(type = "array", nullable = true) | ||
| private final List<String> openingCategories; | ||
|
|
||
| @Schema(type = "string") | ||
| private final String fileId; | ||
|
|
||
| @Schema(type = "array", nullable = true) | ||
| private final List<String> clientNumbers; | ||
|
|
||
| @Schema(type = "array", nullable = true) | ||
| private final List<String> openingStatuses; | ||
|
|
||
| @Schema(type = "string", format = "date", nullable = true) | ||
| private final String updateDateStart; | ||
|
|
||
| @Schema(type = "string", format = "date", nullable = true) | ||
| private final String updateDateEnd; | ||
|
|
||
| /** | ||
| * Creates a no-arg instance with all fields set to null, delegating to the all-args constructor | ||
| * to apply defaults. | ||
| */ | ||
| public ActivitySearchFiltersDto() { | ||
| this(null, null, null, null, null, null, null, null, null, null, null, null, null); | ||
| } | ||
|
|
||
| /** Creates an instance of the activity search filter dto. */ | ||
| public ActivitySearchFiltersDto( | ||
| List<String> bases, | ||
| List<String> techniques, | ||
| List<String> methods, | ||
| Boolean isComplete, | ||
| List<String> objectives, | ||
| List<String> fundingSources, | ||
| List<String> orgUnits, | ||
| List<String> openingCategories, | ||
| String fileId, | ||
| List<String> clientNumbers, | ||
| List<String> openingStatuses, | ||
| String updateDateStart, | ||
| String updateDateEnd) { | ||
| this.bases = !CollectionUtils.isEmpty(bases) ? bases : List.of(SilvaConstants.NOVALUE); | ||
| this.techniques = | ||
| !CollectionUtils.isEmpty(techniques) ? techniques : List.of(SilvaConstants.NOVALUE); | ||
| this.methods = !CollectionUtils.isEmpty(methods) ? methods : List.of(SilvaConstants.NOVALUE); | ||
| this.isComplete = isComplete; | ||
| this.objectives = | ||
| !CollectionUtils.isEmpty(objectives) ? objectives : List.of(SilvaConstants.NOVALUE); | ||
| this.fundingSources = | ||
| !CollectionUtils.isEmpty(fundingSources) ? fundingSources : List.of(SilvaConstants.NOVALUE); | ||
| this.orgUnits = !CollectionUtils.isEmpty(orgUnits) ? orgUnits : List.of(SilvaConstants.NOVALUE); | ||
| this.openingCategories = | ||
| !CollectionUtils.isEmpty(openingCategories) | ||
| ? openingCategories | ||
| : List.of(SilvaConstants.NOVALUE); | ||
| this.fileId = Objects.isNull(fileId) ? null : fileId.trim(); | ||
| this.clientNumbers = | ||
| !CollectionUtils.isEmpty(clientNumbers) ? clientNumbers : List.of(SilvaConstants.NOVALUE); | ||
| this.openingStatuses = | ||
| !CollectionUtils.isEmpty(openingStatuses) | ||
| ? openingStatuses | ||
| : List.of(SilvaConstants.NOVALUE); | ||
| this.updateDateStart = Objects.isNull(updateDateStart) ? null : updateDateStart.trim(); | ||
| this.updateDateEnd = Objects.isNull(updateDateEnd) ? null : updateDateEnd.trim(); | ||
| } | ||
|
|
||
| public boolean hasAnyFilter() { | ||
| return !SilvaConstants.NOVALUE.equals(bases.get(0)) | ||
| || !SilvaConstants.NOVALUE.equals(techniques.get(0)) | ||
| || !SilvaConstants.NOVALUE.equals(methods.get(0)) | ||
| || isComplete != null | ||
| || !SilvaConstants.NOVALUE.equals(objectives.get(0)) | ||
| || !SilvaConstants.NOVALUE.equals(fundingSources.get(0)) | ||
| || !SilvaConstants.NOVALUE.equals(orgUnits.get(0)) | ||
| || !SilvaConstants.NOVALUE.equals(openingCategories.get(0)) | ||
| || (fileId != null && !fileId.isBlank()) | ||
| || !SilvaConstants.NOVALUE.equals(clientNumbers.get(0)) | ||
| || !SilvaConstants.NOVALUE.equals(openingStatuses.get(0)) | ||
| || (updateDateStart != null && !updateDateStart.isBlank()) | ||
| || (updateDateEnd != null && !updateDateEnd.isBlank()); | ||
| } | ||
| } |
24 changes: 24 additions & 0 deletions
24
...rc/main/java/ca/bc/gov/restapi/results/common/dto/activity/ActivitySearchResponseDto.java
This file contains hidden or 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,24 @@ | ||
| package ca.bc.gov.restapi.results.common.dto.activity; | ||
|
|
||
| import ca.bc.gov.restapi.results.common.dto.CodeDescriptionDto; | ||
| import ca.bc.gov.restapi.results.common.dto.ForestClientDto; | ||
| import java.math.BigDecimal; | ||
| import java.time.LocalDateTime; | ||
|
|
||
| public record ActivitySearchResponseDto( | ||
| Long activityId, | ||
| CodeDescriptionDto base, | ||
| CodeDescriptionDto technique, | ||
| CodeDescriptionDto method, | ||
| boolean isComplete, | ||
| CodeDescriptionDto fundingSource, | ||
| String fileId, | ||
| String cutBlock, | ||
| Long openingId, | ||
| String cuttingPermit, | ||
| BigDecimal treatmentAmountArea, | ||
| String intraAgencyNumber, | ||
| CodeDescriptionDto openingCategory, | ||
| CodeDescriptionDto orgUnit, | ||
| ForestClientDto openingClient, | ||
| LocalDateTime updateTimestamp) {} |
This file contains hidden or 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
54 changes: 54 additions & 0 deletions
54
...d/src/main/java/ca/bc/gov/restapi/results/common/projection/ActivitySearchProjection.java
This file contains hidden or 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,54 @@ | ||
| package ca.bc.gov.restapi.results.common.projection; | ||
|
|
||
| import java.math.BigDecimal; | ||
| import java.time.LocalDateTime; | ||
|
|
||
| /** Projection interface used for activity search native queries. */ | ||
| public interface ActivitySearchProjection { | ||
|
|
||
| Long getActivityId(); | ||
|
|
||
| String getBaseCode(); | ||
|
|
||
| String getBaseDescription(); | ||
|
|
||
| String getTechniqueCode(); | ||
|
|
||
| String getTechniqueDescription(); | ||
|
|
||
| String getMethodCode(); | ||
|
|
||
| String getMethodDescription(); | ||
|
|
||
| Long getIsComplete(); | ||
|
|
||
| String getFundingSourceCode(); | ||
|
|
||
| String getFundingSourceDescription(); | ||
|
|
||
| String getFileId(); | ||
|
|
||
| String getCutBlock(); | ||
|
|
||
| Long getOpeningId(); | ||
|
|
||
| String getCuttingPermit(); | ||
|
|
||
| BigDecimal getTreatmentAmountArea(); | ||
|
|
||
| String getIntraAgencyNumber(); | ||
|
|
||
| String getOpeningCategoryCode(); | ||
|
|
||
| String getOpeningCategoryDescription(); | ||
|
|
||
| String getOrgUnitCode(); | ||
|
|
||
| String getOrgUnitDescription(); | ||
|
|
||
| String getOpeningClientCode(); | ||
|
|
||
| Long getTotalCount(); | ||
|
|
||
| LocalDateTime getUpdateTimestamp(); | ||
| } |
This file contains hidden or 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
11 changes: 11 additions & 0 deletions
11
backend/src/main/java/ca/bc/gov/restapi/results/common/service/ActivityService.java
This file contains hidden or 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,11 @@ | ||
| package ca.bc.gov.restapi.results.common.service; | ||
|
|
||
| import ca.bc.gov.restapi.results.common.dto.activity.ActivitySearchFiltersDto; | ||
| import ca.bc.gov.restapi.results.common.dto.activity.ActivitySearchResponseDto; | ||
| import org.springframework.data.domain.Page; | ||
| import org.springframework.data.domain.Pageable; | ||
|
|
||
| public interface ActivityService { | ||
| Page<ActivitySearchResponseDto> activitySearch( | ||
| ActivitySearchFiltersDto filters, Pageable pagination); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.