Skip to content

Instantly share code, notes, and snippets.

@vahidhedayati
Created October 17, 2016 22:42
Show Gist options
  • Save vahidhedayati/1df1597662065931b2083adfbdda0a54 to your computer and use it in GitHub Desktop.
Save vahidhedayati/1df1597662065931b2083adfbdda0a54 to your computer and use it in GitHub Desktop.
compileStatic - config this way
@CompileStatic
class QueuekitLists {
////
/**
* Retrieve configuration value of reportPriorties
* this should be a list containing key value e.g: ReportName:Priority.HIGH
*
* Assign report priority back if not set to DEFAULT LOW
*/
static Priority sortPriority(String reportName) {
Priority priority = Priority.LOW
Priority configProp =getConfigPriority(reportName)
if (configProp) {
priority = configProp
}
return priority
}
static Priority getConfigPriority(String reportName) {
return (getConfig('reportPriorities') as Map).find{k,v-> k==reportName}.value as Priority
}
static def getConfig(String configProperty) {
Holders.grailsApplication.config.queuekit[configProperty] ?: ''
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment