From 54ee099010f6ed1a82fa16ca6d2df7f954b4570d Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Mon, 9 Feb 2009 09:54:05 +0000 Subject: [PATCH] LMS-740 ExternalData and dependent classes moved from 'lims_base' to 'openbis' SVN: 9738 --- .../generic/shared/IETLLIMSService.java | 82 +++++++ .../generic/shared/dto/DataSetType.java | 39 ++++ .../generic/shared/dto/EntityType.java | 55 +++++ .../generic/shared/dto/ExternalData.java | 213 ++++++++++++++++++ .../generic/shared/dto/ExtractableData.java | 90 ++++++++ .../generic/shared/dto/FileFormatType.java | 41 ++++ .../generic/shared/dto/LocatorType.java | 41 ++++ .../generic/shared/dto/ProcedureType.java | 64 ++++++ 8 files changed, 625 insertions(+) create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IETLLIMSService.java create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetType.java create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityType.java create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExternalData.java create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExtractableData.java create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/FileFormatType.java create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/LocatorType.java create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ProcedureType.java diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IETLLIMSService.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IETLLIMSService.java new file mode 100644 index 00000000000..053fd0e2a36 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IETLLIMSService.java @@ -0,0 +1,82 @@ +/* + * Copyright 2007 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.generic.shared; + +import ch.systemsx.cisd.common.exceptions.UserFailureException; +import ch.systemsx.cisd.openbis.generic.shared.dto.DatabaseInstancePE; +import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.ExternalData; +import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePropertyPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; + +/** + * <b>LIMS</b> <i>Web Service</i> interface for the <b>ETL</b> (<i>Extract, Transform, Load</i>) + * server. + * + * @author Christian Ribeaud + */ +public interface IETLLIMSService extends IWebService, IDataStoreInfoProvider +{ + /** + * Returns the home database instance. + */ + public DatabaseInstancePE getHomeDatabaseInstance(); + + /** + * Gets an {@link ExperimentPE} object specified by experiment ID and sample code. + * + * @param sessionToken the user authentication token. Must not be <code>null</code>. + * @param sampleIdentifier an identifier which uniquely identifies the sample. + * @return <code>null</code> if no experiment could be found for given <var>dataSetInfo</var>. + */ + public ExperimentPE getBaseExperiment(final String sessionToken, + final SampleIdentifier sampleIdentifier) throws UserFailureException; + + /** + * Tries to return the properties of the top sample (e.g. master plate) registered for the + * specified sample code. + * + * @param sessionToken the user authentication token. Must not be <code>null</code>. + * @param sampleIdentifier an identifier which uniquely identifies the sample. + * @return <code>null</code> if no appropriated sample found. Returns an empty array if a a + * sample found with no properties. + */ + public SamplePropertyPE[] getPropertiesOfTopSampleRegisteredFor(final String sessionToken, + final SampleIdentifier sampleIdentifier) throws UserFailureException; + + /** + * Registers the specified data. + * + * @param sessionToken The user authentication token. Must not be <code>null</code>. + * @param sampleIdentifier an identifier which uniquely identifies the sample. + * @param procedureTypeCode Type of the procedure for which this data set will be registered. + * @param externalData Data set to be registered. It is assumed that the attributes + * <code>location</code>, <code>fileFormatType</code>, <code>dataSetType</code>, + * and <code>locatorType</code> are not-<code>null</code>. + * @throws UserFailureException if given data set code could not be found in the persistence + * layer. + */ + public void registerDataSet(final String sessionToken, final SampleIdentifier sampleIdentifier, + final String procedureTypeCode, final ExternalData externalData) + throws UserFailureException; + + /** + * Creates and returns a unique code for a new data set. + */ + public String createDataSetCode(final String sessionToken) throws UserFailureException; + +} \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetType.java new file mode 100644 index 00000000000..074c0f40c62 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetType.java @@ -0,0 +1,39 @@ +/* + * Copyright 2007 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.generic.shared.dto; + +import ch.systemsx.cisd.openbis.generic.shared.GenericSharedConstants; + +/** + * Kind of <i>Java Bean</i> or <i>Value Object</i> which transports through Web Service any + * information we would like to know about an data set type. + * + * @author Christian Ribeaud + */ +public final class DataSetType extends EntityType +{ + private static final long serialVersionUID = GenericSharedConstants.VERSION; + + public DataSetType() + { + } + + public DataSetType(final String code) + { + setCode(code); + } +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityType.java new file mode 100644 index 00000000000..59583e32612 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityType.java @@ -0,0 +1,55 @@ +/* + * Copyright 2008 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.generic.shared.dto; + +import ch.systemsx.cisd.openbis.generic.shared.GenericSharedConstants; + +/** + * An <i>abstract</i> <code>Code</code> extension for types. + * + * @author Christian Ribeaud + */ +public class EntityType extends Code<EntityType> implements IEntityType +{ + private static final long serialVersionUID = GenericSharedConstants.VERSION; + + private String description; + + public EntityType() + { + } + + public EntityType(final String code, final String description) + { + setCode(code); + setDescription(description); + } + + // + // IEntityType + // + + public final String getDescription() + { + return description; + } + + public final void setDescription(final String description) + { + this.description = description; + } +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExternalData.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExternalData.java new file mode 100644 index 00000000000..68e4e0a2b72 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExternalData.java @@ -0,0 +1,213 @@ +/* + * Copyright 2007 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.generic.shared.dto; + +import java.util.Date; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; + +import ch.systemsx.cisd.common.types.BooleanOrUnknown; +import ch.systemsx.cisd.openbis.generic.shared.GenericSharedConstants; + +/** + * Kind of <i>Java Bean</i> or <i>Value Object</i> which transports through Web Service any + * information we would like to know about external data. + * + * @author Christian Ribeaud + */ +public final class ExternalData extends ExtractableData +{ + private static final long serialVersionUID = GenericSharedConstants.VERSION; + + private String location; + + private StorageFormat storageFormat; + + private Date registrationDate; + + private FileFormatType fileFormatType; + + private DataSetType dataSetType; + + private LocatorType locatorType; + + + private BooleanOrUnknown complete = BooleanOrUnknown.U; + + private String associatedSampleCode; + + /** Returns <code>dataSetType</code>. */ + public final DataSetType getDataSetType() + { + return dataSetType; + } + + /** Sets <code>dataSetType</code>. */ + public final void setDataSetType(final DataSetType dataSetType) + { + this.dataSetType = dataSetType; + } + + /** Returns <code>locator</code>. */ + public final String getLocation() + { + return location; + } + + /** Sets <code>locator</code>. */ + public final void setLocation(final String locator) + { + this.location = locator; + } + + /** + * Returns the storage format (proprietary or BDS) of this external data set. + */ + public StorageFormat getStorageFormat() + { + return storageFormat; + } + + /** + * Sets the storage format (proprietary or BDS) of this external data set. + */ + public void setStorageFormat(final StorageFormat storageFormat) + { + this.storageFormat = storageFormat; + } + + /** Returns the date when the data set has been registered to the database. */ + public Date getRegistrationDate() + { + return registrationDate; + } + + /** Sets the date when the data set has been registered to the database. */ + public void setRegistrationDate(final Date registrationDate) + { + this.registrationDate = registrationDate; + } + + /** Returns <code>fileFormatType</code>. */ + public final FileFormatType getFileFormatType() + { + return fileFormatType; + } + + /** Sets <code>fileFormatType</code>. */ + public final void setFileFormatType(final FileFormatType fileFormatType) + { + this.fileFormatType = fileFormatType; + } + + /** Returns <code>locatorType</code>. */ + public final LocatorType getLocatorType() + { + return locatorType; + } + + /** Sets <code>locatorType</code>. */ + public final void setLocatorType(final LocatorType locatorType) + { + this.locatorType = locatorType; + } + + + /** + * Returns {@link BooleanOrUnknown#T}, if the data set is complete in the data store and + * {@link BooleanOrUnknown#F}, if some parts of the data are missing. If the completeness is + * not known (e.g. because the data set is stored in a format that does not allow to assess the + * completeness, {@link BooleanOrUnknown#U} is returned. + */ + public final BooleanOrUnknown getComplete() + { + return complete; + } + + /** + * Sets whether this data set is complete in the data store or not. The default is + * {@link BooleanOrUnknown#U}, which corresponds to the case where the data are stored in a + * format that does not allow to assess completeness. + */ + public final void setComplete(final BooleanOrUnknown complete) + { + this.complete = complete; + } + + public String getAssociatedSampleCode() + { + return associatedSampleCode; + } + + public void setAssociatedSampleCode(final String sampleCode) + { + this.associatedSampleCode = sampleCode; + } + + // + // Object + // + + @Override + public final boolean equals(final Object obj) + { + if (obj == this) + { + return true; + } + if (obj instanceof ExternalData == false) + { + return false; + } + final ExternalData that = (ExternalData) obj; + final EqualsBuilder builder = new EqualsBuilder(); + builder.append(that.location, location); + return builder.isEquals(); + } + + @Override + public final int hashCode() + { + final HashCodeBuilder builder = new HashCodeBuilder(); + builder.append(location); + return builder.toHashCode(); + } + + // + // Comparable + // + + /** + * If <code>null</code> values are present for <code>code</code>, then they come first. + */ + @Override + public final int compareTo(final ExtractableData o) + { + final String thatLocation = ((ExternalData) o).location; + if (location == null) + { + return thatLocation == null ? 0 : -1; + } + if (thatLocation == null) + { + return 1; + } + return location.compareTo(thatLocation); + } + +} \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExtractableData.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExtractableData.java new file mode 100644 index 00000000000..e7cf5d9721d --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExtractableData.java @@ -0,0 +1,90 @@ +/* + * Copyright 2008 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.generic.shared.dto; + +import java.util.Date; + +import ch.systemsx.cisd.openbis.generic.shared.GenericSharedConstants; + +/** + * A basic {@link ExternalData} object. + * <p> + * {@link ExternalData} extends this class and completes it with additional fields. + * </p> + * + * @author Christian Ribeaud + */ +public class ExtractableData extends Code<ExtractableData> +{ + private static final long serialVersionUID = GenericSharedConstants.VERSION; + + private Date productionDate; + + private String dataProducerCode; + + private String parentDataSetCode; + + /** + * Returns the date when the measurement / calculation that produced this external data set has + * been performed. + * <p> + * This may not be known in which case this method will return <code>null</code>. + */ + public Date getProductionDate() + { + return productionDate; + } + + /** + * Sets the date when the measurement / calculation that produced this external data set has + * been performed. + */ + public void setProductionDate(final Date productionDate) + { + this.productionDate = productionDate; + } + + /** + * Returns the code identifying the data source (i.e. measurement device or software pipeline) + * that produced this external data set. + * <p> + * This may not be known in which case this method will return <code>null</code>. + */ + public String getDataProducerCode() + { + return dataProducerCode; + } + + /** + * Sets the code identifying the data source (i.e. measurement device or software pipeline) that + * produced this external data set. + */ + public void setDataProducerCode(final String dataProducerCode) + { + this.dataProducerCode = dataProducerCode; + } + + public final String getParentDataSetCode() + { + return parentDataSetCode; + } + + public final void setParentDataSetCode(String parentDataSetCode) + { + this.parentDataSetCode = parentDataSetCode; + } +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/FileFormatType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/FileFormatType.java new file mode 100644 index 00000000000..facdd283e7c --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/FileFormatType.java @@ -0,0 +1,41 @@ +/* + * Copyright 2007 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.generic.shared.dto; + +import ch.systemsx.cisd.openbis.generic.shared.GenericSharedConstants; + +/** + * Kind of <i>Java Bean</i> or <i>Value Object</i> which transports through Web Service any + * information we would like to know about a file format type. + * + * @author Christian Ribeaud + */ +public final class FileFormatType extends EntityType +{ + private static final long serialVersionUID = GenericSharedConstants.VERSION; + + public static final String DEFAULT_FILE_FORMAT_TYPE_CODE = "TIFF"; + + public FileFormatType() + { + } + + public FileFormatType(final String code) + { + setCode(code); + } +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/LocatorType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/LocatorType.java new file mode 100644 index 00000000000..a5a6f593624 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/LocatorType.java @@ -0,0 +1,41 @@ +/* + * Copyright 2007 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.generic.shared.dto; + +import ch.systemsx.cisd.openbis.generic.shared.GenericSharedConstants; + +/** + * Kind of <i>Java Bean</i> or <i>Value Object</i> which contains any information we would like to + * know about a locator type. + * + * @author Christian Ribeaud + */ +public final class LocatorType extends EntityType +{ + private static final long serialVersionUID = GenericSharedConstants.VERSION; + + public static final String DEFAULT_LOCATOR_TYPE_CODE = "RELATIVE_LOCATION"; + + public LocatorType() + { + } + + public LocatorType(final String code) + { + setCode(code); + } +} \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ProcedureType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ProcedureType.java new file mode 100644 index 00000000000..4cb6478b399 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ProcedureType.java @@ -0,0 +1,64 @@ +/* + * Copyright 2007 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.generic.shared.dto; + +import ch.systemsx.cisd.openbis.generic.shared.GenericSharedConstants; +import ch.systemsx.cisd.openbis.generic.shared.dto.types.ProcedureTypeCode; + +/** + * Kind of <i>Java Bean</i> or <i>Value Object</i> which transports through Web Service any + * information we would like to know about a procedure type. + * + * @author Christian Ribeaud + */ +public final class ProcedureType extends EntityType +{ + private static final long serialVersionUID = GenericSharedConstants.VERSION; + + private boolean dataAcquisition; + + public ProcedureType() + { + } + + public ProcedureType(final String code) + { + ProcedureTypeCode procedureTypeCode = ProcedureTypeCode.getProcedureTypeCode(code); + setCode(procedureTypeCode.getCode()); + // TODO 2008-04-17, Franz-Josef Elmer: data acquisition flag should come from application + // server + setDataAcquisition(procedureTypeCode == ProcedureTypeCode.DATA_ACQUISITION); + } + + /** + * Returns <code>true</code> if and only if this procedure type represents a data acquisition + * (or measurement) rather than a data processing (or derivation) step in a workflow. + */ + public final boolean isDataAcquisition() + { + return dataAcquisition; + } + + /** + * Sets the attribute which determines whether this procedure type represents a data acquisition + * (or measurement) rather than a data processing (or derivation) step in a workflow. + */ + public final void setDataAcquisition(final boolean dataAcquisition) + { + this.dataAcquisition = dataAcquisition; + } +} -- GitLab