grails

Maintaining the position of columns in Grails/GORM

Is there a way to fix the position of the columns in a domain? I have this domain: class SnbrActVector { int nid String term double weight static mapping = { version false id(generator: 'assigned') } static constraints = { nid(blank:false) term(blank:false) weight(blank:...

Grails g:paginate tag and custom URL

Hello, I am trying to use g:paginate in a shared template where depending on the controller, url changes e.g. For my homepage url should be : mydomain[DOT]com/news/recent/(1..n) For search Page: www[DOT]mydomain[DOT]com/search/query/"ipad apps"/filter/this month and my g:paginate looks like this: g:paginate controller=${cust...

groovy multithreading

Hi, I'm newbie to groovy/grails. How to implement thread for this code . Had 2500 urls and this was taking hours of time for checking each url. so i decided to implement multi-thread for this : Here is my sample code : def urls = [ "http://www.wordpress.com", "http://67.192.103.225/QRA.Public/" , "http://www.subaru.com", "htt...

Resolving the path of 'web-app/file/misc' from 'src' in Grails

I created a class under 'src' dir. I'm using this code to access the 'images' directory for all files inside 'grails-app': ApplicationHolder.application.parentContext.getResource("file/misc").file; I'm having this error when I access it in a 'src' class: application has private access in org.codehaus.groovy.grails.commons.Application...

Databinding a StructuredPropertyEditor specific to type and target in Spring(Grails) - Selective application

Using Grails 1.2.2, I'm working on binding a structured property (CC expiration Date) to a java.util.Date but only for specific Domain and Commands objects. I've found the StructuredPropertyEditor interface, but the only way that I've found to register it is to use the PropertyEditorRegistrar and register the editor for the java.util.Da...

blank xml file when using XmlUtil.serialize

I am having a blank xml file with the code below. new OutputStreamWriter(new FileOutputStream("test.xml"), 'utf-8') << XmlUtil.serialize(builder.bind{ mkp.xmlDeclaration() strings { textitem (id:string_id) { text("example string") } }}) However when I try to println the xml, it displays th...

Testing custom constraints in Grails App

Hi there, I have the following as my unit test: void testCreateDealer() { mockForConstraintsTests(Dealer) def _dealer= new Dealer( dealerName:"ABC", Email:"[email protected]", HeadOffice:"", isBranch:false) assertFalse _dealer.val...

Can layouts be chosen by Grails controllers?

I'm building a CMS as a learning exercise in Grails and would like to give content managers the ability to choose between different HTML page structures (e.g. 2 column, 3 column, etc). Grails Layouts seem like a logical choice but is it possible for a Grails controller to explicitly name which layout will be used for rendering? Ideally...

How do I access the body content of a POST in Grails?

I'm trying to read the body content of a Grails request and it's mapping the request to the params even though I've commented out the grails.mime.types. I've also tried setting grails.mime.types to and empty map and it's still mapping. The body content is xml and when Grails maps it, the key ends up being "<?xml version". Unfortunately,...

How to keep default value in domain with Gorm relationship one-to-one ?

I can define default value in domain by this way : class ProcessingPriority { static constraints = { } String processingPriority = "medium" String toString() { return processingPriority } } If I'm using this in another domain (using one-to-one), processingPriority is not define to "medium" but "null...

Compare associations between domain objects in Grails

I am not sure if I am going about this the best way, but I will try to explain what I am trying to do. I have the following domain classes class User { static hasMany = [goals: Goal] } So each User has a list of Goal objects. I want to be able to take an instance of User and return 5 Users with the highest number of matching Goal o...

Is it possible to map a root domain URL to a Grails' controller?

Let's have an example: A grails project, myproj, is deployed in Tomcat 6. It can be accessed anywhere thru this link: http://www.mycompany.com/myproj. Let's say we purchase another domain, http://newcompany.com, and we would like to point it to http://www.mycompany.com/myproj/url. If I go to http://newcompany.com/12345, it should be t...

Black Magic in Grails Data Binding!?

As described in http://n4.nabble.com/Grails-Data-Binding-for-One-To-Many-Relationships-with-REST-tp1754571p1754571.html i'm trying to automatically bind my REST data. I understand now that for one-to-many associations the map that is required for the data binding must have a list of ids of the many side such as: [propName: propValue, m...

Can anyone get app-engine plugin working with Grails on mac os x?

I have been trying for 4 days to get app-engine and grails working together on my mac to no avail. I am using latest groovy/grails and appengine sdk versions. Im following the app-engine plugin step by step on the grails site.. http://grails.org/plugin/app-engine Groovy Version: 1.7.1 JVM: 1.5.0_22 Grails 1.3.0.RC1 echo $APPENGINE_HOME...

Creating a blocked user intercepter in Grails

I am working on a social site where users can block other users. Throughout the site --dozens of places, user information is displayed. For example, user comments, reply forms, online user list.. etc etc.. The problem is that given the high number of places user info is displayed, it's becoming very difficult to check each time if that u...

Grails Unique Constraint for Groups

Hi there, I have the following requirement I have 3 domains namely: class Product { String productName static constraints = { productName(unique:true,blank:false) } class SubType { String subTypeName static constraints = { subTypeNam...

Can i easily use EJB3 Remote with a RAD framework?

Hello, I'm planning to make a webapp and just wonder if someone ever tried to use remote EJBs with a RAD framework like Grails, Play... was it easy? ...

Applying pagination options to a one-to-many list in Grails

I have a User class that hasMany = [friends:User] Now I am trying to display the friends list - ${user.friends} However, I'd like to be able to apply parameters like I can with, for example, User.findAllBy(user, [max:10, sort: 'dateCreated', order: 'desc"]) Can someone kindly tell me how to do this on a one-to-many in Grails / Groovy ...

grails datepicker

Hi, I'm using g:datePicker name="date1" id="date1" value="${program?.startDate}" > In controller when used params.date1 it is showing value as "struct" and unable to save date in my database. How can we parse date in to one param like eg: 2010-10-10 11:11:11 using datePicker ? thanks in advance srinath ...

Grails not executing on IntelliJ (NoClassDefFoundError)

Hi, I have upgraded my application from grails 1.2.2 to 1.3.1-RC1. While things seem to work when executing grails from command prompt, I cannot make it run from my IDE IntelliJ (last development version). The error I got straightaway is: Error executing script RunApp: net/sf/json/JSONException ... Caused by: java.lang.ClassNotFo...