Skip to content

Commit 1f2836e

Browse files
committed
Merge remote-tracking branch 'origin/develop' into fb_invalidAssayIdTestFix
2 parents 47c2f24 + f4edd4e commit 1f2836e

5 files changed

Lines changed: 557 additions & 10 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright (c) 2026 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.query;
17+
18+
import org.json.JSONObject;
19+
import org.labkey.remoteapi.CommandResponse;
20+
import org.labkey.remoteapi.PostCommand;
21+
22+
/**
23+
* Deletes a custom grid view via query-deleteView.api.
24+
*/
25+
public class DeleteQueryViewCommand extends PostCommand<CommandResponse>
26+
{
27+
private final String _schemaName;
28+
private final String _queryName;
29+
private final String _viewName;
30+
private boolean _complete;
31+
32+
public DeleteQueryViewCommand(String schemaName, String queryName, String viewName)
33+
{
34+
super("query", "deleteView");
35+
_schemaName = schemaName;
36+
_queryName = queryName;
37+
_viewName = viewName;
38+
}
39+
40+
/**
41+
* @param complete delete both the saved and the session view; otherwise only the first one found is deleted
42+
*/
43+
public DeleteQueryViewCommand setComplete(boolean complete)
44+
{
45+
_complete = complete;
46+
return this;
47+
}
48+
49+
@Override
50+
public JSONObject getJsonObject()
51+
{
52+
JSONObject json = new JSONObject();
53+
json.put("schemaName", _schemaName);
54+
json.put("queryName", _queryName);
55+
json.put("viewName", _viewName);
56+
json.put("complete", _complete);
57+
return json;
58+
}
59+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright (c) 2026 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.query;
17+
18+
import org.json.JSONObject;
19+
import org.labkey.remoteapi.CommandResponse;
20+
import org.labkey.remoteapi.PostCommand;
21+
22+
/**
23+
* Renames a custom grid view via query-renameQueryView.api.
24+
*/
25+
public class RenameQueryViewCommand extends PostCommand<CommandResponse>
26+
{
27+
private final String _schemaName;
28+
private final String _queryName;
29+
private final String _viewName;
30+
private final String _newName;
31+
32+
public RenameQueryViewCommand(String schemaName, String queryName, String viewName, String newName)
33+
{
34+
super("query", "renameQueryView");
35+
_schemaName = schemaName;
36+
_queryName = queryName;
37+
_viewName = viewName;
38+
_newName = newName;
39+
}
40+
41+
@Override
42+
public JSONObject getJsonObject()
43+
{
44+
JSONObject json = new JSONObject();
45+
json.put("schemaName", _schemaName);
46+
json.put("queryName", _queryName);
47+
json.put("viewName", _viewName);
48+
json.put("newName", _newName);
49+
return json;
50+
}
51+
}

‎src/org/labkey/remoteapi/query/SaveQueryViewsCommand.java‎

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,36 @@ public SaveQueryViewsCommand(String schemaName, String queryName)
4747
* @param inherit make the view available in child folders
4848
*/
4949
public SaveQueryViewsCommand addView(String viewName, List<String> columns, boolean shared, boolean inherit)
50+
{
51+
_views.add(view(viewName, columns, shared, inherit));
52+
return this;
53+
}
54+
55+
/**
56+
* Adds a shared, inheritable view saved into a folder other than the one the command is executed against.
57+
*
58+
* @param containerPath the folder to save the view into
59+
*/
60+
public SaveQueryViewsCommand addViewInContainer(String viewName, List<String> columns, String containerPath)
61+
{
62+
Map<String, Object> view = view(viewName, columns, true, true);
63+
view.put("containerPath", containerPath);
64+
_views.add(view);
65+
66+
return this;
67+
}
68+
69+
/** Adds a view held in the caller's HTTP session rather than the database. */
70+
public SaveQueryViewsCommand addSessionView(String viewName, List<String> columns)
71+
{
72+
Map<String, Object> view = view(viewName, columns, false, false);
73+
view.put("session", true);
74+
_views.add(view);
75+
76+
return this;
77+
}
78+
79+
private static Map<String, Object> view(String viewName, List<String> columns, boolean shared, boolean inherit)
5080
{
5181
List<Map<String, Object>> columnList = columns.stream()
5282
.map(fieldKey -> Map.<String, Object>of("fieldKey", fieldKey))
@@ -58,9 +88,8 @@ public SaveQueryViewsCommand addView(String viewName, List<String> columns, bool
5888
view.put("shared", shared);
5989
view.put("inherit", inherit);
6090
view.put("replace", true);
61-
_views.add(view);
6291

63-
return this;
92+
return view;
6493
}
6594

6695
@Override
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* Copyright (c) 2026 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.query;
17+
18+
import org.json.JSONObject;
19+
import org.labkey.remoteapi.CommandResponse;
20+
import org.labkey.remoteapi.PostCommand;
21+
22+
/**
23+
* Moves a session view into the database via query-saveSessionView.api. The session view must have been created on the
24+
* same {@link org.labkey.remoteapi.Connection}, since it lives in that connection's HTTP session.
25+
*/
26+
public class SaveSessionViewCommand extends PostCommand<CommandResponse>
27+
{
28+
private final String _schemaName;
29+
private final String _queryName;
30+
private final String _viewName;
31+
private final String _newName;
32+
private boolean _shared;
33+
private boolean _inherit;
34+
private boolean _replace = true;
35+
private String _containerPath;
36+
37+
/**
38+
* @param viewName the session view to save
39+
* @param newName the name to save it under
40+
*/
41+
public SaveSessionViewCommand(String schemaName, String queryName, String viewName, String newName)
42+
{
43+
super("query", "saveSessionView");
44+
_schemaName = schemaName;
45+
_queryName = queryName;
46+
_viewName = viewName;
47+
_newName = newName;
48+
}
49+
50+
public SaveSessionViewCommand setShared(boolean shared)
51+
{
52+
_shared = shared;
53+
return this;
54+
}
55+
56+
public SaveSessionViewCommand setInherit(boolean inherit)
57+
{
58+
_inherit = inherit;
59+
return this;
60+
}
61+
62+
/** @param replace overwrite an existing view of the same name instead of reporting a name collision */
63+
public SaveSessionViewCommand setReplace(boolean replace)
64+
{
65+
_replace = replace;
66+
return this;
67+
}
68+
69+
/** @param containerPath the folder to save the view into; honored only alongside {@link #setInherit(boolean)} */
70+
public SaveSessionViewCommand setContainerPath(String containerPath)
71+
{
72+
_containerPath = containerPath;
73+
return this;
74+
}
75+
76+
@Override
77+
public JSONObject getJsonObject()
78+
{
79+
JSONObject json = new JSONObject();
80+
json.put("schemaName", _schemaName);
81+
json.put("queryName", _queryName);
82+
json.put("viewName", _viewName);
83+
json.put("newName", _newName);
84+
json.put("shared", _shared);
85+
json.put("inherit", _inherit);
86+
json.put("replace", _replace);
87+
if (_containerPath != null)
88+
json.put("containerPath", _containerPath);
89+
return json;
90+
}
91+
}

0 commit comments

Comments
 (0)