Skip to content

Commit d6f0e95

Browse files
authored
Support Renaming Containers (#55)
1 parent 97e35ff commit d6f0e95

File tree

5 files changed

+130
-8
lines changed

5 files changed

+130
-8
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# The LabKey Remote API Library for Java - Change Log
22

3-
## version 5.2.0-SNAPSHOT
3+
## version 5.3.0-SNAPSHOT
44
*Released*: TBD
55

6+
## version 5.2.0
7+
*Released*: 3 May 2023
8+
* Add `RenameContainerCommand` and `RenameContainerResponse`
9+
610
## version 5.1.0
711
*Released*: 3 March 2023
812
* Delegate first request behavior to the configured `CredentialsProvider`. Connection-based providers invoke

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@ follow is to use your feature branch in the naming of that version (e.g., `X.Y.Z
4444
TeamCity will automatically publish new SNAPSHOT versions from feature branches.
4545
- Update your `$LABKEY_ROOT/settings.gradle` file to include this project (`include ':remoteapi:labkey-api-java'`)
4646

47-
After making these changes, in all places where a dependency on the Java API has been declared like so:
48-
49-
```gradle
50-
BuildUtils.addLabKeyDependency(project: project, config: "remoteApi", depProjectPath: BuildUtils.getRemoteApiProjectPath(gradle), depVersion: project.labkeyClientApiVersion)
51-
```
52-
5347
Gradle will now pull in the locally built version instead. To start using a published
5448
version instead, revert the change to the `settings.gradle` file (and, if necessary, update the `labkeyClientApiVersion`
5549
in the `$LABKEY_ROOT/gradle.properties` file).

build.gradle

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

4949
group "org.labkey.api"
5050

51-
version "5.2.0-SNAPSHOT"
51+
version "5.3.0-SNAPSHOT"
5252

5353
dependencies {
5454
api "org.json:json:${jsonObjectVersion}"
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
* Copyright (c) 2009 LabKey Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.labkey.remoteapi.security;
18+
19+
import org.labkey.remoteapi.PostCommand;
20+
21+
import org.json.JSONObject;
22+
23+
/**
24+
* Rename a container on the server
25+
*/
26+
public class RenameContainerCommand extends PostCommand<RenameContainerResponse> {
27+
private String _name;
28+
private String _title;
29+
private boolean _addAlias = true;
30+
31+
32+
public RenameContainerCommand(String name, String title, boolean addAlias)
33+
{
34+
super("admin", "RenameContainer");
35+
_name = name;
36+
_title = title;
37+
_addAlias = addAlias;
38+
}
39+
40+
@Override
41+
public JSONObject getJsonObject()
42+
{
43+
JSONObject result = new JSONObject();
44+
result.put("name", _name);
45+
result.put("title", _title);
46+
result.put("addAlias", _addAlias);
47+
48+
return result;
49+
}
50+
51+
public String getName()
52+
{
53+
return _name;
54+
}
55+
56+
public void setName(String name)
57+
{
58+
_name = name;
59+
}
60+
61+
public String getTitle()
62+
{
63+
return _title;
64+
}
65+
66+
public void setTitle(String title)
67+
{
68+
_title = title;
69+
}
70+
71+
public boolean isAddAlias()
72+
{
73+
return _addAlias;
74+
}
75+
76+
public void setAddAlias(boolean addAlias)
77+
{
78+
_addAlias = addAlias;
79+
}
80+
81+
@Override
82+
protected RenameContainerResponse createResponse(String text, int status, String contentType, JSONObject json)
83+
{
84+
return new RenameContainerResponse(text, status, contentType, json);
85+
}
86+
87+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) 2012-2013 LabKey Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.labkey.remoteapi.security;
17+
18+
import org.json.JSONObject;
19+
import org.labkey.remoteapi.CommandResponse;
20+
21+
public class RenameContainerResponse extends CommandResponse
22+
{
23+
public RenameContainerResponse(String text, int statusCode, String contentType, JSONObject json)
24+
{
25+
super(text, statusCode, contentType, json);
26+
}
27+
28+
public String getPath()
29+
{
30+
return getProperty("path");
31+
}
32+
33+
public String getName()
34+
{
35+
return getProperty("name");
36+
}
37+
}

0 commit comments

Comments
 (0)