From ac54c8f060d669213578b1ce376c723db15b8884 Mon Sep 17 00:00:00 2001 From: chrisala Date: Wed, 12 Jun 2024 09:28:30 +1000 Subject: [PATCH] Add relatedScores property to Score entity AtlasOfLivingAustralia/fieldcapture#3170 --- grails-app/conf/application.groovy | 6 +++++- .../au/org/ala/ecodata/RelatedScore.groovy | 18 ++++++++++++++++++ .../domain/au/org/ala/ecodata/Score.groovy | 4 ++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 grails-app/domain/au/org/ala/ecodata/RelatedScore.groovy diff --git a/grails-app/conf/application.groovy b/grails-app/conf/application.groovy index 8f0b6285e..c4ff29125 100644 --- a/grails-app/conf/application.groovy +++ b/grails-app/conf/application.groovy @@ -623,7 +623,11 @@ environments { app.uploads.url = "/document/download/" grails.mail.host="localhost" grails.mail.port=1025 - + grails.cache.ehcache = { + diskStore { + path "~/data/${appName}/ehcache" + } + } } test { diff --git a/grails-app/domain/au/org/ala/ecodata/RelatedScore.groovy b/grails-app/domain/au/org/ala/ecodata/RelatedScore.groovy new file mode 100644 index 000000000..3f9659ef2 --- /dev/null +++ b/grails-app/domain/au/org/ala/ecodata/RelatedScore.groovy @@ -0,0 +1,18 @@ +package au.org.ala.ecodata + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import groovy.transform.EqualsAndHashCode +import groovy.transform.ToString + + +@EqualsAndHashCode +@ToString +@JsonIgnoreProperties(['metaClass', 'errors', 'expandoMetaClass']) +class RelatedScore { + + String scoreId + + /** A description of the association - e.g. Service Provider, Grantee, Sponsor */ + String description + +} diff --git a/grails-app/domain/au/org/ala/ecodata/Score.groovy b/grails-app/domain/au/org/ala/ecodata/Score.groovy index e7cddc34a..843e99a1f 100644 --- a/grails-app/domain/au/org/ala/ecodata/Score.groovy +++ b/grails-app/domain/au/org/ala/ecodata/Score.groovy @@ -37,6 +37,8 @@ class Score { /** Can be used to categorize scores */ List tags + List relatedScores + /** Embedded document describing how the score should be calculated */ Map configuration @@ -59,6 +61,8 @@ class Score { version false } + static embedded = ['relatedScores'] + def beforeValidate() { if (scoreId == null) { scoreId = Identifiers.getNew(true, "")