service.@date -> service.getLocalDate because direct field accessor isn't working properly anymore.
This commit is contained in:
@ -16,7 +16,7 @@ public class Service implements Serializable {
|
||||
Service that = (Service) thatObj
|
||||
|
||||
return (this.id == that.id &&
|
||||
this.date == (that.rawDate) &&
|
||||
this.date == (that.locaDate) &&
|
||||
this.serviceType == that.serviceType) }
|
||||
|
||||
public void setDate(Date date) { this.date = LocalDate.fromDateFields(date) }
|
||||
@ -29,5 +29,5 @@ public class Service implements Serializable {
|
||||
|
||||
// Needed only because the @directFieldAccesor syntax stopped working in
|
||||
// Groovy 2.4.7
|
||||
private LocalDate getRawDate() { return this.date }
|
||||
private LocalDate getLocalDate() { return this.date }
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ public class NLSongsContext {
|
||||
public static String mediaBaseUrl
|
||||
|
||||
public static String makeUrl(Service service, Song song) {
|
||||
return mediaBaseUrl + '/' + service.@date.toString('yyyy-MM-dd') + '_' +
|
||||
return mediaBaseUrl + '/' + service.localDate.toString('yyyy-MM-dd') + '_' +
|
||||
service.serviceType.name().toLowerCase() + '_' +
|
||||
song.name.replaceAll(/[\s'"\\\/\?!]/, '') + '.mp3' }
|
||||
}
|
||||
|
@ -21,23 +21,28 @@ public final class NLSongsContextListener implements ServletContextListener {
|
||||
|
||||
Properties props = new Properties()
|
||||
|
||||
// Load database details from the context configuration.
|
||||
String contextConfigFile = context.getInitParameter('context.config.file')
|
||||
if (contextConfigFile) {
|
||||
NLSongsContextListener.getResourceAsStream(contextConfigFile)
|
||||
.withStream { is -> props.load(is) } }
|
||||
// Load configuration details from the context configuration.
|
||||
NLSongsContextListener.getResourceAsStream(
|
||||
context.getInitParameter('context.config.file'))
|
||||
.withStream { is -> props.load(is) }
|
||||
|
||||
// Load database configuration
|
||||
Properties dataSourceProps = new Properties()
|
||||
String dbConfigFile = context.getInitParameter('datasource.config.file')
|
||||
|
||||
if (dbConfigFile) {
|
||||
NLSongsContextListener.getResourceAsStream(dbConfigFile)
|
||||
.withStream { is -> dataSourceProps.load(is) } }
|
||||
|
||||
// Load database configuration from environment variables (may
|
||||
// override settings in file).
|
||||
def env = System.getenv()
|
||||
env.keySet().findAll { it.startsWith('DB_') }.each { key ->
|
||||
props[key.substring(3)] = env[key] }
|
||||
System.properties.keySet().findAll { it.startsWith('DB_') }.each { key ->
|
||||
dataSourceProps["dataSource.${key.substring(3)}"] = System.properties[key] }
|
||||
|
||||
log.debug("Database configuration: {}", props)
|
||||
log.debug("Database configuration: {}", dataSourceProps)
|
||||
|
||||
// Create the pooled data source
|
||||
HikariConfig hcfg = new HikariConfig(
|
||||
context.getInitParameter('datasource.config.file'))
|
||||
HikariConfig hcfg = new HikariConfig(dataSourceProps)
|
||||
|
||||
HikariDataSource hds = new HikariDataSource(hcfg)
|
||||
|
||||
|
Reference in New Issue
Block a user