Index: topia/src/java/org/codelutin/topia/persistence/jdo/JDOPersistenceHelper.java diff -u topia/src/java/org/codelutin/topia/persistence/jdo/JDOPersistenceHelper.java:1.2 topia/src/java/org/codelutin/topia/persistence/jdo/JDOPersistenceHelper.java:1.3 --- topia/src/java/org/codelutin/topia/persistence/jdo/JDOPersistenceHelper.java:1.2 Fri Jul 30 14:38:59 2004 +++ topia/src/java/org/codelutin/topia/persistence/jdo/JDOPersistenceHelper.java Fri Jul 30 16:57:58 2004 @@ -23,9 +23,9 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ * - * Mise a jour: $Date: 2004/07/30 14:38:59 $ + * Mise a jour: $Date: 2004/07/30 16:57:58 $ * par : $Author: pineau $ */ @@ -55,21 +55,13 @@ import org.codelutin.topia.TopiaException; import org.codelutin.topia.TopiaId; import org.codelutin.topia.TopiaQuery; -import org.codelutin.topia.persistence.PersistenceHelper; +import org.codelutin.topia.persistence.AbstractPersistenceHelper; import org.codelutin.util.VersionNumberUtil; -public class JDOPersistenceHelper implements PersistenceHelper { // JDOPersistenceHelper +public class JDOPersistenceHelper extends AbstractPersistenceHelper { // JDOPersistenceHelper /** - * Le context a partir duquel on a recupere ce PersistenceHelper - */ - protected TopiaContext context = null; - /** - * Les proprietes pour ce PersistenceHelper - */ - protected Properties properties = null; - /** - * Le PersistenceHelper JDO + * Le AbstractPersistenceHelper JDO */ protected PersistenceManager pm = null; /** @@ -78,26 +70,13 @@ protected QueryHelper queryHelper = null; public JDOPersistenceHelper(TopiaContext context, Properties properties){ - this.context = context; - this.properties = properties; - PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(properties); + super(context, properties); + PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(getProperties()); pm = pmf.getPersistenceManager(); pm.setUserObject(this); } - public TopiaContext getContext(){ - return context; - } - - public TopiaEntity create(Class entityClass) throws TopiaException { - Class clazz = Util.getClazz(entityClass.getName() + "Impl"); - Class lazyClass = Util.getLazyClass(entityClass); - TopiaEntity entity = (TopiaEntity)Util.getInstance(clazz); - AbstractLazyEntity lazy = (AbstractLazyEntity)Util.getInstance(lazyClass, new Object[]{context, entity}); - return lazy; - } - - protected boolean isNewObject(TopiaEntity entity) throws TopiaException { + protected boolean isNewObject(TopiaEntity entity) throws TopiaException { String objectTopiaId = entity.get_topiaId_(); String objectVersion = entity.get_version_(); return objectTopiaId == null || objectVersion == null || "".equals(objectVersion) || VersionNumberUtil.equals("0", objectVersion); @@ -224,7 +203,7 @@ return find(query).size(); } - public TopiaEntity findByTopiaId(String id) throws TopiaException{ + protected TopiaEntity findByTopiaId(String id) throws TopiaException{ TopiaEntity entity = findDO(id).convertToEntity(); return entity; } Index: topia/src/java/org/codelutin/topia/persistence/jdo/AbstractLazyEntity.java diff -u topia/src/java/org/codelutin/topia/persistence/jdo/AbstractLazyEntity.java:1.1 topia/src/java/org/codelutin/topia/persistence/jdo/AbstractLazyEntity.java:1.2 --- topia/src/java/org/codelutin/topia/persistence/jdo/AbstractLazyEntity.java:1.1 Thu Jul 15 13:13:13 2004 +++ topia/src/java/org/codelutin/topia/persistence/jdo/AbstractLazyEntity.java Fri Jul 30 16:57:58 2004 @@ -23,20 +23,21 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * - * Mise a jour: $Date: 2004/07/15 13:13:13 $ - * par : $Author: bpoussin $ + * Mise a jour: $Date: 2004/07/30 16:57:58 $ + * par : $Author: pineau $ */ package org.codelutin.topia.persistence.jdo; -import org.codelutin.topia.TopiaUser; -import org.codelutin.topia.TopiaEntity; +import java.util.Date; + import org.codelutin.topia.TopiaContext; +import org.codelutin.topia.TopiaEntity; import org.codelutin.topia.TopiaException; import org.codelutin.topia.TopiaNotFoundException; -import java.util.Date; +import org.codelutin.topia.TopiaUser; import org.codelutin.util.VersionNumberUtil; public abstract class AbstractLazyEntity implements TopiaEntity { // AbstractLazyEntity @@ -112,7 +113,7 @@ } public JDOPersistenceHelper getPersistenceHelper() throws TopiaNotFoundException { - return (JDOPersistenceHelper)getContext().getPersistenceHelper(); + return (JDOPersistenceHelper) getContext().getPersistenceHelper(); } protected void load() throws TopiaException {