{"id":174683,"date":"2013-03-29T12:05:03","date_gmt":"2013-03-29T08:05:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=174683"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=174683","title":{"rendered":"<span class=\"post_title\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0432\u043e\u0439 \u044f\u0437\u044b\u043a \u043d\u0430 Groovy<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 \u0438\u0445 \u043d\u0438\u0437\u043a\u0430\u044f \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043a \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u044f\u0437\u044b\u043a\u0430\u043c. <\/p>\n<p>  \u041e\u041e\u041f \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0447\u0430\u0441\u0442\u044f\u043c\u0438 \u0440\u0435\u0448\u0438\u043b, \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0432 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u043e\u0436\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0437\u0434\u0435\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u044f\u0437\u044b\u043a\u0438 \u043d\u0435 \u043f\u0440\u0438\u0441\u043f\u043e\u0441\u043e\u0431\u043b\u0435\u043d\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0437\u0430\u043a\u0430\u0437\u0430\u043c\u0438 \u043d\u0430 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u044b \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432:  <\/p>\n<pre><code class=\"java\">\/\/ \u041a\u043b\u0438\u0435\u043d\u0442 class Customer {     int inn     String name     String address     String phone }  \/\/ \u041a\u043b\u0438\u0435\u043d\u0442\u044b class Customers {     Customer findByInn(inn)     void add(Customer customer) }  \/\/ \u041f\u0440\u043e\u0434\u0443\u043a\u0442 class Product {     String article     String name     double price }  \/\/ \u041f\u0440\u043e\u0434\u0443\u043a\u0442\u044b class Products {     Product findByArticle(article)     void add(Product product) }  \/\/ \u0417\u0430\u043a\u0430\u0437 class Order {     int num     Customer customer     List&lt;OrderDetail&gt; details = []      OrderDetail findByPos(pos)     void add(OrderDetail detail) }  \/\/ \u0422\u043e\u0432\u0430\u0440 \u0437\u0430\u043a\u0430\u0437\u0430 class OrderDetail {     int pos     Product product     def count = 1     def getSum() { count * product.price } }  \/\/ \u0417\u0430\u043a\u0430\u0437\u044b class Orders {     Order findByNum(num)     void add(Order order) } <\/code><\/pre>\n<p>  \u0421\u0430\u043c\u0430 \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<a name=\"habracut\"><\/a>  <\/p>\n<pre><code class=\"java\">\/\/ \u0421\u043f\u0438\u0441\u043a\u0438 \u0431\u0438\u0437\u043d\u0435\u0441-\u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 def customers = new Customers() def products = new Products() def orders = new Orders()  \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 customers.add(new Customer(inn: 1234, name: &quot;\u041a\u043b\u0438\u0435\u043d\u0442&quot;, address: &quot;\u0420\u043e\u0441\u0441\u0438\u044f&quot;,  \t\t\t\t\t\t\tphone: &quot;+74951002030&quot;))  \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 products.add(new Product(article: &quot;a100&quot;, name: &quot;\u0422\u043e\u0432\u0430\u0440 1&quot;, price: 100.00)) products.add(new Product(article: &quot;a200&quot;, name: &quot;\u0422\u043e\u0432\u0430\u0440 2&quot;, price: 200.00))  \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u0430\u0437\u0430 def order = new Order(num: 1, customer: customers.findByInn(1234)) order.add(new OrderDetail(pos: 1,  \t\t\tproduct: products.findByArticle(&quot;a100&quot;), count: 1)) order.add(new OrderDetail(pos: 2,  \t\t\tproduct: products.findByArticle(&quot;a200&quot;), count: 1)) orders.add(order)  <\/code><\/pre>\n<p>  \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0438\u0437\u044f\u0449\u0435\u0441\u0442\u0432\u0443 Groovy, \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u0439. \u041d\u043e \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438, \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438, \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u043e \u0438 \u043f\u043b\u043e\u0445\u043e \u0447\u0438\u0442\u0430\u0442\u044c\u0441\u044f. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u044f \u0438\u043c\u0435\u044e \u043d\u0435\u043a\u0438\u0439 API, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u043a\u043e\u0434\u0430, \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u0438 \u043d\u0435\u043b\u0435\u0433\u043a\u043e \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u0412 Groovy \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0441\u0432\u043e\u044e \u0436\u0438\u0437\u043d\u044c, \u043d\u0430\u043f\u0438\u0441\u0430\u0432 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0434\u043b\u044f \u043b\u0435\u0433\u043a\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439. \u0412\u043e\u0442 \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0430\u043d\u0430\u043b\u043e\u0433 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0438:  <\/p>\n<pre><code class=\"java\">AddCustomer(inn: 1234, name: &quot;\u041a\u043b\u0438\u0435\u043d\u0442&quot;, address: &quot;\u0420\u043e\u0441\u0441\u0438\u044f&quot;, phone: &quot;+74951002030&quot;)  AddProduct(article: &quot;a100&quot;, name: &quot;\u0422\u043e\u0432\u0430\u0440 1&quot;, price: 100.00) AddProduct(article: &quot;a200&quot;, name: &quot;\u0422\u043e\u0432\u0430\u0440 2&quot;, price: 200.00)  AddOrder(num: 1, customer: 1234) { \tDetail(pos: 1, product: &quot;a100&quot;, count: 1) \tDetail(pos: 2, product: &quot;a200&quot;, count: 1) }  <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043d\u0443\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u2014 \u043e\u043d \u0438\u043c\u0435\u0435\u0442 \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>  \u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u0438\u043b\u0434\u0435\u0440 \u043d\u0430 Groovy. \u0423 Groovy \u0435\u0441\u0442\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 BuilderSupport, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0431\u0438\u043b\u0434\u0435\u0440. \u0412 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0442\u044c \u0440\u044f\u0434 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 Groovy \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u0440\u0430\u0437\u0431\u043e\u0440\u0435 \u044f\u0437\u044b\u043a\u0430 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0432 \u043a\u043e\u0434\u0435. \u0412\u043e\u0442 \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0431\u0438\u043b\u0434\u0435\u0440\u0430:  <\/p>\n<pre><code class=\"java\">public class MyBuilder extends BuilderSupport { \tpublic Customers customers \tpublic Products products \tpublic Orders orders  \t\/\/ \u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u043e\u0434\u0435 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u043d\u043e\u0434\u044b \tprotected void setParent(Object parent, Object child) { \t}  \t\/\/ \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0434\u0443 \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \tprotected Object createNode(Object name) { \t\tif (name != &quot;call&quot;)  \t\t\tthrow new Exception(&quot;Node required parameters&quot;) \t\tnew Node(null, name); \t}  \t\/\/ \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0434\u0443 \u0441 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c \u043a \u043d\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \tprotected Object createNode(Object name, Object value) { \t\tthrow new Exception(&quot;Node required parameters&quot;) \t}  \t\/\/ \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0434\u0443 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \tprotected Object createNode(Object name, Map attributes) { \t\t\/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043d\u043e\u0434\u0443 \t\tNode parent = getCurrent() \t\tdef result \t\t \t\t\/\/ \u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0438\u043c\u044f \u043d\u043e\u0434\u044b \t\tswitch (name) { \t\t\tcase &quot;AddCustomer&quot;: \t\t\t\tresult = addCustomer(attributes) \t\t\t\tbreak \t\t\tcase &quot;AddProduct&quot;: \t\t\t\tresult = addProduct(attributes) \t\t\t\tbreak \t\t\tcase &quot;AddOrder&quot;: \t\t\t\tresult = addOrder(attributes) \t\t\t\tbreak \t\t\tcase &quot;Detail&quot;: \t\t\t\tif (parent == null ||  \t\t\t\t\tparent.name() != &quot;AddOrder&quot;) \t\t\t\t\tthrow new Exception( \t\t\t\t\t\t&quot;Detail must be specified with only AddOrder&quot;)  \t\t\t\tresult = addOrderDetail(parent.value(), attributes) \t\t\t\tbreak \t\t\tdefailt: \t\t\t\tthrow new Exception(&quot;Unknown node ${name}&quot;) \t\t} \t\tnew Node(null, name, attributes, result); \t}  \t\/\/ \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0434\u0443 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c \u043a \u043d\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \tprotected Object createNode(Object name, Map attributes, Object value) { \t\tthrow new Exception(&quot;Node ${name} can not support objects&quot;) \t}  \t\/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \tdef addCustomer(Map params) { \t\tdef customer = new Customer(inn: params.inn, name: params.name,  \t\t\t\t\t\taddress: params.address, phone: params.phone) \t\tcustomers.add(customer) \t\tprintln &quot;Added customer ${customer.inn}: ${customer.name}&quot; \t\tcustomer \t} \t \t\/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u0434\u0443\u043a\u0442 \tdef addProduct(Map params) { \t\tdef product = new Product(article: params.article, name: params.name,  \t\t\t\t\t\tprice: params.price) \t\tproducts.add(product) \t\tprintln &quot;Added product ${product.article}: ${product.name}&quot; \t\tproduct \t} \t \t\/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043a\u0430\u0437 \tdef addOrder(Map params) { \t\tdef order = new Order(num: 1, customer: customers.findByInn(params.customer)) \t\torders.add(order) \t\tprintln &quot;Added order ${order.num} from customer ${order.customer.name}&quot; \t\torder \t} \t \t\/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0437\u0430\u043a\u0430\u0437\u0430 \tdef addOrderDetail(Order order, Map params) { \t\tdef count = params.count?:1 \t\tdef detail = new OrderDetail(pos: params.pos,  \t\t\t\t\t\tproduct: products.findByArticle(params.product),  \t\t\t\t\t\tcount: count) \t\torder.add(detail) \t\tprintln &quot;Added into order ${order.num} detail pos ${detail.pos} &quot; + \t\t\t\t&quot;with product ${detail.product.name}&quot; \t\tdetail \t} } <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0442\u043e \u0434\u0432\u0430 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430 setParent \u0438 createNode. setParent \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u0434\u043e\u0447\u0435\u0440\u043d\u0435\u0439 \u043d\u043e\u0434\u0435 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0438 \u0432 \u043c\u043e\u0435\u0439 \u043b\u043e\u0433\u0438\u043a\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u0410 \u0432\u043e\u0442 \u0432 createNode \u043a\u0430\u043a \u0440\u0430\u0437 \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043d\u043e\u0434\u044b \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 createNode. \u041c\u043e\u0435\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442, \u0447\u0442\u043e \u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u0441\u0435\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 \u043d\u0443\u0436\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432\u043e \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b createNode. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043f\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0434\u043b\u044f \u0440\u0443\u0442\u043e\u0432\u043e\u0439 \u043c\u0435\u0442\u043a\u0438 call, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0431\u0438\u043b\u0434\u0435\u0440\u0430 \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u041a\u043b\u0430\u0441\u0441 \u0431\u0438\u043b\u0434\u0435\u0440\u0430 \u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u043b \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u043c, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432 \u0438 \u0437\u0430\u043a\u0430\u0437\u043e\u0432. \u0422\u0430\u043a \u0436\u0435 \u043e\u043f\u0438\u0441\u0430\u043b \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0438\u0437\u043d\u0435\u0441 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439. \u041d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u2014 \u0432\u0441\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0438\u0434\u043d\u043e \u0432 \u043a\u043e\u0434\u0435 \u0438 \u043f\u043e \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c \u0432 \u043d\u0435\u043c.<\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432:  <\/p>\n<pre><code class=\"java\">\/\/ \u0421\u043f\u0438\u0441\u043a\u0438 \u0431\u0438\u0437\u043d\u0435\u0441-\u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 def customers = new Customers() def products = new Products() def orders = new Orders()  \/\/ \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0431\u0438\u043b\u0434\u0435\u0440\u0430 def myApi = new MyBuilder(customers: customers, products: products, orders: orders)  \/\/ \u0412\u044b\u0437\u0432\u0430\u0442\u044c \u0431\u0438\u043b\u0434\u0435\u0440 myApi { \tAddCustomer(inn: 1234, name: &quot;\u041a\u043b\u0438\u0435\u043d\u0442&quot;, address: &quot;\u0420\u043e\u0441\u0441\u0438\u044f&quot;, phone: &quot;+74951002030&quot;) \t \tAddProduct(article: &quot;a100&quot;, name: &quot;\u0422\u043e\u0432\u0430\u0440 1&quot;, price: 100.00) \tAddProduct(article: &quot;a200&quot;, name: &quot;\u0422\u043e\u0432\u0430\u0440 2&quot;, price: 200.00) \t \tAddOrder(num: 1, customer: 1234) { \t\tDetail(pos: 1, product: &quot;a100&quot;, count: 1) \t\tDetail(pos: 2, product: &quot;a200&quot;, count: 1) \t} }  \/\/ \u041f\u0435\u0447\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 println &quot;\\n*** Result ***&quot; println &quot;Customers:&quot; println customers println &quot;Products:&quot; println products println &quot;Orders:&quot; println orders <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:  <\/p>\n<blockquote><p>Added customer 1234: \u041a\u043b\u0438\u0435\u043d\u0442<br \/>  Added product a100: \u0422\u043e\u0432\u0430\u0440 1<br \/>  Added product a200: \u0422\u043e\u0432\u0430\u0440 2<br \/>  Added order 1 from customer \u041a\u043b\u0438\u0435\u043d\u0442<br \/>  Added into order 1 detail pos 1 with product \u0422\u043e\u0432\u0430\u0440 1<br \/>  Added into order 1 detail pos 2 with product \u0422\u043e\u0432\u0430\u0440 2<\/p>\n<p>  *** Result ***<br \/>  Customers:<br \/>  {inn=1234, name=\u041a\u043b\u0438\u0435\u043d\u0442, address=\u0420\u043e\u0441\u0441\u0438\u044f, phone=+74951002030}<br \/>  Products:<br \/>  {article=a100, name=\u0422\u043e\u0432\u0430\u0440 1, price=100.0}<br \/>  {article=a200, name=\u0422\u043e\u0432\u0430\u0440 2, price=200.0}<br \/>  Orders:<br \/>  {num=1, customer=\u041a\u043b\u0438\u0435\u043d\u0442, <br \/>   detail={pos=1, product=\u0422\u043e\u0432\u0430\u0440 1, count=1, sum=100.0};<br \/>   {pos=2, product=\u0422\u043e\u0432\u0430\u0440 2, count=1, sum=200.0}}  <\/p><\/blockquote>\n<p>  \u0412\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \ud83d\ude42 <\/p>\n<p>  \u0420\u0435\u0437\u044e\u043c\u0438\u0440\u0443\u044f \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0443 \u0431\u0438\u043b\u0434\u0435\u0440\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u0430\u044f. \u042f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0430 \u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e \u044f\u0437\u044b\u043a \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e open source \u043f\u0440\u043e\u0435\u043a\u0442\u0430 GETL (ETL \u043d\u0430 \u0431\u0430\u0437\u0435 Groovy). \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u043b\u0434\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c SQL \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432 \u043a\u043e\u0434\u0435 \u0438\u043b\u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435. \u0414\u0430 \u0438 \u0448\u0442\u0430\u0442\u043d\u044b\u0435 XML\/JSON \u043c\u0430\u0440\u043a\u0435\u0440\u044b \u0434\u0443\u043c\u0430\u044e \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u0442\u0430\u0439\u043d\u044b. \u042f\u0437\u044b\u043a \u0440\u0430\u0437\u043c\u0435\u0442\u043e\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043a\u043e\u0434\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043d\u0430 Groovy, \u043d\u043e \u0438 \u043a\u0430\u043a \u0431\u043b\u043e\u043a\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u044b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b. \u0411\u043b\u043e\u043a\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u044f\u043c\u043e \u0432 runtime \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0437 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 EVAL. \u0422\u0430\u043a \u043a\u0430\u043a \u0431\u043b\u043e\u043a\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u0444\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b, \u0442\u043e \u0434\u043b\u044f \u043d\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 GUI \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0438 \u043e\u0431\u044b\u0447\u043d\u044b\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438. <\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e. \u041d\u043e \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u2014 \u0432\u0441\u0435 \u0432\u044b\u0448\u0435\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445 \u043b\u0438\u0431\u043e \u0443\u0441\u0438\u043b\u0438\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 Java! \u041d\u0438\u043a\u0442\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u0432 Groovy \u043e\u0431\u0432\u044f\u0437\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 Java \u043a\u043b\u0430\u0441\u0441\u044b \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0441\u0432\u043e\u0438\u043c \u044f\u0437\u044b\u043a\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u0430\u043b\u044c\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 Java \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445. \u042d\u0442\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0442\u043e\u044f\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 Java \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u044b\u0439 Groovy \ud83d\ude42<\/p>\n<p>  \u0421\u043a\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u043c\u043e\u0436\u043d\u043e <a href=\"http:\/\/sourceforge.net\/projects\/getl\/files\/builderexample.zip\/download\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a>. \t\t\t \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/174683\/\"> http:\/\/habrahabr.ru\/post\/174683\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 \u0438\u0445 \u043d\u0438\u0437\u043a\u0430\u044f \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043a \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u044f\u0437\u044b\u043a\u0430\u043c. <\/p>\n<p>  \u041e\u041e\u041f \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0447\u0430\u0441\u0442\u044f\u043c\u0438 \u0440\u0435\u0448\u0438\u043b, \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0432 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u043e\u0436\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0437\u0434\u0435\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u044f\u0437\u044b\u043a\u0438 \u043d\u0435 \u043f\u0440\u0438\u0441\u043f\u043e\u0441\u043e\u0431\u043b\u0435\u043d\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0437\u0430\u043a\u0430\u0437\u0430\u043c\u0438 \u043d\u0430 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u044b \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432:  <\/p>\n<pre><code class=\"java\">\/\/ \u041a\u043b\u0438\u0435\u043d\u0442 class Customer {     int inn     String name     String address     String phone }  \/\/ \u041a\u043b\u0438\u0435\u043d\u0442\u044b class Customers {     Customer findByInn(inn)     void add(Customer customer) }  \/\/ \u041f\u0440\u043e\u0434\u0443\u043a\u0442 class Product {     String article     String name     double price }  \/\/ \u041f\u0440\u043e\u0434\u0443\u043a\u0442\u044b class Products {     Product findByArticle(article)     void add(Product product) }  \/\/ \u0417\u0430\u043a\u0430\u0437 class Order {     int num     Customer customer     List&lt;OrderDetail&gt; details = []      OrderDetail findByPos(pos)     void add(OrderDetail detail) }  \/\/ \u0422\u043e\u0432\u0430\u0440 \u0437\u0430\u043a\u0430\u0437\u0430 class OrderDetail {     int pos     Product product     def count = 1     def getSum() { count * product.price } }  \/\/ \u0417\u0430\u043a\u0430\u0437\u044b class Orders {     Order findByNum(num)     void add(Order order) } <\/code><\/pre>\n<p>  \u0421\u0430\u043c\u0430 \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-174683","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/174683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=174683"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/174683\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=174683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=174683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=174683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}