Author: echatellier Date: 2010-03-23 14:04:37 +0100 (Tue, 23 Mar 2010) New Revision: 1852 Log: Set newInstance instance public and add it on interface. Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java 2010-03-22 17:34:41 UTC (rev 1851) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java 2010-03-23 13:04:37 UTC (rev 1852) @@ -60,23 +60,35 @@ throws TopiaException; /** - * Return class of entity managed by this DAO + * Create a new instance of managed entity. + * + * @return new entity instance + * @since 2.3.1 + * @throws TopiaException + */ + Entity newInstance() throws TopiaException; + + /** + * Return class of entity managed by this DAO. + * * @return entity managed by this DAO */ Class<Entity> getEntityClass(); /** + * Return context used by this DAO. + * * @return Returns the context. */ TopiaContextImplementor getContext(); /** - * Appelé lorsque le context a eu un commit de fait. + * Appelé lorsque le context a eu un commit de fait. + * + * TODO il faudrait peut-etre plutot faire un commit a deux phase + * car plusieurs type de persistence peuvent etre melangé, et il + * serait bien que si l'une echoué les autres echoue aussi. * - * TODO il faudrait peut-etre plutot faire un commit a deux phase - * car plusieurs type de persistence peuvent etre melangé, et il - * serait bien que si l'une echoué les autres echoue aussi. - * * @throws TopiaException if any pb while commit */ void commitTransaction() throws TopiaException; Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java 2010-03-22 17:34:41 UTC (rev 1851) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java 2010-03-23 13:04:37 UTC (rev 1852) @@ -155,7 +155,8 @@ } @SuppressWarnings("unchecked") - protected E instanciateNew() throws TopiaException { + @Override + public E newInstance() throws TopiaException { E result = null; if (log.isDebugEnabled()) { log.debug("entityClass = " + entityClass); @@ -702,7 +703,7 @@ */ @Override public E create(Map<String, Object> properties) throws TopiaException { - E result = instanciateNew(); + E result = newInstance(); // TODO reflechir s'il ne faudrait pas creer l'id avant l'event precedent // reflechir toujours dans un context on les E pourrait ne pas
participants (1)
-
echatellier@users.nuiton.org