There is no one single way to create Grails applications. Often applications do make use of domain classes that provide easy access to data in relational database tables, but you can easily switch to a NoSQL datastore or even use no direct persistence like in your application.
The simple answer to your question is that you should just create non-persistent data classes in src/groovy
and src/java
that represent the data you're working with from your web service calls. You can still use Grails for its controllers and GSPs, taglibs, services (non-transactional of course since there won't be database access), and also take advantage of the many available plugins.
You shouldn't have to do much to use the standard generated controllers and GSPs to display data with sorting and pagination. The generation scripts do expect domain classes, but you can cheat a bit to get those generated (and of course you can always code stuff by hand). For example if you have a Person class in src/groovy/com/yourcompany, move it to grails-app/domain
:
package com.yourcompany
class Person {
String firstName
String lastName
}
Then run grails generate-all com.yourcompany.Person
and it will create the controller and its unit test, and the GSPs. Now move it back to src/groovy
and use it as you want. The GSPs don't expect domain classes, they just expect individual class instances or lists of instances.
You'll need to convert controller calls to stuff like person.save()
to use your web services instead, but much of the code should be reusable.
One thing you can take advantage of is validation. You can annotate your classes with @Validateable
and define constraints to take advantage of Grails validation for non-persistent classes - see the documentation for more details.