From 1d63d99a077421c26ef41b6074c72a2ff31a112b Mon Sep 17 00:00:00 2001 From: chrisala Date: Thu, 16 May 2024 11:01:47 +1000 Subject: [PATCH] Addressed code review comments #945 --- grails-app/conf/application.groovy | 4 ++-- grails-app/domain/au/org/ala/ecodata/Record.groovy | 2 ++ .../services/au/org/ala/ecodata/ParatooService.groovy | 2 +- .../au/org/ala/ecodata/SpeciesReMatchService.groovy | 2 +- .../au/org/ala/ecodata/metadata/SpeciesUrlGetter.groovy | 7 +++++-- .../au/org/ala/ecodata/reporting/TabbedExporter.groovy | 2 +- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/grails-app/conf/application.groovy b/grails-app/conf/application.groovy index 2938f86e0..3f0209f77 100644 --- a/grails-app/conf/application.groovy +++ b/grails-app/conf/application.groovy @@ -501,8 +501,8 @@ app { if (!ala.baseURL) { ala.baseURL = "https://www.ala.org.au" } -bie.ws.url = "https://www.bie.ala.org.au/ws" -bie.url = "https://www.bie.ala.org.au" +bie.ws.url = "https://bie-ws.ala.org.au/" +bie.url = "https://bie.ala.org.au/" if (!collectory.baseURL) { //collectory.baseURL = "https://collectory-dev.ala.org.au/" diff --git a/grails-app/domain/au/org/ala/ecodata/Record.groovy b/grails-app/domain/au/org/ala/ecodata/Record.groovy index 0dfe00481..ddfd8682b 100644 --- a/grails-app/domain/au/org/ala/ecodata/Record.groovy +++ b/grails-app/domain/au/org/ala/ecodata/Record.groovy @@ -6,6 +6,8 @@ import org.bson.types.ObjectId class Record { // def grailsApplication + /** Represents a species guid that was unable to be matched against the ALA names list */ + static final String UNMATCHED_GUID = "A_GUID" static mapping = { occurrenceID index: true diff --git a/grails-app/services/au/org/ala/ecodata/ParatooService.groovy b/grails-app/services/au/org/ala/ecodata/ParatooService.groovy index ca8709715..7e909bb6a 100644 --- a/grails-app/services/au/org/ala/ecodata/ParatooService.groovy +++ b/grails-app/services/au/org/ala/ecodata/ParatooService.groovy @@ -2052,7 +2052,7 @@ class ParatooService { } // record is only created if guid is present - result.guid = result.guid ?: "A_GUID" + result.guid = result.guid ?: Record.UNMATCHED_GUID result } } diff --git a/grails-app/services/au/org/ala/ecodata/SpeciesReMatchService.groovy b/grails-app/services/au/org/ala/ecodata/SpeciesReMatchService.groovy index e074cd730..11214a11d 100644 --- a/grails-app/services/au/org/ala/ecodata/SpeciesReMatchService.groovy +++ b/grails-app/services/au/org/ala/ecodata/SpeciesReMatchService.groovy @@ -85,7 +85,7 @@ class SpeciesReMatchService { name = name?.toLowerCase() ?: "" cacheService.get('bie-search-auto-' + name, { def encodedQuery = URLEncoder.encode(name ?: '', "UTF-8") - def url = "${grailsApplication.config.getProperty('bie.url')}ws/search/auto.jsonp?q=${encodedQuery}&limit=${limit}&idxType=TAXON" + def url = "${grailsApplication.config.getProperty('bie.ws.url')}ws/search/auto.jsonp?q=${encodedQuery}&limit=${limit}&idxType=TAXON" webService.getJson(url) }) diff --git a/src/main/groovy/au/org/ala/ecodata/metadata/SpeciesUrlGetter.groovy b/src/main/groovy/au/org/ala/ecodata/metadata/SpeciesUrlGetter.groovy index 296fe17eb..89a7dffc1 100644 --- a/src/main/groovy/au/org/ala/ecodata/metadata/SpeciesUrlGetter.groovy +++ b/src/main/groovy/au/org/ala/ecodata/metadata/SpeciesUrlGetter.groovy @@ -1,6 +1,7 @@ package au.org.ala.ecodata.metadata import pl.touk.excel.export.getters.Getter +import au.org.ala.ecodata.Record class SpeciesUrlGetter extends OutputDataGetter implements Getter { String biePrefix @@ -15,8 +16,10 @@ class SpeciesUrlGetter extends OutputDataGetter implements Getter { if (!val?.name) { return "" } - - return val?.guid ? biePrefix+val.guid : "Unmatched name" + if (!val?.guid || val.guid == Record.UNMATCHED_GUID) { + return "Unmatched name" + } + return biePrefix+val.guid } diff --git a/src/main/groovy/au/org/ala/ecodata/reporting/TabbedExporter.groovy b/src/main/groovy/au/org/ala/ecodata/reporting/TabbedExporter.groovy index 17efdc3f9..3151e2663 100644 --- a/src/main/groovy/au/org/ala/ecodata/reporting/TabbedExporter.groovy +++ b/src/main/groovy/au/org/ala/ecodata/reporting/TabbedExporter.groovy @@ -27,7 +27,7 @@ class TabbedExporter { ReportingService reportingService = Holders.grailsApplication.mainContext.getBean("reportingService") ActivityFormService activityFormService = Holders.grailsApplication.mainContext.getBean("activityFormService") OutputModelProcessor processor = new OutputModelProcessor() - String biePrefix = Holders.grailsApplication.config.getProperty("bie.url")+'/species/' + String biePrefix = Holders.grailsApplication.config.getProperty("bie.url")+'species/' static String DATE_CELL_FORMAT = "dd/MM/yyyy" Map sheets