groovy

add reminder to Google Calendar

I have worked out how to add a reminder after setting a CalendarEventEntry using insertedEntry = myService.insert( postUrl, myEntry ) reminder = new Reminder() reminder.setMethod( Reminder$Method.ALERT ) //foo insertedEntry.getReminder().add( reminder ) insertedEntry.update() but if you update it becomes an EventEntry and the getRemi...

Groovy How can change an XmlParser to an xml format?

HI, I've used XmlParser to can change the attributes of some nodes in my xml file. Some code: def temp = groovyUtils.getXmlHolder( "testAddress CUY#ResponseAsXML") def aux = temp.getXml(); def lang = new XmlParser().parseText(aux) lang.prov[0].description[0].setValue('newDesciption') After doing that I have something like " root[at...

Grails - How to - Unit test Service that uses params from controller

Hi, I'm trying to unit test a service method that takes as parameters a date and the params LinkedHashMap from the controller. The setup is as follows: def save = {CustomCommandObject erc -> ... if (erc.conditionProperty != null) { def result = myService.ServiceMethod(someDate, params) ... } .... redirect(co...

Speed of Groovy XML Slurping

We're starting to investigate a project that requires a tricky bit of XML parsing. I like the look of Groovy's XmlSlurper (Groovy appears to be my Golden Hammer of choice at the moment). We'll need to process a pretty wide range of XML inputs and Groovy's dynamic nature might just let us work out a neat, concise solution. We'll see. A ...

how do I get the username of the user who started a build in hudson

I'm using the groovy post build plugin. http://wiki.hudson-ci.org/display/HUDSON/Groovy+Postbuild+Plugin I'd like to access the username of the user who started the build. What is the correct variable for this? ...

Difference between Groovy def and Java Object?

I'm trying to figure out the difference between Groovy: def name = "stephanie" Java: Object name = "stephanie" as both seem to act as objects in that to interact with them i have to cast them to their original intended type. I was originally on a search for a java equivalent of C#'s dynamic class ( http://stackoverflow.com/quest...

Groovy: remove and object from a list within itself?

I'm trying to remove objects from a list when it finds that particular objects privacy is private to the current user books.eachWithIndex{ obj, i -> if((obj.book.private).equals(true)){ def status = bookService.getBookStatus(obj.book) if(!status){ books.remove(i) } } ...

Regex to remove \" from a Groovy GString?

Hi, I'm trying to parse a JSON using Grails, to test the parser I Wrote an unit test and put my input JSON in a GString that looks something like this: """{"Information":"Some data here \"stuff\" some more.","AnswerToEverything":42,"Other":71,"Name":"Joe Doe"}""" The \"stuff\" is causing the parser to break. I tried using String.rep...

Stylesheet in Grails Feeds Plugin

trying to include stylesheet in grails plugin, any suggestion in how to implement with plugin or do I just need to write my own feed code? ...

Verifying Java Class Library in Netbeans 6.9.1

I am new to java and to netbeans so my apologies if this is a simple question. I made a 'Java Class Library' Project in Netbeans 6.9.1 I added a few classes to it and hit 'Build'. It builds with no errors. However the problem is I know there are errors. It seems as though I can make up class names and hit build and it doesnt provide m...

Problem with Gant

Hello, I am new to Gant. I was trying Ant.echo("hello gant") but I am getting this error message: No such property: Ant for class: build Any help would be highly appreciated. ...

where are grails libs specified

Hi, I recently upgraded a project to Grails 1.3.5. This deleted everything in the /lib dir, though the project continues to work, so I guess the way dependencies are specified (and the location they're stored) has changed. I want to remove some libs that I'm no longer using, but can't do this until I find where the dependencies are spec...

Grails (Hibernate) Criteria query

Hi, I have a domain class in my Grails app that looks like this: class Event { Date date } I want to write a criteria query that selects events that occurred in a certain month of a certain year, any suggestions? Thanks, Don ...

Groovy : get a list of all the files in a directory (recursive)

Newbie question: I'm trying to get (not print , that's easy) the list of files in a directory and it's sub directories. I've tried: def folder = "C:\\DevEnv\\Projects\\Generic"; def baseDir = new File(folder); files = baseDir.listFiles(); but I only get the dirs. I've also tried def files = []; def processFileClosure = { ...

Groovy in SOAPUI , Parsing of xml using xmlSlurper()

I want to Parse the xml by using the XmlSlurper() method In Groovy using SOAPUI. I need to display each text inside the tags and update it different values in the next request please provide the coding snippet to do so... ...

Match several occurrences or zero (in this order) using regular expressions

Hello all, I want to match roman numbers using Groovy regular expressions (I have not tried this in Java but should be the same). I found an answer in this website in which someone suggested the following regex: /M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})/ The problem is that a expression like /V?I{0,3}/ is not greedy in ...

Groovy criteria query

Hi, I have a domain model that looks like this Category 1 ------- * Type 1 ------- * Expense Or in English "An expense has a type, and each type belongs to a category". I want to write a Criteria query that will find all expenses in a particular category. I tried both this Expense.withCriteria { eq('type.category', someCategoryI...

DataIntegrityViolationException when I change a List variable to ArrayList

I have a grails project that is throwing the following exception: org.springframework.dao.DataIntegrityViolationException: could not delete: [Role#4]; SQL [delete from role where id=? an d version=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not del ete: [Role#4] In my Role dom...

[SOAPUI] GROOVY How to trim a random number into a whole number

Hi there, I'm looking to trim a randomly generated number down to a whole number. I've tried various means but none seem to work. My latest attempt is as follows: def som = Math.random() * totalContacts log.info som som.toInteger() log.info som def cleaned = parseInt(som) log.info cleaned (I'm logging to the console after each ste...

What is the difference between Groovy's AnnotationNode and Java's annotation ?

Although the title says quite all, let me explain a little further. I've written a library in which I do some introspection on Java fields to have their annotation list (and more specifically to see if they have one or more specific annotations (like - say, @Id, @Child, @Parent). Here is an example of the kind of code I use : @Over...