{"id":4533,"date":"2011-11-23T00:37:37","date_gmt":"2011-11-22T19:07:37","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=4533"},"modified":"2022-01-12T18:50:51","modified_gmt":"2022-01-12T13:20:51","slug":"grailsdomain-design-via-intellij-ideas-ui","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/grailsdomain-design-via-intellij-ideas-ui\/","title":{"rendered":"Grails:Domain Design Via Intellij Idea&#8217;s Diagrams"},"content":{"rendered":"<p>Here is an example of how to design Grails domain class with Intellij Idea.For this we need to have blank domain classes. So lets say we created\u00a0\u00a0three  Domain Classes \tCompany,Book,Author<\/p>\n<ol>\n<li>To see relationship diagram, Selected Domain Class, and \tselected tab Domain Class  Dependencies.It should look like this\n<\/li>\n<li>Lets assume the relation that publication has many books. So I drag mouse from Company to Books. \tWhich invokes a popup asking about relationship between the domains \tand type and name of the field.\n<\/li>\n<li>On Selecting ok from previous \tpopup. Their relation is defined in domain and in diagram.\u00a0Similarly, lets  define<\/li>\n<ol>\n<li>Book hasMany Authors,<\/li>\n<li>Authors hasMany Books,<\/li>\n<li>Book belongsTo Author<\/li>\n<li>And Diagram looked like this.<\/li>\n<\/ol>\n<\/li>\n<li>Next Step \u2013 Lets add fields to Domain Class all by Intellij Idea&#8217;s UI. Select package of domain class and pressshft+ctrl+alt+u. It&#8217;ll open package diagram of  app.\n<\/li>\n<li>Now lets add field name to domain \tAuthor. For that we&#8217;ll need to select domain author,right click and select fields. It&#8217;ll \tinvoke a popup asking details about field.\n<p>Similarly we add field name to Author and published on to Book.<\/li>\n<li>Now lets add a method  to named \u201cpublishedBefore\u201d to Book which takes a date and return list of books published before that date.For this we need to right click on domain and select method.And it&#8217;ll invoke popup asking \tdetails.Select create and its done.\n<\/li>\n<\/ol>\n<p>This was a simple and easy way to create structure of grails app in Intellij Idea.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is an example of how to design Grails domain class with Intellij Idea.For this we need to have blank domain classes. So lets say we created\u00a0\u00a0three Domain Classes Company,Book,Author To see relationship diagram, Selected Domain Class, and selected tab Domain Class Dependencies.It should look like this Lets assume the relation that publication has many [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":4},"categories":[7],"tags":[690,689,4840,9,515,692,691,379],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/4533"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=4533"}],"version-history":[{"count":3,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/4533\/revisions"}],"predecessor-version":[{"id":54605,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/4533\/revisions\/54605"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=4533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=4533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=4533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}