From b5b8b312579a0ba3e970aa924e5933db315131ad Mon Sep 17 00:00:00 2001 From: pkupczyk <pkupczyk> Date: Wed, 4 Nov 2015 11:25:57 +0000 Subject: [PATCH] SSDM-2706 : V3 AS API - create data sets (only metadata): - hide the fact that storage format is a controlled vocabulary internally (still DTOs todo) - make it easier to set storage format and locator type by having a predefined classes for common values - more tests SVN: 34989 --- .../server/api/v3/ApplicationServerApi.java | 1 + .../SetDataSetLocatorTypeExecutor.java | 10 +- .../SetDataSetPhysicalDataExecutor.java | 6 + .../SetDataSetStorageFormatExecutor.java | 21 +- .../helper/common/AbstractListObjectById.java | 33 ++ .../helper/common/AbstractListTechIdById.java | 8 +- .../api/v3/helper/common/IListObjectById.java | 2 +- .../api/v3/helper/common/MapObjectById.java | 2 +- .../helper/dataset/ListDataSetByPermId.java | 4 +- .../dataset/ListFileFormatTypeByPermId.java | 4 +- .../dataset/ListLocatorTypeByPermId.java | 4 +- .../datastore/ListDataStoreByPermId.java | 4 +- .../helper/deletion/ListDeletionByTechId.java | 4 +- .../helper/entity/ListEntityTypeByPermId.java | 4 +- .../ListExperimentByIdentifier.java | 4 +- .../experiment/ListExperimentByPermId.java | 4 +- .../externaldms/ListExternalDmsByPermId.java | 4 +- .../material/ListMaterialsByPermId.java | 4 +- .../v3/helper/person/ListPersonByPermId.java | 4 +- .../project/ListProjectByIdentifier.java | 4 +- .../helper/project/ListProjectByPermId.java | 4 +- .../helper/sample/ListSampleByIdentifier.java | 4 +- .../v3/helper/sample/ListSampleByPermId.java | 4 +- .../v3/helper/space/ListSpaceByPermId.java | 4 +- .../vocabulary/ListVocabularyByPermId.java | 4 +- .../vocabulary/ListVocabularyTermByCode.java | 4 +- .../systemtest/api/v3/CreateDataSetTest.java | 366 ++++++++++++++---- .../entity/dataset/PhysicalDataCreation.java | 8 +- .../BdsDirectoryStorageFormatPermId.java | 37 ++ .../v3/dto/id/dataset/IStorageFormatId.java | 31 ++ .../v3/dto/id/dataset/LocatorTypePermId.java | 29 ++ .../ProprietaryStorageFormatPermId.java | 37 ++ .../RelativeLocationLocatorTypePermId.java | 37 ++ .../dto/id/dataset/StorageFormatPermId.java | 80 ++++ 34 files changed, 664 insertions(+), 116 deletions(-) create mode 100644 openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/common/AbstractListObjectById.java create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/BdsDirectoryStorageFormatPermId.java create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/IStorageFormatId.java create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/ProprietaryStorageFormatPermId.java create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/RelativeLocationLocatorTypePermId.java create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/StorageFormatPermId.java diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApi.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApi.java index cd0184e24fa..faeed772521 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApi.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApi.java @@ -306,6 +306,7 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi> @Override @Transactional + // @RolesAllowed intentionally omitted. Authorization is done in CreateDataSetMethodExecutor. @Capability("CREATE_DATASET") @DatabaseCreateOrDeleteModification(value = ObjectKind.DATA_SET) public List<DataSetPermId> createDataSets(String sessionToken, List<DataSetCreation> creations) diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/SetDataSetLocatorTypeExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/SetDataSetLocatorTypeExecutor.java index f310d0ef8ba..05e88f28f39 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/SetDataSetLocatorTypeExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/SetDataSetLocatorTypeExecutor.java @@ -26,6 +26,7 @@ import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.AbstractSetEntityToOneRelationExecutor; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetCreation; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.ILocatorTypeId; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.RelativeLocationLocatorTypePermId; import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; import ch.systemsx.cisd.openbis.generic.shared.dto.ExternalDataPE; @@ -46,7 +47,14 @@ public class SetDataSetLocatorTypeExecutor extends @Override protected ILocatorTypeId getRelatedId(DataSetCreation creation) { - return creation.getPhysicalData() != null ? creation.getPhysicalData().getLocatorTypeId() : null; + if (creation.getPhysicalData() != null) + { + return creation.getPhysicalData().getLocatorTypeId() != null ? creation.getPhysicalData().getLocatorTypeId() + : new RelativeLocationLocatorTypePermId(); + } else + { + return null; + } } @Override diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/SetDataSetPhysicalDataExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/SetDataSetPhysicalDataExecutor.java index 5c954e956e8..9d9abb1e0e0 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/SetDataSetPhysicalDataExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/SetDataSetPhysicalDataExecutor.java @@ -76,7 +76,13 @@ public class SetDataSetPhysicalDataExecutor implements ISetDataSetPhysicalDataEx dataSet.setShareId(physicalCreation.getShareId()); dataSet.setLocation(physicalCreation.getLocation()); + + if (physicalCreation.getSize() != null && physicalCreation.getSize() < 0) + { + throw new UserFailureException("Physical data set size cannot be < 0."); + } dataSet.setSize(physicalCreation.getSize()); + if (physicalCreation.getSpeedHint() != null) { dataSet.setSpeedHint(physicalCreation.getSpeedHint()); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/SetDataSetStorageFormatExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/SetDataSetStorageFormatExecutor.java index 8a149439185..afdcf519904 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/SetDataSetStorageFormatExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/SetDataSetStorageFormatExecutor.java @@ -26,8 +26,11 @@ import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.AbstractSetEntityToOneRelationExecutor; import ch.ethz.sis.openbis.generic.server.api.v3.executor.vocabulary.IMapVocabularyTermByIdExecutor; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetCreation; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.IStorageFormatId; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.StorageFormatPermId; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.vocabulary.IVocabularyTermId; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.vocabulary.VocabularyPermId; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.vocabulary.VocabularyTermCode; import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; import ch.systemsx.cisd.openbis.generic.shared.dto.ExternalDataPE; @@ -49,7 +52,23 @@ public class SetDataSetStorageFormatExecutor extends @Override protected IVocabularyTermId getRelatedId(DataSetCreation creation) { - return creation.getPhysicalData() != null ? creation.getPhysicalData().getStorageFormatId() : null; + if (creation.getPhysicalData() != null) + { + IStorageFormatId storageFormatId = creation.getPhysicalData().getStorageFormatId(); + + if (storageFormatId != null) + { + if (storageFormatId instanceof StorageFormatPermId) + { + return new VocabularyTermCode(((StorageFormatPermId) storageFormatId).getPermId()); + } else + { + throw new UserFailureException("Unsupported storage format: " + storageFormatId.getClass().getName()); + } + } + } + + return null; } @Override diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/common/AbstractListObjectById.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/common/AbstractListObjectById.java new file mode 100644 index 00000000000..d56fd5266f9 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/common/AbstractListObjectById.java @@ -0,0 +1,33 @@ +/* + * Copyright 2015 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.ethz.sis.openbis.generic.server.api.v3.helper.common; + +/** + * @author pkupczyk + */ +public abstract class AbstractListObjectById<ID, OBJECT> implements IListObjectById<ID, OBJECT> +{ + + @Override + public boolean acceptsIdClass(Class<ID> idClass) + { + return getIdClass().isAssignableFrom(idClass); + } + + protected abstract Class<ID> getIdClass(); + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/common/AbstractListTechIdById.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/common/AbstractListTechIdById.java index c1cba2d36dc..ec2ba6f79f2 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/common/AbstractListTechIdById.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/common/AbstractListTechIdById.java @@ -22,14 +22,12 @@ import java.util.List; import java.util.Map; /** - * - * * @author Franz-Josef Elmer */ -public abstract class AbstractListTechIdById<ID> implements IListObjectById<ID, Long> +public abstract class AbstractListTechIdById<ID> extends AbstractListObjectById<ID, Long> { private Map<Long, ID> idsByTechIds = new HashMap<Long, ID>(); - + @Override public ID createId(Long techId) { @@ -42,7 +40,7 @@ public abstract class AbstractListTechIdById<ID> implements IListObjectById<ID, idsByTechIds = createIdsByTechIdsMap(ids); return new ArrayList<>(idsByTechIds.keySet()); } - + protected abstract Map<Long, ID> createIdsByTechIdsMap(List<ID> ids); } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/common/IListObjectById.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/common/IListObjectById.java index dd628a61dc3..5c008acc3ed 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/common/IListObjectById.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/common/IListObjectById.java @@ -24,7 +24,7 @@ import java.util.List; public interface IListObjectById<ID, OBJECT> { - public Class<ID> getIdClass(); + public boolean acceptsIdClass(Class<ID> idClass); public ID createId(OBJECT entity); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/common/MapObjectById.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/common/MapObjectById.java index dc8f488593c..fdd0d01ee00 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/common/MapObjectById.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/common/MapObjectById.java @@ -84,7 +84,7 @@ public class MapObjectById<ID, OBJECT> { for (IListObjectById lister : listers) { - if (lister.getIdClass().equals(idClass)) + if (lister.acceptsIdClass(idClass)) { return lister; } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/dataset/ListDataSetByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/dataset/ListDataSetByPermId.java index d0e3b83571e..47b6de08f09 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/dataset/ListDataSetByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/dataset/ListDataSetByPermId.java @@ -20,7 +20,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListObjectById; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.DataSetPermId; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDataDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; @@ -28,7 +28,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; /** * @author pkupczyk */ -public class ListDataSetByPermId implements IListObjectById<DataSetPermId, DataPE> +public class ListDataSetByPermId extends AbstractListObjectById<DataSetPermId, DataPE> { private IDataDAO dataDAO; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/dataset/ListFileFormatTypeByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/dataset/ListFileFormatTypeByPermId.java index 4473f6ec11b..f0fcf8304ed 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/dataset/ListFileFormatTypeByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/dataset/ListFileFormatTypeByPermId.java @@ -19,7 +19,7 @@ package ch.ethz.sis.openbis.generic.server.api.v3.helper.dataset; import java.util.ArrayList; import java.util.List; -import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListObjectById; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.FileFormatTypePermId; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IFileFormatTypeDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.FileFormatTypePE; @@ -27,7 +27,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.FileFormatTypePE; /** * @author pkupczyk */ -public class ListFileFormatTypeByPermId implements IListObjectById<FileFormatTypePermId, FileFormatTypePE> +public class ListFileFormatTypeByPermId extends AbstractListObjectById<FileFormatTypePermId, FileFormatTypePE> { private IFileFormatTypeDAO typeDAO; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/dataset/ListLocatorTypeByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/dataset/ListLocatorTypeByPermId.java index 8617bfe3235..9839a28f07e 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/dataset/ListLocatorTypeByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/dataset/ListLocatorTypeByPermId.java @@ -19,7 +19,7 @@ package ch.ethz.sis.openbis.generic.server.api.v3.helper.dataset; import java.util.ArrayList; import java.util.List; -import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListObjectById; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.LocatorTypePermId; import ch.systemsx.cisd.openbis.generic.server.dataaccess.ILocatorTypeDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.LocatorTypePE; @@ -27,7 +27,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.LocatorTypePE; /** * @author pkupczyk */ -public class ListLocatorTypeByPermId implements IListObjectById<LocatorTypePermId, LocatorTypePE> +public class ListLocatorTypeByPermId extends AbstractListObjectById<LocatorTypePermId, LocatorTypePE> { private ILocatorTypeDAO typeDAO; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/datastore/ListDataStoreByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/datastore/ListDataStoreByPermId.java index 71b3e2b94e3..26323671580 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/datastore/ListDataStoreByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/datastore/ListDataStoreByPermId.java @@ -19,7 +19,7 @@ package ch.ethz.sis.openbis.generic.server.api.v3.helper.datastore; import java.util.LinkedList; import java.util.List; -import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListObjectById; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.datastore.DataStorePermId; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDataStoreDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.DataStorePE; @@ -27,7 +27,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.DataStorePE; /** * @author pkupczyk */ -public class ListDataStoreByPermId implements IListObjectById<DataStorePermId, DataStorePE> +public class ListDataStoreByPermId extends AbstractListObjectById<DataStorePermId, DataStorePE> { private IDataStoreDAO dataStoreDAO; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/deletion/ListDeletionByTechId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/deletion/ListDeletionByTechId.java index ca357261122..565b1c159d0 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/deletion/ListDeletionByTechId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/deletion/ListDeletionByTechId.java @@ -19,7 +19,7 @@ package ch.ethz.sis.openbis.generic.server.api.v3.helper.deletion; import java.util.LinkedList; import java.util.List; -import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListObjectById; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.DeletionTechId; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDeletionDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.DeletionPE; @@ -27,7 +27,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.DeletionPE; /** * @author pkupczyk */ -public class ListDeletionByTechId implements IListObjectById<DeletionTechId, DeletionPE> +public class ListDeletionByTechId extends AbstractListObjectById<DeletionTechId, DeletionPE> { private IDeletionDAO deletionDAO; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/entity/ListEntityTypeByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/entity/ListEntityTypeByPermId.java index 9a18acaec2a..93a96b40eaf 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/entity/ListEntityTypeByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/entity/ListEntityTypeByPermId.java @@ -19,7 +19,7 @@ package ch.ethz.sis.openbis.generic.server.api.v3.helper.entity; import java.util.LinkedList; import java.util.List; -import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListObjectById; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.entitytype.EntityTypePermId; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IEntityTypeDAO; @@ -29,7 +29,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; /** * @author pkupczyk */ -public class ListEntityTypeByPermId implements IListObjectById<EntityTypePermId, EntityTypePE> +public class ListEntityTypeByPermId extends AbstractListObjectById<EntityTypePermId, EntityTypePE> { private IEntityTypeDAO entityTypeDAO; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/experiment/ListExperimentByIdentifier.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/experiment/ListExperimentByIdentifier.java index b91e3803a66..1966ba9ff89 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/experiment/ListExperimentByIdentifier.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/experiment/ListExperimentByIdentifier.java @@ -21,7 +21,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; -import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListObjectById; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.ExperimentIdentifier; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IExperimentDAO; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IProjectDAO; @@ -33,7 +33,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ProjectIdentifier; /** * @author pkupczyk */ -public class ListExperimentByIdentifier implements IListObjectById<ExperimentIdentifier, ExperimentPE> +public class ListExperimentByIdentifier extends AbstractListObjectById<ExperimentIdentifier, ExperimentPE> { private IProjectDAO projectDAO; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/experiment/ListExperimentByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/experiment/ListExperimentByPermId.java index 3879590d418..89607befa7f 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/experiment/ListExperimentByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/experiment/ListExperimentByPermId.java @@ -19,7 +19,7 @@ package ch.ethz.sis.openbis.generic.server.api.v3.helper.experiment; import java.util.LinkedList; import java.util.List; -import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListObjectById; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.ExperimentPermId; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IExperimentDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE; @@ -27,7 +27,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE; /** * @author pkupczyk */ -public class ListExperimentByPermId implements IListObjectById<ExperimentPermId, ExperimentPE> +public class ListExperimentByPermId extends AbstractListObjectById<ExperimentPermId, ExperimentPE> { private IExperimentDAO experimentDAO; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/externaldms/ListExternalDmsByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/externaldms/ListExternalDmsByPermId.java index 286b129d293..e34db5aa228 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/externaldms/ListExternalDmsByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/externaldms/ListExternalDmsByPermId.java @@ -19,7 +19,7 @@ package ch.ethz.sis.openbis.generic.server.api.v3.helper.externaldms; import java.util.LinkedList; import java.util.List; -import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListObjectById; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.externaldms.ExternalDmsPermId; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IExternalDataManagementSystemDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.ExternalDataManagementSystemPE; @@ -27,7 +27,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.ExternalDataManagementSystemP /** * @author pkupczyk */ -public class ListExternalDmsByPermId implements IListObjectById<ExternalDmsPermId, ExternalDataManagementSystemPE> +public class ListExternalDmsByPermId extends AbstractListObjectById<ExternalDmsPermId, ExternalDataManagementSystemPE> { private IExternalDataManagementSystemDAO externalDmsDAO; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/material/ListMaterialsByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/material/ListMaterialsByPermId.java index 67056d46c10..d44c68ec841 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/material/ListMaterialsByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/material/ListMaterialsByPermId.java @@ -20,7 +20,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListObjectById; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.material.MaterialPermId; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IMaterialDAO; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialIdentifier; @@ -29,7 +29,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialPE; /** * @author pkupczyk */ -public class ListMaterialsByPermId implements IListObjectById<MaterialPermId, MaterialPE> +public class ListMaterialsByPermId extends AbstractListObjectById<MaterialPermId, MaterialPE> { private IMaterialDAO materialDAO; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/person/ListPersonByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/person/ListPersonByPermId.java index 8c3a08913d0..f467fa9c2e5 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/person/ListPersonByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/person/ListPersonByPermId.java @@ -19,7 +19,7 @@ package ch.ethz.sis.openbis.generic.server.api.v3.helper.person; import java.util.LinkedList; import java.util.List; -import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListObjectById; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.person.PersonPermId; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IPersonDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; @@ -27,7 +27,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; /** * @author pkupczyk */ -public class ListPersonByPermId implements IListObjectById<PersonPermId, PersonPE> +public class ListPersonByPermId extends AbstractListObjectById<PersonPermId, PersonPE> { private IPersonDAO personDAO; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/project/ListProjectByIdentifier.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/project/ListProjectByIdentifier.java index 48b330470b5..56431b45b60 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/project/ListProjectByIdentifier.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/project/ListProjectByIdentifier.java @@ -19,7 +19,7 @@ package ch.ethz.sis.openbis.generic.server.api.v3.helper.project; import java.util.LinkedList; import java.util.List; -import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListObjectById; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.project.ProjectIdentifier; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IProjectDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectPE; @@ -28,7 +28,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ProjectIdentifierF /** * @author pkupczyk */ -public class ListProjectByIdentifier implements IListObjectById<ProjectIdentifier, ProjectPE> +public class ListProjectByIdentifier extends AbstractListObjectById<ProjectIdentifier, ProjectPE> { private IProjectDAO projectDAO; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/project/ListProjectByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/project/ListProjectByPermId.java index 41d853fdf5f..cb1dea01637 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/project/ListProjectByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/project/ListProjectByPermId.java @@ -19,7 +19,7 @@ package ch.ethz.sis.openbis.generic.server.api.v3.helper.project; import java.util.LinkedList; import java.util.List; -import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListObjectById; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.project.ProjectPermId; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IProjectDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectPE; @@ -27,7 +27,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectPE; /** * @author pkupczyk */ -public class ListProjectByPermId implements IListObjectById<ProjectPermId, ProjectPE> +public class ListProjectByPermId extends AbstractListObjectById<ProjectPermId, ProjectPE> { private IProjectDAO projectDAO; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/sample/ListSampleByIdentifier.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/sample/ListSampleByIdentifier.java index e167f2a6285..d98f8f55342 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/sample/ListSampleByIdentifier.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/sample/ListSampleByIdentifier.java @@ -26,7 +26,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListObjectById; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.sample.SampleIdentifier; import ch.systemsx.cisd.openbis.generic.server.dataaccess.ISampleDAO; import ch.systemsx.cisd.openbis.generic.server.dataaccess.ISpaceDAO; @@ -39,7 +39,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SpaceIdentifier; * @author Franz-Josef Elmer */ // TODO: neds unit tests -public class ListSampleByIdentifier implements IListObjectById<SampleIdentifier, SamplePE> +public class ListSampleByIdentifier extends AbstractListObjectById<SampleIdentifier, SamplePE> { private ISpaceDAO spaceDAO; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/sample/ListSampleByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/sample/ListSampleByPermId.java index 3465a85b474..9cb4b34a041 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/sample/ListSampleByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/sample/ListSampleByPermId.java @@ -19,7 +19,7 @@ package ch.ethz.sis.openbis.generic.server.api.v3.helper.sample; import java.util.LinkedList; import java.util.List; -import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListObjectById; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.sample.SamplePermId; import ch.systemsx.cisd.openbis.generic.server.dataaccess.ISampleDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE; @@ -27,7 +27,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE; /** * @author pkupczyk */ -public class ListSampleByPermId implements IListObjectById<SamplePermId, SamplePE> +public class ListSampleByPermId extends AbstractListObjectById<SamplePermId, SamplePE> { private ISampleDAO sampleDAO; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/space/ListSpaceByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/space/ListSpaceByPermId.java index d4531e3edc3..3dc5e9fa57e 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/space/ListSpaceByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/space/ListSpaceByPermId.java @@ -19,7 +19,7 @@ package ch.ethz.sis.openbis.generic.server.api.v3.helper.space; import java.util.LinkedList; import java.util.List; -import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListObjectById; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.space.SpacePermId; import ch.systemsx.cisd.openbis.generic.server.dataaccess.ISpaceDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE; @@ -27,7 +27,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE; /** * @author pkupczyk */ -public class ListSpaceByPermId implements IListObjectById<SpacePermId, SpacePE> +public class ListSpaceByPermId extends AbstractListObjectById<SpacePermId, SpacePE> { private ISpaceDAO spaceDAO; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/vocabulary/ListVocabularyByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/vocabulary/ListVocabularyByPermId.java index 1e6960a543d..5e53b5887f0 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/vocabulary/ListVocabularyByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/vocabulary/ListVocabularyByPermId.java @@ -19,7 +19,7 @@ package ch.ethz.sis.openbis.generic.server.api.v3.helper.vocabulary; import java.util.LinkedList; import java.util.List; -import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListObjectById; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.vocabulary.VocabularyPermId; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IVocabularyDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyPE; @@ -27,7 +27,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyPE; /** * @author pkupczyk */ -public class ListVocabularyByPermId implements IListObjectById<VocabularyPermId, VocabularyPE> +public class ListVocabularyByPermId extends AbstractListObjectById<VocabularyPermId, VocabularyPE> { private IVocabularyDAO vocabularyDAO; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/vocabulary/ListVocabularyTermByCode.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/vocabulary/ListVocabularyTermByCode.java index d12aeac6d30..b2b419d6d1a 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/vocabulary/ListVocabularyTermByCode.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/helper/vocabulary/ListVocabularyTermByCode.java @@ -21,7 +21,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; -import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListObjectById; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.vocabulary.VocabularyTermCode; import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyPE; import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyTermPE; @@ -29,7 +29,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyTermPE; /** * @author pkupczyk */ -public class ListVocabularyTermByCode implements IListObjectById<VocabularyTermCode, VocabularyTermPE> +public class ListVocabularyTermByCode extends AbstractListObjectById<VocabularyTermCode, VocabularyTermPE> { private VocabularyPE vocabulary; diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/CreateDataSetTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/CreateDataSetTest.java index 23f2cc1ac82..9e3ae20eb45 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/CreateDataSetTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/CreateDataSetTest.java @@ -40,7 +40,8 @@ import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.CreationId; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.DataSetPermId; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.FileFormatTypePermId; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.IDataSetId; -import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.LocatorTypePermId; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.ProprietaryStorageFormatPermId; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.RelativeLocationLocatorTypePermId; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.datastore.DataStorePermId; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.datastore.IDataStoreId; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.entitytype.EntityTypePermId; @@ -49,13 +50,13 @@ import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.ExperimentIde import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.ExperimentPermId; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.IExperimentId; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.externaldms.ExternalDmsPermId; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.externaldms.IExternalDmsId; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.project.ProjectIdentifier; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.sample.ISampleId; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.sample.SampleIdentifier; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.sample.SamplePermId; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.space.SpacePermId; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.tag.TagCode; -import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.vocabulary.VocabularyTermCode; import ch.systemsx.cisd.common.action.IDelegatedAction; /** @@ -68,7 +69,7 @@ public class CreateDataSetTest extends AbstractDataSetTest public void testCreateWithCodeNull() { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation dataSet = dataSetCreation(); + final DataSetCreation dataSet = physicalDataSetCreation(); dataSet.setCode(null); assertUserFailureException(new IDelegatedAction() @@ -86,7 +87,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation dataSet = dataSetCreation(); + final DataSetCreation dataSet = physicalDataSetCreation(); dataSet.setCode("DATA_SET_WITH_EXISTING_CODE"); v3api.createDataSets(sessionToken, Arrays.asList(dataSet)); @@ -104,7 +105,7 @@ public class CreateDataSetTest extends AbstractDataSetTest public void testCreateWithCodeIncorrect() { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation dataSet = dataSetCreation(); + final DataSetCreation dataSet = physicalDataSetCreation(); dataSet.setCode("?!*"); assertUserFailureException(new IDelegatedAction() @@ -122,7 +123,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation dataSet = dataSetCreation(); + final DataSetCreation dataSet = physicalDataSetCreation(); dataSet.setTypeId(null); assertUserFailureException(new IDelegatedAction() @@ -141,7 +142,7 @@ public class CreateDataSetTest extends AbstractDataSetTest final String sessionToken = v3api.login(TEST_USER, PASSWORD); final IEntityTypeId typeId = new EntityTypePermId("IDONTEXIST"); - final DataSetCreation dataSet = dataSetCreation(); + final DataSetCreation dataSet = physicalDataSetCreation(); dataSet.setTypeId(typeId); assertObjectNotFoundException(new IDelegatedAction() @@ -159,7 +160,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setProperty("NONEXISTENT_PROPERTY_CODE", "any value"); assertUserFailureException(new IDelegatedAction() @@ -177,7 +178,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setTypeId(new EntityTypePermId("HCS_IMAGE")); creation.setProperty("GENDER", "NON_EXISTENT_GENDER"); @@ -196,7 +197,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setTypeId(new EntityTypePermId("HCS_IMAGE")); assertUserFailureException(new IDelegatedAction() @@ -214,7 +215,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setDataStoreId(null); assertUserFailureException(new IDelegatedAction() @@ -233,7 +234,7 @@ public class CreateDataSetTest extends AbstractDataSetTest final String sessionToken = v3api.login(TEST_USER, PASSWORD); final IDataStoreId dataStoreId = new DataStorePermId("IDONTEXIST"); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setDataStoreId(dataStoreId); assertObjectNotFoundException(new IDelegatedAction() @@ -251,7 +252,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setMeasured(true); DataSet dataSet = createDataSet(sessionToken, creation, new DataSetFetchOptions()); @@ -264,7 +265,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setMeasured(false); DataSet dataSet = createDataSet(sessionToken, creation, new DataSetFetchOptions()); @@ -277,7 +278,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.loginAs(TEST_USER, PASSWORD, TEST_SPACE_USER); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setExperimentId(new ExperimentIdentifier("/TEST-SPACE/TEST-PROJECT/EXP-SPACE-TEST")); creation.setTagIds(Arrays.asList(new TagCode("TEST_METAPROJECTS"))); @@ -294,7 +295,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.loginAs(TEST_USER, PASSWORD, TEST_SPACE_USER); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setExperimentId(new ExperimentIdentifier("/TEST-SPACE/TEST-PROJECT/EXP-SPACE-TEST")); creation.setTagIds(Arrays.asList(new TagCode("IDONTEXIST"))); @@ -311,7 +312,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setExperimentId(null); creation.setSampleId(null); @@ -330,7 +331,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setExperimentId(new ExperimentIdentifier("/CISD/NEMO/EXP1")); creation.setSampleId(null); @@ -349,7 +350,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setExperimentId(null); creation.setSampleId(new SampleIdentifier("/CISD/CP-TEST-1")); @@ -368,7 +369,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setTypeId(new EntityTypePermId("UNKNOWN")); creation.setExperimentId(null); creation.setSampleId(new SampleIdentifier("/CISD/3V-125")); @@ -388,7 +389,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setTypeId(new EntityTypePermId("REQUIRES_EXPERIMENT")); creation.setExperimentId(null); creation.setSampleId(new SampleIdentifier("/CISD/3V-125")); @@ -408,7 +409,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setTypeId(new EntityTypePermId("UNKNOWN")); creation.setExperimentId(new ExperimentIdentifier("/CISD/NEMO/EXP-TEST-1")); creation.setSampleId(new SampleIdentifier("/CISD/3V-125")); @@ -429,7 +430,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setTypeId(new EntityTypePermId("UNKNOWN")); creation.setExperimentId(new ExperimentIdentifier("/CISD/NEMO/EXP-TEST-1")); creation.setSampleId(new SampleIdentifier("/CISD/CP-TEST-1")); @@ -449,7 +450,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setTypeId(new EntityTypePermId("UNKNOWN")); creation.setExperimentId(new ExperimentIdentifier("/CISD/DEFAULT/EXP-REUSE")); creation.setSampleId(new SampleIdentifier("/CISD/CP-TEST-1")); @@ -475,7 +476,7 @@ public class CreateDataSetTest extends AbstractDataSetTest deletion.setReason("testing"); v3api.deleteExperiments(sessionToken, experimentIds, deletion); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setExperimentId(experimentIds.get(0)); creation.setSampleId(null); @@ -495,7 +496,7 @@ public class CreateDataSetTest extends AbstractDataSetTest final String sessionToken = v3api.loginAs(TEST_USER, PASSWORD, TEST_SPACE_USER); final IExperimentId experimentId = new ExperimentIdentifier("/CISD/NEMO/EXP1"); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setExperimentId(experimentId); creation.setSampleId(null); @@ -519,7 +520,7 @@ public class CreateDataSetTest extends AbstractDataSetTest deletion.setReason("testing"); v3api.deleteSamples(sessionToken, sampleIds, deletion); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setExperimentId(null); creation.setSampleId(sampleIds.get(0)); @@ -539,7 +540,7 @@ public class CreateDataSetTest extends AbstractDataSetTest final String sessionToken = v3api.loginAs(TEST_USER, PASSWORD, TEST_SPACE_USER); final ISampleId sampleId = new SampleIdentifier("/CISD/CP-TEST-1"); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setExperimentId(null); creation.setSampleId(sampleId); @@ -558,7 +559,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setExperimentId(null); creation.setSampleId(new SamplePermId("200811050947161-652")); @@ -577,7 +578,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { String sessionToken = v3api.login(TEST_USER, PASSWORD); - DataSetCreation creation = dataSetCreation(); + DataSetCreation creation = physicalDataSetCreation(); creation.setContainerIds(Collections.singletonList(new DataSetPermId("20081105092159111-1"))); DataSetFetchOptions fo = new DataSetFetchOptions(); @@ -594,9 +595,9 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation1 = dataSetCreation(); - final DataSetCreation creation2 = dataSetCreation(); - final DataSetCreation creation3 = dataSetCreation(); + final DataSetCreation creation1 = physicalDataSetCreation(); + final DataSetCreation creation2 = physicalDataSetCreation(); + final DataSetCreation creation3 = physicalDataSetCreation(); creation2.setContainerIds(Collections.singletonList(creation1.getCreationId())); creation3.setContainerIds(Collections.singletonList(creation2.getCreationId())); @@ -618,7 +619,7 @@ public class CreateDataSetTest extends AbstractDataSetTest final String sessionToken = v3api.loginAs(TEST_USER, PASSWORD, TEST_SPACE_USER); final IDataSetId containerId = new DataSetPermId("20081105092159111-1"); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setExperimentId(new ExperimentIdentifier("/TEST-SPACE/TEST-PROJECT/EXP-SPACE-TEST")); creation.setContainerIds(Collections.singletonList(containerId)); @@ -637,7 +638,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { String sessionToken = v3api.login(TEST_USER, PASSWORD); - DataSetCreation creation = dataSetCreation(); + DataSetCreation creation = physicalDataSetCreation(); creation.setContainedIds(Collections.singletonList(new DataSetPermId("20081105092159111-1"))); DataSetFetchOptions fo = new DataSetFetchOptions(); @@ -654,9 +655,9 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation1 = dataSetCreation(); - final DataSetCreation creation2 = dataSetCreation(); - final DataSetCreation creation3 = dataSetCreation(); + final DataSetCreation creation1 = physicalDataSetCreation(); + final DataSetCreation creation2 = physicalDataSetCreation(); + final DataSetCreation creation3 = physicalDataSetCreation(); creation2.setContainedIds(Collections.singletonList(creation1.getCreationId())); creation3.setContainedIds(Collections.singletonList(creation2.getCreationId())); @@ -678,7 +679,7 @@ public class CreateDataSetTest extends AbstractDataSetTest final String sessionToken = v3api.loginAs(TEST_USER, PASSWORD, TEST_SPACE_USER); final IDataSetId containedId = new DataSetPermId("20081105092159111-1"); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setExperimentId(new ExperimentIdentifier("/TEST-SPACE/TEST-PROJECT/EXP-SPACE-TEST")); creation.setContainedIds(Collections.singletonList(containedId)); @@ -697,7 +698,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { String sessionToken = v3api.login(TEST_USER, PASSWORD); - DataSetCreation creation = dataSetCreation(); + DataSetCreation creation = physicalDataSetCreation(); creation.setParentIds(Collections.singletonList(new DataSetPermId("20081105092159111-1"))); DataSetFetchOptions fo = new DataSetFetchOptions(); @@ -714,9 +715,9 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation1 = dataSetCreation(); - final DataSetCreation creation2 = dataSetCreation(); - final DataSetCreation creation3 = dataSetCreation(); + final DataSetCreation creation1 = physicalDataSetCreation(); + final DataSetCreation creation2 = physicalDataSetCreation(); + final DataSetCreation creation3 = physicalDataSetCreation(); creation2.setParentIds(Collections.singletonList(creation1.getCreationId())); creation3.setParentIds(Collections.singletonList(creation2.getCreationId())); @@ -738,7 +739,7 @@ public class CreateDataSetTest extends AbstractDataSetTest final String sessionToken = v3api.loginAs(TEST_USER, PASSWORD, TEST_SPACE_USER); final IDataSetId parentId = new DataSetPermId("20081105092159111-1"); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setExperimentId(new ExperimentIdentifier("/TEST-SPACE/TEST-PROJECT/EXP-SPACE-TEST")); creation.setParentIds(Collections.singletonList(parentId)); @@ -757,7 +758,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { String sessionToken = v3api.login(TEST_USER, PASSWORD); - DataSetCreation creation = dataSetCreation(); + DataSetCreation creation = physicalDataSetCreation(); creation.setChildIds(Collections.singletonList(new DataSetPermId("20081105092159111-1"))); DataSetFetchOptions fo = new DataSetFetchOptions(); @@ -774,9 +775,9 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation1 = dataSetCreation(); - final DataSetCreation creation2 = dataSetCreation(); - final DataSetCreation creation3 = dataSetCreation(); + final DataSetCreation creation1 = physicalDataSetCreation(); + final DataSetCreation creation2 = physicalDataSetCreation(); + final DataSetCreation creation3 = physicalDataSetCreation(); creation2.setChildIds(Collections.singletonList(creation1.getCreationId())); creation3.setChildIds(Collections.singletonList(creation2.getCreationId())); @@ -798,7 +799,7 @@ public class CreateDataSetTest extends AbstractDataSetTest final String sessionToken = v3api.loginAs(TEST_USER, PASSWORD, TEST_SPACE_USER); final IDataSetId childId = new DataSetPermId("20081105092159111-1"); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setExperimentId(new ExperimentIdentifier("/TEST-SPACE/TEST-PROJECT/EXP-SPACE-TEST")); creation.setChildIds(Collections.singletonList(childId)); @@ -822,7 +823,7 @@ public class CreateDataSetTest extends AbstractDataSetTest @Override public void execute() { - createDataSet(sessionToken, dataSetCreation(), new DataSetFetchOptions()); + createDataSet(sessionToken, physicalDataSetCreation(), new DataSetFetchOptions()); } }, "Data set creation can be only executed by a user with ETL_SERVER role."); } @@ -832,7 +833,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setExperimentId(new ExperimentIdentifier("/TEST-SPACE/TEST-PROJECT/EXP-SPACE-TEST")); DataSetFetchOptions fo = new DataSetFetchOptions(); @@ -852,7 +853,7 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.loginAs(TEST_USER, PASSWORD, TEST_SPACE_USER); - final DataSetCreation creation = dataSetCreation(); + final DataSetCreation creation = physicalDataSetCreation(); creation.setExperimentId(new ExperimentIdentifier("/TEST-SPACE/TEST-PROJECT/EXP-SPACE-TEST")); DataSetFetchOptions fo = new DataSetFetchOptions(); @@ -875,8 +876,8 @@ public class CreateDataSetTest extends AbstractDataSetTest PhysicalDataCreation physicalCreation = new PhysicalDataCreation(); physicalCreation.setLocation("a/b/c"); physicalCreation.setFileFormatTypeId(new FileFormatTypePermId("TIFF")); - physicalCreation.setLocatorTypeId(new LocatorTypePermId("RELATIVE_LOCATION")); - physicalCreation.setStorageFormatId(new VocabularyTermCode("PROPRIETARY")); + physicalCreation.setLocatorTypeId(new RelativeLocationLocatorTypePermId()); + physicalCreation.setStorageFormatId(new ProprietaryStorageFormatPermId()); DataSetCreation creation = new DataSetCreation(); creation.setCode("TEST_PHYSICAL_DATASET"); @@ -911,11 +912,8 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation = new DataSetCreation(); - creation.setCode("TEST_PHYSICAL_DATASET"); - creation.setTypeId(new EntityTypePermId("UNKNOWN")); - creation.setExperimentId(new ExperimentIdentifier("/CISD/NEMO/EXP1")); - creation.setDataStoreId(new DataStorePermId("STANDARD")); + final DataSetCreation creation = physicalDataSetCreation(); + creation.setPhysicalData(null); assertUserFailureException(new IDelegatedAction() { @@ -927,6 +925,169 @@ public class CreateDataSetTest extends AbstractDataSetTest }, "Physical data cannot be null for a physical data set."); } + @Test + public void testCreatePhysicalDataSetWithShareIdNull() + { + String sessionToken = v3api.login(TEST_USER, PASSWORD); + + DataSetCreation creation = physicalDataSetCreation(); + creation.getPhysicalData().setShareId(null); + + DataSetFetchOptions fo = new DataSetFetchOptions(); + fo.withPhysicalData(); + + DataSet dataSet = createDataSet(sessionToken, creation, fo); + + assertEquals(dataSet.getPhysicalData().getShareId(), null); + } + + @Test + public void testCreatePhysicalDataSetWithShareIdNotNull() + { + String sessionToken = v3api.login(TEST_USER, PASSWORD); + + DataSetCreation creation = physicalDataSetCreation(); + creation.getPhysicalData().setShareId("SOME_SHARE"); + + DataSetFetchOptions fo = new DataSetFetchOptions(); + fo.withPhysicalData(); + + DataSet dataSet = createDataSet(sessionToken, creation, fo); + + assertEquals(dataSet.getPhysicalData().getShareId(), "SOME_SHARE"); + } + + @Test + public void testCreatePhysicalDataSetWithLocationNull() + { + final String sessionToken = v3api.login(TEST_USER, PASSWORD); + + final DataSetCreation creation = physicalDataSetCreation(); + creation.getPhysicalData().setLocation(null); + + assertUserFailureException(new IDelegatedAction() + { + @Override + public void execute() + { + createDataSet(sessionToken, creation, new DataSetFetchOptions()); + } + }, "Location can not be null."); + } + + @Test + public void testCreatePhysicalDataSetWithLocationAbsolute() + { + final String sessionToken = v3api.login(TEST_USER, PASSWORD); + + final DataSetCreation creation = physicalDataSetCreation(); + creation.getPhysicalData().setLocation("/cannot_be_absolute_path/sorry"); + + assertUserFailureException(new IDelegatedAction() + { + @Override + public void execute() + { + createDataSet(sessionToken, creation, new DataSetFetchOptions()); + } + }, "Location is not relative"); + } + + @Test + public void testCreatePhysicalDataSetWithLocationRelative() + { + String sessionToken = v3api.login(TEST_USER, PASSWORD); + + DataSetCreation creation = physicalDataSetCreation(); + creation.getPhysicalData().setLocation("relative_path_should_be/fine"); + + DataSetFetchOptions fo = new DataSetFetchOptions(); + fo.withPhysicalData(); + + DataSet dataSet = createDataSet(sessionToken, creation, fo); + + assertEquals(dataSet.getPhysicalData().getLocation(), creation.getPhysicalData().getLocation()); + } + + @Test + public void testCreatePhysicalDataSetWithLocationExisting() + { + final String sessionToken = v3api.login(TEST_USER, PASSWORD); + + final String location = "duplicated_location/should_fail"; + + final DataSetCreation creation1 = physicalDataSetCreation(); + creation1.getPhysicalData().setLocation(location); + + final DataSetCreation creation2 = physicalDataSetCreation(); + creation2.getPhysicalData().setLocation(location); + + final DataSetFetchOptions fo = new DataSetFetchOptions(); + fo.withPhysicalData(); + + DataSet dataSet1 = createDataSet(sessionToken, creation1, fo); + assertEquals(dataSet1.getPhysicalData().getLocation(), creation1.getPhysicalData().getLocation()); + + assertUserFailureException(new IDelegatedAction() + { + @Override + public void execute() + { + createDataSet(sessionToken, creation2, fo); + } + }, "DataSet already exists in the database and needs to be unique."); + } + + @Test + public void testCreatePhysicalDataSetWithSizeNull() + { + String sessionToken = v3api.login(TEST_USER, PASSWORD); + + DataSetCreation creation = physicalDataSetCreation(); + creation.getPhysicalData().setSize(null); + + DataSetFetchOptions fo = new DataSetFetchOptions(); + fo.withPhysicalData(); + + DataSet dataSet = createDataSet(sessionToken, creation, fo); + + assertEquals(dataSet.getPhysicalData().getSize(), null); + } + + @Test + public void testCreatePhysicalDataSetWithSizeNotNull() + { + String sessionToken = v3api.login(TEST_USER, PASSWORD); + + DataSetCreation creation = physicalDataSetCreation(); + creation.getPhysicalData().setSize(12345L); + + DataSetFetchOptions fo = new DataSetFetchOptions(); + fo.withPhysicalData(); + + DataSet dataSet = createDataSet(sessionToken, creation, fo); + + assertEquals(dataSet.getPhysicalData().getSize(), Long.valueOf(12345)); + } + + @Test + public void testCreatePhysicalDataSetWithSizeNegative() + { + final String sessionToken = v3api.login(TEST_USER, PASSWORD); + + final DataSetCreation creation = physicalDataSetCreation(); + creation.getPhysicalData().setSize(-12345L); + + assertUserFailureException(new IDelegatedAction() + { + @Override + public void execute() + { + createDataSet(sessionToken, creation, new DataSetFetchOptions()); + } + }, "Physical data set size cannot be < 0."); + } + @Test public void testCreateContainerDataSet() { @@ -996,11 +1157,8 @@ public class CreateDataSetTest extends AbstractDataSetTest { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - final DataSetCreation creation = new DataSetCreation(); - creation.setCode("TEST_LINK_DATASET"); - creation.setTypeId(new EntityTypePermId("LINK_TYPE")); - creation.setExperimentId(new ExperimentIdentifier("/CISD/NEMO/EXP1")); - creation.setDataStoreId(new DataStorePermId("STANDARD")); + final DataSetCreation creation = linkDataSetCreation(); + creation.setLinkedData(null); assertUserFailureException(new IDelegatedAction() { @@ -1012,15 +1170,70 @@ public class CreateDataSetTest extends AbstractDataSetTest }, "Linked data cannot be null for a link data set."); } - private DataSetCreation dataSetCreation() + @Test + public void testCreateLinkDataSetWithExternalCodeNull() + { + final String sessionToken = v3api.login(TEST_USER, PASSWORD); + + final DataSetCreation creation = linkDataSetCreation(); + creation.getLinkedData().setExternalCode(null); + + assertUserFailureException(new IDelegatedAction() + { + @Override + public void execute() + { + createDataSet(sessionToken, creation, new DataSetFetchOptions()); + } + }, "External code can not be null."); + } + + @Test + public void testCreateLinkDataSetWithExternalDmsNonexistent() + { + final String sessionToken = v3api.login(TEST_USER, PASSWORD); + + final IExternalDmsId externalDmsId = new ExternalDmsPermId("IDONTEXIST"); + final DataSetCreation creation = linkDataSetCreation(); + creation.getLinkedData().setExternalDmsId(externalDmsId); + + assertObjectNotFoundException(new IDelegatedAction() + { + @Override + public void execute() + { + createDataSet(sessionToken, creation, new DataSetFetchOptions()); + } + }, externalDmsId); + } + + @Test + public void testCreateLinkDataSetWithExternalDmsNull() + { + final String sessionToken = v3api.login(TEST_USER, PASSWORD); + + final DataSetCreation creation = linkDataSetCreation(); + creation.getLinkedData().setExternalDmsId(null); + + assertUserFailureException(new IDelegatedAction() + { + @Override + public void execute() + { + createDataSet(sessionToken, creation, new DataSetFetchOptions()); + } + }, "External data management system id cannot be null for a link data set."); + } + + private DataSetCreation physicalDataSetCreation() { String code = UUID.randomUUID().toString(); PhysicalDataCreation physicalCreation = new PhysicalDataCreation(); physicalCreation.setLocation("test/location/" + code); physicalCreation.setFileFormatTypeId(new FileFormatTypePermId("TIFF")); - physicalCreation.setLocatorTypeId(new LocatorTypePermId("RELATIVE_LOCATION")); - physicalCreation.setStorageFormatId(new VocabularyTermCode("PROPRIETARY")); + physicalCreation.setLocatorTypeId(new RelativeLocationLocatorTypePermId()); + physicalCreation.setStorageFormatId(new ProprietaryStorageFormatPermId()); DataSetCreation creation = new DataSetCreation(); creation.setCode(code); @@ -1033,6 +1246,25 @@ public class CreateDataSetTest extends AbstractDataSetTest return creation; } + private DataSetCreation linkDataSetCreation() + { + String code = UUID.randomUUID().toString(); + + LinkedDataCreation linkedCreation = new LinkedDataCreation(); + linkedCreation.setExternalCode("TEST_EXTERNAL_CODE"); + linkedCreation.setExternalDmsId(new ExternalDmsPermId("DMS_1")); + + DataSetCreation creation = new DataSetCreation(); + creation.setCode(code); + creation.setTypeId(new EntityTypePermId("LINK_TYPE")); + creation.setExperimentId(new ExperimentIdentifier("/CISD/NEMO/EXP1")); + creation.setDataStoreId(new DataStorePermId("STANDARD")); + creation.setLinkedData(linkedCreation); + creation.setCreationId(new CreationId(code)); + + return creation; + } + private ExperimentCreation experimentCreation() { ExperimentCreation creation = new ExperimentCreation(); diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/PhysicalDataCreation.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/PhysicalDataCreation.java index b3149228dca..30e6c488288 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/PhysicalDataCreation.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/PhysicalDataCreation.java @@ -22,7 +22,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.IFileFormatTypeId; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.ILocatorTypeId; -import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.vocabulary.IVocabularyTermId; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.IStorageFormatId; import ch.systemsx.cisd.base.annotation.JsonObject; /** @@ -43,7 +43,7 @@ public class PhysicalDataCreation implements Serializable private Long size; @JsonProperty - private IVocabularyTermId storageFormatId; + private IStorageFormatId storageFormatId; @JsonProperty private IFileFormatTypeId fileFormatTypeId; @@ -87,12 +87,12 @@ public class PhysicalDataCreation implements Serializable this.size = size; } - public IVocabularyTermId getStorageFormatId() + public IStorageFormatId getStorageFormatId() { return storageFormatId; } - public void setStorageFormatId(IVocabularyTermId storageFormatId) + public void setStorageFormatId(IStorageFormatId storageFormatId) { this.storageFormatId = storageFormatId; } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/BdsDirectoryStorageFormatPermId.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/BdsDirectoryStorageFormatPermId.java new file mode 100644 index 00000000000..4d8f435db50 --- /dev/null +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/BdsDirectoryStorageFormatPermId.java @@ -0,0 +1,37 @@ +/* + * Copyright 2013 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.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset; + +import ch.systemsx.cisd.base.annotation.JsonObject; + +/** + * Bds directory storage format perm id. + * + * @author pkupczyk + */ +@JsonObject("dto.id.dataset.BdsDirectoryStorageFormatPermId") +public class BdsDirectoryStorageFormatPermId extends StorageFormatPermId +{ + + private static final long serialVersionUID = 1L; + + public BdsDirectoryStorageFormatPermId() + { + super("BDS_DIRECTORY"); + } + +} diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/IStorageFormatId.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/IStorageFormatId.java new file mode 100644 index 00000000000..c493e67dbde --- /dev/null +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/IStorageFormatId.java @@ -0,0 +1,31 @@ +/* + * Copyright 2013 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.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset; + +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.IObjectId; +import ch.systemsx.cisd.base.annotation.JsonObject; + +/** + * Holds information that uniquely identifies a storage format in openBIS. + * + * @author pkupczyk + */ +@JsonObject("dto.id.dataset.IStorageFormatId") +public interface IStorageFormatId extends IObjectId +{ + +} diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/LocatorTypePermId.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/LocatorTypePermId.java index 345fcc2a13e..3b2c334cd4d 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/LocatorTypePermId.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/LocatorTypePermId.java @@ -48,4 +48,33 @@ public class LocatorTypePermId extends ObjectPermId implements ILocatorTypeId super(); } + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (obj == null) + { + return false; + } + if (false == (obj instanceof LocatorTypePermId)) + { + return false; + } + LocatorTypePermId other = (LocatorTypePermId) obj; + if (getPermId() == null) + { + if (other.getPermId() != null) + { + return false; + } + } else if (!getPermId().equals(other.getPermId())) + { + return false; + } + return true; + } + } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/ProprietaryStorageFormatPermId.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/ProprietaryStorageFormatPermId.java new file mode 100644 index 00000000000..9ff0b789cc0 --- /dev/null +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/ProprietaryStorageFormatPermId.java @@ -0,0 +1,37 @@ +/* + * Copyright 2013 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.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset; + +import ch.systemsx.cisd.base.annotation.JsonObject; + +/** + * Proprietary storage format perm id. + * + * @author pkupczyk + */ +@JsonObject("dto.id.dataset.ProprietaryStorageFormatPermId") +public class ProprietaryStorageFormatPermId extends StorageFormatPermId +{ + + private static final long serialVersionUID = 1L; + + public ProprietaryStorageFormatPermId() + { + super("PROPRIETARY"); + } + +} diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/RelativeLocationLocatorTypePermId.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/RelativeLocationLocatorTypePermId.java new file mode 100644 index 00000000000..5181c0d6ee4 --- /dev/null +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/RelativeLocationLocatorTypePermId.java @@ -0,0 +1,37 @@ +/* + * Copyright 2013 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.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset; + +import ch.systemsx.cisd.base.annotation.JsonObject; + +/** + * Relative location perm id. + * + * @author pkupczyk + */ +@JsonObject("dto.id.dataset.RelativeLocationLocatorTypePermId") +public class RelativeLocationLocatorTypePermId extends LocatorTypePermId +{ + + private static final long serialVersionUID = 1L; + + public RelativeLocationLocatorTypePermId() + { + super("RELATIVE_LOCATION"); + } + +} diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/StorageFormatPermId.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/StorageFormatPermId.java new file mode 100644 index 00000000000..d806f2baafb --- /dev/null +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/dataset/StorageFormatPermId.java @@ -0,0 +1,80 @@ +/* + * Copyright 2013 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.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset; + +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.ObjectPermId; +import ch.systemsx.cisd.base.annotation.JsonObject; + +/** + * Storage format perm id. + * + * @author pkupczyk + */ +@JsonObject("dto.id.dataset.StorageFormatPermId") +public class StorageFormatPermId extends ObjectPermId implements IStorageFormatId +{ + + private static final long serialVersionUID = 1L; + + /** + * @param permId Storage format perm id, e.g. "PROPRIETARY". + */ + public StorageFormatPermId(String permId) + { + super(permId); + } + + // + // JSON-RPC + // + + @SuppressWarnings("unused") + private StorageFormatPermId() + { + super(); + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (obj == null) + { + return false; + } + if (false == (obj instanceof StorageFormatPermId)) + { + return false; + } + StorageFormatPermId other = (StorageFormatPermId) obj; + if (getPermId() == null) + { + if (other.getPermId() != null) + { + return false; + } + } else if (!getPermId().equals(other.getPermId())) + { + return false; + } + return true; + } + +} -- GitLab