From 9104c3b5b45c62aa5af5bc117e9fa09c66d7a3fa Mon Sep 17 00:00:00 2001
From: Maria Hofmann <m.hofmann@adito.de>
Date: Mon, 17 Jun 2019 10:55:13 +0200
Subject: [PATCH] keywords, fixes

---
 .../basic/2019.1.4/DSGVO/create_DSGVO.xml     |   4 +-
 .../basic/2019.1.4/DSGVO/insert_DSGVO.xml     |   4 +-
 aliasDefinition/Data_alias/Data_alias.aod     |   8 +-
 entity/DSGVO_entity/DSGVO_entity.aod          |  24 +-
 .../recordcontainers/db/conditionProcess.js   |  16 +-
 .../recordcontainers/db/fromClauseProcess.js  |   8 +-
 .../recordcontainers/db/onDBInsert.js         |  40 +--
 .../medium.displayvalue/expression.js         |   6 +
 .../medium.value/expression.js                |  22 ++
 entity/MediumValue/DSGVO_entity.aod           | 257 ++++++++++++++++++
 .../entityfields/contact_id/valueProcess.js   |   0
 .../entityfields/date_edit/valueProcess.js    |   7 +
 .../entityfields/date_new/valueProcess.js     |   7 +
 .../children/anonymperson/onActionProcess.js  |   5 +
 .../children/anonymperson/stateProcess.js     |   0
 .../entityfields/dsgvoid/valueProcess.js      |   8 +
 .../containername_param/valueProcess.js       |   4 +
 .../containername_param/valueProcess.js       |   4 +
 .../opendisclosurereport/onActionProcess.js   |   5 +
 .../openinforeport/onActionProcess.js         |   5 +
 .../entityfields/right/displayValueProcess.js |   6 +
 .../entityfields/use/displayValueProcess.js   |   6 +
 .../entityfields/user_edit/valueProcess.js    |   7 +
 .../entityfields/user_new/valueProcess.js     |   7 +
 .../recordcontainers/db/conditionProcess.js   |   8 +
 .../recordcontainers/db/fromClauseProcess.js  |   6 +
 .../recordcontainers/db/onDBInsert.js         |  44 +++
 .../medium.value/expression.js                |  22 ++
 .../right.displayvalue/expression.js          |   6 +
 .../use.displayvalue/expression.js            |   6 +
 neonView/DSGVOEdit_view/DSGVOEdit_view.aod    |   9 +
 .../DSGVOFilter_view/DSGVOFilter_view.aod     |   4 +
 32 files changed, 516 insertions(+), 49 deletions(-)
 create mode 100644 entity/DSGVO_entity/recordcontainers/db/recordfieldmappings/medium.displayvalue/expression.js
 create mode 100644 entity/DSGVO_entity/recordcontainers/db/recordfieldmappings/medium.value/expression.js
 create mode 100644 entity/MediumValue/DSGVO_entity.aod
 create mode 100644 entity/MediumValue/entityfields/contact_id/valueProcess.js
 create mode 100644 entity/MediumValue/entityfields/date_edit/valueProcess.js
 create mode 100644 entity/MediumValue/entityfields/date_new/valueProcess.js
 create mode 100644 entity/MediumValue/entityfields/dsgvoactions/children/anonymperson/onActionProcess.js
 create mode 100644 entity/MediumValue/entityfields/dsgvoactions/children/anonymperson/stateProcess.js
 create mode 100644 entity/MediumValue/entityfields/dsgvoid/valueProcess.js
 create mode 100644 entity/MediumValue/entityfields/keywordright/children/containername_param/valueProcess.js
 create mode 100644 entity/MediumValue/entityfields/keyworduse/children/containername_param/valueProcess.js
 create mode 100644 entity/MediumValue/entityfields/reports/children/opendisclosurereport/onActionProcess.js
 create mode 100644 entity/MediumValue/entityfields/reports/children/openinforeport/onActionProcess.js
 create mode 100644 entity/MediumValue/entityfields/right/displayValueProcess.js
 create mode 100644 entity/MediumValue/entityfields/use/displayValueProcess.js
 create mode 100644 entity/MediumValue/entityfields/user_edit/valueProcess.js
 create mode 100644 entity/MediumValue/entityfields/user_new/valueProcess.js
 create mode 100644 entity/MediumValue/recordcontainers/db/conditionProcess.js
 create mode 100644 entity/MediumValue/recordcontainers/db/fromClauseProcess.js
 create mode 100644 entity/MediumValue/recordcontainers/db/onDBInsert.js
 create mode 100644 entity/MediumValue/recordcontainers/db/recordfieldmappings/medium.value/expression.js
 create mode 100644 entity/MediumValue/recordcontainers/db/recordfieldmappings/right.displayvalue/expression.js
 create mode 100644 entity/MediumValue/recordcontainers/db/recordfieldmappings/use.displayvalue/expression.js

diff --git a/.liquibase/Data_alias/basic/2019.1.4/DSGVO/create_DSGVO.xml b/.liquibase/Data_alias/basic/2019.1.4/DSGVO/create_DSGVO.xml
index ff9a187f9dc..f28453e4b0a 100644
--- a/.liquibase/Data_alias/basic/2019.1.4/DSGVO/create_DSGVO.xml
+++ b/.liquibase/Data_alias/basic/2019.1.4/DSGVO/create_DSGVO.xml
@@ -17,8 +17,8 @@
                         
             <column name="ROW_ID" type="CHAR(36)" />
             
