leftovers...

about grails groovy

Grails 1.3.1 リリース!

おーと、Grails 1.3.1がリリースされました!
見逃すとこだった。

内容としては、1.3でのバグフィックスといくつかの1.3でみおくられた追加実装です。

公式リリースノート
http://www.grails.org/1.3.1+Release+Notes


今回の追加内容は。
フィルタオーダリング
dependsOnプロパティを定義することで、フィルタの実行順番を定義することができます。

class MyFilters {
    def dependsOn = [MyOtherFilters]
    def filters = { … } 
}

class MyOtherFilters {

    def filters = { … } 
}

GSP タグ "unless"

<g:unless test="${cacheEnabled}">
  Tag Body Goes Here
</g:unless>

クエリーキャッシュの向上
findAllメソッドに対してセカンドレベルキャッシュの対応

Book.findAll("from Book as b where b.author=:author", [author:'Dan Brown'], [cache: true])

名前つきクエリのネスト
名前つきクエリがネスト対応しました。

class Publication {
   String title
   String author
   Date datePublished
   Integer numberOfPages

   static namedQueries = { 
     recentPublications { 
        def now = new Date() gt 'datePublished', now - 365 
     }
     publicationsWithBookInTitle { 
        like 'title', '%Book%' 
     }

     recentPublicationsWithBookInTitle { 
        // ここで他の名前つきクエリ呼出 
        recentPublications() 
        publicationsWithBookInTitle()
     } 
   } 
}

TagLib テスト
TagLibUnitTestCaseがpageScopeプロパティに対応しました。テスト時にpageScopeプロパティが動的に追加されます。


今回は、本気でサイクル早すぎで試していませんが、おいおい試していこうかと思います。