From bb60f5cc26778e145c1ece6d5b2afcdf932379f1 Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Tue, 1 Nov 2011 08:16:46 +0000 Subject: [PATCH] LMS-2600 handle unkown space and sample type in SampleLoader. Make database basic name configurable. SVN: 23479 --- .../plugin/phosphonetx/server/business/SampleLoader.java | 9 +++++++++ .../source/java/phosphonetx-applicationContext.xml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/SampleLoader.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/SampleLoader.java index 0d42ea959f4..7f5d1c12057 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/SampleLoader.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/SampleLoader.java @@ -17,6 +17,7 @@ package ch.systemsx.cisd.openbis.plugin.phosphonetx.server.business; import java.util.ArrayList; +import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -77,10 +78,18 @@ public class SampleLoader implements ISampleLoader { SampleTypePE sampleTypePE = daoFactory.getSampleTypeDAO().tryFindSampleTypeByCode(sampleTypeCode); + if (sampleTypePE == null) + { + return Collections.emptySet(); + } final Long sampleTypeID = sampleTypePE.getId(); SpacePE space = daoFactory.getSpaceDAO().tryFindSpaceByCodeAndDatabaseInstance(spaceCode, daoFactory.getHomeDatabaseInstance()); + if (space == null) + { + return Collections.emptySet(); + } final Long spaceID = space.getId(); List<SampleSkeleton> sampleSkeletons = sampleLister.listSampleBy(new IValidator<SampleSkeleton>() diff --git a/rtd_phosphonetx/source/java/phosphonetx-applicationContext.xml b/rtd_phosphonetx/source/java/phosphonetx-applicationContext.xml index 54fa288d235..be72e2788ac 100644 --- a/rtd_phosphonetx/source/java/phosphonetx-applicationContext.xml +++ b/rtd_phosphonetx/source/java/phosphonetx-applicationContext.xml @@ -11,7 +11,7 @@ <bean id="phosphonetx-db-configuration-context" class="ch.systemsx.cisd.dbmigration.DatabaseConfigurationContext"> - <property name="basicDatabaseName" value="phosphonetx" /> + <property name="basicDatabaseName" value="${phosphonetx.database.basic-name}" /> <property name="createFromScratch" value="${phosphonetx.database.create-from-scratch}" /> <property name="scriptSingleStepMode" value="${phosphonetx.database.script-single-step-mode}" /> <property name="sequenceNameMapper"> -- GitLab