From 6f53c20daff95e25afc33afcc97a68ba111e0ed8 Mon Sep 17 00:00:00 2001 From: tpylak <tpylak> Date: Mon, 16 Feb 2009 12:16:54 +0000 Subject: [PATCH] LMS-749 bugfix: searching and showing sample properties did not work correctly SVN: 9842 --- .../application/ui/data/CriterionWidget.java | 5 +---- .../data/DataSetSearchFieldsSelectionWidget.java | 15 +++++++++++---- .../ui/data/DataSetSearchHitModel.java | 8 ++++++-- .../columns/PropertyExperimentColDef.java | 2 +- .../ui/grid/AbstractPropertyColDef.java | 14 +++++++++----- .../ui/sample/columns/PropertySampleColDef.java | 2 +- .../shared/basic/dto/DataSetSearchCriterion.java | 6 ++++++ 7 files changed, 35 insertions(+), 17 deletions(-) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/CriterionWidget.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/CriterionWidget.java index 1c08cdd9ea2..81121553ad6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/CriterionWidget.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/CriterionWidget.java @@ -170,10 +170,7 @@ public class CriterionWidget extends HorizontalPanel final DataSetSearchField selectedFieldName = nameField.tryGetSelectedField(); if (selectedFieldName != null && StringUtils.isBlank(selectedValue) == false) { - final DataSetSearchCriterion result = new DataSetSearchCriterion(); - result.setField(selectedFieldName); - result.setValue(selectedValue); - return result; + return new DataSetSearchCriterion(selectedFieldName, selectedValue); } return null; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetSearchFieldsSelectionWidget.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetSearchFieldsSelectionWidget.java index 013ba4d6c4c..f7475ea23ad 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetSearchFieldsSelectionWidget.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetSearchFieldsSelectionWidget.java @@ -213,7 +213,7 @@ public final class DataSetSearchFieldsSelectionWidget extends { List<PropertyType> relevantPropertyTypes = DataSetSearchHitModel.filterSamplePropertyTypes(propertyTypes); - return addPropertyTypes(result, relevantPropertyTypes); + return addPropertyTypes(result, relevantPropertyTypes, false); } private static List<String> addExperimentPropertyTypes( @@ -221,19 +221,26 @@ public final class DataSetSearchFieldsSelectionWidget extends { List<PropertyType> relevantPropertyTypes = DataSetSearchHitModel.filterExperimentPropertyTypes(propertyTypes); - return addPropertyTypes(result, relevantPropertyTypes); + return addPropertyTypes(result, relevantPropertyTypes, true); } // returns codes of added properties private static List<String> addPropertyTypes(final List<DataSetSearchFieldComboModel> result, - List<PropertyType> types) + List<PropertyType> types, boolean isExperimentProperty) { List<String> allProps = new ArrayList<String>(); for (final PropertyType st : types) { String code = st.getCode(); allProps.add(code); - DataSetSearchField field = DataSetSearchField.createSampleProperty(code); + DataSetSearchField field; + if (isExperimentProperty) + { + field = DataSetSearchField.createSampleProperty(code); + } else + { + field = DataSetSearchField.createExperimentProperty(code); + } DataSetSearchFieldComboModel comboModel = createPropertyComboModel(st, field, isLabelDuplicated(st, types)); result.add(comboModel); 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 d20e419b48c..cb0b0c6089f 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 @@ -173,6 +173,8 @@ public class DataSetSearchHitModel extends BaseEntityModel<DataSetSearchHit> public static final class DataSetSamplePropertyColDef extends AbstractPropertyColDef<DataSetSearchHit> { + private static final String ID_PREFIX = "sample"; + // GWT only public DataSetSamplePropertyColDef() { @@ -181,7 +183,7 @@ public class DataSetSearchHitModel extends BaseEntityModel<DataSetSearchHit> private DataSetSamplePropertyColDef(PropertyType propertyType, boolean isDisplayedByDefault, int width, String propertyTypeLabel) { - super(propertyType, isDisplayedByDefault, width, propertyTypeLabel); + super(propertyType, isDisplayedByDefault, width, propertyTypeLabel, ID_PREFIX); } @Override @@ -194,6 +196,8 @@ public class DataSetSearchHitModel extends BaseEntityModel<DataSetSearchHit> public static final class DataSetExperimentPropertyColDef extends AbstractPropertyColDef<DataSetSearchHit> { + private static final String ID_PREFIX = "exp"; + // GWT only public DataSetExperimentPropertyColDef() { @@ -202,7 +206,7 @@ public class DataSetSearchHitModel extends BaseEntityModel<DataSetSearchHit> public DataSetExperimentPropertyColDef(PropertyType propertyType, boolean isDisplayedByDefault, int width, String propertyTypeLabel) { - super(propertyType, isDisplayedByDefault, width, propertyTypeLabel); + super(propertyType, isDisplayedByDefault, width, propertyTypeLabel, ID_PREFIX); } @Override diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/columns/PropertyExperimentColDef.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/columns/PropertyExperimentColDef.java index fc1b1691b6d..370fd3a7d32 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/columns/PropertyExperimentColDef.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/columns/PropertyExperimentColDef.java @@ -34,7 +34,7 @@ public class PropertyExperimentColDef extends AbstractPropertyColDef<Experiment> // GWT only public PropertyExperimentColDef() { - super(null, false, 0, false, null); + super(null, false, 0, false, null, null); } public PropertyExperimentColDef(PropertyType propertyType) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractPropertyColDef.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractPropertyColDef.java index a14838868af..e3308c45b78 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractPropertyColDef.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractPropertyColDef.java @@ -35,6 +35,8 @@ public abstract class AbstractPropertyColDef<T> extends AbstractColumnDefinition private static final String PROPERTY_PREFIX = "property"; + private String identifierPrefix; + private boolean isInternalNamespace; private String simpleCode; @@ -46,22 +48,24 @@ public abstract class AbstractPropertyColDef<T> extends AbstractColumnDefinition public AbstractPropertyColDef(PropertyType propertyType, boolean isDisplayedByDefault) { - this(propertyType, isDisplayedByDefault, PROPERTY_COLUMN_WIDTH, propertyType.getLabel()); + this(propertyType, isDisplayedByDefault, PROPERTY_COLUMN_WIDTH, propertyType.getLabel(), ""); } public AbstractPropertyColDef(PropertyType propertyType, boolean isDisplayedByDefault, - int width, String propertyTypeLabel) + int width, String propertyTypeLabel, String identifierPrefix) { this(propertyType.getSimpleCode(), isDisplayedByDefault, width, propertyType - .isInternalNamespace(), propertyTypeLabel); + .isInternalNamespace(), propertyTypeLabel, identifierPrefix + PROPERTY_PREFIX); } protected AbstractPropertyColDef(String propertyTypeCode, boolean isDisplayedByDefault, - int width, boolean isInternalNamespace, String propertyTypeLabel) + int width, boolean isInternalNamespace, String propertyTypeLabel, + String identifierPrefix) { super(propertyTypeLabel, width, isDisplayedByDefault); this.isInternalNamespace = isInternalNamespace; this.simpleCode = propertyTypeCode; + this.identifierPrefix = identifierPrefix; } @Override @@ -91,6 +95,6 @@ public abstract class AbstractPropertyColDef<T> extends AbstractColumnDefinition public String getIdentifier() { - return PROPERTY_PREFIX + isInternalNamespace + simpleCode; + return identifierPrefix + isInternalNamespace + simpleCode; } } \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/columns/PropertySampleColDef.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/columns/PropertySampleColDef.java index 5e282d79c91..7376ad3337b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/columns/PropertySampleColDef.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/columns/PropertySampleColDef.java @@ -30,7 +30,7 @@ class PropertySampleColDef extends AbstractPropertyColDef<Sample> implements IsS // GWT only public PropertySampleColDef() { - super(null, false, 0, false, null); + super(null, false, 0, false, null, null); } public PropertySampleColDef(PropertyType propertyType, boolean isDisplayedByDefault) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSetSearchCriterion.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSetSearchCriterion.java index 4d5ed614510..0895311fe90 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSetSearchCriterion.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSetSearchCriterion.java @@ -212,6 +212,12 @@ public class DataSetSearchCriterion implements IsSerializable { } + public DataSetSearchCriterion(DataSetSearchField field, String value) + { + this.field = field; + this.value = value; + } + public DataSetSearchField getField() { return field; -- GitLab