diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/AbstractCreateEntityTypeExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/AbstractCreateEntityTypeExecutor.java index 6334eb9cbec652a948727036680318ef1062338d..4961683ca576799e172fb0e8f45009bcac6f39fc 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/AbstractCreateEntityTypeExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/AbstractCreateEntityTypeExecutor.java @@ -166,8 +166,14 @@ public abstract class AbstractCreateEntityTypeExecutor<CREATION extends IEntityT { return pluginIdHolder.getValidationPluginId(); } + + @Override + public boolean isModified(CREATION pluginIdHolder) + { + return true; + } }; - setEntityTypeValidationScriptExecutor.setValidationPlugin(context, batch, pluginIdProvider, getDAOEntityKind()); + setEntityTypeValidationScriptExecutor.setValidationPlugin(context, batch, pluginIdProvider, getPEEntityKind()); } @Override diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/AbstractUpdateEntityTypeExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/AbstractUpdateEntityTypeExecutor.java index b5489e77461e296d7f69d23ecbab7467b5f06073..8d5498d794634ffca731416b26de52290fd2e155 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/AbstractUpdateEntityTypeExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/AbstractUpdateEntityTypeExecutor.java @@ -39,6 +39,7 @@ import ch.systemsx.cisd.openbis.generic.server.business.bo.DataAccessExceptionTr import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory; import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePE; import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; +import ch.systemsx.cisd.openbis.generic.shared.translator.DtoConverters; /** * @author Franz-Josef Elmer @@ -78,14 +79,22 @@ public abstract class AbstractUpdateEntityTypeExecutor<UPDATE extends IEntityTyp @Override protected void checkData(IOperationContext context, UPDATE update) { - IEntityTypeId id = update.getObjectId(); + IEntityTypeId id = update.getTypeId(); if (id == null) { throw new UserFailureException("Missing type id."); } - if (id instanceof EntityTypePermId && ((EntityTypePermId) id).getEntityKind() == null) + if (id instanceof EntityTypePermId) { - throw new UserFailureException("Unspecified entity kind in type id: " + id); + EntityTypePermId entityTypePermId = (EntityTypePermId) id; + ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.EntityKind entityKind = EntityKindConverter.convert(getDAOEntityKind()); + if (entityTypePermId.getEntityKind() == null) + { + update.setTypeId(new EntityTypePermId(entityTypePermId.getPermId(), entityKind)); + } else if (entityTypePermId.getEntityKind().equals(entityKind) == false) + { + throw new UserFailureException("Entity kind " + entityKind + " expected: " + id); + } } checkTypeSpecificFields(update); @@ -120,8 +129,15 @@ public abstract class AbstractUpdateEntityTypeExecutor<UPDATE extends IEntityTyp { return pluginIdHolder.getValidationPluginId().getValue(); } + + @Override + public boolean isModified(UPDATE pluginIdHolder) + { + return pluginIdHolder.getValidationPluginId().isModified(); + } }; - setEntityTypeValidationScriptExecutor.setValidationPlugin(context, batch, pluginIdProvider, getDAOEntityKind()); + setEntityTypeValidationScriptExecutor.setValidationPlugin(context, batch, pluginIdProvider, + DtoConverters.convertEntityKind(getDAOEntityKind())); for (Map.Entry<UPDATE, TYPE_PE> entry : batch.getObjects().entrySet()) { UPDATE update = entry.getKey(); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/AbstractUpdateEntityTypePropertyTypesExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/AbstractUpdateEntityTypePropertyTypesExecutor.java index 843c596597f8794f4d74c8b9d774cf6d897174ba..0d118258f82facf3fa78fc02cc65ec146decf561 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/AbstractUpdateEntityTypePropertyTypesExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/AbstractUpdateEntityTypePropertyTypesExecutor.java @@ -22,7 +22,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import javax.annotation.Resource; @@ -40,9 +39,13 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.create.PropertyAssignme import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.id.IPropertyAssignmentId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.id.IPropertyTypeId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.id.PropertyTypePermId; +import ch.ethz.sis.openbis.generic.server.asapi.v3.context.IProgress; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.property.IMapPropertyAssignmentByIdExecutor; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.batch.MapBatch; +import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.batch.MapBatchProcessor; +import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.entity.progress.UpdateRelationProgress; +import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.openbis.generic.server.ComponentNames; import ch.systemsx.cisd.openbis.generic.server.business.bo.ICommonBusinessObjectFactory; import ch.systemsx.cisd.openbis.generic.server.business.bo.IEntityTypePropertyTypeBO; @@ -73,14 +76,22 @@ public abstract class AbstractUpdateEntityTypePropertyTypesExecutor<UPDATE exten @Override public void update(IOperationContext context, MapBatch<UPDATE, TYPE_PE> batch) { - Set<Entry<UPDATE, TYPE_PE>> entrySet = batch.getObjects().entrySet(); - for (Entry<UPDATE, TYPE_PE> entry : entrySet) - { - UPDATE update = entry.getKey(); - TYPE_PE typePE = entry.getValue(); - PropertyAssignmentListUpdateValue propertyAssignments = update.getPropertyAssignments(); - update(context, typePE, propertyAssignments); - } + new MapBatchProcessor<UPDATE, TYPE_PE>(context, batch) + { + + @Override + public void process(UPDATE update, TYPE_PE typePE) + { + PropertyAssignmentListUpdateValue propertyAssignments = update.getPropertyAssignments(); + update(context, typePE, propertyAssignments); + } + + @Override + public IProgress createProgress(UPDATE key, TYPE_PE value, int objectIndex, int totalObjectCount) + { + return new UpdateRelationProgress(key, value, "entity-type-property-type", objectIndex, totalObjectCount); + } + }; } private void update(IOperationContext context, TYPE_PE typePE, PropertyAssignmentListUpdateValue updates) @@ -116,7 +127,8 @@ public abstract class AbstractUpdateEntityTypePropertyTypesExecutor<UPDATE exten if (removed.isEmpty() == false) { Map<IPropertyAssignmentId, EntityTypePropertyTypePE> map = mapPropertyAssignmentByIdExecutor.map(context, removed); - removeAssignments(map.values()); + boolean forceRemovingAssignments = updates.isForceRemovingAssignments(); + removeAssignments(map.values(), forceRemovingAssignments); } } @@ -154,7 +166,9 @@ public abstract class AbstractUpdateEntityTypePropertyTypesExecutor<UPDATE exten Collection<? extends PropertyAssignmentCreation> creations = lastSet.getItems(); List<PropertyAssignmentCreation> replacements = new ArrayList<>(); List<PropertyAssignmentCreation> newCreations = new ArrayList<>(); - findReplacementsNewCreationsAndDeleteAssignments(typePE, creations, replacements, newCreations); + boolean forceRemovingAssignments = updates.isForceRemovingAssignments(); + findReplacementsNewCreationsAndDeleteAssignments(typePE, creations, replacements, newCreations, + forceRemovingAssignments); if (newCreations.isEmpty() == false) { createPropertyAssignmentsExecutor.createPropertyAssignments(context, typePE.getCode(), newCreations, getEntityKind()); @@ -177,8 +191,10 @@ public abstract class AbstractUpdateEntityTypePropertyTypesExecutor<UPDATE exten } } - private void findReplacementsNewCreationsAndDeleteAssignments(TYPE_PE typePE, Collection<? extends PropertyAssignmentCreation> creations, - List<PropertyAssignmentCreation> replacements, List<PropertyAssignmentCreation> newCreations) + private void findReplacementsNewCreationsAndDeleteAssignments(TYPE_PE typePE, + Collection<? extends PropertyAssignmentCreation> creations, + List<PropertyAssignmentCreation> replacements, List<PropertyAssignmentCreation> newCreations, + boolean forceRemovingAssignments) { Map<String, EntityTypePropertyTypePE> currentAssignments = getCurrentAssignments(typePE); for (PropertyAssignmentCreation propertyAssignmentCreation : creations) @@ -194,9 +210,15 @@ public abstract class AbstractUpdateEntityTypePropertyTypesExecutor<UPDATE exten { newCreations.add(propertyAssignmentCreation); } + } else if (propertyTypeId == null) + { + throw new UserFailureException("PropertyTypeId cannot be null."); + } else + { + throw new UserFailureException("Unknown type of property type id: " + propertyTypeId.getClass().getName()); } } - removeAssignments(currentAssignments.values()); + removeAssignments(currentAssignments.values(), forceRemovingAssignments); } private Map<String, EntityTypePropertyTypePE> getCurrentAssignments(TYPE_PE typePE) @@ -211,11 +233,22 @@ public abstract class AbstractUpdateEntityTypePropertyTypesExecutor<UPDATE exten return etptByPropertyTypeCode; } - private void removeAssignments(Collection<EntityTypePropertyTypePE> etpts) + private void removeAssignments(Collection<EntityTypePropertyTypePE> etpts, boolean forceRemovingAssignments) { for (EntityTypePropertyTypePE entityTypePropertyType : etpts) { - entityTypePropertyType.getEntityType().getEntityTypePropertyTypes().remove(entityTypePropertyType); + if (forceRemovingAssignments || entityTypePropertyType.getPropertyValues().isEmpty()) + { + entityTypePropertyType.getEntityType().getEntityTypePropertyTypes().remove(entityTypePropertyType); + } else + { + throw new UserFailureException("Can not remove property type " + + entityTypePropertyType.getPropertyType().getCode() + " from type " + + entityTypePropertyType.getEntityType().getCode() + " because " + + entityTypePropertyType.getPropertyValues().size() + " entites using this property. " + + "To force removal call getPropertyAssignments().setForceRemovingAssignments(true) " + + "on the entity update object."); + } } } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/DeleteEntityTypeExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/DeleteEntityTypeExecutor.java index 896510f2dcdfe081ea8914a4771dc49a56f78405..8c835c36e469a236dd03868819ef88ab9a6d4eea 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/DeleteEntityTypeExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/DeleteEntityTypeExecutor.java @@ -16,28 +16,22 @@ package ch.ethz.sis.openbis.generic.server.asapi.v3.executor.entity; -import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.delete.EntityTypeDeletionOptions; -import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.IEntityTypeId; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.dataset.IDataSetTypeAuthorizationExecutor; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.experiment.IExperimentTypeAuthorizationExecutor; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.material.IMaterialTypeAuthorizationExecutor; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.sample.ISampleTypeAuthorizationExecutor; -import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.entity.EntityKindConverter; -import ch.systemsx.cisd.common.exceptions.UserFailureException; +import ch.systemsx.cisd.openbis.generic.server.business.bo.IEntityTypeBO; import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePE; -import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; /** * @author Franz-Josef Elmer @@ -65,41 +59,7 @@ public class DeleteEntityTypeExecutor @Override protected Map<IEntityTypeId, EntityTypePE> map(IOperationContext context, List<? extends IEntityTypeId> entityTypeIds) { - Map<IEntityTypeId, EntityTypePE> result = new HashMap<>(); - Map<EntityKind, List<IEntityTypeId>> typeIdsByKind = splitByEntityKind(entityTypeIds); - for (Entry<EntityKind, List<IEntityTypeId>> entry : typeIdsByKind.entrySet()) - { - result.putAll(mapEntityTypeByIdExecutor.map(context, entry.getKey(), entry.getValue())); - } - return result; - } - - private Map<EntityKind, List<IEntityTypeId>> splitByEntityKind(List<? extends IEntityTypeId> entityTypeIds) - { - Map<EntityKind, List<IEntityTypeId>> typeIdsByKind = new HashMap<>(); - for (IEntityTypeId entityTypeId : entityTypeIds) - { - if (entityTypeId instanceof EntityTypePermId) - { - EntityTypePermId permId = (EntityTypePermId) entityTypeId; - EntityKind entityKind = EntityKindConverter.convert(permId.getEntityKind()); - if (entityKind == null) - { - throw new UserFailureException("Entity type id with unspecified entity kind: " + entityTypeId); - } - List<IEntityTypeId> ids = typeIdsByKind.get(entityKind); - if (ids == null) - { - ids = new ArrayList<>(); - typeIdsByKind.put(entityKind, ids); - } - ids.add(entityTypeId); - } else - { - throw new UserFailureException("Unknown entity type id type: " + entityTypeId.getClass().getName()); - } - } - return typeIdsByKind; + return mapEntityTypeByIdExecutor.map(context, null, entityTypeIds); } @Override @@ -132,7 +92,9 @@ public class DeleteEntityTypeExecutor { for (EntityTypePE entityType : entities) { - daoFactory.getEntityTypeDAO(entityType.getEntityKind()).delete(entityType); + IEntityTypeBO bo = businessObjectFactory.createEntityTypeBO(context.getSession()); + bo.load(entityType.getEntityKind(), entityType.getCode()); + bo.delete(); } return null; } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/IPluginIdProvider.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/IPluginIdProvider.java index d88035d615f3e6af39c40641b7e919a85c16c2a9..8c6740e3d517242df84413a47f329a84e30726f2 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/IPluginIdProvider.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/IPluginIdProvider.java @@ -26,4 +26,6 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.plugin.id.IPluginId; public interface IPluginIdProvider<T> { public IPluginId getPluginId(T pluginIdHolder); + + public boolean isModified(T pluginIdHolder); } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/SetEntityTypeValidationScriptExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/SetEntityTypeValidationScriptExecutor.java index 78e75146253cf0f1e5f866278525bfdf5be2e816..2cde55dc43fa086e0c4fc4cb4d9c2ca9464ce148 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/SetEntityTypeValidationScriptExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/entity/SetEntityTypeValidationScriptExecutor.java @@ -18,7 +18,6 @@ package ch.ethz.sis.openbis.generic.server.asapi.v3.executor.entity; import java.util.HashSet; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; @@ -26,14 +25,17 @@ import org.springframework.stereotype.Component; import ch.ethz.sis.openbis.generic.asapi.v3.dto.plugin.id.IPluginId; import ch.ethz.sis.openbis.generic.asapi.v3.exceptions.ObjectNotFoundException; +import ch.ethz.sis.openbis.generic.server.asapi.v3.context.IProgress; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.plugin.IMapPluginByIdExecutor; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.batch.MapBatch; +import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.batch.MapBatchProcessor; +import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.entity.progress.EntityProgress; import ch.systemsx.cisd.common.exceptions.UserFailureException; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ScriptType; import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePE; import ch.systemsx.cisd.openbis.generic.shared.dto.ScriptPE; -import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; /** * @@ -49,43 +51,81 @@ public class SetEntityTypeValidationScriptExecutor public <T, PE extends EntityTypePE> void setValidationPlugin(IOperationContext context, MapBatch<T, PE> batch, IPluginIdProvider<T> pluginIdProvider, EntityKind entityKind) { - Set<IPluginId> pluginIds = new HashSet<>(); - Set<Entry<T, PE>> entrySet = batch.getObjects().entrySet(); - for (Entry<T, PE> entry : entrySet) + Map<IPluginId, ScriptPE> pluginsById = getPlugins(context, batch, pluginIdProvider); + new MapBatchProcessor<T, PE>(context, batch) { - IPluginId validationPluginId = pluginIdProvider.getPluginId(entry.getKey()); - if (validationPluginId != null) + @Override + public void process(T key, PE value) { - pluginIds.add(validationPluginId); - } - } - Map<IPluginId, ScriptPE> map = mapPluginByIdExecutor.map(context, pluginIds); - for (Entry<T, PE> entry : entrySet) - { - T typeCreation = entry.getKey(); - IPluginId validationPluginId = pluginIdProvider.getPluginId(typeCreation); - if (validationPluginId != null) - { - ScriptPE pluginPE = map.get(validationPluginId); - if (pluginPE == null) + IPluginId validationPluginId = pluginIdProvider.getPluginId(key); + if (pluginIdProvider.isModified(key)) { - throw new ObjectNotFoundException(validationPluginId); + ScriptPE pluginPE = null; + if (validationPluginId != null) + { + pluginPE = pluginsById.get(validationPluginId); + if (pluginPE == null) + { + throw new ObjectNotFoundException(validationPluginId); + } + checkScriptType(pluginPE, validationPluginId); + checkEntityKind(pluginPE, entityKind); + } + value.setValidationScript(pluginPE); } - if (false == ScriptType.ENTITY_VALIDATION.equals(pluginPE.getScriptType())) + } + + @Override + public IProgress createProgress(T key, PE value, int objectIndex, int totalObjectCount) + { + return new EntityProgress("setting validation script", value, objectIndex, totalObjectCount); + } + + }; + } + + private <T, PE extends EntityTypePE> Map<IPluginId, ScriptPE> getPlugins(IOperationContext context, + MapBatch<T, PE> batch, IPluginIdProvider<T> pluginIdProvider) + { + Set<IPluginId> pluginIds = new HashSet<>(); + new MapBatchProcessor<T, PE>(context, batch) + { + @Override + public void process(T key, PE value) { - throw new UserFailureException("Entity type validation plugin has to be of type '" + ScriptType.ENTITY_VALIDATION - + "'. The specified plugin with id '" + validationPluginId + "' is of type '" + pluginPE.getScriptType() - + "'."); + IPluginId validationPluginId = pluginIdProvider.getPluginId(key); + if (validationPluginId != null) + { + pluginIds.add(validationPluginId); + } } - - if (pluginPE.getEntityKind() != null - && false == pluginPE.getEntityKind().equals(entityKind)) + + @Override + public IProgress createProgress(T key, PE value, int objectIndex, int totalObjectCount) { - throw new UserFailureException("Entity type validation plugin has entity kind set to '" + pluginPE.getEntityKind() - + "'. Expected a plugin where entity kind is either '" + entityKind + "' or null."); + return new EntityProgress("getting validation script", value, objectIndex, totalObjectCount); } - entry.getValue().setValidationScript(pluginPE); - } + }; + return mapPluginByIdExecutor.map(context, pluginIds); + } + + private void checkScriptType(ScriptPE pluginPE, IPluginId validationPluginId) + { + if (false == ScriptType.ENTITY_VALIDATION.equals(pluginPE.getScriptType())) + { + throw new UserFailureException("Entity type validation plugin has to be of type '" + + ScriptType.ENTITY_VALIDATION + "'. The specified plugin with id '" + + validationPluginId + "' is of type '" + pluginPE.getScriptType() + "'."); + } + } + + private void checkEntityKind(ScriptPE pluginPE, EntityKind entityKind) + { + if (pluginPE.getEntityKind() != null && false == pluginPE.getEntityKind().equals(entityKind)) + { + throw new UserFailureException("Entity type validation plugin has entity kind set to '" + + pluginPE.getEntityKind() + "'. Expected a plugin where entity kind is either '" + + entityKind + "' or null."); } } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/entity/progress/EntityProgress.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/entity/progress/EntityProgress.java index 18c55957d7c109f049f11fecd8ae73c647cb9313..5301b3a27ceb9fccba0854c4c2bbedf4e442a259 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/entity/progress/EntityProgress.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/entity/progress/EntityProgress.java @@ -26,7 +26,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.IPermIdHolder; /** * @author pkupczyk */ -public abstract class EntityProgress extends Progress +public class EntityProgress extends Progress { private static final long serialVersionUID = 1L; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/entitytype/update/PropertyAssignmentListUpdateValue.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/entitytype/update/PropertyAssignmentListUpdateValue.js index 7ede138225a093c4d91649980b1c6042d7f1638f..6e043025b49fb84674266976da9c2bc784a7db7e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/entitytype/update/PropertyAssignmentListUpdateValue.js +++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/entitytype/update/PropertyAssignmentListUpdateValue.js @@ -5,6 +5,13 @@ define([ "stjs", "as/dto/common/update/ListUpdateValue" ], function(stjs, ListUp stjs.extend(PropertyAssignmentListUpdateValue, ListUpdateValue, [ ListUpdateValue ], function(constructor, prototype) { prototype['@type'] = 'as.dto.entitytype.update.PropertyAssignmentListUpdateValue'; constructor.serialVersionUID = 1; + prototype.forceRemovingAssignments = false; + prototype.isForceRemovingAssignments = function() { + return this.forceRemovingAssignments; + }; + prototype.setForceRemovingAssignments = function(forceRemovingAssignments) { + this.forceRemovingAssignments = forceRemovingAssignments; + } }, { actions : { name : "List", diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/DeleteEntityTypeTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/DeleteEntityTypeTest.java index 00a8098b151a68370434b3af9f4712f0118001e7..2cc84006d49bc5e3ef2d96a2772ea2f6bfba72a9 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/DeleteEntityTypeTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/DeleteEntityTypeTest.java @@ -106,7 +106,7 @@ public class DeleteEntityTypeTest extends AbstractTest // When v3api.deleteEntityTypes(sessionToken, Arrays.asList(typeId), deletionOptions); } - }, "Entity type id with unspecified entity kind"); + }, "Entity type entity kind cannot be null"); } @Test(dataProvider = "usersNotAllowedToDelete") diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateDataSetTypeTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateDataSetTypeTest.java index 99b2221a96658bcf4ea4bd7343b42d1da7ba881c..0e3f4c12041a148d94749de0840a42c126126613 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateDataSetTypeTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateDataSetTypeTest.java @@ -18,19 +18,26 @@ package ch.ethz.sis.openbis.systemtest.asapi.v3; import static org.testng.Assert.assertEquals; +import java.util.Arrays; import java.util.List; +import java.util.UUID; import org.testng.annotations.Test; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPropertiesHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.search.AbstractEntitySearchCriteria; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.DataSetKind; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.DataSetType; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.create.DataSetCreation; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.fetchoptions.DataSetFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.fetchoptions.DataSetTypeFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.search.DataSetSearchCriteria; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.search.DataSetTypeSearchCriteria; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.update.DataSetTypeUpdate; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.datastore.id.DataStorePermId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.IEntityTypeId; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.id.ExperimentIdentifier; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Script; import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; @@ -67,6 +74,19 @@ public class UpdateDataSetTypeTest extends UpdateEntityTypeTest<DataSetTypeUpdat v3api.updateDataSetTypes(sessionToken, updates); } + @Override + protected void createEntity(String sessionToken, IEntityTypeId entityType, String propertyType, String propertyValue) + { + DataSetCreation creation = new DataSetCreation(); + creation.setTypeId(entityType); + creation.setCode(UUID.randomUUID().toString()); + creation.setDataSetKind(DataSetKind.CONTAINER); + creation.setDataStoreId(new DataStorePermId("STANDARD")); + creation.setExperimentId(new ExperimentIdentifier("/TEST-SPACE/TEST-PROJECT/EXP-SPACE-TEST")); + creation.setProperty(propertyType, propertyValue); + v3api.createDataSets(sessionToken, Arrays.asList(creation)); + } + @Override protected DataSetType getType(String sessionToken, EntityTypePermId typeId) { diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateEntityTypeTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateEntityTypeTest.java index 9f6a26b74fa03382fcb064270d049cde2824e837..7ba257ae1909d36bf6efab6108bfc04213cfad8e 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateEntityTypeTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateEntityTypeTest.java @@ -33,11 +33,13 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPropertiesHol import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.search.AbstractEntitySearchCriteria; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.update.FieldUpdateValue; import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.IEntityTypeId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.update.IEntityTypeUpdate; import ch.ethz.sis.openbis.generic.asapi.v3.dto.plugin.id.PluginPermId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyType; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.create.PropertyAssignmentCreation; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.id.IPropertyTypeId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.id.PropertyAssignmentPermId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.id.PropertyTypePermId; import ch.systemsx.cisd.common.action.IDelegatedAction; @@ -53,7 +55,9 @@ public abstract class UpdateEntityTypeTest<UPDATE extends IEntityTypeUpdate, TYP protected abstract UPDATE newTypeUpdate(); protected abstract EntityTypePermId getTypeId(); - + + protected abstract void createEntity(String sessionToken, IEntityTypeId entityType, String propertyType, String propertyValue); + protected abstract void updateTypes(String sessionToken, List<UPDATE> updates); protected abstract TYPE getType(String sessionToken, EntityTypePermId typeId); @@ -108,23 +112,25 @@ public abstract class UpdateEntityTypeTest<UPDATE extends IEntityTypeUpdate, TYP } @Test - public void testUpdateWithIdButUnspecifiedEntityKind() + public void testUpdateWithIdWrongEntityKind() { // Given String sessionToken = v3api.login(TEST_USER, PASSWORD); UPDATE update = newTypeUpdate(); - update.setTypeId(new EntityTypePermId(getTypeId().getPermId())); + EntityTypePermId typeId = getTypeId(); + update.setTypeId(new EntityTypePermId(typeId.getPermId(), nextEntityKind(typeId.getEntityKind()))); assertUserFailureException(new IDelegatedAction() { @Override public void execute() - {// When + { + // When updateTypes(sessionToken, Arrays.asList(update)); } }, // Then - "Unspecified entity kind in type id: " + update.getTypeId()); + "Entity kind " + typeId.getEntityKind() + " expected: "); } @Test @@ -146,6 +152,27 @@ public abstract class UpdateEntityTypeTest<UPDATE extends IEntityTypeUpdate, TYP assertEquals(type.getDescription(), update.getDescription().getValue()); assertTypeSpecificFields(type, update, 0); } + + @Test + public void testUpdateDescriptionUsingEntityTypePermIdWithoutEntityKind() + { + // Given + String sessionToken = v3api.login(TEST_USER, PASSWORD); + UPDATE update = newTypeUpdate(); + EntityTypePermId typeId = new EntityTypePermId(getTypeId().getPermId()); + update.setTypeId(typeId); + update.setDescription("new description " + System.currentTimeMillis()); + updateTypeSpecificFields(update, 0); + + // When + updateTypes(sessionToken, Arrays.asList(update)); + + // Then + TYPE type = getType(sessionToken, typeId); + assertEquals(type.getDescription(), update.getDescription().getValue()); + assertTypeSpecificFields(type, update, 0); + } + @Test public void testUpdateWithValidationPlugin() { @@ -166,6 +193,32 @@ public abstract class UpdateEntityTypeTest<UPDATE extends IEntityTypeUpdate, TYP assertTypeSpecificFields(type, update, 1); } + @Test + public void testUpdateRemovingValidationPlugin() + { + // Given + String sessionToken = v3api.login(TEST_USER, PASSWORD); + UPDATE update = newTypeUpdate(); + EntityTypePermId typeId = getTypeId(); + update.setTypeId(typeId); + update.setValidationPluginId(new PluginPermId("validateOK")); + updateTypeSpecificFields(update, 1); + updateTypes(sessionToken, Arrays.asList(update)); + assertEquals(getValidationPluginOrNull(sessionToken, typeId), "validateOK"); + + update = newTypeUpdate(); + update.setTypeId(typeId); + update.getValidationPluginId().setValue(null); + + // When + updateTypes(sessionToken, Arrays.asList(update)); + + // Then + assertEquals(getValidationPluginOrNull(sessionToken, typeId), null); + TYPE type = getType(sessionToken, typeId); + assertTypeSpecificFields(type, update, 1); + } + @Test public void testUpdateWithValidationPluginOfIncorrectType() { @@ -215,6 +268,31 @@ public abstract class UpdateEntityTypeTest<UPDATE extends IEntityTypeUpdate, TYP + "'. Expected a plugin where entity kind is either '" + getEntityKind().name() + "' or null"); } + @Test + public void testUpdateWithValidationPluginOfCorrectEntityType() + { + // Given + String sessionToken = v3api.login(TEST_USER, PASSWORD); + UPDATE update = newTypeUpdate(); + EntityTypePermId typeId = getTypeId(); + update.setTypeId(typeId); + EntityKind correctEntityKind = getCorrectEntityKind(); + String pluginPermId = null; + if (correctEntityKind != null) + { + pluginPermId = "test" + correctEntityKind; + update.setValidationPluginId(new PluginPermId(pluginPermId)); + } + + // When + updateTypes(sessionToken, Arrays.asList(update)); + + // Then + assertEquals(getValidationPluginOrNull(sessionToken, typeId), pluginPermId); + TYPE type = getType(sessionToken, typeId); + assertTypeSpecificFields(type, update, 1); + } + @Test public void testAddAndRemovePropertyTypeAssignment() { @@ -225,15 +303,18 @@ public abstract class UpdateEntityTypeTest<UPDATE extends IEntityTypeUpdate, TYP update.setTypeId(typeId); PropertyAssignmentCreation assignmentCreation = new PropertyAssignmentCreation(); assignmentCreation.setPropertyTypeId(new PropertyTypePermId("SIZE")); - assignmentCreation.setMandatory(true); - assignmentCreation.setInitialValueForExistingEntities("42"); + assignmentCreation.setMandatory(false); assignmentCreation.setSection("test"); assignmentCreation.setOrdinal(3); + assignmentCreation.setShowRawValueInForms(false); + assignmentCreation.setShowInEditView(false); + update.getPropertyAssignments().setForceRemovingAssignments(true); update.getPropertyAssignments().add(assignmentCreation); update.getPropertyAssignments().remove(new PropertyAssignmentPermId(typeId, new PropertyTypePermId("description"))); Map<String, String> renderedAssignments = getCurrentRenderedPropertyAssignmentsByPropertyTypeCode(sessionToken); renderedAssignments.remove("DESCRIPTION"); - renderedAssignments.put("SIZE", "PropertyAssignment entity type: " + typeId.getPermId() + ", property type: SIZE, mandatory: true"); + renderedAssignments.put("SIZE", "PropertyAssignment entity type: " + typeId.getPermId() + + ", property type: SIZE, mandatory: false, showInEditView: false, showRawValueInForms: false"); // When updateTypes(sessionToken, Arrays.asList(update)); @@ -244,6 +325,30 @@ public abstract class UpdateEntityTypeTest<UPDATE extends IEntityTypeUpdate, TYP assertEquals(actual.toString(), expected.toString()); } + @Test public void testRemovePropertyTypeAssignmentFailsBecauseOfEntitiesWithSuchProperty() + { + // Given + String sessionToken = v3api.login(TEST_USER, PASSWORD); + UPDATE update = newTypeUpdate(); + EntityTypePermId typeId = getTypeId(); + String propertyType = "DESCRIPTION"; + createEntity(sessionToken, typeId, propertyType, "new property"); + update.setTypeId(typeId); + update.getPropertyAssignments().remove(new PropertyAssignmentPermId(typeId, new PropertyTypePermId(propertyType))); + + assertUserFailureException(new IDelegatedAction() + { + @Override + public void execute() + { + // When + updateTypes(sessionToken, Arrays.asList(update)); + } + }, + // Then + "Can not remove property type " + propertyType + " from type " + typeId.getPermId()); + } + @Test public void testAddAlreadyExistingPropertyTypeAssignment() { @@ -284,30 +389,89 @@ public abstract class UpdateEntityTypeTest<UPDATE extends IEntityTypeUpdate, TYP newCreation.setPropertyTypeId(new PropertyTypePermId("SIZE")); newCreation.setInitialValueForExistingEntities("42"); newCreation.setMandatory(true); + newCreation.setShowRawValueInForms(true); + newCreation.setShowInEditView(false); newCreation.setSection("test"); PropertyAssignmentCreation replaceCreation = new PropertyAssignmentCreation(); replaceCreation.setPropertyTypeId(new PropertyTypePermId("$PLATE_GEOMETRY")); replaceCreation.setMandatory(false); + replaceCreation.setShowInEditView(true); update.getPropertyAssignments().set(newCreation, replaceCreation); + update.getPropertyAssignments().setForceRemovingAssignments(true); + Map<String, String> renderedAssignments = getCurrentRenderedPropertyAssignmentsByPropertyTypeCode(sessionToken); + renderedAssignments.remove("DESCRIPTION"); + renderedAssignments.remove("BACTERIUM"); + renderedAssignments.remove("ANY_MATERIAL"); + renderedAssignments.remove("ORGANISM"); + renderedAssignments.remove("DELETION_TEST"); + renderedAssignments.remove("COMMENT"); + renderedAssignments.remove("COMPOUND_HCS"); + renderedAssignments.remove("GENE_SYMBOL"); + renderedAssignments.put("SIZE", "PropertyAssignment entity type: " + typeId.getPermId() + + ", property type: SIZE, mandatory: true, showInEditView: false, showRawValueInForms: true"); + renderedAssignments.put("PLATE_GEOMETRY", "PropertyAssignment entity type: " + typeId.getPermId() + + ", property type: PLATE_GEOMETRY, mandatory: false, showInEditView: true, showRawValueInForms: false"); // When updateTypes(sessionToken, Arrays.asList(update)); // Then - TYPE type = getType(sessionToken, typeId); - List<PropertyAssignment> assignments = type.getPropertyAssignments(); - sortPropertyAssignments(assignments); - assertEquals(assignments.toString(), - "[PropertyAssignment entity type: " + typeId.getPermId() + ", property type: PLATE_GEOMETRY, mandatory: false, " - + "PropertyAssignment entity type: " + typeId.getPermId() + ", property type: SIZE, mandatory: true]"); - PropertyAssignment assignment = assignments.get(1); - assertEquals(assignment.getSection(), "test"); - AbstractEntitySearchCriteria<?> searchCriteria = createSearchCriteria(typeId); - searchCriteria.withProperty("SIZE"); - for (IPropertiesHolder propertiesHolder : searchEntities(sessionToken, searchCriteria)) - { - assertEquals(propertiesHolder.getProperty("SIZE"), "42"); - } + List<String> expected = getSortedRenderedAssignments(renderedAssignments); + List<String> actual = getSortedRenderedAssignments(sessionToken); + assertEquals(actual.toString(), expected.toString()); + } + + @Test + public void testReplacingPropertyTypeWithPropertyTypeIdNull() + { + // Given + String sessionToken = v3api.login(TEST_USER, PASSWORD); + UPDATE update = newTypeUpdate(); + EntityTypePermId typeId = getTypeId(); + update.setTypeId(typeId); + PropertyAssignmentCreation replaceCreation = new PropertyAssignmentCreation(); + replaceCreation.setMandatory(false); + update.getPropertyAssignments().set(replaceCreation); + + assertUserFailureException(new IDelegatedAction() + { + @Override + public void execute() + { + // When + updateTypes(sessionToken, Arrays.asList(update)); + } + }, + // Then + "PropertyTypeId cannot be null."); + } + + @Test + public void testReplacingPropertyTypeWithUnknownPropertyTypeIdClass() + { + // Given + String sessionToken = v3api.login(TEST_USER, PASSWORD); + UPDATE update = newTypeUpdate(); + EntityTypePermId typeId = getTypeId(); + update.setTypeId(typeId); + PropertyAssignmentCreation replaceCreation = new PropertyAssignmentCreation(); + replaceCreation.setPropertyTypeId(new IPropertyTypeId() + { + private static final long serialVersionUID = 1L; + }); + update.getPropertyAssignments().set(replaceCreation); + + assertUserFailureException(new IDelegatedAction() + { + @Override + public void execute() + { + // When + updateTypes(sessionToken, Arrays.asList(update)); + } + }, + // Then + "Unknown type of property type id: ch.ethz.sis.openbis.systemtest.asapi.v3.UpdateEntityTypeTest$"); } @Test(dataProvider = "usersNotAllowedToUpdate") @@ -354,6 +518,20 @@ public abstract class UpdateEntityTypeTest<UPDATE extends IEntityTypeUpdate, TYP } } + private EntityKind getCorrectEntityKind() + { + if (EntityKind.EXPERIMENT.equals(getEntityKind())) + { + return EntityKind.EXPERIMENT; + } else if (EntityKind.SAMPLE.equals(getEntityKind())) + { + return EntityKind.SAMPLE; + } else + { + return null; + } + } + private List<String> getSortedRenderedAssignments(String sessionToken) { return getSortedRenderedAssignments(getCurrentRenderedPropertyAssignmentsByPropertyTypeCode(sessionToken)); @@ -375,9 +553,20 @@ public abstract class UpdateEntityTypeTest<UPDATE extends IEntityTypeUpdate, TYP { PropertyType propertyType = propertyAssignment.getPropertyType(); String code = propertyType.getCode(); - result.put(code, propertyAssignment.toString()); + StringBuilder builder = new StringBuilder(propertyAssignment.toString()); + builder.append(", showInEditView: ").append(propertyAssignment.isShowInEditView()); + builder.append(", showRawValueInForms: ").append(propertyAssignment.isShowRawValueInForms()); + result.put(code, builder.toString()); } return result; } + private ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.EntityKind nextEntityKind( + ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.EntityKind entityKind) + { + ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.EntityKind[] values + = ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.EntityKind.values(); + return values[(entityKind.ordinal() + 1) % values.length]; + } + } diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateExperimentTypeTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateExperimentTypeTest.java index 58c2d823516ce032323ea878be9eb25e847e281a..4421c658bd62ce526c7e40e3869dd28409f7702a 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateExperimentTypeTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateExperimentTypeTest.java @@ -23,6 +23,7 @@ import org.testng.annotations.Test; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPropertiesHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.search.AbstractEntitySearchCriteria; import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.IEntityTypeId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.ExperimentType; import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.fetchoptions.ExperimentFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.fetchoptions.ExperimentTypeFetchOptions; @@ -59,6 +60,11 @@ public class UpdateExperimentTypeTest extends UpdateEntityTypeTest<ExperimentTyp return new EntityTypePermId("COMPOUND_HCS", ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.EntityKind.EXPERIMENT); } + @Override + protected void createEntity(String sessionToken, IEntityTypeId entityType, String propertyType, String propertyValue) + { + } + @Override protected void updateTypes(String sessionToken, List<ExperimentTypeUpdate> updates) { diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateMaterialTypeTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateMaterialTypeTest.java index 0744b8ba3ade123ae1ad3c84cf6763b447b56121..7f61f19a3960e0be4a053b703a3cb6bc6b17a0b7 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateMaterialTypeTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateMaterialTypeTest.java @@ -23,8 +23,7 @@ import org.testng.annotations.Test; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPropertiesHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.search.AbstractEntitySearchCriteria; import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId; -import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.ExperimentType; -import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.update.ExperimentTypeUpdate; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.IEntityTypeId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.MaterialType; import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.fetchoptions.MaterialFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.fetchoptions.MaterialTypeFetchOptions; @@ -61,6 +60,11 @@ public class UpdateMaterialTypeTest extends UpdateEntityTypeTest<MaterialTypeUpd return new EntityTypePermId("gene", ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.EntityKind.MATERIAL); } + @Override + protected void createEntity(String sessionToken, IEntityTypeId entityType, String propertyType, String propertyValue) + { + } + @Override protected void updateTypes(String sessionToken, List<MaterialTypeUpdate> updates) { diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateSampleTypeTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateSampleTypeTest.java index f821a9a5a6e620c7490df68c54d69626dcedee51..9712d88f7d1651e5096e6ff6cf82b01ef484ed37 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateSampleTypeTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateSampleTypeTest.java @@ -25,6 +25,7 @@ import org.testng.annotations.Test; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPropertiesHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.search.AbstractEntitySearchCriteria; import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.IEntityTypeId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.SampleType; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.fetchoptions.SampleFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.fetchoptions.SampleTypeFetchOptions; @@ -58,7 +59,12 @@ public class UpdateSampleTypeTest extends UpdateEntityTypeTest<SampleTypeUpdate, @Override protected EntityTypePermId getTypeId() { - return new EntityTypePermId("MASTER_PLATE", ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.EntityKind.SAMPLE); + return new EntityTypePermId("CONTROL_LAYOUT", ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.EntityKind.SAMPLE); + } + + @Override + protected void createEntity(String sessionToken, IEntityTypeId entityType, String propertyType, String propertyValue) + { } @Override