-            <column name="RIGHT" type="INTEGER" />
-            <column name="USE" type="INTEGER" />
+            <column name="RIGHT" type="CHAR(36)" />
+            <column name="USE" type="CHAR(36)" />
             
             <column name="TABLENAME" type="NVARCHAR(30)" />
             <column name="VALID_TO" type="TIMESTAMP" />
diff --git a/.liquibase/Data_alias/basic/2019.1.4/DSGVO/insert_DSGVO.xml b/.liquibase/Data_alias/basic/2019.1.4/DSGVO/insert_DSGVO.xml
index b268177c97e..518da7b2af7 100644
--- a/.liquibase/Data_alias/basic/2019.1.4/DSGVO/insert_DSGVO.xml
+++ b/.liquibase/Data_alias/basic/2019.1.4/DSGVO/insert_DSGVO.xml
@@ -8,8 +8,8 @@
             <column name="USER_EDIT" value="null"/>
             <column name="DATE_EDIT" value="null"/>
             <column name="ROW_ID" value="73d73404-e7f5-11e8-9f32-f2801f1b9fd1"/>
-            <column name="RIGHT" valueNumeric="0"/>
-            <column name="USE" valueNumeric="0"/>
+            <column name="RIGHT" value="b3f7038b-622b-45e4-8c5c-4b0c7aed6300"/>
+            <column name="USE" value="56762dd8-cfe8-4551-a758-0fd0fa4f7e76"/>
             <column name="TABLENAME" value="ADDRESS"/>
             <column name="VALID_TO" value="2019-10-10 06:57:51.882"/>
             <column name="CONTACT_ID" value="7c1efe4c-cc73-4e95-bdf0-208a3ff699b5"/>
diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod
index d611b82424c..3d1bf4244e2 100644
--- a/aliasDefinition/Data_alias/Data_alias.aod
+++ b/aliasDefinition/Data_alias/Data_alias.aod
@@ -9814,8 +9814,8 @@
                 <name>USE</name>
                 <dbName></dbName>
                 <primaryKey v="false" />
-                <columnType v="4" />
-                <size v="10" />
+                <columnType v="1" />
+                <size v="36" />
                 <scale v="0" />
                 <notNull v="false" />
                 <isUnique v="false" />
@@ -9828,8 +9828,8 @@
                 <name>RIGHT</name>
                 <dbName></dbName>
                 <primaryKey v="false" />
-                <columnType v="4" />
-                <size v="10" />
+                <columnType v="1" />
+                <size v="36" />
                 <scale v="0" />
                 <notNull v="false" />
                 <isUnique v="false" />
diff --git a/entity/DSGVO_entity/DSGVO_entity.aod b/entity/DSGVO_entity/DSGVO_entity.aod
index 48cb9e1aa31..22df5e3bc84 100644
--- a/entity/DSGVO_entity/DSGVO_entity.aod
+++ b/entity/DSGVO_entity/DSGVO_entity.aod
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.6" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.6">
+<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.7" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.7">
   <name>DSGVO_entity</name>
   <majorModelMode>DISTRIBUTED</majorModelMode>
   <icon>VAADIN:LOCK</icon>
@@ -47,6 +47,7 @@
       <description>The statutory source of the private data. Keyword DSGVORight</description>
       <consumer>KeywordRight</consumer>
       <groupable v="true" />
+      <linkedContext>KeywordEntry</linkedContext>
       <mandatory v="true" />
       <displayValueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/right/displayValueProcess.js</displayValueProcess>
     </entityField>
@@ -122,16 +123,9 @@
     </entityConsumer>
     <entityField>
       <name>MEDIUM</name>
+      <title>Type</title>
       <description>What kind of data is being saved, e.g. Mail, Home address</description>
     </entityField>
-    <entityField>
-      <name>validToFormat</name>
-      <contentType>DATE</contentType>
-      <resolution>DAY</resolution>
-      <outputFormat>dd.MM.yyyy</outputFormat>
-      <inputFormat>dd.MM.yyyy</inputFormat>
-      <searchable v="true" />
-    </entityField>
     <entityParameter>
       <name>currentPerson_param</name>
       <expose v="true" />
@@ -172,6 +166,10 @@
         </entityActionField>
       </children>
     </entityActionGroup>
+    <entityField>
+      <name>VALUE</name>
+      <title>Value</title>
+    </entityField>
   </entityFields>
   <recordContainers>
     <dbRecordContainer>
@@ -249,6 +247,14 @@
           <name>validToFormat.value</name>
           <recordfield>DSGVO.VALID_TO</recordfield>
         </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>MEDIUM.displayValue</name>
+          <expression>%aditoprj%/entity/DSGVO_entity/recordcontainers/db/recordfieldmappings/medium.displayvalue/expression.js</expression>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>MEDIUM.value</name>
+          <expression>%aditoprj%/entity/DSGVO_entity/recordcontainers/db/recordfieldmappings/medium.value/expression.js</expression>
+        </dbRecordFieldMapping>
       </recordFieldMappings>
     </dbRecordContainer>
   </recordContainers>
