You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by pa...@apache.org on 2017/03/13 10:34:58 UTC

[06/50] [abbrv] polygene-java git commit: Added support for properties/associations/manyassociations/namedassociations for incoming domain model composites. name/type

Added support for properties/associations/manyassociations/namedassociations for incoming domain model composites. name/type


Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/0c7ee190
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/0c7ee190
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/0c7ee190

Branch: refs/heads/serialization-3.0
Commit: 0c7ee1909ce7e317182f34f011199276b5eeb18c
Parents: 284fb8e
Author: niclas <ni...@spicter.com>
Authored: Sat Mar 11 17:55:36 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Sat Mar 11 17:55:36 2017 +0800

----------------------------------------------------------------------
 tools/generator-polygene/app/index.js           |  73 +++++++++++
 .../DomainLayer/DomainModule/Configuration.tmpl |  37 ++++++
 .../DomainLayer/DomainModule/Crud.tmpl          |  10 +-
 .../DomainLayer/DomainModule/Entity.tmpl        |  10 +-
 .../DomainLayer/DomainModule/Service.tmpl       |  16 +++
 .../DomainLayer/DomainModule/Transient.tmpl     |  10 +-
 .../DomainLayer/DomainModule/Value.tmpl         |  13 +-
 .../DomainLayer/DomainModule/bootstrap.tmpl     | 131 ++++++++++++-------
 .../DomainLayer/DomainModule/module.js          |   9 +-
 .../app/templates/DomainLayer/bootstrap.tmpl    |  17 ++-
 10 files changed, 263 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0c7ee190/tools/generator-polygene/app/index.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/index.js b/tools/generator-polygene/app/index.js
