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

Update jooq repository to improve reusability #9424

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

edwin-greene
Copy link
Contributor

Description:
Updates the Bound class to include fields.
Simplifies the JooqRepository to only accept Bounds as parameters.
Updates the JooqRepository to support N-numbered conditions.

Related issue(s):

Fixes #9379

Notes for reviewer:
This should not be merged until the work for pagination for airdrop nfts is completed in #9378

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Signed-off-by: Edwin Greene <[email protected]>
Signed-off-by: Edwin Greene <[email protected]>
Signed-off-by: Edwin Greene <[email protected]>
Signed-off-by: Edwin Greene <[email protected]>
Signed-off-by: Edwin Greene <[email protected]>
Signed-off-by: Edwin Greene <[email protected]>
Signed-off-by: Edwin Greene <[email protected]>
Signed-off-by: Edwin Greene <[email protected]>
@edwin-greene edwin-greene added enhancement Type: New feature rest-java Area: Java REST API labels Sep 20, 2024
@edwin-greene edwin-greene added this to the 0.115.0 milestone Sep 20, 2024
@edwin-greene edwin-greene self-assigned this Sep 20, 2024
@edwin-greene edwin-greene changed the title 9379 update jooq repository conditionalfieldbounds to improve reusability Update jooq repository to improve reusability Sep 20, 2024
Copy link

sonarcloud bot commented Sep 20, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
4 New Code Smells (required ≤ 0)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

Copy link

codecov bot commented Sep 20, 2024

Codecov Report

Attention: Patch coverage is 86.66667% with 14 lines in your changes missing coverage. Please review.

Project coverage is 92.54%. Comparing base (90dca10) to head (c9fb6e7).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...era/mirror/restjava/repository/JooqRepository.java 81.13% 3 Missing and 7 partials ⚠️
...edera/mirror/restjava/dto/NftAllowanceRequest.java 33.33% 0 Missing and 2 partials ⚠️
.../hedera/mirror/restjava/common/RangeParameter.java 50.00% 0 Missing and 1 partial ⚠️
...java/com/hedera/mirror/restjava/service/Bound.java 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9424      +/-   ##
============================================
- Coverage     92.68%   92.54%   -0.14%     
- Complexity     6943     7067     +124     
============================================
  Files           896      915      +19     
  Lines         29553    29842     +289     
  Branches       3745     3780      +35     
============================================
+ Hits          27390    27617     +227     
- Misses         1399     1447      +48     
- Partials        764      778      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


private final String parameterName;

private final EnumMap<RangeOperator, Integer> cardinality = new EnumMap<>(RangeOperator.class);

public Bound(List<EntityIdRangeParameter> params, boolean primarySortField, String parameterName) {
public Bound(RangeParameter<Long>[] params, boolean primarySortField, String parameterName, Field<Long> field) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bounds can now be NumberRangeParameter bounds (because of the serial number bound), instead of just EntityIdRangeParameter, so I updated this from a list to an array to accept the interface of both RangeParameter.

var secondaryBound = tokenIds == null ? tertiaryBound : tokenIds;
var primaryBound = entityIds == null ? secondaryBound : entityIds;
return List.of(primaryBound, secondaryBound, tertiaryBound);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class already contained the specifics concerning the ordering of the jooq Fields in AirdropRequestType, so it seemed to fit to place the specifics for the ordering of the bounds here. But we could place this in one of the other layers as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Type: New feature rest-java Area: Java REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Jooq Repository ConditionalFieldBounds to improve reusability
1 participant