From 9ac10fc6f9d14aa54b7f35a5cad0f46603ecd518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20D=C3=B6ring?= Date: Fri, 3 Jan 2025 17:54:25 +0100 Subject: [PATCH] Add classOnly query param to term vocab to filter for rowType terms only, see https://github.com/CatalogueOfLife/checklistbank/issues/1516 --- .../main/java/life/catalogue/resources/VocabResource.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webservice/src/main/java/life/catalogue/resources/VocabResource.java b/webservice/src/main/java/life/catalogue/resources/VocabResource.java index 7c5b018e2..762cb77c1 100644 --- a/webservice/src/main/java/life/catalogue/resources/VocabResource.java +++ b/webservice/src/main/java/life/catalogue/resources/VocabResource.java @@ -105,7 +105,7 @@ public List list() { @GET @Path("term") - public List terms(@QueryParam("prefix") String prefix) { + public List terms(@QueryParam("prefix") String prefix, @QueryParam("classOnly") boolean classOnly) { Set> classes = new HashSet<>( TermFactory.instance().listRegisteredTermEnums() ); if (prefix != null) { prefix = prefix.toLowerCase().trim(); @@ -122,7 +122,9 @@ public List terms(@QueryParam("prefix") String pr for (Class clazz : classes) { Class tec = (Class) clazz; for (TE te : tec.getEnumConstants()) { - terms.add(te); + if (!classOnly || te.isClass()) { + terms.add(te); + } } }