diff --git a/grails-app/services/au/org/ala/ecodata/ParatooService.groovy b/grails-app/services/au/org/ala/ecodata/ParatooService.groovy index b963f4d8f..d8b3077f2 100644 --- a/grails-app/services/au/org/ala/ecodata/ParatooService.groovy +++ b/grails-app/services/au/org/ala/ecodata/ParatooService.groovy @@ -1233,8 +1233,9 @@ class ParatooService { ArrayDeque modelVisitStack = new ArrayDeque<>() documentation = deepCopy(documentation) Map components = deepCopy(getComponents(documentation)) + boolean record = config.createSpeciesRecord - Map template = [dataModel: [], viewModel: [], modelName: capitalizeModelName(protocol.attributes.name), record: true, relationships: [ecodata: [:], apiOutput: [:]]] + Map template = [dataModel: [], viewModel: [], modelName: capitalizeModelName(protocol.attributes.name), record: record, relationships: [ecodata: [:], apiOutput: [:]]] Map properties = deepCopy(findProtocolEndpointDefinition(protocol, documentation)) if (properties == null) { throw new NotFoundException("No protocol endpoint found for ${protocol.attributes.endpointPrefix}/bulk") diff --git a/src/main/groovy/au/org/ala/ecodata/paratoo/ParatooProtocolConfig.groovy b/src/main/groovy/au/org/ala/ecodata/paratoo/ParatooProtocolConfig.groovy index ff07b372d..98a02dba7 100644 --- a/src/main/groovy/au/org/ala/ecodata/paratoo/ParatooProtocolConfig.groovy +++ b/src/main/groovy/au/org/ala/ecodata/paratoo/ParatooProtocolConfig.groovy @@ -17,6 +17,7 @@ class ParatooProtocolConfig { String name String apiEndpoint boolean usesPlotLayout = true + boolean createSpeciesRecord = true List tags String geometryType = 'Polygon' diff --git a/src/test/groovy/au/org/ala/ecodata/ParatooServiceSpec.groovy b/src/test/groovy/au/org/ala/ecodata/ParatooServiceSpec.groovy index 1cfd60ac1..83f2c4f5c 100644 --- a/src/test/groovy/au/org/ala/ecodata/ParatooServiceSpec.groovy +++ b/src/test/groovy/au/org/ala/ecodata/ParatooServiceSpec.groovy @@ -1549,6 +1549,94 @@ class ParatooServiceSpec extends MongoSpec implements ServiceUnitTest