Accessing Domain Constraints:Grails

Constraints provide Grails with a declarative DSL for defining validation rules, schema generation and CRUD generation meta data. For example, consider these class User { String username String password String email int age static constraints = { username size: 5..15,...

Data Transfer Object(DTO) in grails

Data transfer object (DTO) is an object that carries data between processes. Working with a remote interface where each call to it is expensive. Response to each call should bring as much data as possible so if multiple request are required to bring data for a...

Liquibase Basics

Liquibase is an open source technology for tracking, managing and applying database schema changes. All changes to the database are stored in XML files in the form of change-sets and is identified by a combination of an “id” and “author” tag....

Enable Authentication in MongoDB

Follow below steps to enable authentication in MongoDB. 1- Run command praveen@acer-aspire:~# gedit /etc/mongodb.conf add ‘auth=true’ or uncomment by removing # it if exists. 2- Add atleast one user to the DB ‘admin’ . Admin user can access all the collections in the...

Facebook Profile Image Using Grails OAuth Plugin

In the blog we have seen how we can connect with Facebook using grails oauth plugin. Using that blog we can get various information of the user but not profile image. To get the Facebook profile image you require to make one more request, like: def facebook() { Token...

Access ServletContext In Grails gsp

ServletContext is used to store global application attributes among other things,e.g In grails controller we can store global application attribute as : def mySetting = servletContext["mySetting"] servletContext["mySetting"] = "foo" asset...

Create-A-New-User-In-MySQL

In general, We did all of the editing in MySQL as the root user, with full access to all of the databases. However, in the cases where more restrictions may be required, there are ways to create users with custom permissions. Let’s start by making a new user within...

Groovy list: Get element from last

Groovy has lots of awesome features which helps a lot in every day development, thanks @groovy. This blog demonstrate a cool feature of groovy list. Get element from last in a groovy list Lets have a list List list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] We can easily get...

Locale and Message Bundle in Grails

I am back with a new blog post titled “Locale and Message Bundle in Grails”. In grails we define all the string content/description in message.properties file. In order to fetch the message in gsp page we can use the following code:- <g:set...