From 882a76f425e4f82b15c55b86b28abaa2a6fa05a6 Mon Sep 17 00:00:00 2001 From: brinn <brinn> Date: Thu, 30 Jul 2009 12:04:16 +0000 Subject: [PATCH] client-side entity properties refactoring add: interface IEntityProperty add: entity property classes which specifically hold a generic value, a vocabulary term value or a material value change: simplify client-side EntityProperty classes by replacing EntityTypePropertyType by PropertyType change: unify client-side entity property type classes, delete SampleProperty, ExperimentProperty, MaterialProperty and DataSetProperty merge: r11925-11943 from feature branch fast_sample_browsing SVN: 11945 --- .../model/EntityGridModelFactory.java | 6 +- .../VocabularyPropertyColRenderer.java | 4 +- .../ui/PropertyValueRenderers.java | 70 ++++-------- .../framework/EntityPropertyColDef.java | 16 +-- .../data/DataSetExperimentPropertyColDef.java | 7 +- .../specific/data/DataSetPropertyColDef.java | 7 +- .../data/DataSetSamplePropertyColDef.java | 7 +- .../ui/data/DataSetSearchHitModel.java | 8 +- .../application/ui/property/PropertyGrid.java | 4 +- .../client/web/client/dto/Experiment.java | 8 +- .../client/web/client/dto/ExternalData.java | 15 ++- .../generic/client/web/client/dto/Sample.java | 11 +- .../client/web/client/dto/SampleUpdates.java | 4 +- .../translator/DataSetPropertyTranslator.java | 36 ++++--- .../ExperimentPropertyTranslator.java | 41 ++++--- .../translator/ExperimentTranslator.java | 4 +- .../translator/ExternalDataTranslator.java | 4 +- .../MaterialPropertyTranslator.java | 39 ++++--- .../server/translator/MaterialTranslator.java | 4 +- .../translator/PropertyTranslatorUtils.java | 96 +++++++++++++++++ .../translator/SamplePropertyTranslator.java | 43 ++++---- .../server/translator/SampleTranslator.java | 4 +- .../bo/AbstractSampleBusinessObject.java | 4 +- .../bo/EntityPropertiesConverter.java | 20 ++-- .../server/business/bo/ExperimentBO.java | 9 +- .../server/business/bo/ExternalDataBO.java | 22 ++-- .../bo/IEntityPropertiesConverter.java | 10 +- .../server/business/bo/IExternalDataBO.java | 4 +- .../server/business/bo/IMaterialBO.java | 4 +- .../server/business/bo/MaterialBO.java | 6 +- .../server/business/bo/MaterialTable.java | 4 +- .../generic/server/business/bo/SampleBO.java | 4 +- .../basic/dto/AbstractEntityProperty.java | 102 ++++++++++++++++++ .../basic/dto/BasicExperimentUpdates.java | 6 +- .../shared/basic/dto/BasicSampleUpdates.java | 8 +- .../shared/basic/dto/EntityProperty.java | 46 ++------ .../shared/basic/dto/ExperimentProperty.java | 32 ------ ...y.java => GenericValueEntityProperty.java} | 30 ++++-- .../basic/dto/IEntityPropertiesHolder.java | 2 +- .../shared/basic/dto/IEntityProperty.java | 54 ++++++++++ .../generic/shared/basic/dto/Material.java | 6 +- .../shared/basic/dto/MaterialIdentifier.java | 8 +- .../shared/basic/dto/MaterialProperty.java | 34 ------ .../dto/MaterialValueEntityProperty.java | 55 ++++++++++ .../shared/basic/dto/NewExperiment.java | 6 +- .../generic/shared/basic/dto/NewMaterial.java | 6 +- .../generic/shared/basic/dto/NewSample.java | 6 +- .../shared/basic/dto/SampleProperty.java | 32 ------ .../basic/dto/ServiceVersionHolder.java | 2 +- .../VocabularyTermValueEntityProperty.java | 55 ++++++++++ .../generic/shared/dto/EntityPropertyPE.java | 2 +- ...operty.java => IEntityPropertyHolder.java} | 2 +- .../generic/shared/dto/SampleUpdatesDTO.java | 4 +- .../web/client/IGenericClientService.java | 7 +- .../client/IGenericClientServiceAsync.java | 7 +- ...AbstractGenericEntityRegistrationForm.java | 10 +- .../dataset/DataSetPropertiesSection.java | 21 ++-- .../dataset/DataSetPropertyEditor.java | 9 +- .../dataset/GenericDataSetEditForm.java | 9 +- ...ractGenericExperimentRegisterEditForm.java | 8 +- .../experiment/EntityPropertyGrid.java | 28 +++-- .../experiment/ExperimentPropertiesPanel.java | 22 ++-- .../experiment/ExperimentPropertyEditor.java | 9 +- .../GenericExperimentRegistrationForm.java | 8 +- .../experiment/PropertiesEditor.java | 34 +++--- .../material/GenericMaterialEditForm.java | 6 +- .../material/MaterialPropertiesSection.java | 25 +++-- .../material/MaterialPropertyEditor.java | 9 +- ...AbstractGenericSampleRegisterEditForm.java | 5 +- .../sample/GenericSampleEditForm.java | 4 +- .../sample/GenericSampleRegistrationForm.java | 6 +- .../sample/GenericSampleViewer.java | 24 +++-- .../sample/SamplePropertyEditor.java | 9 +- .../web/server/GenericClientService.java | 10 +- .../NewMaterialParserObjectFactory.java | 28 ++--- .../server/NewSampleParserObjectFactory.java | 24 +++-- .../plugin/generic/server/GenericServer.java | 7 +- .../generic/server/GenericServerLogger.java | 7 +- .../plugin/generic/shared/IGenericServer.java | 7 +- .../testframework/AbstractProperty.java | 7 +- .../bo/EntityPropertiesConverterTest.java | 22 ++-- .../server/business/bo/ExperimentBOTest.java | 10 +- .../business/bo/ExternalDataBOTest.java | 4 +- .../server/business/bo/SampleBOTest.java | 24 ++--- .../web/server/GenericClientServiceTest.java | 33 +++--- .../NewSampleParserObjectFactoryTest.java | 10 +- .../generic/server/GenericServerTest.java | 7 +- .../shared/IGenericServer.java.expected | 7 +- .../dto/SampleWithPropertiesAndAbundance.java | 8 +- 89 files changed, 859 insertions(+), 639 deletions(-) create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/PropertyTranslatorUtils.java create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AbstractEntityProperty.java delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ExperimentProperty.java rename openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/{DataSetProperty.java => GenericValueEntityProperty.java} (61%) create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IEntityProperty.java delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialProperty.java create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialValueEntityProperty.java delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SampleProperty.java create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/VocabularyTermValueEntityProperty.java rename openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/{IEntityProperty.java => IEntityPropertyHolder.java} (95%) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/EntityGridModelFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/EntityGridModelFactory.java index e76b5f146e4..729001334f9 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/EntityGridModelFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/EntityGridModelFactory.java @@ -26,9 +26,9 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.ColumnDefsAndConfigs; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.entity.PropertyTypesFilterUtil; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityPropertiesHolder; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; /** @@ -64,9 +64,9 @@ public class EntityGridModelFactory<T extends IEntityPropertiesHolder> IEntityPropertiesHolder entity) { List<IColumnDefinitionUI<T>> list = createStaticColumnDefinitions(null); - for (EntityProperty<?, ?> prop : entity.getProperties()) + for (IEntityProperty prop : entity.getProperties()) { - PropertyType propertyType = prop.getEntityTypePropertyType().getPropertyType(); + PropertyType propertyType = prop.getPropertyType(); EntityPropertyColDef<T> colDef = new EntityPropertyColDef<T>(propertyType, true, null); list.add(AbstractPropertyColRenderer.getPropertyColRenderer(colDef)); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/renderer/VocabularyPropertyColRenderer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/renderer/VocabularyPropertyColRenderer.java index 38ad9ab99bd..ba0882f7995 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/renderer/VocabularyPropertyColRenderer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/renderer/VocabularyPropertyColRenderer.java @@ -19,8 +19,8 @@ package ch.systemsx.cisd.openbis.generic.client.web.client.application.model.ren import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.EntityPropertyColDef; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.ExternalHyperlink; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.MultilineHTML; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityPropertiesHolder; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTerm; /** @@ -39,7 +39,7 @@ public class VocabularyPropertyColRenderer<T extends IEntityPropertiesHolder> ex @Override protected String renderValue(T entity) { - final EntityProperty<?, ?> property = colDef.tryGetProperty(entity); + final IEntityProperty property = colDef.tryGetProperty(entity); String result = ""; if (property != null) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/PropertyValueRenderers.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/PropertyValueRenderers.java index 14599878bff..32ebeb1f7fd 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/PropertyValueRenderers.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/PropertyValueRenderers.java @@ -42,19 +42,15 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.dto.IInvalidationProvi import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Invalidation; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Sample; import ch.systemsx.cisd.openbis.generic.shared.basic.IEntityInformationHolder; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTerm; @@ -146,42 +142,12 @@ public final class PropertyValueRenderers } /** - * Creates a {@link IPropertyValueRenderer} implementation for rendering {@link SampleProperty}. + * Creates a {@link IPropertyValueRenderer} implementation for rendering {@link IEntityProperty}. */ - public final static IPropertyValueRenderer<SampleProperty> createSamplePropertyPropertyValueRenderer( + public final static IPropertyValueRenderer<IEntityProperty> createEntityPropertyPropertyValueRenderer( final IViewContext<?> viewContext) { - return new EntityPropertyPropertyValueRenderer<SampleProperty>(viewContext); - } - - /** - * Creates a {@link IPropertyValueRenderer} implementation for rendering - * {@link ExperimentProperty}. - */ - public final static IPropertyValueRenderer<ExperimentProperty> createExperimentPropertyPropertyValueRenderer( - final IViewContext<?> viewContext) - { - return new EntityPropertyPropertyValueRenderer<ExperimentProperty>(viewContext); - } - - /** - * Creates a {@link IPropertyValueRenderer} implementation for rendering - * {@link MaterialProperty}. - */ - public final static IPropertyValueRenderer<MaterialProperty> createMaterialPropertyPropertyValueRenderer( - final IViewContext<?> viewContext) - { - return new EntityPropertyPropertyValueRenderer<MaterialProperty>(viewContext); - } - - /** - * Creates a {@link IPropertyValueRenderer} implementation for rendering {@link DataSetProperty} - * . - */ - public final static IPropertyValueRenderer<DataSetProperty> createDataSetPropertyPropertyValueRenderer( - final IViewContext<?> viewContext) - { - return new EntityPropertyPropertyValueRenderer<DataSetProperty>(viewContext); + return new EntityPropertyPropertyValueRenderer(viewContext); } /** @@ -275,12 +241,12 @@ public final class PropertyValueRenderers } /** - * Renderer for {@link EntityProperty}. + * Renderer for {@link IEntityProperty}. * * @author Christian Ribeaud */ - private final static class EntityPropertyPropertyValueRenderer<T extends EntityProperty<?, ?>> - extends AbstractPropertyValueRenderer<T> + private final static class EntityPropertyPropertyValueRenderer extends + AbstractPropertyValueRenderer<IEntityProperty> { private final IViewContext<?> viewContext; @@ -292,10 +258,10 @@ public final class PropertyValueRenderers } // - // AbstractPropertyValueRenderer + // IPropertyValueRenderer // - public Widget getAsWidget(T object) + public Widget getAsWidget(IEntityProperty object) { switch (getDataTypeCode(object)) { @@ -312,12 +278,12 @@ public final class PropertyValueRenderers } } - private DataTypeCode getDataTypeCode(T property) + private DataTypeCode getDataTypeCode(IEntityProperty property) { return getPropertyType(property).getDataType().getCode(); } - private Widget createLinkToMaterial(T object) + private Widget createLinkToMaterial(IEntityProperty object) { Material material = object.getMaterial(); if (material != null) @@ -341,7 +307,7 @@ public final class PropertyValueRenderers } } - private Widget createMultilineHtmlWidget(T object) + private Widget createMultilineHtmlWidget(IEntityProperty object) { return MultilineStringPropertyValueRenderer .createMultilineHtmlWidget(object.getValue()); @@ -352,18 +318,18 @@ public final class PropertyValueRenderers return new InlineHTML(html); } - private Widget createHtmlWidget(T object) + private Widget createHtmlWidget(IEntityProperty object) { return createHtmlWidget(object.getValue()); } - private Widget createHyperlink(T object) + private Widget createHyperlink(IEntityProperty object) { String value = object.getValue(); return new ExternalHyperlink(value, value); } - private Widget createVocabularyTermLink(T object) + private Widget createVocabularyTermLink(IEntityProperty object) { final VocabularyTerm term = object.getVocabularyTerm(); String html = ""; @@ -374,14 +340,14 @@ public final class PropertyValueRenderers return createHtmlWidget(html); } - private boolean isAllowedMaterialTypeUnspecified(T property) + private boolean isAllowedMaterialTypeUnspecified(IEntityProperty property) { return getPropertyType(property).getMaterialType() == null; } - private PropertyType getPropertyType(T property) + private PropertyType getPropertyType(IEntityProperty property) { - return property.getEntityTypePropertyType().getPropertyType(); + return property.getPropertyType(); } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/framework/EntityPropertyColDef.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/framework/EntityPropertyColDef.java index 3cbfccd2161..ef55f88b0c9 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/framework/EntityPropertyColDef.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/framework/EntityPropertyColDef.java @@ -22,8 +22,8 @@ import com.google.gwt.user.client.rpc.IsSerializable; import ch.systemsx.cisd.openbis.generic.client.web.client.application.renderer.PropertyTypeRenderer; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityPropertiesHolder; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; /** @@ -97,19 +97,19 @@ public class EntityPropertyColDef<T extends IEntityPropertiesHolder> extends @Override protected final String tryGetValue(T entity) { - for (EntityProperty<?, ?> prop : getProperties(entity)) + for (IEntityProperty prop : getProperties(entity)) { if (isMatching(prop)) { - return prop.getValue(); + return prop.tryGetAsString(); } } return null; } - public EntityProperty<?, ?> tryGetProperty(T entity) + public IEntityProperty tryGetProperty(T entity) { - for (EntityProperty<?, ?> prop : getProperties(entity)) + for (IEntityProperty prop : getProperties(entity)) { if (isMatching(prop)) { @@ -119,14 +119,14 @@ public class EntityPropertyColDef<T extends IEntityPropertiesHolder> extends return null; } - protected List<? extends EntityProperty<?, ?>> getProperties(T entity) + protected List<? extends IEntityProperty> getProperties(T entity) { return entity.getProperties(); } - private boolean isMatching(EntityProperty<?, ?> prop) + private boolean isMatching(IEntityProperty prop) { - PropertyType propType = prop.getEntityTypePropertyType().getPropertyType(); + final PropertyType propType = prop.getPropertyType(); return propType.isInternalNamespace() == isInternalNamespace && propType.getSimpleCode().equals(simpleCode); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/DataSetExperimentPropertyColDef.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/DataSetExperimentPropertyColDef.java index 3e6b9c920d8..054de4b36f2 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/DataSetExperimentPropertyColDef.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/DataSetExperimentPropertyColDef.java @@ -20,8 +20,7 @@ import java.util.List; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.EntityPropertyColDef; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ExternalData; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; public final class DataSetExperimentPropertyColDef extends @@ -41,12 +40,12 @@ public final class DataSetExperimentPropertyColDef extends } @Override - protected List<? extends EntityProperty<?, ?>> getProperties(ExternalData entity) + protected List<? extends IEntityProperty> getProperties(ExternalData entity) { return getExperimentProperties(entity); } - public static List<ExperimentProperty> getExperimentProperties(ExternalData entity) + public static List<IEntityProperty> getExperimentProperties(ExternalData entity) { return entity.getExperiment().getProperties(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/DataSetPropertyColDef.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/DataSetPropertyColDef.java index 56a207972b1..9d5c9c5ed10 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/DataSetPropertyColDef.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/DataSetPropertyColDef.java @@ -20,8 +20,7 @@ import java.util.List; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.EntityPropertyColDef; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ExternalData; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; public final class DataSetPropertyColDef extends EntityPropertyColDef<ExternalData> @@ -40,12 +39,12 @@ public final class DataSetPropertyColDef extends EntityPropertyColDef<ExternalDa } @Override - protected List<? extends EntityProperty<?, ?>> getProperties(ExternalData entity) + protected List<? extends IEntityProperty> getProperties(ExternalData entity) { return getDataSetProperties(entity); } - public static List<DataSetProperty> getDataSetProperties(ExternalData entity) + public static List<IEntityProperty> getDataSetProperties(ExternalData entity) { return entity.getProperties(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/DataSetSamplePropertyColDef.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/DataSetSamplePropertyColDef.java index ac7de681473..5c994665e6b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/DataSetSamplePropertyColDef.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/DataSetSamplePropertyColDef.java @@ -20,9 +20,8 @@ import java.util.List; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.EntityPropertyColDef; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ExternalData; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; public final class DataSetSamplePropertyColDef extends EntityPropertyColDef<ExternalData> { @@ -40,12 +39,12 @@ public final class DataSetSamplePropertyColDef extends EntityPropertyColDef<Exte } @Override - protected List<? extends EntityProperty<?, ?>> getProperties(ExternalData entity) + protected List<? extends IEntityProperty> getProperties(ExternalData entity) { return getSampleProperties(entity); } - public static List<SampleProperty> getSampleProperties(ExternalData entity) + public static List<IEntityProperty> getSampleProperties(ExternalData entity) { return entity.getSampleProperties(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetSearchHitModel.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetSearchHitModel.java index 6f2463cdb81..4586c908b66 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetSearchHitModel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetSearchHitModel.java @@ -30,7 +30,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.Co import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.entity.PropertyTypesFilterUtil; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ExternalData; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; /** @@ -114,12 +114,12 @@ public class DataSetSearchHitModel extends BaseEntityModel<ExternalData> } private static List<PropertyType> extractPropertyTypes( - List<? extends EntityProperty<?, ?>> properties) + List<? extends IEntityProperty> properties) { List<PropertyType> propertyTypes = new ArrayList<PropertyType>(); - for (EntityProperty<?, ?> prop : properties) + for (IEntityProperty prop : properties) { - PropertyType propertyType = prop.getEntityTypePropertyType().getPropertyType(); + PropertyType propertyType = prop.getPropertyType(); propertyTypes.add(propertyType); } return propertyTypes; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property/PropertyGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property/PropertyGrid.java index 5fad0bf1168..e1818b19478 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property/PropertyGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property/PropertyGrid.java @@ -99,8 +99,8 @@ public final class PropertyGrid extends Grid } /** For given <var>clazz</var> registers given <var>propertyValueRenderer</var>. */ - public final <T> void registerPropertyValueRenderer(final Class<T> clazz, - final IPropertyValueRenderer<T> propertyValueRenderer) + public final <V, T extends V> void registerPropertyValueRenderer(final Class<T> clazz, + final IPropertyValueRenderer<V> propertyValueRenderer) { propertyValueRenderers.put(clazz, propertyValueRenderer); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/Experiment.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/Experiment.java index a2da412c7cd..73c10a2b1b5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/Experiment.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/Experiment.java @@ -26,9 +26,9 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Attachment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.CodeWithRegistration; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityPropertiesHolder; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder; import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE; @@ -49,7 +49,7 @@ public class Experiment extends CodeWithRegistration<Experiment> implements IInv private String identifier; - private List<ExperimentProperty> properties; + private List<IEntityProperty> properties; private Invalidation invalidation; @@ -103,12 +103,12 @@ public class Experiment extends CodeWithRegistration<Experiment> implements IInv this.identifier = experimentIdentifier; } - public List<ExperimentProperty> getProperties() + public List<IEntityProperty> getProperties() { return properties; } - public void setProperties(final List<ExperimentProperty> properties) + public void setProperties(final List<IEntityProperty> properties) { this.properties = properties; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/ExternalData.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/ExternalData.java index 54601aca8da..f67b3735edf 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/ExternalData.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/ExternalData.java @@ -24,13 +24,12 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.IEntityInformationHolder; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdentifiable; import ch.systemsx.cisd.openbis.generic.shared.basic.IPermIdHolder; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.CodeWithRegistration; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.FileFormatType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityPropertiesHolder; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SourceType; @@ -83,9 +82,9 @@ public class ExternalData extends CodeWithRegistration<ExternalData> implements private List<ExternalData> children; - private List<SampleProperty> sampleProperties; + private List<IEntityProperty> sampleProperties; - private List<DataSetProperty> dataSetProperties; + private List<IEntityProperty> dataSetProperties; private DataStore dataStore; @@ -158,12 +157,12 @@ public class ExternalData extends CodeWithRegistration<ExternalData> implements this.children = children; } - public List<SampleProperty> getSampleProperties() + public List<IEntityProperty> getSampleProperties() { return sampleProperties; } - private void setSampleProperties(List<SampleProperty> sampleProperties) + private void setSampleProperties(List<IEntityProperty> sampleProperties) { this.sampleProperties = sampleProperties; } @@ -293,12 +292,12 @@ public class ExternalData extends CodeWithRegistration<ExternalData> implements this.experiment = experiment; } - public void setDataSetProperties(List<DataSetProperty> dataSetProperties) + public void setDataSetProperties(List<IEntityProperty> dataSetProperties) { this.dataSetProperties = dataSetProperties; } - public List<DataSetProperty> getProperties() + public List<IEntityProperty> getProperties() { return dataSetProperties; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/Sample.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/Sample.java index f3770cc61eb..75eb30a10d8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/Sample.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/Sample.java @@ -28,9 +28,10 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Attachment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.CodeWithRegistration; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseInstance; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityPropertiesHolder; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder; @@ -59,7 +60,7 @@ public final class Sample extends CodeWithRegistration<Sample> implements IInval private Sample generatedFrom; - private List<SampleProperty> properties; + private List<IEntityProperty> properties; private Invalidation invalidation; @@ -146,13 +147,13 @@ public final class Sample extends CodeWithRegistration<Sample> implements IInval this.generatedFrom = generatedFrom; } - public List<SampleProperty> getProperties() + public List<IEntityProperty> getProperties() { return properties; } - @CollectionMapping(collectionClass = ArrayList.class, elementClass = SampleProperty.class) - public void setProperties(final List<SampleProperty> properties) + @CollectionMapping(collectionClass = ArrayList.class, elementClass = EntityProperty.class) + public void setProperties(final List<IEntityProperty> properties) { this.properties = properties; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/SampleUpdates.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/SampleUpdates.java index c6cc5cb7655..f5373222f6c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/SampleUpdates.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/SampleUpdates.java @@ -21,8 +21,8 @@ import java.util.List; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.BasicSampleUpdates; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAttachment; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder; /** @@ -54,7 +54,7 @@ public class SampleUpdates extends BasicSampleUpdates { } - public SampleUpdates(String sessionKey, TechId sampleId, List<SampleProperty> properties, + public SampleUpdates(String sessionKey, TechId sampleId, List<IEntityProperty> properties, List<NewAttachment> attachments, ExperimentIdentifier experimentIdentifierOrNull, Date version, String sampleIdentifier, String parentIdentifierOrNull, String containerIdentifierOrNull) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/DataSetPropertyTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/DataSetPropertyTranslator.java index 957b1171e2f..6c026eb5532 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/DataSetPropertyTranslator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/DataSetPropertyTranslator.java @@ -22,12 +22,12 @@ import java.util.Set; import org.apache.commons.lang.StringEscapeUtils; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.dto.DataSetPropertyPE; -import ch.systemsx.cisd.openbis.generic.shared.dto.DataSetTypePropertyTypePE; /** - * A {@link DataSetProperty} <---> {@link DataSetPropertyPE} translator. + * A {@link IEntityProperty} <---> {@link DataSetPropertyPE} translator. * * @author Izabela Adamczyk */ @@ -38,27 +38,35 @@ public final class DataSetPropertyTranslator // Can not be instantiated. } - public final static DataSetProperty translate(final DataSetPropertyPE propertyPE) + public final static IEntityProperty translate(final DataSetPropertyPE propertyPE) { - final DataSetProperty result = new DataSetProperty(); - result.setValue(StringEscapeUtils.escapeHtml(propertyPE.tryGetUntypedValue())); - result - .setVocabularyTerm(VocabularyTermTranslator.translate(propertyPE + final DataTypeCode typeCode = PropertyTranslatorUtils.getDataTypeCode(propertyPE); + final IEntityProperty result = PropertyTranslatorUtils.createEntityProperty(typeCode); + result.setPropertyType(PropertyTypeTranslator.translate(propertyPE + .getEntityTypePropertyType().getPropertyType())); + switch (typeCode) + { + case CONTROLLEDVOCABULARY: + result.setVocabularyTerm(VocabularyTermTranslator.translate(propertyPE .getVocabularyTerm())); - result.setMaterial(MaterialTranslator.translate(propertyPE.getMaterialValue(), false)); - result.setEntityTypePropertyType(DataSetTypePropertyTypeTranslator - .translate((DataSetTypePropertyTypePE) propertyPE.getEntityTypePropertyType())); + break; + case MATERIAL: + result.setMaterial(MaterialTranslator.translate(propertyPE.getMaterialValue(), + false)); + break; + default: + result.setValue(StringEscapeUtils.escapeHtml(propertyPE.tryGetUntypedValue())); + } return result; - } - public final static List<DataSetProperty> translate(final Set<DataSetPropertyPE> list) + public final static List<IEntityProperty> translate(final Set<DataSetPropertyPE> list) { if (list == null) { return null; } - final List<DataSetProperty> result = new ArrayList<DataSetProperty>(); + final List<IEntityProperty> result = new ArrayList<IEntityProperty>(); for (final DataSetPropertyPE property : list) { result.add(translate(property)); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/ExperimentPropertyTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/ExperimentPropertyTranslator.java index fc96a200d54..680c559ce5f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/ExperimentPropertyTranslator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/ExperimentPropertyTranslator.java @@ -22,12 +22,12 @@ import java.util.Set; import org.apache.commons.lang.StringEscapeUtils; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPropertyPE; -import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentTypePropertyTypePE; /** - * A {@link ExperimentProperty} <---> {@link ExperimentPropertyPE} translator. + * A {@link IEntityProperty} <---> {@link ExperimentPropertyPE} translator. * * @author Izabela Adamczyk */ @@ -38,28 +38,37 @@ public final class ExperimentPropertyTranslator // Can not be instantiated. } - public final static ExperimentProperty translate(final ExperimentPropertyPE experimentPropertyPE) + public final static IEntityProperty translate(final ExperimentPropertyPE experimentPropertyPE) { - final ExperimentProperty result = new ExperimentProperty(); - result.setValue(StringEscapeUtils.escapeHtml(experimentPropertyPE.tryGetUntypedValue())); - result.setVocabularyTerm(VocabularyTermTranslator.translate(experimentPropertyPE - .getVocabularyTerm())); - result.setMaterial(MaterialTranslator.translate(experimentPropertyPE.getMaterialValue(), - false)); - result.setEntityTypePropertyType(ExperimentTypePropertyTypeTranslator - .translate((ExperimentTypePropertyTypePE) experimentPropertyPE - .getEntityTypePropertyType())); + final DataTypeCode typeCode = PropertyTranslatorUtils.getDataTypeCode(experimentPropertyPE); + final IEntityProperty result = PropertyTranslatorUtils.createEntityProperty(typeCode); + result.setPropertyType(PropertyTypeTranslator.translate(experimentPropertyPE + .getEntityTypePropertyType().getPropertyType())); + switch (typeCode) + { + case CONTROLLEDVOCABULARY: + result.setVocabularyTerm(VocabularyTermTranslator.translate(experimentPropertyPE + .getVocabularyTerm())); + break; + case MATERIAL: + result.setMaterial(MaterialTranslator.translate( + experimentPropertyPE.getMaterialValue(), false)); + break; + default: + result + .setValue(StringEscapeUtils.escapeHtml(experimentPropertyPE + .tryGetUntypedValue())); + } return result; - } - public final static List<ExperimentProperty> translate(final Set<ExperimentPropertyPE> list) + public final static List<IEntityProperty> translate(final Set<ExperimentPropertyPE> list) { if (list == null) { return null; } - final List<ExperimentProperty> result = new ArrayList<ExperimentProperty>(); + final List<IEntityProperty> result = new ArrayList<IEntityProperty>(); for (final ExperimentPropertyPE experimentProperty : list) { result.add(translate(experimentProperty)); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/ExperimentTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/ExperimentTranslator.java index 968d9b5cc59..6b2c1fb8b8c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/ExperimentTranslator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/ExperimentTranslator.java @@ -23,8 +23,8 @@ import org.apache.commons.lang.StringEscapeUtils; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Experiment; import ch.systemsx.cisd.openbis.generic.shared.basic.PermlinkUtilities; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE; import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentTypePE; import ch.systemsx.cisd.openbis.generic.shared.util.HibernateUtils; @@ -92,7 +92,7 @@ public final class ExperimentTranslator result.setProperties(ExperimentPropertyTranslator.translate(experiment.getProperties())); } else { - result.setProperties(new ArrayList<ExperimentProperty>()); + result.setProperties(new ArrayList<IEntityProperty>()); } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/ExternalDataTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/ExternalDataTranslator.java index 31f1e95e1bd..ffe7b6a39d2 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/ExternalDataTranslator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/ExternalDataTranslator.java @@ -28,8 +28,8 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Sample; import ch.systemsx.cisd.openbis.generic.client.web.server.translator.ExperimentTranslator.LoadableFields; import ch.systemsx.cisd.openbis.generic.shared.basic.IEntityInformationHolder; import ch.systemsx.cisd.openbis.generic.shared.basic.PermlinkUtilities; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE; import ch.systemsx.cisd.openbis.generic.shared.dto.ExternalDataPE; @@ -113,7 +113,7 @@ public class ExternalDataTranslator .getProperties())); } else { - externalData.setDataSetProperties(new ArrayList<DataSetProperty>()); + externalData.setDataSetProperties(new ArrayList<IEntityProperty>()); } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/MaterialPropertyTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/MaterialPropertyTranslator.java index 66570634a84..8b7b5e2f49b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/MaterialPropertyTranslator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/MaterialPropertyTranslator.java @@ -22,13 +22,13 @@ import java.util.Set; import org.apache.commons.lang.StringEscapeUtils; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPropertyPE; import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialPropertyPE; -import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialTypePropertyTypePE; /** - * A {@link MaterialProperty} <---> {@link ExperimentPropertyPE} translator. + * A {@link IEntityProperty} <---> {@link ExperimentPropertyPE} translator. * * @author Izabela Adamczyk */ @@ -39,28 +39,35 @@ public final class MaterialPropertyTranslator // Can not be instantiated. } - public final static MaterialProperty translate(final MaterialPropertyPE materialPropertyPE) + public final static IEntityProperty translate(final MaterialPropertyPE materialPropertyPE) { - final MaterialProperty result = new MaterialProperty(); - result.setValue(StringEscapeUtils.escapeHtml(materialPropertyPE.tryGetUntypedValue())); - result.setVocabularyTerm(VocabularyTermTranslator.translate(materialPropertyPE - .getVocabularyTerm())); - result.setMaterial(MaterialTranslator.translate(materialPropertyPE.getMaterialValue(), - false)); - result.setEntityTypePropertyType(MaterialTypePropertyTypeTranslator - .translate((MaterialTypePropertyTypePE) materialPropertyPE - .getEntityTypePropertyType())); + final DataTypeCode typeCode = PropertyTranslatorUtils.getDataTypeCode(materialPropertyPE); + final IEntityProperty result = PropertyTranslatorUtils.createEntityProperty(typeCode); + result.setPropertyType(PropertyTypeTranslator.translate(materialPropertyPE + .getEntityTypePropertyType().getPropertyType())); + switch (typeCode) + { + case CONTROLLEDVOCABULARY: + result.setVocabularyTerm(VocabularyTermTranslator.translate(materialPropertyPE + .getVocabularyTerm())); + break; + case MATERIAL: + result.setMaterial(MaterialTranslator.translate(materialPropertyPE.getMaterialValue(), + false)); + break; + default: + result.setValue(StringEscapeUtils.escapeHtml(materialPropertyPE.tryGetUntypedValue())); + } return result; - } - public final static List<MaterialProperty> translate(final Set<MaterialPropertyPE> list) + public final static List<IEntityProperty> translate(final Set<MaterialPropertyPE> list) { if (list == null) { return null; } - final List<MaterialProperty> result = new ArrayList<MaterialProperty>(); + final List<IEntityProperty> result = new ArrayList<IEntityProperty>(); for (final MaterialPropertyPE materialProperty : list) { result.add(translate(materialProperty)); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/MaterialTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/MaterialTranslator.java index 63f11c503cf..84e69d3c833 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/MaterialTranslator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/MaterialTranslator.java @@ -21,8 +21,8 @@ import java.util.List; import org.apache.commons.lang.StringEscapeUtils; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialPE; import ch.systemsx.cisd.openbis.generic.shared.util.HibernateUtils; @@ -84,7 +84,7 @@ public final class MaterialTranslator .getProperties())); } else { - result.setProperties(new ArrayList<MaterialProperty>()); + result.setProperties(new ArrayList<IEntityProperty>()); } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/PropertyTranslatorUtils.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/PropertyTranslatorUtils.java new file mode 100644 index 00000000000..a9cb286713a --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/PropertyTranslatorUtils.java @@ -0,0 +1,96 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.generic.client.web.server.translator; + +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericValueEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialValueEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermValueEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.dto.DataSetPropertyPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePropertyTypePE; +import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPropertyPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialPropertyPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePropertyPE; + +/** + * Some utility methods for entity property translations. + * + * @author Bernd Rinn + */ +final class PropertyTranslatorUtils +{ + + private PropertyTranslatorUtils() + { + // cannot be instantiated. + } + + private static DataTypeCode translateDataTypeCode(EntityTypePropertyTypePE etpt) + { + return DataTypeCode.valueOf(etpt.getPropertyType().getType().getCode().name()); + } + + /** + * Returns the {@link DataTypeCode} for the given <var>property</var>. + */ + static DataTypeCode getDataTypeCode(SamplePropertyPE property) + { + return translateDataTypeCode(property.getEntityTypePropertyType()); + } + + /** + * Returns the {@link DataTypeCode} for the given <var>property</var>. + */ + static DataTypeCode getDataTypeCode(MaterialPropertyPE property) + { + return translateDataTypeCode(property.getEntityTypePropertyType()); + } + + /** + * Returns the {@link DataTypeCode} for the given <var>property</var>. + */ + static DataTypeCode getDataTypeCode(ExperimentPropertyPE property) + { + return translateDataTypeCode(property.getEntityTypePropertyType()); + } + + /** + * Returns the {@link DataTypeCode} for the given <var>property</var>. + */ + static DataTypeCode getDataTypeCode(DataSetPropertyPE property) + { + return translateDataTypeCode(property.getEntityTypePropertyType()); + } + + /** + * Creates an appropriate {@link IEntityProperty} for the given <var>dataTypeCode</var>. + */ + static IEntityProperty createEntityProperty(DataTypeCode dataTypeCode) + { + switch (dataTypeCode) + { + case CONTROLLEDVOCABULARY: + return new VocabularyTermValueEntityProperty(); + case MATERIAL: + return new MaterialValueEntityProperty(); + default: + return new GenericValueEntityProperty(); + } + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/SamplePropertyTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/SamplePropertyTranslator.java index 464ef8b77bb..b0ff8b39b28 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/SamplePropertyTranslator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/SamplePropertyTranslator.java @@ -22,12 +22,12 @@ import java.util.Set; import org.apache.commons.lang.StringEscapeUtils; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePropertyPE; -import ch.systemsx.cisd.openbis.generic.shared.dto.SampleTypePropertyTypePE; /** - * A {@link SampleProperty} <---> {@link SamplePropertyPE} translator. + * A {@link IEntityProperty} <---> {@link SamplePropertyPE} translator. * * @author Franz-Josef Elmer */ @@ -38,30 +38,37 @@ public final class SamplePropertyTranslator // Can not be instantiated. } - public final static SampleProperty translate(final SamplePropertyPE samplePropertyPE) + public final static IEntityProperty translate(final SamplePropertyPE samplePropertyPE) { - final SampleProperty result = new SampleProperty(); - result.setValue(StringEscapeUtils.escapeHtml(samplePropertyPE.tryGetUntypedValue())); - result.setVocabularyTerm(VocabularyTermTranslator.translate(samplePropertyPE - .getVocabularyTerm())); - result - .setMaterial(MaterialTranslator.translate(samplePropertyPE.getMaterialValue(), - false)); - result - .setEntityTypePropertyType(SampleTypePropertyTypeTranslator - .translate((SampleTypePropertyTypePE) samplePropertyPE - .getEntityTypePropertyType())); + final DataTypeCode typeCode = PropertyTranslatorUtils.getDataTypeCode(samplePropertyPE); + final IEntityProperty result = PropertyTranslatorUtils.createEntityProperty(typeCode); + result.setPropertyType(PropertyTypeTranslator.translate(samplePropertyPE + .getEntityTypePropertyType().getPropertyType())); + switch (typeCode) + { + case CONTROLLEDVOCABULARY: + result.setVocabularyTerm(VocabularyTermTranslator.translate(samplePropertyPE + .getVocabularyTerm())); + break; + case MATERIAL: + result.setMaterial(MaterialTranslator.translate( + samplePropertyPE.getMaterialValue(), false)); + break; + default: + result + .setValue(StringEscapeUtils.escapeHtml(samplePropertyPE + .tryGetUntypedValue())); + } return result; - } - public final static List<SampleProperty> translate(final Set<SamplePropertyPE> set) + public final static List<IEntityProperty> translate(final Set<SamplePropertyPE> set) { if (set == null) { return null; } - final List<SampleProperty> result = new ArrayList<SampleProperty>(); + final List<IEntityProperty> result = new ArrayList<IEntityProperty>(); for (final SamplePropertyPE samplePropertyPE : set) { result.add(translate(samplePropertyPE)); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/SampleTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/SampleTranslator.java index 0d861806cde..3472251a833 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/SampleTranslator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/translator/SampleTranslator.java @@ -26,7 +26,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.dto.SampleGeneration; import ch.systemsx.cisd.openbis.generic.shared.basic.PermlinkUtilities; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Attachment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.dto.SampleGenerationDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE; import ch.systemsx.cisd.openbis.generic.shared.util.HibernateUtils; @@ -126,7 +126,7 @@ public final class SampleTranslator result.setProperties(SamplePropertyTranslator.translate(samplePE.getProperties())); } else { - result.setProperties(new ArrayList<SampleProperty>()); + result.setProperties(new ArrayList<IEntityProperty>()); } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java index f26e17ccbe2..8378b978ad9 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java @@ -22,8 +22,8 @@ import java.util.Map; import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.openbis.generic.server.business.bo.util.SampleOwner; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE; import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectPE; import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE; @@ -60,7 +60,7 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi } private final void defineSampleProperties(final SamplePE sample, - final SampleProperty[] sampleProperties) + final IEntityProperty[] sampleProperties) { final String sampleTypeCode = sample.getSampleType().getCode(); final List<SamplePropertyPE> properties = diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityPropertiesConverter.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityPropertiesConverter.java index ddb4bf4beea..d5e20af91e7 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityPropertiesConverter.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityPropertiesConverter.java @@ -31,8 +31,7 @@ import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory; import ch.systemsx.cisd.openbis.generic.server.util.IPropertyValueValidator; import ch.systemsx.cisd.openbis.generic.server.util.KeyExtractorFactory; import ch.systemsx.cisd.openbis.generic.server.util.PropertyValidator; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityTypePropertyType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialIdentifier; import ch.systemsx.cisd.openbis.generic.shared.dto.EntityPropertyPE; import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePE; @@ -189,12 +188,11 @@ public final class EntityPropertiesConverter implements IEntityPropertiesConvert } private final <T extends EntityPropertyPE> T tryConvertProperty(final PersonPE registrator, - final EntityTypePE entityTypePE, final EntityProperty<?, ?> property) + final EntityTypePE entityTypePE, final IEntityProperty property) { - EntityTypePropertyType<?> entityTypePropertyType = property.getEntityTypePropertyType(); - final String propertyCode = entityTypePropertyType.getPropertyType().getCode(); + final String propertyCode = property.getPropertyType().getCode(); final PropertyTypePE propertyType = getPropertyType(propertyCode); - final String valueOrNull = property.getValue(); + final String valueOrNull = property.tryGetAsString(); final EntityTypePropertyTypePE entityTypePropertyTypePE = getEntityTypePropertyType(entityTypePE, propertyType); if (entityTypePropertyTypePE.isMandatory() && valueOrNull == null) @@ -229,15 +227,15 @@ public final class EntityPropertiesConverter implements IEntityPropertiesConvert // private final <T extends EntityPropertyPE> List<T> convertProperties( - final List<? extends EntityProperty<?, ?>> properties, final String entityTypeCode, + final List<? extends IEntityProperty> properties, final String entityTypeCode, final PersonPE registrator) { - EntityProperty<?, ?>[] propsArray = properties.toArray(new EntityProperty<?, ?>[0]); + IEntityProperty[] propsArray = properties.toArray(new IEntityProperty[0]); return convertProperties(propsArray, entityTypeCode, registrator); } public final <T extends EntityPropertyPE> List<T> convertProperties( - final EntityProperty<?, ?>[] properties, final String entityTypeCode, + final IEntityProperty[] properties, final String entityTypeCode, final PersonPE registrator) { assert entityTypeCode != null : "Unspecified entity type code."; @@ -245,7 +243,7 @@ public final class EntityPropertiesConverter implements IEntityPropertiesConvert assert properties != null : "Unspecified entity properties"; final EntityTypePE entityTypePE = getEntityType(entityTypeCode); final List<T> list = new ArrayList<T>(); - for (final EntityProperty<?, ?> property : properties) + for (final IEntityProperty property : properties) { final T convertedPropertyOrNull = tryConvertProperty(registrator, entityTypePE, property); @@ -328,7 +326,7 @@ public final class EntityPropertiesConverter implements IEntityPropertiesConvert return null; } - public <T extends EntityPropertyPE, P extends EntityProperty<?, ?>> Set<T> updateProperties( + public <T extends EntityPropertyPE, P extends IEntityProperty> Set<T> updateProperties( Collection<T> oldProperties, EntityTypePE entityType, List<P> newProperties, PersonPE registrator) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBO.java index c7d21273831..2926f9dba72 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBO.java @@ -32,9 +32,8 @@ import ch.systemsx.cisd.openbis.generic.server.dataaccess.IAttachmentDAO; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory; import ch.systemsx.cisd.openbis.generic.server.dataaccess.ISampleDAO; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; import ch.systemsx.cisd.openbis.generic.shared.dto.AttachmentPE; import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePE; import ch.systemsx.cisd.openbis.generic.shared.dto.EventPE; @@ -105,7 +104,7 @@ public final class ExperimentBO extends AbstractBusinessObject implements IExper } @SuppressWarnings("unused") - private final void defineSampleProperties(final SampleProperty[] experimentProperties) + private final void defineSampleProperties(final IEntityProperty[] experimentProperties) { final String experimentTypeCode = experiment.getExperimentType().getCode(); final List<ExperimentPropertyPE> properties = @@ -349,7 +348,7 @@ public final class ExperimentBO extends AbstractBusinessObject implements IExper } private final void defineExperimentProperties(final String experimentTypeCode, - final ExperimentProperty[] experimentProperties, PersonPE registrator) + final IEntityProperty[] experimentProperties, PersonPE registrator) { final List<ExperimentPropertyPE> properties = propertiesConverter.convertProperties(experimentProperties, experimentTypeCode, @@ -543,7 +542,7 @@ public final class ExperimentBO extends AbstractBusinessObject implements IExper } @Private - void updateProperties(List<ExperimentProperty> properties) + void updateProperties(List<IEntityProperty> properties) { final Set<ExperimentPropertyPE> existingProperties = experiment.getProperties(); final ExperimentTypePE type = experiment.getExperimentType(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataBO.java index a577d175818..8349a41e761 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataBO.java @@ -26,8 +26,8 @@ import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IExternalDataDAO; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IVocabularyDAO; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetTypePropertyType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SourceType; import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; @@ -257,7 +257,7 @@ public class ExternalDataBO extends AbstractExternalDataBusinessObject implement } public void update(TechId datasetId, SampleIdentifier sampleIdentifier, - List<DataSetProperty> properties, Date version) + List<IEntityProperty> properties, Date version) { loadDataByTechId(datasetId); if (version.equals(externalData.getModificationDate()) == false) @@ -276,7 +276,7 @@ public class ExternalDataBO extends AbstractExternalDataBusinessObject implement getExternalDataDAO().validateAndSaveUpdatedEntity(externalData); } - private void updateProperties(List<DataSetProperty> properties) + private void updateProperties(List<IEntityProperty> properties) { final Set<DataSetPropertyPE> existingProperties = externalData.getProperties(); final EntityTypePE type = externalData.getDataSetType(); @@ -319,7 +319,7 @@ public class ExternalDataBO extends AbstractExternalDataBusinessObject implement } private final void defineDataSetProperties(final ExternalDataPE data, - final DataSetProperty[] newProperties) + final IEntityProperty[] newProperties) { final String dataSetTypeCode = data.getDataSetType().getCode(); final List<DataSetPropertyPE> properties = @@ -331,9 +331,9 @@ public class ExternalDataBO extends AbstractExternalDataBusinessObject implement } } - private static DataSetProperty[] convertToDataSetProperties(List<NewProperty> list) + private static IEntityProperty[] convertToDataSetProperties(List<NewProperty> list) { - DataSetProperty[] result = new DataSetProperty[list.size()]; + IEntityProperty[] result = new IEntityProperty[list.size()]; for (int i = 0; i < list.size(); i++) { result[i] = convertProperty(list.get(i)); @@ -341,15 +341,13 @@ public class ExternalDataBO extends AbstractExternalDataBusinessObject implement return result; } - private static DataSetProperty convertProperty(NewProperty newProperty) + private static IEntityProperty convertProperty(NewProperty newProperty) { - DataSetProperty result = new DataSetProperty(); + IEntityProperty result = new EntityProperty(); result.setValue(newProperty.getValue()); - DataSetTypePropertyType etpt = new DataSetTypePropertyType(); PropertyType propertyType = new PropertyType(); propertyType.setCode(newProperty.getPropertyCode()); - etpt.setPropertyType(propertyType); - result.setEntityTypePropertyType(etpt); + result.setPropertyType(propertyType); return result; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IEntityPropertiesConverter.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IEntityPropertiesConverter.java index 65abd92e18b..0c18df35e4d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IEntityPropertiesConverter.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IEntityPropertiesConverter.java @@ -21,7 +21,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.dto.EntityPropertyPE; import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePE; import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePropertyTypePE; @@ -29,7 +29,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; import ch.systemsx.cisd.openbis.generic.shared.dto.PropertyTypePE; /** - * Converter between {@link EntityProperty} and {@link EntityPropertyPE}. + * Converter between {@link IEntityProperty} and {@link EntityPropertyPE}. * * @author Christian Ribeaud */ @@ -37,13 +37,13 @@ public interface IEntityPropertiesConverter { /** - * Converts the set of {@link EntityProperty} objects obtained from the specified entity to an + * Converts the set of {@link IEntityProperty} objects obtained from the specified entity to an * array of {@link EntityPropertyPE} objects. * * @param registrator Will appear in the objects of the output. */ public <T extends EntityPropertyPE> List<T> convertProperties( - final EntityProperty<?, ?>[] properties, final String entityTypeCode, + final IEntityProperty[] properties, final String entityTypeCode, final PersonPE registrator); /** @@ -54,7 +54,7 @@ public interface IEntityPropertiesConverter String value); /** Updates Set<T> of properties. */ - public <T extends EntityPropertyPE, P extends EntityProperty<?, ?>> Set<T> updateProperties( + public <T extends EntityPropertyPE, P extends IEntityProperty> Set<T> updateProperties( Collection<T> oldProperties, EntityTypePE entityType, List<P> newProperties, PersonPE registrator); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IExternalDataBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IExternalDataBO.java index b93f54de1d2..6abacf17d87 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IExternalDataBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IExternalDataBO.java @@ -20,7 +20,7 @@ import java.util.Date; import java.util.List; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SourceType; import ch.systemsx.cisd.openbis.generic.shared.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.dto.ExternalDataPE; @@ -49,7 +49,7 @@ public interface IExternalDataBO extends IEntityBusinessObject * Changes given data set. Currently allowed changes: properties, sample. */ public void update(TechId datasetId, SampleIdentifier sampleIdentifier, - List<DataSetProperty> properties, Date version); + List<IEntityProperty> properties, Date version); /** * Loads the external data item with specified code. diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IMaterialBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IMaterialBO.java index c94e392cbf3..24d5116e1ec 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IMaterialBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IMaterialBO.java @@ -20,8 +20,8 @@ import java.util.Date; import java.util.List; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialIdentifier; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialPE; /** @@ -44,5 +44,5 @@ public interface IMaterialBO extends IEntityBusinessObject /** * Changes given material. Currently allowed changes: properties. */ - public void update(TechId techId, List<MaterialProperty> properties, Date version); + public void update(TechId techId, List<IEntityProperty> properties, Date version); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialBO.java index f91a1ce0852..64d372b6192 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialBO.java @@ -27,8 +27,8 @@ import ch.rinn.restrictions.Private; import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialIdentifier; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePE; import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialPE; import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialPropertyPE; @@ -134,7 +134,7 @@ public final class MaterialBO extends AbstractBusinessObject implements IMateria .getMaterialType()); } - public void update(TechId materialId, List<MaterialProperty> properties, Date version) + public void update(TechId materialId, List<IEntityProperty> properties, Date version) { loadDataByTechId(materialId); if (version.equals(material.getModificationDate()) == false) @@ -145,7 +145,7 @@ public final class MaterialBO extends AbstractBusinessObject implements IMateria dataChanged = true; } - private void updateProperties(List<MaterialProperty> properties) + private void updateProperties(List<IEntityProperty> properties) { final Set<MaterialPropertyPE> existingProperties = material.getProperties(); final EntityTypePE type = material.getMaterialType(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialTable.java index 186ea16dd54..12e6b4f75e1 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialTable.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialTable.java @@ -26,7 +26,7 @@ import org.springframework.dao.DataAccessException; import ch.rinn.restrictions.Private; import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewMaterial; import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePE; import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePropertyTypePE; @@ -155,7 +155,7 @@ public final class MaterialTable extends AbstractBusinessObject implements IMate } private final void defineMaterialProperties(final MaterialPE material, - final MaterialProperty[] materialProperties) + final IEntityProperty[] materialProperties) { final String materialTypeCode = material.getMaterialType().getCode(); final List<MaterialPropertyPE> properties = diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBO.java index ad76aface75..fa230482521 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBO.java @@ -28,8 +28,8 @@ import ch.systemsx.cisd.openbis.generic.server.business.bo.util.SampleUtils; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IAttachmentDAO; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; import ch.systemsx.cisd.openbis.generic.shared.dto.AttachmentPE; import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePE; @@ -395,7 +395,7 @@ public final class SampleBO extends AbstractSampleBusinessObject implements ISam .equals(newExperimentOrNull); } - private void updateProperties(List<SampleProperty> properties) + private void updateProperties(List<IEntityProperty> properties) { final Set<SamplePropertyPE> existingProperties = sample.getProperties(); final EntityTypePE type = sample.getSampleType(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AbstractEntityProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AbstractEntityProperty.java new file mode 100644 index 00000000000..67dde3f00aa --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AbstractEntityProperty.java @@ -0,0 +1,102 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.generic.shared.basic.dto; + +/** + * The abstract base implementation of {@link IEntityProperty}, only featuring a + * {@link PropertyType}. + * <p> + * All getters (except {@link #getPropertyType()} will return <code>null</code>, all setters (except + * {@link #setPropertyType(PropertyType)} will throw an {@link UnsupportedOperationException}. + * + * @author Bernd Rinn + */ +public abstract class AbstractEntityProperty implements IEntityProperty +{ + + private static final long serialVersionUID = ServiceVersionHolder.VERSION; + + private PropertyType propertyType; + + public PropertyType getPropertyType() + { + return propertyType; + } + + public void setPropertyType(PropertyType propertyType) + { + this.propertyType = propertyType; + } + + public String tryGetAsString() + { + if (propertyType == null) + { + return null; + } + switch (propertyType.getDataType().getCode()) + { + case CONTROLLEDVOCABULARY: + return (getVocabularyTerm() != null) ? getVocabularyTerm().getCode() : getValue(); + case MATERIAL: + return (getMaterial() != null) ? MaterialIdentifier.print(getMaterial().getCode(), + getMaterial().getMaterialType().getCode()) : getValue(); + default: + return getValue(); + } + } + + public String getValue() + { + return null; + } + + public void setValue(String value) + { + throw new UnsupportedOperationException(); + } + + public Material getMaterial() + { + return null; + } + + public void setMaterial(Material material) + { + throw new UnsupportedOperationException(); + } + + public VocabularyTerm getVocabularyTerm() + { + return null; + } + + public void setVocabularyTerm(VocabularyTerm vocabularyTerm) + { + throw new UnsupportedOperationException(); + } + + // + // Comparable + // + + public int compareTo(IEntityProperty o) + { + return this.getPropertyType().getLabel().compareTo(o.getPropertyType().getLabel()); + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/BasicExperimentUpdates.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/BasicExperimentUpdates.java index e675447048c..4cbfa45f50b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/BasicExperimentUpdates.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/BasicExperimentUpdates.java @@ -34,7 +34,7 @@ public class BasicExperimentUpdates implements IsSerializable, Serializable // ----- the data which should be changed: // new set of properties for the experiment, they will replace the old set - private List<ExperimentProperty> properties; + private List<IEntityProperty> properties; // New set of sample codes which will replace the old ones. In this way some // samples can be unassigned and some assigned as a result. It will be assumed that @@ -62,12 +62,12 @@ public class BasicExperimentUpdates implements IsSerializable, Serializable this.version = version; } - public List<ExperimentProperty> getProperties() + public List<IEntityProperty> getProperties() { return properties; } - public void setProperties(List<ExperimentProperty> properties) + public void setProperties(List<IEntityProperty> properties) { this.properties = properties; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/BasicSampleUpdates.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/BasicSampleUpdates.java index ac403844ab9..65b10d24e1e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/BasicSampleUpdates.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/BasicSampleUpdates.java @@ -34,7 +34,7 @@ public class BasicSampleUpdates implements IsSerializable, Serializable private TechId sampleId; - private List<SampleProperty> properties; + private List<IEntityProperty> properties; private Date version; @@ -66,7 +66,7 @@ public class BasicSampleUpdates implements IsSerializable, Serializable { } - public BasicSampleUpdates(TechId sampleId, List<SampleProperty> properties, Date version, + public BasicSampleUpdates(TechId sampleId, List<IEntityProperty> properties, Date version, String parentIdentifierOrNull, String containerIdentifierOrNull) { this.sampleId = sampleId; @@ -86,12 +86,12 @@ public class BasicSampleUpdates implements IsSerializable, Serializable this.sampleId = sampleId; } - public List<SampleProperty> getProperties() + public List<IEntityProperty> getProperties() { return properties; } - public void setProperties(List<SampleProperty> properties) + public void setProperties(List<IEntityProperty> properties) { this.properties = properties; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityProperty.java index 86432d1c996..232b5e9613f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityProperty.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityProperty.java @@ -16,75 +16,41 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; -import java.io.Serializable; - -import com.google.gwt.user.client.rpc.IsSerializable; - /** - * An <i>abstract</i> entity property. + * The generic entity property. * * @author Christian Ribeaud */ -public abstract class EntityProperty<T extends EntityType, P extends EntityTypePropertyType<T>> - implements IsSerializable, Comparable<EntityProperty<T, P>>, Serializable +public class EntityProperty extends GenericValueEntityProperty { private static final long serialVersionUID = ServiceVersionHolder.VERSION; - private String value; - private VocabularyTerm vocabularyTermOrNull; private Material materialOrNull; - private P entityTypePropertyType; - + @Override public Material getMaterial() { return materialOrNull; } + @Override public void setMaterial(Material material) { this.materialOrNull = material; } + @Override public VocabularyTerm getVocabularyTerm() { return vocabularyTermOrNull; } + @Override public void setVocabularyTerm(VocabularyTerm vocabularyTerm) { this.vocabularyTermOrNull = vocabularyTerm; } - public final String getValue() - { - return value; - } - - public final void setValue(final String value) - { - this.value = value; - } - - public final P getEntityTypePropertyType() - { - return entityTypePropertyType; - } - - public final void setEntityTypePropertyType(final P entityTypePropertyType) - { - this.entityTypePropertyType = entityTypePropertyType; - } - - // - // Comparable - // - - public int compareTo(EntityProperty<T, P> o) - { - return this.getEntityTypePropertyType().getPropertyType().getLabel().compareTo( - o.getEntityTypePropertyType().getPropertyType().getLabel()); - } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ExperimentProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ExperimentProperty.java deleted file mode 100644 index 60bf66d5c9d..00000000000 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ExperimentProperty.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2008 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.generic.shared.basic.dto; - -import com.google.gwt.user.client.rpc.IsSerializable; - -/** - * The {@link EntityProperty} extension for <i>Experiment</i>. - * - * @author Izabela Adamczyk - */ -public final class ExperimentProperty extends - EntityProperty<ExperimentType, ExperimentTypePropertyType> implements IsSerializable -{ - private static final long serialVersionUID = ServiceVersionHolder.VERSION; - - public static final ExperimentProperty[] EMPTY_ARRAY = new ExperimentProperty[0]; -} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSetProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/GenericValueEntityProperty.java similarity index 61% rename from openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSetProperty.java rename to openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/GenericValueEntityProperty.java index fd3ee2b60db..0d71fd28781 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSetProperty.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/GenericValueEntityProperty.java @@ -1,5 +1,5 @@ /* - * Copyright 2008 ETH Zuerich, CISD + * Copyright 2009 ETH Zuerich, CISD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,19 +16,29 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; -import java.io.Serializable; - -import com.google.gwt.user.client.rpc.IsSerializable; - /** - * The {@link EntityProperty} extension for <i>Data Set Property</i>. + * A {@link IEntityProperty} class that only stores the generic value, but not a vocabulary term + * value or a material value. * - * @author Izabela Adamczyk + * @author Bernd Rinn */ -public final class DataSetProperty extends EntityProperty<DataSetType, DataSetTypePropertyType> - implements IsSerializable, Serializable +public class GenericValueEntityProperty extends AbstractEntityProperty { + private static final long serialVersionUID = ServiceVersionHolder.VERSION; - public static final DataSetProperty[] EMPTY_ARRAY = new DataSetProperty[0]; + private String value; + + @Override + public String getValue() + { + return value; + } + + @Override + public void setValue(String value) + { + this.value = value; + } + } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IEntityPropertiesHolder.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IEntityPropertiesHolder.java index 0eea24df08a..9f07ffb3ccc 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IEntityPropertiesHolder.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IEntityPropertiesHolder.java @@ -26,5 +26,5 @@ import java.util.List; */ public interface IEntityPropertiesHolder { - List<? extends EntityProperty<?, ?>> getProperties(); + List<? extends IEntityProperty> getProperties(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IEntityProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IEntityProperty.java new file mode 100644 index 00000000000..d8f74b5a6b2 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IEntityProperty.java @@ -0,0 +1,54 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.generic.shared.basic.dto; + +import java.io.Serializable; + +import com.google.gwt.user.client.rpc.IsSerializable; + +/** + * An interface for entity properties. + * + * @author Bernd Rinn + */ +public interface IEntityProperty extends Serializable, IsSerializable, Comparable<IEntityProperty> +{ + public static final IEntityProperty[] EMPTY_ARRAY = new IEntityProperty[0]; + + /** + * Returns a string representation of whatever value this property represents. Vocabulary terms + * will be represented as their CODE, material values will be represented as "CODE (TYPE_CODE)". + */ + public String tryGetAsString(); + + public Material getMaterial(); + + public void setMaterial(Material material); + + public VocabularyTerm getVocabularyTerm(); + + public void setVocabularyTerm(VocabularyTerm vocabularyTerm); + + public String getValue(); + + public void setValue(final String value); + + public PropertyType getPropertyType(); + + public void setPropertyType(final PropertyType propertyType); + +} \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Material.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Material.java index d0843daa7b0..6e36dd9b3cf 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Material.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Material.java @@ -41,7 +41,7 @@ public class Material extends CodeWithRegistration<Material> implements IEntityI private Date modificationDate; - private List<MaterialProperty> properties; + private List<IEntityProperty> properties; public MaterialType getMaterialType() { @@ -53,12 +53,12 @@ public class Material extends CodeWithRegistration<Material> implements IEntityI this.MaterialType = experimentType; } - public List<MaterialProperty> getProperties() + public List<IEntityProperty> getProperties() { return properties; } - public void setProperties(List<MaterialProperty> properties) + public void setProperties(List<IEntityProperty> properties) { this.properties = properties; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialIdentifier.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialIdentifier.java index 8174ce5cd89..0841564452f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialIdentifier.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialIdentifier.java @@ -110,7 +110,13 @@ public final class MaterialIdentifier implements IsSerializable, Serializable /** Prints the identifier in the canonical form */ public String print() { - return getCode() + TYPE_SEPARATOR_PREFIX + getTypeCode() + TYPE_SEPARATOR_SUFFIX; + return print(getCode(), getTypeCode()); + } + + /** Prints the identifier in the canonical form */ + public static String print(String code, String typeCode) + { + return code + TYPE_SEPARATOR_PREFIX + typeCode + TYPE_SEPARATOR_SUFFIX; } // diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialProperty.java deleted file mode 100644 index 4c0398a511b..00000000000 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialProperty.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2008 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.generic.shared.basic.dto; - -import java.io.Serializable; - -import com.google.gwt.user.client.rpc.IsSerializable; - -/** - * The {@link EntityProperty} extension for <i>Material</i>. - * - * @author Izabela Adamczyk - */ -public final class MaterialProperty extends EntityProperty<MaterialType, MaterialTypePropertyType> - implements IsSerializable, Serializable -{ - private static final long serialVersionUID = ServiceVersionHolder.VERSION; - - public static final MaterialProperty[] EMPTY_ARRAY = new MaterialProperty[0]; -} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialValueEntityProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialValueEntityProperty.java new file mode 100644 index 00000000000..0bbce1bdcb1 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialValueEntityProperty.java @@ -0,0 +1,55 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.generic.shared.basic.dto; + +/** + * A {@link IEntityProperty} class that only stores the material value, but not a generic value or a + * vocabulary term value. + * + * @author Bernd Rinn + */ +public class MaterialValueEntityProperty extends AbstractEntityProperty +{ + private static final long serialVersionUID = ServiceVersionHolder.VERSION; + + private Material materialOrNull; + + @Override + public void setPropertyType(PropertyType propertyType) + { + if (DataTypeCode.MATERIAL.equals(propertyType.getDataType().getCode()) == false) + { + throw new IllegalArgumentException( + "Only property types with data type MATERIAL supported, found '" + + propertyType.getDataType().getCode() + "'."); + } + super.setPropertyType(propertyType); + } + + @Override + public Material getMaterial() + { + return materialOrNull; + } + + @Override + public void setMaterial(Material material) + { + this.materialOrNull = material; + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewExperiment.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewExperiment.java index 909962e0768..ae6121a8e8f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewExperiment.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewExperiment.java @@ -31,7 +31,7 @@ public final class NewExperiment extends Identifier<NewExperiment> private String[] samples = new String[0]; - private ExperimentProperty[] properties = ExperimentProperty.EMPTY_ARRAY; + private IEntityProperty[] properties = IEntityProperty.EMPTY_ARRAY; private SampleType sampleType = null; @@ -63,12 +63,12 @@ public final class NewExperiment extends Identifier<NewExperiment> this.experimentTypeCode = experimentTypeCode; } - public final ExperimentProperty[] getProperties() + public final IEntityProperty[] getProperties() { return properties; } - public final void setProperties(final ExperimentProperty[] properties) + public final void setProperties(final IEntityProperty[] properties) { this.properties = properties; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewMaterial.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewMaterial.java index ca5e4421354..6856826b75c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewMaterial.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewMaterial.java @@ -25,7 +25,7 @@ public final class NewMaterial extends Code<NewMaterial> { private static final long serialVersionUID = ServiceVersionHolder.VERSION; - private MaterialProperty[] properties = MaterialProperty.EMPTY_ARRAY; + private IEntityProperty[] properties = IEntityProperty.EMPTY_ARRAY; public NewMaterial() { @@ -36,12 +36,12 @@ public final class NewMaterial extends Code<NewMaterial> setCode(code); } - public final MaterialProperty[] getProperties() + public final IEntityProperty[] getProperties() { return properties; } - public final void setProperties(final MaterialProperty[] properties) + public final void setProperties(final IEntityProperty[] properties) { this.properties = properties; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewSample.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewSample.java index 86db0284003..a5a35902cae 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewSample.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewSample.java @@ -50,7 +50,7 @@ public final class NewSample extends Identifier<NewSample> */ private String containerIdentifier; - private SampleProperty[] properties = SampleProperty.EMPTY_ARRAY; + private IEntityProperty[] properties = IEntityProperty.EMPTY_ARRAY; private List<NewAttachment> attachments; @@ -109,12 +109,12 @@ public final class NewSample extends Identifier<NewSample> this.containerIdentifier = container; } - public final SampleProperty[] getProperties() + public final IEntityProperty[] getProperties() { return properties; } - public final void setProperties(final SampleProperty[] properties) + public final void setProperties(final IEntityProperty[] properties) { this.properties = properties; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SampleProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SampleProperty.java deleted file mode 100644 index 0c49baa2d75..00000000000 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SampleProperty.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2008 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.generic.shared.basic.dto; - -import com.google.gwt.user.client.rpc.IsSerializable; - -/** - * The {@link EntityProperty} extension for <i>Sample</i>. - * - * @author Izabela Adamczyk - */ -public final class SampleProperty extends EntityProperty<SampleType, SampleTypePropertyType> - implements IsSerializable -{ - private static final long serialVersionUID = ServiceVersionHolder.VERSION; - - public static final SampleProperty[] EMPTY_ARRAY = new SampleProperty[0]; -} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ServiceVersionHolder.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ServiceVersionHolder.java index 6afc36d9edd..55bc8f53bc5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ServiceVersionHolder.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ServiceVersionHolder.java @@ -24,5 +24,5 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; public final class ServiceVersionHolder { - public static final int VERSION = 2; // for S60 + public static final int VERSION = 3; // for S60 } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/VocabularyTermValueEntityProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/VocabularyTermValueEntityProperty.java new file mode 100644 index 00000000000..61cb542309c --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/VocabularyTermValueEntityProperty.java @@ -0,0 +1,55 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.generic.shared.basic.dto; + +/** + * A {@link IEntityProperty} class that only stores the vocabulary term value, but not a generic + * value or a material value. + * + * @author Bernd Rinn + */ +public class VocabularyTermValueEntityProperty extends AbstractEntityProperty +{ + private static final long serialVersionUID = ServiceVersionHolder.VERSION; + + private VocabularyTerm vocabularyTermOrNull; + + @Override + public void setPropertyType(PropertyType propertyType) + { + if (DataTypeCode.CONTROLLEDVOCABULARY.equals(propertyType.getDataType().getCode()) == false) + { + throw new IllegalArgumentException( + "Only property types with data type CONTROLLEDVOCABULARY supported, found '" + + propertyType.getDataType().getCode() + "'."); + } + super.setPropertyType(propertyType); + } + + @Override + public VocabularyTerm getVocabularyTerm() + { + return vocabularyTermOrNull; + } + + @Override + public void setVocabularyTerm(VocabularyTerm vocabularyTerm) + { + this.vocabularyTermOrNull = vocabularyTerm; + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityPropertyPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityPropertyPE.java index 5a1a35585f9..35279dc94cd 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityPropertyPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityPropertyPE.java @@ -53,7 +53,7 @@ import ch.systemsx.cisd.openbis.generic.shared.util.EqualsHashUtils; @MappedSuperclass @ClassBridge(index = Index.TOKENIZED, store = Store.YES, impl = EntityPropertyPE.EntityPropertySearchBridge.class) public abstract class EntityPropertyPE extends HibernateAbstractRegistrationHolder implements - IUntypedValueSetter, IEntityProperty + IUntypedValueSetter, IEntityPropertyHolder { private static final long serialVersionUID = IServer.VERSION; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IEntityProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IEntityPropertyHolder.java similarity index 95% rename from openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IEntityProperty.java rename to openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IEntityPropertyHolder.java index a514a0a1469..4ffb7f92629 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IEntityProperty.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IEntityPropertyHolder.java @@ -28,7 +28,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.IIdHolder; * * @author Christian Ribeaud */ -public interface IEntityProperty extends IIdHolder +public interface IEntityPropertyHolder extends IIdHolder { /** * Returns the entity type property type for this entity property. diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleUpdatesDTO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleUpdatesDTO.java index 154553f3528..377ed204c9f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleUpdatesDTO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleUpdatesDTO.java @@ -21,7 +21,7 @@ import java.util.List; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.BasicSampleUpdates; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifier; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; @@ -39,7 +39,7 @@ public class SampleUpdatesDTO extends BasicSampleUpdates private List<AttachmentPE> attachments; - public SampleUpdatesDTO(TechId sampleId, List<SampleProperty> properties, + public SampleUpdatesDTO(TechId sampleId, List<IEntityProperty> properties, ExperimentIdentifier experimentIdentifierOrNull, List<AttachmentPE> attachments, Date version, SampleIdentifier sampleIdentifier, String parentIdentifierOrNull, String containerIdentifierOrNull) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/IGenericClientService.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/IGenericClientService.java index 6a1effb57b7..7cd94f2ffa0 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/IGenericClientService.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/IGenericClientService.java @@ -28,11 +28,10 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.dto.SampleGeneration; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.SampleUpdates; import ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentUpdateResult; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentUpdates; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; @@ -126,7 +125,7 @@ public interface IGenericClientService extends IClientService /** * Updates material. */ - public Date updateMaterial(final TechId materialId, List<MaterialProperty> properties, + public Date updateMaterial(final TechId materialId, List<IEntityProperty> properties, Date version) throws UserFailureException; /** @@ -139,5 +138,5 @@ public interface IGenericClientService extends IClientService * Updates data set. */ public Date updateDataSet(final TechId datasetId, final String sampleIdentifier, - List<DataSetProperty> properties, Date version) throws UserFailureException; + List<IEntityProperty> properties, Date version) throws UserFailureException; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/IGenericClientServiceAsync.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/IGenericClientServiceAsync.java index b653abc68d0..56c4ce0f08e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/IGenericClientServiceAsync.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/IGenericClientServiceAsync.java @@ -30,11 +30,10 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.dto.SampleGeneration; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.SampleUpdates; import ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentUpdateResult; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentUpdates; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; @@ -118,7 +117,7 @@ public interface IGenericClientServiceAsync extends IClientServiceAsync /** * @see IGenericClientService#updateMaterial(TechId, List, Date) */ - public void updateMaterial(final TechId materialId, List<MaterialProperty> properties, + public void updateMaterial(final TechId materialId, List<IEntityProperty> properties, Date version, final AsyncCallback<Date> asyncCallback) throws UserFailureException; /** @@ -131,7 +130,7 @@ public interface IGenericClientServiceAsync extends IClientServiceAsync * @see IGenericClientService#updateDataSet(TechId, String, List, Date) */ public void updateDataSet(final TechId datasetId, final String sampleIdentifier, - List<DataSetProperty> properties, Date version, final AsyncCallback<Date> asyncCallback) + List<IEntityProperty> properties, Date version, final AsyncCallback<Date> asyncCallback) throws UserFailureException; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/AbstractGenericEntityRegistrationForm.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/AbstractGenericEntityRegistrationForm.java index 65cbc66670f..acfa6aa700b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/AbstractGenericEntityRegistrationForm.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/AbstractGenericEntityRegistrationForm.java @@ -38,9 +38,9 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.IIdentifiable; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityTypePropertyType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientServiceAsync; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.experiment.PropertiesEditor; @@ -49,7 +49,7 @@ import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.exp * * @author Izabela Adamczyk */ -public abstract class AbstractGenericEntityRegistrationForm<T extends EntityType, S extends EntityTypePropertyType<T>, P extends EntityProperty<T, S>> +public abstract class AbstractGenericEntityRegistrationForm<T extends EntityType, S extends EntityTypePropertyType<T>> extends AbstractRegistrationForm implements IDatabaseModificationObserver { public static final String ID_PREFIX = GenericConstants.ID_PREFIX; @@ -67,7 +67,7 @@ public abstract class AbstractGenericEntityRegistrationForm<T extends EntityType protected CodeFieldWithGenerator codeField; - protected PropertiesEditor<T, S, P> propertiesEditor; + protected PropertiesEditor<T, S> propertiesEditor; // --------------------------------------------------------------------------------------------- // Constructors @@ -247,7 +247,7 @@ public abstract class AbstractGenericEntityRegistrationForm<T extends EntityType /** * @see PropertiesEditor#extractProperties() */ - protected final List<P> extractProperties() + protected final List<IEntityProperty> extractProperties() { return propertiesEditor.extractProperties(); } @@ -279,7 +279,7 @@ public abstract class AbstractGenericEntityRegistrationForm<T extends EntityType /** * Returns the {@link PropertiesEditor} to be used for . */ - abstract protected PropertiesEditor<T, S, P> createPropertiesEditor(String string, + abstract protected PropertiesEditor<T, S> createPropertiesEditor(String string, IViewContext<ICommonClientServiceAsync> context); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertiesSection.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertiesSection.java index 0feafb57870..a201cab5a9c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertiesSection.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertiesSection.java @@ -26,6 +26,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericCon import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; import ch.systemsx.cisd.openbis.generic.client.web.client.application.SectionPanel; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.PropertyValueRenderers; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.IPropertyValueRenderer; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.PropertyGrid; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DataStore; @@ -33,9 +34,13 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Experiment; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Invalidation; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Sample; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericValueEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialValueEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermValueEntityProperty; /** * {@link SectionPanel} containing dataset properties. @@ -71,8 +76,12 @@ public class DataSetPropertiesSection extends SectionPanel .createDataSetTypePropertyValueRenderer(viewContext)); propertyGrid.registerPropertyValueRenderer(Invalidation.class, PropertyValueRenderers .createInvalidationPropertyValueRenderer(viewContext)); - propertyGrid.registerPropertyValueRenderer(DataSetProperty.class, PropertyValueRenderers - .createDataSetPropertyPropertyValueRenderer(viewContext)); + final IPropertyValueRenderer<IEntityProperty> propertyRenderer = PropertyValueRenderers + .createEntityPropertyPropertyValueRenderer(viewContext); + propertyGrid.registerPropertyValueRenderer(EntityProperty.class, propertyRenderer); + propertyGrid.registerPropertyValueRenderer(GenericValueEntityProperty.class, propertyRenderer); + propertyGrid.registerPropertyValueRenderer(VocabularyTermValueEntityProperty.class, propertyRenderer); + propertyGrid.registerPropertyValueRenderer(MaterialValueEntityProperty.class, propertyRenderer); propertyGrid.registerPropertyValueRenderer(Sample.class, PropertyValueRenderers .createSamplePropertyValueRenderer(viewContext, true)); propertyGrid.registerPropertyValueRenderer(Experiment.class, PropertyValueRenderers @@ -127,12 +136,12 @@ public class DataSetPropertiesSection extends SectionPanel properties.put(messageProvider.getMessage(Dict.CHILDREN_DATASETS), children); } - final List<DataSetProperty> datasetProperties = dataset.getProperties(); + final List<IEntityProperty> datasetProperties = dataset.getProperties(); Collections.sort(datasetProperties); - for (final DataSetProperty property : datasetProperties) + for (final IEntityProperty property : datasetProperties) { final String simpleCode = - property.getEntityTypePropertyType().getPropertyType().getLabel(); + property.getPropertyType().getLabel(); properties.put(simpleCode, property); } return properties; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertyEditor.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertyEditor.java index d47d851f288..cf19daa9193 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertyEditor.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertyEditor.java @@ -18,13 +18,12 @@ package ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.da import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientServiceAsync; import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetTypePropertyType; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.experiment.PropertiesEditor; public class DataSetPropertyEditor extends - PropertiesEditor<DataSetType, DataSetTypePropertyType, DataSetProperty> + PropertiesEditor<DataSetType, DataSetTypePropertyType> { public DataSetPropertyEditor(String id, IViewContext<ICommonClientServiceAsync> viewContext) @@ -32,10 +31,4 @@ public class DataSetPropertyEditor extends super(id, viewContext); } - @Override - protected DataSetProperty createEntityProperty() - { - return new DataSetProperty(); - } - } \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetEditForm.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetEditForm.java index 6d50fedfc35..6cb96fedeff 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetEditForm.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetEditForm.java @@ -33,10 +33,10 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.field.S import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.field.SampleChooserField.SampleChooserFieldAdaptor; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdentifiable; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetTypePropertyType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientServiceAsync; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.AbstractGenericEntityRegistrationForm; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.experiment.PropertiesEditor; @@ -47,8 +47,7 @@ import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.exp * @author Piotr Buczek */ public final class GenericDataSetEditForm - extends - AbstractGenericEntityRegistrationForm<DataSetType, DataSetTypePropertyType, DataSetProperty> + extends AbstractGenericEntityRegistrationForm<DataSetType, DataSetTypePropertyType> { private static final String SAMPLE_FIELD_ID_SUFFIX = "sample_field"; @@ -78,7 +77,7 @@ public final class GenericDataSetEditForm @Override public final void submitValidForm() { - final List<DataSetProperty> properties = extractProperties(); + final List<IEntityProperty> properties = extractProperties(); final String sampleIdentifier = extractSampleIdentifier(); viewContext.getService().updateDataSet(techIdOrNull, sampleIdentifier, properties, originalDataSet.getModificationDate(), new UpdateDataSetCallback(viewContext)); @@ -120,7 +119,7 @@ public final class GenericDataSetEditForm } @Override - protected PropertiesEditor<DataSetType, DataSetTypePropertyType, DataSetProperty> createPropertiesEditor( + protected PropertiesEditor<DataSetType, DataSetTypePropertyType> createPropertiesEditor( String id, IViewContext<ICommonClientServiceAsync> context) { DataSetPropertyEditor editor = new DataSetPropertyEditor(id, context); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/AbstractGenericExperimentRegisterEditForm.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/AbstractGenericExperimentRegisterEditForm.java index 10cf10cf3e0..ea7c1b62de5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/AbstractGenericExperimentRegisterEditForm.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/AbstractGenericExperimentRegisterEditForm.java @@ -52,7 +52,6 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget. import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.WindowUtils; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdentifiable; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentTypePropertyType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType; @@ -65,9 +64,8 @@ import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.Abs * * @author Izabela Adamczyk */ -abstract public class AbstractGenericExperimentRegisterEditForm - extends - AbstractGenericEntityRegistrationForm<ExperimentType, ExperimentTypePropertyType, ExperimentProperty> +abstract public class AbstractGenericExperimentRegisterEditForm extends + AbstractGenericEntityRegistrationForm<ExperimentType, ExperimentTypePropertyType> { protected AttachmentsFileFieldManager attachmentsManager; @@ -158,7 +156,7 @@ abstract public class AbstractGenericExperimentRegisterEditForm } @Override - protected PropertiesEditor<ExperimentType, ExperimentTypePropertyType, ExperimentProperty> createPropertiesEditor( + protected PropertiesEditor<ExperimentType, ExperimentTypePropertyType> createPropertiesEditor( String id, IViewContext<ICommonClientServiceAsync> context) { ExperimentPropertyEditor editor = new ExperimentPropertyEditor(id, context); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/EntityPropertyGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/EntityPropertyGrid.java index 14d20bdb6c6..177bb5cc1e0 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/EntityPropertyGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/EntityPropertyGrid.java @@ -22,19 +22,20 @@ import java.util.Map; import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.PropertyValueRenderers; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.IPropertyValueRenderer; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.PropertyGrid; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityTypePropertyType; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericValueEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialValueEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermValueEntityProperty; /** * @author Izabela Adamczyk */ -public class EntityPropertyGrid<T extends EntityType, S extends EntityTypePropertyType<T>, P extends EntityProperty<T, S>> +public class EntityPropertyGrid<T extends EntityType, S extends EntityTypePropertyType<T>, P extends IEntityProperty> { private PropertyGrid grid; @@ -54,14 +55,12 @@ public class EntityPropertyGrid<T extends EntityType, S extends EntityTypeProper private void registerRenderers() { - grid.registerPropertyValueRenderer(ExperimentProperty.class, PropertyValueRenderers - .createExperimentPropertyPropertyValueRenderer(viewContext)); - grid.registerPropertyValueRenderer(SampleProperty.class, PropertyValueRenderers - .createSamplePropertyPropertyValueRenderer(viewContext)); - grid.registerPropertyValueRenderer(MaterialProperty.class, PropertyValueRenderers - .createMaterialPropertyPropertyValueRenderer(viewContext)); - grid.registerPropertyValueRenderer(DataSetProperty.class, PropertyValueRenderers - .createDataSetPropertyPropertyValueRenderer(viewContext)); + final IPropertyValueRenderer<IEntityProperty> renderer = PropertyValueRenderers + .createEntityPropertyPropertyValueRenderer(viewContext); + grid.registerPropertyValueRenderer(EntityProperty.class, renderer); + grid.registerPropertyValueRenderer(GenericValueEntityProperty.class, renderer); + grid.registerPropertyValueRenderer(VocabularyTermValueEntityProperty.class, renderer); + grid.registerPropertyValueRenderer(MaterialValueEntityProperty.class, renderer); } private final Map<String, Object> createProperties(List<P> list) @@ -69,8 +68,7 @@ public class EntityPropertyGrid<T extends EntityType, S extends EntityTypeProper final Map<String, Object> map = new LinkedHashMap<String, Object>(); for (final P property : list) { - final String simpleCode = - property.getEntityTypePropertyType().getPropertyType().getLabel(); + final String simpleCode = property.getPropertyType().getLabel(); map.put(simpleCode, property); } return map; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertiesPanel.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertiesPanel.java index 88e157da9ad..a5dea393484 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertiesPanel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertiesPanel.java @@ -31,6 +31,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewConte import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.AbstractDatabaseModificationObserverWithCallback; import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.IDatabaseModificationObserverWithCallback; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.PropertyValueRenderers; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.IPropertyValueRenderer; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.PropertyGrid; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.GWTUtils; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider; @@ -38,9 +39,13 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Experiment; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Invalidation; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericValueEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialValueEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermValueEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.ObjectKind; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientServiceAsync; @@ -89,8 +94,12 @@ public class ExperimentPropertiesPanel extends ContentPanel .createExperimentTypePropertyValueRenderer(messageProvider)); propertyGrid.registerPropertyValueRenderer(Invalidation.class, PropertyValueRenderers .createInvalidationPropertyValueRenderer(messageProvider)); - propertyGrid.registerPropertyValueRenderer(ExperimentProperty.class, PropertyValueRenderers - .createExperimentPropertyPropertyValueRenderer(viewContext)); + final IPropertyValueRenderer<IEntityProperty> renderer = PropertyValueRenderers + .createEntityPropertyPropertyValueRenderer(viewContext); + propertyGrid.registerPropertyValueRenderer(EntityProperty.class, renderer); + propertyGrid.registerPropertyValueRenderer(GenericValueEntityProperty.class, renderer); + propertyGrid.registerPropertyValueRenderer(VocabularyTermValueEntityProperty.class, renderer); + propertyGrid.registerPropertyValueRenderer(MaterialValueEntityProperty.class, renderer); propertyGrid.setProperties(properties); return propertyGrid; } @@ -110,12 +119,11 @@ public class ExperimentPropertiesPanel extends ContentPanel properties.put(messageProvider.getMessage(Dict.INVALIDATION), invalidation); } - final List<ExperimentProperty> experimentProperties = experiment.getProperties(); + final List<IEntityProperty> experimentProperties = experiment.getProperties(); Collections.sort(experimentProperties); - for (final ExperimentProperty property : experimentProperties) + for (final IEntityProperty property : experimentProperties) { - final String simpleCode = - property.getEntityTypePropertyType().getPropertyType().getLabel(); + final String simpleCode = property.getPropertyType().getLabel(); properties.put(simpleCode, property); } return properties; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertyEditor.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertyEditor.java index e60a3fcc9fa..1c29911c6f0 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertyEditor.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertyEditor.java @@ -18,12 +18,11 @@ package ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.ex import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientServiceAsync; import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentTypePropertyType; public class ExperimentPropertyEditor extends - PropertiesEditor<ExperimentType, ExperimentTypePropertyType, ExperimentProperty> + PropertiesEditor<ExperimentType, ExperimentTypePropertyType> { public ExperimentPropertyEditor(String id, IViewContext<ICommonClientServiceAsync> viewContext) @@ -31,10 +30,4 @@ public class ExperimentPropertyEditor extends super(id, viewContext); } - @Override - protected ExperimentProperty createEntityProperty() - { - return new ExperimentProperty(); - } - } \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/GenericExperimentRegistrationForm.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/GenericExperimentRegistrationForm.java index 3f6661581f1..5ef0cea9575 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/GenericExperimentRegistrationForm.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/GenericExperimentRegistrationForm.java @@ -24,9 +24,9 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientServiceAs import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.AbstractRegistrationForm; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Project; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentTypePropertyType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientServiceAsync; @@ -91,8 +91,8 @@ public final class GenericExperimentRegistrationForm extends { final NewExperiment newExp = new NewExperiment(createExperimentIdentifier(), experimentType.getCode()); - final List<ExperimentProperty> properties = extractProperties(); - newExp.setProperties(properties.toArray(ExperimentProperty.EMPTY_ARRAY)); + final List<IEntityProperty> properties = extractProperties(); + newExp.setProperties(properties.toArray(IEntityProperty.EMPTY_ARRAY)); newExp.setSamples(getSamples()); newExp.setSampleType(getSampleType()); newExp.setGenerateCodes(autoGenerateCodes.getValue().booleanValue()); @@ -103,7 +103,7 @@ public final class GenericExperimentRegistrationForm extends } @Override - protected PropertiesEditor<ExperimentType, ExperimentTypePropertyType, ExperimentProperty> createPropertiesEditor( + protected PropertiesEditor<ExperimentType, ExperimentTypePropertyType> createPropertiesEditor( String id, IViewContext<ICommonClientServiceAsync> context) { ExperimentPropertyEditor editor = new ExperimentPropertyEditor(id, context); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/PropertiesEditor.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/PropertiesEditor.java index ff208d2a6be..135ae511543 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/PropertiesEditor.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/PropertiesEditor.java @@ -28,11 +28,12 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.field.P import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityTypePropertyType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; /** * @author Izabela Adamczyk */ -abstract public class PropertiesEditor<T extends EntityType, S extends EntityTypePropertyType<T>, P extends EntityProperty<T, S>> +abstract public class PropertiesEditor<T extends EntityType, S extends EntityTypePropertyType<T>> { private static final String ETPT = "PROPERTY_TYPE"; @@ -43,7 +44,10 @@ abstract public class PropertiesEditor<T extends EntityType, S extends EntityTyp private final IViewContext<ICommonClientServiceAsync> viewContext; - abstract protected P createEntityProperty(); + protected IEntityProperty createEntityProperty() + { + return new EntityProperty(); + } /** * Requires initial values of properties. @@ -54,7 +58,7 @@ abstract public class PropertiesEditor<T extends EntityType, S extends EntityTyp this.viewContext = viewContext; } - public void initWithProperties(final List<S> entityTypesPropertyTypes, final List<P> properties) + public void initWithProperties(final List<S> entityTypesPropertyTypes, final List<IEntityProperty> properties) { assert properties != null : "Undefined properties."; assert propertyFields == null : "Already initialized."; @@ -68,7 +72,7 @@ abstract public class PropertiesEditor<T extends EntityType, S extends EntityTyp assert propertyFields == null : "Already initialized."; this.propertyFields = createPropertyFields(entityTypesPropertyTypes, - createInitialProperties(new ArrayList<P>())); + createInitialProperties(new ArrayList<IEntityProperty>())); } @@ -85,12 +89,12 @@ abstract public class PropertiesEditor<T extends EntityType, S extends EntityTyp return result; } - private Map<String, String> createInitialProperties(final List<P> properties) + private Map<String, String> createInitialProperties(final List<IEntityProperty> properties) { Map<String, String> result = new HashMap<String, String>(); - for (P p : properties) + for (IEntityProperty p : properties) { - result.put(p.getEntityTypePropertyType().getPropertyType().getCode(), p.getValue()); + result.put(p.getPropertyType().getCode(), p.tryGetAsString()); } return result; } @@ -121,22 +125,22 @@ abstract public class PropertiesEditor<T extends EntityType, S extends EntityTyp } /** - * Returns a list of {@link EntityProperty} for property types with selected values. + * Returns a list of {@link IEntityProperty} for property types with selected values. */ - public final List<P> extractProperties() + public final List<IEntityProperty> extractProperties() { assert propertyFields != null : "Not initialized."; - final List<P> properties = new ArrayList<P>(); + final List<IEntityProperty> properties = new ArrayList<IEntityProperty>(); for (final DatabaseModificationAwareField<?> field : propertyFields) { Object value = field.get().getValue(); if (value != null && PropertyFieldFactory.valueToString(value) != null) { - final S stpt = field.get().getData(ETPT); - final P sampleProperty = createEntityProperty(); - sampleProperty.setValue(PropertyFieldFactory.valueToString(value)); - sampleProperty.setEntityTypePropertyType(stpt); - properties.add(sampleProperty); + final S etpt = field.get().getData(ETPT); + final IEntityProperty entityProperty = createEntityProperty(); + entityProperty.setValue(PropertyFieldFactory.valueToString(value)); + entityProperty.setPropertyType(etpt.getPropertyType()); + properties.add(entityProperty); } } return properties; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/GenericMaterialEditForm.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/GenericMaterialEditForm.java index 1cb72b1f886..b246e853b4d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/GenericMaterialEditForm.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/GenericMaterialEditForm.java @@ -29,7 +29,6 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.Abstrac import ch.systemsx.cisd.openbis.generic.shared.basic.IIdentifiable; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialTypePropertyType; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientServiceAsync; @@ -42,8 +41,7 @@ import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.exp * @author Izabela Adamczyk */ public final class GenericMaterialEditForm - extends - AbstractGenericEntityRegistrationForm<MaterialType, MaterialTypePropertyType, MaterialProperty> + extends AbstractGenericEntityRegistrationForm<MaterialType, MaterialTypePropertyType> { private Material originalMaterial; @@ -100,7 +98,7 @@ public final class GenericMaterialEditForm } @Override - protected PropertiesEditor<MaterialType, MaterialTypePropertyType, MaterialProperty> createPropertiesEditor( + protected PropertiesEditor<MaterialType, MaterialTypePropertyType> createPropertiesEditor( String id, IViewContext<ICommonClientServiceAsync> context) { MaterialPropertyEditor editor = new MaterialPropertyEditor(id, context); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/MaterialPropertiesSection.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/MaterialPropertiesSection.java index f2a592df216..2b4603995eb 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/MaterialPropertiesSection.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/MaterialPropertiesSection.java @@ -26,13 +26,18 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericCon import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; import ch.systemsx.cisd.openbis.generic.client.web.client.application.SectionPanel; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.PropertyValueRenderers; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.IPropertyValueRenderer; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.PropertyGrid; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Invalidation; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericValueEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialValueEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermValueEntityProperty; /** * {@link SectionPanel} containing material properties. @@ -68,8 +73,15 @@ public class MaterialPropertiesSection extends SectionPanel .createMaterialTypePropertyValueRenderer(viewContext)); propertyGrid.registerPropertyValueRenderer(Invalidation.class, PropertyValueRenderers .createInvalidationPropertyValueRenderer(viewContext)); - propertyGrid.registerPropertyValueRenderer(MaterialProperty.class, PropertyValueRenderers - .createMaterialPropertyPropertyValueRenderer(viewContext)); + final IPropertyValueRenderer<IEntityProperty> propertyRenderer = + PropertyValueRenderers.createEntityPropertyPropertyValueRenderer(viewContext); + propertyGrid.registerPropertyValueRenderer(EntityProperty.class, propertyRenderer); + propertyGrid.registerPropertyValueRenderer(GenericValueEntityProperty.class, + propertyRenderer); + propertyGrid.registerPropertyValueRenderer(VocabularyTermValueEntityProperty.class, + propertyRenderer); + propertyGrid.registerPropertyValueRenderer(MaterialValueEntityProperty.class, + propertyRenderer); propertyGrid.setProperties(properties); return propertyGrid; } @@ -85,12 +97,11 @@ public class MaterialPropertiesSection extends SectionPanel properties.put(messageProvider.getMessage(Dict.REGISTRATION_DATE), material .getRegistrationDate()); - final List<MaterialProperty> materialProperties = material.getProperties(); + final List<IEntityProperty> materialProperties = material.getProperties(); Collections.sort(materialProperties); - for (final MaterialProperty property : materialProperties) + for (final IEntityProperty property : materialProperties) { - final String simpleCode = - property.getEntityTypePropertyType().getPropertyType().getLabel(); + final String simpleCode = property.getPropertyType().getLabel(); properties.put(simpleCode, property); } return properties; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/MaterialPropertyEditor.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/MaterialPropertyEditor.java index dea441516e7..eabc941dd74 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/MaterialPropertyEditor.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/MaterialPropertyEditor.java @@ -18,13 +18,12 @@ package ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.ma import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientServiceAsync; import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialTypePropertyType; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.experiment.PropertiesEditor; public class MaterialPropertyEditor extends - PropertiesEditor<MaterialType, MaterialTypePropertyType, MaterialProperty> + PropertiesEditor<MaterialType, MaterialTypePropertyType> { public MaterialPropertyEditor(String id, IViewContext<ICommonClientServiceAsync> viewContext) @@ -32,10 +31,4 @@ public class MaterialPropertyEditor extends super(id, viewContext); } - @Override - protected MaterialProperty createEntityProperty() - { - return new MaterialProperty(); - } - } \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/AbstractGenericSampleRegisterEditForm.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/AbstractGenericSampleRegisterEditForm.java index 26056b12d81..506804f71ac 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/AbstractGenericSampleRegisterEditForm.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/AbstractGenericSampleRegisterEditForm.java @@ -41,7 +41,6 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget. import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Group; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdentifiable; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleTypePropertyType; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientServiceAsync; @@ -54,7 +53,7 @@ import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.exp * @author Izabela Adamczyk */ abstract public class AbstractGenericSampleRegisterEditForm extends - AbstractGenericEntityRegistrationForm<SampleType, SampleTypePropertyType, SampleProperty> + AbstractGenericEntityRegistrationForm<SampleType, SampleTypePropertyType> { public static final String ID_SUFFIX_CONTAINER = "container"; @@ -130,7 +129,7 @@ abstract public class AbstractGenericSampleRegisterEditForm extends } @Override - protected PropertiesEditor<SampleType, SampleTypePropertyType, SampleProperty> createPropertiesEditor( + protected PropertiesEditor<SampleType, SampleTypePropertyType> createPropertiesEditor( String id, IViewContext<ICommonClientServiceAsync> context) { SamplePropertyEditor editor = new SamplePropertyEditor(id, context); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleEditForm.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleEditForm.java index 5babb3174d9..f910ac67a02 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleEditForm.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleEditForm.java @@ -31,8 +31,8 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Group; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Sample; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.SampleUpdates; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdentifiable; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAttachment; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientServiceAsync; /** @@ -61,7 +61,7 @@ public final class GenericSampleEditForm extends AbstractGenericSampleRegisterEd @Override protected void save() { - final List<SampleProperty> properties = extractProperties(); + final List<IEntityProperty> properties = extractProperties(); final List<NewAttachment> attachments = attachmentsManager.extractAttachments(); ExperimentIdentifier experimentIdent = experimentField != null ? experimentField.tryToGetValue() : null; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleRegistrationForm.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleRegistrationForm.java index dcf0a815ecc..c581051faa3 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleRegistrationForm.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleRegistrationForm.java @@ -25,8 +25,8 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.Strin import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Group; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdentifiable; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientServiceAsync; @@ -103,8 +103,8 @@ public final class GenericSampleRegistrationForm extends AbstractGenericSampleRe final NewSample newSample = new NewSample(createSampleIdentifier(), sampleType, StringUtils.trimToNull(parent .getValue()), StringUtils.trimToNull(container.getValue())); - final List<SampleProperty> properties = extractProperties(); - newSample.setProperties(properties.toArray(SampleProperty.EMPTY_ARRAY)); + final List<IEntityProperty> properties = extractProperties(); + newSample.setProperties(properties.toArray(IEntityProperty.EMPTY_ARRAY)); newSample.setAttachments(attachmentsManager.extractAttachments()); viewContext.getService().registerSample(attachmentsSessionKey, newSample, new RegisterSampleCallback(viewContext)); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java index a4740b3a9f6..5b6378752fe 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java @@ -43,6 +43,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework. import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.AbstractViewer; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.PropertyValueRenderers; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.IPropertyValueRenderer; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.PropertyGrid; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.sample.SampleListDeletionConfirmationDialog; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.AbstractGridDataRefreshCallback; @@ -55,9 +56,13 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.dto.SampleGeneration; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdentifiable; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericValueEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialValueEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermValueEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.ObjectKind; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientServiceAsync; @@ -238,11 +243,11 @@ public final class GenericSampleViewer extends AbstractViewer<IGenericClientServ { properties.put(messageProvider.getMessage(Dict.PART_OF), partOf); } - final List<SampleProperty> sampleProperties = sample.getProperties(); + final List<IEntityProperty> sampleProperties = sample.getProperties(); Collections.sort(sampleProperties); - for (final SampleProperty property : sampleProperties) + for (final IEntityProperty property : sampleProperties) { - final String label = property.getEntityTypePropertyType().getPropertyType().getLabel(); + final String label = property.getPropertyType().getLabel(); properties.put(label, property); } return properties; @@ -278,8 +283,15 @@ public final class GenericSampleViewer extends AbstractViewer<IGenericClientServ .createSamplePropertyValueRenderer(viewContext, true)); propertyGrid.registerPropertyValueRenderer(Invalidation.class, PropertyValueRenderers .createInvalidationPropertyValueRenderer(viewContext)); - propertyGrid.registerPropertyValueRenderer(SampleProperty.class, PropertyValueRenderers - .createSamplePropertyPropertyValueRenderer(viewContext)); + final IPropertyValueRenderer<IEntityProperty> propertyValueRenderer = + PropertyValueRenderers.createEntityPropertyPropertyValueRenderer(viewContext); + propertyGrid.registerPropertyValueRenderer(EntityProperty.class, propertyValueRenderer); + propertyGrid.registerPropertyValueRenderer(GenericValueEntityProperty.class, + propertyValueRenderer); + propertyGrid.registerPropertyValueRenderer(VocabularyTermValueEntityProperty.class, + propertyValueRenderer); + propertyGrid.registerPropertyValueRenderer(MaterialValueEntityProperty.class, + propertyValueRenderer); propertyGrid.registerPropertyValueRenderer(Experiment.class, PropertyValueRenderers .createExperimentPropertyValueRenderer(viewContext)); propertyGrid.setProperties(properties); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/SamplePropertyEditor.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/SamplePropertyEditor.java index 6e5f55b2684..9b0d8fd8aaf 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/SamplePropertyEditor.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/SamplePropertyEditor.java @@ -18,13 +18,12 @@ package ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.sa import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientServiceAsync; import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleTypePropertyType; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.experiment.PropertiesEditor; public class SamplePropertyEditor extends - PropertiesEditor<SampleType, SampleTypePropertyType, SampleProperty> + PropertiesEditor<SampleType, SampleTypePropertyType> { public SamplePropertyEditor(String id, IViewContext<ICommonClientServiceAsync> viewContext) @@ -32,10 +31,4 @@ public class SamplePropertyEditor extends super(id, viewContext); } - @Override - protected SampleProperty createEntityProperty() - { - return new SampleProperty(); - } - } \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientService.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientService.java index f6a1c540197..5f0541ab93a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientService.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientService.java @@ -54,11 +54,10 @@ import ch.systemsx.cisd.openbis.generic.client.web.server.translator.SampleTrans import ch.systemsx.cisd.openbis.generic.client.web.server.translator.UserFailureExceptionTranslator; import ch.systemsx.cisd.openbis.generic.shared.IServer; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentUpdateResult; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentUpdates; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewMaterial; @@ -418,8 +417,7 @@ public final class GenericClientService extends AbstractClientService implements final IPropertyMapper propertyMapper) throws ParserException { - return new NewMaterialParserObjectFactory(materialType, - propertyMapper); + return new NewMaterialParserObjectFactory(propertyMapper); } }); final List<NewMaterial> newMaterials = new ArrayList<NewMaterial>(); @@ -492,7 +490,7 @@ public final class GenericClientService extends AbstractClientService implements return modificationDate; } - public Date updateMaterial(TechId materialId, List<MaterialProperty> properties, Date version) + public Date updateMaterial(TechId materialId, List<IEntityProperty> properties, Date version) throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException { try @@ -539,7 +537,7 @@ public final class GenericClientService extends AbstractClientService implements } public Date updateDataSet(TechId datasetId, String sampleIdentifier, - List<DataSetProperty> properties, Date version) + List<IEntityProperty> properties, Date version) throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException { try diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/NewMaterialParserObjectFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/NewMaterialParserObjectFactory.java index 32ddbd1739f..9fb98f85574 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/NewMaterialParserObjectFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/NewMaterialParserObjectFactory.java @@ -25,9 +25,8 @@ import ch.systemsx.cisd.common.parser.AbstractParserObjectFactory; import ch.systemsx.cisd.common.parser.IPropertyMapper; import ch.systemsx.cisd.common.parser.IPropertyModel; import ch.systemsx.cisd.common.parser.ParserException; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialTypePropertyType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewMaterial; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; @@ -39,43 +38,34 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; */ final class NewMaterialParserObjectFactory extends AbstractParserObjectFactory<NewMaterial> { - private final MaterialType materialType; - - NewMaterialParserObjectFactory(final MaterialType materialType, - final IPropertyMapper propertyMapper) + NewMaterialParserObjectFactory(final IPropertyMapper propertyMapper) { super(NewMaterial.class, propertyMapper); - this.materialType = materialType; } - private final MaterialTypePropertyType createMaterialTypePropertyType( - final String propertyTypeCode) + private final PropertyType createPropertyType(final String propertyTypeCode) { - final MaterialTypePropertyType materialTypePropertyType = new MaterialTypePropertyType(); final PropertyType propertyType = new PropertyType(); propertyType.setCode(propertyTypeCode); - materialTypePropertyType.setPropertyType(propertyType); - materialTypePropertyType.setEntityType(materialType); - return materialTypePropertyType; + return propertyType; } private final void setProperties(final NewMaterial newMaterial, final String[] lineTokens) { - final List<MaterialProperty> properties = new ArrayList<MaterialProperty>(); + final List<IEntityProperty> properties = new ArrayList<IEntityProperty>(); for (final String unmatchedProperty : getUnmatchedProperties()) { final IPropertyModel propertyModel = tryGetPropertyModel(unmatchedProperty); final String propertyValue = getPropertyValue(lineTokens, propertyModel); if (StringUtils.isEmpty(propertyValue) == false) { - final MaterialProperty property = new MaterialProperty(); - property - .setEntityTypePropertyType(createMaterialTypePropertyType(unmatchedProperty)); + final IEntityProperty property = new EntityProperty(); + property.setPropertyType(createPropertyType(unmatchedProperty)); property.setValue(propertyValue); properties.add(property); } } - newMaterial.setProperties(properties.toArray(MaterialProperty.EMPTY_ARRAY)); + newMaterial.setProperties(properties.toArray(IEntityProperty.EMPTY_ARRAY)); } @Override diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/NewSampleParserObjectFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/NewSampleParserObjectFactory.java index 5acfbfec21d..80f81ca1c45 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/NewSampleParserObjectFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/NewSampleParserObjectFactory.java @@ -25,11 +25,13 @@ import ch.systemsx.cisd.common.parser.AbstractParserObjectFactory; import ch.systemsx.cisd.common.parser.IPropertyMapper; import ch.systemsx.cisd.common.parser.IPropertyModel; import ch.systemsx.cisd.common.parser.ParserException; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleTypePropertyType; /** * A {@link AbstractParserObjectFactory} extension for creating {@link NewSample}. @@ -50,32 +52,32 @@ final class NewSampleParserObjectFactory extends AbstractParserObjectFactory<New this.identifierExpectedInFile = identifierExpectedInFile; } - private final SampleTypePropertyType createSampleTypePropertyType(final String propertyTypeCode) + private final PropertyType createPropertyType(final String propertyTypeCode) { - final SampleTypePropertyType sampleTypePropertyType = new SampleTypePropertyType(); final PropertyType propertyType = new PropertyType(); + final DataType dataType = new DataType(); + dataType.setCode(DataTypeCode.VARCHAR); propertyType.setCode(propertyTypeCode); - sampleTypePropertyType.setPropertyType(propertyType); - sampleTypePropertyType.setEntityType(sampleType); - return sampleTypePropertyType; + propertyType.setDataType(dataType); + return propertyType; } private final void setProperties(final NewSample newSample, final String[] lineTokens) { - final List<SampleProperty> properties = new ArrayList<SampleProperty>(); + final List<IEntityProperty> properties = new ArrayList<IEntityProperty>(); for (final String unmatchedProperty : getUnmatchedProperties()) { final IPropertyModel propertyModel = tryGetPropertyModel(unmatchedProperty); final String propertyValue = getPropertyValue(lineTokens, propertyModel); if (StringUtils.isEmpty(propertyValue) == false) { - final SampleProperty property = new SampleProperty(); - property.setEntityTypePropertyType(createSampleTypePropertyType(unmatchedProperty)); + final IEntityProperty property = new EntityProperty(); + property.setPropertyType(createPropertyType(unmatchedProperty)); property.setValue(propertyValue); properties.add(property); } } - newSample.setProperties(properties.toArray(SampleProperty.EMPTY_ARRAY)); + newSample.setProperties(properties.toArray(IEntityProperty.EMPTY_ARRAY)); } // diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServer.java index d6fb5606c5f..355c914c23f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServer.java @@ -40,9 +40,8 @@ import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory; import ch.systemsx.cisd.openbis.generic.server.plugin.IDataSetTypeSlaveServerPlugin; import ch.systemsx.cisd.openbis.generic.server.plugin.ISampleTypeSlaveServerPlugin; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentUpdateResult; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewMaterial; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; @@ -378,7 +377,7 @@ public final class GenericServer extends AbstractServer<IGenericServer> implemen } public Date updateMaterial(String sessionToken, TechId materialId, - List<MaterialProperty> properties, Date version) + List<IEntityProperty> properties, Date version) { final Session session = getSessionManager().getSession(sessionToken); final IMaterialBO materialBO = businessObjectFactory.createMaterialBO(session); @@ -399,7 +398,7 @@ public final class GenericServer extends AbstractServer<IGenericServer> implemen } public Date updateDataSet(String sessionToken, TechId datasetId, - SampleIdentifier sampleIdentifier, List<DataSetProperty> properties, Date version) + SampleIdentifier sampleIdentifier, List<IEntityProperty> properties, Date version) { final Session session = getSessionManager().getSession(sessionToken); final IExternalDataBO dataSetBO = businessObjectFactory.createExternalDataBO(session); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServerLogger.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServerLogger.java index 1373360a63d..5d2b284c089 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServerLogger.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServerLogger.java @@ -26,9 +26,8 @@ import ch.systemsx.cisd.common.collections.CollectionUtils; import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.openbis.generic.server.AbstractServerLogger; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentUpdateResult; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewMaterial; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; @@ -174,7 +173,7 @@ final class GenericServerLogger extends AbstractServerLogger implements IGeneric } public Date updateMaterial(String sessionToken, TechId materialId, - List<MaterialProperty> properties, Date version) + List<IEntityProperty> properties, Date version) { logTracking(sessionToken, "edit_material", "MATERIAL(%s)", materialId); return null; @@ -189,7 +188,7 @@ final class GenericServerLogger extends AbstractServerLogger implements IGeneric } public Date updateDataSet(String sessionToken, TechId datasetId, - SampleIdentifier sampleIdentifier, List<DataSetProperty> properties, Date version) + SampleIdentifier sampleIdentifier, List<IEntityProperty> properties, Date version) { logTracking(sessionToken, "edit_data_set", "DATA_SET(%s)", datasetId); return null; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/shared/IGenericServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/shared/IGenericServer.java index 5aba2258877..8631994b45e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/shared/IGenericServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/shared/IGenericServer.java @@ -39,9 +39,8 @@ import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.AbstractT import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.AbstractTechIdPredicate.ExperimentTechIdPredicate; import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.AbstractTechIdPredicate.ProjectTechIdPredicate; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentUpdateResult; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewMaterial; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; @@ -180,7 +179,7 @@ public interface IGenericServer extends IPluginCommonServer @RolesAllowed(RoleSet.INSTANCE_ADMIN) @DatabaseUpdateModification(value = ObjectKind.MATERIAL) public Date updateMaterial(String sessionToken, TechId materialId, - List<MaterialProperty> properties, Date version); + List<IEntityProperty> properties, Date version); /** * Saves changed sample. @@ -201,5 +200,5 @@ public interface IGenericServer extends IPluginCommonServer String sessionToken, @AuthorizationGuard(guardClass = DataSetTechIdPredicate.class) TechId datasetId, @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class) SampleIdentifier sampleIdentifier, - List<DataSetProperty> properties, Date version); + List<IEntityProperty> properties, Date version); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/AbstractProperty.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/AbstractProperty.java index 98e85434371..7a71013159d 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/AbstractProperty.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/AbstractProperty.java @@ -22,6 +22,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.dto.IInvalidationProvi import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Invalidation; import ch.systemsx.cisd.openbis.generic.shared.basic.ICodeProvider; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; /** * Abstract superclass of a generic {@link IProperty} which implements convenient property value @@ -154,11 +155,11 @@ public abstract class AbstractProperty<C extends IPropertyChecker<?>> implements */ public C asProperty(final String expectedValue) { - return by(new IValueAssertion<EntityProperty<?, ?>>() + return by(new IValueAssertion<IEntityProperty>() { - public void assertValue(final EntityProperty<?, ?> value) + public void assertValue(final IEntityProperty value) { - Assert.assertEquals(message, expectedValue, value.getValue()); + Assert.assertEquals(message, expectedValue, value.tryGetAsString()); } }); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityPropertiesConverterTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityPropertiesConverterTest.java index 78029a870a0..1b751e7a3ca 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityPropertiesConverterTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityPropertiesConverterTest.java @@ -29,9 +29,9 @@ import ch.systemsx.cisd.openbis.generic.server.business.ManagerTestTool; import ch.systemsx.cisd.openbis.generic.server.util.IPropertyValueValidator; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleTypePropertyType; import ch.systemsx.cisd.openbis.generic.shared.dto.EntityPropertyPE; import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePropertyTypePE; import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; @@ -107,12 +107,11 @@ public final class EntityPropertiesConverterTest extends AbstractBOTest return sampleType; } - private final static SampleProperty createVarcharSampleProperty(final boolean lowerCase, + private final static IEntityProperty createVarcharSampleProperty(final boolean lowerCase, String code) { - final SampleProperty sampleProperty = new SampleProperty(); + final IEntityProperty sampleProperty = new EntityProperty(); sampleProperty.setValue("blue"); - final SampleTypePropertyType sampleTypePropertyType = new SampleTypePropertyType(); final PropertyType propertyType = new PropertyType(); String newCode = code; if (lowerCase) @@ -124,14 +123,13 @@ public final class EntityPropertiesConverterTest extends AbstractBOTest final DataType dataType = new DataType(); dataType.setCode(DataTypeCode.VARCHAR); propertyType.setDataType(dataType); - sampleTypePropertyType.setPropertyType(propertyType); - sampleProperty.setEntityTypePropertyType(sampleTypePropertyType); + sampleProperty.setPropertyType(propertyType); return sampleProperty; } - private final SampleProperty[] createSampleProperties(final boolean lowerCase) + private final IEntityProperty[] createSampleProperties(final boolean lowerCase) { - return new SampleProperty[] + return new IEntityProperty[] { createVarcharSampleProperty(lowerCase, VARCHAR_PROPERTY_TYPE_CODE) }; } @@ -164,7 +162,7 @@ public final class EntityPropertiesConverterTest extends AbstractBOTest } }); final List<EntityPropertyPE> properties = - entityPropertiesConverter.convertProperties(SampleProperty.EMPTY_ARRAY, + entityPropertiesConverter.convertProperties(IEntityProperty.EMPTY_ARRAY, SAMPLE_TYPE_CODE, ManagerTestTool.EXAMPLE_PERSON); assertEquals(0, properties.size()); context.assertIsSatisfied(); @@ -188,7 +186,7 @@ public final class EntityPropertiesConverterTest extends AbstractBOTest one(propertyValueValidator).validatePropertyValue(propertyTypePE, "blue"); } }); - final SampleProperty[] properties = createSampleProperties(false); + final IEntityProperty[] properties = createSampleProperties(false); final List<EntityPropertyPE> convertedProperties = entityPropertiesConverter.convertProperties(properties, SAMPLE_TYPE_CODE, ManagerTestTool.EXAMPLE_PERSON); @@ -214,7 +212,7 @@ public final class EntityPropertiesConverterTest extends AbstractBOTest one(propertyValueValidator).validatePropertyValue(propertyTypePE, "blue"); } }); - final SampleProperty[] properties = createSampleProperties(true); + final IEntityProperty[] properties = createSampleProperties(true); final List<EntityPropertyPE> convertedProperties = entityPropertiesConverter.convertProperties(properties, SAMPLE_TYPE_CODE .toLowerCase(), ManagerTestTool.EXAMPLE_PERSON); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBOTest.java index 917c1f5394a..8d6eec5e3a3 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBOTest.java @@ -36,7 +36,7 @@ import ch.systemsx.cisd.common.test.AssertionUtil; import ch.systemsx.cisd.openbis.generic.server.business.ManagerTestTool; import ch.systemsx.cisd.openbis.generic.shared.CommonTestUtils; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment; import ch.systemsx.cisd.openbis.generic.shared.dto.AttachmentPE; import ch.systemsx.cisd.openbis.generic.shared.dto.DatabaseInstancePE; @@ -96,7 +96,7 @@ public final class ExperimentBOTest extends AbstractBOTest } private void prepareUpdateProperties(final Set<ExperimentPropertyPE> oldProperties, - final List<ExperimentProperty> newProperties, final EntityTypePE entityType, + final List<IEntityProperty> newProperties, final EntityTypePE entityType, final PersonPE registrator, final List<ExperimentPropertyPE> updated) { context.checking(new Expectations() @@ -417,7 +417,7 @@ public final class ExperimentBOTest extends AbstractBOTest assertTrue(bo.getExperiment().getProperties().contains(deletedProperty)); assertFalse(bo.getExperiment().getProperties().contains(addedProperty)); - List<ExperimentProperty> newProperties = createDummyProperties(); + final List<IEntityProperty> newProperties = createDummyProperties(); prepareUpdateProperties(exp.getProperties(), newProperties, experimentType, ManagerTestTool.EXAMPLE_SESSION.tryGetPerson(), Arrays.asList(changedProperty, addedProperty)); @@ -430,9 +430,9 @@ public final class ExperimentBOTest extends AbstractBOTest context.assertIsSatisfied(); } - private List<ExperimentProperty> createDummyProperties() + private List<IEntityProperty> createDummyProperties() { - return new ArrayList<ExperimentProperty>(); + return new ArrayList<IEntityProperty>(); } @Test diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataBOTest.java index 8e997a94cf5..d2824d1d757 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataBOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataBOTest.java @@ -28,7 +28,7 @@ import org.jmock.Expectations; import org.testng.annotations.Test; import ch.systemsx.cisd.common.types.BooleanOrUnknown; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SourceType; import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; import ch.systemsx.cisd.openbis.generic.shared.dto.DataSetPropertyPE; @@ -388,7 +388,7 @@ public class ExternalDataBOTest extends AbstractBOTest one(locatorTypeDAO).tryToFindLocatorTypeByCode(LOCATOR_TYPE.getCode()); will(returnValue(locatorType)); - one(propertiesConverter).convertProperties(new DataSetProperty[0], + one(propertiesConverter).convertProperties(new IEntityProperty[0], dataSetType.getCode(), EXAMPLE_SESSION.tryGetPerson()); ArrayList<DataSetPropertyPE> properties = new ArrayList<DataSetPropertyPE>(); will(returnValue(properties)); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBOTest.java index e86cd7cc0ae..407fc1c081e 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBOTest.java @@ -39,11 +39,11 @@ import ch.systemsx.cisd.openbis.generic.shared.CommonTestUtils; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleTypePropertyType; import ch.systemsx.cisd.openbis.generic.shared.dto.AttachmentPE; import ch.systemsx.cisd.openbis.generic.shared.dto.DatabaseInstancePE; import ch.systemsx.cisd.openbis.generic.shared.dto.EventPE; @@ -81,19 +81,17 @@ public final class SampleBOTest extends AbstractBOTest private static final String DEFAULT_SAMPLE_CODE = "xx"; - private final static SampleProperty createSampleProperty() + private final static IEntityProperty createSampleProperty() { - final SampleProperty sampleProperty = new SampleProperty(); + final IEntityProperty sampleProperty = new EntityProperty(); sampleProperty.setValue("blue"); - final SampleTypePropertyType sampleTypePropertyType = new SampleTypePropertyType(); final PropertyType propertyType = new PropertyType(); propertyType.setLabel("color"); propertyType.setCode("color"); final DataType dataType = new DataType(); dataType.setCode(DataTypeCode.VARCHAR); propertyType.setDataType(dataType); - sampleTypePropertyType.setPropertyType(propertyType); - sampleProperty.setEntityTypePropertyType(sampleTypePropertyType); + sampleProperty.setPropertyType(propertyType); return sampleProperty; } @@ -263,7 +261,7 @@ public final class SampleBOTest extends AbstractBOTest final SampleIdentifier parentGroupIdentifier = getGroupSampleIdentifier("SAMPLE_GENERATOR"); newSharedSample.setParentIdentifier(parentGroupIdentifier.toString()); - newSharedSample.setProperties(SampleProperty.EMPTY_ARRAY); + newSharedSample.setProperties(IEntityProperty.EMPTY_ARRAY); context.checking(new Expectations() { @@ -349,7 +347,7 @@ public final class SampleBOTest extends AbstractBOTest final SampleIdentifier containerIdentifier = getGroupSampleIdentifier("SAMPLE_CONTAINER"); newSample.setContainerIdentifier(containerIdentifier.toString()); - newSample.setProperties(SampleProperty.EMPTY_ARRAY); + newSample.setProperties(IEntityProperty.EMPTY_ARRAY); final SamplePE generatedFrom = new SamplePE(); generatedFrom.setRegistrator(EXAMPLE_PERSON); @@ -427,8 +425,8 @@ public final class SampleBOTest extends AbstractBOTest sampleType.setCode(MASTER_PLATE); sampleType.setId(new Long(21L)); sampleType.setDatabaseInstance(new DatabaseInstancePE()); - final SampleProperty sampleProperty = createSampleProperty(); - newSample.setProperties(new SampleProperty[] + final IEntityProperty sampleProperty = createSampleProperty(); + newSample.setProperties(new IEntityProperty[] { sampleProperty }); final SamplePropertyPE samplePropertyPE = new SamplePropertyPE(); samplePropertyPE.setRegistrator(EXAMPLE_SESSION.tryGetPerson()); @@ -524,7 +522,7 @@ public final class SampleBOTest extends AbstractBOTest SampleTypeCode.DILUTION_PLATE.getCode()); will(returnValue(new SampleTypePE())); - one(propertiesConverter).convertProperties(SampleProperty.EMPTY_ARRAY, null, + one(propertiesConverter).convertProperties(IEntityProperty.EMPTY_ARRAY, null, EXAMPLE_PERSON); one(sampleDAO).tryFindByCodeAndGroup("DOES_NOT_EXIST", @@ -561,7 +559,7 @@ public final class SampleBOTest extends AbstractBOTest SampleTypeCode.DILUTION_PLATE.getCode()); will(returnValue(new SampleTypePE())); - one(propertiesConverter).convertProperties(SampleProperty.EMPTY_ARRAY, null, + one(propertiesConverter).convertProperties(IEntityProperty.EMPTY_ARRAY, null, EXAMPLE_PERSON); one(sampleDAO).tryFindByCodeAndGroup("DOES_NOT_EXIST", diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientServiceTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientServiceTest.java index c69dc8d19d2..954f57d25a2 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientServiceTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientServiceTest.java @@ -35,13 +35,12 @@ import ch.rinn.restrictions.Friend; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.BatchRegistrationResult; import ch.systemsx.cisd.openbis.generic.client.web.server.AbstractClientServiceTest; import ch.systemsx.cisd.openbis.generic.client.web.server.UploadedFilesBean; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleTypePropertyType; import ch.systemsx.cisd.openbis.generic.shared.dto.AttachmentPE; import ch.systemsx.cisd.openbis.plugin.generic.shared.IGenericServer; @@ -60,7 +59,7 @@ public final class GenericClientServiceTest extends AbstractClientServiceTest private GenericClientService genericClientService; private final static NewSample createNewSample(final String sampleIdentifier, - final String sampleTypeCode, final SampleProperty[] properties, final String parent, + final String sampleTypeCode, final IEntityProperty[] properties, final String parent, final String container) { final NewSample newSample = new NewSample(); @@ -80,16 +79,14 @@ public final class GenericClientServiceTest extends AbstractClientServiceTest return sampleType; } - private final static SampleProperty createSampleProperty(final String propertyTypeCode, + private final static IEntityProperty createSampleProperty(final String propertyTypeCode, final String value) { - final SampleProperty sampleProperty = new SampleProperty(); + final IEntityProperty sampleProperty = new EntityProperty(); sampleProperty.setValue(value); - final SampleTypePropertyType sampleTypePropertyType = new SampleTypePropertyType(); final PropertyType propertyType = new PropertyType(); propertyType.setCode(propertyTypeCode); - sampleTypePropertyType.setPropertyType(propertyType); - sampleProperty.setEntityTypePropertyType(sampleTypePropertyType); + sampleProperty.setPropertyType(propertyType); return sampleProperty; } @@ -112,7 +109,7 @@ public final class GenericClientServiceTest extends AbstractClientServiceTest { final String sessionKey = "some-session-key"; final NewSample newSample = - createNewSample("/group1/sample1", "MASTER_PLATE", SampleProperty.EMPTY_ARRAY, + createNewSample("/group1/sample1", "MASTER_PLATE", IEntityProperty.EMPTY_ARRAY, null, null); context.checking(new Expectations() { @@ -144,7 +141,7 @@ public final class GenericClientServiceTest extends AbstractClientServiceTest newSample.setIdentifier("MP1"); newSample.setContainerIdentifier("MP2"); newSample.setParentIdentifier("MP3"); - newSample.setProperties(new SampleProperty[] + newSample.setProperties(new IEntityProperty[] { createSampleProperty("prop1", "RED"), createSampleProperty("prop2", "1") }); final SampleType sampleType = createSampleType("MASTER_PLATE"); final String fileName = "originalFileName.txt"; @@ -187,7 +184,7 @@ public final class GenericClientServiceTest extends AbstractClientServiceTest { final NewExperiment newExperiment = createNewExperiment("/group1/project1/exp1", "SIRNA_HCS", - ExperimentProperty.EMPTY_ARRAY); + IEntityProperty.EMPTY_ARRAY); final String attachmentSessionKey = "attachment-session-key"; final String sampleSessionKey = "sample-session-key"; context.checking(new Expectations() @@ -218,7 +215,7 @@ public final class GenericClientServiceTest extends AbstractClientServiceTest // private NewExperiment createNewExperiment(String identifier, String type, - ExperimentProperty[] properties) + IEntityProperty[] properties) { final NewExperiment newExperiment = new NewExperiment(); newExperiment.setIdentifier(identifier); @@ -241,11 +238,11 @@ public final class GenericClientServiceTest extends AbstractClientServiceTest this.newSamples = newSamples; } - private final boolean equals(final SampleProperty[] properties, - final SampleProperty[] sampleProperties) + private final boolean equals(final IEntityProperty[] properties, + final IEntityProperty[] sampleProperties) { int i = -1; - for (final SampleProperty sampleProperty : sampleProperties) + for (final IEntityProperty sampleProperty : sampleProperties) { if (StringUtils.equals(sampleProperty.getValue(), properties[++i].getValue()) == false || StringUtils.equals(getPropertyTypeCode(sampleProperty), @@ -257,9 +254,9 @@ public final class GenericClientServiceTest extends AbstractClientServiceTest return true; } - private final static String getPropertyTypeCode(final SampleProperty sampleProperty) + private final static String getPropertyTypeCode(final IEntityProperty sampleProperty) { - return sampleProperty.getEntityTypePropertyType().getPropertyType().getCode(); + return sampleProperty.getPropertyType().getCode(); } private final boolean equals(final NewSample newSample, final NewSample thatNewSample) diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/NewSampleParserObjectFactoryTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/NewSampleParserObjectFactoryTest.java index 578ba8aaa57..e92d6ceffdb 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/NewSampleParserObjectFactoryTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/NewSampleParserObjectFactoryTest.java @@ -29,8 +29,8 @@ import org.testng.annotations.Test; import ch.systemsx.cisd.common.parser.DefaultPropertyMapper; import ch.systemsx.cisd.common.parser.IPropertyMapper; import ch.systemsx.cisd.common.parser.ParserException; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType; /** @@ -171,10 +171,10 @@ public final class NewSampleParserObjectFactoryTest createNewSampleParserObjectFactory(createPropertyMapperWithoutIdentifier(), false); final NewSample objectCreated = parserObjectFactory.createObject(lineTokens); AssertJUnit.assertNull(objectCreated.getIdentifier()); - final SampleProperty[] properties = objectCreated.getProperties(); + final IEntityProperty[] properties = objectCreated.getProperties(); assertEquals(numberOfProperties, properties.length); int index = 0; - for (final SampleProperty sampleProperty : properties) + for (final IEntityProperty sampleProperty : properties) { sampleProperty.getValue().equals(lineTokens[index++]); } @@ -191,10 +191,10 @@ public final class NewSampleParserObjectFactoryTest StringUtils.isEmpty(lineTokens[1]) ? null : lineTokens[1]); assertEquals(objectCreated.getParentIdentifier(), StringUtils.isEmpty(lineTokens[2]) ? null : lineTokens[2]); - final SampleProperty[] properties = objectCreated.getProperties(); + final IEntityProperty[] properties = objectCreated.getProperties(); assertEquals(numberOfProperties, properties.length); int index = 3; - for (final SampleProperty sampleProperty : properties) + for (final IEntityProperty sampleProperty : properties) { sampleProperty.getValue().equals(lineTokens[index++]); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServerTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServerTest.java index 5bbb2cc96de..c45779c16e7 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServerTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServerTest.java @@ -33,11 +33,10 @@ import ch.systemsx.cisd.openbis.generic.shared.AbstractServerTestCase; import ch.systemsx.cisd.openbis.generic.shared.CommonTestUtils; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentUpdateResult; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewMaterial; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType; import ch.systemsx.cisd.openbis.generic.shared.dto.AttachmentPE; import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE; @@ -421,7 +420,7 @@ public final class GenericServerTest extends AbstractServerTestCase public void testEditMaterialNothingChanged() throws Exception { final TechId materialId = CommonTestUtils.TECH_ID; - final List<MaterialProperty> properties = new ArrayList<MaterialProperty>(); + final List<IEntityProperty> properties = new ArrayList<IEntityProperty>(); prepareGetSession(); final Date version = new Date(1); final MaterialPE material = new MaterialPE(); @@ -448,7 +447,7 @@ public final class GenericServerTest extends AbstractServerTestCase public void testEditSampleNothingChanged() throws Exception { final TechId sampleId = CommonTestUtils.TECH_ID; - final List<SampleProperty> properties = new ArrayList<SampleProperty>(); + final List<IEntityProperty> properties = new ArrayList<IEntityProperty>(); prepareGetSession(); final Date version = new Date(); final List<AttachmentPE> attachments = new ArrayList<AttachmentPE>(); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/shared/IGenericServer.java.expected b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/shared/IGenericServer.java.expected index 5aba2258877..8631994b45e 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/shared/IGenericServer.java.expected +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/shared/IGenericServer.java.expected @@ -39,9 +39,8 @@ import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.AbstractT import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.AbstractTechIdPredicate.ExperimentTechIdPredicate; import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.AbstractTechIdPredicate.ProjectTechIdPredicate; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentUpdateResult; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewMaterial; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; @@ -180,7 +179,7 @@ public interface IGenericServer extends IPluginCommonServer @RolesAllowed(RoleSet.INSTANCE_ADMIN) @DatabaseUpdateModification(value = ObjectKind.MATERIAL) public Date updateMaterial(String sessionToken, TechId materialId, - List<MaterialProperty> properties, Date version); + List<IEntityProperty> properties, Date version); /** * Saves changed sample. @@ -201,5 +200,5 @@ public interface IGenericServer extends IPluginCommonServer String sessionToken, @AuthorizationGuard(guardClass = DataSetTechIdPredicate.class) TechId datasetId, @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class) SampleIdentifier sampleIdentifier, - List<DataSetProperty> properties, Date version); + List<IEntityProperty> properties, Date version); } diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/basic/dto/SampleWithPropertiesAndAbundance.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/basic/dto/SampleWithPropertiesAndAbundance.java index 548e501fcdc..2c74a10cf96 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/basic/dto/SampleWithPropertiesAndAbundance.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/basic/dto/SampleWithPropertiesAndAbundance.java @@ -22,7 +22,7 @@ import java.util.List; import com.google.gwt.user.client.rpc.IsSerializable; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder; /** @@ -40,7 +40,7 @@ public class SampleWithPropertiesAndAbundance implements IsSerializable, Seriali private String sampleTypeCode; - private List<SampleProperty> properties; + private List<IEntityProperty> properties; private double abundance; @@ -74,12 +74,12 @@ public class SampleWithPropertiesAndAbundance implements IsSerializable, Seriali this.sampleTypeCode = sampleTypeCode; } - public final List<SampleProperty> getProperties() + public final List<IEntityProperty> getProperties() { return properties; } - public final void setProperties(List<SampleProperty> properties) + public final void setProperties(List<IEntityProperty> properties) { this.properties = properties; } -- GitLab