From 0080f2a71d2641b9580da509fabf6145e9a79436 Mon Sep 17 00:00:00 2001
From: brinn <brinn>
Date: Sat, 19 Nov 2011 12:33:29 +0000
Subject: [PATCH] change: make present_in_archive flag available as dataset
 metadata in the Web GUI

SVN: 23729
---
 .../generic/client/web/client/application/Dict.java  |  2 ++
 .../specific/data/CommonExternalDataColDefKind.java  |  9 +++++++++
 .../web/client/dto/ExternalDataGridColumnIDs.java    |  2 ++
 .../resultset/AbstractExternalDataProvider.java      |  3 +++
 .../business/bo/datasetlister/DatasetLister.java     |  2 ++
 .../business/bo/datasetlister/DatasetRecord.java     |  2 ++
 .../openbis/generic/shared/basic/dto/DataSet.java    | 12 ++++++++++++
 .../generic/shared/translator/DataSetTranslator.java |  1 +
 .../application/dataset/DataSetPropertiesPanel.java  |  2 ++
 .../cisd/openbis/public/common-dictionary.js         |  1 +
 10 files changed, 36 insertions(+)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java
index e963a57c2f5..de12f55d782 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java
@@ -618,6 +618,8 @@ public abstract class Dict
 
     public static final String ARCHIVING_STATUS = "archiving_status";
 
+    public static final String PRESENT_IN_ARCHIVE = "present_in_archive";
+
     public static final String PRODUCTION_DATE = "production_date";
 
     public static final String DATA_PRODUCER_CODE = "data_producer_code";
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/CommonExternalDataColDefKind.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/CommonExternalDataColDefKind.java
index 4ff16662dec..37160f8b88a 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/CommonExternalDataColDefKind.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/CommonExternalDataColDefKind.java
@@ -255,6 +255,15 @@ public enum CommonExternalDataColDefKind implements IColumnDefinitionKind<Extern
             }
         }),
 
+    PRESENT_IN_ARCHIVE(new AbstractDataSetColumnDefinitionKind(Dict.PRESENT_IN_ARCHIVE, true)
+        {
+            @Override
+            public String tryGetValue(DataSet entity)
+            {
+                return SimpleYesNoRenderer.render(entity.isPresentInArchive());
+            }
+        }),
+
     FILE_FORMAT_TYPE(new AbstractDataSetColumnDefinitionKind(Dict.FILE_FORMAT_TYPE, true)
         {
             @Override
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/ExternalDataGridColumnIDs.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/ExternalDataGridColumnIDs.java
index 4d709a16c72..b462224b079 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/ExternalDataGridColumnIDs.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/ExternalDataGridColumnIDs.java
@@ -58,6 +58,8 @@ public class ExternalDataGridColumnIDs
 
     public static final String ARCHIVING_STATUS = "ARCHIVING_STATUS";
 
+    public static final String PRESENT_IN_ARCHIVE = "PRESENT_IN_ARCHIVE";
+
     public static final String FILE_FORMAT_TYPE = "FILE_FORMAT_TYPE";
 
     public static final String PRODUCTION_DATE = "PRODUCTION_DATE";
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/resultset/AbstractExternalDataProvider.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/resultset/AbstractExternalDataProvider.java
index e05211870c1..6bc68ef908a 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/resultset/AbstractExternalDataProvider.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/resultset/AbstractExternalDataProvider.java
@@ -32,6 +32,7 @@ import static ch.systemsx.cisd.openbis.generic.client.web.client.dto.ExternalDat
 import static ch.systemsx.cisd.openbis.generic.client.web.client.dto.ExternalDataGridColumnIDs.LOCATION;
 import static ch.systemsx.cisd.openbis.generic.client.web.client.dto.ExternalDataGridColumnIDs.ORDER_IN_CONTAINER;
 import static ch.systemsx.cisd.openbis.generic.client.web.client.dto.ExternalDataGridColumnIDs.PERM_ID;
+import static ch.systemsx.cisd.openbis.generic.client.web.client.dto.ExternalDataGridColumnIDs.PRESENT_IN_ARCHIVE;
 import static ch.systemsx.cisd.openbis.generic.client.web.client.dto.ExternalDataGridColumnIDs.PRODUCTION_DATE;
 import static ch.systemsx.cisd.openbis.generic.client.web.client.dto.ExternalDataGridColumnIDs.PROJECT;
 import static ch.systemsx.cisd.openbis.generic.client.web.client.dto.ExternalDataGridColumnIDs.PROPERTIES_PREFIX;
@@ -145,6 +146,8 @@ public abstract class AbstractExternalDataProvider extends
                 builder.column(LOCATION).addString(realDataSet.getFullLocation());
                 builder.column(ARCHIVING_STATUS)
                         .addString(realDataSet.getStatus().getDescription());
+                builder.column(PRESENT_IN_ARCHIVE).addString(
+                        SimpleYesNoRenderer.render(realDataSet.isPresentInArchive()));
                 FileFormatType fileFormatType = realDataSet.getFileFormatType();
                 builder.column(FILE_FORMAT_TYPE).addString(
                         fileFormatType == null ? "" : fileFormatType.getCode());
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetLister.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetLister.java
index ba555ae800e..2f06fda99a6 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetLister.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetLister.java
@@ -691,6 +691,8 @@ public class DatasetLister extends AbstractLister implements IDatasetLister
         dataSet.setComplete(resolve(record.is_complete));
         dataSet.setStatus(record.status == null ? null : DataSetArchivingStatus
                 .valueOf(record.status));
+        dataSet.setPresentInArchive(record.present_in_archive == null ? false
+                : record.present_in_archive);
         dataSet.setSpeedHint(record.speed_hint == null ? Constants.DEFAULT_SPEED_HINT
                 : record.speed_hint);
         dataSet.setShareId(record.share_id);
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetRecord.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetRecord.java
index 542fa893781..a009ab76844 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetRecord.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetRecord.java
@@ -60,5 +60,7 @@ public class DatasetRecord extends CodeRecord
 
     public String status;
 
+    public Boolean present_in_archive;
+
     public Integer speed_hint;
 }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSet.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSet.java
index 6e7acfbe637..54bd7dfceed 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSet.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSet.java
@@ -28,6 +28,8 @@ public class DataSet extends ExternalData implements IDatasetLocation
 
     private Boolean complete;
 
+    private boolean presentInArchive;
+
     private String shareId;
 
     private String location;
@@ -101,6 +103,16 @@ public class DataSet extends ExternalData implements IDatasetLocation
         this.status = status;
     }
 
