|
48 | 48 | import org.labkey.api.module.ModuleLoader; |
49 | 49 | import org.labkey.api.query.DetailsURL; |
50 | 50 | import org.labkey.api.query.QueryAction; |
51 | | -import org.labkey.api.query.QueryException; |
52 | 51 | import org.labkey.api.query.QueryForm; |
53 | 52 | import org.labkey.api.query.QueryParseException; |
54 | 53 | import org.labkey.api.query.QueryView; |
|
76 | 75 | import org.labkey.api.view.ActionURL; |
77 | 76 | import org.labkey.api.view.HtmlView; |
78 | 77 | import org.labkey.api.view.NavTree; |
79 | | -import org.labkey.api.view.NotFoundException; |
80 | 78 | import org.labkey.api.view.Portal; |
81 | 79 | import org.labkey.api.view.RedirectException; |
82 | 80 | import org.labkey.api.view.UnauthorizedException; |
|
91 | 89 | import javax.servlet.http.HttpServletResponse; |
92 | 90 | import java.net.URISyntaxException; |
93 | 91 | import java.text.SimpleDateFormat; |
94 | | -import java.util.function.Predicate; |
95 | 92 | import java.util.ArrayList; |
96 | 93 | import java.util.Comparator; |
97 | 94 | import java.util.Date; |
98 | 95 | import java.util.HashMap; |
99 | 96 | import java.util.List; |
100 | 97 | import java.util.Map; |
101 | 98 | import java.util.Set; |
| 99 | +import java.util.function.Predicate; |
102 | 100 |
|
103 | 101 |
|
104 | 102 |
|
@@ -832,7 +830,7 @@ public class UpdateQueryAction extends SimpleViewAction<QueryForm> |
832 | 830 | @Override |
833 | 831 | public ModelAndView getView(QueryForm form, BindException errors) throws Exception |
834 | 832 | { |
835 | | - ensureQueryExists(form); |
| 833 | + form.ensureQueryExists(); |
836 | 834 |
|
837 | 835 | _form = form; |
838 | 836 |
|
@@ -894,42 +892,6 @@ public void addNavTrail(NavTree root) |
894 | 892 |
|
895 | 893 | root.addChild(ti == null ? _form.getQueryName() : ti.getTitle(), _form.urlFor(QueryAction.executeQuery)); |
896 | 894 | } |
897 | | - |
898 | | - protected void ensureQueryExists(QueryForm form) |
899 | | - { |
900 | | - if (form.getSchema() == null) |
901 | | - { |
902 | | - throw new NotFoundException("Could not find schema: " + form.getSchemaName()); |
903 | | - } |
904 | | - |
905 | | - if (StringUtils.isEmpty(form.getQueryName())) |
906 | | - { |
907 | | - throw new NotFoundException("Query not specified"); |
908 | | - } |
909 | | - |
910 | | - if (!queryExists(form)) |
911 | | - { |
912 | | - throw new NotFoundException("Query '" + form.getQueryName() + "' in schema '" + form.getSchemaName() + "' doesn't exist."); |
913 | | - } |
914 | | - } |
915 | | - |
916 | | - protected boolean queryExists(QueryForm form) |
917 | | - { |
918 | | - try |
919 | | - { |
920 | | - return form.getSchema() != null && form.getSchema().getTable(form.getQueryName()) != null; |
921 | | - } |
922 | | - catch (QueryParseException x) |
923 | | - { |
924 | | - // exists with errors |
925 | | - return true; |
926 | | - } |
927 | | - catch (QueryException x) |
928 | | - { |
929 | | - // exists with errors |
930 | | - return true; |
931 | | - } |
932 | | - } |
933 | 895 | } |
934 | 896 |
|
935 | 897 | @RequiresPermission(AdminPermission.class) |
|
0 commit comments