groovy

Grails Scaffolding Default Date

Hello, I'm using Grails scaffolding and would like to make a change in the default date during a create. Currently dates default to today's date. How would one default it to blank or no date? Thanks, Steve ...

sorting problem with multiple joins

I have a problem getting sorting to work with multiple joined tables. For example: class Account { static hasMany = [subscriptions: Subscription] static mapping = { subscriptions fetch: 'join' subscriptions sort: 'magazine' } } class Subscription { static belongsTo = [account:Account, magazine: Magazine] static m...

Grails: How to create a clear button?

Hello I have created a filter for my list. In a template named _search.gsp And I need a clear button that clears out all the fields in the filter. I have one textField named proyectoRutaN And four datePickers named fechaCambioD , fechaCambioH , lastUpdatedD, and lastUpdatedH Any help would be greatly appreciated! Thanks! -Fernando ...

Convert String or String[] to List with Groovy

I have a multiple select variable posting to controller. The way multiple select works is that it is passed as a single String if there was only one value selected and as a String[] if more than one values selected. I want to keep processing simple and treat the passed value(s) the same. So the best way I can up with is to convert it to ...

Hiding base class methods in code completion in Intellij?

Does Intellij have any way of customizing the filtering the methods that are displayed for code completion? For instance, if I have a class that implements a Collection, there are a large number of methods that will be displayed when hitting Ctrl-Space or Ctrl-Shift-Space. I would like to be able to code complete only have the methods ...

Experiences using Groovy++ in Grails

Hi, has anybody tried to implement a Grails solution having Groovy++ under the hood ? ...

Mapping complex datatypes to model classes (SOAP)

I'm writing SOAP web service tests in Groovy/soapUI (the web service heavily takes advantage of complex datatypes). To make my life easier I'm looking for solutions to map complex datatypes to model classes in Groovy. Are there any automated solutions for this task, or do I need to write my own conversions? I'm relatively new to SOAP an...

Using XML for dynamic contraints in Grails

I am trying to dynamically populate the static constraint ={} at run time. Is there a way to do this. Example code: Normal statement: static constraint = { lastName(blank:false, maxSize: 100) } What I am trying to do: static constraint = { call to an XMLSlurper that returns a HashMap of lastName as a key and (blank: false, maxSize:...

How to use Grails Dependency cache in IDE?

Is there a way to use the ivy cache grails dependency DSL creates within an IDE like eclipse or netbeans? Or must I manually add all dependencies to the IDE lib folder? I've looked into plugins like ivybeans and ivyde, but they seem to require ivy.xml and ivysettings.xml files, which grails does not produce. ...

Writing user defined SQL functions for SQLite using Java or Groovy?

With SQLite, user defined SQL functions can easily be added using the C api or PHP. But is it also possible using Java or Groovy? ...

Problems consuming web service from groovy script

Hello, I'm having some problems trying to consume a web service from a groovy script. I'm using WSClient lib. If I execute the example posted at groovy's website: @Grab(group='org.codehaus.groovy.modules', module='groovyws', version='0.5.2') import groovyx.net.ws.WSClient proxy = new WSClient("http://www.w3schools.com/webservices/tem...

Groovy BigInteger to string

I am using i = value.toBigInteger() i.toString(32).toUpperCase() to convert a 16 digit 'number' to characters for use in a serial Is there any way to force this to use the A-Z + 2-7 notation rather than 0-9 + A-V?? ...

Groovy to Biginteger

As the reverse of i.toString(32) is there a better (i.e. working) method to use instead of i = Integer.parseInt(string, 32) to create a BigInteger, as the string I want to pass is 11 'characters' long? (D4KJI9QLC3L) gives me java.lang.NumberFormatException: For input string: "D4KJI9QLC3L" Parameters:{val=14800099002200181, str=D4KJI9...

Groovy/Grails JSON converting of complex objects and collections.

I have following mapping representing categories tree: class Category { String name static belongsTo = [parent: Category] static hasMany = [categories: Category] } The thing I want to do is to render all of the category tree and exclude field parent from rendering. render category as JSON renders only first level of hiera...

Creating a Grails URLMapping for all methods in a controller?

How do I create a urlmapping that maps controller A essentially as controller B? I thought something like this would work, but no dice. "/my/"(controller: 'other', action: '*') ...

CRC-16-ANSI library for for Java/Groovy?

I need to compute the CRC-16 for arbitrary strings in a mixed java/groovy application. Specifically, I need the CRC-16-ANSI aka CRC-16-IBM variant (see http://en.wikipedia.org/wiki/Cyclic_redundancy_check for details; this is the modbus / USB version.) I could implement my own, but I'd much rather find a library out there that someone ...

Grails: test domain object constraints

Hi, I'm trying to test the constraints of my User domain class class UserTests extends GrailsUnitTestCase { protected void setUp() { super.setUp() mockForConstraintsTests(User) } void testEmailConstraint() { // Test e-mail validation def user = new User(userRealName: 'bob', passwd: 'foo') ...

groovy truncate and round

How to truncate string in groovy I used : def c = truncate("abscd adfa dasfds ghisgirs fsdfgf", 10) but getting error . thanks in advance . ...

Groovy Power Print

Groovy has a power assert, but I'd like a power print. For example, def foo = 'banna5', monkey=7, x=70 println "foo=$foo, monkey=$monkey, x/2=${x/2}" See the repeating foo, monkey, and expression in the println line... what I want to type is this, pprint foo, monkey, x/2 This is the output I expect (from either println or pprintln...

binding and closures groovy

I dont know how to use binding with closures in grooy.I wrote a test code and while running it, it said, missing method setBinding on the closure passed as parameter. void testMeasurement() { prepareData(someClosure) } def someClosure = { assertEquals("apple", a) } void prepareData(testCase) { def binding = new Binding() ...