groovy

Hibernate: @UniqueConstraint with @ManyToOne field???

Dear All: Using the following code: @Entity @Table(uniqueConstraints=[@UniqueConstraint(columnNames=["account","name"])]) class Friend { @Id @GeneratedValue(strategy=GenerationType.AUTO) public Long id @ManyToOne public Account account public String href public String name } I get the following error: org.hibernate.Anno...

Groovy markupbuilder tags

Is there a way to modify the code from a previous answer import groovy.xml.MarkupBuilder def writer = new StringWriter() def builder = new MarkupBuilder(writer) def awaiting = ['one', 'two', 'three'] builder.html { ul { awaiting.each { li(it.toString()) } } } println writer.toString() so that i...

Printing out variables and values in a Groovy object

How can I print out the (public and internal) variables and their values of a Groovy object? I.e class X { def X = 10 def Y = 5 private void doPrivate() { def Z = 3 } } Should give X, 10 Y, 5 Z, 3 This has to be a dynamic solution, i.e at runtime. ...

what is used for 'createCriteria' to specify the contains group.

I'm just wondering if it's possible for 'createCriteria' to specify the contains group similar to CharIndex('P', Channel) <> 0 I am using eq and get exact match but what should i use in i need to get all the records which contains channel similar to IN("channel",('a','b','c','d')) def c = Load.createCriteria() def results = c { ...

Groovy Bindable default value????

Dear All: I would like to have a text field whose value always reflects that of a certain field in a given object. I thought Bindable might be the way to do this. However, using the following example: #!/usr/bin/env groovy import groovy.swing.SwingBuilder import groovy.beans.Bindable import static javax.swing.JFrame.EXIT_ON_CLOSE cla...

Groovy 'as' keyword to implement 2+ interfaces

Dear All: I would like to implement a Glazed List that has both an AdvancedTableFormat and WritableTableFormat interface. I am reading here: http://www.jroller.com/aalmiray/entry/glazedlists_groovy_not_your_regular and for one interface it seems this is possible in Groovy with the "as" keyword: # return new EventTableModel(linksList,...

Grails/Groovy problem with XmlSlurper .. help ..

Using grails 1.2.2 with groovy 1.6.8 .. Reading a a web service and trying to process response .. Response is shown below and validates as correct xml .. (sorry for length) .. <soap:Body> <AddProductEventResponse xmlns="http://tempuri.org/"&gt; <AddProductEventResult> <xs:schema id="AddProductEventResult" xmlns=""...

Restrict some API in Embedded Groovy

Hello, I just embedded Groovy in my application and wondering if it's possible to restrict access to some APIs i.e. java.io.File, java.net.URL, etc Or instead of completely restricting java.io.File access, I want to ONLY allow access to certain directories on the machine. Any guidance is greatly appreciated! ...

'ls -l' in groovy

I need to display name, size, date of files using ls -l unix command in groovy . How can we run ls -l in groovy to view info ? thanks in advance. ...

Will groovy (grails) give you compile time checking like java?

Will groovy (grails) give you compile time checking like java? If you always specify the type, will that change things much? ...

Pre-populating input in Java console

I'm making a console-based Java/Groovy application that does a lot of find/replaces in text files. If, say, the program knows you replaced foo with bar last time, it should by default know you probably want to replace the next foo with bar as well. My idea was to pre-populate the input field of the What would you like to rename this to? ...

Execution of Groovy code in java at runtime.

Is it possible to execute groovy code dynamically loaded in java application. For example there is a database table which contains small pieces of groovy code, like: def test(${val_to_insert_from_java}){ if (${val_to_insert_from_java} > 10){ return true; } return false; } Where ${val_to_insert_from_java} is a place...

how to seperate List elements with commas in groovy

def names = ["myname", "yourname", "theirname", "allnames"] String n = "" names.each{ n += it + "," } println n Output: myname,yourname,theirname,allnames, How do I get rid of the leading comma ...

is it still advisible to use eclipse/intellij for grails development?

one thing I hate about java development are their IDE's, and configuration/setup involved to initially get going. does grails have these issues? from the looks of it, it seems you need a command line open and then any text editor will do. (apart from a mysql and tomcat install). are these assumptions correct or its better to get eclips...

Why am I getting stuck making IN query with Groovy to run against Oracle.

I'm trying to make an in statement with values coming from DB and then use them in another query. DB is Oracle Example: I've been beating my head around this for quite some time now. I need some help: Groovy Code: def myList = [] def myQuery = "select USER_ID from USER_TABLE where rownum < 3" println myQuery sql_dw.eachRow(myQuery) {...

XmlSlurper namespaces not being used

I have an XML template document: <TriadMessage xmlns="http://www.myco.com/02/11/2008/V1/TriadMessage.xsd" xmlns:triad="http://www.myco.com/02/11/2008/V1/TriadTypes.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <TriadRouteInfo> <triad:RoutingCorrelationId>new value goes here</triad:RoutingCorrelationId...

I have a bunch of data and I need a data filter using Grails

Hello there, I am trying to make a filter for my data so other people can see it, lets say I have a bunch of Events, like a calendar, and I want to see all that have a name or title with the word "Soccer". I've been trying to figure out how to do it but nothing works for me, I also tried to use filterPane plugin but did not work quite a...

soapUI: Revalidate (recorded) Request/Response pair

Is there a way to record a response (even non permanently during one "test-session") in a way that I can use an assertion like "please validate that the (new) response is exactly like this (old recorded) one". The use case is a regression test for changes which apply to several web services, which then have to be retested to be sure ther...

[grails] JSON converter - stack overflow

Hi all, I'm trying to convert a domain class into JSON. def converter = null try{ converter = events as JSON } catch(e) { log.error "error during conversion to JSON" log.error e } return converter.toString() I always get this error: org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Executin...

Grails: filter data in a Grails table dynamically

I have a table, with a series of events, name of my class is Entry. Here is a picture of my table is in Spanish, but the basics are the same so it shouldn't be a problem. (the filter HTML code is not yet so its a mess but it works) and here are the results that I get when I look for the entry. Now my problem is that I need the resu...