[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-843) Generate application from existing entities

Max Andersen (JIRA) jira-events at lists.jboss.org
Mon Mar 26 07:56:55 EDT 2007


    [ http://jira.jboss.com/jira/browse/JBSEAM-843?page=comments#action_12357286 ] 
            
Max Andersen commented on JBSEAM-843:
-------------------------------------

Index: seam-gen/build.xml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/seam-gen/build.xml,v
retrieving revision 1.77
diff -u -r1.77 build.xml
--- seam-gen/build.xml	26 Mar 2007 10:59:51 -0000	1.77
+++ seam-gen/build.xml	26 Mar 2007 11:54:02 -0000
@@ -796,9 +796,7 @@
         <echo message="Type 'seam restart' and go to http://localhost:8080/${project.name}/${masterPage.name}.seam"/>
     </target>
 
-	<target name="generate-entities" depends="validate-project"
-        description="Reverse engineer entities from the database">
-
+	<target name="hibernate-task">
 	    <taskdef name="hibernate" 
 	             classname="org.hibernate.tool.ant.HibernateToolTask">
 	        <classpath>
@@ -809,54 +807,9 @@
 	        	<pathelement path="../jboss-seam-gen.jar"/>
 	        </classpath>
 	    </taskdef>
-		
-		<hibernate templatepath=".">
-            <jdbcconfiguration propertyfile="build.properties" 
-            	                packagename="${model.package}"
-                                revengfile="${project.home}/resources/seam-gen.reveng.xml"/>
-        	
-        	<property key="hibernatetool.util.toolclass" 
-        		    value="org.jboss.seam.tool.Util"/>
-        	
-            <hbm2java jdk5="true" ejb3="true" destdir="${project.home}/src/model"/> 
-        	<hbmtemplate filepattern="{class-name}List.xhtml"
-        	                template="view/list.xhtml.ftl" 
-        		             destdir="${project.home}/view"
-        	                 foreach="entity"/>
-        	<hbmtemplate filepattern="{class-name}.xhtml"
-        	                template="view/view.xhtml.ftl" 
-        		             destdir="${project.home}/view"
-                             foreach="entity"/>
-        	<hbmtemplate filepattern="{class-name}.page.xml"
-        	                template="view/view.page.xml.ftl" 
-        		             destdir="${project.home}/view"
-                             foreach="entity"/>
-        	<hbmtemplate filepattern="{class-name}Edit.xhtml"
-        	                template="view/edit.xhtml.ftl" 
-        		             destdir="${project.home}/view"
-                             foreach="entity"/>
-        	<hbmtemplate filepattern="{class-name}Edit.page.xml"
-        	                template="view/edit.page.xml.ftl" 
-        		             destdir="${project.home}/view"
-                             foreach="entity"/>
-        	<hbmtemplate filepattern="{package-name}/{class-name}List.java"
-        	                template="src/EntityList.java.ftl" 
-        		             destdir="${project.home}/src/action"
-                             foreach="entity"/>
-        	<hbmtemplate filepattern="{class-name}List.page.xml"
-        	                template="view/list.page.xml.ftl" 
-        		             destdir="${project.home}/view"
-                             foreach="entity"/>
-        	<hbmtemplate filepattern="{package-name}/{class-name}Home.java"
-        	                template="src/EntityHome.java.ftl" 
-        		             destdir="${project.home}/src/action"
-                             foreach="entity"/>
-        	<hbmtemplate filepattern="menu.xhtml"
-        	                template="view/layout/menu.xhtml.ftl" 
-        		             destdir="${project.home}/view/layout"
-                             foreach="entity"/>
-		</hibernate>
+	</target>
 
+	<target name="finish-generation" depends="validate-project">
 		<taskdef name="javaformatter" 
 			 classname="org.hibernate.tool.ant.JavaFormatterTask">
 	        <classpath>
@@ -870,12 +823,86 @@
 		  <fileset dir="${project.home}/src">
 		   	   <include name="**/*.java"/>
 		  </fileset>
-		</javaformatter>
-
+		</javaformatter>		
+		
         <echo message="Type 'seam restart' and go to http://localhost:8080/${project.name}"/>
+		
+	</target>
+
 
+	<target name="internal-generate-ui" depends="validate-project, hibernate-task">
+		<echo>Compiling domain model</echo>
+				<ant antfile="${project.home}/build.xml" inheritall="false" inheritrefs="false" dir="${project.home}" target="jar"/>
+				
+				<hibernate templatepath=".">
+				<jpaconfiguration persistenceunit="${project.name}" /> 
+				   <classpath> 
+				      <pathelement path="${project.home}/exploded-archives/${project.name}.jar"/>
+				   </classpath> 
+				
+		    	<property key="hibernatetool.util.toolclass" 
+		    		    value="org.jboss.seam.tool.Util"/>
+		    	
+		    	<hbmtemplate filepattern="{class-name}List.xhtml"
+		    	                template="view/list.xhtml.ftl" 
+		    		             destdir="${project.home}/view"
+		    	                 foreach="entity"/>
+		    	<hbmtemplate filepattern="{class-name}.xhtml"
+		    	                template="view/view.xhtml.ftl" 
+		    		             destdir="${project.home}/view"
+		                         foreach="entity"/>
+		    	<hbmtemplate filepattern="{class-name}.page.xml"
+		    	                template="view/view.page.xml.ftl" 
+		    		             destdir="${project.home}/view"
+		                         foreach="entity"/>
+		    	<hbmtemplate filepattern="{class-name}Edit.xhtml"
+		    	                template="view/edit.xhtml.ftl" 
+		    		             destdir="${project.home}/view"
+		                         foreach="entity"/>
+		    	<hbmtemplate filepattern="{class-name}Edit.page.xml"
+		    	                template="view/edit.page.xml.ftl" 
+		    		             destdir="${project.home}/view"
+		                         foreach="entity"/>
+		    	<hbmtemplate filepattern="{package-name}/{class-name}List.java"
+		    	                template="src/EntityList.java.ftl" 
+		    		             destdir="${project.home}/src/action"
+		                         foreach="entity"/>
+		    	<hbmtemplate filepattern="{class-name}List.page.xml"
+		    	                template="view/list.page.xml.ftl" 
+		    		             destdir="${project.home}/view"
+		                         foreach="entity"/>
+		    	<hbmtemplate filepattern="{package-name}/{class-name}Home.java"
+		    	                template="src/EntityHome.java.ftl" 
+		    		             destdir="${project.home}/src/action"
+		                         foreach="entity"/>
+		    	<hbmtemplate filepattern="menu.xhtml"
+		    	                template="view/layout/menu.xhtml.ftl" 
+		    		             destdir="${project.home}/view/layout"
+		                         foreach="entity"/>
+		    	</hibernate>
+	</target>
+		
+	<target name="generate-ui" depends="internal-generate-ui, finish-generation" description="Generate UI based on existing entities">
+	</target>
+
+	<target name="reverse-engineer" depends="validate-project, hibernate-task">
+		<hibernate templatepath=".">
+		            <jdbcconfiguration propertyfile="build.properties" 
+		            	                packagename="${model.package}"
+		                                revengfile="${project.home}/resources/seam-gen.reveng.xml"/>
+		        	
+		        	<property key="hibernatetool.util.toolclass" 
+		        		    value="org.jboss.seam.tool.Util"/>
+		        	
+		            <hbm2java jdk5="true" ejb3="true" destdir="${project.home}/src/model"/> 
+				</hibernate>
+	</target>
+	
+	<target name="generate-entities" depends="reverse-engineer, generate-ui, finish-generation"
+        description="Reverse engineer entities from the database">
     </target>
 	
+	
     <target name="deploy" depends="validate-project"
         description="Deploy the EAR or WAR">
         <echo message="Deploying project '${project.name}' to JBoss" />


> Generate application from existing entities
> -------------------------------------------
>
>                 Key: JBSEAM-843
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-843
>             Project: JBoss Seam
>          Issue Type: Feature Request
>          Components: Tools
>    Affects Versions: 1.1.6.GA
>            Reporter: Kent Lam
>         Assigned To: Max Andersen
>            Priority: Minor
>
> Would it be great that seam-gen will generate crud pages and classes for an existing Entity class,just like seam-gen generate the crud pages,classes and entity classes from database. 
> Thanks

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list