From a65fb6d9a8bbcf0f8861fcb68915ec8c384047af Mon Sep 17 00:00:00 2001 From: jakubs <jakubs> Date: Thu, 23 Aug 2012 12:33:07 +0000 Subject: [PATCH] BIS-153 SP-257 remove some of the unwanted package dependencies SVN: 26434 --- .../db/EntityVerificationInterceptor.java | 16 ++++------------ .../db/OpenBISHibernateTransactionManager.java | 12 ++++++++++-- .../source/java/genericApplicationContext.xml | 1 + 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityVerificationInterceptor.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityVerificationInterceptor.java index eacc19da904..143b8c93374 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityVerificationInterceptor.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityVerificationInterceptor.java @@ -26,7 +26,6 @@ import org.hibernate.Transaction; import org.hibernate.type.Type; import ch.systemsx.cisd.common.exceptions.UserFailureException; -import ch.systemsx.cisd.openbis.generic.server.CommonServiceProvider; import ch.systemsx.cisd.openbis.generic.server.business.bo.dynamic_property.DynamicPropertyEvaluator; import ch.systemsx.cisd.openbis.generic.server.business.bo.dynamic_property.IDynamicPropertyEvaluator; import ch.systemsx.cisd.openbis.generic.server.business.bo.dynamic_property.calculator.EntityAdaptorFactory; @@ -57,9 +56,11 @@ public class EntityVerificationInterceptor extends EmptyInterceptor private IDAOFactory daoFactory; - public EntityVerificationInterceptor(IHibernateTransactionManagerCallback callback) + public EntityVerificationInterceptor(IHibernateTransactionManagerCallback callback, + IDAOFactory daoFactory) { this.callback = callback; + this.daoFactory = daoFactory; initializeLists(); } @@ -196,7 +197,7 @@ public class EntityVerificationInterceptor extends EmptyInterceptor { EntityValidationCalculator calculator = EntityValidationCalculator.create(script.getScript()); - IDynamicPropertyEvaluator evaluator = new DynamicPropertyEvaluator(getDAOFactory(), null); + IDynamicPropertyEvaluator evaluator = new DynamicPropertyEvaluator(daoFactory, null); IEntityAdaptor adaptor = EntityAdaptorFactory.create(entity, evaluator); calculator.setEntity(adaptor); calculator.setIsNewEntity(isNewEntity); @@ -258,13 +259,4 @@ public class EntityVerificationInterceptor extends EmptyInterceptor newDatasets = new HashSet<DataPE>(); } - private IDAOFactory getDAOFactory() - { - if (daoFactory == null) - { - daoFactory = CommonServiceProvider.getDAOFactory(); - } - return daoFactory; - } - } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/OpenBISHibernateTransactionManager.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/OpenBISHibernateTransactionManager.java index 63ae6872061..ce534e6d3b4 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/OpenBISHibernateTransactionManager.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/OpenBISHibernateTransactionManager.java @@ -27,7 +27,8 @@ import org.springframework.orm.hibernate3.HibernateTransactionManager; import org.springframework.orm.hibernate3.SessionHolder; import org.springframework.transaction.support.DefaultTransactionStatus; -import ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException; +import ch.systemsx.cisd.common.exceptions.UserFailureException; +import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder; /** @@ -42,6 +43,13 @@ public class OpenBISHibernateTransactionManager extends HibernateTransactionMana private static final long serialVersionUID = ServiceVersionHolder.VERSION; + private IDAOFactory daoFactory; + + public OpenBISHibernateTransactionManager(IDAOFactory daoFactory) + { + this.daoFactory = daoFactory; + } + WeakHashMap<Transaction, String> rolledBackTransactions = new WeakHashMap<Transaction, String>(); @@ -55,7 +63,7 @@ public class OpenBISHibernateTransactionManager extends HibernateTransactionMana @Override public Interceptor getEntityInterceptor() throws IllegalStateException, BeansException { - return new EntityVerificationInterceptor(this); + return new EntityVerificationInterceptor(this, daoFactory); } @Override diff --git a/openbis/source/java/genericApplicationContext.xml b/openbis/source/java/genericApplicationContext.xml index e392016928b..62fdc810d6b 100644 --- a/openbis/source/java/genericApplicationContext.xml +++ b/openbis/source/java/genericApplicationContext.xml @@ -19,6 +19,7 @@ <bean id="transaction-manager" class="ch.systemsx.cisd.openbis.generic.server.dataaccess.db.OpenBISHibernateTransactionManager"> + <constructor-arg ref="dao-factory" /> <property name="sessionFactory" ref="hibernate-session-factory" /> <property name="jdbcExceptionTranslator" ref="exception-translator" /> </bean> -- GitLab