-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MODINVSTOR-1343: Sort holdings by location name in instanceId query
https://folio-org.atlassian.net/browse/MODINVSTOR-1343 The UI has the instance view that shows the holdings that belong to that instance. There are many libraries with many holdings per instance, they need this sorted by effectiveLocation.name, callNumberPrefix, callNumber, callNumberSuffix. RMB doesn’t support sorting by effectiveLocation.name because that’s a foreign table field. It only supports sorting by effectiveLocationId. Implement this special case that the UI will use: instanceId==5b966ed6-3cd6-4dda-a0c7-f9b5e2826ccd sortBy effectiveLocation.name callNumberPrefix callNumber callNumberSuffix Allow any sub-set and order for the sortBy fields.
- Loading branch information
1 parent
3c2cf47
commit 9c3a61f
Showing
8 changed files
with
190 additions
and
6 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
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
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
24 changes: 24 additions & 0 deletions
24
src/test/java/org/folio/persist/HoldingsRepositoryTest.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,24 @@ | ||
package org.folio.persist; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.instanceOf; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
import io.vertx.core.Vertx; | ||
import java.util.Map; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class HoldingsRepositoryTest { | ||
|
||
@Test | ||
void invalidSortBy() { | ||
String[] sortBys = {"foo"}; | ||
var context = Vertx.vertx().getOrCreateContext(); | ||
var headers = Map.of("X-Okapi-Tenant", "diku"); | ||
var holdingsRepository = new HoldingsRepository(context, headers); | ||
var future = holdingsRepository.getByInstanceId(null, sortBys, 0, 0); | ||
assertThat(future.cause(), is(instanceOf(IllegalArgumentException.class))); | ||
assertThat(future.cause().getMessage(), is("sortBy: foo")); | ||
} | ||
|
||
} |
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