kody 0.0.2

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 (31) hide show
  1. checksums.yaml +7 -0
  2. data/bin/kody +41 -0
  3. data/lib/kody.rb +58 -0
  4. data/lib/kody/app.rb +73 -0
  5. data/lib/kody/builder/attribute_builder.rb +88 -0
  6. data/lib/kody/builder/class_builder.rb +159 -0
  7. data/lib/kody/builder/project_builder.rb +15 -0
  8. data/lib/kody/builder/relation_builder.rb +110 -0
  9. data/lib/kody/engine/demoiselle/datatype.rb +93 -0
  10. data/lib/kody/engine/demoiselle/demoiselle.rb +320 -0
  11. data/lib/kody/engine/demoiselle/templates/beans.xml.tpl +4 -0
  12. data/lib/kody/engine/demoiselle/templates/businnes.tpl +14 -0
  13. data/lib/kody/engine/demoiselle/templates/entity.tpl +62 -0
  14. data/lib/kody/engine/demoiselle/templates/enumeration.tpl +28 -0
  15. data/lib/kody/engine/demoiselle/templates/exemplo.xmi +123 -0
  16. data/lib/kody/engine/demoiselle/templates/messages.tpl +7 -0
  17. data/lib/kody/engine/demoiselle/templates/persistence.tpl +13 -0
  18. data/lib/kody/engine/demoiselle/templates/persistence.xml.tpl +23 -0
  19. data/lib/kody/engine/demoiselle/templates/pom.xml.tpl +46 -0
  20. data/lib/kody/engine/demoiselle/templates/view_edit.tpl +42 -0
  21. data/lib/kody/engine/demoiselle/templates/view_list.tpl +46 -0
  22. data/lib/kody/engine/demoiselle/templates/view_mb_edit.tpl +48 -0
  23. data/lib/kody/engine/demoiselle/templates/view_mb_list.tpl +47 -0
  24. data/lib/kody/engine/generic/generic.rb +151 -0
  25. data/lib/kody/model.rb +20 -0
  26. data/lib/kody/modules.rb +19 -0
  27. data/lib/kody/parser.rb +13 -0
  28. data/lib/kody/properties.rb +41 -0
  29. data/lib/kody/string.rb +16 -0
  30. data/lib/kody/util.rb +17 -0
  31. metadata +174 -0