diff --git a/entity/DSGVO_entity/recordcontainers/db/conditionProcess.js b/entity/DSGVO_entity/recordcontainers/db/conditionProcess.js
index 6f5161310af..9528a09d791 100644
--- a/entity/DSGVO_entity/recordcontainers/db/conditionProcess.js
+++ b/entity/DSGVO_entity/recordcontainers/db/conditionProcess.js
@@ -1,8 +1,8 @@
-import("system.db");
-import("system.result");
-import("Sql_lib");
-
-var cond = new SqlCondition();
-cond.andPrepareVars("DSGVO.CONTACT_ID", "$param.currentPerson_param");
-/* TODO: use a preparedCondition when available*/
-result.string(db.translateCondition(cond.build("1 = 2")));
\ No newline at end of file
+//import("system.db");
+//import("system.result");
+//import("Sql_lib");
+//
+//var cond = new SqlCondition();
+//cond.andPrepareVars("DSGVO.CONTACT_ID", "$param.currentPerson_param");
+///* TODO: use a preparedCondition when available*/
+//result.string(db.translateCondition(cond.build("1 = 2")));
\ No newline at end of file
diff --git a/entity/DSGVO_entity/recordcontainers/db/fromClauseProcess.js b/entity/DSGVO_entity/recordcontainers/db/fromClauseProcess.js
index 1484e554be9..a502cdaff4c 100644
--- a/entity/DSGVO_entity/recordcontainers/db/fromClauseProcess.js
+++ b/entity/DSGVO_entity/recordcontainers/db/fromClauseProcess.js
@@ -1,6 +1,6 @@
-import("system.result");
-
-result.string("DSGVO "
-                + "join CONTACT on DSGVO.CONTACT_ID = CONTACT.CONTACTID ");
+//import("system.result");
+//
+//result.string("DSGVO "
+//                + "join CONTACT on DSGVO.CONTACT_ID = CONTACT.CONTACTID ");
 /*                + "join COMMUNICATION on DSGVO.ROW_ID = COMMUNICATION.COMMUNICATIONID "
                 + "join ADDRESS on DSGVO.ROW_ID = ADDRESS.ADDRESSID");*/
