From 0cb087e3f9b2289a1215d70c9478e3a8579b6970 Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Thu, 25 Feb 2016 10:29:26 +0000 Subject: [PATCH] SSDM-3220: Shortcuts for identifiers of component sample no longer supported in public V3 API. But they are still supported for ServiceForDataStoreServer.performEntityOpertations(). System tests adapted and new tests added. SVN: 35733 --- .../common/AbstractMapObjectByIdExecutor.java | 2 +- .../entity/MapEntityTypeByIdExecutor.java | 2 +- .../material/ListMaterialsTechIdByPermId.java | 3 +- .../ListProjectTechIdByIdentifier.java | 3 +- .../sample/ListSampleTechIdByIdentifier.java | 31 +++++++++++++------ .../MapVocabularyTermByIdExecutor.java | 2 +- .../helper/common/AbstractListTechIdById.java | 8 +++-- .../common/AbstractListTechIdByPermId.java | 3 +- .../v3/helper/common/IListObjectById.java | 4 ++- .../asapi/v3/helper/common/MapObjectById.java | 11 ++++--- .../helper/dataset/ListDataSetByPermId.java | 3 +- .../dataset/ListFileFormatTypeByPermId.java | 3 +- .../dataset/ListLocatorTypeByPermId.java | 3 +- .../datastore/ListDataStoreByPermId.java | 3 +- .../helper/deletion/ListDeletionByTechId.java | 3 +- .../helper/entity/ListEntityTypeByPermId.java | 3 +- .../ListExperimentByIdentifier.java | 3 +- .../experiment/ListExperimentByPermId.java | 3 +- .../externaldms/ListExternalDmsByPermId.java | 3 +- .../material/ListMaterialsByPermId.java | 3 +- .../v3/helper/person/ListPersonByPermId.java | 3 +- .../project/ListProjectByIdentifier.java | 3 +- .../helper/project/ListProjectByPermId.java | 3 +- .../helper/sample/ListSampleByIdentifier.java | 5 +-- .../v3/helper/sample/ListSampleByPermId.java | 3 +- .../v3/helper/space/ListSpaceByPermId.java | 3 +- .../vocabulary/ListVocabularyByPermId.java | 3 +- .../vocabulary/ListVocabularyTermByCode.java | 3 +- .../server/ServiceForDataStoreServer.java | 2 ++ .../systemtest/asapi/v3/MapSampleTest.java | 19 ++---------- .../systemtest/EntityOperationTest.java | 27 +++++++++++++++- 31 files changed, 113 insertions(+), 60 deletions(-) diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/common/AbstractMapObjectByIdExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/common/AbstractMapObjectByIdExecutor.java index 21a154deea6..00d139d47b0 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/common/AbstractMapObjectByIdExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/common/AbstractMapObjectByIdExecutor.java @@ -47,7 +47,7 @@ public abstract class AbstractMapObjectByIdExecutor<ID extends IObjectId, OBJECT List<IListObjectById<? extends ID, OBJECT>> listers = new ArrayList<IListObjectById<? extends ID, OBJECT>>(); addListers(context, listers); - return new MapObjectById<ID, OBJECT>().map(listers, ids); + return new MapObjectById<ID, OBJECT>().map(context, listers, ids); } protected abstract void addListers(IOperationContext context, List<IListObjectById<? extends ID, OBJECT>> listers); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/MapEntityTypeByIdExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/MapEntityTypeByIdExecutor.java index a8af9f7be68..44c50f5052e 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/MapEntityTypeByIdExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/MapEntityTypeByIdExecutor.java @@ -60,7 +60,7 @@ public class MapEntityTypeByIdExecutor implements IMapEntityTypeByIdExecutor new LinkedList<IListObjectById<? extends IEntityTypeId, EntityTypePE>>(); listers.add(new ListEntityTypeByPermId(daoFactory, entityKind)); - return new MapObjectById<IEntityTypeId, EntityTypePE>().map(listers, entityTypeIds); + return new MapObjectById<IEntityTypeId, EntityTypePE>().map(context, listers, entityTypeIds); } } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/material/ListMaterialsTechIdByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/material/ListMaterialsTechIdByPermId.java index 5a7a51e1b68..ea1e90a62f3 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/material/ListMaterialsTechIdByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/material/ListMaterialsTechIdByPermId.java @@ -25,6 +25,7 @@ import java.util.Set; import net.lemnik.eodsql.QueryTool; import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.id.MaterialPermId; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.common.TechIdStringIdentifierRecord; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListTechIdById; import ch.systemsx.cisd.openbis.generic.shared.basic.CodeConverter; @@ -44,7 +45,7 @@ public class ListMaterialsTechIdByPermId extends AbstractListTechIdById<Materia } @Override - protected Map<Long, MaterialPermId> createIdsByTechIdsMap(List<MaterialPermId> ids) + protected Map<Long, MaterialPermId> createIdsByTechIdsMap(IOperationContext context, List<MaterialPermId> ids) { Map<String, Map<String, MaterialPermId>> groupedIdentifiers = new HashMap<>(); for (MaterialPermId permId : ids) diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/project/ListProjectTechIdByIdentifier.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/project/ListProjectTechIdByIdentifier.java index dc8795b3aba..32d3887cbcf 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/project/ListProjectTechIdByIdentifier.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/project/ListProjectTechIdByIdentifier.java @@ -25,6 +25,7 @@ import java.util.Set; import net.lemnik.eodsql.QueryTool; import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.id.ProjectIdentifier; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.common.TechIdStringIdentifierRecord; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListTechIdById; import ch.systemsx.cisd.openbis.generic.shared.basic.CodeConverter; @@ -45,7 +46,7 @@ public class ListProjectTechIdByIdentifier extends AbstractListTechIdById<Projec } @Override - protected Map<Long, ProjectIdentifier> createIdsByTechIdsMap(List<ProjectIdentifier> ids) + protected Map<Long, ProjectIdentifier> createIdsByTechIdsMap(IOperationContext context, List<ProjectIdentifier> ids) { Map<String, Map<String, ProjectIdentifier>> groupedIdentifiers = new HashMap<>(); for (ProjectIdentifier projectIdentifier : ids) diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/sample/ListSampleTechIdByIdentifier.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/sample/ListSampleTechIdByIdentifier.java index 80a1bf0c78f..98354b02c6c 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/sample/ListSampleTechIdByIdentifier.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/sample/ListSampleTechIdByIdentifier.java @@ -29,6 +29,7 @@ import java.util.Set; import net.lemnik.eodsql.QueryTool; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.id.SampleIdentifier; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.common.TechIdStringIdentifierRecord; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListTechIdById; import ch.systemsx.cisd.base.exceptions.CheckedExceptionTunnel; @@ -38,6 +39,8 @@ import ch.systemsx.cisd.base.exceptions.CheckedExceptionTunnel; */ public class ListSampleTechIdByIdentifier extends AbstractListTechIdById<SampleIdentifier> { + public static final String CONTAINER_SHORTCUT_ALLOWED_ATTRIBUTE = "container-shortcut-allowed"; + private String homeSpaceCodeOrNull; public ListSampleTechIdByIdentifier(String homeSpaceCodeOrNull) @@ -52,17 +55,17 @@ public class ListSampleTechIdByIdentifier extends AbstractListTechIdById<SampleI } @Override - protected Map<Long, SampleIdentifier> createIdsByTechIdsMap(List<SampleIdentifier> ids) + protected Map<Long, SampleIdentifier> createIdsByTechIdsMap(IOperationContext context, List<SampleIdentifier> ids) { Map<SampleIdentifierParts, Map<String, SampleIdentifier>> groupedIdentifiers = groupIdentifiers(ids); - + boolean containerShortcutAllowed = getContainerShortcutAllowed(context); Map<Long, SampleIdentifier> result = new HashMap<>(); SampleQuery query = QueryTool.getManagedQuery(SampleQuery.class); for (Entry<SampleIdentifierParts, Map<String, SampleIdentifier>> entry : groupedIdentifiers.entrySet()) { SampleIdentifierParts key = entry.getKey(); Map<String, SampleIdentifier> identifiersByCode = entry.getValue(); - List<TechIdStringIdentifierRecord> records = list(query, key, identifiersByCode.keySet()); + List<TechIdStringIdentifierRecord> records = list(query, key, identifiersByCode.keySet(), containerShortcutAllowed); for (TechIdStringIdentifierRecord record : records) { String sampleCode = record.identifier; @@ -71,6 +74,12 @@ public class ListSampleTechIdByIdentifier extends AbstractListTechIdById<SampleI } return result; } + + private boolean getContainerShortcutAllowed(IOperationContext context) + { + Object value = context.getAttribute(CONTAINER_SHORTCUT_ALLOWED_ATTRIBUTE); + return Boolean.TRUE.equals(value); + } private Map<SampleIdentifierParts, Map<String, SampleIdentifier>> groupIdentifiers(List<SampleIdentifier> ids) { @@ -92,7 +101,8 @@ public class ListSampleTechIdByIdentifier extends AbstractListTechIdById<SampleI return groupedIdentifiers; } - private List<TechIdStringIdentifierRecord> list(final SampleQuery query, final SampleIdentifierParts key, final Collection<String> codes) + private List<TechIdStringIdentifierRecord> list(final SampleQuery query, final SampleIdentifierParts key, + final Collection<String> codes, boolean containerShortcutAllowed) { final String[] codesArray = codes.toArray(new String[codes.size()]); final String spaceCode = key.getSpaceCodeOrNull(); @@ -117,7 +127,7 @@ public class ListSampleTechIdByIdentifier extends AbstractListTechIdById<SampleI { return query.listSharedSampleTechIdsByCodesWithSomeContainer(codesToList); } - }); + }, containerShortcutAllowed); } return query.listSharedSampleTechIdsByContainerCodeAndCodes(containerCode, codesArray); } @@ -139,7 +149,7 @@ public class ListSampleTechIdByIdentifier extends AbstractListTechIdById<SampleI { return query.listSpaceSampleTechIdsByCodesWithSomeContainer(spaceCode, codesToList); } - }); + }, containerShortcutAllowed); } return query.listSpaceSampleTechIdsByContainerCodeAndCodes(spaceCode, containerCode, codesArray); } @@ -159,13 +169,14 @@ public class ListSampleTechIdByIdentifier extends AbstractListTechIdById<SampleI { return query.listProjectSampleTechIdsByCodesWithSomeContainer(spaceCode, projectCode, codesToList); } - }); + }, containerShortcutAllowed); } return query.listProjectSampleTechIdsByContainerCodeAndCodes(spaceCode, projectCode, containerCode, codesArray); } - private List<TechIdStringIdentifierRecord> listWithoutContainerOrWithSomeContainerAndUniqueCode(SampleQuery query, String[] codes, - IListAction listWithoutContainer, IListAction listWithSomeContainer) + private List<TechIdStringIdentifierRecord> listWithoutContainerOrWithSomeContainerAndUniqueCode(SampleQuery query, + String[] codes, IListAction listWithoutContainer, IListAction listWithSomeContainer, + boolean containerShortcutAllowed) { try { @@ -177,7 +188,7 @@ public class ListSampleTechIdByIdentifier extends AbstractListTechIdById<SampleI codesNotFound.remove(found.identifier); } - if (codesNotFound.isEmpty()) + if (codesNotFound.isEmpty() || containerShortcutAllowed == false) { return foundWithoutContainer; } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/vocabulary/MapVocabularyTermByIdExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/vocabulary/MapVocabularyTermByIdExecutor.java index 54d5548ca20..00dc7fe5292 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/vocabulary/MapVocabularyTermByIdExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/vocabulary/MapVocabularyTermByIdExecutor.java @@ -65,7 +65,7 @@ public class MapVocabularyTermByIdExecutor implements IMapVocabularyTermByIdExec listers.add(new ListVocabularyTermByCode(vocabulary)); } - return new MapObjectById<IVocabularyTermId, VocabularyTermPE>().map(listers, vocabularyTermIds); + return new MapObjectById<IVocabularyTermId, VocabularyTermPE>().map(context, listers, vocabularyTermIds); } } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/common/AbstractListTechIdById.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/common/AbstractListTechIdById.java index b152e1db460..5a2c2936f62 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/common/AbstractListTechIdById.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/common/AbstractListTechIdById.java @@ -21,6 +21,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; + /** * @author Franz-Josef Elmer */ @@ -35,12 +37,12 @@ public abstract class AbstractListTechIdById<ID> extends AbstractListObjectById< } @Override - public List<Long> listByIds(List<ID> ids) + public List<Long> listByIds(IOperationContext context, List<ID> ids) { - idsByTechIds = createIdsByTechIdsMap(ids); + idsByTechIds = createIdsByTechIdsMap(context, ids); return new ArrayList<>(idsByTechIds.keySet()); } - protected abstract Map<Long, ID> createIdsByTechIdsMap(List<ID> ids); + protected abstract Map<Long, ID> createIdsByTechIdsMap(IOperationContext context, List<ID> ids); } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/common/AbstractListTechIdByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/common/AbstractListTechIdByPermId.java index 1fa3b481824..c321c3b13f8 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/common/AbstractListTechIdByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/common/AbstractListTechIdByPermId.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Map; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.id.ObjectPermId; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.common.TechIdStringIdentifierRecord; /** @@ -33,7 +34,7 @@ public abstract class AbstractListTechIdByPermId<ID extends ObjectPermId> extend { @Override - protected Map<Long, ID> createIdsByTechIdsMap(List<ID> ids) + protected Map<Long, ID> createIdsByTechIdsMap(IOperationContext context, List<ID> ids) { List<String> permIds = new ArrayList<>(ids.size()); for (ID permId : ids) diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/common/IListObjectById.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/common/IListObjectById.java index 61922774a55..e5a673e101e 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/common/IListObjectById.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/common/IListObjectById.java @@ -18,6 +18,8 @@ package ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common; import java.util.List; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; + /** * @author pkupczyk */ @@ -28,6 +30,6 @@ public interface IListObjectById<ID, OBJECT> public ID createId(OBJECT entity); - public List<OBJECT> listByIds(List<ID> ids); + public List<OBJECT> listByIds(IOperationContext context, List<ID> ids); } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/common/MapObjectById.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/common/MapObjectById.java index bcbe306e285..11bf245bcd8 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/common/MapObjectById.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/common/MapObjectById.java @@ -25,6 +25,7 @@ import java.util.Map; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.id.IObjectId; import ch.ethz.sis.openbis.generic.asapi.v3.exceptions.UnsupportedObjectIdException; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; /** * @author pkupczyk @@ -58,7 +59,8 @@ public class MapObjectById<ID, OBJECT> return idClassToIdListMap; } - private Map mapByIds(List<IListObjectById<? extends ID, OBJECT>> listers, Map<Class, List> idClassToIdListMap) + private Map mapByIds(IOperationContext context, List<IListObjectById<? extends ID, OBJECT>> listers, + Map<Class, List> idClassToIdListMap) { final Map idToObject = new HashMap(); @@ -66,7 +68,7 @@ public class MapObjectById<ID, OBJECT> { List idList = idClassToIdListMap.get(idClass); IListObjectById listerForIdClass = findLister(listers, idClass, idList); - List objects = listerForIdClass.listByIds(idList); + List objects = listerForIdClass.listByIds(context, idList); if (objects != null) { for (Object object : objects) @@ -92,10 +94,11 @@ public class MapObjectById<ID, OBJECT> throw new UnsupportedObjectIdException((IObjectId) idList.iterator().next()); } - public Map<ID, OBJECT> map(List<IListObjectById<? extends ID, OBJECT>> listers, Collection<? extends ID> ids) + public Map<ID, OBJECT> map(IOperationContext context, List<IListObjectById<? extends ID, OBJECT>> listers, + Collection<? extends ID> ids) { Map<Class, List> idClassToIdListMap = groupIdsByClass(ids); - Map idToObjectMap = mapByIds(listers, idClassToIdListMap); + Map idToObjectMap = mapByIds(context, listers, idClassToIdListMap); Map orderedMap = new LinkedHashMap(); for (ID id : ids) diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/dataset/ListDataSetByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/dataset/ListDataSetByPermId.java index 216d763096e..0becc8a6ee1 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/dataset/ListDataSetByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/dataset/ListDataSetByPermId.java @@ -21,6 +21,7 @@ import java.util.List; import java.util.Set; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.id.DataSetPermId; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListObjectById; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDataDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; @@ -51,7 +52,7 @@ public class ListDataSetByPermId extends AbstractListObjectById<DataSetPermId, D } @Override - public List<DataPE> listByIds(List<DataSetPermId> ids) + public List<DataPE> listByIds(IOperationContext context, List<DataSetPermId> ids) { Set<String> codes = new HashSet<String>(); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/dataset/ListFileFormatTypeByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/dataset/ListFileFormatTypeByPermId.java index 0ecc4b5a3ae..320246e5fb4 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/dataset/ListFileFormatTypeByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/dataset/ListFileFormatTypeByPermId.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.List; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.id.FileFormatTypePermId; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListObjectById; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IFileFormatTypeDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.FileFormatTypePE; @@ -50,7 +51,7 @@ public class ListFileFormatTypeByPermId extends AbstractListObjectById<FileForma } @Override - public List<FileFormatTypePE> listByIds(List<FileFormatTypePermId> ids) + public List<FileFormatTypePE> listByIds(IOperationContext context, List<FileFormatTypePermId> ids) { List<FileFormatTypePE> types = new ArrayList<FileFormatTypePE>(); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/dataset/ListLocatorTypeByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/dataset/ListLocatorTypeByPermId.java index 0a6551bed98..1c923786f48 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/dataset/ListLocatorTypeByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/dataset/ListLocatorTypeByPermId.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.List; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.id.LocatorTypePermId; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListObjectById; import ch.systemsx.cisd.openbis.generic.server.dataaccess.ILocatorTypeDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.LocatorTypePE; @@ -50,7 +51,7 @@ public class ListLocatorTypeByPermId extends AbstractListObjectById<LocatorTypeP } @Override - public List<LocatorTypePE> listByIds(List<LocatorTypePermId> ids) + public List<LocatorTypePE> listByIds(IOperationContext context, List<LocatorTypePermId> ids) { List<LocatorTypePE> types = new ArrayList<LocatorTypePE>(); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/datastore/ListDataStoreByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/datastore/ListDataStoreByPermId.java index 78857b1cf28..5421c9b0752 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/datastore/ListDataStoreByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/datastore/ListDataStoreByPermId.java @@ -20,6 +20,7 @@ import java.util.LinkedList; import java.util.List; import ch.ethz.sis.openbis.generic.asapi.v3.dto.datastore.id.DataStorePermId; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListObjectById; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDataStoreDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.DataStorePE; @@ -50,7 +51,7 @@ public class ListDataStoreByPermId extends AbstractListObjectById<DataStorePermI } @Override - public List<DataStorePE> listByIds(List<DataStorePermId> ids) + public List<DataStorePE> listByIds(IOperationContext context, List<DataStorePermId> ids) { List<DataStorePE> dataStores = new LinkedList<DataStorePE>(); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/deletion/ListDeletionByTechId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/deletion/ListDeletionByTechId.java index 9d857ebe454..631a96ebd30 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/deletion/ListDeletionByTechId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/deletion/ListDeletionByTechId.java @@ -20,6 +20,7 @@ import java.util.LinkedList; import java.util.List; import ch.ethz.sis.openbis.generic.asapi.v3.dto.deletion.id.DeletionTechId; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListObjectById; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDeletionDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.DeletionPE; @@ -50,7 +51,7 @@ public class ListDeletionByTechId extends AbstractListObjectById<DeletionTechId, } @Override - public List<DeletionPE> listByIds(List<DeletionTechId> ids) + public List<DeletionPE> listByIds(IOperationContext context, List<DeletionTechId> ids) { List<Long> techIds = new LinkedList<Long>(); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/entity/ListEntityTypeByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/entity/ListEntityTypeByPermId.java index a9d57fe91f1..79ace0f121e 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/entity/ListEntityTypeByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/entity/ListEntityTypeByPermId.java @@ -20,6 +20,7 @@ import java.util.LinkedList; import java.util.List; import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListObjectById; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IEntityTypeDAO; @@ -52,7 +53,7 @@ public class ListEntityTypeByPermId extends AbstractListObjectById<EntityTypePer } @Override - public List<EntityTypePE> listByIds(List<EntityTypePermId> ids) + public List<EntityTypePE> listByIds(IOperationContext context, List<EntityTypePermId> ids) { List<String> permIds = new LinkedList<String>(); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/experiment/ListExperimentByIdentifier.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/experiment/ListExperimentByIdentifier.java index 5d994816116..973734860d3 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/experiment/ListExperimentByIdentifier.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/experiment/ListExperimentByIdentifier.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Map; import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.id.ExperimentIdentifier; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListObjectById; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IExperimentDAO; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IProjectDAO; @@ -59,7 +60,7 @@ public class ListExperimentByIdentifier extends AbstractListObjectById<Experimen } @Override - public List<ExperimentPE> listByIds(List<ExperimentIdentifier> experimentIdentifiers) + public List<ExperimentPE> listByIds(IOperationContext context, List<ExperimentIdentifier> experimentIdentifiers) { List<ExperimentPE> experiments = new LinkedList<ExperimentPE>(); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/experiment/ListExperimentByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/experiment/ListExperimentByPermId.java index 3992c90e9b5..e3a685bbce6 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/experiment/ListExperimentByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/experiment/ListExperimentByPermId.java @@ -20,6 +20,7 @@ import java.util.LinkedList; import java.util.List; import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.id.ExperimentPermId; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListObjectById; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IExperimentDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE; @@ -50,7 +51,7 @@ public class ListExperimentByPermId extends AbstractListObjectById<ExperimentPer } @Override - public List<ExperimentPE> listByIds(List<ExperimentPermId> ids) + public List<ExperimentPE> listByIds(IOperationContext context, List<ExperimentPermId> ids) { List<String> permIds = new LinkedList<String>(); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/externaldms/ListExternalDmsByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/externaldms/ListExternalDmsByPermId.java index 5c70e72ad7f..98ba7a0c28a 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/externaldms/ListExternalDmsByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/externaldms/ListExternalDmsByPermId.java @@ -20,6 +20,7 @@ import java.util.LinkedList; import java.util.List; import ch.ethz.sis.openbis.generic.asapi.v3.dto.externaldms.id.ExternalDmsPermId; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListObjectById; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IExternalDataManagementSystemDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.ExternalDataManagementSystemPE; @@ -50,7 +51,7 @@ public class ListExternalDmsByPermId extends AbstractListObjectById<ExternalDmsP } @Override - public List<ExternalDataManagementSystemPE> listByIds(List<ExternalDmsPermId> ids) + public List<ExternalDataManagementSystemPE> listByIds(IOperationContext context, List<ExternalDmsPermId> ids) { List<ExternalDataManagementSystemPE> externalDmses = new LinkedList<ExternalDataManagementSystemPE>(); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/material/ListMaterialsByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/material/ListMaterialsByPermId.java index 013ee50afcf..e93232fd35f 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/material/ListMaterialsByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/material/ListMaterialsByPermId.java @@ -21,6 +21,7 @@ import java.util.List; import java.util.Set; import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.id.MaterialPermId; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListObjectById; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IMaterialDAO; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialIdentifier; @@ -52,7 +53,7 @@ public class ListMaterialsByPermId extends AbstractListObjectById<MaterialPermId } @Override - public List<MaterialPE> listByIds(List<MaterialPermId> ids) + public List<MaterialPE> listByIds(IOperationContext context, List<MaterialPermId> ids) { System.out.println("list by ids: " + ids); Set<MaterialIdentifier> codes = new HashSet<MaterialIdentifier>(); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/person/ListPersonByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/person/ListPersonByPermId.java index 777771de664..9a665e4ca4f 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/person/ListPersonByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/person/ListPersonByPermId.java @@ -20,6 +20,7 @@ import java.util.LinkedList; import java.util.List; import ch.ethz.sis.openbis.generic.asapi.v3.dto.person.id.PersonPermId; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListObjectById; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IPersonDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; @@ -50,7 +51,7 @@ public class ListPersonByPermId extends AbstractListObjectById<PersonPermId, Per } @Override - public List<PersonPE> listByIds(List<PersonPermId> ids) + public List<PersonPE> listByIds(IOperationContext context, List<PersonPermId> ids) { List<String> userIds = new LinkedList<String>(); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/project/ListProjectByIdentifier.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/project/ListProjectByIdentifier.java index 52c2cf6b05a..5465ecd087c 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/project/ListProjectByIdentifier.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/project/ListProjectByIdentifier.java @@ -20,6 +20,7 @@ import java.util.LinkedList; import java.util.List; import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.id.ProjectIdentifier; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListObjectById; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IProjectDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectPE; @@ -51,7 +52,7 @@ public class ListProjectByIdentifier extends AbstractListObjectById<ProjectIdent } @Override - public List<ProjectPE> listByIds(List<ProjectIdentifier> ids) + public List<ProjectPE> listByIds(IOperationContext context, List<ProjectIdentifier> ids) { List<ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ProjectIdentifier> identifiers = new LinkedList<ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ProjectIdentifier>(); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/project/ListProjectByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/project/ListProjectByPermId.java index 4fd0ab3ba55..accd740aa19 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/project/ListProjectByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/project/ListProjectByPermId.java @@ -20,6 +20,7 @@ import java.util.LinkedList; import java.util.List; import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.id.ProjectPermId; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListObjectById; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IProjectDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectPE; @@ -50,7 +51,7 @@ public class ListProjectByPermId extends AbstractListObjectById<ProjectPermId, P } @Override - public List<ProjectPE> listByIds(List<ProjectPermId> ids) + public List<ProjectPE> listByIds(IOperationContext context, List<ProjectPermId> ids) { List<String> permIds = new LinkedList<String>(); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/sample/ListSampleByIdentifier.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/sample/ListSampleByIdentifier.java index ab52d96e9e8..245e7fd19af 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/sample/ListSampleByIdentifier.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/sample/ListSampleByIdentifier.java @@ -19,6 +19,7 @@ package ch.ethz.sis.openbis.generic.server.asapi.v3.helper.sample; import java.util.List; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.id.SampleIdentifier; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.sample.ListSampleTechIdByIdentifier; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListObjectById; import ch.systemsx.cisd.openbis.generic.server.dataaccess.ISampleDAO; @@ -56,9 +57,9 @@ public class ListSampleByIdentifier extends AbstractListObjectById<SampleIdentif } @Override - public List<SamplePE> listByIds(List<SampleIdentifier> ids) + public List<SamplePE> listByIds(IOperationContext context, List<SampleIdentifier> ids) { - return sampleDAO.listByIDs(techIdByIdentifier.listByIds(ids)); + return sampleDAO.listByIDs(techIdByIdentifier.listByIds(context, ids)); } } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/sample/ListSampleByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/sample/ListSampleByPermId.java index 4be5d890df7..2ae5d506cf6 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/sample/ListSampleByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/sample/ListSampleByPermId.java @@ -20,6 +20,7 @@ import java.util.LinkedList; import java.util.List; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.id.SamplePermId; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListObjectById; import ch.systemsx.cisd.openbis.generic.server.dataaccess.ISampleDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE; @@ -50,7 +51,7 @@ public class ListSampleByPermId extends AbstractListObjectById<SamplePermId, Sam } @Override - public List<SamplePE> listByIds(List<SamplePermId> ids) + public List<SamplePE> listByIds(IOperationContext context, List<SamplePermId> ids) { List<String> permIds = new LinkedList<String>(); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/space/ListSpaceByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/space/ListSpaceByPermId.java index 1a8f3caf309..62e2d7b0602 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/space/ListSpaceByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/space/ListSpaceByPermId.java @@ -20,6 +20,7 @@ import java.util.LinkedList; import java.util.List; import ch.ethz.sis.openbis.generic.asapi.v3.dto.space.id.SpacePermId; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListObjectById; import ch.systemsx.cisd.openbis.generic.server.dataaccess.ISpaceDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE; @@ -50,7 +51,7 @@ public class ListSpaceByPermId extends AbstractListObjectById<SpacePermId, Space } @Override - public List<SpacePE> listByIds(List<SpacePermId> ids) + public List<SpacePE> listByIds(IOperationContext context, List<SpacePermId> ids) { List<String> permIds = new LinkedList<String>(); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/vocabulary/ListVocabularyByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/vocabulary/ListVocabularyByPermId.java index 1cfd0829ff8..9b9ea0f5e45 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/vocabulary/ListVocabularyByPermId.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/vocabulary/ListVocabularyByPermId.java @@ -20,6 +20,7 @@ import java.util.LinkedList; import java.util.List; import ch.ethz.sis.openbis.generic.asapi.v3.dto.vocabulary.id.VocabularyPermId; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListObjectById; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IVocabularyDAO; import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyPE; @@ -50,7 +51,7 @@ public class ListVocabularyByPermId extends AbstractListObjectById<VocabularyPer } @Override - public List<VocabularyPE> listByIds(List<VocabularyPermId> ids) + public List<VocabularyPE> listByIds(IOperationContext context, List<VocabularyPermId> ids) { List<VocabularyPE> vocabularies = new LinkedList<VocabularyPE>(); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/vocabulary/ListVocabularyTermByCode.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/vocabulary/ListVocabularyTermByCode.java index 45022eda0a6..76c1aa568b5 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/vocabulary/ListVocabularyTermByCode.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/vocabulary/ListVocabularyTermByCode.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Set; import ch.ethz.sis.openbis.generic.asapi.v3.dto.vocabulary.id.VocabularyTermCode; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListObjectById; import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyPE; import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyTermPE; @@ -52,7 +53,7 @@ public class ListVocabularyTermByCode extends AbstractListObjectById<VocabularyT } @Override - public List<VocabularyTermPE> listByIds(List<VocabularyTermCode> ids) + public List<VocabularyTermPE> listByIds(IOperationContext context, List<VocabularyTermCode> ids) { List<VocabularyTermPE> terms = new LinkedList<VocabularyTermPE>(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ServiceForDataStoreServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ServiceForDataStoreServer.java index 925f72c5507..4ed6eb2bc14 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ServiceForDataStoreServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ServiceForDataStoreServer.java @@ -52,6 +52,7 @@ import ch.ethz.sis.openbis.generic.server.asapi.v3.context.IProgressListener; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.OperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.dataset.ICreateDataSetExecutor; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.sample.ListSampleTechIdByIdentifier; import ch.rinn.restrictions.Private; import ch.systemsx.cisd.authentication.DefaultSessionManager; import ch.systemsx.cisd.authentication.DummyAuthenticationService; @@ -2427,6 +2428,7 @@ public class ServiceForDataStoreServer extends AbstractCommonServer<IServiceForD } IOperationContext context = new OperationContext(session); + context.setAttribute(ListSampleTechIdByIdentifier.CONTAINER_SHORTCUT_ALLOWED_ATTRIBUTE, true); context.addProgressListener(new IProgressListener() { @Override diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapSampleTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapSampleTest.java index 0700033bfc1..3c947c75306 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapSampleTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapSampleTest.java @@ -156,11 +156,7 @@ public class MapSampleTest extends AbstractSampleTest Map<ISampleId, Sample> map = v3api.mapSamples(sessionToken, Arrays.asList(identifier1), new SampleFetchOptions()); - assertEquals(map.size(), 1); - - Sample sample1 = map.get(identifier1); - - assertEquals(sample1.getIdentifier().getIdentifier(), "/MP:A03"); + assertEquals(map.size(), 0); v3api.logout(sessionToken); } @@ -224,13 +220,7 @@ public class MapSampleTest extends AbstractSampleTest Map<ISampleId, Sample> map = v3api.mapSamples(sessionToken, Arrays.asList(identifier1, identifier2), new SampleFetchOptions()); - assertEquals(map.size(), 2); - - Sample sample1 = map.get(identifier1); - Sample sample2 = map.get(identifier2); - - assertEquals(sample1.getIdentifier().getIdentifier(), "/CISD/PLATE_WELLSEARCH:WELL-A01"); - assertEquals(sample2.getIdentifier().getIdentifier(), "/CISD/PLATE_WELLSEARCH:WELL-A02"); + assertEquals(map.size(), 0); v3api.logout(sessionToken); } @@ -260,10 +250,7 @@ public class MapSampleTest extends AbstractSampleTest Map<ISampleId, Sample> map = v3api.mapSamples(sessionToken, Arrays.asList(identifier1, identifier2), new SampleFetchOptions()); - assertEquals(map.size(), 1); - - Sample sample1 = map.get(identifier1); - assertEquals(sample1.getIdentifier().getIdentifier(), "/CISD/PLATE_WELLSEARCH:WELL-A01"); + assertEquals(map.size(), 0); v3api.logout(sessionToken); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/EntityOperationTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/EntityOperationTest.java index 821e26d4358..75299eb069e 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/EntityOperationTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/EntityOperationTest.java @@ -28,6 +28,7 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import ch.systemsx.cisd.common.exceptions.AuthorizationFailureException; +import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.openbis.generic.shared.IServiceForDataStoreServer; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AbstractExternalData; @@ -647,7 +648,7 @@ public class EntityOperationTest extends SystemTestCase new DataSetBuilder().code(dataSetCode).type("HCS_IMAGE") .store(new DataStoreBuilder("STANDARD").getStore()) .fileFormat("XML").location("a/b/c").property("COMMENT", "my data") - .sample(new SampleBuilder().identifier("/CISD/CP1-A1").getSample()) + .sample(new SampleBuilder().identifier("/CISD/WELL-A01").getSample()) .getDataSet()).create(); AtomicEntityOperationResult result = etlService.performEntityOperations(sessionToken, eo); @@ -657,6 +658,30 @@ public class EntityOperationTest extends SystemTestCase assertEquals(dataSetCode, dataSet.getCode()); assertEquals("HCS_IMAGE", dataSet.getDataSetType().getCode()); assertEquals("[COMMENT: my data]", dataSet.getProperties().toString()); + assertEquals("/CISD/PLATE_WELLSEARCH:WELL-A01", dataSet.getSampleIdentifier()); + } + + @Test + public void testCreateDataSetForUnknownSample() + { + String sessionToken = authenticateAs(SPACE_ETL_SERVER_FOR_A); + String dataSetCode = "DS-1"; + AtomicEntityOperationDetails eo = + new EntityOperationBuilder().dataSet( + new DataSetBuilder().code(dataSetCode).type("HCS_IMAGE") + .store(new DataStoreBuilder("STANDARD").getStore()) + .fileFormat("XML").location("a/b/c").property("COMMENT", "my data") + .sample(new SampleBuilder().identifier("/CISD/A01").getSample()) + .getDataSet()).create(); + + try + { + etlService.performEntityOperations(sessionToken, eo); + fail("UserFailureException expected"); + } catch (UserFailureException ex) + { + assertEquals("Object with SampleIdentifier = [/CISD/A01] has not been found.", ex.getMessage()); + } } @Test -- GitLab