From 275d6db3b7ebad5e3451e2d56283194da3007b23 Mon Sep 17 00:00:00 2001 From: "s.pongratz" <s.pongratz@adito.de> Date: Wed, 1 Jul 2020 10:05:02 +0200 Subject: [PATCH] =?UTF-8?q?#1058737-DublettenKonfiguration=20Demodaten=20g?= =?UTF-8?q?e=C3=A4ndert=20und=20anpassungen=20am=20EntityToScanName?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../generatedData/duplicates/duplicatescanner.xml | 4 ++-- .../DuplicateScanner_entity/DuplicateScanner_entity.aod | 4 +++- .../entityfields/entity_to_scan_name/onValueChange.js | 7 ------- .../entityfields/entity_to_scan_name/stateProcess.js | 9 +++++++++ .../recordcontainers/dbrecordcontainer/onDBInsert.js | 7 +++++++ .../recordcontainers/dbrecordcontainer/onDBUpdate.js | 8 ++++++++ .../PermissionDetail_entity/PermissionDetail_entity.aod | 5 ----- 7 files changed, 29 insertions(+), 15 deletions(-) delete mode 100644 entity/DuplicateScanner_entity/entityfields/entity_to_scan_name/onValueChange.js create mode 100644 entity/DuplicateScanner_entity/entityfields/entity_to_scan_name/stateProcess.js create mode 100644 entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBInsert.js create mode 100644 entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBUpdate.js diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/duplicates/duplicatescanner.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/duplicates/duplicatescanner.xml index f45f6f3a08..6a8af1e611 100644 --- a/.liquibase/Data_alias/basic/_demoData/generatedData/duplicates/duplicatescanner.xml +++ b/.liquibase/Data_alias/basic/_demoData/generatedData/duplicates/duplicatescanner.xml @@ -8,7 +8,7 @@ <column name="FILTER_NAME" value="PersonDuplicates" /> <column name="EXTERNAL_SERVICE_USAGE_ALLOWED" valueNumeric="0" /> <column name="ID_FIELD_NAME" value="CONTACTID" /> - <column name="SCAN_PATTERN" value="firstname:({"entityfield": "FIRSTNAME"}) AND lastname:({"entityfield": "LASTNAME"})" /> + <column name="SCAN_PATTERN" value="{"entity":"Person_entity","provider":"indexP","filter":{"type":"group","operator":"AND","childs":[{"type":"row","name":"FIRSTNAME","operator":"ISNOTNULL","value":"","key":"","contenttype":"TEXT"},{"type":"row","name":"LASTNAME","operator":"ISNOTNULL","value":"","key":"","contenttype":"TEXT"}]}}" /> <column name="USER_NEW" value="Admin" /> <column name="DATE_NEW" valueDate="2019-07-19" /> <column name="USER_EDIT" value="Admin" /> @@ -20,7 +20,7 @@ <column name="FILTER_NAME" value="OrganisationDuplicates" /> <column name="EXTERNAL_SERVICE_USAGE_ALLOWED" valueNumeric="0" /> <column name="ID_FIELD_NAME" value="CONTACTID" /> - <column name="SCAN_PATTERN" value="name:({"entityfield": "NAME", "exclude": ["gmbh", "co", "kg", "ag", "bank", "deutsche", "van", "software", "medien", "print"] }) AND city:({"entityfield": "STANDARD_CITY"})" /> + <column name="SCAN_PATTERN" value="{"entity":"Organisation_entity","provider":"indexP","filter":{"type":"group","operator":"AND","childs":[{"type":"row","name":"NAME","operator":"CONTAINSNOT","value":"[\"gmbh\", \"co\", \"kg\", \"ag\", \"bank\", \"deutsche\", \"van\", \"software\", \"medien\", \"print\"]","key":"[\"gmbh\", \"co\", \"kg\", \"ag\", \"bank\", \"deutsche\", \"van\", \"software\", \"medien\", \"print\"]","contenttype":"LONG_TEXT"},{"type":"row","name":"STANDARD_CITY","operator":"ISNOTNULL","value":"","key":"","contenttype":"TEXT"}]}}" /> <column name="USER_NEW" value="Admin" /> <column name="DATE_NEW" valueDate="2019-07-19" /> <column name="USER_EDIT" value="Admin" /> diff --git a/entity/DuplicateScanner_entity/DuplicateScanner_entity.aod b/entity/DuplicateScanner_entity/DuplicateScanner_entity.aod index 3334ff8a07..655421fb7b 100644 --- a/entity/DuplicateScanner_entity/DuplicateScanner_entity.aod +++ b/entity/DuplicateScanner_entity/DuplicateScanner_entity.aod @@ -14,7 +14,7 @@ <entityField> <name>ENTITY_TO_SCAN_NAME</name> <title>Target Entity</title> - <onValueChange>%aditoprj%/entity/DuplicateScanner_entity/entityfields/entity_to_scan_name/onValueChange.js</onValueChange> + <stateProcess>%aditoprj%/entity/DuplicateScanner_entity/entityfields/entity_to_scan_name/stateProcess.js</stateProcess> </entityField> <entityField> <name>UID</name> @@ -103,6 +103,8 @@ <dbRecordContainer> <name>DBRecordContainer</name> <alias>Data_alias</alias> + <onDBInsert>%aditoprj%/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBInsert.js</onDBInsert> + <onDBUpdate>%aditoprj%/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBUpdate.js</onDBUpdate> <onDBDelete>%aditoprj%/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> diff --git a/entity/DuplicateScanner_entity/entityfields/entity_to_scan_name/onValueChange.js b/entity/DuplicateScanner_entity/entityfields/entity_to_scan_name/onValueChange.js deleted file mode 100644 index b696837f0f..0000000000 --- a/entity/DuplicateScanner_entity/entityfields/entity_to_scan_name/onValueChange.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.neon"); -import("system.vars"); - -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW) { - var entity = vars.get("$this.value"); - vars.set("$field.SCAN_PATTERN", JSON.stringify({entity: "" + entity + "", provider: "indexP", filter: {type: "group", operator: "AND", childs: []}})); -} \ No newline at end of file diff --git a/entity/DuplicateScanner_entity/entityfields/entity_to_scan_name/stateProcess.js b/entity/DuplicateScanner_entity/entityfields/entity_to_scan_name/stateProcess.js new file mode 100644 index 0000000000..07c220ad58 --- /dev/null +++ b/entity/DuplicateScanner_entity/entityfields/entity_to_scan_name/stateProcess.js @@ -0,0 +1,9 @@ +import("system.neon"); +import("system.result"); +import("system.vars"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) { + result.string(neon.COMPONENTSTATE_EDITABLE); +} else { + result.string(neon.COMPONENTSTATE_READONLY); +} \ No newline at end of file diff --git a/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBInsert.js b/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBInsert.js new file mode 100644 index 0000000000..07ccfd896b --- /dev/null +++ b/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBInsert.js @@ -0,0 +1,7 @@ +import("Sql_lib"); +import("system.neon"); +import("system.vars"); + +var entity = vars.get("$field.ENTITY_TO_SCAN_NAME"); +newWhere("DUPLICATESCANNER.ID", vars.get("$field.UID")) +.updateFields({"DUPLICATESCANNER.SCAN_PATTERN" : JSON.stringify({entity: "" + entity + "", provider: "indexP", filter: {type: "group", operator: "AND", childs: []}})}, "DUPLICATESCANNER"); \ No newline at end of file diff --git a/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBUpdate.js b/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBUpdate.js new file mode 100644 index 0000000000..f91f2dea7d --- /dev/null +++ b/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBUpdate.js @@ -0,0 +1,8 @@ +import("system.vars"); + +let scanPattern = JSON.stringify(vars.get("$field.SCAN_PATTERN")); +if (scanPattern.provider == undefined) +{ + scanPattern.provider = "indexP"; + vars.set("$field.SCAN_PATTERN", JSON.stringify(scanPattern)); +} \ No newline at end of file diff --git a/entity/PermissionDetail_entity/PermissionDetail_entity.aod b/entity/PermissionDetail_entity/PermissionDetail_entity.aod index 8b2a82d124..d6e9a449d7 100644 --- a/entity/PermissionDetail_entity/PermissionDetail_entity.aod +++ b/entity/PermissionDetail_entity/PermissionDetail_entity.aod @@ -131,11 +131,6 @@ <entityName>PermissionMetaData_entity</entityName> <fieldName>MetaData</fieldName> </dependency> - <children> - <entityParameter> - <name>EntityName_param</name> - </entityParameter> - </children> </entityConsumer> <entityParameter> <name>EntityTitle_param</name> -- GitLab