I'm writing a grails plugin and I need to hook into the domain save() method to do some logic after the save. I need to do this across multiple domain classes. I'm trying to avoid hibernate events in the cases where a plugin user is not using hibernate with GORM.
I've tried many thing but below is what I think should have had the best ...
What a the best books for learning Groovy and Grails for an experienced Java developer?
...
Is there a variable where I can find out the root directory of my Grails application?
for example, I have a folder named "chart" under \%root%\web-app\images\ where I put my charts in. Once I deploy my grails application on Jetty, I will get FileNotFoundException because the root path becomes /srv/www/vhosts/domain-name/jetty-version/
...
Hello,
Usecase: Player may have award or may not have. If player never had any award then Award will be null, ( 1. Is there any other way to do this.. without null.. I don't feel its good idea)
I am generating scaffold for following domain structure.
class Player {
String name
Award recentAward
static constraints = {
...
I've a problem using Enumeration in Grails:
I try to use an enumeraion in a grails domain object
code:
package it.xxx.tools.kanban
import java.util.Date;
class Task {
String name
String description
Priority priority
static belongsTo = [user:User, project:Project]
static constraints = {...
My newest project is able to generate documents with information from a database.
So I copy the document template on demand to an temporary folder for a user and modify it. I do this because every template must be available during modification.
Afterwards the user is awarded with his document via a download link from my webapp.
My que...
I am sick of encapsuling each call of asType with try/catch block like :
def b = ""
def c
try {
c = b as Integer
}
catch (NumberFormatException) {
c = null
}
println c
instead I would like to write in my code the following:
def b = ""
def c = b as Integer
and if b is not well-formatted, then I want to have null be assigne...
I've changed a g:select field to a yui autocomplete (without using the yui plugin) and now I'm getting:
Failed to convert property value of type [java.lang.String] to required type...
println the params in the controller looks identical in both cases.
I can go ahead and use the String id in the params and get the required domain ...
Anyone used this annotation in grails unit tests?
Didnt seem to work for me.
Thanks.
D
Update: the last line of my test below does throw the expected exception. However the test fails (Stack trace too big for here...). I'm using grails 1.2 and running the test in eclipse's junit runner. Maybe grails is using an earlier version of junit...
I have an applicaton that contains some tables that are auto-generated from Grails domain classes and one legacy table (say table legacy) that have been created outside of Grails but are being mapped by Grails domain classes. Mapping the columns in the legacy database is trivial, but I would like to disable the adding of extra fields and...
Just reading spring in action, and I know there is a chapter on MVC that I havent' got to yet.
I also read about grails, is that another framework or built on top of spring?
...
GWT version: 2.0.0
Grail version: 1.1.2
Grails - GWT plugin version: grails-gwt-0.5-SNAPSHOT, used after 0.4.1
I'm calling a method from the gwt side passing a transfer object, which implements IsSerializable and resides in the client package, so to be compiled into js, also all class properties are of primitive types.
Follows a brief s...
I would like to implement the following:
import org.springframework.web.servlet.support.RequestContextUtils as RCU
class HomeController {
def home = {
def locale = RCU.getLocale(request)
render view: viewExists("home_$locale") ? "home_$locale": "home"
}
}
What is the code of boolean viewExists(String viewPath)...
Using the datatable, within the Grails UI plugin, does anyone know how to make the list of dropdownOptions dynamic?
You can specify the dropdownOptions like this:
[age:'Age', formatter:'number', editor:[type:'dropDown', controller:'demo', action:'tableChange', config:[dropdownOptions: ['Foo', 'Bar'], disableBtns:true]],
sortab...
Hi,
I have a problem in Grails 1.1.2 + MySQL.
My domain class Something contains field
Map<String, Map<Integer, Integer>> priceMap
When I run the app, Grails creates table 'something' and sub-table 'something_price_map'. 'something_price_map' contains
BIGINT(20) price_map
VARCHAR(255) price_map_idx
TINYBLOB price_map_elt
The pr...
Is there a way to coerce the result row gotten from calling a stored procedure into a specific object so I can pass just a list of that object into the view?
I know I can use things like Node.list() to do this, but I am eventually going to replace getnodes() with a fairly complicated stored procedure that creates temp tables and does so...
altEmailAddress(blank: true, nullable: true, validator: {
if (it == null || it == '') {
return true
} else {
return (User.countByEmailAddress(it) > 0 && User.countByAltEmailAddress(it) > 0)
}
}
Stack trace:
Testcase: testFindValidEmailAddress took 0.429 sec
Caused an ERROR
null
java.lang.StackOverflowE...
SpringSource (now VMWare) has two very similar technologies: Grails and Spring Roo. I have been using Grails, but I see that SpringSource is actively working on something that is a competitor for that technology and that makes me worried about the future of Grails.
Does anyone know how these technologies relate, are they going to be mer...
Hi,
I'm considering developing a school information system using the Grails web framework. Before a school can use the system, they will need to setup the following data
School data
Students
Teachers
Subjects
Classes
etc.
I'm considering using a CMS in order to get the ability to CRUD these entities "for free". The CMS may also pro...
In my Grails domain I have something like the following
class A {
String name
static hasMany = [ b : B ]
SortedSet b
static fetchMode = [ b:"eager" ]
}
class B implements Comparable{
A a
... compareTo method defined ....
}
What I'm trying to do is to retrieve an instance of class A, and at the same time have i...