springmvc-scaffold 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.travis.yml +7 -0
  4. data/Gemfile +4 -0
  5. data/Gemfile.lock +45 -0
  6. data/README.markdown +31 -0
  7. data/Rakefile +9 -0
  8. data/bin/springmvc +7 -0
  9. data/lib/springmvc-scaffold.rb +14 -0
  10. data/lib/springmvc-scaffold/configuration.rb +50 -0
  11. data/lib/springmvc-scaffold/execution.rb +20 -0
  12. data/lib/springmvc-scaffold/generators/app/app_generator.rb +123 -0
  13. data/lib/springmvc-scaffold/generators/app/dependencies.rb +26 -0
  14. data/lib/springmvc-scaffold/generators/app/dependency.rb +15 -0
  15. data/lib/springmvc-scaffold/generators/app/templates/build.gradle.erb +56 -0
  16. data/lib/springmvc-scaffold/generators/app/templates/models/Entity.erb +46 -0
  17. data/lib/springmvc-scaffold/generators/app/templates/orm/Repository-hibernate.java.tt +51 -0
  18. data/lib/springmvc-scaffold/generators/app/templates/orm/Repository-jpa.java.tt +49 -0
  19. data/lib/springmvc-scaffold/generators/app/templates/pom.erb +95 -0
  20. data/lib/springmvc-scaffold/generators/app/templates/resources/hibernate.properties +16 -0
  21. data/lib/springmvc-scaffold/generators/app/templates/resources/log4j.properties +4 -0
  22. data/lib/springmvc-scaffold/generators/app/templates/resources/messages.properties +0 -0
  23. data/lib/springmvc-scaffold/generators/app/templates/springmvc-scaffold.erb +6 -0
  24. data/lib/springmvc-scaffold/generators/app/templates/webapp/.bowerrc +3 -0
  25. data/lib/springmvc-scaffold/generators/app/templates/webapp/WEB-INF/jsp/decorators/main.jsp +15 -0
  26. data/lib/springmvc-scaffold/generators/app/templates/webapp/WEB-INF/jsp/prelude.jspf +4 -0
  27. data/lib/springmvc-scaffold/generators/app/templates/webapp/WEB-INF/sitemesh3.xml +3 -0
  28. data/lib/springmvc-scaffold/generators/app/templates/webapp/WEB-INF/spring-servlet.xml.tt +42 -0
  29. data/lib/springmvc-scaffold/generators/app/templates/webapp/WEB-INF/web.xml.tt +52 -0
  30. data/lib/springmvc-scaffold/generators/app/templates/webapp/bower.json.tt +7 -0
  31. data/lib/springmvc-scaffold/generators/app/templates/webapp/stylesheets/application.css +38 -0
  32. data/lib/springmvc-scaffold/generators/base.rb +17 -0
  33. data/lib/springmvc-scaffold/generators/scaffold/attribute.rb +68 -0
  34. data/lib/springmvc-scaffold/generators/scaffold/base_scaffold.rb +54 -0
  35. data/lib/springmvc-scaffold/generators/scaffold/controller/controller_generator.rb +20 -0
  36. data/lib/springmvc-scaffold/generators/scaffold/controller/templates/controller.erb +126 -0
  37. data/lib/springmvc-scaffold/generators/scaffold/controller/templates/controller_test.erb +13 -0
  38. data/lib/springmvc-scaffold/generators/scaffold/imports.rb +18 -0
  39. data/lib/springmvc-scaffold/generators/scaffold/jsp/jsp_generator.rb +40 -0
  40. data/lib/springmvc-scaffold/generators/scaffold/jsp/templates/edit.erb +15 -0
  41. data/lib/springmvc-scaffold/generators/scaffold/jsp/templates/form.erb +14 -0
  42. data/lib/springmvc-scaffold/generators/scaffold/jsp/templates/index.erb +38 -0
  43. data/lib/springmvc-scaffold/generators/scaffold/jsp/templates/new.erb +14 -0
  44. data/lib/springmvc-scaffold/generators/scaffold/jsp/templates/show.erb +16 -0
  45. data/lib/springmvc-scaffold/generators/scaffold/model/model_generator.rb +16 -0
  46. data/lib/springmvc-scaffold/generators/scaffold/model/templates/model.erb +22 -0
  47. data/lib/springmvc-scaffold/generators/scaffold/model/templates/model_test.erb +13 -0
  48. data/lib/springmvc-scaffold/generators/scaffold/repository/repository_generator.rb +30 -0
  49. data/lib/springmvc-scaffold/generators/scaffold/repository/templates/repository.erb +18 -0
  50. data/lib/springmvc-scaffold/generators/scaffold/repository/templates/repository_test.erb +13 -0
  51. data/lib/springmvc-scaffold/generators/scaffold/scaffold_generator.rb +31 -0
  52. data/lib/springmvc-scaffold/runner.rb +7 -0
  53. data/lib/springmvc-scaffold/runner/commands_help.rb +11 -0
  54. data/lib/springmvc-scaffold/runner/generator.rb +14 -0
  55. data/lib/springmvc-scaffold/runner/help.rb +10 -0
  56. data/lib/springmvc-scaffold/runner/scaffold.rb +15 -0
  57. data/lib/springmvc-scaffold/version.rb +3 -0
  58. data/spec/spec_helper.rb +23 -0
  59. data/spec/springmvc-scaffold/configuration_spec.rb +124 -0
  60. data/spec/springmvc-scaffold/execution_spec.rb +40 -0
  61. data/spec/springmvc-scaffold/generators/app/app_generator_spec.rb +226 -0
  62. data/spec/springmvc-scaffold/generators/app/dependency_spec.rb +14 -0
  63. data/spec/springmvc-scaffold/generators/app/templates/Entity.java +46 -0
  64. data/spec/springmvc-scaffold/generators/app/templates/RepositoryJPA.java +49 -0
  65. data/spec/springmvc-scaffold/generators/app/templates/build.gradle +59 -0
  66. data/spec/springmvc-scaffold/generators/app/templates/pom.xml +146 -0
  67. data/spec/springmvc-scaffold/generators/app/templates/springmvc-scaffold.properties +6 -0
  68. data/spec/springmvc-scaffold/generators/scaffold/attribute_spec.rb +215 -0
  69. data/spec/springmvc-scaffold/generators/scaffold/base_scaffold_spec.rb +70 -0
  70. data/spec/springmvc-scaffold/generators/scaffold/controller/controller_generator_spec.rb +53 -0
  71. data/spec/springmvc-scaffold/generators/scaffold/controller/templates/ProductsController.java +97 -0
  72. data/spec/springmvc-scaffold/generators/scaffold/imports_spec.rb +9 -0
  73. data/spec/springmvc-scaffold/generators/scaffold/jsp/jsp_generator_spec.rb +46 -0
  74. data/spec/springmvc-scaffold/generators/scaffold/jsp/templates/form.jsp +25 -0
  75. data/spec/springmvc-scaffold/generators/scaffold/model/model_generator_spec.rb +28 -0
  76. data/spec/springmvc-scaffold/generators/scaffold/model/templates/Product.java +43 -0
  77. data/spec/springmvc-scaffold/generators/scaffold/repository/repository_generator_spec.rb +49 -0
  78. data/spec/springmvc-scaffold/generators/scaffold/repository/templates/Clients.java +16 -0
  79. data/spec/springmvc-scaffold/generators/scaffold/repository/templates/Products.java +10 -0
  80. data/spec/springmvc-scaffold/generators/scaffold/scaffold_generator_spec.rb +60 -0
  81. data/spec/springmvc-scaffold/runner/commands_help_spec.rb +13 -0
  82. data/spec/springmvc-scaffold/runner/generator_spec.rb +21 -0
  83. data/spec/springmvc-scaffold/runner/help_spec.rb +22 -0
  84. data/spec/springmvc-scaffold/runner/scaffold_spec.rb +36 -0
  85. data/spec/springmvc-scaffold_spec.rb +4 -0
  86. data/springmvc-scaffold.gemspec +27 -0
  87. metadata +185 -0
