Subject: [Topia-commits] r1607 - trunk/topia-persistence/src/main/java/org/nuiton/topia/generator
From: [email-masked]
To: [email-masked]
Date: Wed, 15 Jul 2009 15:47:24 +0200 (CEST)
List-Id: <topia-commits.lists.labs.libre-entreprise.org>

Author: echatellier
Date: 2009-07-15 15:47:24 +0200 (Wed, 15 Jul 2009)
New Revision: 1607

Modified:
   trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityAbstractGenerator.java
   trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityHibernateMappingGenerator.java
   trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java
Log:
Merge branche on trunk

Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityAbstractGenerator.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityAbstractGenerator.java	2009-07-15 13:28:00 UTC (rev 1606)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityAbstractGenerator.java	2009-07-15 13:47:24 UTC (rev 1607)
@@ -377,7 +377,9 @@
                     String attrName = attr.getName();
                     String getterName  = "get" + GeneratorUtil.capitalize(attrName);
                     if (GeneratorUtil.isNMultiplicity(attr)) {
-/*{        tmp.addAll(<%=getterName%>());
+/*{        if (<%=getterName%>() != null) {
+              tmp.addAll(<%=getterName%>());
+           }
 }*/
                     } else {
 /*{        tmp.add(<%=getterName%>());
@@ -407,9 +409,11 @@
 //                            tmp.addAll(<%=ref%>);
 //                        }
 /*{
-        tmp.addAll(((TopiaContextImplementor)getTopiaContext())
-            .getDAO(<%=assocClassFQN%>.class)
-            .findAllByProperties("<%=reverseAttrName%>", this));
+        org.codelutin.topia.persistence.TopiaDAO<<%=assocClassFQN%>> dao = ((TopiaContextImplementor) getTopiaContext()).getDAO(<%=assocClassFQN%>.class);
+        List<<%=assocClassFQN%>> findAllByProperties = dao.findAllByProperties("<%=reverseAttrName%>", this);
+        if (findAllByProperties != null) {
+            tmp.addAll(findAllByProperties);
+        }
 }*/
                     }
                 }

Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityHibernateMappingGenerator.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityHibernateMappingGenerator.java	2009-07-15 13:28:00 UTC (rev 1606)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityHibernateMappingGenerator.java	2009-07-15 13:47:24 UTC (rev 1607)
@@ -101,12 +101,18 @@
         String tableName = TopiaGeneratorUtil.getDBName(clazz);
         String isAbstract = clazz.isAbstract()?"true":"false";
         String clazzFQN = clazz.getQualifiedName();
-
+        
         String optionalAttributes = "";
         String schema = TopiaGeneratorUtil.getSchemaName(clazz, model);
         if (schema != null) {
         	optionalAttributes += "schema=\"" + schema + "\" "; 
         }
+        
+        //On précise au proxy de quelle interface hérite l'objet
+        String proxyTagValue = TopiaGeneratorUtil.findTagValue(TopiaGeneratorUtil.TAG_PROXY_INTERFACE, clazz, model);
+        if (proxyTagValue == null || !proxyTagValue.equals("none")) {
+            optionalAttributes += "proxy=\"" + clazzFQN + "\" ";
+        }
 
         if (haveSuper) {
             ObjectModelClass superClass = clazz.getSuperclasses().iterator().next();
@@ -115,15 +121,14 @@
             	log.debug("superClass for " + clazz.getQualifiedName() + " is " + superClassname);
             }
             String superClassDOType = TopiaGeneratorUtil.getDOType(superClassname, model);
-            //On précise au proxy de quelle interface hérite l'objet
 
-/*{    <union-subclass name="<%=clazzDOType%>" extends="<%=superClassDOType%>" table="<%=tableName%>" node="<%=clazzDOType%>" abstract="<%=isAbstract%>" proxy="<%=clazzFQN%>" <%=optionalAttributes%>>
+/*{    <union-subclass name="<%=clazzDOType%>" extends="<%=superClassDOType%>" table="<%=tableName%>" node="<%=clazzDOType%>" abstract="<%=isAbstract%>" <%=optionalAttributes%>>
         <!--key column="topiaId"/-->
 }*/
             // FIXME mieux gerer le cas haveSuper
             noneNaturalAttributes.addAll(clazz.getAttributes());
         } else {
-/*{    <class name="<%=clazzDOType%>" table="<%=tableName%>" node="<%=clazzDOType%>" abstract="<%=isAbstract%>" proxy="<%=clazzFQN%>" <%=optionalAttributes%>>
+/*{    <class name="<%=clazzDOType%>" table="<%=tableName%>" node="<%=clazzDOType%>" abstract="<%=isAbstract%>" <%=optionalAttributes%>>
         <id name="topiaId" type="string" length="255" node="@topiaId"/>
 }*/
             // on detecte les attributs des clef metiers            

Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java	2009-07-15 13:28:00 UTC (rev 1606)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java	2009-07-15 13:47:24 UTC (rev 1607)
@@ -103,6 +103,15 @@
     public static final String TAG_NOT_NULL = "notNull";
     /** Tag pour spécifier la caractère embed-xml d'une association */
     public static final String TAG_EMBED_XML = "embedXml";
+    /**
+     * Tag pour configurer l'interface du proxy sur autre chose que l'implementation par defaut.
+     * 
+     * Par defaut :
+     *   null > generere le proxy sur l'interface de l'implementation
+     * Autre valeur :
+     *   "none" > laisse la configuration par defaut d'hibernate
+     */
+    public static final String TAG_PROXY_INTERFACE = "hibernateProxyInterface";
     /** Tag pour spécifier le permissions à la création */
     public static final String TAG_SECURITY_CREATE = "securityCreate";
     /** Tag pour spécifier le permissions au chargement */

_______________________________________________
Topia-commits mailing list
[email-masked]
https://lists.labs.libre-entreprise.org/mailman/listinfo/topia-commits