Skip to content

Commit c50321b

Browse files
authored
Move ExecuteSqlCommand into the SelectRowsCommand inheritance hierarchy (#95)
#### Rationale Client requested that we add missing support for the `includeMetadata` option on `ExecuteSqlCommand`. LabKey/internal-issues#1414 #### Related Pull Requests * LabKey/testAutomation#3158 * LabKey/limsModules#2406 #### Changes * Instead of adding yet-another property and its handling to ExecuteSqlCommand, I decided to refactor `BaseQueryCommand`, add `BaseSelectRowsCommand`, and fold ExecuteSqlCommand into that hierarchy, so it can share the large number of common properties and handling with `SelectRowCommand`. This adds `includeMetadata` support "for free", eliminates a large amount of redundant code, and ensures future properties can be implemented in both easily. * Eliminate the `RequestType` generic type parameter on `Command`. This was added recently (by me) but it adds little value and makes it more difficult to implement inheritance hierarchies where parents and children might need different HTTP methods. `GetCommand`, `PostCommand`, and subclass methods can continue to return `HttpGet` or `HttpPost` if they wish, so this has very little impact. * Eliminate unnecessary `BaseSelect` interface. This early attempt at keeping ExecuteSqlCommand and SelectRowsCommand in sync is no longer needed since they now share a common base class that implements all shared property handling. * Update `StopImpersonatingCommand` to use `stopImpersonatingApi`. This means that, on success, the command now returns a success status code instead of a redirect. * Remove deprecated methods from `GetContainersResponse` and `GetUsersCommand`
1 parent 6e660ab commit c50321b

22 files changed

Lines changed: 221 additions & 406 deletions

CHANGELOG.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
# The LabKey Remote API Library for Java - Change Log
22

3-
## version 7.4.0-SNAPSHOT
3+
## version 8.1.0-SNAPSHOT
44
*Released*: TBD
5-
*
5+
6+
## version 8.0.0
7+
*Released*: 2026-08-20
8+
* POTENTIALLY BREAKING CHANGES
9+
* Eliminate the `RequestType` generic type parameter on `Command`
10+
* Eliminate unnecessary `BaseSelect` interface
11+
* Remove deprecated methods from `GetContainersResponse` and `GetUsersCommand`
12+
* Update `StopImpersonatingCommand` to use the `stopImpersonatingApi` action. A successful execute() call now returns
13+
status code 200 instead of 302.
14+
* `ExecuteSqlCommand` now supports `setIncludeMetadata()` and `isIncludeMetadata()`. Use of this flag requires LabKey
15+
Server v26.9+.
16+
* Merge `ExecuteSqlCommand` into the `SelectRowsCommand` hierarchy to add `includeMetadata` support, eliminate redundant
17+
code, and ensure future shared properties can be implemented in both easily.
18+
* Add `ExecuteSqlCommand.quoteIdentifier()` helper method to quote identifiers that may have tricky characters
19+
* Update Gradle, Gradle plugins, Commons Codec, Commons Logging, HttpClient, and JSON-java versions
620

721
## version 7.3.0
822
*Released*: 15 July 2026
923
* Update Gradle version and remove some deprecated syntax
1024
* Update HttpCore5 to 5.4.3 (CVE-2026-54399) and HttpClient5 to 5.5.2
11-
* Update Gradle plugins, Commons Codec, Commons Logging, and JSONObject versions
25+
* Update Gradle plugins, Commons Codec, Commons Logging, and JSON-java versions
1226

1327
## version 7.2.0
1428
*Released*: 17 February 2026
@@ -25,7 +39,7 @@
2539

2640
## version 7.0.0
2741
*Released*: 18 July 2025
28-
* Update Gradle, Gradle Plugins, HttpClient, and JSONObject versions
42+
* Update Gradle, Gradle Plugins, HttpClient, and JSON-java versions
2943
* BREAKING CHANGES
3044
* The `SaveRowsCommand` has been updated to be a command wrapper for the `query-saveRows.api`
3145
* The `SaveRowsResponse` now wraps the response from the new `SaveRowsCommand`
@@ -35,7 +49,7 @@
3549

3650
## version 6.3.0
3751
*Released*: 19 June 2025
38-
* Update Commons Codec, Commons Logging, Gradle, Gradle Plugins, HttpClient, HttpCore, and JSONObject versions
52+
* Update Commons Codec, Commons Logging, Gradle, Gradle Plugins, HttpClient, HttpCore, and JSON-java versions
3953
* Remove defunct FileNotification API and uses
4054
* Update publishing method for new Maven Central API
4155

@@ -44,7 +58,7 @@
4458
* Add support for `auditUserComment` field for assay import
4559
* Add support for `allowPlateMetadata`, `plateMetadata` fields for assay plate support
4660
* Deprecate `GetContainersResponse` permissions methods which are incompatible with LabKey Server v24.8+
47-
* Update Commons Codec, Commons Logging, Gradle, Gradle Plugins, HttpCore, and JSONObject versions
61+
* Update Commons Codec, Commons Logging, Gradle, Gradle Plugins, HttpCore, and JSON-java versions
4862

4963
## version 6.1.0
5064
*Released*: 26 February 2024

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ repositories {
7070

7171
group = "org.labkey.api"
7272

73-
version = "7.4.0-SNAPSHOT"
73+
version = "8.1.0-SNAPSHOT"
7474

7575
dependencies {
7676
api "org.json:json:${jsonObjectVersion}"

gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ artifactory_contextUrl=https://labkey.jfrog.io/artifactory
77
sourceCompatibility=17
88
targetCompatibility=17
99

10-
gradlePluginsVersion=9.1.0
10+
gradlePluginsVersion=10.0.0
1111

12-
commonsCodecVersion=1.22.0
12+
commonsCodecVersion=1.22.1
1313
commonsLoggingVersion=1.4.0
1414

15-
httpclient5Version=5.5.2
15+
httpclient5Version=5.6.4
1616
httpcore5Version=5.4.3
1717

18-
jsonObjectVersion=20260522
18+
jsonObjectVersion=20260719
1919

2020
junitVersion=4.13.2
2121

gradle/wrapper/gradle-wrapper.jar

1.3 KB
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
44
networkTimeout=10000
5+
retries=0
6+
retryBackOffMs=500
57
validateDistributionUrl=true
68
zipStoreBase=GRADLE_USER_HOME
79
zipStorePath=wrapper/dists

gradlew

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 12 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/org/labkey/remoteapi/Command.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
* Note that this class is not thread-safe. Do not share instances of this class or its
5959
* descendants between threads, unless the descendant declares explicitly that it is thread-safe.
6060
*/
61-
public abstract class Command<ResponseType extends CommandResponse, RequestType extends HttpUriRequest> implements HasRequiredVersion
61+
public abstract class Command<ResponseType extends CommandResponse> implements HasRequiredVersion
6262
{
6363
/**
6464
* A constant for the official JSON content type ("application/json")
@@ -448,7 +448,7 @@ protected ResponseType createResponse(String text, int status, String contentTyp
448448
* @throws URISyntaxException Thrown if there is a problem parsing the base URL in the connection.
449449
*/
450450

451-
protected RequestType getHttpRequest(Connection connection, String folderPath) throws URISyntaxException
451+
protected HttpUriRequest getHttpRequest(Connection connection, String folderPath) throws URISyntaxException
452452
{
453453
//construct a URI from connection base URI, folder path, and current parameters
454454
URI uri = createURI(connection, folderPath);
@@ -461,7 +461,7 @@ protected RequestType getHttpRequest(Connection connection, String folderPath) t
461461
* @param uri the uri to convert
462462
* @return The HttpUriRequest instance.
463463
*/
464-
protected abstract RequestType createRequest(URI uri);
464+
protected abstract HttpUriRequest createRequest(URI uri);
465465

466466
/**
467467
* Returns a full URI for this Command, including base URI, folder path, and query string.

src/org/labkey/remoteapi/Connection.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,7 @@ public Connection stopImpersonating() throws IOException, CommandException
380380
{
381381
CommandResponse resp = new StopImpersonatingCommand().execute(this, _impersonatePath);
382382

383-
// on success, a 302 response is returned (this command disables redirects)
384-
if (resp.getStatusCode() != 302)
383+
if (resp.getStatusCode() != 200)
385384
throw new CommandException("Failed to stop impersonating");
386385

387386
_impersonateUser = null;

src/org/labkey/remoteapi/GetCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import java.net.URI;
2121

2222
/** Base class for all commands that use get **/
23-
public abstract class GetCommand<ResponseType extends CommandResponse> extends Command<ResponseType, HttpGet>
23+
public abstract class GetCommand<ResponseType extends CommandResponse> extends Command<ResponseType>
2424
{
2525
protected GetCommand(String controllerName, String actionName)
2626
{

0 commit comments

Comments
 (0)