Author: dan.j.allen
Date: 2008-09-24 03:43:32 -0400 (Wed, 24 Sep 2008)
New Revision: 9133
Modified:
trunk/seam-gen/src/EntityList.java
trunk/seam-gen/src/EntityList.java.ftl
Log:
update the EntityQuery templates to use the ValueExpression types
Modified: trunk/seam-gen/src/EntityList.java
===================================================================
--- trunk/seam-gen/src/EntityList.java 2008-09-24 07:43:03 UTC (rev 9132)
+++ trunk/seam-gen/src/EntityList.java 2008-09-24 07:43:32 UTC (rev 9133)
@@ -7,9 +7,8 @@
@Name("@listName@")
public class @entityName@List extends EntityQuery<@entityName@>
{
- @Override
- public String getEjbql()
+ public @entityName@List()
{
- return "select @componentName@ from @entityName@ @componentName@";
+ setEjbql("select @componentName@ from @entityName@ @componentName@");
}
}
Modified: trunk/seam-gen/src/EntityList.java.ftl
===================================================================
--- trunk/seam-gen/src/EntityList.java.ftl 2008-09-24 07:43:03 UTC (rev 9132)
+++ trunk/seam-gen/src/EntityList.java.ftl 2008-09-24 07:43:32 UTC (rev 9133)
@@ -9,13 +9,14 @@
</#if>
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
-import java.util.List;
import java.util.Arrays;
@Name("${listName}")
public class ${entityName}List extends EntityQuery<${entityName}>
{
+ private static final String EJBQL = "select ${componentName} from ${entityName}
${componentName}";
+
private static final String[] RESTRICTIONS = {
<#foreach property in pojo.allPropertiesIterator>
<#if !c2h.isCollection(property) && !util.isToOne(property)>
@@ -36,37 +37,23 @@
<#if pojo.isComponent(pojo.identifierProperty)>
private ${entityName} ${componentName};
+<#else>
+ private ${entityName} ${componentName} = new ${entityName}();
+</#if>
public ${entityName}List()
{
+<#if pojo.isComponent(pojo.identifierProperty)>
${componentName} = new ${entityName}();
${componentName}.setId( new ${entityName}Id() );
- }
-<#else>
- private ${entityName} ${componentName} = new ${entityName}();
</#if>
-
- @Override
- public String getEjbql()
- {
- return "select ${componentName} from ${entityName} ${componentName}";
+ setEjbql(EJBQL);
+ setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
+ setMaxResults(25);
}
- @Override
- public Integer getMaxResults()
- {
- return 25;
- }
-
public ${entityName} get${entityName}()
{
return ${componentName};
}
-
- @Override
- public List<String> getRestrictions()
- {
- return Arrays.asList(RESTRICTIONS);
- }
-
}