-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CIRC-2109 Pass additional includeRoutingServicePoints parameter when …
…needed (#1478) * CIRC-2109 Initial implementation * CIRC-2109 Apply suggestions from code review Co-authored-by: Roman Barannyk <[email protected]> * CIRC-2109 Support for fake routing service points * CIRC-2109 Remove unneeded method * CIRC-2109 Add Override annotation * CIRC-2109 Apply suggestions from code review Co-authored-by: Roman Barannyk <[email protected]> * CIRC-2019 Update src/test/java/api/support/fakes/FakeCQLToJSONInterpreter.java Co-authored-by: Roman Barannyk <[email protected]> * CIRC-2109 Fix github suggestion commit * CIRC-2109 Code review 1 * CIRC-2109 Revert FakeStorageModuleBuilder --------- Co-authored-by: Roman Barannyk <[email protected]>
- Loading branch information
1 parent
5cff758
commit ea17564
Showing
9 changed files
with
148 additions
and
10 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
46 changes: 46 additions & 0 deletions
46
src/main/java/org/folio/circulation/support/CustomParamCollectionResourceClient.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,46 @@ | ||
package org.folio.circulation.support; | ||
|
||
import java.net.URL; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
import org.folio.circulation.support.http.client.CqlQuery; | ||
import org.folio.circulation.support.http.client.Offset; | ||
import org.folio.circulation.support.http.client.OkapiHttpClient; | ||
import org.folio.circulation.support.http.client.PageLimit; | ||
import org.folio.circulation.support.http.client.QueryParameter; | ||
import org.folio.circulation.support.http.client.Response; | ||
import org.folio.circulation.support.results.Result; | ||
|
||
public class CustomParamCollectionResourceClient extends CollectionResourceClient { | ||
|
||
private QueryParameter customQueryParameter; | ||
|
||
public CustomParamCollectionResourceClient(OkapiHttpClient client, URL collectionRoot, | ||
QueryParameter customQueryParameter) { | ||
|
||
super(client, collectionRoot); | ||
this.customQueryParameter = customQueryParameter; | ||
} | ||
|
||
@Override | ||
public CompletableFuture<Result<Response>> get() { | ||
return client.get(collectionRoot.toString(), customQueryParameter); | ||
} | ||
|
||
@Override | ||
public CompletableFuture<Result<Response>> get(PageLimit pageLimit) { | ||
return client.get(collectionRoot, pageLimit, customQueryParameter); | ||
} | ||
|
||
@Override | ||
public CompletableFuture<Result<Response>> get(String id) { | ||
return client.get(individualRecordUrl(id), customQueryParameter); | ||
} | ||
|
||
@Override | ||
public CompletableFuture<Result<Response>> getMany(CqlQuery cqlQuery, | ||
PageLimit pageLimit, Offset offset) { | ||
|
||
return client.get(collectionRoot, cqlQuery, pageLimit, offset, customQueryParameter); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/org/folio/circulation/support/http/client/IncludeRoutingServicePoints.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,33 @@ | ||
package org.folio.circulation.support.http.client; | ||
|
||
import static java.lang.String.format; | ||
|
||
public class IncludeRoutingServicePoints implements QueryParameter { | ||
|
||
private static final String PARAM_NAME = "includeRoutingServicePoints"; | ||
private final Boolean value; | ||
|
||
public static IncludeRoutingServicePoints enabled() { | ||
return new IncludeRoutingServicePoints(true); | ||
} | ||
|
||
private IncludeRoutingServicePoints(Boolean value) { | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public void consume(QueryStringParameterConsumer consumer) { | ||
if (value != null) { | ||
consumer.consume(PARAM_NAME, value.toString()); | ||
} | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
if (value == null) { | ||
return format("No %s", PARAM_NAME); | ||
} | ||
|
||
return format("%s = \"%s\"", PARAM_NAME, value); | ||
} | ||
} |
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