From 2f3bb4d5ce620fd2b02a0d97bc83adbadd726015 Mon Sep 17 00:00:00 2001 From: brinn <brinn> Date: Fri, 28 Sep 2012 17:23:28 +0000 Subject: [PATCH] Refactor field names of PersistencyResources to reflect that the fields cannot be null. SVN: 26854 --- .../bo/common/DatabaseContextUtils.java | 2 +- .../dataaccess/PersistencyResources.java | 21 +++++++++---------- ...bstractGenericEntityWithPropertiesDAO.java | 4 ++-- .../db/AuthorizationDAOFactory.java | 6 +++--- .../dataaccess/db/EntityHistoryDAO.java | 2 +- .../dataaccess/db/EntityPropertyTypeDAO.java | 2 +- 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/DatabaseContextUtils.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/DatabaseContextUtils.java index 29ea2f70d3e..da69b94ca1c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/DatabaseContextUtils.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/DatabaseContextUtils.java @@ -44,7 +44,7 @@ public class DatabaseContextUtils public static DatabaseConfigurationContext getDatabaseContext(IDAOFactory daoFactory) { PersistencyResources persistencyResources = daoFactory.getPersistencyResources(); - DatabaseConfigurationContext context = persistencyResources.getContextOrNull(); + DatabaseConfigurationContext context = persistencyResources.getContext(); if (context == null) { throw new ConfigurationFailureException("Missing database configuration context."); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/PersistencyResources.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/PersistencyResources.java index e6238f54e23..e61aa3dd290 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/PersistencyResources.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/PersistencyResources.java @@ -28,33 +28,32 @@ import ch.systemsx.cisd.openbis.generic.server.dataaccess.db.search.IFullTextInd */ public final class PersistencyResources { - private final DatabaseConfigurationContext contextOrNull; + private final DatabaseConfigurationContext context; - private final SessionFactory sessionFactoryOrNull; + private final SessionFactory sessionFactory; private final IFullTextIndexUpdateScheduler indexUpdateScheduler; private final IDynamicPropertyEvaluationScheduler dynamicPropertyEvaluationScheduler; - public PersistencyResources(DatabaseConfigurationContext contextOrNull, - SessionFactory sessionFactoryOrNull, - IFullTextIndexUpdateScheduler indexUpdateScheduler, + public PersistencyResources(DatabaseConfigurationContext context, + SessionFactory sessionFactory, IFullTextIndexUpdateScheduler indexUpdateScheduler, IDynamicPropertyEvaluationScheduler dynamicPropertyEvaluationScheduler) { - this.contextOrNull = contextOrNull; - this.sessionFactoryOrNull = sessionFactoryOrNull; + this.context = context; + this.sessionFactory = sessionFactory; this.indexUpdateScheduler = indexUpdateScheduler; this.dynamicPropertyEvaluationScheduler = dynamicPropertyEvaluationScheduler; } - public final DatabaseConfigurationContext getContextOrNull() + public final DatabaseConfigurationContext getContext() { - return contextOrNull; + return context; } - public final SessionFactory getSessionFactoryOrNull() + public final SessionFactory getSessionFactory() { - return sessionFactoryOrNull; + return sessionFactory; } public IFullTextIndexUpdateScheduler getIndexUpdateScheduler() diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AbstractGenericEntityWithPropertiesDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AbstractGenericEntityWithPropertiesDAO.java index c4b30e5c068..ecd4dfab184 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AbstractGenericEntityWithPropertiesDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AbstractGenericEntityWithPropertiesDAO.java @@ -73,7 +73,7 @@ public abstract class AbstractGenericEntityWithPropertiesDAO<T extends IEntityIn final PersistencyResources persistencyResources, final DatabaseInstancePE databaseInstance, final Class<T> entityClass) { - super(persistencyResources.getSessionFactoryOrNull(), databaseInstance, entityClass); + super(persistencyResources.getSessionFactory(), databaseInstance, entityClass); this.persistencyResources = persistencyResources; } @@ -89,7 +89,7 @@ public abstract class AbstractGenericEntityWithPropertiesDAO<T extends IEntityIn protected DataSource getDataSource() { - return persistencyResources.getContextOrNull().getDataSource(); + return persistencyResources.getContext().getDataSource(); } @Override diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AuthorizationDAOFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AuthorizationDAOFactory.java index f3418946584..efa0f72b80a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AuthorizationDAOFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AuthorizationDAOFactory.java @@ -123,7 +123,7 @@ public class AuthorizationDAOFactory implements IAuthorizationDAOFactory @Override public SessionFactory getSessionFactory() { - return persistencyResources.getSessionFactoryOrNull(); + return persistencyResources.getSessionFactory(); } private final DatabaseInstancePE getDatabaseInstanceId(final String databaseInstanceCode) @@ -277,7 +277,7 @@ public class AuthorizationDAOFactory implements IAuthorizationDAOFactory @Override public void setBatchUpdateMode(boolean batchMode) { - SessionFactory sessionFactory = persistencyResources.getSessionFactoryOrNull(); + SessionFactory sessionFactory = persistencyResources.getSessionFactory(); Session currentSession = sessionFactory.getCurrentSession(); HibernateUtils.setBatchUpdateMode(currentSession, batchMode); } @@ -286,7 +286,7 @@ public class AuthorizationDAOFactory implements IAuthorizationDAOFactory @Override public Connection getConnection() { - final SessionFactory sessionFactory = persistencyResources.getSessionFactoryOrNull(); + final SessionFactory sessionFactory = persistencyResources.getSessionFactory(); return sessionFactory.getCurrentSession().connection(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityHistoryDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityHistoryDAO.java index 6ded4b78ce4..0afa74605ea 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityHistoryDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityHistoryDAO.java @@ -39,7 +39,7 @@ class EntityHistoryDAO extends AbstractDAO implements IEntityHistoryDAO { EntityHistoryDAO(PersistencyResources persistencyResources, DatabaseInstancePE databaseInstance) { - super(persistencyResources.getSessionFactoryOrNull(), databaseInstance); + super(persistencyResources.getSessionFactory(), databaseInstance); } private static final Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION, diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityPropertyTypeDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityPropertyTypeDAO.java index 9be324f6392..3e2923034f0 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityPropertyTypeDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityPropertyTypeDAO.java @@ -72,7 +72,7 @@ final class EntityPropertyTypeDAO extends AbstractDAO implements IEntityProperty final PersistencyResources persistencyResources, final DatabaseInstancePE databaseInstance) { - super(persistencyResources.getSessionFactoryOrNull(), databaseInstance); + super(persistencyResources.getSessionFactory(), databaseInstance); this.entityKind = entityKind; this.dynamicPropertyEvaluationScheduler = persistencyResources.getDynamicPropertyEvaluationScheduler(); -- GitLab