Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into feature/issue929
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisala committed Jun 5, 2024
2 parents d9785ac + 9af965b commit e96522c
Show file tree
Hide file tree
Showing 27 changed files with 1,476 additions and 235 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- master
- feature/**
- hotfix/**
- release/**

env:
TZ: Australia/Canberra
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
id "com.gorylenko.gradle-git-properties" version "2.4.1"
}

version "4.6-SNAPSHOT"
version "4.7-SNAPSHOT"
group "au.org.ala"
description "Ecodata"

Expand Down
7 changes: 6 additions & 1 deletion grails-app/conf/application.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,11 @@ site.check.boundary.layers = [
if (!ala.baseURL) {
ala.baseURL = "https://www.ala.org.au"
}
bie.ws.url = "https://bie-ws.ala.org.au/"
bie.url = "https://bie.ala.org.au/"
namesmatching.url = "https://namematching-ws-test.ala.org.au/"
namematching.strategy = ["exactMatch", "vernacularMatch"]

if (!collectory.baseURL) {
//collectory.baseURL = "https://collectory-dev.ala.org.au/"
collectory.baseURL = "https://collections-test.ala.org.au/"
Expand Down Expand Up @@ -1477,4 +1482,4 @@ paratoo.defaultPlotLayoutViewModels = [
]
]
]

paratoo.species.specialCases = ["Other", "N/A"]
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ class AdminController {
def reSubmitDataSet() {
String projectId = params.id
String dataSetId = params.dataSetId
String userId = params.userId ?: userService.getCurrentUser().userId
String userId = params.userId ?: userService.currentUser()?.userId
if (!projectId || !dataSetId || !userId) {
render text: [message: "Bad request"] as JSON, status: HttpStatus.SC_BAD_REQUEST
return
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package au.org.ala.ecodata

import org.apache.http.HttpStatus

class DataSetSummaryController {

static responseFormats = ['json', 'xml']
static allowedMethods = [update:['POST', 'PUT'], delete:'DELETE', bulkUpdate: 'POST']

ProjectService projectService

/** Updates a single dataset for a project */
def update(String projectId) {
Map dataSet = request.JSON
projectId = projectId ?: dataSet.projectId

if (!projectId) {
render status: HttpStatus.SC_BAD_REQUEST, text: "projectId is required"
return
}

if (dataSet.projectId && dataSet.projectId != projectId) {
render status: HttpStatus.SC_BAD_REQUEST, text: "projectId must match the data set projectId"
return
}

respond projectService.updateDataSet(projectId, dataSet)
}

/**
* Updates multiple data sets for a project.
* This endpoint exists to support the use case of associating multiple data sets with a
* report and updating their publicationStatus when the report is submitted/approved.
*
* This method expects the projectId to be supplied via the URL and the data sets to be supplied in the request
* body as a JSON object with key="dataSets" and value=List of data sets.
*/
def bulkUpdate(String projectId) {
Map postBody = request.JSON
List dataSets = postBody?.dataSets

if (!projectId) {
render status: HttpStatus.SC_BAD_REQUEST, text: "projectId is required"
return
}

for (Map dataSet in dataSets) {
if (dataSet.projectId && dataSet.projectId != projectId) {
render status: HttpStatus.SC_BAD_REQUEST, text: "projectId must match the projectId in all supplied data sets"
return
}
}

respond projectService.updateDataSets(projectId, dataSets)
}

def delete(String projectId, String dataSetId) {
if (!projectId || !dataSetId) {
render status: HttpStatus.SC_BAD_REQUEST, text: "projectId and dataSetId are required"
return
}
respond projectService.deleteDataSet(projectId, dataSetId)
}
}
6 changes: 6 additions & 0 deletions grails-app/controllers/au/org/ala/ecodata/UrlMappings.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ class UrlMappings {
"/ws/project/getDefaultFacets"(controller: "project", action: "getDefaultFacets")
"/ws/project/$projectId/dataSet/$dataSetId/records"(controller: "project", action: "fetchDataSetRecords")
"/ws/admin/initiateSpeciesRematch"(controller: "admin", action: "initiateSpeciesRematch")
"/ws/dataSetSummary/$projectId/$dataSetId?"(controller :'dataSetSummary') {

action = [POST:'update', PUT:'update', DELETE:'delete']
}

"/ws/dataSetSummary/bulkUpdate/$projectId"(controller:'dataSetSummary', action:'bulkUpdate')

"/ws/document/download"(controller:"document", action:"download")

Expand Down
2 changes: 1 addition & 1 deletion grails-app/domain/au/org/ala/ecodata/ExternalId.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ExternalId implements Comparable {
enum IdType {
INTERNAL_ORDER_NUMBER, TECH_ONE_CODE, WORK_ORDER, GRANT_AWARD, GRANT_OPPORTUNITY, RELATED_PROJECT,
MONITOR_PROTOCOL_INTERNAL_ID, MONITOR_PROTOCOL_GUID, TECH_ONE_CONTRACT_NUMBER, MONITOR_PLOT_GUID,
MONITOR_MINTED_COLLECTION_ID, UNSPECIFIED }
MONITOR_PLOT_SELECTION_GUID, MONITOR_MINTED_COLLECTION_ID, UNSPECIFIED }

static constraints = {
}
Expand Down
2 changes: 2 additions & 0 deletions grails-app/domain/au/org/ala/ecodata/Record.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions grails-app/domain/au/org/ala/ecodata/Site.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,14 @@ class Site {
status != Status.DELETED
}.find()
}

static List<Site> findAllByExternalId(ExternalId.IdType idType, String externalId, Map params) {
where {
externalIds {
idType == idType
externalId == externalId
}
status != Status.DELETED
}.list(params)
}
}
Loading

0 comments on commit e96522c

Please sign in to comment.