gpc / joda-time Goto Github PK
View Code? Open in Web Editor NEWA plugin that Integrates the Joda Time date/time library into Grails
Home Page: http://gpc.github.com/joda-time
License: Apache License 2.0
A plugin that Integrates the Joda Time date/time library into Grails
Home Page: http://gpc.github.com/joda-time
License: Apache License 2.0
The current plugin descriptor seem to have wrong urls for documentation, issue management, etc. in it.
It is currently very hard to figure out how to configure the plugin in Grails 3.
Documentation URL does not exist (Should this point to https://gpc.github.io/joda-time/latest/ instead?):
def documentation = "http://grails.org/plugin/grails-joda-time"
Issue Management URL is outdated and does not exist anymore (GH issues instead?):
def issueManagement = [system: 'JIRA', url: 'http://jira.grails.org/browse/GPJODATIME']
Not sure why this happens, but when I installed grails SAML plugin for SSO it broke joda-time to work.
SSO plugin http://docs.spring.io/spring-security-saml/docs/1.0.x/reference/html/index.html
joda-time version 1.4
grails verstion 2.0.3
exception I got is the following:
/<APP_NAME>/order/entry
Class
groovy.lang.MissingMethodException
Message
No signature of method: static org.joda.time.DateTime.now() is applicable for argument types: (org.joda.time.tz.CachedDateTimeZone) values: [America/New_York] Possible solutions: era(), next(), any(), get(org.joda.time.DateTimeField), get(org.joda.time.DateTimeFieldType), get(org.joda.time.DateTimeFieldType)
I created a simple app to illustration my issue : https://github.com/bdbogjoe/jodatime-binary
After starting app, open H2 db with any SQL browser and you can see that columns are binary in Child table
Other columns in Main or Sample are ok
I am busy with a (long overdue) upgrade of a Grails2 app to Grails3. Part of the upgrade is maintaining the Joda Time functionality. This has likely succeeded, but with a configuration that is not documented. I am not sure if the plugin's workings have changed, or the documentation is incorrect, but I think it's worth noting.
Some facts about the app:
Joda (related) dependencies in build.gradle:
compile 'org.grails.plugins:joda-time:2.1.0'
compile "org.jadira.usertype:usertype.jodatime:1.9"
In the Grails2 app the Joda <> Hibernate mapping was in a grails.gorm.default.mapping
entry in Config.groovy. I moved this to application.groovy, which is the correct place according to this plugin's documentation (and install-mapping script). However, in the Grails3 app grails.gorm.default.mapping
does not work. What does work, is using the grails.gorm.default.constraints
entry. Like so:
grails.gorm.default.constraints = {
"user-type" type: org.jadira.usertype.dateandtime.joda.PersistentDateTime, class: org.joda.time.DateTime
"user-type" type: org.jadira.usertype.dateandtime.joda.PersistentDateTimeZoneAsString, class: org.joda.time.DateTimeZone
"user-type" type: org.jadira.usertype.dateandtime.joda.PersistentDurationAsString, class: org.joda.time.Duration
"user-type" type: org.jadira.usertype.dateandtime.joda.PersistentInstantAsMillisLong, class: org.joda.time.Instant
"user-type" type: org.jadira.usertype.dateandtime.joda.PersistentInterval, class: org.joda.time.Interval
"user-type" type: org.jadira.usertype.dateandtime.joda.PersistentLocalDate, class: org.joda.time.LocalDate
"user-type" type: org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime, class: org.joda.time.LocalDateTime
"user-type" type: org.jadira.usertype.dateandtime.joda.PersistentLocalTime, class: org.joda.time.LocalTime
"user-type" type: org.jadira.usertype.dateandtime.joda.PersistentPeriodAsString, class: org.joda.time.Period
"user-type" type: org.jadira.usertype.dateandtime.joda.PersistentYears, class: org.joda.time.Years
}
(To be clear: it works fine in the app, but it seems undocumented - at least for this version of the plugin?)
Grails 3.3.2
JDK 8
For example we have a domain User.groovy
package demoapp
import org.joda.time.LocalDate
import org.jadira.usertype.dateandtime.joda.PersistentDateTime
class User {
LocalDate dateOfBirth
static constraints = {
dateOfBirth type: PersistentDateTime
}
}
Now, when we run the following test it should pass:
void "test joda time property on persistentEntity"() {
when:
assert domain.properties != null
PersistentEntity persistentEntity = User.gormPersistentEntity
List<PersistentProperty> properties = persistentEntity.persistentProperties
then: "Joda property found on persistent entity"
properties.any {it.type == LocalDate}
}
The plugin artifact currently is named "joda-time-.jar".
Normally plugins use the convention
grails-plugin-<name>-<version>.jar
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.