groovy

Java/Groovy Rails Database Migrations

Is there a tool in the Java/Groovy world that lets me manage database changes similar to the way that Rails Database Migrations work? ...

Ruby to Groovy

I have a framework written in Ruby that needs to be converted into Groovy. It does not use anything outside of core ruby, but a lot of meta programming. Are all the same basic features supported by Groovy and is the changeover complicated? ...

grails web flow exception handling

Hi, In my Grails app, I have defined the following (simplified) web flow def registerFlow = { start { action {RegistrationCommand cmd -> try { memberService.validateRegistrationCommandDTO(cmd) } catch (MemberException ex) { flow.regErrorCode = ex.err...

Gantt Chart - JavaScript / JSP / Java / Groovy / Grails

I'm looking to add the ability to create a gantt chart to my web application. Currently my application is Grails based running on Tomcat. Research around SO seems to indicate that JFreeChart (http://www.jfree.org/jfreechart/) and Google Charts both might provide me with the ability to create charts that I could mold into what I need. B...

Is there a way to plan and diagram an architecture for dynamic scripting languages like groovy or python?

Say I want to write a large application in groovy, and take advantage of closures, categories and other concepts (that I regularly use to separate concerns). Is there a way to diagram or otherwise communicate in a simple way the architecture of some of this stuff? How do you detail (without verbose documentation) the things that a map ...

Call C API from Groovy

I know that is better to use Python to call Posix and Win API, but I would like to know if there is a not so painful way to call C APIs from Groovy, or at least with Java. ...

Finding a coordinate in a circle

I am doing a mashup using Google Maps under Grails where users can create geofences by selecting a point on the map and a radius. This get stored on my database and the application receives constantly a set of coordinates from a GPS device. I would like to compare the received coordinates with the area stored in the circles. If the poin...

Unit testing Abstract classes in Groovy

I am new to unit testing and mocking. I am trying to unit test an abstract domain class in Grails. How should I mock an implementation so I can unit test the constraints of the domain class? Is there a way to use the mock libraries that come with groovy or grails? Should I just implement a class that simply extends the abstract class? ...

mockForConstraintsTests abstract groovy class

Unit testing Abstract classes in Groovy I asked a question previous about unit testing and mocking a domain class, but I do not think I was specific enough. I have a domain class: package toplevel.domain abstract class Party { static hasMany = [roles:PartyRole] static constraints = { roles(nullable:true) dateCr...

How to catch error in addToTag() [grails]

Hi, I have 2 domains .. master and details. Master{ String masterName; static hasMany=[details:Detail] } Detail { String detailName ; static belongsTo =[master:Master]; } I have form that handle the save def save = { ..... def master = new Master(params); params.detailsName.eachWithIndex(dtName, index -> def detail =...

getting strange stacktrace on compiling groovy class

I'm coding a small test app in Groovy. I have the following code. class Address { static constraints = { street(blank:false, maxSize:100) residencenumber(min:1, max:65000) addition() zip() city(blank:false, maxSize:100) county() country(blank:false, maxSize:50) } String street String zip int residencenumber...

How to determine the pixel size of text using Groovy's GraphicsBuilder module?

If I am drawing images using Groovy's GraphicsBuilder, how do I determine the size of the text I am drawing? I could use Java's FontMetrics class but it requires a Graphics object and I'm not sure how to obtain one when using GraphicsBuilder. ...

Is Gant 100% Ant compatible?

I wrote some Groovy code, and I'd like to integrate it with the existing Java code. We'd like to be able to keep our ant scripts, and only add the needed Groovy functionality. Will Gant allow us to keep our existing scripts? ...

Best way to create an Admin section in Grails

Hy, I'm wondering what's the best way to create an Admin (backend) section in a Grails app ? I want to create an Admin folder in the Controllers folder of Grail to put all my admin controllers. But Then will I have to create manually the URL mapping for each Admin controllers ? I have already generate all my frontend gsp with the ge...

Retrieve id of last inserted object in groovy

I am importing raw data in groovy, hundreds of thousands of entries. I use the table fields as the keys of a hash map and then use the add(hash) method on a groove sql Dataset. The Dataset goes to a postgres table and the ID field is autogenerated from a sequence. I need to get the ID of each record as it is inserted. In java + hiberna...

why collection [Person.companies] was not processed by flush() when using session ?

Hi, I am using grails 1.1.1 and i got this error collection [Person.companies] was not processed by flush() the configuration is as follow: Person domain has many companies (Company domain) while Company belongsTo Person then in the controller I did like this def person = session.person ; def jobs = Job.findByPerson(person); job...

log4j in grails : how to log into file ?

hi, I have this log4j configuration in my grails config.groovy log4j = { error 'org.codehaus.groovy.grails.web.servlet', // controllers 'org.codehaus.groovy.grails.web.pages' // GSP warn 'org.mortbay.log' appenders { rollingFile name:'infoLog', file:'info.log', threshold: org.apache.log4j....

Trouble calling a MS SQL Stored Procedure with OUT Parameter using Groovy

When calling this MS-SQL stored procedure: CREATE PROCEDURE [dbo].[AddUser] @networkID varchar(512), @id uniqueidentifier OUTPUT .... With this Groovy code: networkAliasID = 'aschoewe_test' sql.call("{call AddUser(?, ${Sql.VARCHAR}) }", [networkAliasID]) { s -> println "userID: ${s}" } I receive this error: java.sql.S...

Error in Grails

Anyone knows how to fix this ? It works fine on my env (Me being the developer) and doesn't work on my colleagues machine who unzips the whole Welcome to Grails null - http://grails.org/ Licensed under Apache Standard License 2.0 Grails home is set to: C:\abc\products\grails-1.1 Base Directory: C:\abc\products\foo\bar Running script C...

How do I get Groovy and JAXB to play nice together

I am trying to get JAXB to work with a groovy class of mine, however, it appears it doesn't work but the java version does. Here is the code... Here are the Scenarios if 2 and 3 are uncommented it works fine if 1 and 4 are uncommented I get... com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of Illeg...