Skip to content
Snippets Groups Projects
Commit 21c55f26 authored by tpylak's avatar tpylak
Browse files

LMS-1529 coherent naming for data mart infrastructure

SVN: 15874
parent 4807d5eb
No related branches found
No related tags found
No related merge requests found
Showing
with 30 additions and 28 deletions
......@@ -22,8 +22,8 @@ import org.springframework.dao.DataAccessException;
import ch.systemsx.cisd.base.exceptions.CheckedExceptionTunnel;
import ch.systemsx.cisd.yeastx.db.generic.DMDataSetDTO;
import ch.systemsx.cisd.yeastx.db.generic.GenericUtils;
import ch.systemsx.cisd.yeastx.db.generic.IGenericDAO;
import ch.systemsx.cisd.yeastx.db.generic.DMGenericUtils;
import ch.systemsx.cisd.yeastx.db.generic.IDMGenericDAO;
/**
* Abstract class for dataset loaders. Provides commit and rollback functionality and creation of
......@@ -31,7 +31,7 @@ import ch.systemsx.cisd.yeastx.db.generic.IGenericDAO;
*
* @author Tomasz Pylak
*/
abstract public class AbstractDatasetLoader<T extends IGenericDAO> implements IDatasetLoader
abstract public class AbstractDatasetLoader<T extends IDMGenericDAO> implements IDatasetLoader
{
// if false transaction has to be commited or rollbacked before the next dataset will be created
protected boolean isTransactionCompleted = true;
......@@ -76,7 +76,7 @@ abstract public class AbstractDatasetLoader<T extends IGenericDAO> implements ID
throw new IllegalStateException(
"The previous transaction of uploading a dataset has been neither commited nor rollbacked.");
}
GenericUtils.createDataSet(getDao(), dataSet);
DMGenericUtils.createDataSet(getDao(), dataSet);
isTransactionCompleted = false;
}
......
......@@ -50,11 +50,11 @@ public class DMDataSetDTO
}
public DMDataSetDTO(String dsPermId, String sampPermIdOrNull, String sampNameOrNull,
String expePermId, String expeName)
String expePermId, String experimentName)
{
this.permId = dsPermId;
final DMExperimentDTO experiment = new DMExperimentDTO(expePermId);
experiment.setName(expeName);
experiment.setName(experimentName);
if (sampPermIdOrNull != null)
{
assert sampNameOrNull != null : "sample name must be given when sample permId is given";
......
......@@ -17,9 +17,11 @@
package ch.systemsx.cisd.yeastx.db.generic;
/**
* Utilities to perform operations on the Data Mart.
*
* @author Tomasz Pylak
*/
public class GenericUtils
public class DMGenericUtils
{
/**
* Creates the data set based on the information given in <var>dataSet</var>. The sample and
......@@ -33,9 +35,9 @@ public class GenericUtils
* transaction will be rolled back sample and experiment created in first transaction will stay
* in the DB.
*/
public static void createDataSet(IGenericDAO dao, DMDataSetDTO dataSet)
public static void createDataSet(IDMGenericDAO dao, DMDataSetDTO dataSet)
{
synchronized (IGenericDAO.class)
synchronized (IDMGenericDAO.class)
{
DMExperimentDTO experiment = getOrCreateExperiment(dao, dataSet);
dataSet.setExperimentId(experiment.getId()); // make sure all the ids are set correctly.
......@@ -65,19 +67,19 @@ public class GenericUtils
dataSet.setId(dataSetId);
}
private static DMSampleDTO createSample(IGenericDAO dao, DMSampleDTO sample, String samplePermId)
private static DMSampleDTO createSample(IDMGenericDAO dao, DMSampleDTO sample, String samplePermId)
{
final long sampleId = dao.addSample(sample);
sample.setId(sampleId);
return sample;
}
private static DMExperimentDTO getOrCreateExperiment(IGenericDAO dao, DMDataSetDTO dataSet)
private static DMExperimentDTO getOrCreateExperiment(IDMGenericDAO dao, DMDataSetDTO dataSet)
{
String permId = dataSet.getExperiment().getPermId();
// it may have happened that the experiment has been created by another thread after
// we checked that it does not exist
synchronized (IGenericDAO.class)
synchronized (IDMGenericDAO.class)
{
DMExperimentDTO experiment = dao.getExperimentByPermId(permId);
if (experiment == null)
......@@ -88,7 +90,7 @@ public class GenericUtils
}
}
private static DMExperimentDTO createExperiment(IGenericDAO dao, DMDataSetDTO dataSet,
private static DMExperimentDTO createExperiment(IDMGenericDAO dao, DMDataSetDTO dataSet,
String permId)
{
DMExperimentDTO experiment;
......
......@@ -24,11 +24,11 @@ import net.lemnik.eodsql.TransactionQuery;
import net.lemnik.eodsql.Update;
/**
* Interface for the "generic" methods (i.e. experiment, sample and data set).
* Interface for the "generic" methods on the Data Mart (i.e. experiment, sample and data set).
*
* @author Bernd Rinn
*/
public interface IGenericDAO extends TransactionQuery
public interface IDMGenericDAO extends TransactionQuery
{
@Select("select * from EXPERIMENTS where PERM_ID = ?{1}")
......
......@@ -20,14 +20,14 @@ import net.lemnik.eodsql.DataIterator;
import net.lemnik.eodsql.Select;
import net.lemnik.eodsql.Update;
import ch.systemsx.cisd.yeastx.db.generic.IGenericDAO;
import ch.systemsx.cisd.yeastx.db.generic.IDMGenericDAO;
/**
* Interface for querying / updating the metabol database.
*
* @author Bernd Rinn
*/
public interface IEICMSRunDAO extends IGenericDAO
public interface IEICMSRunDAO extends IDMGenericDAO
{
final String ALL_EIC_MSRUN_COLUMNS =
"EIC_MS_RUNS.ID, EIC_MS_RUNS.EXPE_ID, EIC_MS_RUNS.SAMP_ID, EIC_MS_RUNS.DS_ID, "
......
......@@ -32,7 +32,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifi
import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier;
import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SpaceIdentifier;
import ch.systemsx.cisd.yeastx.db.DBUtils;
import ch.systemsx.cisd.yeastx.db.generic.IGenericDAO;
import ch.systemsx.cisd.yeastx.db.generic.IDMGenericDAO;
/**
* Archiver that removes/adds data related to given data set from/to metabol database.
......@@ -62,7 +62,7 @@ public class MLArchiverTask extends AbstractArchiverProcessingPlugin
{
DataSource dataSource = getDataSource(dataSourceName);
final IGenericDAO dao = DBUtils.getQuery(dataSource, IGenericDAO.class);
final IDMGenericDAO dao = DBUtils.getQuery(dataSource, IDMGenericDAO.class);
try
{
dao.deleteDataSet(dataset.getDatasetCode());
......
......@@ -20,14 +20,14 @@ import net.lemnik.eodsql.DataIterator;
import net.lemnik.eodsql.Select;
import net.lemnik.eodsql.Update;
import ch.systemsx.cisd.yeastx.db.generic.IGenericDAO;
import ch.systemsx.cisd.yeastx.db.generic.IDMGenericDAO;
/**
* Interface for querying / updating the metabol database.
*
* @author Bernd Rinn
*/
public interface IFIAMSRunDAO extends IGenericDAO
public interface IFIAMSRunDAO extends IDMGenericDAO
{
final String ALL_FIA_MSRUN_COLUMNS =
"FIA_MS_RUNS.ID, FIA_MS_RUNS.EXPE_ID, "
......
......@@ -20,7 +20,7 @@ import net.lemnik.eodsql.Select;
import net.lemnik.eodsql.Update;
import ch.systemsx.cisd.yeastx.db.generic.DMDataSetDTO;
import ch.systemsx.cisd.yeastx.db.generic.IGenericDAO;
import ch.systemsx.cisd.yeastx.db.generic.IDMGenericDAO;
import ch.systemsx.cisd.yeastx.mzxml.dto.MzInstrumentDTO;
import ch.systemsx.cisd.yeastx.mzxml.dto.MzPrecursorDTO;
import ch.systemsx.cisd.yeastx.mzxml.dto.MzScanDTO;
......@@ -30,7 +30,7 @@ import ch.systemsx.cisd.yeastx.mzxml.dto.MzScanDTO;
*
* @author Tomasz Pylak
*/
public interface IMzXmlDAO extends IGenericDAO
public interface IMzXmlDAO extends IDMGenericDAO
{
@Select(sql = "insert into MZ_MS_RUNS "
+ " ( EXPE_ID, SAMP_ID, DS_ID, INSTRUMENT_TYPE, INSTRUMENT_MANUFACTURER, "
......
......@@ -19,7 +19,7 @@ package ch.systemsx.cisd.yeastx.quant;
import net.lemnik.eodsql.Select;
import net.lemnik.eodsql.Update;
import ch.systemsx.cisd.yeastx.db.generic.IGenericDAO;
import ch.systemsx.cisd.yeastx.db.generic.IDMGenericDAO;
import ch.systemsx.cisd.yeastx.quant.dto.MSConcentrationDTO;
import ch.systemsx.cisd.yeastx.quant.dto.MSQuantificationDTO;
......@@ -28,7 +28,7 @@ import ch.systemsx.cisd.yeastx.quant.dto.MSQuantificationDTO;
*
* @author Tomasz Pylak
*/
public interface IQuantMSDAO extends IGenericDAO
public interface IQuantMSDAO extends IDMGenericDAO
{
@Select(sql = "insert into MS_QUANTIFICATIONS "
+ "( EXPE_ID, DS_ID, SOURCE, VALID, COMMENT, REGISTRATOR, REGISTRATION_DATE ) "
......
......@@ -32,7 +32,7 @@ import org.testng.annotations.Test;
import ch.systemsx.cisd.yeastx.db.AbstractDBTest;
import ch.systemsx.cisd.yeastx.db.DBUtils;
import ch.systemsx.cisd.yeastx.db.generic.DMDataSetDTO;
import ch.systemsx.cisd.yeastx.db.generic.GenericUtils;
import ch.systemsx.cisd.yeastx.db.generic.DMGenericUtils;
/**
* A test for the fiaML tables.
......@@ -115,10 +115,10 @@ public class FIAMLTest extends AbstractDBTest
{
try
{
GenericUtils.createDataSet(fiamsDAO, new DMDataSetDTO("data set perm id 4",
DMGenericUtils.createDataSet(fiamsDAO, new DMDataSetDTO("data set perm id 4",
"sample perm id4", "sample name", "experiment perm id", "experiment name"));
// This will fail with a DataIntegrityViolationException.
GenericUtils.createDataSet(fiamsDAO, new DMDataSetDTO("data set perm id 4",
DMGenericUtils.createDataSet(fiamsDAO, new DMDataSetDTO("data set perm id 4",
"sample perm id4", "sample name", "experiment perm id", "experiment name"));
// There is transaction commit inside createDataSet method before DS is added to DB.
// DS created in first invocation will be be commited in second invocation.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment