grails

Maven Grails Building with 'mvn clean install' doesn't work

Hi, I've built a Maven Grails project which can be build fine using command mvn grails:war. However, using the standard mvn install fails to work - I get exceptions complaining that a util Java class (held under the grails-app/util folder) can't compile because it can't find one of the domain classes. I'm not using any package structu...

Checking if specific user has a role

Hi, is there some pretty way to check if some specific user (not the one that is logged in) has some specific role? Here is grails example (generally the same for plain Java but syntax): def user = User.get(1) //Get user with id 1 if (ifAnyGranted(user,"ROLE_ADMIN")) { //This is the line I need to implement somehow ... } Thanks in a...

Grails 1.1.1 log4j DSL throws MissingMethodException for PatternLayout configuration

I've upgraded a Grails 1.0.3 app to Grails 1.1.1. I've upgraded the log4j configuration in Config.groovy to conform to the new DSL. However, after defining a ConsoleAppender with a PatternLayout, the application won't start, and instead throws a MissingMethodException with the message: groovy.lang.MissingMethodException: No signature of...

grails <g:link tag sometimes works and sometimes doesn't>

The <g:link controller="foo" action="bar">foobar</g:link> tag sometimes works, that is is renders as <a href="grailsapp/foo/bar">foobar</a> and sometimes it doesn't. In this case I'll get a <a href="grailsapp/">foobar</a> Does anyone know what conditions cause this tag to fail to expand? Also is there any way to debug the tag e...

Groovyscript grails system commands

Hi, Is there a possibility of running my "grails run-app" command from my groovy script? I tried "cmd /c dir".execute() and it was working but "cmd /c grails run-app" doesn't seem to work :( Can anybody help me? I dont know how to see the output too :( ...

Grails GORM Domain class relationship

Grails 1.1.1 Goovy 1.5.7 In a relationship such this: Author 1 -- n Book n -- 1 Publisher Defined in Grails: class Author { String firstName String lastName static hasMany = [books: Book] static constraints = { books(nullable: true) } } class Book { String title Author author Publisher ...

Setting timeout for new URL(...).text in Groovy/Grails

I use the following Groovy snippet to obtain the plain-text representation of an HTML-page in a Grails application: String str = new URL("http://www.example.com/some/path")?.text?.decodeHTML() Now I want to alter the code so that the request will timeout after 5 seconds (resulting instr == null). What is the easiest and most Groovy wa...

Using HTML builders in grails instead of GSP

Hello, is there a way to use groovy builders to build JSP files in a Grails application keeping things enough integrated? To explain better: by default Grails uses gsp files that are nice but quite verbose.. <div class="clear"> <ul id="nav"> <li><g:link controller="snippets" action="list">Snippets</g:link></li> <li><g:link ...

Running a Java Program in Grails

I've written some small programs that help me out parsing/analysing data. I want to use those programs in my grails app. Regarding my research so far, it is possible, but I don't see where I have to place my Java Code to get it running. Are there any examples available? ...

Date updation using Grails and GWT-EXT

I have an editable grid created using GWT-EXT which consists of a date column. The date column is editable and the date can be changed using a date picker. When I get the new date , I would like to send it to a grails service so that the corresponding persistent object can be updated. The data rendering on the grid is using JSON and I d...

Include Grails generated Java class into the grails project

How can I Include Grails generated java class into the grails project? How can I use the generated class by grails into a java class in the project. Use my Groovy class into a Java class of the Grails project. Accesing his methods, attributes, etc... Example: I have a Domain class like this: package es.prueba.domain class Author impl...

groovy XmlSlurper not parse my xml file

I have an xml, and I can't parse this file with xmlslurper. Here a copy of my xml file : <Entrezgene-Set> <Entrezgene> <Entrezgene_summary>The protein encoded by this gene is a plasma glycoprotein of unknown function. The protein shows sequence similarity to the variable regions of some immunoglobulin supergene family member proteins. [...

How to query a date in HQL (Hibernate) with Joda Time?

I am sure that someone familiar with HQL (I am myself a newbie) can easily answer this question. In my Grails application, I have the following domain class. class Book { org.joda.time.DateTime releaseDate //I use the PersistentDateTime for persisting via Hibernate (that use a DATETIME type for MySQL DB) } In my HQL query, I want t...

Migrate Grail's HSQLDB embedded database

how to migrate Grail's HSQLDB embedded database(That contains my App's Data that I don't want to lose) into external one, such as MySQL or ApacheDerby? ...

How to configure grails classpath in order to add "src/groovy" folder ( in Linux environment)?

Hi, I am currently porting my development environment from Windows to Linux. Under Linux, I noticed a "No class found" compilation error related to my classes in the directory <PROJECT_HOME>/src/groovy. Under windows, it works fine. Is this "src/groovy" directory included in the CLASSPATH when running "grails run-app" ? Why does it ...

How to configure Grails to work with Apache Derby?

How to configure Grails to work with Apache Derby instead of HSQLDB ...

Grails config files: best practice

Hi, Just wondering what is the 'best practice' when adding config key-value pairs to your grails app. Should you just add to Config.groovy or create new files. I tried creating a new config file (Company.groovy) but could not access the config props from my app. However when I cup-paste the properties into Config.groovy I do have acces...

Hurdles with Grails development

Have been developing with Grails for couple of weeks now, Though I've loved the experience and the possibilities, I've seen following problems starting up. Please share if you've had similar issues.. and remedies would help too. Transaction management (in-built) doesn't seem to work in some circumstances. AOP with domain objects doe...

Grails Quartz Job has no Hibernate session after upgrade, causing LazyInitializationException

I've upgraded a Grails 1.0.4 application to 1.1.1. After upgrading, I'm repeatedly getting Exceptions when executing my Quartz jobs (using Quartz plugin 0.4.1). The plugin is used to manually schedule jobs using Simple and Cron Triggers via a service (paraphrased code below): class SchedulerService implements InitializingBean { stat...

How Handle multiple customers in a single grails application with customised look and feel?

Hi there, My app needs to support multiple customers at run time. They will all be displaying the same data, using the same controllers, services but with different layouts, css and images. My basic idea is as follows: 1) Have a filter to authenticate and set a config value in the session 2) My controller code will call something alo...