index a13be9d..7f76c10 100644
--- a/tools/generator-polygene/app/index.js
+++ b/tools/generator-polygene/app/index.js
@@ -287,4 +287,77 @@ function assignFunctions(polygene) {
     polygene.firstUpper = function (text) {
         return text.charAt(0).toUpperCase() + text.substring(1);
     };
+    polygene.typeNameOnly = function(text) {
+        var lastPos = text.lastIndexOf(".");
+        if( lastPos < 0 ) {
+            return text;
+        }
+        return text.substring(lastPos + 1);
+    };
+
+    polygene.configurationClassName = function( clazzName ) {
+        if( clazzName.endsWith( "Service" )) {
+            clazzName = clazzName.substring(0, clazzName.length - 7 );
+        }
+        return clazzName + "Configuration";
+    };
+
+    polygene.prepareClazz = function (current) {
+        var state = [];
+        var imported = {};
+        var props = current.clazz.properties;
+        if( props ) {
+            for( var idx in props ) {
+                var prop = props[idx];
+                state.push( 'Property' + '<' + polygene.typeNameOnly(prop.type) + "> " + prop.name + "();")
+                imported[prop.type] = imported[prop.type];
+            }
+        } else {
+            state.push( 'Property<String> name();    // TODO: remove sample property')
+        }
+        var assocs = current.clazz.associations;
+        if( assocs ) {
+            for( var idx in assocs ) {
+                var assoc = assocs[idx];
+                state.push("Association" + '<' +  polygene.typeNameOnly(assoc.type) + '>' + assoc.name + "();")
+                imported[assoc.type] = imported[assoc.type] ;
+            }
+        }
+        assocs = current.clazz.manyassociations;
+        if( assocs ) {
+            for( var idx in assocs ) {
+                var assoc = assocs[idx];
+                state.push("ManyAssociation<" +  polygene.typeNameOnly(assoc.type) + ">" + assoc.name + "();")
+                imported[assoc.type] = imported[assoc.type] ;
+            }
+        }
+        assocs = current.clazz.namedassociations;
+        if( assocs ) {
+            for( var idx in assocs ) {
+                var assoc = assocs[idx];
+                state.push("NamedAssociation<" +  polygene.typeNameOnly(assoc.type) + ">" + assoc.name + "();")
+                imported[assoc.type] = imported[assoc.type];
+            }
+        }
+        current.state = state;
+        current.imported = imported;
+    };
+
+    polygene.prepareConfigClazz = function (current) {
+        var state = [];
+        var imported = {};
+        var props = current.clazz.configuration;
+        if( props ) {
+            for( var idx in props ) {
+                var prop = props[idx];
+                state.push( 'Property' + '<' + polygene.typeNameOnly(prop.type) + "> " + prop.name + "();")
+                imported[prop.type] = imported[prop.type];
+            }
+        } else {
+            state.push( 'Property<String> name();    // TODO: remove sample property')
+        }
+        current.state = state;
+        current.imported = imported;
+    };
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0c7ee190/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Configuration.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Configuration.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Configuration.tmpl
new file mode 100644
index 0000000..14c9735
--- /dev/null
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Configuration.tmpl
@@ -0,0 +1,37 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+-%>
+package <%= packageName %>.model.<%= polygene.current.name %>;
+
+import org.apache.polygene.api.injection.scope.This;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.property.Property;
+<%
+for( var prop in polygene.current.imported ) {
+    if( !prop.startsWith( "java.lang" )) {
+        %><%- "import " + prop + ";"; %><%
+    }
+} %>
+
+public interface <%= polygene.current.clazz.name %>
+{
+<% for( var idx in polygene.current.state ) { %>
+    <%- polygene.current.state[idx]; %>
+<% } %>
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0c7ee190/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Crud.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Crud.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Crud.tmpl
index 95eed76..ecec763 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Crud.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Crud.tmpl
@@ -22,13 +22,21 @@ package <%= packageName %>.model.<%= polygene.current.name %>;
 import org.apache.polygene.api.injection.scope.This;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.property.Property;
+<%
+for( var prop in polygene.current.imported ) {
+    if( !prop.startsWith( "java.lang" )) {
+        %><%- "import " + prop + ";"; %><%
+    }
+} %>
 
 @Mixins( { <%= polygene.current.clazz.name %>.Mixin.class } )
 public interface <%= polygene.current.clazz.name %>
 {
     interface State
     {
-        Property<String> name();     // Sample hidden property
+<% for( var idx in polygene.current.state ) { %>
+        <%- polygene.current.state[idx]; %>
+<% } %>
     }
 
     class Mixin

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0c7ee190/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Entity.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Entity.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Entity.tmpl
index 95eed76..ecec763 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Entity.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Entity.tmpl
@@ -22,13 +22,21 @@ package <%= packageName %>.model.<%= polygene.current.name %>;
 import org.apache.polygene.api.injection.scope.This;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.property.Property;
+<%
+for( var prop in polygene.current.imported ) {
+    if( !prop.startsWith( "java.lang" )) {
+        %><%- "import " + prop + ";"; %><%
+    }
+} %>
 
 @Mixins( { <%= polygene.current.clazz.name %>.Mixin.class } )
 public interface <%= polygene.current.clazz.name %>
 {
     interface State
     {
-        Property<String> name();     // Sample hidden property
+<% for( var idx in polygene.current.state ) { %>
+        <%- polygene.current.state[idx]; %>
+<% } %>
     }
 
     class Mixin

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0c7ee190/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Service.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Service.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Service.tmpl
index 0edefdc..5710441 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Service.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Service.tmpl
@@ -19,18 +19,34 @@
 -%>
 package <%= packageName %>.model.<%= polygene.current.name %>;
 
+import org.apache.polygene.api.configuration.Configuration;
 import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.injection.scope.This;
 import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
 import org.apache.polygene.api.value.ValueBuilderFactory;
+<%
+for( var prop in polygene.current.imported ) {
+    if( !prop.startsWith( "java.lang" )) {
+        %><%- "import " + prop + ";"; %><%
+    }
+} %>
 
 @Mixins( { <%= polygene.current.clazz.name %>.Mixin.class } )
 public interface <%= polygene.current.clazz.name %>
 {
+
     class Mixin
         implements <%= polygene.current.clazz.name %>
     {
+        @This
+        private Configuration<<%- polygene.configurationClassName( polygene.current.clazz.name ); %>> configuration;
+
         @Structure
         private ValueBuilderFactory vbf;
+
+        @Structure
+        private UnitOfWorkFactory uowf;
     }
 }
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0c7ee190/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Transient.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Transient.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Transient.tmpl
index 29f32e2..1fae121 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Transient.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Transient.tmpl
@@ -22,11 +22,19 @@ package <%= packageName %>.model.<%= polygene.current.name %>;
 import org.apache.polygene.api.injection.scope.Uses;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.property.Property;
+<%
+for( var prop in polygene.current.imported ) {
+    if( !prop.startsWith( "java.lang" )) {
+        %><%- "import " + prop + ";"; %><%
+    }
+} %>
 
 @Mixins( { <%= polygene.current.clazz.name %>.Mixin.class } )
 public interface <%= polygene.current.clazz.name %>
 {
-    Property<String> name();     // Sample hidden property
+<% for( var idx in polygene.current.state ) { %>
+        <%- polygene.current.state[idx]; %>
+<% } %>
 
     // If Property declarations are public, the Mixin must be abstract, because PropertyMixin will implement those methods.
     abstract class Mixin

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0c7ee190/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Value.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Value.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Value.tmpl
index 95eed76..c4194e7 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Value.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Value.tmpl
@@ -22,20 +22,27 @@ package <%= packageName %>.model.<%= polygene.current.name %>;
 import org.apache.polygene.api.injection.scope.This;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.property.Property;
+<%
+for( var prop in polygene.current.imported ) {
+    if( !prop.startsWith( "java.lang" )) {
+        %><%- "import " + prop + ";"; %><%
+    }
+} %>
 
 @Mixins( { <%= polygene.current.clazz.name %>.Mixin.class } )
 public interface <%= polygene.current.clazz.name %>
 {
     interface State
     {
-        Property<String> name();     // Sample hidden property
+<% for( var idx in polygene.current.state ) { %>
+        <%- polygene.current.state[idx]; %>
+<% } %>
     }
 
     class Mixin
         implements <%= polygene.current.clazz.name %>
     {
         @This
-        private State state;        // Sample reference to hidden property
-
+        private State state;        // Reference to private State instance
     }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0c7ee190/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl
index 3ee206c..17b391a 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl
@@ -23,14 +23,36 @@ import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.LayerAssembly;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-<% for( var idx in polygene.current.cruds) { %>
-<%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.cruds[idx].name + ";" %>
-<% } %>
-<% for( var idx in polygene.current.values) { %><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.values[idx].name + ";" %><% } %>
-<% for( var idx in polygene.current.entities) { %><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.entities[idx].name + ";" %><% } %>
-<% for( var idx in polygene.current.transients) { %><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.transients[idx].name + ";" %><% } %>
-<% for( var idx in polygene.current.objects) { %><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.objects[idx].name + ";" %><% } %>
-<% for( var idx in polygene.current.services) { %><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.services[idx].name + ";" %><% } %>
+
+<% for( var idx in polygene.current.cruds) {
+%><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.cruds[idx].name + ";" %>
+<%
+}
+
+for( var idx in polygene.current.values) {
+%><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.values[idx].name + ";" %>
+<%
+}
+for( var idx in polygene.current.entities) {
+%><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.entities[idx].name + ";" %>
+<%
+}
+
+for( var idx in polygene.current.transients) {
+%><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.transients[idx].name + ";" %>
+<%
+}
+
+for( var idx in polygene.current.objects) {
+%><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.objects[idx].name + ";" %>
+<%
+}
+
+for( var idx in polygene.current.services) {
+%><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.services[idx].name + ";" %>
+<%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.configurationClassName(polygene.current.services[idx].name) + ";" %>
+<%
+} %>
 
 import static org.apache.polygene.api.common.Visibility.layer;
 import static org.apache.polygene.api.common.Visibility.application;
@@ -42,46 +64,57 @@ public class <%- firstUpper(polygene.current.name) %>Module
     public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
         throws AssemblyException
     {
-<% if( polygene.current.cruds ) { %>
-  <% for( var value in polygene.current.cruds ) { %>
-    <% var crud1 = polygene.current.cruds[value]; %>
-    module.values(<%-  crud1.name + ".class" %>)<% if( crud1.visibility ) {%><%-".visibleIn(" + crud1.visibility +")"%><% } %>;
-  <% } %>
-  <% for( var value in polygene.current.cruds ) { %>
-    <% var crud2 = polygene.current.cruds[value]; %>
-        module.entities(<%= crud2.name + ".class" %>)<% if( crud2.visibility ) {%><%-".visibleIn(" + crud2.visibility +")"%><% } %>;
-  <% } %>
-<% } %>
-<% if( polygene.current.values ) { %>
-  <% for( var value in polygene.current.values ) { %>
-    <% var v = polygene.current.values[value]; %>
-        module.values(<%= v.name + ".class" %>)<% if( v.visibility ) {%><%-".visibleIn(" + v.visibility +")"%><% } %>;
-  <% } %>
-<% } %>
-<% if( polygene.current.entities ) { %>
-  <% for( var value in polygene.current.entities ) { %>
-    <% var entity = polygene.current.entities[value]; %>
-        module.values(<%= entity.name + ".class" %>)<% if( entity.visibility ) {%><%-".visibleIn(" + entity.visibility +")"%><% } %>;
-  <% } %>
-<% } %>
-<% if( polygene.current.transients ) { %>
-  <% for( var value in polygene.current.transients ) { %>
-    <% var trans = polygene.current.transients[value]; %>
-        module.values(<%= trans.name + ".class" %>)<% if( trans.visibility ) {%><%-".visibleIn(" + trans.visibility +")"%><% } %>;
-  <% } %>
-<% } %>
-<% if( polygene.current.objects ) { %>
-  <% for( var value in polygene.current.objects ) { %>
-    <% var obj = polygene.current.objects[value]; %>
-        module.values(<%= obj.name + ".class" %>)<% if( obj.visibility ) {%><%-".visibleIn(" + obj.visibility +")"%><% } %>;
-  <% } %>
-<% } %>
-<% if( polygene.current.services ) { %>
-  <% for( var value in polygene.current.services ) { %>
-    <% var service = polygene.current.services[value]; %>
-        module.values(<%= service.name + ".class" %>)<% if( service.visibility ) {%><%-".visibleIn(" + service.visibility +")"%><% } %>;
-  <% } %>
-<% } %>
+<%
+if( polygene.current.cruds ) {
+    for( var value in polygene.current.cruds ) {
+        var crud = polygene.current.cruds[value];
+%>
+        <%- "module.values( " + crud.name + ".class )" + (crud.visibility ? ".visibleIn(" + crud.visibility +")" : "" ) %>;
+        <%- "module.entities( " + crud.name + ".class )" + (crud.visibility ? ".visibleIn(" + crud.visibility +")" : "" ) %>;
+<%
+    }
+}
+if( polygene.current.values ) {
+    for( var value in polygene.current.values ) {
+        var v = polygene.current.values[value];
+%>
+        <%- "module.values( " + v.name + ".class )" + (v.visibility ? ".visibleIn(" + v.visibility +")" : "" ) %>;
+<%
+    }
+}
+if( polygene.current.entities ) {
+    for( var value in polygene.current.entities ) {
+        var entity = polygene.current.entities[value];
+%>
+        <%- "module.entities( " + entity.name + ".class )" + (entity.visibility ? ".visibleIn(" + entity.visibility +")" : "" ) %>;
+<%
+    }
+}
+if( polygene.current.transients ) {
+    for( var value in polygene.current.transients ) {
+        var trans = polygene.current.transients[value];
+%>
+        <%- "module.transients( " + trans.name + ".class )" + (trans.visibility ? ".visibleIn(" + trans.visibility +")" : "" ) %>;
+<%
+    }
+}
+if( polygene.current.objects ) {
+    for( var value in polygene.current.objects ) {
+        var obj = polygene.current.objects[value];
+%>
+        <%- "module.objects( " + obj.name + ".class )" + (obj.visibility ? ".visibleIn(" + obj.visibility +")" : "" ) %>;
+<%
+    }
+}
+if( polygene.current.services ) {
+    for( var value in polygene.current.services ) {
+        var service = polygene.current.services[value];
+%>
+        <%- "module.services( " + service.name + ".class )" + (service.visibility ? ".visibleIn(" + service.visibility + ")" : "" ) %>;
+        <%- "module.entities( " + polygene.configurationClassName(service.name) + ".class )" %>;
+<%
+    }
+} %>
         return module;
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0c7ee190/tools/generator-polygene/app/templates/DomainLayer/DomainModule/module.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/module.js b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/module.js
index 2ceeaa5..3aea91c 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/module.js
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/module.js
@@ -28,12 +28,19 @@ function copyPolygeneDomainModule(p, moduleName, moduleDef) {
     copyComposites(p, moduleDef.transients, "Transient");
     copyComposites(p, moduleDef.objects, "Object");
     copyComposites(p, moduleDef.services, "Service");
+    copyComposites(p, moduleDef.services, "Configuration");
 }
 
 function copyComposites(p, composites, type) {
     for (var idx in composites) {
         if (composites.hasOwnProperty(idx)) {
-            p.current.clazz = composites[idx];
+            if( type === "Configuration"){
+                p.current.clazz.name = p.configurationClassName(composites[idx].name);
+                p.prepareConfigClazz(p.current);
+            } else {
+                p.current.clazz = composites[idx];
+                p.prepareClazz(p.current);
+            }
             p.copyTemplate(p.ctx,
                 'DomainLayer/DomainModule/' + type + '.tmpl',
                 'model/src/main/java/' + p.javaPackageDir + '/model/' + p.current.name  + '/' + p.current.clazz.name + '.java');

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0c7ee190/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl b/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl
index 63401be..68be6f3 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl
@@ -28,15 +28,18 @@ public class DomainLayer extends LayeredLayerAssembler
     implements LayerAssembler
 {
     @Override
-    public LayerAssembly assemble(LayerAssembly layer)
+    public LayerAssembly assemble( LayerAssembly layer )
         throws AssemblyException
     {
-<% if( hasFeature( 'rest api' ) ) { %>
-        createModule( layer, CrudModule.class );
-<% } %>
-<% if( hasFeature( 'security' ) ) { %>
-        createModule( layer, SecurityModule.class );
-<% } %>
+<% if( hasFeature( 'rest api' ) ) {
+%>        createModule( layer, CrudModule.class );<%
+}
+for( var mod in polygene.modules ) {%>
+<%- "        createModule( layer, " + polygene.firstUpper(mod) + "Module.class );" %><%
+}
+if( hasFeature( 'security' ) ) {
+%>        createModule( layer, SecurityModule.class );<%
+} %>
         return layer;
     }
 }
\ No newline at end of file