Skip to content

Commit

Permalink
#275 Using Token in list deletion, instead of Api key
Browse files Browse the repository at this point in the history
  • Loading branch information
qifeng-bai committed Sep 8, 2023
1 parent 9f168a4 commit 62d935e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class HelperService {

def grailsApplication

def localAuthService, authService, userDetailsService
def localAuthService, authService, userDetailsService, webService

BieService bieService

Expand Down Expand Up @@ -107,11 +107,11 @@ class HelperService {
def deleteUrl = grailsApplication.config.collectory.baseURL +"/ws/dataResource/" + drId
def http = new HTTPBuilder(deleteUrl)
http.getClient().getParams().setParameter("http.socket.timeout", new Integer(5000))
try {
http.setHeaders([Authorization: "Bearer ${webService.getTokenService().getAuthToken(false)}"])

try {
http.request(Method.DELETE) {
requestContentType = ContentType.JSON
headers."Authorization" = "${grailsApplication.config.registryApiKey}"
response.success = { resp ->
def result = (resp.getEntity() != null ? EntityUtils.toString(resp.getEntity()) : "")
log.info("${drId} has been deleted from ${grailsApplication.config.collectory.baseURL} with ${result}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ class QueryService {
"group by kvp.key, kvp.value, kvp.vocabValue, kvp.itemOrder, kvp.key order by kvp.itemOrder, kvp.key, cnt desc",
queryParameters)
def timeStop = new Date()
log.info("Query KVP of " + fqs + "took " + TimeCategory.minus(timeStop, timeStart))
log.info("Query KVP of ${fqs} took " + TimeCategory.minus(timeStop, timeStart))

//obtain the families from the common list facets
def commonResults = SpeciesListItem.executeQuery("select sli.family, count(sli) as cnt from SpeciesListItem sli " +
Expand All @@ -861,7 +861,7 @@ class QueryService {
'group by kvp.key, kvp.value, kvp.vocabValue, kvp.itemOrder order by kvp.itemOrder, kvp.key, cnt desc',
queryParameters)
def timeStop = new Date()
log.info("Query KVP of " + id + "took " + TimeCategory.minus(timeStop, timeStart))
log.info("Query KVP of ${id} took " + TimeCategory.minus(timeStop, timeStart))
properties = results.findAll{it[1].length()<maxLengthForFacet}.groupBy{it[0]}.findAll{it.value.size()>1 }
//obtain the families from the common list facets
def commonResults = SpeciesListItem.executeQuery('select family, count(*) as cnt from SpeciesListItem ' +
Expand Down

0 comments on commit 62d935e

Please sign in to comment.