Skip to content

Commit

Permalink
Merge pull request #171 from AtlasOfLivingAustralia/develop
Browse files Browse the repository at this point in the history
PR for 3.1.1 Release
  • Loading branch information
sughics authored Dec 15, 2022
2 parents 38e163b + bab6abf commit 7d022cb
Show file tree
Hide file tree
Showing 18 changed files with 128 additions and 114 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ plugins {
id "com.gorylenko.gradle-git-properties" version "2.4.0-rc2"
}

version "3.1.0"
version "3.1.1-SNAPSHOT"


group "au.org.ala"
Expand Down
6 changes: 3 additions & 3 deletions grails-app/assets/javascripts/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* Populate Images tab body with images via AJAX call to Biocache
*/
function loadImagesTab() {
var wsBase = "/occurrences/search.json";
var wsBase = "/occurrences/search";
var uiBase = "/occurrences/search";
var imagesQueryUrl = "?facets=type_status&fq=multimedia%3AImage&pageSize=100&q=" + (SHOW_REC.isPipelinesCompatible? "collectionUid:" : "collection_uid:") + SHOW_REC.instanceUuid;

$.ajax({
url: SHOW_REC.biocacheServicesUrl + wsBase + imagesQueryUrl,
dataType: 'jsonp',
dataType: 'json',
timeout: 20000,
complete: function(jqXHR, textStatus) {
if (textStatus == 'timeout') {
Expand Down Expand Up @@ -39,4 +39,4 @@ function loadImagesTab() {
}
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class AdminController {

def search = {
// use bie search and filter results
def url = grailsApplication.config.biocacheServicesUrl + "search.json?q=" + params.term.encodeAsURL() + "&pageSize=1000"
def url = grailsApplication.config.biocacheServicesUrl + "search?q=" + params.term.encodeAsURL() + "&pageSize=1000"

def conn = new URL(url).openConnection()
try {
Expand Down
93 changes: 30 additions & 63 deletions grails-app/controllers/au/org/ala/collectory/DataController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -225,42 +225,31 @@ class DataController {
* @param pg - optional instance specified by uid (added in beforeInterceptor)
* @param json - the body of the request
*/
// NOTE - Sine the same method below saveEntity is used for saving and updating an entity - OpenAPI specs for both save and update operations cannot be added on Code.
// API Gateway handles the below by using the {entity+} wildcard but for swagger specs in the documentation portal. additional spec has been added for just the /{entity} path - which allows Inserting of an entity
@Operation(
method = "POST",
tags = "collection, institution, dataProvider, dataResource, tempDataResource, dataHub",
operationId = "saveEntity",
operationId = "updateEntity",
summary = "Insert or update an entity",
description = "Insert or update an entity - if uid is specified, entity must exist and is updated with the provided data",
parameters = [
@Parameter(
name = "entity",
in = PATH,
description = "entity e.g. datResource, dataProvider etc",
description = "entity i.e. collection, institution, dataProvider, dataResource, tempDataResource, dataHub",
schema = @Schema(implementation = String),
example ="collection",
required = true
),
@Parameter(
name = "uid",
in = PATH,
description = "optional uid of an instance of entity",
schema = @Schema(implementation = String),
example = "co43",
required = false
),
@Parameter(
name = "pg",
in = QUERY,
description = "optional instance specified by uid ",
schema = @Schema(implementation = String),
required = false
),
@Parameter(
name = "q",
in = QUERY,
description = "restrict to associated object names that contain this value",
schema = @Schema(implementation = String),
required = false
),
@Parameter(name = "Authorization", in = HEADER, schema = @Schema(implementation = String), required = true)
)
],
requestBody = @RequestBody(
required = true,
Expand All @@ -287,26 +276,11 @@ class DataController {
@Header(name = 'Access-Control-Allow-Methods', description = "CORS header", schema = @Schema(type = "String")),
@Header(name = 'Access-Control-Allow-Origin', description = "CORS header", schema = @Schema(type = "String"))
]
),
@ApiResponse(
description = "Status of operation - updated",
responseCode = "200",
content = [
@Content(
mediaType = "application/json",
schema = @Schema(implementation = Object)
)
],
headers = [
@Header(name = 'Access-Control-Allow-Headers', description = "CORS header", schema = @Schema(type = "String")),
@Header(name = 'Access-Control-Allow-Methods', description = "CORS header", schema = @Schema(type = "String")),
@Header(name = 'Access-Control-Allow-Origin', description = "CORS header", schema = @Schema(type = "String"))
]
)
],
security = [@SecurityRequirement(name = 'openIdConnect')]
)
@Path("/ws/{entity}/{uid}?")
@Path("/ws/{entity}/{uid}")
@Produces("application/json")
def saveEntity () {
def ok = check(params)
Expand Down Expand Up @@ -409,45 +383,35 @@ class DataController {
* @param api_key - optional param for displaying any sensitive data
*/

// since this method provides response for all entity types and optionally specific instance of an entity type with the optional {uid} path param, the specs for api gateway will need to be specified with a special proxy character e.g. /ws/{entity+} to support the optional {uid} param.
// since this method provides response for all entity types and optionally specific instance of an entity type with the optional {uid} path param, the specs for api gateway will are to be specified with a special proxy character e.g. /ws/{entity+} to support the optional {uid} param.
// additional spec has also been added to swagger json file used in docs portal for /ws/{entity} to got a list of entities.
@Operation(
method = "GET",
tags = "collection, institution, dataProvider, dataResource, tempDataResource, dataHub",
operationId = "getEntity",
summary = "Get a list of entities for a data type or details of a record.",
description = "Get a summary of entities that exist for a data type or detailed information for a specific entity.",
summary = "Get an entity for a specified entity uid",
description = "Get detailed information for a specific entity",
parameters = [
@Parameter(
name = "entity",
in = PATH,
description = "entity e.g. datResource, dataProvider etc",
description = "entity type - e.g. datResource, dataProvider etc",
schema = @Schema(implementation = String),
example = "collection",
required = true
),
@Parameter(
name = "uid",
in = PATH,
description = "optional uid of an instance of entity",
description = "uid of an instance of entity",
schema = @Schema(implementation = String),
required = false
),
@Parameter(
name = "summary",
in = QUERY,
description = "false to include the summary",
schema = @Schema(implementation = Boolean),
required = false
),
@Parameter(
name = "q",
in = QUERY,
description = "restrict to associated object names that contain this value",
schema = @Schema(implementation = String),
required = false
)],
example = "co43",
required = true
)
],
responses = [
@ApiResponse(
description = "List of entities",
description = "Entity Info",
responseCode = "200",
content = [
@Content(
Expand Down Expand Up @@ -566,9 +530,6 @@ class DataController {
tags = "gbif",
operationId = "syncGBIF",
summary = "Update All registrations with GBIF",
parameters =[
@Parameter(name = "Authorization", in = HEADER, schema = @Schema(implementation = String), required = true)
],
responses = [
@ApiResponse(
description = "Status of GBIF sync operation",
Expand Down Expand Up @@ -734,27 +695,31 @@ class DataController {
in = PATH,
description = "Id of the field",
schema = @Schema(implementation = String),
example = "dr368",
required = true
),
@Parameter(
name = "start",
in = QUERY,
description = "starting index for associated objects",
schema = @Schema(implementation = Long),
example = "0",
required = false
),
@Parameter(
name = "pageSize",
in = QUERY,
description = "number of associated objects to return",
schema = @Schema(implementation = Long),
example = "1",
required = false
),
@Parameter(
name = "q",
in = QUERY,
description = "restrict to associated object names that contain this value",
schema = @Schema(implementation = String),
example ="Environment",
required = false
)
],
Expand Down Expand Up @@ -902,9 +867,9 @@ class DataController {
in = PATH,
description = "contact identifier value",
schema = @Schema(implementation = String),
example = "31",
required = true
),
@Parameter(name = "Authorization", in = HEADER, schema = @Schema(implementation = String), required = true)
],
responses = [
@ApiResponse(
Expand Down Expand Up @@ -1009,9 +974,9 @@ class DataController {
in = PATH,
description = "contact identifier value",
schema = @Schema(implementation = String),
example = "31",
required = true
),
@Parameter(name = "Authorization", in = HEADER, schema = @Schema(implementation = String), required = true)
],
requestBody = @RequestBody(
required = true,
Expand Down Expand Up @@ -1307,25 +1272,27 @@ class DataController {
@Parameter(
name = "entity",
in = PATH,
description = "entity an entity type in url form ie one of collection, institution, dataProvider, dataResource, dataHub",
description = "metadata entity type i.e. collection, institution, dataProvider, dataResource, dataHub",
schema = @Schema(implementation = String),
example = "collection",
required = true
),
@Parameter(
name = "uid",
in = PATH,
description = "uid the entity instance",
schema = @Schema(implementation = String),
example = "co43",
required = true
),
@Parameter(
name = "id",
in = PATH,
description = "contact identifier value",
schema = @Schema(implementation = String),
example = "844",
required = true
),
@Parameter(name = "Authorization", in = HEADER, schema = @Schema(implementation = String), required = true)
],
requestBody = @RequestBody(
required = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ class GbifController {
in = PATH,
description = "provider uid",
schema = @Schema(implementation = String),
example = "1",
required = true
),
@Parameter(name = "Authorization", in = HEADER, schema = @Schema(implementation = String), required = true)
],
responses = [
@ApiResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import io.swagger.v3.oas.annotations.Parameter
import io.swagger.v3.oas.annotations.headers.Header
import io.swagger.v3.oas.annotations.media.Content
import io.swagger.v3.oas.annotations.media.Schema
import io.swagger.v3.oas.annotations.parameters.RequestBody
import io.swagger.v3.oas.annotations.responses.ApiResponse
import io.swagger.v3.oas.annotations.security.SecurityRequirement

Expand Down Expand Up @@ -56,29 +57,47 @@ class IptController {
operationId = "scanIpt",
summary = "Scan an IPT instance described by a data provider id",
description = "Scan an IPT instance described by a data provider id",
requestBody = @RequestBody(
content = [
@Content(
mediaType = "application/json",
schema = @Schema(implementation = ArrayList)
),
@Content(
mediaType = "test/xml",
schema = @Schema(implementation = ArrayList)
),
@Content(
mediaType = "text/plain",
schema = @Schema(implementation = ArrayList)
)
]
),
parameters = [
@Parameter(
name = "uid",
in = PATH,
description = "provider uid",
schema = @Schema(implementation = String),
example = "dp1518",
required = true
),
@Parameter(
name = "create",
in = QUERY,
description = "Boolean flag to determine whether to update existing datasets and create data resources for new datasets",
schema = @Schema(implementation = Boolean),
example = "false",
required = false
),
@Parameter(
name = "check",
in = QUERY,
description = "Boolean flag to check to see ifresource needs updating by looking at the data currency",
schema = @Schema(implementation = Boolean),
example = "true",
required = false
),
@Parameter(name = "Authorization", in = HEADER, schema = @Schema(implementation = String), required = true)
],
responses = [
@ApiResponse(
Expand Down
Loading

0 comments on commit 7d022cb

Please sign in to comment.