\ No newline at end of file
diff --git a/entity/DSGVO_entity/recordcontainers/db/onDBInsert.js b/entity/DSGVO_entity/recordcontainers/db/onDBInsert.js
index 09754cf5860..bd9bf3dd160 100644
--- a/entity/DSGVO_entity/recordcontainers/db/onDBInsert.js
+++ b/entity/DSGVO_entity/recordcontainers/db/onDBInsert.js
@@ -1,23 +1,23 @@
-import("KeywordRegistry_basic");
-import("Keyword_lib");
-import("system.db");
-import("system.neon");
-import("system.vars");
-import("system.util");
-
-
-if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
-{
-    var cols = ["USER_NEW" , "USER_EDIT" , "DSGVOID" , "ROW_ID" , "DATE_NEW" , 
-        "TABLENAME" , "DATE_EDIT" , "RIGHT" , "VALID_TO" , "CONTACT_ID" , "USE"];
-    
-    var vals = [vars.get("$sys.user"), null, util.getNewUUID(), 
-        vars.get("$field.ROW_ID"), vars.get("$sys.date"), vars.get("$field.TABLENAME"),
-        null,  KeywordUtils. vars.get("$field.RIGHT").valueOf(), vars.get("$field.VALID_TO"), 
-        vars.get("$field.CONTACT_ID"), vars.get("$field.USE").valueOf()];
-    // KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.DSGVOUse(), "DSGVO.USE");
-    db.insertData("DSGVO", cols, null, vals);
-}
+//import("KeywordRegistry_basic");
+//import("Keyword_lib");
+//import("system.db");
+//import("system.neon");
+//import("system.vars");
+//import("system.util");
+//
+//
+//if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
+//{
+//    var cols = ["USER_NEW" , "USER_EDIT" , "DSGVOID" , "ROW_ID" , "DATE_NEW" , 
+//        "TABLENAME" , "DATE_EDIT" , "RIGHT" , "VALID_TO" , "CONTACT_ID" , "USE"];
+//    
+//    var vals = [vars.get("$sys.user"), null, util.getNewUUID(), 
+//        vars.get("$field.ROW_ID"), vars.get("$sys.date"), vars.get("$field.TABLENAME"),
+//        null,  KeywordUtils. vars.get("$field.RIGHT").valueOf(), vars.get("$field.VALID_TO"), 
+//        vars.get("$field.CONTACT_ID"), vars.get("$field.USE").valueOf()];
+//    // KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.DSGVOUse(), "DSGVO.USE");
+//    db.insertData("DSGVO", cols, null, vals);
+//}
     // TODO Eintrag in DSGVO Tabelle
     
     /*
diff --git a/entity/DSGVO_entity/recordcontainers/db/recordfieldmappings/medium.displayvalue/expression.js b/entity/DSGVO_entity/recordcontainers/db/recordfieldmappings/medium.displayvalue/expression.js
new file mode 100644
index 00000000000..1de26b616b1
--- /dev/null
+++ b/entity/DSGVO_entity/recordcontainers/db/recordfieldmappings/medium.displayvalue/expression.js
@@ -0,0 +1,6 @@
+import("system.result");
+import("Keyword_lib");
+import("KeywordRegistry_basic");
+
+var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.communicationMedium(), "DSGVO.ROW_ID"); // TODO prüfen
+result.string(sql);
diff --git a/entity/DSGVO_entity/recordcontainers/db/recordfieldmappings/medium.value/expression.js b/entity/DSGVO_entity/recordcontainers/db/recordfieldmappings/medium.value/expression.js
new file mode 100644
index 00000000000..d807c25346c
--- /dev/null
+++ b/entity/DSGVO_entity/recordcontainers/db/recordfieldmappings/medium.value/expression.js
@@ -0,0 +1,22 @@
+import("system.result");
+import("Sql_lib");
+import("system.db");
+import("KeywordRegistry_basic");
+import("Keyword_lib");
+import("system.vars");
+
+var res;
+var table = vars.get("$field.TABLENAME");
+if(table == "COMMUNICATION")
+    {
+        sql = db.cell(SqlCondition.begin().andPrepare(table +  "ID", vars.getString("$field.ROW_ID"))
+            .andPrepare("1=2")
+            .buildSql("select MEDIUM_ID from " + table, "1=2"));
+        res = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.communicationMedium(), sql); 
+    }
+else if(table == "ADDRESS")
+    res = "ADDRESS";
+else
+    res = "PERSON"
+    
+result.string(res);
\ No newline at end of file
diff --git a/entity/MediumValue/DSGVO_entity.aod b/entity/MediumValue/DSGVO_entity.aod
new file mode 100644
index 00000000000..034db36219d
--- /dev/null
+++ b/entity/MediumValue/DSGVO_entity.aod
@@ -0,0 +1,257 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.7" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.7">
+  <name>DSGVO_entity</name>
+  <majorModelMode>DISTRIBUTED</majorModelMode>
+  <icon>VAADIN:LOCK</icon>
+  <title>Data Privacy</title>
+  <titlePlural>Data Privacies</titlePlural>
+  <recordContainer>db</recordContainer>
+  <entityFields>
+    <entityProvider>
+      <name>#PROVIDER</name>
+      <dependencies>
+        <entityDependency>
+          <name>848916ba-482b-4e53-ac22-48ee6fbf2b64</name>
+          <entityName>Person_entity</entityName>
+          <fieldName>DSGVOEntries</fieldName>
+          <isConsumer v="false" />
+        </entityDependency>
+      </dependencies>
+    </entityProvider>
+    <entityField>
+      <name>DSGVOID</name>
+      <valueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/dsgvoid/valueProcess.js</valueProcess>
+    </entityField>
+    <entityField>
+      <name>USER_NEW</name>
+      <valueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/user_new/valueProcess.js</valueProcess>
+    </entityField>
+    <entityField>
+      <name>USER_EDIT</name>
+      <valueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/user_edit/valueProcess.js</valueProcess>
+    </entityField>
+    <entityField>
+      <name>DATE_NEW</name>
+      <valueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/date_new/valueProcess.js</valueProcess>
+    </entityField>
+    <entityField>
+      <name>DATE_EDIT</name>
+      <valueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/date_edit/valueProcess.js</valueProcess>
+    </entityField>
+    <entityField>
+      <name>ROW_ID</name>
+    </entityField>
+    <entityField>
+      <name>RIGHT</name>
+      <title>DataPrivacy Right</title>
+      <description>The statutory source of the private data. Keyword DSGVORight</description>
+      <consumer>KeywordRight</consumer>
+      <groupable v="true" />
+      <mandatory v="true" />
+      <displayValueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/right/displayValueProcess.js</displayValueProcess>
+    </entityField>
+    <entityField>
+      <name>USE</name>
+      <title>DataPrivacy Use</title>
+      <description>The purpose of the private data. Keyword DSGVOUse</description>
+      <consumer>KeywordUse</consumer>
+      <groupable v="true" />
+      <mandatory v="true" />
+      <displayValueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/use/displayValueProcess.js</displayValueProcess>
+    </entityField>
+    <entityField>
+      <name>TABLENAME</name>
+    </entityField>
+    <entityField>
+      <name>VALID_TO</name>
+      <title>Valid to</title>
+      <description>How long the data will be saved</description>
+      <contentType>DATE</contentType>
+      <resolution>MINUTE</resolution>
+      <outputFormat>dd.MM.yyyy</outputFormat>
+      <inputFormat>dd.MM.yyyy</inputFormat>
+      <mandatory v="true" />
+    </entityField>
+    <entityField>
+      <name>CONTACT_ID</name>
+      <valueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/contact_id/valueProcess.js</valueProcess>
+    </entityField>
+    <entityConsumer>
+      <name>ContactAdresses</name>
+      <dependency>
+        <name>dependency</name>
+        <entityName>Address_entity</entityName>
+        <fieldName>ContactAddresses</fieldName>
+      </dependency>
+    </entityConsumer>
+    <entityConsumer>
+      <name>KeywordUse</name>
+      <dependency>
+        <name>dependency</name>
+        <entityName>KeywordEntry_entity</entityName>
+        <fieldName>SpecificContainerKeywords</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>ContainerName_param</name>
+          <valueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/keyworduse/children/containername_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+    </entityConsumer>
+    <entityConsumer>
+      <name>KeywordRight</name>
+      <dependency>
+        <name>dependency</name>
+        <entityName>KeywordEntry_entity</entityName>
+        <fieldName>SpecificContainerKeywords</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>ContainerName_param</name>
+          <valueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/keywordright/children/containername_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+    </entityConsumer>
+    <entityConsumer>
+      <name>Communications</name>
+      <dependency>
+        <name>dependency</name>
+        <entityName>Communication_entity</entityName>
+        <fieldName>AllCommunications</fieldName>
+      </dependency>
+    </entityConsumer>
+    <entityField>
+      <name>MEDIUM</name>
+      <description>What kind of data is being saved, e.g. Mail, Home address</description>
+    </entityField>
+    <entityParameter>
+      <name>currentPerson_param</name>
+      <expose v="true" />
+      <triggerRecalculation v="true" />
+      <mandatory v="true" />
+    </entityParameter>
+    <entityActionGroup>
+      <name>Reports</name>
+      <children>
+        <entityActionField>
+          <name>openDisclosureReport</name>
+          <title>Disclosure Report</title>
+          <onActionProcess>%aditoprj%/entity/DSGVO_entity/entityfields/reports/children/opendisclosurereport/onActionProcess.js</onActionProcess>
+          <isObjectAction v="false" />
+          <isSelectionAction v="true" />
+          <iconId>VAADIN:INFO_CIRCLE_O</iconId>
+        </entityActionField>
+        <entityActionField>
+          <name>openInfoReport</name>
+          <title>Information Report</title>
+          <onActionProcess>%aditoprj%/entity/DSGVO_entity/entityfields/reports/children/openinforeport/onActionProcess.js</onActionProcess>
+          <isSelectionAction v="true" />
+          <iconId>VAADIN:INFO_CIRCLE</iconId>
+        </entityActionField>
+      </children>
+    </entityActionGroup>
+    <entityActionGroup>
+      <name>DSGVOActions</name>
+      <children>
+        <entityActionField>
+          <name>anonymPerson</name>
+          <title>Anonymization</title>
+          <onActionProcess>%aditoprj%/entity/DSGVO_entity/entityfields/dsgvoactions/children/anonymperson/onActionProcess.js</onActionProcess>
+          <actionOrder v="0" />
+          <isSelectionAction v="true" />
+          <iconId>VAADIN:MEH_O</iconId>
+          <stateProcess>%aditoprj%/entity/DSGVO_entity/entityfields/dsgvoactions/children/anonymperson/stateProcess.js</stateProcess>
+        </entityActionField>
+      </children>
+    </entityActionGroup>
+    <entityField>
+      <name>VALUE</name>
+    </entityField>
+    <entityFieldGroup>
+      <name>MediumValue</name>
+    </entityFieldGroup>
+  </entityFields>
+  <recordContainers>
+    <dbRecordContainer>
+      <name>db</name>
+      <alias>Data_alias</alias>
+      <maximumDbRows v="0" />
+      <isPageable v="true" />
+      <isRequireContainerFiltering v="false" />
+      <fromClauseProcess>%aditoprj%/entity/DSGVO_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess>
+      <conditionProcess>%aditoprj%/entity/DSGVO_entity/recordcontainers/db/conditionProcess.js</conditionProcess>
+      <onDBInsert>%aditoprj%/entity/DSGVO_entity/recordcontainers/db/onDBInsert.js</onDBInsert>
+      <linkInformation>
+        <linkInformation>
+          <name>ca40447a-06ab-4d49-97bb-dde5ccfc8c24</name>
+          <tableName>DSGVO</tableName>
+          <primaryKey>DSGVOID</primaryKey>
+          <isUIDTable v="true" />
+          <readonly v="false" />
+        </linkInformation>
+      </linkInformation>
+      <recordFieldMappings>
+        <dbRecordFieldMapping>
+          <name>CONTACT_ID.value</name>
+          <recordfield>DSGVO.CONTACT_ID</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>DATE_EDIT.value</name>
+          <recordfield>DSGVO.DATE_EDIT</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>DATE_NEW.value</name>
+          <recordfield>DSGVO.DATE_NEW</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>DSGVOID.value</name>
+          <recordfield>DSGVO.DSGVOID</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>RIGHT.value</name>
+          <recordfield>DSGVO.RIGHT</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>ROW_ID.value</name>
+          <recordfield>DSGVO.ROW_ID</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>TABLENAME.value</name>
+          <recordfield>DSGVO.TABLENAME</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>USE.value</name>
+          <recordfield>DSGVO.USE</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>USER_EDIT.value</name>
+          <recordfield>DSGVO.USER_EDIT</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>USER_NEW.value</name>
+          <recordfield>DSGVO.USER_NEW</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>VALID_TO.value</name>
+          <recordfield>DSGVO.VALID_TO</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>RIGHT.displayValue</name>
+          <expression>%aditoprj%/entity/DSGVO_entity/recordcontainers/db/recordfieldmappings/right.displayvalue/expression.js</expression>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>USE.displayValue</name>
+          <expression>%aditoprj%/entity/DSGVO_entity/recordcontainers/db/recordfieldmappings/use.displayvalue/expression.js</expression>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>validToFormat.value</name>
+          <recordfield>DSGVO.VALID_TO</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>MEDIUM.value</name>
+          <expression>%aditoprj%/entity/DSGVO_entity/recordcontainers/db/recordfieldmappings/medium.value/expression.js</expression>
+        </dbRecordFieldMapping>
+      </recordFieldMappings>
+    </dbRecordContainer>
+  </recordContainers>
+</entity>
diff --git a/entity/MediumValue/entityfields/contact_id/valueProcess.js b/entity/MediumValue/entityfields/contact_id/valueProcess.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/entity/MediumValue/entityfields/date_edit/valueProcess.js b/entity/MediumValue/entityfields/date_edit/valueProcess.js
new file mode 100644
index 00000000000..5e6ef059738
--- /dev/null
+++ b/entity/MediumValue/entityfields/date_edit/valueProcess.js
@@ -0,0 +1,7 @@
+import("system.util");
+import("system.result");
+import("system.neon");
+import("system.vars");
+
+if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT)
+    result.string(vars.get("$sys.date"));
\ No newline at end of file
diff --git a/entity/MediumValue/entityfields/date_new/valueProcess.js b/entity/MediumValue/entityfields/date_new/valueProcess.js
new file mode 100644
index 00000000000..a72892783bf
--- /dev/null
+++ b/entity/MediumValue/entityfields/date_new/valueProcess.js
@@ -0,0 +1,7 @@
+import("system.util");
+import("system.result");
+import("system.neon");
+import("system.vars");
+
+if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
+    result.string(vars.get("$sys.date"));
\ No newline at end of file
diff --git a/entity/MediumValue/entityfields/dsgvoactions/children/anonymperson/onActionProcess.js b/entity/MediumValue/entityfields/dsgvoactions/children/anonymperson/onActionProcess.js
new file mode 100644
index 00000000000..960e1c35e36
--- /dev/null
+++ b/entity/MediumValue/entityfields/dsgvoactions/children/anonymperson/onActionProcess.js
@@ -0,0 +1,5 @@
+import("system.vars");
+import("DSGVO_lib");
+
+// TODO open View DSGVOPreviewAnonym_view mit Auswahl an Kategorien
+//dsgvoMkDataAnonymous(vars.get("$field.CONTACT_ID"), vars.get("$field.ROW_ID"));
\ No newline at end of file
diff --git a/entity/MediumValue/entityfields/dsgvoactions/children/anonymperson/stateProcess.js b/entity/MediumValue/entityfields/dsgvoactions/children/anonymperson/stateProcess.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/entity/MediumValue/entityfields/dsgvoid/valueProcess.js b/entity/MediumValue/entityfields/dsgvoid/valueProcess.js
new file mode 100644
index 00000000000..ef478411d78
--- /dev/null
+++ b/entity/MediumValue/entityfields/dsgvoid/valueProcess.js
@@ -0,0 +1,8 @@
+import("system.neon");
+import("system.result");
+import("system.util");
+import("system.vars");
+
+if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW){
+    result.string(util.getNewUUID());
+}
\ No newline at end of file
diff --git a/entity/MediumValue/entityfields/keywordright/children/containername_param/valueProcess.js b/entity/MediumValue/entityfields/keywordright/children/containername_param/valueProcess.js
new file mode 100644
index 00000000000..1ecc628d1e1
--- /dev/null
+++ b/entity/MediumValue/entityfields/keywordright/children/containername_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.result");
+import("KeywordRegistry_basic");
+
+result.string($KeywordRegistry.DSGVORight());
\ No newline at end of file
diff --git a/entity/MediumValue/entityfields/keyworduse/children/containername_param/valueProcess.js b/entity/MediumValue/entityfields/keyworduse/children/containername_param/valueProcess.js
new file mode 100644
index 00000000000..6805dc6c2c3
--- /dev/null
+++ b/entity/MediumValue/entityfields/keyworduse/children/containername_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.result");
+import("KeywordRegistry_basic");
+
+result.string($KeywordRegistry.DSGVOUse());
\ No newline at end of file
diff --git a/entity/MediumValue/entityfields/reports/children/opendisclosurereport/onActionProcess.js b/entity/MediumValue/entityfields/reports/children/opendisclosurereport/onActionProcess.js
new file mode 100644
index 00000000000..eb6195e833e
--- /dev/null
+++ b/entity/MediumValue/entityfields/reports/children/opendisclosurereport/onActionProcess.js
@@ -0,0 +1,5 @@
+
+
+var params = {};
+// TODO params for Reports
+// TODO open Report
\ No newline at end of file
diff --git a/entity/MediumValue/entityfields/reports/children/openinforeport/onActionProcess.js b/entity/MediumValue/entityfields/reports/children/openinforeport/onActionProcess.js
new file mode 100644
index 00000000000..eb6195e833e
--- /dev/null
+++ b/entity/MediumValue/entityfields/reports/children/openinforeport/onActionProcess.js
@@ -0,0 +1,5 @@
+
+
+var params = {};
+// TODO params for Reports
+// TODO open Report
\ No newline at end of file
diff --git a/entity/MediumValue/entityfields/right/displayValueProcess.js b/entity/MediumValue/entityfields/right/displayValueProcess.js
new file mode 100644
index 00000000000..fa353b3a409
--- /dev/null
+++ b/entity/MediumValue/entityfields/right/displayValueProcess.js
@@ -0,0 +1,6 @@
+import("system.result");
+import("system.vars");
+import("KeywordRegistry_basic");
+import("Keyword_lib");
+
+result.string(KeywordUtils.getViewValue($KeywordRegistry.DSGVORight(), vars.get("$field.RIGHT")));
\ No newline at end of file
diff --git a/entity/MediumValue/entityfields/use/displayValueProcess.js b/entity/MediumValue/entityfields/use/displayValueProcess.js
new file mode 100644
index 00000000000..244c7f20cc6
--- /dev/null
+++ b/entity/MediumValue/entityfields/use/displayValueProcess.js
@@ -0,0 +1,6 @@
+import("system.result");
+import("system.vars");
+import("KeywordRegistry_basic");
+import("Keyword_lib");
+
+result.string(KeywordUtils.getViewValue($KeywordRegistry.DSGVOUse(), vars.get("$field.USE")));
\ No newline at end of file
diff --git a/entity/MediumValue/entityfields/user_edit/valueProcess.js b/entity/MediumValue/entityfields/user_edit/valueProcess.js
new file mode 100644
index 00000000000..6af880ae3e0
--- /dev/null
+++ b/entity/MediumValue/entityfields/user_edit/valueProcess.js
@@ -0,0 +1,7 @@
+import("system.util");
+import("system.result");
+import("system.neon");
+import("system.vars");
+
+if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT)
+    result.string(vars.get("$sys.user"));
\ No newline at end of file
diff --git a/entity/MediumValue/entityfields/user_new/valueProcess.js b/entity/MediumValue/entityfields/user_new/valueProcess.js
new file mode 100644
index 00000000000..e518bc75a94
--- /dev/null
+++ b/entity/MediumValue/entityfields/user_new/valueProcess.js
@@ -0,0 +1,7 @@
+import("system.util");
+import("system.result");
+import("system.neon");
+import("system.vars");
+
+if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
+    result.string(vars.get("$sys.user"));
\ No newline at end of file
diff --git a/entity/MediumValue/recordcontainers/db/conditionProcess.js b/entity/MediumValue/recordcontainers/db/conditionProcess.js
new file mode 100644
index 00000000000..6f5161310af
--- /dev/null
+++ b/entity/MediumValue/recordcontainers/db/conditionProcess.js
@@ -0,0 +1,8 @@
+import("system.db");
+import("system.result");
+import("Sql_lib");
+
+var cond = new SqlCondition();
+cond.andPrepareVars("DSGVO.CONTACT_ID", "$param.currentPerson_param");
+/* TODO: use a preparedCondition when available*/
+result.string(db.translateCondition(cond.build("1 = 2")));
\ No newline at end of file
diff --git a/entity/MediumValue/recordcontainers/db/fromClauseProcess.js b/entity/MediumValue/recordcontainers/db/fromClauseProcess.js
new file mode 100644
index 00000000000..f292981e986
--- /dev/null
+++ b/entity/MediumValue/recordcontainers/db/fromClauseProcess.js
@@ -0,0 +1,6 @@
+import("system.result");
+
+result.string("DSGVO ");
+//                + "join CONTACT on DSGVO.CONTACT_ID = CONTACT.CONTACTID ");
+/*                + "join COMMUNICATION on DSGVO.ROW_ID = COMMUNICATION.COMMUNICATIONID "
+                + "join ADDRESS on DSGVO.ROW_ID = ADDRESS.ADDRESSID");*/
\ No newline at end of file
diff --git a/entity/MediumValue/recordcontainers/db/onDBInsert.js b/entity/MediumValue/recordcontainers/db/onDBInsert.js
new file mode 100644
index 00000000000..db3acc78baf
--- /dev/null
+++ b/entity/MediumValue/recordcontainers/db/onDBInsert.js
@@ -0,0 +1,44 @@
+import("KeywordRegistry_basic");
+import("Keyword_lib");
+import("system.db");
+import("system.neon");
+import("system.vars");
+import("system.util");
+
+
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
+{
+    var cols = ["USER_NEW" , "USER_EDIT" , "DSGVOID" , "ROW_ID" , "DATE_NEW" , 
+        "TABLENAME" , "DATE_EDIT" , "RIGHT" , "VALID_TO" , "CONTACT_ID" , "USE"];
+    var table = vars.get("$field.TABLENAME");
+    
+    var vals = [vars.get("$sys.user"), null, util.getNewUUID(), 
+        vars.get("$field.ROW_ID"), vars.get("$sys.date"), table,
+        null,  KeywordUtils. vars.get("$field.RIGHT").valueOf(), vars.get("$field.VALID_TO"), 
+        vars.get("$field.CONTACT_ID"), vars.get("$field.USE").valueOf()];
+    // KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.DSGVOUse(), "DSGVO.USE");
+    db.insertData("DSGVO", cols, null, vals);
+}
+    // TODO Eintrag in DSGVO Tabelle
+    
+    /*
+     * 
+     var InputMapping = {
+        "OFFERITEM": {
+            condition: "OFFER_ID = '" + pSourceOfferId + "' order by ITEMSORT",
+            ValueMapping: {
+                "OFFER_ID" : pTargetOfferId
+            }
+        }
+    };
+    CopyModuleUtils.copyModule(InputMapping);
+    
+    var oiUtils = new OfferItemUtils(pTargetOfferId);
+    
+    //update order price
+    cols = ["NET", "VAT"];
+    var vals = oiUtils.getNetAndVat();
+    
+    db.updateData("OFFER", cols, null, vals, SqlCondition.equals("OFFER.OFFERID", pTargetOfferId, "1 = 2"));
+     * 
+     */
\ No newline at end of file
diff --git a/entity/MediumValue/recordcontainers/db/recordfieldmappings/medium.value/expression.js b/entity/MediumValue/recordcontainers/db/recordfieldmappings/medium.value/expression.js
new file mode 100644
index 00000000000..4cb06aa85a6
--- /dev/null
+++ b/entity/MediumValue/recordcontainers/db/recordfieldmappings/medium.value/expression.js
@@ -0,0 +1,22 @@
+import("system.logging");
+import("KeywordRegistry_basic");
+import("Keyword_lib");
+import("system.vars");
+import("Sql_lib");
+import("system.result");
+import("system.db");
+
+var sql = SqlCondition.begin()
+                    .andPrepare("$field.CONTACT_ID", "CONTACT_ID")
+                    .andPrepare("1=2");
+var table = vars.getString("$field.TABLENAME");
+if(table == "COMMUNICATION")
+    {
+        sql = db.cell(sql.buildSQL("select MEDIUM_ID from " + table));
+        result.string(KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.communicationMedium(), sql));
+    }
+else
+    {
+        logging.log("Medium -->> Table -->> " + vars.getString("$field.TABLENAME"));
+        result.string("$field.TABLENAME");
+    }
\ No newline at end of file
diff --git a/entity/MediumValue/recordcontainers/db/recordfieldmappings/right.displayvalue/expression.js b/entity/MediumValue/recordcontainers/db/recordfieldmappings/right.displayvalue/expression.js
new file mode 100644
index 00000000000..7bff6895d0d
--- /dev/null
+++ b/entity/MediumValue/recordcontainers/db/recordfieldmappings/right.displayvalue/expression.js
@@ -0,0 +1,6 @@
+import("system.result");
+import("Keyword_lib");
+import("KeywordRegistry_basic");
+
+var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.DSGVORight(), "DSGVO.RIGHT");
+result.string(sql);
diff --git a/entity/MediumValue/recordcontainers/db/recordfieldmappings/use.displayvalue/expression.js b/entity/MediumValue/recordcontainers/db/recordfieldmappings/use.displayvalue/expression.js
new file mode 100644
index 00000000000..4b55075d997
--- /dev/null
+++ b/entity/MediumValue/recordcontainers/db/recordfieldmappings/use.displayvalue/expression.js
@@ -0,0 +1,6 @@
+import("system.result");
+import("Keyword_lib");
+import("KeywordRegistry_basic");
+
+var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.DSGVOUse(), "DSGVO.USE");
+result.string(sql);
diff --git a/neonView/DSGVOEdit_view/DSGVOEdit_view.aod b/neonView/DSGVOEdit_view/DSGVOEdit_view.aod
index 7ffda7078f8..f18bd070955 100644
--- a/neonView/DSGVOEdit_view/DSGVOEdit_view.aod
+++ b/neonView/DSGVOEdit_view/DSGVOEdit_view.aod
@@ -2,6 +2,7 @@
 <neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.1">
   <name>DSGVOEdit_view</name>
   <majorModelMode>DISTRIBUTED</majorModelMode>
