|
16 | 16 |
|
17 | 17 | package org.labkey.snprc_ehr; |
18 | 18 |
|
19 | | -import org.apache.commons.lang3.StringUtils; |
20 | 19 | import org.json.JSONObject; |
21 | 20 | import org.labkey.api.action.ApiResponse; |
22 | 21 | import org.labkey.api.action.ApiSimpleResponse; |
|
39 | 38 | import org.labkey.api.query.FieldKey; |
40 | 39 | import org.labkey.api.query.InvalidKeyException; |
41 | 40 | import org.labkey.api.query.QueryAction; |
42 | | -import org.labkey.api.query.QueryException; |
43 | 41 | import org.labkey.api.query.QueryForm; |
44 | 42 | import org.labkey.api.query.QueryParseException; |
45 | 43 | import org.labkey.api.query.QueryUpdateService; |
|
57 | 55 | import org.labkey.api.view.ActionURL; |
58 | 56 | import org.labkey.api.view.JspView; |
59 | 57 | import org.labkey.api.view.NavTree; |
60 | | -import org.labkey.api.view.NotFoundException; |
61 | 58 | import org.labkey.api.view.Portal; |
62 | 59 | import org.labkey.api.view.WebPartFactory; |
63 | 60 | import org.labkey.api.view.WebPartView; |
@@ -202,7 +199,7 @@ public class UpdateQueryAction extends SimpleViewAction<QueryForm> |
202 | 199 | @Override |
203 | 200 | public ModelAndView getView(QueryForm form, BindException errors) throws Exception |
204 | 201 | { |
205 | | - ensureQueryExists(form); |
| 202 | + form.ensureQueryExists(); |
206 | 203 |
|
207 | 204 | _form = form; |
208 | 205 |
|
@@ -264,43 +261,8 @@ public void addNavTrail(NavTree root) |
264 | 261 |
|
265 | 262 | root.addChild(ti == null ? _form.getQueryName() : ti.getTitle(), _form.urlFor(QueryAction.executeQuery)); |
266 | 263 | } |
267 | | - |
268 | | - protected void ensureQueryExists(QueryForm form) |
269 | | - { |
270 | | - if (form.getSchema() == null) |
271 | | - { |
272 | | - throw new NotFoundException("Could not find schema: " + form.getSchemaName()); |
273 | | - } |
274 | | - |
275 | | - if (StringUtils.isEmpty(form.getQueryName())) |
276 | | - { |
277 | | - throw new NotFoundException("Query not specified"); |
278 | | - } |
279 | | - |
280 | | - if (!queryExists(form)) |
281 | | - { |
282 | | - throw new NotFoundException("Query '" + form.getQueryName() + "' in schema '" + form.getSchemaName() + "' doesn't exist."); |
283 | | - } |
284 | | - } |
285 | | - |
286 | | - protected boolean queryExists(QueryForm form) |
287 | | - { |
288 | | - try |
289 | | - { |
290 | | - return form.getSchema() != null && form.getSchema().getTable(form.getQueryName()) != null; |
291 | | - } |
292 | | - catch (QueryParseException x) |
293 | | - { |
294 | | - // exists with errors |
295 | | - return true; |
296 | | - } |
297 | | - catch (QueryException x) |
298 | | - { |
299 | | - // exists with errors |
300 | | - return true; |
301 | | - } |
302 | | - } |
303 | 264 | } |
| 265 | + |
304 | 266 | // http://localhost:8080/labkey/snprc_ehr/snprc/getNextAnimalId |
305 | 267 | @RequiresPermission(EHRDataEntryPermission.class) |
306 | 268 | public class getNextAnimalIdAction extends MutatingApiAction<SimpleApiJsonForm> |
|
0 commit comments