From efad3885e1fdbbb8ffa8efc825c006212e68547a Mon Sep 17 00:00:00 2001 From: "d.buechler" <d.buechler@adito.de> Date: Fri, 13 Sep 2019 16:09:55 +0200 Subject: [PATCH] New Context/Entity/Views/Liquibase to configure which entity fields should be used by the index to search for duplicates Renaming of DuplicateScanConditionConfig to have a seamless naming system - DuplicateScanConditionConfig => DuplicateScannerPrefilterConfig - DuplicateScannerIndexConfig --- .../create_duplicateScannerIndexConfig.xml | 23 ++ ...reate_duplicateScannerPrefilterConfig.xml} | 6 +- .../Data_alias/basic/2019.2.1/changelog.xml | 3 +- aliasDefinition/Data_alias/Data_alias.aod | 136 +++++++- .../_____SYSTEM_APPLICATION_NEON.aod | 2 +- .../duplicatescan_id/valueProcess.js | 6 - .../dbrecordcontainer/conditionProcess.js | 7 - .../DuplicateScannerIndexConfig_entity.aod | 108 +++++++ .../entityfields/date_edit/valueProcess.js | 0 .../entityfields/date_new/valueProcess.js | 0 .../duplicatescanner_id/valueProcess.js | 10 + .../entityfields/user_edit/valueProcess.js | 0 .../entityfields/user_new/valueProcess.js | 0 .../recordcontainer/conditionProcess.js | 7 + ...uplicateScannerPrefilterConfig_entity.aod} | 56 ++-- .../entityfields/condition/onValueChange.js | 0 .../entityfields/condition/valueProcess.js | 2 + .../entityfields/date_edit/valueProcess.js | 0 .../entityfields/date_new/valueProcess.js | 0 .../duplicatescanner_id/valueProcess.js | 10 + .../entityfields/parameter/valueProcess.js | 0 .../entityfields/user_edit/valueProcess.js | 0 .../entityfields/user_new/valueProcess.js | 0 .../dbrecordcontainer/conditionProcess.js | 7 + .../dbrecordcontainer/onDBUpdate.js | 0 .../DuplicateScanner_entity.aod} | 46 ++- .../entityfields/date_edit/valueProcess.js | 7 + .../entityfields/date_new/valueProcess.js | 7 + .../valueProcess.js | 0 .../entityfields/filter_name/onValidation.js | 0 .../duplicatescannerid_param/valueProcess.js | 6 + .../duplicatescannerid_param}/valueProcess.js | 0 .../entitytofilter_param/valueProcess.js | 0 .../testduplicatescanner}/onActionProcess.js | 25 ++ .../entityfields/user_edit/valueProcess.js | 7 + .../entityfields/user_new/valueProcess.js | 7 + .../dbrecordcontainer/onDBDelete.js | 4 +- .../DuplicateScanner.aod} | 16 +- .../DuplicateScannerIndexConfig.aod | 12 + .../DuplicateScannerPrefilterConfig.aod} | 4 +- .../DuplicateEdit_view/DuplicateEdit_view.aod | 4 +- .../DuplicateScannerEdit_view.aod} | 11 +- .../DuplicateScannerFilter_view.aod} | 2 +- .../DuplicateScannerIndexConfigEdit_view.aod | 27 ++ .../DuplicateScannerPreview_view.aod} | 4 +- process/DuplicateScanner_lib/process.js | 292 ++++++++++++++++-- process/JditoFilter_lib/process.js | 20 ++ .../process.js | 6 +- 48 files changed, 777 insertions(+), 113 deletions(-) create mode 100644 .liquibase/Data_alias/basic/2019.2.1/Duplicates/create_duplicateScannerIndexConfig.xml rename .liquibase/Data_alias/basic/2019.2.1/Duplicates/{create_duplicateScanConditionConfig.xml => create_duplicateScannerPrefilterConfig.xml} (89%) delete mode 100644 entity/DuplicateScanConditionConfig_entity/entityfields/duplicatescan_id/valueProcess.js delete mode 100644 entity/DuplicateScanConditionConfig_entity/recordcontainers/dbrecordcontainer/conditionProcess.js create mode 100644 entity/DuplicateScannerIndexConfig_entity/DuplicateScannerIndexConfig_entity.aod rename entity/{DuplicateScanConditionConfig_entity => DuplicateScannerIndexConfig_entity}/entityfields/date_edit/valueProcess.js (100%) rename entity/{DuplicateScanConditionConfig_entity => DuplicateScannerIndexConfig_entity}/entityfields/date_new/valueProcess.js (100%) create mode 100644 entity/DuplicateScannerIndexConfig_entity/entityfields/duplicatescanner_id/valueProcess.js rename entity/{DuplicateScanConditionConfig_entity => DuplicateScannerIndexConfig_entity}/entityfields/user_edit/valueProcess.js (100%) rename entity/{DuplicateScanConditionConfig_entity => DuplicateScannerIndexConfig_entity}/entityfields/user_new/valueProcess.js (100%) create mode 100644 entity/DuplicateScannerIndexConfig_entity/recordcontainers/recordcontainer/conditionProcess.js rename entity/{DuplicateScanConditionConfig_entity/DuplicateScanConditionConfig_entity.aod => DuplicateScannerPrefilterConfig_entity/DuplicateScannerPrefilterConfig_entity.aod} (58%) rename entity/{DuplicateScanConditionConfig_entity => DuplicateScannerPrefilterConfig_entity}/entityfields/condition/onValueChange.js (100%) rename entity/{DuplicateScanConditionConfig_entity => DuplicateScannerPrefilterConfig_entity}/entityfields/condition/valueProcess.js (79%) rename entity/{DuplicateScan_entity => DuplicateScannerPrefilterConfig_entity}/entityfields/date_edit/valueProcess.js (100%) rename entity/{DuplicateScan_entity => DuplicateScannerPrefilterConfig_entity}/entityfields/date_new/valueProcess.js (100%) create mode 100644 entity/DuplicateScannerPrefilterConfig_entity/entityfields/duplicatescanner_id/valueProcess.js rename entity/{DuplicateScanConditionConfig_entity => DuplicateScannerPrefilterConfig_entity}/entityfields/parameter/valueProcess.js (100%) rename entity/{DuplicateScan_entity => DuplicateScannerPrefilterConfig_entity}/entityfields/user_edit/valueProcess.js (100%) rename entity/{DuplicateScan_entity => DuplicateScannerPrefilterConfig_entity}/entityfields/user_new/valueProcess.js (100%) create mode 100644 entity/DuplicateScannerPrefilterConfig_entity/recordcontainers/dbrecordcontainer/conditionProcess.js rename entity/{DuplicateScanConditionConfig_entity => DuplicateScannerPrefilterConfig_entity}/recordcontainers/dbrecordcontainer/onDBUpdate.js (100%) rename entity/{DuplicateScan_entity/DuplicateScan_entity.aod => DuplicateScanner_entity/DuplicateScanner_entity.aod} (62%) create mode 100644 entity/DuplicateScanner_entity/entityfields/date_edit/valueProcess.js create mode 100644 entity/DuplicateScanner_entity/entityfields/date_new/valueProcess.js rename entity/{DuplicateScan_entity => DuplicateScanner_entity}/entityfields/external_service_usage_allowed/valueProcess.js (100%) rename entity/{DuplicateScan_entity => DuplicateScanner_entity}/entityfields/filter_name/onValidation.js (100%) create mode 100644 entity/DuplicateScanner_entity/entityfields/scannerindexconfigs_consumer/children/duplicatescannerid_param/valueProcess.js rename entity/{DuplicateScan_entity/entityfields/scanconditionconfigs_consumer/children/duplicatescanid_param => DuplicateScanner_entity/entityfields/scannerprefilterconfigs_consumer/children/duplicatescannerid_param}/valueProcess.js (100%) rename entity/{DuplicateScan_entity/entityfields/scanconditionconfigs_consumer => DuplicateScanner_entity/entityfields/scannerprefilterconfigs_consumer}/children/entitytofilter_param/valueProcess.js (100%) rename entity/{DuplicateScan_entity/entityfields/testactiongroup/children/testduplicatescan => DuplicateScanner_entity/entityfields/testactiongroup/children/testduplicatescanner}/onActionProcess.js (69%) create mode 100644 entity/DuplicateScanner_entity/entityfields/user_edit/valueProcess.js create mode 100644 entity/DuplicateScanner_entity/entityfields/user_new/valueProcess.js rename entity/{DuplicateScan_entity => DuplicateScanner_entity}/recordcontainers/dbrecordcontainer/onDBDelete.js (80%) rename neonContext/{DuplicateScan/DuplicateScan.aod => DuplicateScanner/DuplicateScanner.aod} (65%) create mode 100644 neonContext/DuplicateScannerIndexConfig/DuplicateScannerIndexConfig.aod rename neonContext/{DuplicateScanConditionConfig/DuplicateScanConditionConfig.aod => DuplicateScannerPrefilterConfig/DuplicateScannerPrefilterConfig.aod} (84%) rename neonView/{DuplicateScanEdit_view/DuplicateScanEdit_view.aod => DuplicateScannerEdit_view/DuplicateScannerEdit_view.aod} (76%) rename neonView/{DuplicateScanFilter_view/DuplicateScanFilter_view.aod => DuplicateScannerFilter_view/DuplicateScannerFilter_view.aod} (96%) create mode 100644 neonView/DuplicateScannerIndexConfigEdit_view/DuplicateScannerIndexConfigEdit_view.aod rename neonView/{DuplicateScanPreview_view/DuplicateScanPreview_view.aod => DuplicateScannerPreview_view/DuplicateScannerPreview_view.aod} (91%) diff --git a/.liquibase/Data_alias/basic/2019.2.1/Duplicates/create_duplicateScannerIndexConfig.xml b/.liquibase/Data_alias/basic/2019.2.1/Duplicates/create_duplicateScannerIndexConfig.xml new file mode 100644 index 0000000000..03bc02bd1d --- /dev/null +++ b/.liquibase/Data_alias/basic/2019.2.1/Duplicates/create_duplicateScannerIndexConfig.xml @@ -0,0 +1,23 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<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="d.buechler" id="1c532327-8b0f-4f0d-b160-dd75db93cecb"> + <createTable tableName="DUPLICATESCANNERINDEXCONFIG"> + <column name="ID" type="CHAR(36)"> + <constraints primaryKey="true" primaryKeyName="PK_DUPLICATESCANNERINDEXCONFIG_ID"/> + </column> + <column name="DUPLICATESCANNER_ID" type="CHAR(36)"> + <constraints nullable="false" /> + </column> + <column name="TARGET_CONTEXT" type="NVARCHAR(100)" /> + <column name="ENTITY_FIELD_NAME" type="NVARCHAR(100)" /> + <column name="USER_NEW" type="NVARCHAR(50)"> + <constraints nullable="false"/> + </column> + <column name="DATE_NEW" type="DATE"> + <constraints nullable="false"/> + </column> + <column name="USER_EDIT" type="NVARCHAR(50)" /> + <column name="DATE_EDIT" type="DATE"/> + </createTable> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2019.2.1/Duplicates/create_duplicateScanConditionConfig.xml b/.liquibase/Data_alias/basic/2019.2.1/Duplicates/create_duplicateScannerPrefilterConfig.xml similarity index 89% rename from .liquibase/Data_alias/basic/2019.2.1/Duplicates/create_duplicateScanConditionConfig.xml rename to .liquibase/Data_alias/basic/2019.2.1/Duplicates/create_duplicateScannerPrefilterConfig.xml index 61202f06f5..971958f1f7 100644 --- a/.liquibase/Data_alias/basic/2019.2.1/Duplicates/create_duplicateScanConditionConfig.xml +++ b/.liquibase/Data_alias/basic/2019.2.1/Duplicates/create_duplicateScannerPrefilterConfig.xml @@ -1,11 +1,11 @@ <?xml version="1.1" encoding="UTF-8" standalone="no"?> <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="d.buechler" id="cf165521-f2bb-4941-82ee-c4a5812ea8b8"> - <createTable tableName="DUPLICATESCANCONDITIONCONFIG"> + <createTable tableName="DUPLICATESCANNERPREFILTERCONFIG"> <column name="ID" type="CHAR(36)"> - <constraints primaryKey="true" primaryKeyName="PK_DUPLICATESCANCONDITIONCONFIG_ID"/> + <constraints primaryKey="true" primaryKeyName="PK_DUPLICATESCANNERPREFILTERCONFIG_ID"/> </column> - <column name="DUPLICATESCAN_ID" type="CHAR(36)"> + <column name="DUPLICATESCANNER_ID" type="CHAR(36)"> <constraints nullable="false" /> </column> <column name="CONDITION" type="CLOB" /> diff --git a/.liquibase/Data_alias/basic/2019.2.1/changelog.xml b/.liquibase/Data_alias/basic/2019.2.1/changelog.xml index 805f6b4d5a..f5be2c867d 100644 --- a/.liquibase/Data_alias/basic/2019.2.1/changelog.xml +++ b/.liquibase/Data_alias/basic/2019.2.1/changelog.xml @@ -11,6 +11,7 @@ <include relativeToChangelogFile="true" file="Duplicates/create_duplicateClusters.xml"/> <include relativeToChangelogFile="true" file="Duplicates/create_duplicateScanner.xml"/> - <include relativeToChangelogFile="true" file="Duplicates/create_duplicateScanConditionConfig.xml"/> + <include relativeToChangelogFile="true" file="Duplicates/create_duplicateScannerPrefilterConfig.xml"/> + <include relativeToChangelogFile="true" file="Duplicates/create_duplicateScannerIndexConfig.xml"/> <include relativeToChangelogFile="true" file="Duplicates/create_unrelatedDuplicates.xml"/> </databaseChangeLog> diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index 85f669d76b..9f9c36632c 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -10999,7 +10999,7 @@ </entityFields> </entityDb> <entityDb> - <name>DUPLICATESCANCONDITIONCONFIG</name> + <name>DUPLICATESCANNERPREFILTERCONFIG</name> <dbName></dbName> <idColumn>ID</idColumn> <idGeneratorType v="0" /> @@ -11115,7 +11115,7 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>DUPLICATESCAN_ID</name> + <name>DUPLICATESCANNER_ID</name> <dbName></dbName> <primaryKey v="false" /> <columnType v="1" /> @@ -11442,6 +11442,138 @@ </entityFieldDb> </entityFields> </entityDb> + <entityDb> + <name>DUPLICATESCANNERINDEXCONFIG</name> + <dbName></dbName> + <idColumn>ID</idColumn> + <idGeneratorType v="0" /> + <idGeneratorInterval v="1" /> + <documentation></documentation> + <title></title> + <description></description> + <auditSyncConfig> + <name>auditSyncConfig</name> + <auditMode v="0" /> + <syncActive v="false" /> + <syncComplete v="true" /> + <syncDirection v="1" /> + <syncIds></syncIds> + </auditSyncConfig> + <entityFields> + <entityFieldDb> + <name>TARGET_CONTEXT</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="100" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DATE_EDIT</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="91" /> + <size v="10" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DUPLICATESCANNER_ID</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DATE_NEW</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="91" /> + <size v="10" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>ID</name> + <dbName></dbName> + <primaryKey v="true" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="true" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>USER_NEW</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="50" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>ENTITY_FIELD_NAME</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="100" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>USER_EDIT</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="50" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + </entityFields> + </entityDb> </entities> </entityGroup> </aliasDefDb> diff --git a/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod b/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod index e193cdfb68..9368553e36 100644 --- a/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod +++ b/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod @@ -237,7 +237,7 @@ <title></title> </entityNode> <entityNode> - <name>DuplicateScan</name> + <name>DuplicateScanner</name> <kind v="10077" /> <title></title> </entityNode> diff --git a/entity/DuplicateScanConditionConfig_entity/entityfields/duplicatescan_id/valueProcess.js b/entity/DuplicateScanConditionConfig_entity/entityfields/duplicatescan_id/valueProcess.js deleted file mode 100644 index 37ac743953..0000000000 --- a/entity/DuplicateScanConditionConfig_entity/entityfields/duplicatescan_id/valueProcess.js +++ /dev/null @@ -1,6 +0,0 @@ -import("system.result"); -import("system.vars"); -if(vars.get("$this.value") == "") -{ - result.string(vars.get("$param.DuplicateScanId_param")); -} \ No newline at end of file diff --git a/entity/DuplicateScanConditionConfig_entity/recordcontainers/dbrecordcontainer/conditionProcess.js b/entity/DuplicateScanConditionConfig_entity/recordcontainers/dbrecordcontainer/conditionProcess.js deleted file mode 100644 index 32b8c7a573..0000000000 --- a/entity/DuplicateScanConditionConfig_entity/recordcontainers/dbrecordcontainer/conditionProcess.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.vars"); -import("system.result"); - -if(vars.get("$param.DuplicateScanId_param")) -{ - result.string("DUPLICATESCAN_ID = '" + vars.getString("$param.DuplicateScanId_param") + "'"); -} \ No newline at end of file diff --git a/entity/DuplicateScannerIndexConfig_entity/DuplicateScannerIndexConfig_entity.aod b/entity/DuplicateScannerIndexConfig_entity/DuplicateScannerIndexConfig_entity.aod new file mode 100644 index 0000000000..cd4d39a1ee --- /dev/null +++ b/entity/DuplicateScannerIndexConfig_entity/DuplicateScannerIndexConfig_entity.aod @@ -0,0 +1,108 @@ +<?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.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11"> + <name>DuplicateScannerIndexConfig_entity</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <recordContainer>recordContainer</recordContainer> + <entityFields> + <entityProvider> + <name>#PROVIDER</name> + </entityProvider> + <entityField> + <name>TARGET_CONTEXT</name> + <title>Context</title> + </entityField> + <entityField> + <name>ENTITY_FIELD_NAME</name> + <title>Entity field name</title> + </entityField> + <entityProvider> + <name>ScannerIndexConfigProvider</name> + <dependencies> + <entityDependency> + <name>031ba527-13cf-4b28-9db4-8f666f81bc8e</name> + <entityName>DuplicateScanner_entity</entityName> + <fieldName>ScannerIndexConfigs_Consumer</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> + </entityProvider> + <entityField> + <name>UID</name> + </entityField> + <entityField> + <name>DUPLICATESCANNER_ID</name> + <valueProcess>%aditoprj%/entity/DuplicateScannerIndexConfig_entity/entityfields/duplicatescanner_id/valueProcess.js</valueProcess> + </entityField> + <entityParameter> + <name>DuplicateScannerId_param</name> + <expose v="true" /> + <mandatory v="true" /> + </entityParameter> + <entityField> + <name>DATE_EDIT</name> + <valueProcess>%aditoprj%/entity/DuplicateScannerIndexConfig_entity/entityfields/date_edit/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>DATE_NEW</name> + <valueProcess>%aditoprj%/entity/DuplicateScannerIndexConfig_entity/entityfields/date_new/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>USER_NEW</name> + <valueProcess>%aditoprj%/entity/DuplicateScannerIndexConfig_entity/entityfields/user_new/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>USER_EDIT</name> + <valueProcess>%aditoprj%/entity/DuplicateScannerIndexConfig_entity/entityfields/user_edit/valueProcess.js</valueProcess> + </entityField> + </entityFields> + <recordContainers> + <dbRecordContainer> + <name>recordContainer</name> + <alias>Data_alias</alias> + <conditionProcess>%aditoprj%/entity/DuplicateScannerIndexConfig_entity/recordcontainers/recordcontainer/conditionProcess.js</conditionProcess> + <linkInformation> + <linkInformation> + <name>e8beb2e0-6eae-401c-8c72-3d91d440c9c3</name> + <tableName>DUPLICATESCANNERINDEXCONFIG</tableName> + <primaryKey>ID</primaryKey> + <isUIDTable v="false" /> + <readonly v="false" /> + </linkInformation> + </linkInformation> + <recordFieldMappings> + <dbRecordFieldMapping> + <name>UID.value</name> + <recordfield>DUPLICATESCANNERINDEXCONFIG.ID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>TARGET_CONTEXT.value</name> + <recordfield>DUPLICATESCANNERINDEXCONFIG.TARGET_CONTEXT</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ENTITY_FIELD_NAME.value</name> + <recordfield>DUPLICATESCANNERINDEXCONFIG.ENTITY_FIELD_NAME</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DUPLICATESCANNER_ID.value</name> + <recordfield>DUPLICATESCANNERINDEXCONFIG.DUPLICATESCANNER_ID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>USER_NEW.value</name> + <recordfield>DUPLICATESCANNERINDEXCONFIG.USER_NEW</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>USER_EDIT.value</name> + <recordfield>DUPLICATESCANNERINDEXCONFIG.USER_EDIT</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DATE_NEW.value</name> + <recordfield>DUPLICATESCANNERINDEXCONFIG.DATE_NEW</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DATE_EDIT.value</name> + <recordfield>DUPLICATESCANNERINDEXCONFIG.DATE_EDIT</recordfield> + </dbRecordFieldMapping> + </recordFieldMappings> + </dbRecordContainer> + </recordContainers> +</entity> diff --git a/entity/DuplicateScanConditionConfig_entity/entityfields/date_edit/valueProcess.js b/entity/DuplicateScannerIndexConfig_entity/entityfields/date_edit/valueProcess.js similarity index 100% rename from entity/DuplicateScanConditionConfig_entity/entityfields/date_edit/valueProcess.js rename to entity/DuplicateScannerIndexConfig_entity/entityfields/date_edit/valueProcess.js diff --git a/entity/DuplicateScanConditionConfig_entity/entityfields/date_new/valueProcess.js b/entity/DuplicateScannerIndexConfig_entity/entityfields/date_new/valueProcess.js similarity index 100% rename from entity/DuplicateScanConditionConfig_entity/entityfields/date_new/valueProcess.js rename to entity/DuplicateScannerIndexConfig_entity/entityfields/date_new/valueProcess.js diff --git a/entity/DuplicateScannerIndexConfig_entity/entityfields/duplicatescanner_id/valueProcess.js b/entity/DuplicateScannerIndexConfig_entity/entityfields/duplicatescanner_id/valueProcess.js new file mode 100644 index 0000000000..66f9c66a4b --- /dev/null +++ b/entity/DuplicateScannerIndexConfig_entity/entityfields/duplicatescanner_id/valueProcess.js @@ -0,0 +1,10 @@ +import("system.logging"); +import("system.result"); +import("system.vars"); +logging.log("DuplicateScannerId_param -> " + vars.get("$param.DuplicateScannerId_param")); +logging.log("this value -> " + vars.get("$this.value")); +if(vars.get("$this.value") == null || vars.get("$this.value") == "") +{ + logging.log("hallo -> "); + result.string(vars.get("$param.DuplicateScannerId_param")); +} \ No newline at end of file diff --git a/entity/DuplicateScanConditionConfig_entity/entityfields/user_edit/valueProcess.js b/entity/DuplicateScannerIndexConfig_entity/entityfields/user_edit/valueProcess.js similarity index 100% rename from entity/DuplicateScanConditionConfig_entity/entityfields/user_edit/valueProcess.js rename to entity/DuplicateScannerIndexConfig_entity/entityfields/user_edit/valueProcess.js diff --git a/entity/DuplicateScanConditionConfig_entity/entityfields/user_new/valueProcess.js b/entity/DuplicateScannerIndexConfig_entity/entityfields/user_new/valueProcess.js similarity index 100% rename from entity/DuplicateScanConditionConfig_entity/entityfields/user_new/valueProcess.js rename to entity/DuplicateScannerIndexConfig_entity/entityfields/user_new/valueProcess.js diff --git a/entity/DuplicateScannerIndexConfig_entity/recordcontainers/recordcontainer/conditionProcess.js b/entity/DuplicateScannerIndexConfig_entity/recordcontainers/recordcontainer/conditionProcess.js new file mode 100644 index 0000000000..09f2397fdf --- /dev/null +++ b/entity/DuplicateScannerIndexConfig_entity/recordcontainers/recordcontainer/conditionProcess.js @@ -0,0 +1,7 @@ +import("system.vars"); +import("system.result"); + +if(vars.get("$param.DuplicateScannerId_param")) +{ + result.string("DUPLICATESCANNER_ID = '" + vars.getString("$param.DuplicateScannerId_param") + "'"); +} \ No newline at end of file diff --git a/entity/DuplicateScanConditionConfig_entity/DuplicateScanConditionConfig_entity.aod b/entity/DuplicateScannerPrefilterConfig_entity/DuplicateScannerPrefilterConfig_entity.aod similarity index 58% rename from entity/DuplicateScanConditionConfig_entity/DuplicateScanConditionConfig_entity.aod rename to entity/DuplicateScannerPrefilterConfig_entity/DuplicateScannerPrefilterConfig_entity.aod index 66b7a72398..000df595b2 100644 --- a/entity/DuplicateScanConditionConfig_entity/DuplicateScanConditionConfig_entity.aod +++ b/entity/DuplicateScannerPrefilterConfig_entity/DuplicateScannerPrefilterConfig_entity.aod @@ -1,6 +1,6 @@ <?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.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11"> - <name>DuplicateScanConditionConfig_entity</name> + <name>DuplicateScannerPrefilterConfig_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> <title>Condition Configuration</title> <recordContainer>DBRecordContainer</recordContainer> @@ -17,8 +17,8 @@ <name>CONDITION</name> <title>Condition</title> <contentType>FILTER_TREE</contentType> - <valueProcess>%aditoprj%/entity/DuplicateScanConditionConfig_entity/entityfields/condition/valueProcess.js</valueProcess> - <onValueChange>%aditoprj%/entity/DuplicateScanConditionConfig_entity/entityfields/condition/onValueChange.js</onValueChange> + <valueProcess>%aditoprj%/entity/DuplicateScannerPrefilterConfig_entity/entityfields/condition/valueProcess.js</valueProcess> + <onValueChange>%aditoprj%/entity/DuplicateScannerPrefilterConfig_entity/entityfields/condition/onValueChange.js</onValueChange> <onValueChangeTypes> <element>MASK</element> <element>PROCESS</element> @@ -26,20 +26,20 @@ </onValueChangeTypes> </entityField> <entityProvider> - <name>ScanConditionConfigsProvider</name> + <name>ScannerPrefilterConfigsProvider</name> <recordContainer>DBRecordContainer</recordContainer> <dependencies> <entityDependency> <name>a546a627-7b08-42a7-86af-c3759d163235</name> - <entityName>DuplicateScan_entity</entityName> - <fieldName>ScanConditionConfigs_Consumer</fieldName> + <entityName>DuplicateScanner_entity</entityName> + <fieldName>ScannerPrefilterConfigs_Consumer</fieldName> <isConsumer v="false" /> </entityDependency> </dependencies> </entityProvider> <entityField> - <name>DUPLICATESCAN_ID</name> - <valueProcess>%aditoprj%/entity/DuplicateScanConditionConfig_entity/entityfields/duplicatescan_id/valueProcess.js</valueProcess> + <name>DUPLICATESCANNER_ID</name> + <valueProcess>%aditoprj%/entity/DuplicateScannerPrefilterConfig_entity/entityfields/duplicatescanner_id/valueProcess.js</valueProcess> </entityField> <entityField> <name>UID</name> @@ -57,28 +57,28 @@ <entityField> <name>parameter</name> <title>parameter</title> - <valueProcess>%aditoprj%/entity/DuplicateScanConditionConfig_entity/entityfields/parameter/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/DuplicateScannerPrefilterConfig_entity/entityfields/parameter/valueProcess.js</valueProcess> </entityField> <entityParameter> - <name>DuplicateScanId_param</name> + <name>DuplicateScannerId_param</name> <expose v="true" /> <mandatory v="true" /> </entityParameter> <entityField> <name>DATE_EDIT</name> - <valueProcess>%aditoprj%/entity/DuplicateScanConditionConfig_entity/entityfields/date_edit/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/DuplicateScannerPrefilterConfig_entity/entityfields/date_edit/valueProcess.js</valueProcess> </entityField> <entityField> <name>DATE_NEW</name> - <valueProcess>%aditoprj%/entity/DuplicateScanConditionConfig_entity/entityfields/date_new/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/DuplicateScannerPrefilterConfig_entity/entityfields/date_new/valueProcess.js</valueProcess> </entityField> <entityField> <name>USER_NEW</name> - <valueProcess>%aditoprj%/entity/DuplicateScanConditionConfig_entity/entityfields/user_new/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/DuplicateScannerPrefilterConfig_entity/entityfields/user_new/valueProcess.js</valueProcess> </entityField> <entityField> <name>USER_EDIT</name> - <valueProcess>%aditoprj%/entity/DuplicateScanConditionConfig_entity/entityfields/user_edit/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/DuplicateScannerPrefilterConfig_entity/entityfields/user_edit/valueProcess.js</valueProcess> </entityField> <entityField> <name>MAX_RESULTS_THRESHOLD</name> @@ -89,12 +89,12 @@ <dbRecordContainer> <name>DBRecordContainer</name> <alias>Data_alias</alias> - <conditionProcess>%aditoprj%/entity/DuplicateScanConditionConfig_entity/recordcontainers/dbrecordcontainer/conditionProcess.js</conditionProcess> - <onDBUpdate>%aditoprj%/entity/DuplicateScanConditionConfig_entity/recordcontainers/dbrecordcontainer/onDBUpdate.js</onDBUpdate> + <conditionProcess>%aditoprj%/entity/DuplicateScannerPrefilterConfig_entity/recordcontainers/dbrecordcontainer/conditionProcess.js</conditionProcess> + <onDBUpdate>%aditoprj%/entity/DuplicateScannerPrefilterConfig_entity/recordcontainers/dbrecordcontainer/onDBUpdate.js</onDBUpdate> <linkInformation> <linkInformation> <name>072783b0-8914-4886-bfa3-74565db81474</name> - <tableName>DUPLICATESCANCONDITIONCONFIG</tableName> + <tableName>DUPLICATESCANNERPREFILTERCONFIG</tableName> <primaryKey>ID</primaryKey> <isUIDTable v="true" /> <readonly v="false" /> @@ -103,43 +103,43 @@ <recordFieldMappings> <dbRecordFieldMapping> <name>CONDITION.value</name> - <recordfield>DUPLICATESCANCONDITIONCONFIG.CONDITION</recordfield> + <recordfield>DUPLICATESCANNERPREFILTERCONFIG.CONDITION</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>COUNT_CHARACTERS_TO_USE.value</name> - <recordfield>DUPLICATESCANCONDITIONCONFIG.COUNT_CHARACTERS_TO_USE</recordfield> + <recordfield>DUPLICATESCANNERPREFILTERCONFIG.COUNT_CHARACTERS_TO_USE</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> - <name>DUPLICATESCAN_ID.value</name> - <recordfield>DUPLICATESCANCONDITIONCONFIG.DUPLICATESCAN_ID</recordfield> + <name>DUPLICATESCANNER_ID.value</name> + <recordfield>DUPLICATESCANNERPREFILTERCONFIG.DUPLICATESCANNER_ID</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>UID.value</name> - <recordfield>DUPLICATESCANCONDITIONCONFIG.ID</recordfield> + <recordfield>DUPLICATESCANNERPREFILTERCONFIG.ID</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONDITION_CONFIG_NAME.value</name> - <recordfield>DUPLICATESCANCONDITIONCONFIG.CONDITION_CONFIG_NAME</recordfield> + <recordfield>DUPLICATESCANNERPREFILTERCONFIG.CONDITION_CONFIG_NAME</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DATE_EDIT.value</name> - <recordfield>DUPLICATESCANCONDITIONCONFIG.DATE_EDIT</recordfield> + <recordfield>DUPLICATESCANNERPREFILTERCONFIG.DATE_EDIT</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DATE_NEW.value</name> - <recordfield>DUPLICATESCANCONDITIONCONFIG.DATE_NEW</recordfield> + <recordfield>DUPLICATESCANNERPREFILTERCONFIG.DATE_NEW</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>USER_EDIT.value</name> - <recordfield>DUPLICATESCANCONDITIONCONFIG.USER_EDIT</recordfield> + <recordfield>DUPLICATESCANNERPREFILTERCONFIG.USER_EDIT</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>USER_NEW.value</name> - <recordfield>DUPLICATESCANCONDITIONCONFIG.USER_NEW</recordfield> + <recordfield>DUPLICATESCANNERPREFILTERCONFIG.USER_NEW</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>MAX_RESULTS_THRESHOLD.value</name> - <recordfield>DUPLICATESCANCONDITIONCONFIG.MAX_RESULTS_THRESHOLD</recordfield> + <recordfield>DUPLICATESCANNERPREFILTERCONFIG.MAX_RESULTS_THRESHOLD</recordfield> </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> diff --git a/entity/DuplicateScanConditionConfig_entity/entityfields/condition/onValueChange.js b/entity/DuplicateScannerPrefilterConfig_entity/entityfields/condition/onValueChange.js similarity index 100% rename from entity/DuplicateScanConditionConfig_entity/entityfields/condition/onValueChange.js rename to entity/DuplicateScannerPrefilterConfig_entity/entityfields/condition/onValueChange.js diff --git a/entity/DuplicateScanConditionConfig_entity/entityfields/condition/valueProcess.js b/entity/DuplicateScannerPrefilterConfig_entity/entityfields/condition/valueProcess.js similarity index 79% rename from entity/DuplicateScanConditionConfig_entity/entityfields/condition/valueProcess.js rename to entity/DuplicateScannerPrefilterConfig_entity/entityfields/condition/valueProcess.js index c1041366b8..be039b8954 100644 --- a/entity/DuplicateScanConditionConfig_entity/entityfields/condition/valueProcess.js +++ b/entity/DuplicateScannerPrefilterConfig_entity/entityfields/condition/valueProcess.js @@ -1,6 +1,8 @@ +import("system.logging"); import("system.vars"); import("system.result"); +logging.log("this.value -> " + vars.get("$this.value")); if(vars.get("$this.value") == "") { let entityToScan = vars.get("$param.EntityToFilter_param"); diff --git a/entity/DuplicateScan_entity/entityfields/date_edit/valueProcess.js b/entity/DuplicateScannerPrefilterConfig_entity/entityfields/date_edit/valueProcess.js similarity index 100% rename from entity/DuplicateScan_entity/entityfields/date_edit/valueProcess.js rename to entity/DuplicateScannerPrefilterConfig_entity/entityfields/date_edit/valueProcess.js diff --git a/entity/DuplicateScan_entity/entityfields/date_new/valueProcess.js b/entity/DuplicateScannerPrefilterConfig_entity/entityfields/date_new/valueProcess.js similarity index 100% rename from entity/DuplicateScan_entity/entityfields/date_new/valueProcess.js rename to entity/DuplicateScannerPrefilterConfig_entity/entityfields/date_new/valueProcess.js diff --git a/entity/DuplicateScannerPrefilterConfig_entity/entityfields/duplicatescanner_id/valueProcess.js b/entity/DuplicateScannerPrefilterConfig_entity/entityfields/duplicatescanner_id/valueProcess.js new file mode 100644 index 0000000000..15289852f2 --- /dev/null +++ b/entity/DuplicateScannerPrefilterConfig_entity/entityfields/duplicatescanner_id/valueProcess.js @@ -0,0 +1,10 @@ +import("system.logging"); +import("system.result"); +import("system.vars"); +logging.log("asdDuplicateScannerId_param -> " + vars.get("$param.DuplicateScannerId_param")); +logging.log("asdthis value -> " + vars.get("$this.value")); +if(vars.get("$this.value") == "") +{ + logging.log("asdhallo -> "); + result.string(vars.get("$param.DuplicateScannerId_param")); +} \ No newline at end of file diff --git a/entity/DuplicateScanConditionConfig_entity/entityfields/parameter/valueProcess.js b/entity/DuplicateScannerPrefilterConfig_entity/entityfields/parameter/valueProcess.js similarity index 100% rename from entity/DuplicateScanConditionConfig_entity/entityfields/parameter/valueProcess.js rename to entity/DuplicateScannerPrefilterConfig_entity/entityfields/parameter/valueProcess.js diff --git a/entity/DuplicateScan_entity/entityfields/user_edit/valueProcess.js b/entity/DuplicateScannerPrefilterConfig_entity/entityfields/user_edit/valueProcess.js similarity index 100% rename from entity/DuplicateScan_entity/entityfields/user_edit/valueProcess.js rename to entity/DuplicateScannerPrefilterConfig_entity/entityfields/user_edit/valueProcess.js diff --git a/entity/DuplicateScan_entity/entityfields/user_new/valueProcess.js b/entity/DuplicateScannerPrefilterConfig_entity/entityfields/user_new/valueProcess.js similarity index 100% rename from entity/DuplicateScan_entity/entityfields/user_new/valueProcess.js rename to entity/DuplicateScannerPrefilterConfig_entity/entityfields/user_new/valueProcess.js diff --git a/entity/DuplicateScannerPrefilterConfig_entity/recordcontainers/dbrecordcontainer/conditionProcess.js b/entity/DuplicateScannerPrefilterConfig_entity/recordcontainers/dbrecordcontainer/conditionProcess.js new file mode 100644 index 0000000000..09f2397fdf --- /dev/null +++ b/entity/DuplicateScannerPrefilterConfig_entity/recordcontainers/dbrecordcontainer/conditionProcess.js @@ -0,0 +1,7 @@ +import("system.vars"); +import("system.result"); + +if(vars.get("$param.DuplicateScannerId_param")) +{ + result.string("DUPLICATESCANNER_ID = '" + vars.getString("$param.DuplicateScannerId_param") + "'"); +} \ No newline at end of file diff --git a/entity/DuplicateScanConditionConfig_entity/recordcontainers/dbrecordcontainer/onDBUpdate.js b/entity/DuplicateScannerPrefilterConfig_entity/recordcontainers/dbrecordcontainer/onDBUpdate.js similarity index 100% rename from entity/DuplicateScanConditionConfig_entity/recordcontainers/dbrecordcontainer/onDBUpdate.js rename to entity/DuplicateScannerPrefilterConfig_entity/recordcontainers/dbrecordcontainer/onDBUpdate.js diff --git a/entity/DuplicateScan_entity/DuplicateScan_entity.aod b/entity/DuplicateScanner_entity/DuplicateScanner_entity.aod similarity index 62% rename from entity/DuplicateScan_entity/DuplicateScan_entity.aod rename to entity/DuplicateScanner_entity/DuplicateScanner_entity.aod index a8430e125f..32667f2dcf 100644 --- a/entity/DuplicateScan_entity/DuplicateScan_entity.aod +++ b/entity/DuplicateScanner_entity/DuplicateScanner_entity.aod @@ -1,6 +1,6 @@ <?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.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11"> - <name>DuplicateScan_entity</name> + <name>DuplicateScanner_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> <title>Duplicate configuration</title> <iconId>VAADIN:DATABASE</iconId> @@ -20,29 +20,29 @@ <entityField> <name>FILTER_NAME</name> <title>Filter Name</title> - <onValidation>%aditoprj%/entity/DuplicateScan_entity/entityfields/filter_name/onValidation.js</onValidation> + <onValidation>%aditoprj%/entity/DuplicateScanner_entity/entityfields/filter_name/onValidation.js</onValidation> </entityField> <entityField> <name>EXTERNAL_SERVICE_USAGE_ALLOWED</name> <title>Use external Scanservice</title> <contentType>BOOLEAN</contentType> - <valueProcess>%aditoprj%/entity/DuplicateScan_entity/entityfields/external_service_usage_allowed/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/DuplicateScanner_entity/entityfields/external_service_usage_allowed/valueProcess.js</valueProcess> </entityField> <entityConsumer> - <name>ScanConditionConfigs_Consumer</name> + <name>ScannerPrefilterConfigs_Consumer</name> <dependency> <name>dependency</name> - <entityName>DuplicateScanConditionConfig_entity</entityName> - <fieldName>ScanConditionConfigsProvider</fieldName> + <entityName>DuplicateScannerPrefilterConfig_entity</entityName> + <fieldName>ScannerPrefilterConfigsProvider</fieldName> </dependency> <children> <entityParameter> <name>EntityToFilter_param</name> - <valueProcess>%aditoprj%/entity/DuplicateScan_entity/entityfields/scanconditionconfigs_consumer/children/entitytofilter_param/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/DuplicateScanner_entity/entityfields/scannerprefilterconfigs_consumer/children/entitytofilter_param/valueProcess.js</valueProcess> </entityParameter> <entityParameter> - <name>DuplicateScanId_param</name> - <valueProcess>%aditoprj%/entity/DuplicateScan_entity/entityfields/scanconditionconfigs_consumer/children/duplicatescanid_param/valueProcess.js</valueProcess> + <name>DuplicateScannerId_param</name> + <valueProcess>%aditoprj%/entity/DuplicateScanner_entity/entityfields/scannerprefilterconfigs_consumer/children/duplicatescannerid_param/valueProcess.js</valueProcess> </entityParameter> </children> </entityConsumer> @@ -50,34 +50,48 @@ <name>TestActionGroup</name> <children> <entityActionField> - <name>TestDuplicateScan</name> + <name>TestDuplicateScanner</name> <title>Test DuplicateSearch</title> - <onActionProcess>%aditoprj%/entity/DuplicateScan_entity/entityfields/testactiongroup/children/testduplicatescan/onActionProcess.js</onActionProcess> + <onActionProcess>%aditoprj%/entity/DuplicateScanner_entity/entityfields/testactiongroup/children/testduplicatescanner/onActionProcess.js</onActionProcess> </entityActionField> </children> </entityActionGroup> <entityField> <name>USER_NEW</name> - <valueProcess>%aditoprj%/entity/DuplicateScan_entity/entityfields/user_new/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/DuplicateScanner_entity/entityfields/user_new/valueProcess.js</valueProcess> </entityField> <entityField> <name>USER_EDIT</name> - <valueProcess>%aditoprj%/entity/DuplicateScan_entity/entityfields/user_edit/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/DuplicateScanner_entity/entityfields/user_edit/valueProcess.js</valueProcess> </entityField> <entityField> <name>DATE_NEW</name> - <valueProcess>%aditoprj%/entity/DuplicateScan_entity/entityfields/date_new/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/DuplicateScanner_entity/entityfields/date_new/valueProcess.js</valueProcess> </entityField> <entityField> <name>DATE_EDIT</name> - <valueProcess>%aditoprj%/entity/DuplicateScan_entity/entityfields/date_edit/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/DuplicateScanner_entity/entityfields/date_edit/valueProcess.js</valueProcess> </entityField> + <entityConsumer> + <name>ScannerIndexConfigs_Consumer</name> + <dependency> + <name>dependency</name> + <entityName>DuplicateScannerIndexConfig_entity</entityName> + <fieldName>ScannerIndexConfigProvider</fieldName> + </dependency> + <children> + <entityParameter> + <name>DuplicateScannerId_param</name> + <valueProcess>%aditoprj%/entity/DuplicateScanner_entity/entityfields/scannerindexconfigs_consumer/children/duplicatescannerid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> </entityFields> <recordContainers> <dbRecordContainer> <name>DBRecordContainer</name> <alias>Data_alias</alias> - <onDBDelete>%aditoprj%/entity/DuplicateScan_entity/recordcontainers/dbrecordcontainer/onDBDelete.js</onDBDelete> + <onDBDelete>%aditoprj%/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> <name>b61b26d3-e823-45ba-9ac5-12acaaa1ec15</name> diff --git a/entity/DuplicateScanner_entity/entityfields/date_edit/valueProcess.js b/entity/DuplicateScanner_entity/entityfields/date_edit/valueProcess.js new file mode 100644 index 0000000000..5e6ef05973 --- /dev/null +++ b/entity/DuplicateScanner_entity/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/DuplicateScanner_entity/entityfields/date_new/valueProcess.js b/entity/DuplicateScanner_entity/entityfields/date_new/valueProcess.js new file mode 100644 index 0000000000..a72892783b --- /dev/null +++ b/entity/DuplicateScanner_entity/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/DuplicateScan_entity/entityfields/external_service_usage_allowed/valueProcess.js b/entity/DuplicateScanner_entity/entityfields/external_service_usage_allowed/valueProcess.js similarity index 100% rename from entity/DuplicateScan_entity/entityfields/external_service_usage_allowed/valueProcess.js rename to entity/DuplicateScanner_entity/entityfields/external_service_usage_allowed/valueProcess.js diff --git a/entity/DuplicateScan_entity/entityfields/filter_name/onValidation.js b/entity/DuplicateScanner_entity/entityfields/filter_name/onValidation.js similarity index 100% rename from entity/DuplicateScan_entity/entityfields/filter_name/onValidation.js rename to entity/DuplicateScanner_entity/entityfields/filter_name/onValidation.js diff --git a/entity/DuplicateScanner_entity/entityfields/scannerindexconfigs_consumer/children/duplicatescannerid_param/valueProcess.js b/entity/DuplicateScanner_entity/entityfields/scannerindexconfigs_consumer/children/duplicatescannerid_param/valueProcess.js new file mode 100644 index 0000000000..22f23dda2f --- /dev/null +++ b/entity/DuplicateScanner_entity/entityfields/scannerindexconfigs_consumer/children/duplicatescannerid_param/valueProcess.js @@ -0,0 +1,6 @@ +import("system.logging"); +import("system.vars"); +import("system.result"); + +logging.log("$field.UID -> " + vars.get("$field.UID")); +result.string(vars.get("$field.UID")); \ No newline at end of file diff --git a/entity/DuplicateScan_entity/entityfields/scanconditionconfigs_consumer/children/duplicatescanid_param/valueProcess.js b/entity/DuplicateScanner_entity/entityfields/scannerprefilterconfigs_consumer/children/duplicatescannerid_param/valueProcess.js similarity index 100% rename from entity/DuplicateScan_entity/entityfields/scanconditionconfigs_consumer/children/duplicatescanid_param/valueProcess.js rename to entity/DuplicateScanner_entity/entityfields/scannerprefilterconfigs_consumer/children/duplicatescannerid_param/valueProcess.js diff --git a/entity/DuplicateScan_entity/entityfields/scanconditionconfigs_consumer/children/entitytofilter_param/valueProcess.js b/entity/DuplicateScanner_entity/entityfields/scannerprefilterconfigs_consumer/children/entitytofilter_param/valueProcess.js similarity index 100% rename from entity/DuplicateScan_entity/entityfields/scanconditionconfigs_consumer/children/entitytofilter_param/valueProcess.js rename to entity/DuplicateScanner_entity/entityfields/scannerprefilterconfigs_consumer/children/entitytofilter_param/valueProcess.js diff --git a/entity/DuplicateScan_entity/entityfields/testactiongroup/children/testduplicatescan/onActionProcess.js b/entity/DuplicateScanner_entity/entityfields/testactiongroup/children/testduplicatescanner/onActionProcess.js similarity index 69% rename from entity/DuplicateScan_entity/entityfields/testactiongroup/children/testduplicatescan/onActionProcess.js rename to entity/DuplicateScanner_entity/entityfields/testactiongroup/children/testduplicatescanner/onActionProcess.js index 96cb00f646..86fe140654 100644 --- a/entity/DuplicateScan_entity/entityfields/testactiongroup/children/testduplicatescan/onActionProcess.js +++ b/entity/DuplicateScanner_entity/entityfields/testactiongroup/children/testduplicatescanner/onActionProcess.js @@ -1,5 +1,30 @@ +import("system.question"); import("system.logging"); import("DuplicateScanner_lib"); +import("JditoFilter_lib"); + +//let testFields = []; +//let filters = DuplicateScannerUtils.loadFilters("PersonDuplicates", "Person_entity") +//logging.log("filters -> " + filters); +// +//for (let i = 0; i < filters.length; i++) +//{ +// logging.log("filters[i] -> " + filters[i]); +// let filter = JSON.parse(filters[i]).filter; +// let fields = JditoFilterUtils.getFilterFields(filter.childs) +// testFields.concat(fields); +//} +//logging.log("testFields -> " + testFields); + + + + +// var buttons = { +// "ok" : "ok", +// "": "Abbrechen" +// }; +// var defaultButton = "ok"; +//var res = question.openDialog("DLG_FILTER_TODO_Neon", null, buttons, defaultButton); diff --git a/entity/DuplicateScanner_entity/entityfields/user_edit/valueProcess.js b/entity/DuplicateScanner_entity/entityfields/user_edit/valueProcess.js new file mode 100644 index 0000000000..6af880ae3e --- /dev/null +++ b/entity/DuplicateScanner_entity/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/DuplicateScanner_entity/entityfields/user_new/valueProcess.js b/entity/DuplicateScanner_entity/entityfields/user_new/valueProcess.js new file mode 100644 index 0000000000..e518bc75a9 --- /dev/null +++ b/entity/DuplicateScanner_entity/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/DuplicateScan_entity/recordcontainers/dbrecordcontainer/onDBDelete.js b/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBDelete.js similarity index 80% rename from entity/DuplicateScan_entity/recordcontainers/dbrecordcontainer/onDBDelete.js rename to entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBDelete.js index 67f82ff481..06be87508d 100644 --- a/entity/DuplicateScan_entity/recordcontainers/dbrecordcontainer/onDBDelete.js +++ b/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBDelete.js @@ -7,12 +7,12 @@ var currentId = vars.getString("$field.UID"); if (currentId) { var toDelete = [ - "DUPLICATESCANCONDITIONCONFIG", + "DUPLICATESCANNERPREFILTERCONFIG", ]; toDelete = toDelete.map(function(pTable) { - return [pTable, SqlCondition.equals(pTable + ".DUPLICATESCAN_ID", currentId, "1=2")] + return [pTable, SqlCondition.equals(pTable + ".DUPLICATESCANNER_ID", currentId, "1=2")] }); db.deletes(toDelete); diff --git a/neonContext/DuplicateScan/DuplicateScan.aod b/neonContext/DuplicateScanner/DuplicateScanner.aod similarity index 65% rename from neonContext/DuplicateScan/DuplicateScan.aod rename to neonContext/DuplicateScanner/DuplicateScanner.aod index b599cfa83e..4f2a161e17 100644 --- a/neonContext/DuplicateScan/DuplicateScan.aod +++ b/neonContext/DuplicateScanner/DuplicateScanner.aod @@ -1,24 +1,24 @@ <?xml version="1.0" encoding="UTF-8"?> <neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0"> - <name>DuplicateScan</name> + <name>DuplicateScanner</name> <title>Duplicate configuration</title> <majorModelMode>DISTRIBUTED</majorModelMode> - <filterview>DuplicateScanFilter_view</filterview> - <editview>DuplicateScanEdit_view</editview> - <preview>DuplicateScanPreview_view</preview> - <entity>DuplicateScan_entity</entity> + <filterview>DuplicateScannerFilter_view</filterview> + <editview>DuplicateScannerEdit_view</editview> + <preview>DuplicateScannerPreview_view</preview> + <entity>DuplicateScanner_entity</entity> <references> <neonViewReference> <name>53f8619a-aa58-45a3-afe4-a8cb15d76ece</name> - <view>DuplicateScanFilter_view</view> + <view>DuplicateScannerFilter_view</view> </neonViewReference> <neonViewReference> <name>93945a65-b870-4f37-8282-da5d8c60f17d</name> - <view>DuplicateScanPreview_view</view> + <view>DuplicateScannerPreview_view</view> </neonViewReference> <neonViewReference> <name>6688b424-8f21-49c7-8613-d6d822309a1a</name> - <view>DuplicateScanEdit_view</view> + <view>DuplicateScannerEdit_view</view> </neonViewReference> </references> </neonContext> diff --git a/neonContext/DuplicateScannerIndexConfig/DuplicateScannerIndexConfig.aod b/neonContext/DuplicateScannerIndexConfig/DuplicateScannerIndexConfig.aod new file mode 100644 index 0000000000..a586520902 --- /dev/null +++ b/neonContext/DuplicateScannerIndexConfig/DuplicateScannerIndexConfig.aod @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0"> + <name>DuplicateScannerIndexConfig</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <entity>DuplicateScannerIndexConfig_entity</entity> + <references> + <neonViewReference> + <name>2b64a1d4-3c88-43f0-9270-265d7bd2c093</name> + <view>DuplicateScannerIndexConfigEdit_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonContext/DuplicateScanConditionConfig/DuplicateScanConditionConfig.aod b/neonContext/DuplicateScannerPrefilterConfig/DuplicateScannerPrefilterConfig.aod similarity index 84% rename from neonContext/DuplicateScanConditionConfig/DuplicateScanConditionConfig.aod rename to neonContext/DuplicateScannerPrefilterConfig/DuplicateScannerPrefilterConfig.aod index 5467983e6b..819fa9bd9c 100644 --- a/neonContext/DuplicateScanConditionConfig/DuplicateScanConditionConfig.aod +++ b/neonContext/DuplicateScannerPrefilterConfig/DuplicateScannerPrefilterConfig.aod @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0"> - <name>DuplicateScanConditionConfig</name> + <name>DuplicateScannerPrefilterConfig</name> <title>Condition Configuration</title> <majorModelMode>DISTRIBUTED</majorModelMode> <editview>DuplicateEdit_view</editview> - <entity>DuplicateScanConditionConfig_entity</entity> + <entity>DuplicateScannerPrefilterConfig_entity</entity> <references> <neonViewReference> <name>f20b5358-0ec3-4695-92d5-17028383a823</name> diff --git a/neonView/DuplicateEdit_view/DuplicateEdit_view.aod b/neonView/DuplicateEdit_view/DuplicateEdit_view.aod index 4d905f4fcf..c4b6d39fd2 100644 --- a/neonView/DuplicateEdit_view/DuplicateEdit_view.aod +++ b/neonView/DuplicateEdit_view/DuplicateEdit_view.aod @@ -4,9 +4,9 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <isSmall v="false" /> <layout> - <noneLayout> + <boxLayout> <name>layout</name> - </noneLayout> + </boxLayout> </layout> <children> <genericMultipleViewTemplate> diff --git a/neonView/DuplicateScanEdit_view/DuplicateScanEdit_view.aod b/neonView/DuplicateScannerEdit_view/DuplicateScannerEdit_view.aod similarity index 76% rename from neonView/DuplicateScanEdit_view/DuplicateScanEdit_view.aod rename to neonView/DuplicateScannerEdit_view/DuplicateScannerEdit_view.aod index 915d080318..4489a6e8a0 100644 --- a/neonView/DuplicateScanEdit_view/DuplicateScanEdit_view.aod +++ b/neonView/DuplicateScannerEdit_view/DuplicateScannerEdit_view.aod @@ -1,10 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>DuplicateScanEdit_view</name> + <name>DuplicateScannerEdit_view</name> <majorModelMode>DISTRIBUTED</majorModelMode> <layout> <boxLayout> <name>layout</name> + <maxDirectionElements v="3" /> + <autoHeight v="false" /> </boxLayout> </layout> <children> @@ -29,8 +31,13 @@ </genericViewTemplate> <neonViewReference> <name>bd267f54-084a-4284-8c83-924115c5f1d2</name> - <entityField>ScanConditionConfigs_Consumer</entityField> + <entityField>ScannerPrefilterConfigs_Consumer</entityField> <view>DuplicateEdit_view</view> </neonViewReference> + <neonViewReference> + <name>94a33f54-6bea-4ec7-8bcf-2763f471cbe3</name> + <entityField>ScannerIndexConfigs_Consumer</entityField> + <view>DuplicateScannerIndexConfigEdit_view</view> + </neonViewReference> </children> </neonView> diff --git a/neonView/DuplicateScanFilter_view/DuplicateScanFilter_view.aod b/neonView/DuplicateScannerFilter_view/DuplicateScannerFilter_view.aod similarity index 96% rename from neonView/DuplicateScanFilter_view/DuplicateScanFilter_view.aod rename to neonView/DuplicateScannerFilter_view/DuplicateScannerFilter_view.aod index a8949f6916..cd44bd1be4 100644 --- a/neonView/DuplicateScanFilter_view/DuplicateScanFilter_view.aod +++ b/neonView/DuplicateScannerFilter_view/DuplicateScannerFilter_view.aod @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>DuplicateScanFilter_view</name> + <name>DuplicateScannerFilter_view</name> <majorModelMode>DISTRIBUTED</majorModelMode> <layout> <boxLayout> diff --git a/neonView/DuplicateScannerIndexConfigEdit_view/DuplicateScannerIndexConfigEdit_view.aod b/neonView/DuplicateScannerIndexConfigEdit_view/DuplicateScannerIndexConfigEdit_view.aod new file mode 100644 index 0000000000..bcb3d22f06 --- /dev/null +++ b/neonView/DuplicateScannerIndexConfigEdit_view/DuplicateScannerIndexConfigEdit_view.aod @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>DuplicateScannerIndexConfigEdit_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericMultipleViewTemplate> + <name>EntityFieldsConfig</name> + <autoNewRow v="true" /> + <entityField>#ENTITY</entityField> + <columns> + <neonTableColumn> + <name>db56e501-a380-45bb-9d9d-530fb3c5f128</name> + <entityField>TARGET_CONTEXT</entityField> + </neonTableColumn> + <neonTableColumn> + <name>29df7f7b-b929-422f-8c6c-540669928687</name> + <entityField>ENTITY_FIELD_NAME</entityField> + </neonTableColumn> + </columns> + </genericMultipleViewTemplate> + </children> +</neonView> diff --git a/neonView/DuplicateScanPreview_view/DuplicateScanPreview_view.aod b/neonView/DuplicateScannerPreview_view/DuplicateScannerPreview_view.aod similarity index 91% rename from neonView/DuplicateScanPreview_view/DuplicateScanPreview_view.aod rename to neonView/DuplicateScannerPreview_view/DuplicateScannerPreview_view.aod index e8e37d35af..acc5485240 100644 --- a/neonView/DuplicateScanPreview_view/DuplicateScanPreview_view.aod +++ b/neonView/DuplicateScannerPreview_view/DuplicateScannerPreview_view.aod @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>DuplicateScanPreview_view</name> + <name>DuplicateScannerPreview_view</name> <majorModelMode>DISTRIBUTED</majorModelMode> <layout> <noneLayout> @@ -29,7 +29,7 @@ </genericViewTemplate> <neonViewReference> <name>16a22309-3957-4d13-95b6-958a2cfe95bb</name> - <entityField>ScanConditionConfigs_Consumer</entityField> + <entityField>ScannerPrefilterConfigs_Consumer</entityField> <view>DuplicateEdit_view</view> </neonViewReference> </children> diff --git a/process/DuplicateScanner_lib/process.js b/process/DuplicateScanner_lib/process.js index 9c5e31aa66..ed72fbe48e 100644 --- a/process/DuplicateScanner_lib/process.js +++ b/process/DuplicateScanner_lib/process.js @@ -15,6 +15,16 @@ import("Sql_lib"); */ function DuplicateScannerUtils() {} +//todo remove +DuplicateScannerUtils.loadFilters = function(pFilterName, pTargetEntity) +{ + let query = "select \"CONDITION\", COUNT_CHARACTERS_TO_USE, MAX_RESULTS_THRESHOLD from DUPLICATESCANNERPREFILTERCONFIG" + + " join DUPLICATESCANNER on DUPLICATESCANNER.ID = DUPLICATESCANNERPREFILTERCONFIG.DUPLICATESCANNER_ID" + + " where FILTER_NAME = '" + pFilterName + "'" + + " and ENTITY_TO_SCAN_NAME = '" + pTargetEntity + "'"; + return db.table(query); +} + DuplicateScannerUtils.ScanForDuplicates = function(pFilterName, pTargetEntity, pFilterValues, pTargetEntityResultFields, pRecordIdFieldToIgnore, pRecordIdValueToIgnore) { @@ -23,6 +33,12 @@ pTargetEntityResultFields, pRecordIdFieldToIgnore, pRecordIdValueToIgnore) configuredFilters = [ignoredRecordFilter].concat(configuredFilters); +//Wenn externer Service genutzt wird +// applyPreFilterOnly +// Umwandeln in WS Format +// WS die Daten schicken +//Wenn interne Dublettenermittlung genutzt werden soll +// let possibleDuplicates = _DuplicateScannerUtils._applyPreFilter(pTargetEntity, configuredFilters, pTargetEntityResultFields, pFilterValues); @@ -68,7 +84,7 @@ DuplicateScannerUtils.DeleteCachedDuplicate = function(pDuplicateId) } /* - * Deletes all CLusters for the given target Entity. + * Deletes all Clusters for the given target Entity. * No records markes as unrelated duplicate are being deleted. * * @return Count of deleted rows @@ -203,29 +219,130 @@ DuplicateScannerUtils.GetCachedDuplicatesForId = function(pClusterRecordId) return db.array(db.COLUMN, query); } -//Später mal eigentsändiger Serverprozess ohne externe Konfiguration +/* + * Recreates the cached duplicate clusters based on the configured filters. + * The old clusters have to be deleted manually beforehand using "DeleteDuplicateClustersByTargetEntity". + * If there have already been ignored relations between duplicate records, it's advised to call "RefreshUnrelatedDuplicateRelations" after the recreation of the duplicates cache. + * + * @param {String} pFilterName Name of the filter to use + * @param {String} pTargetEntity The target entity which has been assigned to the filters configuration + * @param {String} pQueryTargetRecords Query which holds the values that are being used as configured in the filter. + * Important: The first element has to be the id field! + * @param {String[]} pFilterFields Array of fields used in the filter. The first element has to be the id field. Afterswards the same field in the identical order as defined in the parameter "pQueryTargetRecords" + * @param {String} pRecordIdFieldToIgnore Name of the id field. Has to be equal to the first field in the parameters "pFilterFields" and "pQueryTargetRecords" + * + * @return {Int} Count of duplicate clusters created + * + * @example + * filterName = "OrganisationDuplicates";<br /> + * targetEntity = "Organisation_entity";<br /> + * resultFieldsIdFieldName = "CONTACTID";<br /> + * queryPersonContactIds = "select CONTACTID, ORGANISATION.\"NAME\" from ORGANISATION"<br /> + * + " join CONTACT on CONTACT.CONTACTID = ORGANISATION.ORGANISATIONID"<br /> + * + " where CONTACTID != '0'";<br /> + * tmpFieldsInFilterRay = ["CONTACTID", "NAME"];<br /> + * <br /> + * DuplicateScannerUtils.DeleteDuplicateClustersByTargetEntity(targetEntity)<br /> + * <br /> + * DuplicateScannerUtils.RebuildDuplicatesCache(filterName, targetEntity, queryPersonContactIds,<br /> + * tmpFieldsInFilterRay, resultFieldsIdFieldName);<br /> + * <br /> + * DuplicateScannerUtils.RefreshUnrelatedDuplicateRelations(targetEntity);<br /> + */ DuplicateScannerUtils.RebuildDuplicatesCache = function(pFilterName, pTargetEntity, pQueryTargetRecords, pFilterFields, pRecordIdFieldToIgnore) -{ -// process.execute("buildSerialLetter_serverProcess", { -// "serialLetterId" : pSerialLetterId, -// "recipientIds" : JSON.stringify(pRecipientIds) -// }); - +{ logging.log("in RebuildDuplicatesCache -> "); let alreadyIdentifiedIds = []; let contactIdsToScan = db.table(pQueryTargetRecords); logging.log("contactIdsToScan -> " + JSON.stringify(contactIdsToScan)); - //If the contact id loader query results in no ids, stop. + //If the contact id loading query has no results, stop. //No ids should be deleted if an error has been made in this query. if(contactIdsToScan.length <= 0) return; - - //todo woanders löschen - //_DuplicateScannerUtils._deleteDuplicateClusters(); + /* + * First it gets checked if the current id has already been identified. If that's the case it'll continue with the next. + * Otherwise an object gets build in the form of ["FilterFieldName" = "FilterFieldValueFromQuery"] with which a scan for possible duplicates get's started + */ + var duplicatesToInsertQueries = []; + for (b = 0; b < contactIdsToScan.length; b++) + { + logging.log("b -> " + b); + logging.log("indexOf(contactIdsToScan[b] -> " + alreadyIdentifiedIds.indexOf(contactIdsToScan[b])); + + //If the current Id has already been identified, continue + if(alreadyIdentifiedIds.indexOf(contactIdsToScan[b][0]) > -1) + continue; + logging.log("contactid noch nicht bearbeitet -> " + contactIdsToScan[b][0]); + + let filterValuesObject = {}; + + /* + * Based on the parameterized filter field names and the values loaded via the query, an object in the style of ["FilterFieldName" = "FilterFieldValueFromQuery"] + * gets created. This mandatory to run the scan for this record. + */ + for (a = 0; a < pFilterFields.length; a++) + { + logging.log("pFilterValues[a] -> " + pFilterFields[a]); + logging.log("contactIdsToScan[i][a] -> " + contactIdsToScan[b][a]); + + filterValuesObject[pFilterFields[a]] = contactIdsToScan[b][a]; + + logging.log("filterValuesObject[pFilterValues[a]] -> " + filterValuesObject[pFilterFields[a]]); + } + + logging.log("filterValuesObject -> " + JSON.stringify(filterValuesObject)); + + let foundDuplicates = DuplicateScannerUtils.ScanForDuplicates(pFilterName, pTargetEntity, + filterValuesObject, [pRecordIdFieldToIgnore], pRecordIdFieldToIgnore, contactIdsToScan[b][0]) + + logging.log("foundDuplicates -> " + JSON.stringify(foundDuplicates)); + if(foundDuplicates.length == 0) + continue; + + + //Insert all found duplicate ids into an cache array because those ids don't have to be checked again lateron. + let foundDuplicateIds = []; + for (let i = 0; i < foundDuplicates.length; i++) + { + logging.log("i -> " + i); + logging.log("foundDuplicates[pRecordIdFieldToIgnore] -> " + foundDuplicates[i][pRecordIdFieldToIgnore]); + foundDuplicateIds.push(foundDuplicates[i][pRecordIdFieldToIgnore]); + } + + alreadyIdentifiedIds = alreadyIdentifiedIds.concat(foundDuplicateIds); + + //The duplicates list contains only the found duplicates to the original id, therefore it get's added manually + foundDuplicateIds.push(contactIdsToScan[b][0]); + logging.log("foundDuplicates -> " + JSON.stringify(foundDuplicates)); + logging.log("foundDuplicateIds -> " + JSON.stringify(foundDuplicateIds)); + + let insertQueriesRay = _DuplicateScannerUtils._createInsertDuplicatesClusterQuery(foundDuplicateIds, pTargetEntity) + duplicatesToInsertQueries = duplicatesToInsertQueries.concat(insertQueriesRay); + } + logging.log("duplicatesToInsertQueries -> " + JSON.stringify(duplicatesToInsertQueries)); + return db.inserts(duplicatesToInsertQueries); +} + +DuplicateScannerUtils.RebuildDuplicatesCacheIndex = function(pFilterName, pTargetEntity, +pQueryTargetRecords, pFilterFields, pRecordIdFieldToIgnore) +{ + logging.log("in RebuildDuplicatesCache -> "); + let alreadyIdentifiedIds = []; + let contactIdsToScan = db.table(pQueryTargetRecords); + logging.log("contactIdsToScan -> " + JSON.stringify(contactIdsToScan)); + //If the contact id loading query has no results, stop. + //No ids should be deleted if an error has been made in this query. + if(contactIdsToScan.length <= 0) + return; + + /* + * First it gets checked if the current id has already been identified. If that's the case it'll continue with the next. + * Otherwise an object gets build in the form of ["FilterFieldName" = "FilterFieldValueFromQuery"] with which a scan for possible duplicates get's started + */ var duplicatesToInsertQueries = []; for (b = 0; b < contactIdsToScan.length; b++) { @@ -239,6 +356,10 @@ pQueryTargetRecords, pFilterFields, pRecordIdFieldToIgnore) let filterValuesObject = {}; + /* + * Based on the parameterized filter field names and the values loaded via the query, an object in the style of ["FilterFieldName" = "FilterFieldValueFromQuery"] + * gets created. This mandatory to run the scan for this record. + */ for (a = 0; a < pFilterFields.length; a++) { logging.log("pFilterValues[a] -> " + pFilterFields[a]); @@ -258,6 +379,8 @@ pQueryTargetRecords, pFilterFields, pRecordIdFieldToIgnore) if(foundDuplicates.length == 0) continue; + + //Insert all found duplicate ids into an cache array because those ids don't have to be checked again lateron. let foundDuplicateIds = []; for (let i = 0; i < foundDuplicates.length; i++) { @@ -268,7 +391,7 @@ pQueryTargetRecords, pFilterFields, pRecordIdFieldToIgnore) alreadyIdentifiedIds = alreadyIdentifiedIds.concat(foundDuplicateIds); - //The duplicates list doesn't contain the id which was tested for, therefore it get's added manually + //The duplicates list contains only the found duplicates to the original id, therefore it get's added manually foundDuplicateIds.push(contactIdsToScan[b][0]); logging.log("foundDuplicates -> " + JSON.stringify(foundDuplicates)); logging.log("foundDuplicateIds -> " + JSON.stringify(foundDuplicateIds)); @@ -277,9 +400,118 @@ pQueryTargetRecords, pFilterFields, pRecordIdFieldToIgnore) duplicatesToInsertQueries = duplicatesToInsertQueries.concat(insertQueriesRay); } logging.log("duplicatesToInsertQueries -> " + JSON.stringify(duplicatesToInsertQueries)); - db.inserts(duplicatesToInsertQueries); + return db.inserts(duplicatesToInsertQueries); } +DuplicateScannerUtils.ScanForDuplicatesIndex = function(pFilterName, pTargetEntity, pFilterValues, +pTargetEntityResultFields, pRecordIdFieldToIgnore, pRecordIdValueToIgnore) +{ + let ignoredRecordFilter = _DuplicateScannerUtils._getIgnoreRecordFilter(pRecordIdFieldToIgnore, pRecordIdValueToIgnore, pTargetEntity); + let configuredFilters = _DuplicateScannerUtils._loadFilters(pFilterName, pTargetEntity); + + configuredFilters = [ignoredRecordFilter].concat(configuredFilters); + + + let possibleDuplicates = _DuplicateScannerUtils._applyPreFilterIndex(pTargetEntity, configuredFilters, pTargetEntityResultFields, pFilterValues); + + + + return possibleDuplicates; +} + +DuplicateScannerUtils._applyPreFilterIndex = function(pTargetEntity, pFilterCountCharactersToUseRay, pTargetEntityResultFields, pFilterValues) +{ + var combinedFilter = {}; + + for (i = 0; i < pFilterCountCharactersToUseRay.length; i++) + { + let filter = pFilterCountCharactersToUseRay[i][INDEX_FILTER_CONDITION]; + let countCharsOfValueToUse = pFilterCountCharactersToUseRay[i][INDEX_COUNT_CHARS_TO_USE]; + let maxResultsThreshold = pFilterCountCharactersToUseRay[i][INDEX_MAX_RESULTS_THRESHOLD]; + + if(filter == null || filter == "") + continue; + logging.log("complete filter -> " + filter); + filter = JSON.parse(filter).filter; + + logging.log("countCharsOfValueToUse -> " + countCharsOfValueToUse); + logging.log("maxResultsThreshold -> " + maxResultsThreshold); + /* + * Insert the values into the current filter. Has to be here so that only the new filter + * and therefore the combinedFilter incrementally gets filled and not always everything multiple times. + */ + filter.childs = _DuplicateScannerUtils._insertValuesInFilterTemplate(filter.childs, pFilterValues, countCharsOfValueToUse); + logging.log("gefüllter filter -> " + JSON.stringify(filter.childs)); + + + + if(i == 0) + combinedFilter = filter; + else + { + logging.log("aktueller combinedFilter -> " + JSON.stringify(combinedFilter)); + + //Extend the current combined filter with the next filter condition to further refine the results + //It seems to always contain one child element at the root + combinedFilter.childs.push(filter.childs[0]); + } + + logging.log("combinedFilter + gefüllter filter -> " + JSON.stringify(combinedFilter)); + +// let loadRowsConfig = entities.createConfigForLoadingRows() +// .entity(pTargetEntity) +// .filter(JSON.stringify(combinedFilter)); +// +// let rowCount = entities.getRowCount(loadRowsConfig); + + //Vorfilter +// var patternConf = indexsearch.createPatternConfig() +// .or(umwandeln gefüllter filter in pattern); + + + logging.log("rowCount -> " + rowCount); + + if(rowCount > maxResultsThreshold) + { + logging.log("zu viele rows gefundenn nächsten Filter anwenden -> rowCount:" + rowCount + " maxResultsThreshold:" + maxResultsThreshold); + //Found more rows than allowed by the threshold, run next filter to narrow the results + continue; + } + else if(rowCount <= 0) + { + return []; + } + else + { + //we're in the treshold, return the data + + loadRowsConfig = loadRowsConfig.fields(pTargetEntityResultFields); + + let resultRows = entities.getRows(loadRowsConfig); + + return resultRows; + } + } + logging.log("zu viele rows und keine filter mehr -> "); + return []; +} + + + + + + + + + + + + + + + + + DuplicateScannerUtils.MergePerson = function(pSourceContactId, pTargetContactId) @@ -295,8 +527,6 @@ DuplicateScannerUtils.MergePerson = function(pSourceContactId, pTargetContactId) updateStatementsCurrentAlias = updateStatementsCurrentAlias.concat(_DuplicateScannerUtils._buildUpdateContactIdStatements(tableInfosCurrentAlias, pSourceContactId, pTargetContactId)); updateStatementsCurrentAlias = updateStatementsCurrentAlias.concat(_DuplicateScannerUtils._buildUpdateAttachParticipantsToNewContactQuery("CAMPAIGNPARTICIPANT", "CONTACT_ID", "CAMPAIGN_ID", pSourceContactId, pTargetContactId)); - updateStatementsCurrentAlias = updateStatementsCurrentAlias.concat(_DuplicateScannerUtils._buildUpdateContactIdStatements(tableInfosCurrentAlias, pSourceContactId, pTargetContactId)); - updateStatementsSystemAlias = updateStatementsSystemAlias.concat(_DuplicateScannerUtils._buildUpdateContactIdStatements(tableInfosSystemAlias, pSourceContactId, pTargetContactId)); deleteStatements = deleteStatements.concat(_DuplicateScannerUtils._buildDeleteRemoveObsoleteParticipantsRecordsQuery("CAMPAIGNPARTICIPANT", "CONTACT_ID", "CAMPAIGN_ID", pSourceContactId, pTargetContactId)); @@ -328,23 +558,31 @@ DuplicateScannerUtils.MergeOrganisation = function(pSourceContactId, pTargetCont .buildSql("select ORGANISATION_ID from CONTACT"); var sourceOrganisationId = db.cell(querySourceOrganisationId); - var tableInfos = _DuplicateScannerUtils._getMergeUpdateTableInfos(); - - updateStatements = updateStatements.concat(_DuplicateScannerUtils._buildUpdateContactIdStatements(tableInfos, pSourceContactId, pTargetContactId)); - updateStatements = updateStatements.concat(_DuplicateScannerUtils._buildUpdateAttachParticipantsToNewContactQuery("CAMPAIGNPARTICIPANT", "CONTACT_ID", "CAMPAIGN_ID", pSourceContactId, pTargetContactId)); + var tableInfosCurrentAlias = _DuplicateScannerUtils._getMergeUpdateTableInfosCurrentAlias(); + var tableInfosSystemAlias = _DuplicateScannerUtils._getMergeUpdateTableInfosSystemAlias(); + + updateStatementsCurrentAlias = updateStatementsCurrentAlias.concat(_DuplicateScannerUtils._buildUpdateContactIdStatements(tableInfosCurrentAlias, pSourceContactId, pTargetContactId)); + updateStatementsCurrentAlias = updateStatementsCurrentAlias.concat(_DuplicateScannerUtils._buildUpdateAttachParticipantsToNewContactQuery("CAMPAIGNPARTICIPANT", "CONTACT_ID", "CAMPAIGN_ID", pSourceContactId, pTargetContactId)); + + updateStatementsSystemAlias = updateStatementsSystemAlias.concat(_DuplicateScannerUtils._buildUpdateContactIdStatements(tableInfosSystemAlias, pSourceContactId, pTargetContactId)); deleteStatements = deleteStatements.concat(_DuplicateScannerUtils._buildDeleteRemoveObsoleteParticipantsRecordsQuery("CAMPAIGNPARTICIPANT", "CONTACT_ID", "CAMPAIGN_ID", pSourceContactId, pTargetContactId)); deleteStatements = deleteStatements.concat(_DuplicateScannerUtils._buildDeleteOrganisationAndContactQuery(sourceOrganisationId, pSourceContactId)); deleteStatements = deleteStatements.concat(_DuplicateScannerUtils._buildDeleteCachedUnrelatedDuplicateQuery(pSourceContactId)); - - logging.log("updateStatements -> " + JSON.stringify(updateStatements)); + + logging.log("updateStatementsCurrentAlias -> " + JSON.stringify(updateStatementsCurrentAlias)); logging.log("deleteStatements -> " + JSON.stringify(deleteStatements)); - //let affectedRows = db.updates(updateStatements); - //let deletedRows = db.deletes(deleteStatements) + + let affectedRowsCurrentAlias = db.updates(updateStatementsCurrentAlias); + let affectedRowsSystemAlias = db.updates(updateStatementsSystemAlias, "_____SYSTEMALIAS"); + let deletedRows = db.deletes(deleteStatements) + + logging.log("affectedRowsCurrentAlias -> " + affectedRowsCurrentAlias); + logging.log("deletedRows -> " + deletedRows); DuplicateScannerUtils.DeleteCachedDuplicate(pSourceContactId); - return true;//(affectedRows > 0 && deletedRows >= 2); + return (affectedRowsCurrentAlias > 0 && deletedRows >= 2); } function _DuplicateScannerUtils() {} @@ -639,8 +877,8 @@ _DuplicateScannerUtils._getExternalServiceConfiguration = function(pFormattedJso _DuplicateScannerUtils._loadFilters = function(pFilterName, pTargetEntity) { - let query = "select \"CONDITION\", COUNT_CHARACTERS_TO_USE, MAX_RESULTS_THRESHOLD from DUPLICATESCANCONDITIONCONFIG" - + " join DUPLICATESCANNER on DUPLICATESCANNER.ID = DUPLICATESCANCONDITIONCONFIG.DUPLICATESCAN_ID" + let query = "select \"CONDITION\", COUNT_CHARACTERS_TO_USE, MAX_RESULTS_THRESHOLD from DUPLICATESCANNERPREFILTERCONFIG" + + " join DUPLICATESCANNER on DUPLICATESCANNER.ID = DUPLICATESCANNERPREFILTERCONFIG.DUPLICATESCANNER_ID" + " where FILTER_NAME = '" + pFilterName + "'" + " and ENTITY_TO_SCAN_NAME = '" + pTargetEntity + "'"; return db.table(query); diff --git a/process/JditoFilter_lib/process.js b/process/JditoFilter_lib/process.js index 077e6c10ae..67875ce891 100644 --- a/process/JditoFilter_lib/process.js +++ b/process/JditoFilter_lib/process.js @@ -103,6 +103,26 @@ JditoFilterHelper.prototype.checkRecord = function (pRow) */ function JditoFilterUtils () {} +JditoFilterUtils.getFilterFields = function (pFilterJsonRootNode) +{ + let filterFields = []; + for(var filterChildNode in pFilterJsonRootNode) + { + var currentNode = pJsonRootNode[filterChildNode]; + + if(currentNode.type == "row") + { + let fieldName = currentNode.name; + filterFields.push(fieldName); + } + else + { + JditoFilterUtils.getFilterFields(filterChildNode); + } + } + return filterFields; +} + /** * Filters the given records manually. If you get the records using a sql query, you might consider using * JditoFilterUtils.getSqlCondition instead for better performance. diff --git a/process/RebuildDuplicatesCache_serverProcess/process.js b/process/RebuildDuplicatesCache_serverProcess/process.js index c8efbfd89c..74346c3308 100644 --- a/process/RebuildDuplicatesCache_serverProcess/process.js +++ b/process/RebuildDuplicatesCache_serverProcess/process.js @@ -2,16 +2,16 @@ import("DuplicateScanner_lib"); /* * Serverprocess to reload duplicates - * It is dividede by the filter and their respective target entities. * * Step #1: * All Clusters for the specified targetEntity are deleted. - * Relations between records marked as unrelated are not deleted at this moment + * Relations between records marked as unrelated are not deleted at this time + * * Step #2 * The duplicates cache gets rebuilt * * Step #3: - * All unrelated relations between duplicate ids hold their respective cluster id + * All unrelated relations between duplicate ids hold their respective cluster id. * If the same combination of duplicate ids exists in the duplicate cache after the rebuild, * it is assumed that those records remain duplicates. * Therefore the saved clusterId gets refreshed with the newly created clusters id. -- GitLab