@@ -0,0 +1,54 @@
1
+ class BaseScaffold < SpringMvcScaffold::Base
2
+
3
+ def initialize(model, attributes={})
4
+ super()
5
+ @model = model
6
+ @attributes = attributes
7
+ end
8
+
9
+ def class_name
10
+ @model.camelize
11
+ end
12
+
13
+ def model_parameter_name
14
+ @model.camelize(:lower)
15
+ end
16
+
17
+ def test_class_name
18
+ "#{class_name}Test"
19
+ end
20
+
21
+ def repository_class_name
22
+ class_name.pluralize
23
+ end
24
+
25
+ def repository_name
26
+ repository_class_name.downcase
27
+ end
28
+
29
+ def repository_test_class_name
30
+ "#{class_name.pluralize}Test"
31
+ end
32
+
33
+ def controller_class_name
34
+ "#{class_name.pluralize}Controller"
35
+ end
36
+
37
+ def controller_test_class_name
38
+ "#{class_name.pluralize}ControllerTest"
39
+ end
40
+
41
+ def base_path
42
+ model_parameter_name.pluralize
43
+ end
44
+
45
+ def imports
46
+ @attributes.map(&:import).uniq.reject(&:empty?).flatten
47
+ end
48
+
49
+ protected
50
+ def define_source_paths
51
+ source_paths << File.expand_path(template_path) if File.exist?(template_path)
52
+ source_paths << source_root
53
+ end
54
+ end
@@ -0,0 +1,20 @@
1
+ class ControllerGenerator < BaseScaffold
2
+
3
+ def build
4
+ define_source_paths
5
+ template("controller.erb", Configuration.main_class_path(Configuration.controllers_package, "#{controller_class_name}.java"))
6
+ template("controller_test.erb", Configuration.test_class_path(Configuration.controllers_package, "#{controller_test_class_name}.java"))
7
+ end
8
+
9
+ def template_path
10
+ "src/templates/controllers"
11
+ end
12
+
13
+ def path
14
+ "/#{base_path}"
15
+ end
16
+
17
+ def source_root
18
+ File.join(File.dirname(__FILE__), "templates")
19
+ end
20
+ end
@@ -0,0 +1,126 @@
1
+ package <%= Configuration.package %>.<%= Configuration.controllers_package %>;
2
+
3
+ import static org.springframework.web.bind.annotation.RequestMethod.DELETE;
4
+ import static org.springframework.web.bind.annotation.RequestMethod.GET;
5
+ import static org.springframework.web.bind.annotation.RequestMethod.POST;
6
+
7
+ import javax.validation.Valid;
8
+
9
+ import org.springframework.beans.factory.annotation.Autowired;
10
+ import org.springframework.stereotype.Controller;
11
+ import org.springframework.validation.BindingResult;
12
+ import org.springframework.web.bind.annotation.PathVariable;
13
+ import org.springframework.web.bind.annotation.RequestMapping;
14
+ import org.springframework.web.servlet.ModelAndView;
15
+ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
16
+
17
+ import <%= Configuration.full_models_package %>.<%= class_name %>;
18
+ import <%= Configuration.package %>.<%= Configuration.repositories_package %>.<%= repository_class_name %>;
19
+ <%- @attributes.each do |att| -%>
20
+ <%- if att.is_reference? -%>
21
+ import <%= Configuration.package %>.<%= Configuration.repositories_package %>.<%= att.java_type.pluralize %>;
22
+ <%- end -%>
23
+ <%- end -%>
24
+
25
+ @Controller
26
+ public class <%= controller_class_name %> {
27
+
28
+ private final <%= repository_class_name %> <%= repository_name %>;
29
+ <%- @attributes.each do |att| -%>
30
+ <%- if att.is_reference? -%>
31
+ private final <%= att.java_type.pluralize %> <%= att.name.pluralize %>;
32
+ <%- end -%>
33
+ <%- end -%>
34
+
35
+ @Autowired
36
+ public <%= controller_class_name %>(final <%= repository_class_name %> <%= repository_name %><% @attributes.each do |att| -%>
37
+ <%- if att.is_reference? -%>, final <%= att.java_type.pluralize %> <%= att.name.pluralize %><%- end -%><% end -%>) {
38
+ this.<%= repository_name %> = <%= repository_name %>;
39
+ <%- @attributes.each do |att| -%>
40
+ <%- if att.is_reference? -%>
41
+ this.<%= att.name.pluralize %> = <%= att.name.pluralize %>;
42
+ <%- end -%>
43
+ <%- end -%>
44
+ }
45
+
46
+ @RequestMapping(value = "<%= path %>", method = GET)
47
+ public ModelAndView index() {
48
+ return new ModelAndView("<%= base_path %>/index", "<%= model_parameter_name %>List", <%= repository_name %>.all());
49
+ }
50
+
51
+ @RequestMapping(value = "<%= path %>/{id}", method = GET)
52
+ public ModelAndView show(@PathVariable final Long id) {
53
+ return new ModelAndView("<%= base_path %>/show", "<%= model_parameter_name %>", <%= repository_name %>.get(id));
54
+ }
55
+
56
+ @RequestMapping(value = "<%= path %>/new", method = GET)
57
+ public ModelAndView new<%= class_name %>() {
58
+ ModelAndView model = new ModelAndView("<%= base_path %>/new<%= class_name %>", "<%= model_parameter_name %>", new <%= class_name %>());
59
+ <%- @attributes.each do |att| -%>
60
+ <%- if att.is_reference? -%>
61
+ model.addObject("<%= att.name %>List", <%= att.name.pluralize %>.all());
62
+ <%- end -%>
63
+ <%- end -%>
64
+ return model;
65
+ }
66
+
67
+ @RequestMapping(value = "<%= path %>", method = POST)
68
+ public ModelAndView create(@Valid final <%= class_name %> <%= model_parameter_name %>, final BindingResult result,
69
+ final RedirectAttributes attrs) {
70
+ ModelAndView model = new ModelAndView();
71
+ if(result.hasErrors()) {
72
+ model.setViewName("<%= base_path %>/new<%= class_name %>");
73
+ <%- @attributes.each do |att| -%>
74
+ <%- if att.is_reference? -%>
75
+ model.addObject("<%= att.name %>List", <%= att.name.pluralize %>.all());
76
+ <%- end -%>
77
+ <%- end -%>
78
+ return model;
79
+ }
80
+
81
+ <%= repository_name %>.add(<%= model_parameter_name %>);
82
+ model.setViewName("redirect:<%= path %>/{id}");
83
+ model.addObject("id", <%= model_parameter_name %>.getId());
84
+ attrs.addFlashAttribute("message", "<%= class_name %> was successfully created.");
85
+ return model;
86
+ }
87
+
88
+ @RequestMapping(value = "<%= path %>/{id}/edit", method = GET)
89
+ public ModelAndView edit(@PathVariable final Long id) {
90
+ ModelAndView model = new ModelAndView("<%= base_path %>/edit", "<%= model_parameter_name %>", <%= repository_name %>.get(id));
91
+ <%- @attributes.each do |att| -%>
92
+ <%- if att.is_reference? -%>
93
+ model.addObject("<%= att.name %>List", <%= att.name.pluralize %>.all());
94
+ <%- end -%>
95
+ <%- end -%>
96
+ return model;
97
+ }
98
+
99
+ @RequestMapping(value = "<%= path %>/update", method = POST)
100
+ public ModelAndView update(@Valid final <%= class_name %> <%= model_parameter_name %>, final BindingResult result,
101
+ final RedirectAttributes attrs) {
102
+ ModelAndView model = new ModelAndView();
103
+ if(result.hasErrors()) {
104
+ model.setViewName("<%= base_path %>/edit");
105
+ <%- @attributes.each do |att| -%>
106
+ <%- if att.is_reference? -%>
107
+ model.addObject("<%= att.name %>List", <%= att.name.pluralize %>.all());
108
+ <%- end -%>
109
+ <%- end -%>
110
+ return model;
111
+ }
112
+
113
+ <%= repository_name %>.update(<%= model_parameter_name %>);
114
+ model.setViewName("redirect:<%= path %>/{id}");
115
+ model.addObject("id", <%= model_parameter_name %>.getId());
116
+ attrs.addFlashAttribute("message", "<%= class_name %> was successfully updated.");
117
+ return model;
118
+ }
119
+
120
+ @RequestMapping(value = "<%= path %>/{id}", method = DELETE)
121
+ public String destroy(@PathVariable final Long id, final RedirectAttributes attrs) {
122
+ <%= repository_name %>.remove(id);
123
+ attrs.addFlashAttribute("message", "<%= class_name %> was successfully destroyed.");
124
+ return "redirect:<%= path %>";
125
+ }
126
+ }
@@ -0,0 +1,13 @@
1
+ package <%= Configuration.package %>.<%= Configuration.controllers_package %>;
2
+
3
+ import static org.junit.Assert.assertNotNull;
4
+
5
+ import org.junit.Test;
6
+
7
+ public class <%= controller_test_class_name %> {
8
+
9
+ @Test
10
+ public void fakeTest() {
11
+ assertNotNull("test something real");
12
+ }
13
+ }
@@ -0,0 +1,18 @@
1
+ class Imports
2
+ attr_accessor :type
3
+
4
+ def initialize(type)
5
+ @type = type
6
+ packages
7
+ end
8
+
9
+ def package
10
+ packages[type.to_sym] or []
11
+ end
12
+
13
+ def packages
14
+ {
15
+ date: ["java.util.Date"],
16
+ }
17
+ end
18
+ end
@@ -0,0 +1,40 @@
1
+ class JspGenerator < BaseScaffold
2
+
3
+ def build
4
+ define_source_paths
5
+ create_view("index")
6
+ create_view("show")
7
+ create_view("form")
8
+ create_view("edit")
9
+ create_view("new", "new#{class_name}")
10
+ end
11
+
12
+ def create_view(template_name, file_name=template_name)
13
+ template("#{template_name}.erb", "#{views_path}/#{file_name}.#{extension}")
14
+ end
15
+
16
+ def views_path
17
+ File.join(Configuration::WEB_INF, view_folder, base_path)
18
+ end
19
+
20
+ def template_path
21
+ "src/templates/views"
22
+ end
23
+
24
+ def view_folder
25
+ "jsp"
26
+ end
27
+
28
+ def extension
29
+ "jsp"
30
+ end
31
+
32
+ def path url=""
33
+ %Q{${pageContext.request.contextPath}/#{base_path}#{url}}
34
+ end
35
+
36
+ def source_root
37
+ File.join(File.dirname(__FILE__), "templates")
38
+ end
39
+
40
+ end
@@ -0,0 +1,15 @@
1
+ <head>
2
+ <title><%= class_name %> [edit]</title>
3
+ </head>
4
+ <body>
5
+ <h1>Editing <%= class_name %></h1>
6
+ <form:form action="<%= path %>/update" commandName="<%= model_parameter_name %>">
7
+ <form:hidden path="id"/>
8
+ <%%@include file="form.jsp"%>
9
+ <div class="actions">
10
+ <button type="submit">Update <%= class_name %></button>
11
+ </div>
12
+ </form:form>
13
+ </body>
14
+
15
+ <a href="<%= path %>">Back</a>
@@ -0,0 +1,14 @@
1
+ <% @attributes.each do |att| -%>
2
+ <div class="field">
3
+ <%= att.html_label %>:<br />
4
+ <%- if att.is_reference? -%>
5
+ <form:select path="<%=att.name%>.id">
6
+ <form:options items="${<%=att.name%>List}" itemValue="id" itemLabel="id"/>
7
+ </form:select>
8
+ <%- else -%>
9
+ <form:<%= att.html_input %> path="<%=att.name%>" />
10
+ <form:errors path="<%=att.name%>" />
11
+ <%- end -%>
12
+ </div>
13
+
14
+ <% end -%>
@@ -0,0 +1,38 @@
1
+ <head>
2
+ <title><%= class_name %> [index]</title>
3
+ </head>
4
+ <body>
5
+ <p id="message">${message}</p>
6
+
7
+ <h1>Listing <%= class_name.pluralize %></h1>
8
+
9
+ <table>
10
+ <tr>
11
+ <%- @attributes.each do |att| -%>
12
+ <th><%= att.html_label %></th>
13
+ <%- end -%>
14
+ <th></th>
15
+ <th></th>
16
+ <th></th>
17
+ </tr>
18
+
19
+ <c:forEach items="${<%=model_parameter_name%>List}" var="<%=model_parameter_name%>">
20
+ <tr>
21
+ <%- @attributes.each do |att| -%>
22
+ <td><%= "${#{model_parameter_name}.#{att.name}}" %></td>
23
+ <%- end -%>
24
+ <td><a href="<%= path "/${#{model_parameter_name}.id}" %>">show</a></td>
25
+ <td><a href="<%= path "/${#{model_parameter_name}.id}/edit" %>">edit</a></td>
26
+ <td>
27
+ <form action="<%= path "/${#{model_parameter_name}.id}" %>" method="post">
28
+ <input type="hidden" name="_method" value="delete"/>
29
+ <button type="submit" onclick="return confirm('Are you sure?')">destroy</button>
30
+ </form>
31
+ </td>
32
+ </tr>
33
+ </c:forEach>
34
+ </table>
35
+
36
+ <br />
37
+ <a href="<%= path '/new' %>">New <%= class_name %></a>
38
+ </body>
@@ -0,0 +1,14 @@
1
+ <head>
2
+ <title><%= class_name %> [new]</title>
3
+ </head>
4
+ <body>
5
+ <h1>New <%= class_name %></h1>
6
+ <form:form action="<%= path %>" commandName="<%= model_parameter_name %>">
7
+ <%%@include file="form.jsp"%>
8
+ <div class="actions">
9
+ <button type="submit">Create <%= class_name %></button>
10
+ </div>
11
+ </form:form>
12
+ </body>
13
+
14
+ <a href="<%= path %>">Back</a>
@@ -0,0 +1,16 @@
1
+ <head>
2
+ <title><%= class_name %> [show]</title>
3
+ </head>
4
+ <body>
5
+ <p id="message">${message}</p>
6
+
7
+ <%- @attributes.each do |att| -%>
8
+ <p>
9
+ <b><%= att.html_label %>:</b>
10
+ <%= "${#{model_parameter_name}.#{att.name}}" %>
11
+ </p>
12
+ <% end -%>
13
+
14
+ <a href="<%= path "/${#{model_parameter_name}.id}/edit" %>">Edit</a>
15
+ <a href="<%= path %>">Back</a>
16
+ </body>
@@ -0,0 +1,16 @@
1
+ class ModelGenerator < BaseScaffold
2
+
3
+ def build
4
+ define_source_paths
5
+ template("model.erb", Configuration.main_class_path(Configuration.models_package, "#{class_name}.java"))
6
+ template("model_test.erb", Configuration.test_class_path(Configuration.models_package, "#{test_class_name}.java"))
7
+ end
8
+
9
+ def template_path
10
+ "src/templates/models"
11
+ end
12
+
13
+ def source_root
14
+ File.join(File.dirname(__FILE__), "templates")
15
+ end
16
+ end
@@ -0,0 +1,22 @@
1
+ package <%= Configuration.full_models_package %>;
2
+ <% imports.each do |import| %>
3
+ import <%= import %>;
4
+ <% end %>
5
+ @javax.persistence.Entity
6
+ public class <%= class_name %> extends Entity {
7
+
8
+ <% @attributes.each do |att| -%>
9
+ private <%= att.declaration %>;
10
+ <% end -%>
11
+
12
+ <% @attributes.each do |att| -%>
13
+ public void <%= att.setter_name %>(<%= att.declaration %>) {
14
+ this.<%= att.name %> = <%= att.name %>;
15
+ }
16
+
17
+ public <%= att.java_type %> <%= att.getter_name %>() {
18
+ return <%= att.name %>;
19
+ }
20
+
21
+ <% end -%>
22
+ }
@@ -0,0 +1,13 @@
1
+ package <%= Configuration.full_models_package %>;
2
+
3
+ import static org.junit.Assert.assertNotNull;
4
+
5
+ import org.junit.Test;
6
+
7
+ public class <%= test_class_name %> {
8
+
9
+ @Test
10
+ public void fakeTest() {
11
+ assertNotNull("test something real", new <%= class_name %>());
12
+ }
13
+ }
@@ -0,0 +1,30 @@
1
+ class RepositoryGenerator < BaseScaffold
2
+
3
+ def build
4
+ define_source_paths
5
+ template("repository.erb", Configuration.main_class_path(Configuration.repositories_package, "#{repository_class_name}.java"))
6
+ template("repository_test.erb", Configuration.test_class_path(Configuration.repositories_package, "#{repository_test_class_name}.java"))
7
+ end
8
+
9
+ def template_path
10
+ "src/templates/repositories"
11
+ end
12
+
13
+ def orm_import
14
+ return "org.hibernate.SessionFactory" if Configuration.hibernate?
15
+ "javax.persistence.EntityManager"
16
+ end
17
+
18
+ def orm_parameter_name
19
+ return "sessionFactory" if Configuration.hibernate?
20
+ "entityManager"
21
+ end
22
+
23
+ def orm_class
24
+ orm_parameter_name.camelize
25
+ end
26
+
27
+ def source_root
28
+ File.join(File.dirname(__FILE__), "templates")
29
+ end
30
+ end