[jboss-cvs] jboss-seam/seam-gen/freemarker-templates ...
Gavin King
gavin.king at jboss.com
Wed Nov 1 20:01:53 EST 2006
User: gavin
Date: 06/11/01 20:01:53
Modified: seam-gen/freemarker-templates BaseTest.ftl
CreateInterface.ftl CreateInterfaceConversation.ftl
CreateSFSBAction.ftl CreateSFSBConversation.ftl
CreateSFSBInterface.ftl CreateSLSBAction.ftl
Entity.ftl TestCase.ftl action-page.ftl page.ftl
Log:
various improvements to generated code
Revision Changes Path
1.2 +0 -7 jboss-seam/seam-gen/freemarker-templates/BaseTest.ftl
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BaseTest.ftl
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/seam-gen/freemarker-templates/BaseTest.ftl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- BaseTest.ftl 28 Oct 2006 17:56:04 -0000 1.1
+++ BaseTest.ftl 2 Nov 2006 01:01:53 -0000 1.2
@@ -8,11 +8,4 @@
extends SeamTest
{
- public Object lookup(String name) {
- return Contexts.lookupInStatefulContexts(name);
- }
-
- public boolean inConversation() {
- return Manager.instance().isLongRunningConversation();
- }
}
1.2 +1 -1 jboss-seam/seam-gen/freemarker-templates/CreateInterface.ftl
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CreateInterface.ftl
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/seam-gen/freemarker-templates/CreateInterface.ftl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- CreateInterface.ftl 28 Oct 2006 17:56:04 -0000 1.1
+++ CreateInterface.ftl 2 Nov 2006 01:01:53 -0000 1.2
@@ -6,7 +6,7 @@
public interface ${interfaceName} {
//seam-gen method
- public String doAction();
+ public String go();
//add additional interface methods here
}
\ No newline at end of file
1.2 +2 -2 jboss-seam/seam-gen/freemarker-templates/CreateInterfaceConversation.ftl
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CreateInterfaceConversation.ftl
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/seam-gen/freemarker-templates/CreateInterfaceConversation.ftl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- CreateInterfaceConversation.ftl 28 Oct 2006 17:56:04 -0000 1.1
+++ CreateInterfaceConversation.ftl 2 Nov 2006 01:01:53 -0000 1.2
@@ -6,8 +6,8 @@
public interface ${interfaceName} {
//seam-gen methods
- public String beginAction();
- public String endAction();
+ public String begin();
+ public String end();
public void destroy();
//add additional interface methods here
1.2 +7 -6 jboss-seam/seam-gen/freemarker-templates/CreateSFSBAction.ftl
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CreateSFSBAction.ftl
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/seam-gen/freemarker-templates/CreateSFSBAction.ftl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- CreateSFSBAction.ftl 28 Oct 2006 17:56:04 -0000 1.1
+++ CreateSFSBAction.ftl 2 Nov 2006 01:01:53 -0000 1.2
@@ -5,20 +5,21 @@
import javax.ejb.Remove;
import javax.ejb.Stateful;
import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Destroy;
-import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.log.Log;
@Stateful
@Name("${actionName}")
- at Scope(ScopeType.CONVERSATION)
-public class ${actionName}Action implements ${actionName}, Serializable {
+public class ${actionName}Action implements ${actionName} {
+
+ private @Logger log;
//seam-gen method
- public String doAction()
+ public String go()
{
//implement your business logic here
- System.out.println("Action Called");
+ log.info("go() action called");
return "success";
}
1.2 +9 -6 jboss-seam/seam-gen/freemarker-templates/CreateSFSBConversation.ftl
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CreateSFSBConversation.ftl
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/seam-gen/freemarker-templates/CreateSFSBConversation.ftl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- CreateSFSBConversation.ftl 28 Oct 2006 17:56:04 -0000 1.1
+++ CreateSFSBConversation.ftl 2 Nov 2006 01:01:53 -0000 1.2
@@ -5,30 +5,33 @@
import javax.ejb.Remove;
import javax.ejb.Stateful;
import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.End;
import org.jboss.seam.annotations.Destroy;
-import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.log.Log;
@Stateful
@Name("${actionName}")
- at Scope(ScopeType.CONVERSATION)
-public class ${actionName}Action implements ${actionName}, Serializable {
+public class ${actionName}Action implements ${actionName} {
+
+ private @Logger log;
@Begin
- public String beginAction()
+ public String begin()
{
//implement your begin conversation business logic
+ log.info("beginning conversation");
return "success";
}
//add additional action methods that participate in this conversation
@End
- public String endAction()
+ public String end()
{
//implement your end conversation business logic
+ log.info("ending conversation");
return "success";
}
1.2 +1 -1 jboss-seam/seam-gen/freemarker-templates/CreateSFSBInterface.ftl
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CreateSFSBInterface.ftl
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/seam-gen/freemarker-templates/CreateSFSBInterface.ftl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- CreateSFSBInterface.ftl 28 Oct 2006 17:56:04 -0000 1.1
+++ CreateSFSBInterface.ftl 2 Nov 2006 01:01:53 -0000 1.2
@@ -6,7 +6,7 @@
public interface ${interfaceName} {
//seam-gen methods
- public String doAction();
+ public String go();
public void destroy();
//add additional interface methods here
1.2 +8 -2 jboss-seam/seam-gen/freemarker-templates/CreateSLSBAction.ftl
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CreateSLSBAction.ftl
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/seam-gen/freemarker-templates/CreateSLSBAction.ftl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- CreateSLSBAction.ftl 28 Oct 2006 17:56:04 -0000 1.1
+++ CreateSLSBAction.ftl 2 Nov 2006 01:01:53 -0000 1.2
@@ -5,14 +5,20 @@
import javax.ejb.Remove;
import javax.ejb.Stateless;
import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.log.Log;
@Stateless
@Name("${actionName}")
-public class ${actionName}Action implements ${actionName}, Serializable {
+public class ${actionName}Action implements ${actionName} {
+
+ private @Logger log;
//seam-gen method
- public String doAction()
+ public String go()
{
+ //implement your business logic here
+ log.info("go() action called");
return "success";
}
1.2 +23 -11 jboss-seam/seam-gen/freemarker-templates/Entity.ftl
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Entity.ftl
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/seam-gen/freemarker-templates/Entity.ftl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Entity.ftl 28 Oct 2006 17:56:04 -0000 1.1
+++ Entity.ftl 2 Nov 2006 01:01:53 -0000 1.2
@@ -3,6 +3,7 @@
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
import org.jboss.seam.annotations.Name;
@Entity
@@ -10,27 +11,38 @@
public class ${actionName} implements Serializable {
//seam-gen attributes (you should probably edit these)
- private String column1;
- private String column2;
+ private Long id;
+ private Integer version;
+ private String name;
//add additional entity attributes
//seam-gen attribute getters/setters with annotations (you probably should edit)
- @Id
- public String getColumn1() {
- return column1;
+ @Id @GeneratedValue
+ public Long getId() {
+ return id;
}
- public void setColumn1(String column1) {
- this.column1 = column1;
+ public void setId(Long id) {
+ this.id = id;
}
- public String getColumn2() {
- return column2;
+ @Version
+ public Integer getVersion() {
+ return version;
}
- public void setColumn2(String column2) {
- this.column2 = column2;
+ private void setVersion(Integer version) {
+ this.version = version;
+ }
+
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
}
}
1.2 +3 -9 jboss-seam/seam-gen/freemarker-templates/TestCase.ftl
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TestCase.ftl
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/seam-gen/freemarker-templates/TestCase.ftl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- TestCase.ftl 28 Oct 2006 17:56:04 -0000 1.1
+++ TestCase.ftl 2 Nov 2006 01:01:53 -0000 1.2
@@ -6,27 +6,21 @@
@Test
public void test() throws Exception {
- new Script() {
+ new FacesRequest() {
@Override
protected void updateModelValues() throws Exception {
- //simulate form input to Java POJOs
-
- //create pojos and set POJO attributes
- System.out.println("simulate form input to Java POJOs");
+ //set form input to model attributes
}
@Override
protected void invokeApplication() {
//simulate HTTP request (POST)
//call action methods here
- System.out.println("simulate HTTP request (POST)");
+ invokeMethod("${pound}{${actionName}.go}");
}
@Override
protected void renderResponse() {
- //simulate HTTP response
-
//check model attributes if needed
- System.out.println("simulate HTTP response");
}
}.run();
}
1.3 +8 -8 jboss-seam/seam-gen/freemarker-templates/action-page.ftl
(In the diff below, changes in quantity of whitespace are not shown.)
Index: action-page.ftl
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/seam-gen/freemarker-templates/action-page.ftl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- action-page.ftl 2 Nov 2006 00:37:01 -0000 1.2
+++ action-page.ftl 2 Nov 2006 01:01:53 -0000 1.3
@@ -8,15 +8,15 @@
xmlns:h="http://java.sun.com/jsf/html"
template="/WEB-INF/layout/template.xhtml">
- <ui:define name="body">
+<ui:define name="body">
<h1>Seam Generated Page named: "${pageName}"</h1>
<h:form>
<div>
<h:commandButton styleClass="formButton" type="submit"
- value="Test Action" action="${pound}{${actionName}.doAction}"/>
+ value="Test Action" action="${pound}{${actionName}.go}"/>
</div>
</h:form>
- </ui:define>
+</ui:define>
</ui:composition>
1.2 +2 -5 jboss-seam/seam-gen/freemarker-templates/page.ftl
(In the diff below, changes in quantity of whitespace are not shown.)
Index: page.ftl
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/seam-gen/freemarker-templates/page.ftl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- page.ftl 28 Oct 2006 17:56:04 -0000 1.1
+++ page.ftl 2 Nov 2006 01:01:53 -0000 1.2
@@ -8,10 +8,7 @@
template="layout/template.xhtml">
<ui:define name="body">
-
- <ui:define name="body">
<h1>Seam Generated Page named: ${pageName}</h1>
- </ui:define>
-
</ui:define>
+
</ui:composition>
More information about the jboss-cvs-commits
mailing list