diff --git a/pom.xml b/pom.xml
index be897dbd1..e3d24cf83 100644
--- a/pom.xml
+++ b/pom.xml
@@ -88,7 +88,7 @@
2.2.8.RELEASE
- 2.0.0
+ 2.0.1
0.59
2.0.0
2.0.0
diff --git a/registry-service/src/main/java/org/gbif/registry/service/collections/utils/Vocabularies.java b/registry-service/src/main/java/org/gbif/registry/service/collections/utils/Vocabularies.java
index 9f7e5e435..a124f772b 100644
--- a/registry-service/src/main/java/org/gbif/registry/service/collections/utils/Vocabularies.java
+++ b/registry-service/src/main/java/org/gbif/registry/service/collections/utils/Vocabularies.java
@@ -221,6 +221,24 @@ private static Set findChildren(
return allChildren;
}
+ public static List getVocabularyConcepts(String vocabulary, ConceptClient conceptClient) {
+ int limit = 100;
+ long offset = 0;
+ PagingResponse response;
+ List concepts = new ArrayList<>();
+ do {
+ ConceptListParams params = ConceptListParams.builder().limit(limit).offset(offset).build();
+ response =
+ Retry.decorateSupplier(
+ RETRY, () -> conceptClient.listConceptsLatestRelease(vocabulary, params))
+ .get();
+ response.getResults().forEach(r -> concepts.add(r.getConcept().getName()));
+ offset += limit;
+ } while (!response.isEndOfRecords());
+
+ return concepts;
+ }
+
public static ConceptView getConceptLatestRelease(
String vocabulary, String conceptName, ConceptClient conceptClient) {
return Retry.decorateSupplier(
diff --git a/registry-ws/src/main/java/org/gbif/registry/ws/resources/scheduled/GRSciCollCountsUpdaterService.java b/registry-ws/src/main/java/org/gbif/registry/ws/resources/scheduled/GRSciCollCountsUpdaterService.java
index cc3abff65..73b252714 100644
--- a/registry-ws/src/main/java/org/gbif/registry/ws/resources/scheduled/GRSciCollCountsUpdaterService.java
+++ b/registry-ws/src/main/java/org/gbif/registry/ws/resources/scheduled/GRSciCollCountsUpdaterService.java
@@ -23,6 +23,8 @@
import org.gbif.registry.persistence.mapper.collections.CollectionMapper;
import org.gbif.registry.persistence.mapper.collections.InstitutionMapper;
import org.gbif.registry.persistence.mapper.params.Count;
+import org.gbif.registry.service.collections.utils.Vocabularies;
+import org.gbif.vocabulary.client.ConceptClient;
import org.gbif.ws.client.ClientBuilder;
import org.gbif.ws.json.JacksonJsonObjectMapperProvider;
@@ -47,15 +49,18 @@ public class GRSciCollCountsUpdaterService {
private final InstitutionMapper institutionMapper;
private final CollectionMapper collectionMapper;
+ private final ConceptClient conceptClient;
private final OccurrenceWsSearchClient occurrenceWsSearchClient;
@Autowired
public GRSciCollCountsUpdaterService(
InstitutionMapper institutionMapper,
CollectionMapper collectionMapper,
+ ConceptClient conceptClient,
@Value("${api.root.url}") String apiRootUrl) {
this.institutionMapper = institutionMapper;
this.collectionMapper = collectionMapper;
+ this.conceptClient = conceptClient;
this.occurrenceWsSearchClient =
new ClientBuilder()
.withObjectMapper(JacksonJsonObjectMapperProvider.getObjectMapperWithBuilderSupport())
@@ -138,8 +143,11 @@ private void updateCounts() {
}
// add type specimens to the request and make the call
- Arrays.stream(TypeStatus.values())
- .filter(t -> t != TypeStatus.NOTATYPE)
+ List typeStatusValues =
+ Vocabularies.getVocabularyConcepts(Vocabularies.TYPE_STATUS, conceptClient);
+
+ typeStatusValues.stream()
+ .filter(t -> !t.equalsIgnoreCase("NotAType"))
.forEach(request::addTypeStatusFilter);
SearchResponse typeSpecimenCountsResponse =
occurrenceWsSearchClient.search(request);