diff --git a/screening/etc/service.properties b/screening/etc/service.properties index 3917b50cc88b7878e615d0b2fb852b5bcb51e4fe..f6b7f9d2bc1ced60a6da6f8e3fbfede97c3be455 100644 --- a/screening/etc/service.properties +++ b/screening/etc/service.properties @@ -159,7 +159,7 @@ screening-dss-api-exporter-servlet.path = /rmi-datastore-server-screening-api-v1 # --------------------------------------------------------------------------- data-sources = imaging-db -imaging-db.version-holder-class = ch.systemsx.cisd.openbis.plugin.screening.shared.ImagingDatabaseVersionHolder +imaging-db.version-holder-class = ch.systemsx.cisd.openbis.dss.etl.dataaccess.ImagingDatabaseVersionHolder imaging-db.databaseEngineCode = postgresql imaging-db.basicDatabaseName = imaging imaging-db.databaseKind = dev diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/HCSImageFileExtractionResult.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/HCSImageFileExtractionResult.java index e744d06bef95e1af705fbb0ccecd0df9a760881d..66b14cb63ea7daf38a01b9e624f7479165108775 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/HCSImageFileExtractionResult.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/HCSImageFileExtractionResult.java @@ -17,6 +17,9 @@ package ch.systemsx.cisd.openbis.dss.etl; import java.io.File; import java.util.List; +import java.util.Set; + +import ch.systemsx.cisd.bds.hcs.Channel; /** * Class which contains the image extraction process results. @@ -31,10 +34,14 @@ public final class HCSImageFileExtractionResult /** The invalid files found. */ private final List<File> invalidFiles; - public HCSImageFileExtractionResult(List<AcquiredPlateImage> images, List<File> invalidFiles) + private final Set<Channel> channels; + + public HCSImageFileExtractionResult(List<AcquiredPlateImage> images, List<File> invalidFiles, + Set<Channel> channels) { this.images = images; this.invalidFiles = invalidFiles; + this.channels = channels; } public List<AcquiredPlateImage> getImages() @@ -46,4 +53,9 @@ public final class HCSImageFileExtractionResult { return invalidFiles; } + + public Set<Channel> getChannels() + { + return channels; + } } \ No newline at end of file diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/PlateStorageProcessor.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/PlateStorageProcessor.java index 3325b90176f15a6962c5e2664ce678fccfaf20ed..30af1e46c3a1a6036f703aa102fa1b2a1396735a 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/PlateStorageProcessor.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/PlateStorageProcessor.java @@ -22,6 +22,10 @@ import java.util.ArrayList; import java.util.List; import java.util.Properties; +import javax.sql.DataSource; + +import net.lemnik.eodsql.QueryTool; + import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.time.DurationFormatUtils; import org.apache.log4j.Logger; @@ -50,6 +54,8 @@ import ch.systemsx.cisd.etlserver.ITypeExtractor; import ch.systemsx.cisd.etlserver.PlateDimension; import ch.systemsx.cisd.etlserver.PlateDimensionParser; import ch.systemsx.cisd.etlserver.HCSImageCheckList.FullLocation; +import ch.systemsx.cisd.openbis.dss.etl.dataaccess.IImagingUploadDAO; +import ch.systemsx.cisd.openbis.dss.generic.shared.ServiceProvider; import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; @@ -79,6 +85,10 @@ public final class PlateStorageProcessor extends AbstractStorageProcessor private static final String DEPRECATED_FILE_EXTRACTOR_PROPERTY = "deprecated-file-extractor"; + // ----------- + + private final DataSource dataSource; + private final Geometry spotGeometry; private final int numberOfChannels; @@ -88,6 +98,8 @@ public final class PlateStorageProcessor extends AbstractStorageProcessor private final ch.systemsx.cisd.etlserver.IHCSImageFileExtractor deprecatedImageFileExtractor; + private IImagingUploadDAO currentTransaction; + public PlateStorageProcessor(final Properties properties) { super(properties); @@ -110,6 +122,8 @@ public final class PlateStorageProcessor extends AbstractStorageProcessor ClassUtils.create(ch.systemsx.cisd.etlserver.IHCSImageFileExtractor.class, fileExtractorClass, properties); } + this.dataSource = ServiceProvider.getDataSourceProvider().getDataSource(properties); + this.currentTransaction = null; } private int extractNumberOfChannels() @@ -124,6 +138,11 @@ public final class PlateStorageProcessor extends AbstractStorageProcessor return channels; } + private IImagingUploadDAO createQuery() + { + return QueryTool.getQuery(dataSource, IImagingUploadDAO.class); + } + private final static void checkDataSetInformation(final DataSetInformation dataSetInformation) { assert dataSetInformation != null : "Unspecified data set information"; @@ -250,7 +269,8 @@ public final class PlateStorageProcessor extends AbstractStorageProcessor { throw new UserFailureException("Experiment unknown for data set " + dataSetInformation); } - ScreeningContainerDatasetInfo info = createScreeningDatasetInfo(experiment, dataSetInformation); + ScreeningContainerDatasetInfo info = + createScreeningDatasetInfo(experiment, dataSetInformation); HCSImageFileExtractionResult extractionResult = extractImages(dataSetInformation, incomingDataSetDirectory); @@ -332,14 +352,29 @@ public final class PlateStorageProcessor extends AbstractStorageProcessor @Override public void commit() { - // FIXME 2010--, Tomasz Pylak: implement me + commitDatabaseChanges(); + } + + private void commitDatabaseChanges() + { + if (currentTransaction == null) + { + throw new IllegalStateException("there is no transaction to commit"); + } + try + { + currentTransaction.close(true); + } finally + { + currentTransaction = null; + } } public UnstoreDataAction rollback(File incomingDataSetDirectory, File storedDataDirectory, Throwable exception) { unstoreFiles(incomingDataSetDirectory, storedDataDirectory); - unstoreFromDatabase(); + rollbackDatabaseChanges(); return UnstoreDataAction.MOVE_TO_ERROR; } @@ -385,12 +420,28 @@ public final class PlateStorageProcessor extends AbstractStorageProcessor private void storeInDatabase(ScreeningContainerDatasetInfo info, List<AcquiredPlateImage> images) { + if (currentTransaction != null) + { + throw new IllegalStateException("previous transaction has not been commited!"); + } + currentTransaction = createQuery(); // FIXME 2010--, Tomasz Pylak: implement me } - private void unstoreFromDatabase() + private void rollbackDatabaseChanges() { - // FIXME 2010-05-14, Tomasz Pylak: delete the whle dataset from the screening database + if (currentTransaction == null) + { + throw new IllegalStateException("there is no transaction to rollback"); + } + try + { + currentTransaction.rollback(); + } finally + { + currentTransaction.close(); + currentTransaction = null; + } } /** @@ -514,7 +565,8 @@ public final class PlateStorageProcessor extends AbstractStorageProcessor .createDirectoryNode(incomingDataSetDirectory), dataSetInformation, accepter); return new HCSImageFileExtractionResult(accepter.getImages(), - asRelativePaths(originalResult.getInvalidFiles())); + asRelativePaths(originalResult.getInvalidFiles()), originalResult + .getChannels()); } private List<File> asRelativePaths(List<IFile> files) diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/IImagingUploadDAO.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/IImagingUploadDAO.java new file mode 100644 index 0000000000000000000000000000000000000000..cee7e3814491f721aab83fb8d42aebd61d5b9d1c --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/IImagingUploadDAO.java @@ -0,0 +1,36 @@ +/* + * Copyright 2010 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.dss.etl.dataaccess; + +import net.lemnik.eodsql.Select; +import net.lemnik.eodsql.TransactionQuery; + +/** + * @author Tomasz Pylak + */ +public interface IImagingUploadDAO extends TransactionQuery +{ + @Select("select ID from EXPERIMENTS where PERM_ID = ?{1}") + public Long tryGetExperimentIdByPermId(String experimentPermId); + + @Select("insert into EXPERIMENTS (PERM_ID) values (?{1}) returning ID") + public long addExperiment(String experimentPermId); + + @Select("select * from CONTAINERS where PERM_ID = ?{1}") + public ImgContainerDTO tryGetContainerByPermId(String containerPermId); + +} diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/ScreeningDatabaseVersionHolder.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImagingDatabaseVersionHolder.java similarity index 75% rename from screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/ScreeningDatabaseVersionHolder.java rename to screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImagingDatabaseVersionHolder.java index ecffb28e669ecaa9b04ee0d88b8bd4158bfd6a69..21acd307892bfb55ae8c339ea2dac709c31da39e 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/ScreeningDatabaseVersionHolder.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImagingDatabaseVersionHolder.java @@ -14,15 +14,16 @@ * limitations under the License. */ -package ch.systemsx.cisd.openbis.plugin.screening.shared; +package ch.systemsx.cisd.openbis.dss.etl.dataaccess; +import ch.systemsx.cisd.openbis.dss.generic.shared.IDatabaseVersionHolder; /** - * Stores current version of special purpose screening database. + * Stores current version of special purpose imaging database. * * @author Tomasz Pylak */ -public class ScreeningDatabaseVersionHolder +public class ImagingDatabaseVersionHolder implements IDatabaseVersionHolder { /** Current version of the database. */ static final String DATABASE_VERSION = "001"; diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgAcquiredImageDTO.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgAcquiredImageDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..ff3268fb5d5c96cf5ad45dacd15ed6ab8d4b841f --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgAcquiredImageDTO.java @@ -0,0 +1,93 @@ +/* + * Copyright 2010 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.dss.etl.dataaccess; + +import net.lemnik.eodsql.AutoGeneratedKeys; +import net.lemnik.eodsql.ResultColumn; + +/** + * @author Tomasz Pylak + */ +public class ImgAcquiredImageDTO +{ + @AutoGeneratedKeys + private long id; + + @ResultColumn("IMG_ID") + private long imageId; + + // can be null if there is no thumbnail + @ResultColumn("THUMBNAIL_ID") + private Long thumbnailId; + + @ResultColumn("CHANNEL_STACK_ID") + private long channelStackId; + + @ResultColumn("CHANNEL_ID") + private long channelId; + + public long getId() + { + return id; + } + + public void setId(long id) + { + this.id = id; + } + + public long getImageId() + { + return imageId; + } + + public void setImageId(long imageId) + { + this.imageId = imageId; + } + + public Long getThumbnailId() + { + return thumbnailId; + } + + public void setThumbnailId(Long thumbnailId) + { + this.thumbnailId = thumbnailId; + } + + public long getChannelStackId() + { + return channelStackId; + } + + public void setChannelStackId(long channelStackId) + { + this.channelStackId = channelStackId; + } + + public long getChannelId() + { + return channelId; + } + + public void setChannelId(long channelId) + { + this.channelId = channelId; + } + +} diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgChannelDTO.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgChannelDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..df8812dbe4e4d009beba992e20d8f813389e4db2 --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgChannelDTO.java @@ -0,0 +1,137 @@ +/* + * Copyright 2010 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.dss.etl.dataaccess; + +import net.lemnik.eodsql.AutoGeneratedKeys; +import net.lemnik.eodsql.ResultColumn; + +/** + * @author Tomasz Pylak + */ +// CREATE TABLE CHANNELS ( +// ID BIGSERIAL NOT NULL, +// +// NAME NAME NOT NULL, +// DESCRIPTION DESCRIPTION, +// WAVELENGTH INTEGER, +// +// DS_ID TECH_ID, +// EXP_ID TECH_ID, +// +// PRIMARY KEY (ID), +// CONSTRAINT FK_CHANNELS_1 FOREIGN KEY (DS_ID) REFERENCES DATA_SETS (ID) ON DELETE CASCADE ON +// UPDATE CASCADE, +// CONSTRAINT FK_CHANNELS_2 FOREIGN KEY (EXP_ID) REFERENCES EXPERIMENTS (ID) ON DELETE CASCADE ON +// UPDATE CASCADE, +// CONSTRAINT CHANNELS_DS_EXP_ARC_CK CHECK ((DS_ID IS NOT NULL AND EXP_ID IS NULL) OR (DS_ID IS NULL +// AND EXP_ID IS NOT NULL)) +// ); +public class ImgChannelDTO +{ + @AutoGeneratedKeys + private long id; + + @ResultColumn("NAME") + private String name; + + @ResultColumn("DESCRIPTION") + private String descriptionOrNull; + + @ResultColumn("WAVELENGTH") + private Integer wavelengthOrNull; + + // can be null if experimentId is not null + @ResultColumn("DS_ID") + private Long datasetIdOrNull; + + // can be null if datasetId is not null + @ResultColumn("EXP_ID") + private Long experimentIdOrNull; + + public ImgChannelDTO(String name, String descriptionOrNull, Integer wavelengthOrNull, + Long datasetIdOrNull, Long experimentIdOrNull) + { + assert (datasetIdOrNull == null && experimentIdOrNull != null) + || (datasetIdOrNull != null && experimentIdOrNull == null); + this.name = name; + this.descriptionOrNull = descriptionOrNull; + this.wavelengthOrNull = wavelengthOrNull; + this.datasetIdOrNull = datasetIdOrNull; + this.experimentIdOrNull = experimentIdOrNull; + } + + public long getId() + { + return id; + } + + public void setId(long id) + { + this.id = id; + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getDescription() + { + return descriptionOrNull; + } + + public void setDescription(String description) + { + this.descriptionOrNull = description; + } + + public Integer getWavelength() + { + return wavelengthOrNull; + } + + public void setWavelength(Integer wavelength) + { + this.wavelengthOrNull = wavelength; + } + + public Long getDatasetId() + { + return datasetIdOrNull; + } + + public void setDatasetId(Long datasetId) + { + this.datasetIdOrNull = datasetId; + } + + public Long getExperimentId() + { + return experimentIdOrNull; + } + + public void setExperimentId(Long experimentId) + { + this.experimentIdOrNull = experimentId; + } + +} diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgChannelStackDTO.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgChannelStackDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..d92339eb5028a12d28f77bc2fc831a79ba97b499 --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgChannelStackDTO.java @@ -0,0 +1,131 @@ +/* + * Copyright 2010 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.dss.etl.dataaccess; + +import net.lemnik.eodsql.AutoGeneratedKeys; +import net.lemnik.eodsql.ResultColumn; + +/** + * @author Tomasz Pylak + */ +public class ImgChannelStackDTO +{ + @AutoGeneratedKeys + private long id; + + // x and y are kind of a two dimensional sequence number, (e.g. tile column) + @ResultColumn("X") + private Integer x; + + // x and y are kind of a two dimensional sequence number, (e.g. tile row, 1 is the first row) + // Some use case may only use x and leave y alone. + @ResultColumn("Y") + private Integer y; + + // can be null + @ResultColumn("Z_in_M") + private Float z; + + // can be null + @ResultColumn("T_in_SEC") + private Float t; + + @ResultColumn("DS_ID") + private long datasetId; + + @ResultColumn("SPOT_ID") + private long spotId; + + public ImgChannelStackDTO(int x, int y, long datasetId, long spotId) + { + this.x = x; + this.y = y; + this.datasetId = datasetId; + this.spotId = spotId; + } + + public long getId() + { + return id; + } + + public void setId(long id) + { + this.id = id; + } + + public Integer getX() + { + return x; + } + + public void setX(Integer x) + { + this.x = x; + } + + public Integer getY() + { + return y; + } + + public void setY(Integer y) + { + this.y = y; + } + + public Float getZ() + { + return z; + } + + public void setZ(Float z) + { + this.z = z; + } + + public Float getT() + { + return t; + } + + public void setT(Float t) + { + this.t = t; + } + + public long getDatasetId() + { + return datasetId; + } + + public void setDatasetId(long datasetId) + { + this.datasetId = datasetId; + } + + public long getSpotId() + { + return spotId; + } + + public void setSpotId(long spotId) + { + this.spotId = spotId; + } + +} diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgContainerDTO.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgContainerDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..c2b824b5e500ddcf7806b659db48f3f2362202c4 --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgContainerDTO.java @@ -0,0 +1,94 @@ +/* + * Copyright 2010 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.dss.etl.dataaccess; + +import net.lemnik.eodsql.AutoGeneratedKeys; +import net.lemnik.eodsql.ResultColumn; + +/** + * DTO holding information about the container in the imaging database. + * + * @author Tomasz Pylak + */ +public class ImgContainerDTO +{ + @AutoGeneratedKeys + private long id; + + @ResultColumn("PERM_ID") + private String permId; + + @ResultColumn("SPOTS_WIDTH") + private Integer spotWidth; + + @ResultColumn("SPOTS_HEIGHT") + private Integer spotHeight; + + @ResultColumn("EXPE_ID") + private long experimentId; + + public long getId() + { + return id; + } + + public void setId(long id) + { + this.id = id; + } + + public String getPermId() + { + return permId; + } + + public void setPermId(String permId) + { + this.permId = permId; + } + + public Integer getSpotWidth() + { + return spotWidth; + } + + public void setSpotWidth(Integer spotWidth) + { + this.spotWidth = spotWidth; + } + + public Integer getSpotHeight() + { + return spotHeight; + } + + public void setSpotHeight(Integer spotHeight) + { + this.spotHeight = spotHeight; + } + + public long getExperimentId() + { + return experimentId; + } + + public void setExperimentId(long experimentId) + { + this.experimentId = experimentId; + } + +} diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgDatasetDTO.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgDatasetDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..c12c34bf6513b25724947a5981dbdee392914447 --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgDatasetDTO.java @@ -0,0 +1,101 @@ +/* + * Copyright 2010 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.dss.etl.dataaccess; + +import net.lemnik.eodsql.AutoGeneratedKeys; +import net.lemnik.eodsql.ResultColumn; + +/** + * @author Tomasz Pylak + */ +public class ImgDatasetDTO +{ + @AutoGeneratedKeys + private long id; + + @ResultColumn("PERM_ID") + private String permId; + + @ResultColumn("FIELDS_WIDTH") + private Integer fieldsWidthOrNull; + + @ResultColumn("FIELDS_HEIGHT") + private Integer fieldsHeightOrNull; + + @ResultColumn("CONT_ID") + private long containerId; + + public ImgDatasetDTO(String permId, Integer fieldsWidthOrNull, Integer fieldsHeightOrNull, + long containerId) + { + this.permId = permId; + this.fieldsWidthOrNull = fieldsWidthOrNull; + this.fieldsHeightOrNull = fieldsHeightOrNull; + this.containerId = containerId; + } + + public long getId() + { + return id; + } + + public void setId(long id) + { + this.id = id; + } + + public String getPermId() + { + return permId; + } + + public void setPermId(String permId) + { + this.permId = permId; + } + + public Integer getFieldsWidth() + { + return fieldsWidthOrNull; + } + + public void setFieldsWidth(Integer fieldsWidth) + { + this.fieldsWidthOrNull = fieldsWidth; + } + + public Integer getFieldsHeight() + { + return fieldsHeightOrNull; + } + + public void setFieldsHeight(Integer fieldsHeight) + { + this.fieldsHeightOrNull = fieldsHeight; + } + + public long getContainerId() + { + return containerId; + } + + public void setContainerId(long containerId) + { + this.containerId = containerId; + } + +} diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgImageDTO.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgImageDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..d82d5ca4c0bccb9259e8a3ee2d26cbf7268d19fc --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgImageDTO.java @@ -0,0 +1,96 @@ +/* + * Copyright 2010 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.dss.etl.dataaccess; + +import net.lemnik.eodsql.AutoGeneratedKeys; +import net.lemnik.eodsql.ResultColumn; + +/** + * @author Tomasz Pylak + */ +public class ImgImageDTO +{ + @AutoGeneratedKeys + private long id; + + @ResultColumn("PATH") + private String filePath; + + @ResultColumn("PAGE") + private Integer pathOrNull; + + @ResultColumn("COLOR") + private ColorComponent colorComponentOrNull; + + public static enum ColorComponent + { + RED, GREEN, BLUE + } + + public ImgImageDTO(String filePath) + { + this(filePath, null, null); + } + + public ImgImageDTO(String filePath, Integer pathOrNull, ColorComponent colorComponentOrNull) + { + this.filePath = filePath; + this.pathOrNull = pathOrNull; + this.colorComponentOrNull = colorComponentOrNull; + } + + public long getId() + { + return id; + } + + public void setId(long id) + { + this.id = id; + } + + public String getFilePath() + { + return filePath; + } + + public void setFilePath(String filePath) + { + this.filePath = filePath; + } + + public Integer getPath() + { + return pathOrNull; + } + + public void setPath(Integer path) + { + this.pathOrNull = path; + } + + public ColorComponent getColorComponent() + { + return colorComponentOrNull; + } + + public void setColorComponent(ColorComponent colorComponent) + { + this.colorComponentOrNull = colorComponent; + } + +} diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgSpotDTO.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgSpotDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..e2cb4cbcd7c32ed401ffe5ef3e8151af4873d914 --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImgSpotDTO.java @@ -0,0 +1,103 @@ +/* + * Copyright 2010 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.dss.etl.dataaccess; + +import net.lemnik.eodsql.AutoGeneratedKeys; +import net.lemnik.eodsql.ResultColumn; + +/** + * @author Tomasz Pylak + */ +public class ImgSpotDTO +{ + @AutoGeneratedKeys + private long id; + + @ResultColumn("PERM_ID") + private String permId; + + // position in the container, one-based (e.g. well column) + @ResultColumn("X") + private Integer x; + + // position in the container, one-based (e.g. well row, 1 is the first row) + @ResultColumn("Y") + private Integer y; + + @ResultColumn("CONT_ID") + private long containerId; + + public ImgSpotDTO(long id, String permId, Integer x, Integer y, long containerId) + { + this.id = id; + this.permId = permId; + this.x = x; + this.y = y; + this.containerId = containerId; + } + + public long getId() + { + return id; + } + + public void setId(long id) + { + this.id = id; + } + + public String getPermId() + { + return permId; + } + + public void setPermId(String permId) + { + this.permId = permId; + } + + public Integer getX() + { + return x; + } + + public void setX(Integer x) + { + this.x = x; + } + + public Integer getY() + { + return y; + } + + public void setY(Integer y) + { + this.y = y; + } + + public long getContainerId() + { + return containerId; + } + + public void setContainerId(long containerId) + { + this.containerId = containerId; + } + +} diff --git a/screening/source/sql/postgresql/001/schema-001.sql b/screening/source/sql/postgresql/001/schema-001.sql index 90b6b2a5ddcb21563e1537151abce28ac8b5f180..a0858f746149df7a7422fe045d6a45496b857e77 100644 --- a/screening/source/sql/postgresql/001/schema-001.sql +++ b/screening/source/sql/postgresql/001/schema-001.sql @@ -149,6 +149,8 @@ CREATE TABLE IMAGES ( /* FEATURE VECTORS */ /* ---------------------------------------------------------------------- */ +/* --- UNUSED YET --------------------------------------- + CREATE TABLE FEATURE_DEFS ( ID BIGSERIAL NOT NULL, @@ -187,3 +189,4 @@ CREATE INDEX FEATURE_VALUES_FD_IDX ON FEATURE_VALUES(FD_ID); CREATE INDEX FEATURE_VALUES_DS_IDX ON FEATURE_VALUES(DS_ID); CREATE INDEX FEATURE_VALUES_Z_AND_T_IDX ON FEATURE_VALUES(Z_in_M, T_in_SEC); + --- END UNUSED YET --------------------------------------- */