From a447d5cd75df005665b5cdfc09d4db5718c9e047 Mon Sep 17 00:00:00 2001 From: Maria Hofmann <m.hofmann@adito.de> Date: Wed, 26 Jun 2019 13:29:33 +0200 Subject: [PATCH] recordContainers --- .../basic/2019.1.4/DSGVO/create_DSGVO.xml | 2 +- .../2019.1.4/DSGVO/insert_example_DSGVO.xml | 6 +- .../2019.1.4/DSGVO/update_comm_medium.xml | 2 +- aliasDefinition/Data_alias/Data_alias.aod | 2 +- entity/DSGVO_entity/DSGVO_entity.aod | 18 ++- .../tablename/displayValueProcess.js | 5 + .../entityfields/type/displayValueProcess.js | 14 ++ .../recordcontainers/db/conditionProcess.js | 8 + .../value.value/expression.js | 6 - .../recordcontainers/jdito/contentProcess.js | 138 ++++++++++++++++-- 10 files changed, 169 insertions(+), 32 deletions(-) create mode 100644 entity/DSGVO_entity/entityfields/tablename/displayValueProcess.js create mode 100644 entity/DSGVO_entity/entityfields/type/displayValueProcess.js delete mode 100644 entity/DSGVO_entity/recordcontainers/db/recordfieldmappings/value.value/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 ae929f253f6..935d30e7579 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 @@ -16,7 +16,7 @@ <column name="DATE_EDIT" type="TIMESTAMP" /> <column name="TABLENAME" type="CHAR(36)" /> - <column name="TYPE" type="CHAR(36)"/> + <column name="TYPE" type="NVARCHAR(36)"/> <column name="ROW_ID" type="CHAR(36)" /> <column name="STATUORITYSOURCE" type="CHAR(36)" /> diff --git a/.liquibase/Data_alias/basic/2019.1.4/DSGVO/insert_example_DSGVO.xml b/.liquibase/Data_alias/basic/2019.1.4/DSGVO/insert_example_DSGVO.xml index d6c3fdc844d..616e1cc2d26 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/DSGVO/insert_example_DSGVO.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/DSGVO/insert_example_DSGVO.xml @@ -7,12 +7,16 @@ <column name="DATE_NEW" value="2019-06-03 06:57:51.882"/> <column name="USER_EDIT" value="null"/> <column name="DATE_EDIT" value="null"/> - <column name="ROW_ID" value="73d73404-e7f5-11e8-9f32-f2801f1b9fd1"/> + <column name="ROW_ID" value="84e040be-5a5f-48e7-be2c-769d4a169390"/> <column name="STATUORITYSOURCE" value="b3f7038b-622b-45e4-8c5c-4b0c7aed6300"/> <column name="PURPOSE" value="56762dd8-cfe8-4551-a758-0fd0fa4f7e76"/> + <column name="TABLENAME" value="c9032b73-63ec-4a22-aff6-317ec3a4dbf6"/> + <column name="TYPE" value="HOMEADDR"/> + <column name="VALID_TO" value="2019-10-10 06:57:51.882"/> <column name="CONTACT_ID" value="7c1efe4c-cc73-4e95-bdf0-208a3ff699b5"/> + </insert> </changeSet> </databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2019.1.4/DSGVO/update_comm_medium.xml b/.liquibase/Data_alias/basic/2019.1.4/DSGVO/update_comm_medium.xml index b6faa137bb6..81b50077257 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/DSGVO/update_comm_medium.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/DSGVO/update_comm_medium.xml @@ -2,7 +2,7 @@ <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> <changeSet author="m.hofmann" id="e6b32d7d-298c-44a3-901f-88baa77cb6c3"> <update tableName="COMMUNICATION"> - <column name="MEDIUM_ID" value="d08956b8-369e-4b65-88fa-1c37b3368ae3"></column> + <column name="MEDIUM_ID" value="COMMINTERNET"></column> <where>MEDIUM_ID = ?</where> <whereParams> <param value="d9434c95-9abb-4661-a4c0-65d8a9eb676e"></param> diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index 48649f7db08..8093a67a652 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -10189,7 +10189,7 @@ <name>TYPE</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="1" /> + <columnType v="12" /> <size v="36" /> <scale v="0" /> <notNull v="false" /> diff --git a/entity/DSGVO_entity/DSGVO_entity.aod b/entity/DSGVO_entity/DSGVO_entity.aod index 8bf104a5a93..69832684f5e 100644 --- a/entity/DSGVO_entity/DSGVO_entity.aod +++ b/entity/DSGVO_entity/DSGVO_entity.aod @@ -5,7 +5,7 @@ <icon>VAADIN:LOCK</icon> <title>Data Privacy</title> <titlePlural>Data Privacies</titlePlural> - <recordContainer>db</recordContainer> + <recordContainer>jdito</recordContainer> <entityFields> <entityProvider> <name>#PROVIDER</name> @@ -69,6 +69,7 @@ <groupable v="true" /> <linkedContext>KeywordEntry</linkedContext> <mandatory v="true" /> + <displayValueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/tablename/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>VALID_TO</name> @@ -134,6 +135,7 @@ <description>What kind of data is being saved, e.g. Mail, Home address</description> <mandatory v="true" /> <dropDownProcess>%aditoprj%/entity/DSGVO_entity/entityfields/type/dropDownProcess.js</dropDownProcess> + <displayValueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/type/displayValueProcess.js</displayValueProcess> </entityField> <entityParameter> <name>currentPerson_param</name> @@ -198,7 +200,6 @@ <dbRecordContainer> <name>db</name> <alias>Data_alias</alias> - <maximumDbRows v="0" /> <conditionProcess>%aditoprj%/entity/DSGVO_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <linkInformation> <linkInformation> @@ -273,10 +274,6 @@ <name>PURPOSE.value</name> <recordfield>DSGVO.PURPOSE</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>VALUE.value</name> - <expression>%aditoprj%/entity/DSGVO_entity/recordcontainers/db/recordfieldmappings/value.value/expression.js</expression> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TYPE.value</name> <recordfield>DSGVO.TYPE</recordfield> @@ -290,6 +287,7 @@ <jDitoRecordContainer> <name>jdito</name> <jDitoRecordAlias>Data_alias</jDitoRecordAlias> + <isPageable v="true" /> <isFilterable v="true" /> <contentProcess>%aditoprj%/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js</contentProcess> <recordFields> @@ -298,6 +296,14 @@ <element>TABLENAME.value</element> <element>TYPE.value</element> <element>VALUE.value</element> + <element>STATUORITYSOURCE.value</element> + <element>PURPOSE.value</element> + <element>VALID_TO.value</element> + <element>CONTACT_ID.value</element> + <element>DATE_NEW.value</element> + <element>DATE_EDIT.value</element> + <element>USER_NEW.value</element> + <element>USER_EDIT.value</element> </recordFields> </jDitoRecordContainer> </recordContainers> diff --git a/entity/DSGVO_entity/entityfields/tablename/displayValueProcess.js b/entity/DSGVO_entity/entityfields/tablename/displayValueProcess.js new file mode 100644 index 00000000000..0dfee046adb --- /dev/null +++ b/entity/DSGVO_entity/entityfields/tablename/displayValueProcess.js @@ -0,0 +1,5 @@ +import("Keyword_lib"); +import("system.result"); + + +result.string(KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.DSGVOTablename(), "DSGVO.TABLENAME")); \ No newline at end of file diff --git a/entity/DSGVO_entity/entityfields/type/displayValueProcess.js b/entity/DSGVO_entity/entityfields/type/displayValueProcess.js new file mode 100644 index 00000000000..a8e98e0f2f0 --- /dev/null +++ b/entity/DSGVO_entity/entityfields/type/displayValueProcess.js @@ -0,0 +1,14 @@ +import("system.result"); +import("Keyword_lib"); +import("Keyword_lib"); +import("system.vars"); + +var tablename = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.DSGVOTablename(), "DSGVO.TABLENAME"); +if(tablename == "Adressen") +{ + var addrAdd = innerCond.andPrepare(vars.get("$field.ROW_ID"), "ADDRESSID") // RowId + .buildSql("select ADDRESSADDITION " + + "from ADDRESS", "1 = 1"); + if(addrAdd) + result.string(vars.get("$field.TYPE") + " | " + addrAdd); +} diff --git a/entity/DSGVO_entity/recordcontainers/db/conditionProcess.js b/entity/DSGVO_entity/recordcontainers/db/conditionProcess.js index e69de29bb2d..e35a5d6c723 100644 --- a/entity/DSGVO_entity/recordcontainers/db/conditionProcess.js +++ b/entity/DSGVO_entity/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 = 1"))); \ No newline at end of file diff --git a/entity/DSGVO_entity/recordcontainers/db/recordfieldmappings/value.value/expression.js b/entity/DSGVO_entity/recordcontainers/db/recordfieldmappings/value.value/expression.js deleted file mode 100644 index 13e181d1db9..00000000000 --- a/entity/DSGVO_entity/recordcontainers/db/recordfieldmappings/value.value/expression.js +++ /dev/null @@ -1,6 +0,0 @@ -/*import("system.vars"); -import("system.result"); -import("DSGVO_lib"); - - -result.object(getDSGVOTable(vars.get("$param.currentPerson_param"), vars.get("$field.TABLENAME")));*/ \ No newline at end of file diff --git a/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js b/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js index 8630527704c..cdd6f8fbb9d 100644 --- a/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js @@ -1,3 +1,4 @@ +import("system.logging"); import("KeywordRegistry_basic"); import("Keyword_lib"); import("system.db"); @@ -12,15 +13,16 @@ recordCond.andPrepare("$param.currentPerson_param", "$field.CONTACT_ID"); //var dataQuery = recordCond.buildSql("select DSGVOID, ROW_ID, STATUORITYSOURCE, PURPOSE, TABLENAME, TYPE, VALID_TO, CONTACT_ID " + // "from DSGVO ", "1 = 1"); //, "order by DATE_NEW desc, USER_NEW asc"); -var dataQuery = recordCond.buildSql("select DSGVOID, ROW_ID, TABLENAME, TYPE from DSGVO ", "1 = 1"); -var res = _groupData(dataQuery); +var dataQuery = recordCond.buildSql("select DSGVOID, ROW_ID, TABLENAME, TYPE, STATUORITYSOURCE, PURPOSE, VALID_TO, CONTACT_ID, DATE_NEW, DATE_EDIT, USER_NEW, USER_EDIT from DSGVO ", "1 = 1"); + +logging.log(dataQuery.length); +logging.log(dataQuery); -// res.push([dsgvoId, row, statSource, purpose, tablename, type, validTo, contactId]); -// ---->>>> VALUE von RowId -// result.object(); +var res = _groupData(dataQuery); +result.object(res); // RESULT muss Form haben: DSGVOID, ROW_ID, STATUORITYSOURCE, PURPOSE, TABLENAME, TYPE, VALUE, VALID_TO, CONTACT_ID -// ggf. kürzen? nur DSGVOID und VALUE? + function _groupData(pData) { @@ -30,7 +32,6 @@ function _groupData(pData) var res = []; var tableContainer = $KeywordRegistry.DSGVOTablename(); - for (var i = 0; i < dataQuery.length; i++) { var tableViewVal = KeywordUtils.getViewValue(tableContainer, pData[i][2]); @@ -38,19 +39,46 @@ function _groupData(pData) switch (tableViewVal) { case "Adressen": + logging.log("Address"); var addrData = innerCond.andPrepare(pData[i][1], "ADDRESSID") // RowId .buildSql("select ADDRESSID, ADDRESS, ADDRESSADDITION, ADDRIDENTIFIER, " - + "BUILDINGNO, CITY, COUNTRY, DISTRICT, REGION, STATE, ZIP " + + "BUILDINGNO, CITY, COUNTRY, DISTRICT, REGION, STATE, ZIP, ADDR_TYPE " + "from ADDRESS", "1 = 1"); if(addrData.length == 1) { + logging.log("one value"); // TODO welche Werte brauch ich? s.o. var addrVal = (_formatAddrData(addrData[0])) - res.push(["DSGVOID", pData[i][0]], ["ROW_ID", pData[i][1]], ["TABLENAME", pData[i][2]], ["TYPE", pData[i][3]], ["VALUE", addrVal]); - //res.push(pData[i][0], pData[i][1], pData[i][2], pData[i][3], pData[i][4], pData[i][5], value, pData[i][6], pData[i][7]) - - }else - continue; + //var addrType = KeywordUtils.getViewValue($KeywordRegistry.addressType(), pData[i][3]); + //if(addrData[i][2]) + // addrType = addrType + " | " + addrData[i][2]; + /*res.push(["DSGVOID", pData[i][0]], + ["ROW_ID", pData[i][1]], + ["TABLENAME", pData[i][2]], + ["TYPE", addrType], + ["VALUE", addrVal], + ["STATUORITYSOURCE", pData[i][4]], + ["PURPOSE", pData[i][5]], + ["VALID_TO", pData[i][6]], + ["CONTACT_ID", pData[i][7]] + ["DATE_NEW", pData[i][8]], + ["DATE_EDIT", pData[i][9]], + ["USER_NEW", pData[i][10]], + ["USER_EDIT", pData[i][11]]);*/ + res.push(pData[i][0], + pData[i][1], + pData[i][2], + addrData[11], + addrVal, + pData[i][4], + pData[i][5], + pData[i][6], + pData[i][7], + pData[i][8], + pData[i][9], + pData[i][10], + pData[i][11]); + } // CONTACT_ID, DATE_NEW, DATE_EDIT, USER_NEW, USER_EDIT break; case "Kommunikationsdaten": var comm = db.table(SqlCondition.begin() @@ -58,7 +86,33 @@ function _groupData(pData) .buildSql("select COMMUNICATIONID, ADDR, MEDIUM_ID from COMMUNICATION join CONTACT on COMMUNICATION.CONTACT_ID = CONTACTID", "1 = 1")); if(comm.length == 1) { - res.push(["DSGVOID", pData[i][0]], ["ROW_ID", pData[i][1]], ["TABLENAME", pData[i][2]], ["TYPE", pData[i][3]], ["VALUE", comm[1]]); + //var commType = KeywordUtils.getViewValue($KeywordRegistry.communicationMedium(), pData[i][3]); + /*res.push(["DSGVOID", pData[i][0]], + ["ROW_ID", pData[i][1]], + ["TABLENAME", pData[i][2]], + ["TYPE", commType], + ["VALUE", comm[1]], + ["STATUORITYSOURCE", pData[i][4]], + ["PURPOSE", pData[i][5]], + ["VALID_TO", pData[i][6]], + ["CONTACT_ID", pData[i][7]] + ["DATE_NEW", pData[i][8]], + ["DATE_EDIT", pData[i][9]], + ["USER_NEW", pData[i][10]], + ["USER_EDIT", pData[i][11]]);*/ + res.push(pData[i][0], + pData[i][1], + pData[i][2], + comm[2], + comm[1], + pData[i][4], + pData[i][5], + pData[i][6], + pData[i][7], + pData[i][8], + pData[i][9], + pData[i][10], + pData[i][11]); } break; case "Attribute": @@ -75,11 +129,63 @@ function _groupData(pData) { case "Namen": var names = pers[6] + " " + pers[7] + " " + pers[8] + " " + pers[2] + " " + pers[3] + " " + pers[4]; - res.push(["DSGVOID", pData[i][0]], ["ROW_ID", pData[i][1]], ["TABLENAME", pData[i][2]], ["TYPE", pData[i][3]], ["VALUE", names]); + //var nameType = KeywordUtils.getViewValue($KeywordRegistry.DSGVOType(), pData[i][3]); + /*res.push(["DSGVOID", pData[i][0]], + ["ROW_ID", pData[i][1]], + ["TABLENAME", pData[i][2]], + ["TYPE", nameType], + ["VALUE", names], + ["STATUORITYSOURCE", pData[i][4]], + ["PURPOSE", pData[i][5]], + ["VALID_TO", pData[i][6]], + ["CONTACT_ID", pData[i][7]] + ["DATE_NEW", pData[i][8]], + ["DATE_EDIT", pData[i][9]], + ["USER_NEW", pData[i][10]], + ["USER_EDIT", pData[i][11]]);*/ + res.push(pData[i][0], + pData[i][1], + pData[i][2], + pData[i][3], + names, + pData[i][4], + pData[i][5], + pData[i][6], + pData[i][7], + pData[i][8], + pData[i][9], + pData[i][10], + pData[i][11]); break; case "sonstige Persönliche Daten": var otherPersData = pers[9] + pers[1] + ", " + pers[5]; - res.push(["DSGVOID", pData[i][0]], ["ROW_ID", pData[i][1]], ["TABLENAME", pData[i][2]], ["TYPE", pData[i][3]], ["VALUE", otherPersData]); + //var persDataType = KeywordUtils.getViewValue($KeywordRegistry.DSGVOType(), pData[i][3]); + /*res.push(["DSGVOID", pData[i][0]], + ["ROW_ID", pData[i][1]], + ["TABLENAME", pData[i][2]], + ["TYPE", persDataType], + ["VALUE", otherPersData], + ["STATUORITYSOURCE", pData[i][4]], + ["PURPOSE", pData[i][5]], + ["VALID_TO", pData[i][6]], + ["CONTACT_ID", pData[i][7]] + ["DATE_NEW", pData[i][8]], + ["DATE_EDIT", pData[i][9]], + ["USER_NEW", pData[i][10]], + ["USER_EDIT", pData[i][11]]);*/ + res.push(pData[i][0], + pData[i][1], + pData[i][2], + pData[i][3], + otherPersData, + pData[i][4], + pData[i][5], + pData[i][6], + pData[i][7], + pData[i][8], + pData[i][9], + pData[i][10], + pData[i][11]); break; default: continue; -- GitLab