Tags » Grails

TUTORIAL BELAJAR GRAILS PART 2 : INTRODUCTION TO GROOVY

Groovy merupakan bahasa pemrograman dynamic yang dibuat untuk berjalan di JVM (java virtual machine). Groovy memiliki hubungan yang dekat dengan java, karena kita bisa mengintegrasikan groovy dengan java library yang ingin kita gunakan. 491 more words

Grails

TUTORIAL BELAJAR GRAILS PART 1 : GRAILS?

Grails merupakan sebuah open source web application framework yang menggunakan Groovy sebagai bahasa pemrogramannya. Grails pertama kali diperkenalkan pada July 2005 dan sampai sekarang masih dikembangkan dengan versi terbarunya telah mencapai versi 3.1.11. 347 more words

Grails

return map for criteria

http://stackoverflow.com/questions/32237680/is-there-any-way-to-return-a-map-with-some-fields-from-a-createcriteria-in-grail

you can use import org.hibernate.criterion.CriteriaSpecification with withCriteria() to transform the result in a Collection object, with properties chosen by you only:

import org.hibernate.criterion.CriteriaSpecification

def criteria = User.withCriteria(){
    resultTransformer CriteriaSpecification.ALIAS_TO_ENTITY_MAP
    createAlias 'personalData', 'p'
    eq 'id', params.id
    // ...and so on, then
    projections {
        property 'id', 'myId' // a property called 'myId', from User
        property 'p.name', 'userName' // from personalData, a property mapped by a fk in User
        property 'p.age', 'age'
    }
}
Grails

Grails Object

  • params: get parameters such as url parameter
  •  principal: get user info
    • password:null
    • accountNonExpired:true
    • class:class grails.plugin.springsecurity.userdetails.GrailsUser
    • accountNonLocked:true
    • authorities:
    • id:2
    • credentialsNonExpired:true
    • enabled:true
    • username:sp@ss.com
Grails

Grails Plugin: Grails CSV Plugin

Using it is extremely simple. On any instance of the four data types, call the ‘eachCsvLine’ method with a closure accepting the tokens (a String array) for each parsed line: 45 more words

Welcome

Welcome to the Grails Coding Tutorial.

Whether you are an experienced programmer or not, this blog is indeed  for everyone who wishes to learn the Groovy Grails programming.

Good luck and Happy Learning!

Grails