diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod index b66a7a2379c66d01e97228531d4cb7bde61490a5..76cce88c0219c362a252c8d088b605176ad6134a 100644 --- a/entity/Organisation_entity/Organisation_entity.aod +++ b/entity/Organisation_entity/Organisation_entity.aod @@ -914,28 +914,6 @@ <name>SelfDuplicatesProvider</name> <titlePlural>Duplicates</titlePlural> </entityProvider> - <entityConsumer> - <name>SelfDuplicatesConsumer</name> - <dependency> - <name>dependency</name> - <entityName>Organisation_entity</entityName> - <fieldName>SelfDuplicatesProvider</fieldName> - </dependency> - <children> - <entityParameter> - <name>OnlyShowContactIds_param</name> - <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/selfduplicatesconsumer/children/onlyshowcontactids_param/valueProcess.js</valueProcess> - </entityParameter> - <entityParameter> - <name>DuplicateCurrentContactId_param</name> - <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/selfduplicatesconsumer/children/duplicatecurrentcontactid_param/valueProcess.js</valueProcess> - </entityParameter> - <entityParameter> - <name>DuplicateActionsControl_param</name> - <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/selfduplicatesconsumer/children/duplicateactionscontrol_param/valueProcess.js</valueProcess> - </entityParameter> - </children> - </entityConsumer> <entityParameter> <name>OnlyShowContactIds_param</name> <expose v="true" /> diff --git a/entity/Organisation_entity/entityfields/selfduplicatesconsumer/children/duplicateactionscontrol_param/valueProcess.js b/entity/Organisation_entity/entityfields/selfduplicatesconsumer/children/duplicateactionscontrol_param/valueProcess.js deleted file mode 100644 index 81570217c3ecd3cf76deb5e14d7ac0a6121a59bb..0000000000000000000000000000000000000000 --- a/entity/Organisation_entity/entityfields/selfduplicatesconsumer/children/duplicateactionscontrol_param/valueProcess.js +++ /dev/null @@ -1,2 +0,0 @@ -import("system.result"); -result.string("1");//todo use keyword \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/selfduplicatesconsumer/children/duplicatecurrentcontactid_param/valueProcess.js b/entity/Organisation_entity/entityfields/selfduplicatesconsumer/children/duplicatecurrentcontactid_param/valueProcess.js deleted file mode 100644 index 821415ae694dd9c3d98a7703f4c59b81a37f524b..0000000000000000000000000000000000000000 --- a/entity/Organisation_entity/entityfields/selfduplicatesconsumer/children/duplicatecurrentcontactid_param/valueProcess.js +++ /dev/null @@ -1,3 +0,0 @@ -import("system.vars"); -import("system.result"); -result.string(vars.get("$field.CONTACTID")); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/selfduplicatesconsumer/children/onlyshowcontactids_param/valueProcess.js b/entity/Organisation_entity/entityfields/selfduplicatesconsumer/children/onlyshowcontactids_param/valueProcess.js deleted file mode 100644 index fa8ef63877b8454ebeb9a6637aed6e3866399771..0000000000000000000000000000000000000000 --- a/entity/Organisation_entity/entityfields/selfduplicatesconsumer/children/onlyshowcontactids_param/valueProcess.js +++ /dev/null @@ -1,18 +0,0 @@ -import("system.logging"); -import("system.vars"); -import("DuplicateScanner_lib"); -import("system.result"); - -let contactIdToCheck = vars.get("$field.CONTACTID"); - -let duplicateIds = DuplicateScannerUtils.GetCachedDuplicatesForDuplicateId(contactIdToCheck); - -/* - * To achieve that if there are no duplicates, no contacts should be shown and therefore returned by the - * recordcontainer, an invalid id gets returned. It then is used in the conditionProcess to load the duplicates. - * Because of its invalidity, no records are shown. -*/ -if(duplicateIds.length == 0) - result.string(JSON.stringify(["nodata"])); -else - result.string(JSON.stringify(duplicateIds)); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js b/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js index f3168178a395fee73c7e5c839b56f864da612686..4024668e40db9cb823c5beacc015904e2ab73d68 100644 --- a/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js +++ b/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js @@ -5,29 +5,30 @@ import("system.vars"); import("DuplicateScanner_lib"); import("system.result"); +let scannerName = "OrganisationDuplicates"; let targetEntity = "Organisation_entity"; let valuesToCheck = {}; -var entityModel = project.getEntityStructure(targetEntity); +var entityFieldsToLoad = DuplicateScannerUtils.GetEntityFieldsFromConfig(scannerName, targetEntity); +//project.getEntityStructure(targetEntity); - //Read the values of all available entity fields and write the fieldname/value combination + //Read the values of all available entity fields and write the fieldname7value combination //as key/value pairs into an object. This is used to trigger the scan for duplicates let fieldValue = ""; let entityFields = []; -for (fieldname in entityModel.fields) +for (fieldname in entityFieldsToLoad) { - field = entityModel.fields[fieldname]; - if(field.fieldType == project.ENTITYFIELDTYPE_FIELD) + field = entityFieldsToLoad[fieldname]; + fieldValue = vars.get("$field." + field.name); + + if(fieldValue != null && fieldValue != "") { - fieldValue = vars.get("$field." + field.name); - - if(fieldValue != null && fieldValue != "") - { - valuesToCheck[field.name] = fieldValue; - } + valuesToCheck[field.name] = fieldValue; } } -let scanResults = DuplicateScannerUtils.ScanForDuplicates("OrganisationDuplicates", targetEntity, + +let scanResults = DuplicateScannerUtils.ScanForDuplicates(scannerName, targetEntity, valuesToCheck, null); + let duplicateIds = []; if(scanResults != undefined && scanResults != null) diff --git a/entity/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod index 2934d745218c46ac0b18e3db3733727c19c373a7..5796e1ce02ae3b170a66610f3319caa6160c6f8a 100644 --- a/entity/Person_entity/Person_entity.aod +++ b/entity/Person_entity/Person_entity.aod @@ -999,28 +999,6 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact <name>OnlyShowContactIds_param</name> <expose v="true" /> </entityParameter> - <entityConsumer> - <name>SelfDuplicates</name> - <dependency> - <name>dependency</name> - <entityName>Person_entity</entityName> - <fieldName>SelfDuplicatesProvider</fieldName> - </dependency> - <children> - <entityParameter> - <name>OnlyShowContactIds_param</name> - <valueProcess>%aditoprj%/entity/Person_entity/entityfields/selfduplicates/children/onlyshowcontactids_param/valueProcess.js</valueProcess> - </entityParameter> - <entityParameter> - <name>DuplicateCurrentContactId_param</name> - <valueProcess>%aditoprj%/entity/Person_entity/entityfields/selfduplicates/children/duplicatecurrentcontactid_param/valueProcess.js</valueProcess> - </entityParameter> - <entityParameter> - <name>DuplicateActionsControl_param</name> - <valueProcess>%aditoprj%/entity/Person_entity/entityfields/selfduplicates/children/duplicateactionscontrol_param/valueProcess.js</valueProcess> - </entityParameter> - </children> - </entityConsumer> <entityProvider> <name>SelfDuplicatesProvider</name> <titlePlural>Duplicates</titlePlural> diff --git a/entity/Person_entity/entityfields/selfduplicates/children/duplicateactionscontrol_param/valueProcess.js b/entity/Person_entity/entityfields/selfduplicates/children/duplicateactionscontrol_param/valueProcess.js deleted file mode 100644 index 81570217c3ecd3cf76deb5e14d7ac0a6121a59bb..0000000000000000000000000000000000000000 --- a/entity/Person_entity/entityfields/selfduplicates/children/duplicateactionscontrol_param/valueProcess.js +++ /dev/null @@ -1,2 +0,0 @@ -import("system.result"); -result.string("1");//todo use keyword \ No newline at end of file diff --git a/entity/Person_entity/entityfields/selfduplicates/children/duplicatecurrentcontactid_param/valueProcess.js b/entity/Person_entity/entityfields/selfduplicates/children/duplicatecurrentcontactid_param/valueProcess.js deleted file mode 100644 index 821415ae694dd9c3d98a7703f4c59b81a37f524b..0000000000000000000000000000000000000000 --- a/entity/Person_entity/entityfields/selfduplicates/children/duplicatecurrentcontactid_param/valueProcess.js +++ /dev/null @@ -1,3 +0,0 @@ -import("system.vars"); -import("system.result"); -result.string(vars.get("$field.CONTACTID")); \ No newline at end of file diff --git a/entity/Person_entity/entityfields/selfduplicates/children/onlyshowcontactids_param/valueProcess.js b/entity/Person_entity/entityfields/selfduplicates/children/onlyshowcontactids_param/valueProcess.js deleted file mode 100644 index fa8ef63877b8454ebeb9a6637aed6e3866399771..0000000000000000000000000000000000000000 --- a/entity/Person_entity/entityfields/selfduplicates/children/onlyshowcontactids_param/valueProcess.js +++ /dev/null @@ -1,18 +0,0 @@ -import("system.logging"); -import("system.vars"); -import("DuplicateScanner_lib"); -import("system.result"); - -let contactIdToCheck = vars.get("$field.CONTACTID"); - -let duplicateIds = DuplicateScannerUtils.GetCachedDuplicatesForDuplicateId(contactIdToCheck); - -/* - * To achieve that if there are no duplicates, no contacts should be shown and therefore returned by the - * recordcontainer, an invalid id gets returned. It then is used in the conditionProcess to load the duplicates. - * Because of its invalidity, no records are shown. -*/ -if(duplicateIds.length == 0) - result.string(JSON.stringify(["nodata"])); -else - result.string(JSON.stringify(duplicateIds)); \ No newline at end of file diff --git a/entity/Person_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js b/entity/Person_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js index 476e86c009a244b49af87c73fc1caa006972b953..b352b88a57f806f0d1448f6166bf278ce25aecab 100644 --- a/entity/Person_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js +++ b/entity/Person_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js @@ -5,31 +5,28 @@ import("system.vars"); import("DuplicateScanner_lib"); import("system.result"); +let scannerName = "PersonDuplicates"; let targetEntity = "Person_entity"; let valuesToCheck = {}; -var entityModel = project.getEntityStructure(targetEntity); +var entityFieldsToLoad = DuplicateScannerUtils.GetEntityFieldsFromConfig(scannerName, targetEntity); +//project.getEntityStructure(targetEntity); //Read the values of all available entity fields and write the fieldname7value combination //as key/value pairs into an object. This is used to trigger the scan for duplicates let fieldValue = ""; let entityFields = []; -for (fieldname in entityModel.fields) +for (fieldname in entityFieldsToLoad) { - field = entityModel.fields[fieldname]; - if(field.fieldType == project.ENTITYFIELDTYPE_FIELD) + field = entityFieldsToLoad[fieldname]; + fieldValue = vars.get("$field." + field.name); + + if(fieldValue != null && fieldValue != "") { - fieldValue = vars.get("$field." + field.name); - - if(fieldValue != null && fieldValue != "") - { -// logging.log("field.name -> " + field.name); - valuesToCheck[field.name] = fieldValue; -// logging.log("field value -> " + fieldValue); - } + valuesToCheck[field.name] = fieldValue; } } -let scanResults = DuplicateScannerUtils.ScanForDuplicates("PersonDuplicates", targetEntity, +let scanResults = DuplicateScannerUtils.ScanForDuplicates(scannerName, targetEntity, valuesToCheck, null); let duplicateIds = []; diff --git a/neonView/OrganisationMain_view/OrganisationMain_view.aod b/neonView/OrganisationMain_view/OrganisationMain_view.aod index 8e505480355e6d9286fcc1e46d518e5d09b9793d..db111a376598e9fdd5ee4ac5861c316aafb31bde 100644 --- a/neonView/OrganisationMain_view/OrganisationMain_view.aod +++ b/neonView/OrganisationMain_view/OrganisationMain_view.aod @@ -62,7 +62,7 @@ </neonViewReference> <neonViewReference> <name>cbac7602-9eba-4e5d-8617-3d0b33e55ca1</name> - <entityField>SelfDuplicatesConsumer</entityField> + <entityField>SelfDuplicatesUncached</entityField> <view>OrganisationFilter_view</view> </neonViewReference> </children> diff --git a/neonView/PersonMain_view/PersonMain_view.aod b/neonView/PersonMain_view/PersonMain_view.aod index 88a8e5367feae0aad33a333ab498fbbcc7c4fbd5..1c44780e94bf34189b02b24d4529f194589c7154 100644 --- a/neonView/PersonMain_view/PersonMain_view.aod +++ b/neonView/PersonMain_view/PersonMain_view.aod @@ -61,7 +61,7 @@ </neonViewReference> <neonViewReference> <name>d128a678-b1c0-49d0-a74c-7860d3a85247</name> - <entityField>SelfDuplicates</entityField> + <entityField>SelfDuplicatesUncached</entityField> <view>PersonFilter_view</view> </neonViewReference> </children> diff --git a/process/DuplicateScanner_lib/process.js b/process/DuplicateScanner_lib/process.js index 4d090a9a62257759c5e03ea1c14d05306468bb49..190b3733aa4cafb201dadfcb6e9363899430e68d 100644 --- a/process/DuplicateScanner_lib/process.js +++ b/process/DuplicateScanner_lib/process.js @@ -771,6 +771,12 @@ DuplicateScannerUtils.GetBlockSize = function() return project.getPreferenceValue("custom.duplicates.dataBlockSize", "5000"); } +DuplicateScannerUtils.GetEntityFieldsFromConfig = function(pFilterName, pTargetEntity) +{ + let indexPattern = _DuplicateScannerUtils._loadIndexPattern(pFilterName, pTargetEntity); + let fieldConfigs = _DuplicateScannerUtils._loadEntityFieldConfigsFromPattern(indexPattern); + return _DuplicateScannerUtils._loadEntityFieldsFromFieldConfigs(fieldConfigs); +} function _DuplicateScannerUtils() {}