From 561cd3dc8a88a3b2b94a566aae2e2f9e31237230 Mon Sep 17 00:00:00 2001 From: izabel <izabel> Date: Mon, 7 Jun 2010 07:57:58 +0000 Subject: [PATCH] [LMS-1575] sort properties by ordinal SVN: 16283 --- .../basic/dto/AbstractEntityProperty.java | 18 ++++++++++++++++++ .../shared/basic/dto/IEntityProperty.java | 4 ++++ .../translator/EntityPropertyTranslator.java | 1 + 3 files changed, 23 insertions(+) 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 index 9bee5c878f5..183bb63a72f 100644 --- 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 @@ -32,6 +32,8 @@ public abstract class AbstractEntityProperty implements IEntityProperty private PropertyType propertyType; + private Long ordinal; + public PropertyType getPropertyType() { return propertyType; @@ -94,12 +96,28 @@ public abstract class AbstractEntityProperty implements IEntityProperty { } + public void setOrdinal(Long ordinal) + { + this.ordinal = ordinal; + } + + public Long getOrdinal() + { + return ordinal; + } + // // Comparable // public int compareTo(IEntityProperty o) { + Long thisOrdinal = this.getOrdinal(); + Long otherOrdinal = o.getOrdinal(); + if (thisOrdinal != null && otherOrdinal != null) + { + return thisOrdinal.compareTo(otherOrdinal); + } PropertyType thisPropertyType = this.getPropertyType(); PropertyType otherPropertyType = o.getPropertyType(); if (thisPropertyType.getLabel().equals(otherPropertyType.getLabel())) 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 index 57dc61f542e..9ed120984fe 100644 --- 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 @@ -51,4 +51,8 @@ public interface IEntityProperty extends Serializable, IsSerializable, Comparabl public void setPropertyType(final PropertyType propertyType); + void setOrdinal(Long ordinal); + + Long getOrdinal(); + } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/EntityPropertyTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/EntityPropertyTranslator.java index 6282edf4f1a..291ce73f26b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/EntityPropertyTranslator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/EntityPropertyTranslator.java @@ -48,6 +48,7 @@ public final class EntityPropertyTranslator final IEntityProperty result = PropertyTranslatorUtils.createEntityProperty(typeCode); result.setPropertyType(PropertyTypeTranslator.translate(propertyPE .getEntityTypePropertyType().getPropertyType(), cacheOrNull)); + result.setOrdinal(propertyPE.getEntityTypePropertyType().getOrdinal()); switch (typeCode) { case CONTROLLEDVOCABULARY: -- GitLab