+  <isSmall v="true" />
   <layout>
     <boxLayout>
       <name>layout</name>
@@ -25,6 +26,14 @@
           <name>a9e1245c-7798-4170-9f2f-2e33f61cd6aa</name>
           <entityField>VALID_TO</entityField>
         </entityFieldLink>
+        <entityFieldLink>
+          <name>1e2d81f7-d286-42ee-935d-1a2de2c27c72</name>
+          <entityField>MEDIUM</entityField>
+        </entityFieldLink>
+        <entityFieldLink>
+          <name>732a0a8a-4db3-4ff9-b4a2-c7ab6f2cf144</name>
+          <entityField>VALUE</entityField>
+        </entityFieldLink>
       </fields>
     </genericViewTemplate>
   </children>
diff --git a/neonView/DSGVOFilter_view/DSGVOFilter_view.aod b/neonView/DSGVOFilter_view/DSGVOFilter_view.aod
index ba07b61b5ab..f956e18ee24 100644
--- a/neonView/DSGVOFilter_view/DSGVOFilter_view.aod
+++ b/neonView/DSGVOFilter_view/DSGVOFilter_view.aod
@@ -27,6 +27,10 @@
           <width v="75" />
           <expandRatio v="100" />
         </neonTableColumn>
+        <neonTableColumn>
+          <name>1d329067-0959-4150-aaa4-ea7887a31ec2</name>
+          <entityField>VALUE</entityField>
+        </neonTableColumn>
         <neonTableColumn>
           <name>ad9e414f-4f0f-4efb-887a-468e7a9fefb5</name>
           <entityField>RIGHT</entityField>
-- 
GitLab