@@ -0,0 +1,4 @@
1
+ <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
3
+
4
+ </beans>
@@ -0,0 +1,14 @@
1
+ package {{class.business_package}};
2
+
3
+ import br.gov.frameworkdemoiselle.stereotype.BusinessController;
4
+ import br.gov.frameworkdemoiselle.template.DelegateCrud;
5
+
6
+ import {{class.package}}.{{class.name}};
7
+ import {{class.persistence_package}}.{{class.name}}DAO;
8
+
9
+ @BusinessController
10
+ public class {{class.name}}BC extends DelegateCrud<{{class.name}}, Long, {{class.name}}DAO> {
11
+
12
+ private static final long serialVersionUID = 1L;
13
+
14
+ }
@@ -0,0 +1,62 @@
1
+ package {{class.package}};
2
+
3
+ import javax.persistence.Column;
4
+ import javax.persistence.Entity;
5
+ import javax.persistence.Table;{% if class.extends == null %}
6
+ import java.io.Serializable;
7
+ import javax.persistence.GeneratedValue;
8
+ import javax.persistence.GenerationType;
9
+ import javax.persistence.Id;
10
+ import javax.persistence.SequenceGenerator;{% endif %}{% for import in class.imports %}
11
+ import {{import}};{% endfor %}
12
+
13
+ /**
14
+ * {{class.name}}
15
+ */
16
+ @Entity
17
+ @Table(name = "{{class.table_name}}"){% for annotation in class.annotations %}
18
+ {{annotation}}{% endfor %}{% if class.extends == null %}
19
+ @SequenceGenerator(name = "{{class.sequence_name}}", sequenceName = "{{class.sequence_name}}"){% endif %}
20
+ public class {{class.name}}{% if class.extends != null %} extends {{class.extends}}{% else %} implements Serializable{% endif %} {
21
+
22
+ private static final long serialVersionUID = 1L;{% if class.extends == null %}
23
+
24
+ @Id
25
+ @GeneratedValue(strategy = GenerationType.AUTO, generator = "{{class.sequence_name}}")
26
+ private Long id;
27
+ {% endif %}
28
+ {% for attribute in class.attributes %} {% for annotation in attribute.annotations %}{{annotation}}
29
+ {% endfor %}private {{attribute.type}} {{attribute.name}};
30
+
31
+ {% endfor %}{% for ass in class.relations %} {% for annotation in ass.annotations %} {{annotation}}
32
+ {% endfor %} private {{ass.att_type}} {{ass.name}}{{ass.initialize}};
33
+
34
+ {% endfor %}{% if class.extends == null %} public Long getId() {
35
+ return id;
36
+ }
37
+
38
+ public void setId(Long id) {
39
+ this.id = id;
40
+ }{% endif %}{% for attribute in class.attributes %}
41
+ {{attribute.visibility}} void set{{attribute.name | capitalize_first}}({{attribute.type | java}} {{attribute.name}}) {
42
+ this.{{attribute.name}} = {{attribute.name}};
43
+ }
44
+
45
+ {{attribute.visibility}} {{class.name}} with{{attribute.name | capitalize_first}}({{attribute.type | java}} {{attribute.name}}) {
46
+ this.set{{attribute.name | capitalize_first}}({{attribute.name}});
47
+ return this;
48
+ }
49
+
50
+ {{attribute.anotatios}}{{attribute.visibility}} {{attribute.type | java}} get{{attribute.name | capitalize_first}}() {
51
+ return this.{{attribute.name}};
52
+ }
53
+ {% endfor %}{% for ass in class.relations %}
54
+ {{ass.visibility}} void set{{ass.name | capitalize_first}}({{ass.att_type}} {{ass.name}}) {
55
+ this.{{ass.name}} = {{ass.name}};
56
+ }
57
+
58
+ {{ass.visibility}} {{ass.att_type}} get{{ass.name | capitalize_first}}() {
59
+ return this.{{ass.name}};
60
+ }
61
+ {% endfor %}
62
+ }
@@ -0,0 +1,28 @@
1
+ package {{class.package}};
2
+
3
+ /**
4
+ * {{class.name}}
5
+ */
6
+ public enum {{class.name}} {
7
+
8
+ {% for attribute in class.attributes %}{% if forloop.last %} {{attribute.name}}({{attribute.initial_value}}){% else %} {{attribute.name}}({{attribute.initial_value}}),
9
+ {% endif %}{% endfor %};
10
+
11
+ {{class.enum_type}} value;
12
+
13
+ {{class.name}}({{class.enum_type}} value) {
14
+ this.value = value;
15
+ }
16
+
17
+ public {{class.enum_type}} getValue() {
18
+ return value;
19
+ }
20
+
21
+ public String toString() {
22
+ return "" + value;
23
+ }{% if class.enum_type != "String" %}
24
+
25
+ public {{class.name}} valueOf({{class.enum_type}} value) {
26
+ return super.valueOf({{class.name}}.class, value.toString());
27
+ }{% endif %}
28
+ }
@@ -0,0 +1,123 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <XMI verified="false" xmi.version="1.2" timestamp="2013-03-23T01:40:51" xmlns:UML="http://schema.omg.org/spec/UML/1.3">
3
+ <XMI.header>
4
+ <XMI.documentation>
5
+ <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
6
+ <XMI.exporterVersion>1.5.8</XMI.exporterVersion>
7
+ <XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
8
+ </XMI.documentation>
9
+ <XMI.metamodel xmi.version="1.3" href="UML.xml" xmi.name="UML"/>
10
+ </XMI.header>
11
+ <XMI.content>
12
+ <UML:Model isSpecification="false" isAbstract="false" isLeaf="false" xmi.id="m1" isRoot="false" name="UML Model">
13
+ <UML:Namespace.ownedElement>
14
+ <UML:Stereotype visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="folder" name="folder"/>
15
+ <UML:Stereotype visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="datatype" name="datatype"/>
16
+ <UML:Stereotype visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Entity" name="Entity"/>
17
+ <UML:Model stereotype="folder" visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Logical View" name="Logical View">
18
+ <UML:Namespace.ownedElement>
19
+ <UML:Package stereotype="folder" visibility="public" isSpecification="false" namespace="Logical View" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Datatypes" name="Datatypes">
20
+ <UML:Namespace.ownedElement/>
21
+ </UML:Package>
22
+ <UML:Package visibility="public" isSpecification="false" namespace="Logical View" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="RZKQt0xYO05D" name="com">
23
+ <UML:Namespace.ownedElement>
24
+ <UML:Package visibility="public" isSpecification="false" namespace="RZKQt0xYO05D" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="xOyMo5sr7YFm" name="marvinsiq">
25
+ <UML:Namespace.ownedElement>
26
+ <UML:Class stereotype="Entity" visibility="public" isSpecification="false" namespace="xOyMo5sr7YFm" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="3o63lZFdKwuO" name="Aluno">
27
+ <UML:Classifier.feature>
28
+ <UML:Attribute visibility="public" isSpecification="false" xmi.id="tYRay99O8yjq" type="9sNA8O2dftqc" name="nome"/>
29
+ <UML:Attribute visibility="public" isSpecification="false" xmi.id="6I2f2BYPJemJ" type="HPD616eRhdao" name="dataNascimento"/>
30
+ </UML:Classifier.feature>
31
+ </UML:Class>
32
+ <UML:Class stereotype="Entity" visibility="public" isSpecification="false" namespace="xOyMo5sr7YFm" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="uVx9r4emDSz9" name="Disciplina">
33
+ <UML:Classifier.feature>
34
+ <UML:Attribute visibility="public" isSpecification="false" xmi.id="z2krjQkYRypL" type="9sNA8O2dftqc" name="nome"/>
35
+ </UML:Classifier.feature>
36
+ </UML:Class>
37
+ </UML:Namespace.ownedElement>
38
+ </UML:Package>
39
+ </UML:Namespace.ownedElement>
40
+ </UML:Package>
41
+ <UML:Class visibility="public" isSpecification="false" namespace="Logical View" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="9sNA8O2dftqc" name="String"/>
42
+ <UML:Class visibility="public" isSpecification="false" namespace="Logical View" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="HPD616eRhdao" name="Date"/>
43
+ <UML:Association visibility="public" isSpecification="false" namespace="Logical View" xmi.id="kib0lG0umQEQ" name="">
44
+ <UML:Association.connection>
45
+ <UML:AssociationEnd changeability="changeable" visibility="public" isNavigable="true" isSpecification="false" multiplicity="*" xmi.id="AVgZimYnQzS1" type="3o63lZFdKwuO" name="" aggregation="none"/>
46
+ <UML:AssociationEnd changeability="changeable" visibility="public" isNavigable="true" isSpecification="false" multiplicity="*" xmi.id="aG0G0gljPMh8" type="uVx9r4emDSz9" name="" aggregation="none"/>
47
+ </UML:Association.connection>
48
+ </UML:Association>
49
+ </UML:Namespace.ownedElement>
50
+ <XMI.extension xmi.extender="umbrello">
51
+ <diagrams>
52
+ <diagram showopsig="1" linecolor="#ff0000" snapx="10" showattribassocs="1" snapy="10" linewidth="0" showattsig="1" isopen="0" showpackage="1" showpubliconly="1" showstereotype="1" name="diagrama de classe" font="Sans Serif,9,-1,0,50,0,0,0,0,0" canvasheight="852" canvaswidth="920" localid="-1" snapcsgrid="0" showgrid="0" showops="1" griddotcolor="#000000" backgroundcolor="#ffffff" usefillcolor="1" fillcolor="#ffff00" zoom="100" xmi.id="trCcGmSVqzf5" documentation="" showscope="1" snapgrid="0" showatts="1" type="1">
53
+ <widgets/>
54
+ <messages/>
55
+ <associations/>
56
+ </diagram>
57
+ <diagram showopsig="1" linecolor="#ff0000" snapx="10" showattribassocs="1" snapy="10" linewidth="0" showattsig="1" isopen="1" showpackage="1" showpubliconly="1" showstereotype="1" name="Escola" font="Sans Serif,9,-1,0,50,0,0,0,0,0" canvasheight="852" canvaswidth="1139" localid="-1" snapcsgrid="0" showgrid="0" showops="1" griddotcolor="#000000" backgroundcolor="#ffffff" usefillcolor="1" fillcolor="#ffff00" zoom="100" xmi.id="EUvICjHQLAFX" documentation="" showscope="1" snapgrid="0" showatts="1" type="1">
58
+ <widgets>
59
+ <classwidget linecolor="none" usesdiagramfillcolor="1" linewidth="none" showoperations="1" usesdiagramusefillcolor="1" showpubliconly="1" showpackage="1" x="102" showattsigs="601" showstereotype="1" y="170" showattributes="1" font="Sans Serif,9,-1,0,75,0,0,0,0,0" width="164" isinstance="0" usefillcolor="1" fillcolor="none" xmi.id="3o63lZFdKwuO" showscope="1" height="63" showopsigs="601"/>
60
+ <classwidget linecolor="none" usesdiagramfillcolor="1" linewidth="none" showoperations="1" usesdiagramusefillcolor="1" showpubliconly="1" showpackage="1" x="103" showattsigs="601" showstereotype="1" y="363" showattributes="1" font="Sans Serif,9,-1,0,75,0,0,0,0,0" width="174" isinstance="0" usefillcolor="1" fillcolor="none" xmi.id="uVx9r4emDSz9" showscope="1" height="49" showopsigs="601"/>
61
+ </widgets>
62
+ <messages/>
63
+ <associations>
64
+ <assocwidget indexa="1" indexb="1" usesdiagramusefillcolor="0" widgetaid="3o63lZFdKwuO" usesdiagramfillcolor="0" fillcolor="#000000" linecolor="none" totalcounta="2" xmi.id="kib0lG0umQEQ" widgetbid="uVx9r4emDSz9" totalcountb="2" type="503" usefillcolor="0" linewidth="none">
65
+ <linepath>
66
+ <startpoint startx="185" starty="233"/>
67
+ <endpoint endx="185" endy="363"/>
68
+ </linepath>
69
+ <floatingtext linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="187" showstereotype="1" y="235" text="*" font="Sans Serif,9,-1,0,50,0,0,0,0,0" pretext="" role="701" width="14" isinstance="0" posttext="" usefillcolor="1" fillcolor="none" xmi.id="IuZadn5Y5FFK" height="18"/>
70
+ <floatingtext linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="187" showstereotype="1" y="343" text="*" font="Sans Serif,9,-1,0,50,0,0,0,0,0" pretext="" role="702" width="14" isinstance="0" posttext="" usefillcolor="1" fillcolor="none" xmi.id="vky6bz7trgTU" height="18"/>
71
+ </assocwidget>
72
+ </associations>
73
+ </diagram>
74
+ </diagrams>
75
+ </XMI.extension>
76
+ </UML:Model>
77
+ <UML:Model stereotype="folder" visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Use Case View" name="Use Case View">
78
+ <UML:Namespace.ownedElement/>
79
+ </UML:Model>
80
+ <UML:Model stereotype="folder" visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Component View" name="Component View">
81
+ <UML:Namespace.ownedElement/>
82
+ </UML:Model>
83
+ <UML:Model stereotype="folder" visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Deployment View" name="Deployment View">
84
+ <UML:Namespace.ownedElement/>
85
+ </UML:Model>
86
+ <UML:Model stereotype="folder" visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Entity Relationship Model" name="Entity Relationship Model">
87
+ <UML:Namespace.ownedElement/>
88
+ </UML:Model>
89
+ </UML:Namespace.ownedElement>
90
+ </UML:Model>
91
+ </XMI.content>
92
+ <XMI.extensions xmi.extender="umbrello">
93
+ <docsettings viewid="EUvICjHQLAFX" uniqueid="vky6bz7trgTU" documentation=""/>
94
+ <listview>
95
+ <listitem open="1" type="800" id="Views">
96
+ <listitem open="1" type="836" id="Entity Relationship Model"/>
97
+ <listitem open="1" type="802" id="Use Case View"/>
98
+ <listitem open="1" type="827" id="Deployment View"/>
99
+ <listitem open="1" type="821" id="Component View"/>
100
+ <listitem open="1" type="801" id="Logical View">
101
+ <listitem open="1" type="818" id="RZKQt0xYO05D">
102
+ <listitem open="1" type="818" id="xOyMo5sr7YFm">
103
+ <listitem open="1" type="813" id="3o63lZFdKwuO">
104
+ <listitem open="0" type="814" id="6I2f2BYPJemJ"/>
105
+ <listitem open="0" type="814" id="tYRay99O8yjq"/>
106
+ </listitem>
107
+ <listitem open="1" type="813" id="uVx9r4emDSz9">
108
+ <listitem open="0" type="814" id="z2krjQkYRypL"/>
109
+ </listitem>
110
+ </listitem>
111
+ </listitem>
112
+ <listitem open="0" type="813" id="HPD616eRhdao"/>
113
+ <listitem open="0" type="807" id="EUvICjHQLAFX" label="Escola"/>
114
+ <listitem open="0" type="813" id="9sNA8O2dftqc"/>
115
+ <listitem open="1" type="830" id="Datatypes"/>
116
+ </listitem>
117
+ </listitem>
118
+ </listview>
119
+ <codegeneration>
120
+ <codegenerator language="C++"/>
121
+ </codegeneration>
122
+ </XMI.extensions>
123
+ </XMI>
@@ -0,0 +1,7 @@
1
+ {% for class in classes %}
2
+ {{class.lower_camel_case_name}}.label = {{class.name}}
3
+ {{class.lower_camel_case_name}}.list.table.title = Lista de {{class.name}}s
4
+ {{class.lower_camel_case_name}}.label.id = ID
5
+ {% for attribute in class.attributes %}
6
+ {{class.lower_camel_case_name}}.label.{{attribute.name}} = {{attribute.name | capitalize_first}}{% endfor %}
7
+ {% endfor %}
@@ -0,0 +1,13 @@
1
+ package {{class.persistence_package}};
2
+
3
+ import br.gov.frameworkdemoiselle.stereotype.PersistenceController;
4
+ import br.gov.frameworkdemoiselle.template.JPACrud;
5
+
6
+ import {{class.package}}.{{class.name}};
7
+
8
+ @PersistenceController
9
+ public class {{class.name}}DAO extends JPACrud<{{class.name}}, Long> {
10
+
11
+ private static final long serialVersionUID = 1L;
12
+
13
+ }
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
4
+
5
+ <persistence-unit name="bookmark-ds" transaction-type="RESOURCE_LOCAL">
6
+
7
+ {% for entity in classes %} <class>{{entity.package}}.{{entity.name}}</class>
8
+ {% endfor %}
9
+ <properties>
10
+ <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
11
+ <property name="javax.persistence.jdbc.user" value="postgres" />
12
+ <property name="javax.persistence.jdbc.password" value="postgres" />
13
+ <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/teste" />
14
+
15
+ <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
16
+ <property name="hibernate.hbm2ddl.auto" value="validate"/>
17
+ <property name="hibernate.show_sql" value="true"/>
18
+ <property name="hibernate.format_sql" value="true"/>
19
+ </properties>
20
+
21
+ </persistence-unit>
22
+
23
+ </persistence>
@@ -0,0 +1,46 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
3
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4
+
5
+ <modelVersion>4.0.0</modelVersion>
6
+
7
+ <groupId>{{project.group}}</groupId>
8
+ <artifactId>{{project.name}}</artifactId>
9
+ <version>0.0.1-SNAPSHOT</version>
10
+ <packaging>war</packaging>
11
+
12
+ <name></name>
13
+ <description></description>
14
+ <url></url>
15
+
16
+ <parent>
17
+ <groupId>br.gov.frameworkdemoiselle</groupId>
18
+ <artifactId>demoiselle-jsf-parent</artifactId>
19
+ <version>2.3.2</version>
20
+ </parent>
21
+
22
+ <dependencies>
23
+ <dependency>
24
+ <groupId>br.gov.frameworkdemoiselle</groupId>
25
+ <artifactId>demoiselle-jpa</artifactId>
26
+ <scope>compile</scope>
27
+ </dependency>
28
+ <dependency>
29
+ <groupId>org.primefaces</groupId>
30
+ <artifactId>primefaces</artifactId>
31
+ <scope>compile</scope>
32
+ </dependency>
33
+
34
+ <dependency>
35
+ <groupId>br.gov.frameworkdemoiselle.component</groupId>
36
+ <artifactId>demoiselle-junit</artifactId>
37
+ <version>2.3.0</version>
38
+ <scope>test</scope>
39
+ </dependency>
40
+ <dependency>
41
+ <groupId>org.slf4j</groupId>
42
+ <artifactId>slf4j-log4j12</artifactId>
43
+ <scope>test</scope>
44
+ </dependency>
45
+ </dependencies>
46
+ </project>
@@ -0,0 +1,42 @@
1
+ <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
2
+ xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html"
3
+ xmlns:ui="http://java.sun.com/jsf/facelets" template="/template/main.xhtml">
4
+
5
+ <ui:define name="body">
6
+ <h:form prependId="false">
7
+ <p:toolbar>
8
+ <p:toolbarGroup align="left">
9
+ <p:commandButton value="#{messages['button.save']}" action="#{ {{class.lower_camel_case_name}}EditMB.insert}"
10
+ rendered="#{! {{class.lower_camel_case_name}}EditMB.updateMode}" ajax="false" />
11
+ <p:commandButton value="#{messages['button.save']}" action="#{ {{class.lower_camel_case_name}}EditMB.update}"
12
+ rendered="#{ {{class.lower_camel_case_name}}EditMB.updateMode}" ajax="false" />
13
+ <p:commandButton value="#{messages['button.delete']}" onclick="confirmation.show()"
14
+ rendered="#{ {{class.lower_camel_case_name}}EditMB.updateMode}" type="button" immediate="true" ajax="false" />
15
+ <p:confirmDialog message="#{messages['label.confirm.delete']}" showEffect="bounce" hideEffect="explode"
16
+ header="#{messages['label.dialog.delete']}" severity="alert" widgetVar="confirmation">
17
+ <h:commandButton value="#{messages['button.dialog.yes']}" action="#{ {{class.lower_camel_case_name}}EditMB.delete}" immediate="true"
18
+ ajax="false" />
19
+ <h:commandButton value="#{messages['button.dialog.no']}" onclick="confirmation.hide()" type="button" />
20
+ </p:confirmDialog>
21
+ </p:toolbarGroup>
22
+ </p:toolbar>
23
+
24
+ <br />
25
+
26
+ <p:fieldset legend="#{messages['{{class.lower_camel_case_name}}.label']}" toggleable="true" toggleSpeed="500">
27
+ <h:panelGrid id="fields" columns="3">
28
+ <h:outputLabel value="#{messages['{{class.lower_camel_case_name}}.label.id']}: " for="id" styleClass="text-input" />
29
+ <h:outputText id="id" value="#{ {{class.lower_camel_case_name}}EditMB.bean.id}" />
30
+ <p:message for="id" />
31
+
32
+ {% for attribute in class.attributes %}
33
+ <h:outputLabel value="#{messages['{{class.lower_camel_case_name}}.label.{{attribute.name}}']}: " for="{{attribute.name}}" styleClass="text-input" />
34
+ <h:inputText id="{{attribute.name}}" value="#{ {{class.lower_camel_case_name}}EditMB.bean.{{attribute.name}}}"
35
+ title="#{messages['{{class.lower_camel_case_name}}.label.{{attribute.name}}']}" />
36
+ <p:message for="{{attribute.name}}" />
37
+ {% endfor %}
38
+ </h:panelGrid>
39
+ </p:fieldset>
40
+ </h:form>
41
+ </ui:define>
42
+ </ui:composition>
@@ -0,0 +1,46 @@
1
+ <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
2
+ xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html"
3
+ xmlns:ui="http://java.sun.com/jsf/facelets" template="/template/main.xhtml">
4
+
5
+ <ui:define name="body">
6
+ <h:form>
7
+ <p:toolbar>
8
+ <p:toolbarGroup align="left">
9
+ <p:commandButton title="#{messages['button.new']}" icon="ui-icon-document" action="#{ {{ managed_bean }}.getNextView}"
10
+ actionListener="#{ {{managed_bean}}.clear}" ajax="false" />
11
+
12
+ <p:commandButton title="#{messages['button.delete']}" icon="ui-icon-trash" onclick="confirmation.show()"
13
+ type="button" immediate="true" ajax="false" />
14
+
15
+ <p:confirmDialog message="#{messages['label.confirm.delete']}" showEffect="bounce" hideEffect="explode"
16
+ header="#{messages['label.dialog.alert']}!" severity="alert" widgetVar="confirmation">
17
+
18
+ <h:commandButton value="#{messages['button.dialog.yes']}" action="#{ {{managed_bean}}.deleteSelection}"
19
+ actionListener="#{ {{managed_bean}}.clear}" />
20
+ <h:commandButton value="#{messages['button.dialog.no']}" onclick="confirmation.hide()" type="button" />
21
+ </p:confirmDialog>
22
+ </p:toolbarGroup>
23
+ </p:toolbar>
24
+
25
+ <p:dataTable id="list" var="bean" value="#{ {{managed_bean}}.resultList}">
26
+ <f:facet name="header">#{messages['{{class.lower_camel_case_name}}.list.table.title']}</f:facet>
27
+ <p:column style="width:5%;">
28
+ <h:selectBooleanCheckbox value="#{ {{managed_bean}}.selection[bean.id]}" />
29
+ </p:column>
30
+ <p:column style="width:5%;" sortBy="#{bean.id}">
31
+ <f:facet name="header">#{messages['{{class.lower_camel_case_name}}.label.id']}</f:facet>
32
+ <h:outputText value="#{bean.id}" />
33
+ </p:column>
34
+ {% for attribute in class.attributes %}
35
+ <p:column sortBy="#{bean.{{attribute.name}}}">
36
+ <f:facet name="header">#{messages['{{class.lower_camel_case_name}}.label.{{attribute.name}}']}</f:facet>
37
+ <h:commandLink action="#{ {{managed_bean}}.getNextView}" actionListener="#{ {{managed_bean}}.clear}">
38
+ <h:outputText value="#{bean.{{attribute.name}}}" />
39
+ <f:param name="id" value="#{bean.id}" />
40
+ </h:commandLink>
41
+ </p:column>
42
+ {% endfor %}
43
+ </p:dataTable>
44
+ </h:form>
45
+ </ui:define>
46
+ </ui:composition>
@@ -0,0 +1,48 @@
1
+ package {{class.view_package}};
2
+
3
+ import javax.inject.Inject;
4
+
5
+ import br.gov.frameworkdemoiselle.annotation.PreviousView;
6
+ import br.gov.frameworkdemoiselle.stereotype.ViewController;
7
+ import br.gov.frameworkdemoiselle.template.AbstractEditPageBean;
8
+ import br.gov.frameworkdemoiselle.transaction.Transactional;
9
+
10
+ import {{class.business_package}}.{{class.name}}BC;
11
+ import {{class.package}}.{{class.name}};
12
+
13
+ @ViewController
14
+ @PreviousView("./{{class.underscore_name}}_list.xhtml")
15
+ public class {{class.name}}EditMB extends AbstractEditPageBean<{{class.name}}, Long> {
16
+
17
+ private static final long serialVersionUID = 1L;
18
+
19
+ @Inject
20
+ private {{class.name}}BC {{class.underscore_name}}BC;
21
+
22
+ @Override
23
+ @Transactional
24
+ public String delete() {
25
+ this.{{class.underscore_name}}BC.delete(getId());
26
+ return getPreviousView();
27
+ }
28
+
29
+ @Override
30
+ @Transactional
31
+ public String insert() {
32
+ this.{{class.underscore_name}}BC.insert(getBean());
33
+ return getPreviousView();
34
+ }
35
+
36
+ @Override
37
+ @Transactional
38
+ public String update() {
39
+ this.{{class.underscore_name}}BC.update(getBean());
40
+ return getPreviousView();
41
+ }
42
+
43
+ @Override
44
+ protected void handleLoad() {
45
+ setBean(this.{{class.underscore_name}}BC.load(getId()));
46
+ }
47
+
48
+ }