+    public boolean isPresentInArchive()
+    {
+        return presentInArchive;
+    }
+
+    public void setPresentInArchive(boolean presentInArchive)
+    {
+        this.presentInArchive = presentInArchive;
+    }
+
     @Override
     public int getSpeedHint()
     {
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/DataSetTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/DataSetTranslator.java
index 03d7351720a..5e832fdeba7 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/DataSetTranslator.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/DataSetTranslator.java
@@ -206,6 +206,7 @@ public class DataSetTranslator
         dataSet.setSize(externalDataPE.getSize());
         dataSet.setComplete(BooleanOrUnknown.tryToResolve(externalDataPE.getComplete()));
         dataSet.setStatus(externalDataPE.getStatus());
+        dataSet.setPresentInArchive(externalDataPE.isPresentInArchive());
         dataSet.setSpeedHint(externalDataPE.getSpeedHint());
         dataSet.setFileFormatType(TypeTranslator.translate(externalDataPE.getFileFormatType()));
         dataSet.setLocation(externalDataPE.getLocation());
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertiesPanel.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertiesPanel.java
index 6cc33fb5e53..2f1fa8041c0 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertiesPanel.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertiesPanel.java
@@ -113,6 +113,8 @@ public class DataSetPropertiesPanel extends ContentPanel
             {
                 properties.put(messageProvider.getMessage(Dict.ARCHIVING_STATUS), concreteDataSet
                         .getStatus().getDescription());
+                properties.put(messageProvider.getMessage(Dict.PRESENT_IN_ARCHIVE),
+                        concreteDataSet.isPresentInArchive());
             }
             properties.put(messageProvider.getMessage(Dict.DATA_STORE),
                     concreteDataSet.getDataStore());
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js
index 5523b63b325..589fb7547f4 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js
@@ -681,6 +681,7 @@ var common = {
  is_complete: "Complete?",
  complete: "Complete",
  archiving_status: "Archiving Status",
+ present_in_archive: "Present in Archive",
  data_set_type: "Data Set Type",
  parent: "Parent",
  parent_code: "Parent Code",
-- 
GitLab