From 2775cebbe7e3120fb7707e984e8be29d97f73e8c Mon Sep 17 00:00:00 2001
From: brinn <brinn>
Date: Tue, 6 Dec 2011 16:38:49 +0000
Subject: [PATCH] Do not set 'Pending Evaluation' values for dynamic properties
 that are about to be updated and change the property history rules such that
 they put dynamic properties also in the history, if they do not correspond to
 error values.

SVN: 23898
---
 .../server/business/bo/PlaceholderPropertyCreator.java        | 4 ++--
 openbis/source/sql/postgresql/091/function-091.sql            | 4 ----
 openbis/source/sql/postgresql/migration/migration-090-091.sql | 4 ----
 openbis/sourceTest/sql/postgresql/091/finish-091.sql          | 4 ----
 4 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PlaceholderPropertyCreator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PlaceholderPropertyCreator.java
index f5d56d2fb0e..b905307cb07 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PlaceholderPropertyCreator.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PlaceholderPropertyCreator.java
@@ -32,8 +32,8 @@ class PlaceholderPropertyCreator implements IPropertyPlaceholderCreator
     public void addDynamicPropertiesPlaceholders(Set<IEntityProperty> definedProperties,
             Set<String> dynamicProperties)
     {
-        addPlaceholders(definedProperties, dynamicProperties,
-                BasicConstant.DYNAMIC_PROPERTY_PLACEHOLDER_VALUE);
+        // Note: if you want to set the dynamicProperties to 'invalid', this is the right place
+        // to do it.
     }
 
     /**
diff --git a/openbis/source/sql/postgresql/091/function-091.sql b/openbis/source/sql/postgresql/091/function-091.sql
index c9c38b4f4e4..a6c4f33ac29 100644
--- a/openbis/source/sql/postgresql/091/function-091.sql
+++ b/openbis/source/sql/postgresql/091/function-091.sql
@@ -668,7 +668,6 @@ CREATE OR REPLACE RULE data_deleted_delete AS
 CREATE OR REPLACE RULE material_properties_update AS
     ON UPDATE TO material_properties 
     WHERE decode(substring(OLD.value from 1 for 1), 'escape') != E'\\xefbfbd'
-      AND decode(substring(NEW.value from 1 for 1), 'escape') != E'\\xefbfbd' 
     DO ALSO 
        INSERT INTO material_properties_history (
          ID, 
@@ -723,7 +722,6 @@ CREATE OR REPLACE RULE material_properties_delete AS
 CREATE OR REPLACE RULE experiment_properties_update AS
     ON UPDATE TO experiment_properties 
     WHERE decode(substring(OLD.value from 1 for 1), 'escape') != E'\\xefbfbd'
-      AND decode(substring(NEW.value from 1 for 1), 'escape') != E'\\xefbfbd' 
     DO ALSO 
        INSERT INTO experiment_properties_history (
          ID, 
@@ -778,7 +776,6 @@ CREATE OR REPLACE RULE experiment_properties_delete AS
 CREATE OR REPLACE RULE sample_properties_update AS
     ON UPDATE TO sample_properties
     WHERE decode(substring(OLD.value from 1 for 1), 'escape') != E'\\xefbfbd'
-      AND decode(substring(NEW.value from 1 for 1), 'escape') != E'\\xefbfbd' 
     DO ALSO
        INSERT INTO sample_properties_history (
          ID, 
@@ -833,7 +830,6 @@ CREATE OR REPLACE RULE sample_properties_delete AS
 CREATE OR REPLACE RULE data_set_properties_update AS
     ON UPDATE TO data_set_properties 
     WHERE decode(substring(OLD.value from 1 for 1), 'escape') != E'\\xefbfbd'
-      AND decode(substring(NEW.value from 1 for 1), 'escape') != E'\\xefbfbd' 
     DO ALSO
        INSERT INTO data_set_properties_history (
          ID, 
diff --git a/openbis/source/sql/postgresql/migration/migration-090-091.sql b/openbis/source/sql/postgresql/migration/migration-090-091.sql
index 59c4ff612b7..3d20724483e 100644
--- a/openbis/source/sql/postgresql/migration/migration-090-091.sql
+++ b/openbis/source/sql/postgresql/migration/migration-090-091.sql
@@ -75,7 +75,6 @@ ALTER TABLE material_properties_history ALTER COLUMN valid_from_timestamp SET NO
 CREATE OR REPLACE RULE material_properties_update AS
     ON UPDATE TO material_properties 
     WHERE decode(substring(OLD.value from 1 for 1), 'escape') != E'\\xefbfbd'
-      AND decode(substring(NEW.value from 1 for 1), 'escape') != E'\\xefbfbd' 
     DO ALSO 
        INSERT INTO material_properties_history (
          ID, 
@@ -130,7 +129,6 @@ CREATE OR REPLACE RULE material_properties_delete AS
 CREATE OR REPLACE RULE experiment_properties_update AS
     ON UPDATE TO experiment_properties 
     WHERE decode(substring(OLD.value from 1 for 1), 'escape') != E'\\xefbfbd'
-      AND decode(substring(NEW.value from 1 for 1), 'escape') != E'\\xefbfbd' 
     DO ALSO 
        INSERT INTO experiment_properties_history (
          ID, 
@@ -185,7 +183,6 @@ CREATE OR REPLACE RULE experiment_properties_delete AS
 CREATE OR REPLACE RULE sample_properties_update AS
     ON UPDATE TO sample_properties
     WHERE decode(substring(OLD.value from 1 for 1), 'escape') != E'\\xefbfbd'
-      AND decode(substring(NEW.value from 1 for 1), 'escape') != E'\\xefbfbd' 
     DO ALSO
        INSERT INTO sample_properties_history (
          ID, 
@@ -240,7 +237,6 @@ CREATE OR REPLACE RULE sample_properties_delete AS
 CREATE OR REPLACE RULE data_set_properties_update AS
     ON UPDATE TO data_set_properties 
     WHERE decode(substring(OLD.value from 1 for 1), 'escape') != E'\\xefbfbd'
-      AND decode(substring(NEW.value from 1 for 1), 'escape') != E'\\xefbfbd' 
     DO ALSO
        INSERT INTO data_set_properties_history (
          ID, 
diff --git a/openbis/sourceTest/sql/postgresql/091/finish-091.sql b/openbis/sourceTest/sql/postgresql/091/finish-091.sql
index 5d83ff73aaf..2b3e88e648f 100644
--- a/openbis/sourceTest/sql/postgresql/091/finish-091.sql
+++ b/openbis/sourceTest/sql/postgresql/091/finish-091.sql
@@ -306,7 +306,6 @@ CREATE RULE data_insert AS ON INSERT TO data DO INSTEAD INSERT INTO data_all (id
 CREATE RULE data_set_properties_update AS
     ON UPDATE TO data_set_properties 
     WHERE decode(substring(OLD.value from 1 for 1), 'escape') != E'\\xefbfbd'
-      AND decode(substring(NEW.value from 1 for 1), 'escape') != E'\\xefbfbd' 
     DO ALSO
        INSERT INTO data_set_properties_history (
          ID, 
@@ -362,7 +361,6 @@ CREATE RULE experiment_insert AS ON INSERT TO experiments DO INSTEAD INSERT INTO
 CREATE RULE experiment_properties_update AS
     ON UPDATE TO experiment_properties 
     WHERE decode(substring(OLD.value from 1 for 1), 'escape') != E'\\xefbfbd'
-      AND decode(substring(NEW.value from 1 for 1), 'escape') != E'\\xefbfbd' 
     DO ALSO 
        INSERT INTO experiment_properties_history (
          ID, 
@@ -416,7 +414,6 @@ CREATE RULE experiments_deleted_update AS ON UPDATE TO experiments_deleted DO IN
 CREATE RULE material_properties_update AS
     ON UPDATE TO material_properties 
     WHERE decode(substring(OLD.value from 1 for 1), 'escape') != E'\\xefbfbd'
-      AND decode(substring(NEW.value from 1 for 1), 'escape') != E'\\xefbfbd' 
     DO ALSO 
        INSERT INTO material_properties_history (
          ID, 
@@ -471,7 +468,6 @@ CREATE RULE sample_insert AS ON INSERT TO samples DO INSTEAD INSERT INTO samples
 CREATE RULE sample_properties_update AS
     ON UPDATE TO sample_properties
     WHERE decode(substring(OLD.value from 1 for 1), 'escape') != E'\\xefbfbd'
-      AND decode(substring(NEW.value from 1 for 1), 'escape') != E'\\xefbfbd' 
     DO ALSO
        INSERT INTO sample_properties_history (
          ID, 
-- 
GitLab