grails

Can I Change Look / Feel Of Scaffolded Pages With Mostly CSS?

I am using a web framework (Grails, similar to Rails) that has abilities to auto-generate a lot of code through scaffolding. As a result, all of my CRUD pages are currently automatically generated, and I even have ability to inject additional HTML code whenever I want to to further customize the content of those pages. I can control t...

How to use grail authentication plugin action from link?

I am using the authentication plugin in grails. The logout button code is something like this:- However this creates a submit button on the page. I want to have a link () instead. Does anyone know a way of doing this? I thought createLink might work, but not sure... ...

Grails and Local Maven Dependencies

Hi All, I'm developing a small web frontend in Grails. It is basically a "ultra light-weight" client app that is connected async through JMS. I have two dependencies in the project that I would like to pull from a Maven repository. They is activemq and acme-adapter-api, a inhouse dependency, not available at the remote repository. I ...

Clearing Grails Dependency Cache

Hi All, I run into some problems when trying to solve a problem I had with SNAPSHOT maven dependencies (see here). When running grails dependency-report, cached dependencies get listed, more or less like this: acme-adapter-api by com.acme 108 kB (0 kB downloaded, 108 kB in cache) As this answer suggests, you can run into trouble ...

Grails PUT request with XML

I have a put request that I am trying to unit test for creating a user object. Unit Test: void testPUTXMLResponse() { def mockUser = new User(username:"fred", password:User.encrypt("letmein"), firstName:"Fred", lastName:"Flintstone", middleName:"T", phone:"555-555-5555", email:'[email protected]', activationDate:new Date(), logonFai...

Grails GORM composition or hasOne?

I'm a bit confused about the differences between using the static hasOne map and composing objects in domain classes. What are the differences between the two? ie. class DegreeProgram { String degreeName Date programOfStudyApproval static hasOne = [committee:GraduateCommittee] } versus class DegreeProgram { String degreeName Date p...

How to make use of Grails Dependencies in your IDE

Hi All, So I finally got my dependencies working with Grails. Now, how can my IDE, eg IntelliJ or Eclipse, take advantage of it? Or do I really have to manually manage what classes my IDE knows about at "development time"? If the BuildConfig.groovy script is setup right (see here), you will be able to code away with vi or your favorite...

Grails: nested command objects

Hi, In my grails app I have an outer command object that contains a list of other command objects: public class OuterCommand { List<InnerCommand> innerCommands = ListUtils.lazyList([], FactoryUtils.instantiateFactory(InnerCommand)) } class InnerCommand { String code Long id String value static constraints = { ...

Grails optimistic locking strange behaviour

I've been trying to make GORM throw an optimistic locking error in an integration test. It has been said before that it is not possible to test for concurrent update errors without resorting to multiple threads, but even so I find the behaviour of my test case surprising: void testOptimisticLocking() { new Widget(foo:"bar").save(flus...

Grails dynamic database connections?

Where I'm working, we have multiple database we need to be able to query. Some of them are predefined and we're using Datasources to access. Others are named after the customer id #. For instance _2. We have hundreds of customers and some customers can pose as other customers and depending on which customer is using the interface at t...

Groovy csv parser and export to database

How can I parse my CSV file without parsing first line ? This class work but I don't want to parse the header of my CSV. import groovy.sql.Sql class CSVParserService { boolean transactional = false def sql = Sql.newInstance("jdbc:mysql://localhost/RProject", "xxx", "xxx", "com.mysql.jdbc.Driver") def CSVList = sql.dataS...

Grails searchable plugin

Hi, In my Grails app, I have the following domain class that is indexed by the Searchable plugin: class Foo implements Serializable { BookletCategory bookletCategory Date lastUpdated static hasMany = [details: BookletRootDetail] static searchable = { bookletCategory component: true id name: 'bookletRoo...

Grails startup is slow

Help! I'm porting a large ruby app to Grails - but the Grails startup of my application takes more than 2 minutes. I've already set dbCreate to "read" I've ensured my high end dual processor desktop windows box gives Grails needed RAM (1 Gig). I have no plugins installed. I have 170 domain classes that used to be ruby classes. W...

Migrating Rails app to Grails - Can I easily use an int for the ID field of all the domain classes?

If so how do I do it? I tried just using a declaration id type: 'int' but it got an error when calling Find on the class. ...

How to setup local dependency in grails plugin (classpath to the main app)?

Hi, I have a Grails app consisting of main app and its local module linked in BuildConfig.groovy: grails.plugin.location.'mymodule' = "modules/mymodule" In mymodule I would like to use Helper classes from the main app, however I cannot find any way of how to make mymodule dependent to the main app. I was thinking of adding some extra...

Grails GSP <g:set> tag set as integer?

Using Grails' GSP <g:set> tag, is it possible to specify the type of the variable? I want to declare an integer variable, but <g:set> always declares a sting. For example: <g:set var="x" value="100"/> ${x.getClass()} ${x+23} results in class java.lang.String 10023 I'd like to declare x as an integer. I noticed that using the JSP ta...

With groovy.sql.newInstance in grails - who closes the connection and when?

I'm using grails but I have lot's of stored procedures I'm trying to call from groovy.Sql.newInstance... In all the examples I've found I never see anyone actually calling close on the connection. But when I tried running a bunch of methods within one response that each uses its own call to newInstance, then it got an error that there ...

in Grails can you use both sql.newInstance and Domain class calls in the same method?

Can you have code that looks like this? def methodname () { proc = "sql to call a stored proc" def conn = Sql.newInstance(DB_CONN, DB_USERNAME, DB_PASSWORD, "org.postgresql.Driver") def result1 = conn.rows(proc) def result2 = MyClass.Find("from MyClass where foo='bar'") return [result1, result2] } If so are they using different connec...

In Grails how do I access the hibernate session inside of a domain class static method?

I've read various articles on the web, but they seem rather scattered on this point. Exactly what do I need to do in my configuration and in my method to get the hibernate session. I'm trying to make some direct sql calls for stored procedures. I have a large code base that I am porting from Ruby with lots of static methods and stored...

Grails interprets and closes HTML meta tag

In my Grails GSP file I'm using the HTML meta tag: <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> The problem is that Grails closes this tag and renders it as: <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> This fails W3C's HTML validation (since my doctype is HTML and not XHTML). Is there...