Skip to content

Commit

Permalink
Add minor checks and example configuration comment for processComplet…
Browse files Browse the repository at this point in the history
…eNoInteraction (#274)
  • Loading branch information
philboeselager committed Aug 11, 2020
1 parent 8b52d7e commit 023d5e1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
27 changes: 27 additions & 0 deletions grails-app/controllers/ygor/EnrichmentController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,33 @@ class EnrichmentController implements ControllersHelper{
}


/**
* Current Test configuration via Postman:
*
* POST /ygor/enrichment/processCompleteNoInteraction?
* formatDelimiter=null&
* formatQuote=null&
* formatQuoteMode=null&
* recordSeparator=null&
* addOnly=false&
* processOption=kbart,zdb,ezb&
* gokbUsername=<aValidGokbUser>&
* gokbPassword=<theUser'sPassword>&
* pkgTitle=<yourPackageTitle>&
* pkgIsil&
* pkgCuratoryGroup=<yourCuratoryGroupName>&
* pkgNominalProvider=Organisation for Economic Co-operation and Development&
* pkgNominalPlatform=org.gokb.cred.Platform:408671;OECD UN iLibrary
*
* (examples given for pkgNominalProvider and pkgNominalPlatform)
*
* HTTP/1.1
* Host: localhost:8092
* cache-control: no-cache
* Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
*
* Content-Disposition: form-data; name="uploadFile"; filename="yourKBartTestFile.tsv"
*/
def processCompleteNoInteraction = {
CommonsMultipartFile file = request.getFile('uploadFile')
if (file == null){
Expand Down
6 changes: 4 additions & 2 deletions grails-app/services/ygor/EnrichmentService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ class EnrichmentService{
enrichment.dataContainer.pkgIdNamespace = (pm['pkgIdNamespace'][0])
}
def platform = getPlatform(pm)
applyPlatformToPackageHeader(platform, ph)
if (platform != null){
applyPlatformToPackageHeader(platform, ph)
}
if (pm['pkgNominalProvider']){
ph.nominalProvider = pm['pkgNominalProvider'][0]
}
Expand All @@ -90,7 +92,7 @@ class EnrichmentService{
private def getPlatform(Map pm){
log.debug("Getting platforms for: ${pm['pkgNominalPlatform'][0]}")
def platformSplit = splitPlatformString(pm['pkgNominalPlatform'][0])
if (platformSplit == null){
if (platformSplit == null || platformSplit.size() != 2){
log.error("Could not split platform string.")
return
}
Expand Down

0 comments on commit 023d5e1

Please sign in to comment.