From cd458865941a95c211fa984be593dd0c95dfb5d7 Mon Sep 17 00:00:00 2001
From: tpylak <tpylak>
Date: Thu, 2 Oct 2008 14:44:33 +0000
Subject: [PATCH] LMS-590 sample browser: improve names, add
 sampleTypePropertyType.isDisplayed field

SVN: 8522
---
 .../server/dataaccess/db/SampleDAO.java       |  2 +-
 .../generic/shared/dto/ColumnNames.java       |  6 ++-
 .../shared/dto/SampleRelationsDepthDTO.java   | 48 -------------------
 .../generic/shared/dto/SampleTypePE.java      | 10 ++--
 .../shared/dto/SampleTypePropertyTypePE.java  | 13 +++++
 .../server/dataaccess/db/SampleDAOTest.java   |  2 +-
 6 files changed, 24 insertions(+), 57 deletions(-)
 delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleRelationsDepthDTO.java

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAO.java
index fffeacbeb35..b726bd37a4b 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAO.java
@@ -60,7 +60,7 @@ public class SampleDAO extends AbstractDAO implements ISampleDAO
         Criteria criteria = getSession().createCriteria(ENTITY_CLASS);
         criteria.add(Restrictions.eq("sampleType", sampleType));
 
-        fetchRelations(criteria, "container", sampleType.getPartOfHierarchyDepth());
+        fetchRelations(criteria, "container", sampleType.getContainerHierarchyDepth());
         fetchRelations(criteria, "generatedFrom", sampleType.getGeneratedFromHierarchyDepth());
 
         final List<SamplePE> list = cast(criteria.list());
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ColumnNames.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ColumnNames.java
index 66fbbd7f666..787cb4c7201 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ColumnNames.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ColumnNames.java
@@ -160,9 +160,11 @@ public final class ColumnNames
 
     public static final String IS_LISTABLE = "IS_LISTABLE";
 
-    public static final String GENERATED_FROM_DEPTH = "GENERATED_FROM_DEPTH";
+    public static final String GENERATED_FROM_DEPTH = "generated_from_depth";
 
-    public static final String PART_OF_DEPTH = "PART_OF_DEPTH";
+    public static final String PART_OF_DEPTH = "part_of_depth";
+
+    public static final String IS_DISPLAYED = "is_displayed";
 
     private ColumnNames()
     {
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleRelationsDepthDTO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleRelationsDepthDTO.java
deleted file mode 100644
index 8b28a48735f..00000000000
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleRelationsDepthDTO.java
+++ /dev/null
@@ -1,48 +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.dto;
-
-/**
- * Configures what kind of associations should be retrieved for the sample.
- * 
- * @author Tomasz Pylak
- */
-public class SampleRelationsDepthDTO
-{
-    private final int generatedFromHierarchyDepth;
-
-    private final int partOfHierarchyDepth;
-
-    public SampleRelationsDepthDTO(int generatedFromHierarchyDepth, int partOfHierarchyDepth)
-    {
-        this.generatedFromHierarchyDepth = generatedFromHierarchyDepth;
-        this.partOfHierarchyDepth = partOfHierarchyDepth;
-    }
-
-    /** how many times should we go through generated-from relation retrieving connected samples */
-    public int getGeneratedFromHierarchyDepth()
-    {
-        return generatedFromHierarchyDepth;
-    }
-
-    /** how many times should we go through part-of relation retrieving connected samples */
-    public int getPartOfHierarchyDepth()
-    {
-        return partOfHierarchyDepth;
-    }
-
-}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleTypePE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleTypePE.java
index 99c32a34287..2d2c57aa978 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleTypePE.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleTypePE.java
@@ -47,7 +47,7 @@ public final class SampleTypePE extends EntityTypePE
 
     private int generatedFromHierarchyDepth;
 
-    private int partOfHierarchyDepth;
+    private int containerHierarchyDepth;
 
     @Column(name = ColumnNames.IS_LISTABLE)
     public boolean isListable()
@@ -72,14 +72,14 @@ public final class SampleTypePE extends EntityTypePE
     }
 
     @Column(name = ColumnNames.PART_OF_DEPTH)
-    public int getPartOfHierarchyDepth()
+    public int getContainerHierarchyDepth()
     {
-        return partOfHierarchyDepth;
+        return containerHierarchyDepth;
     }
 
-    public void setPartOfHierarchyDepth(int partOfHierarchyDepth)
+    public void setContainerHierarchyDepth(int partOfHierarchyDepth)
     {
-        this.partOfHierarchyDepth = partOfHierarchyDepth;
+        this.containerHierarchyDepth = partOfHierarchyDepth;
     }
 
     @Transient
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleTypePropertyTypePE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleTypePropertyTypePE.java
index ab325b4cdc9..3f3599472bd 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleTypePropertyTypePE.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleTypePropertyTypePE.java
@@ -47,6 +47,19 @@ public class SampleTypePropertyTypePE extends EntityTypePropertyTypePE
 
     public static final SampleTypePropertyTypePE[] EMPTY_ARRAY = new SampleTypePropertyTypePE[0];
 
+    private boolean isDisplayed;
+
+    @Column(name = ColumnNames.IS_DISPLAYED)
+    public boolean isDisplayed()
+    {
+        return isDisplayed;
+    }
+
+    public void setDisplayed(boolean isDisplayed)
+    {
+        this.isDisplayed = isDisplayed;
+    }
+
     //
     // EntityTypePropertyTypePE
     //
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAOTest.java
index 805a670b72d..bbfe5e2f009 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAOTest.java
@@ -44,7 +44,7 @@ public final class SampleDAOTest extends AbstractDAOTest
         SampleTypePE secType = getSampleType(SampleTypeCode.DILUTION_PLATE);
         SampleTypePE thrType = getSampleType(SampleTypeCode.CELL_PLATE);
 
-        thrType.setPartOfHierarchyDepth(1);
+        thrType.setContainerHierarchyDepth(1);
         thrType.setGeneratedFromHierarchyDepth(1);
 
         SamplePE sampleA = createSample(fstType, "grandParent", null);
-- 
GitLab