From 0b5a5de36879ec5b9f013e3b4151a7015119312d Mon Sep 17 00:00:00 2001 From: "d.buechler" <d.buechler@adito.de> Date: Fri, 11 Oct 2019 18:16:44 +0200 Subject: [PATCH] Refactorings --- .../testduplicatescanner/onActionProcess.js | 72 ++++++++++++++----- .../recordcontainers/db/onDBInsert.js | 3 + 2 files changed, 57 insertions(+), 18 deletions(-) diff --git a/entity/DuplicateScanner_entity/entityfields/testactiongroup/children/testduplicatescanner/onActionProcess.js b/entity/DuplicateScanner_entity/entityfields/testactiongroup/children/testduplicatescanner/onActionProcess.js index a8e1b267f5..4dbfaf2907 100644 --- a/entity/DuplicateScanner_entity/entityfields/testactiongroup/children/testduplicatescanner/onActionProcess.js +++ b/entity/DuplicateScanner_entity/entityfields/testactiongroup/children/testduplicatescanner/onActionProcess.js @@ -1,3 +1,7 @@ +import("system.process"); +import("KeywordRegistry_basic"); +import("system.db"); +import("ActivityTask_lib"); import("Employee_lib"); import("system.util"); import("system.notification"); @@ -253,16 +257,16 @@ import("JditoFilter_lib"); ////The result values can be accessed as seen above in "formatToJsonAndCallWsCallback" //let pPossibleDuplicatesRay = DuplicateScannerUtils.ScanForDuplicates(filterName, targetEntity, valuesToCheck, null); // -//logging.log(" pPossibleDuplicatesRay-> " + pPossibleDuplicatesRay.length); +//logging.log(" pPossibleDuplicatesRay-> " + pPossibleDuplicatesRay); // //for (let i = 0; i < pPossibleDuplicatesRay.length; i++) //{ // logging.log("pPossibleDuplicatesRay[i] -> " + pPossibleDuplicatesRay[i]); //} +// - -//############################################################################## +//################################ entity structure auslesen ############################################## //var model = project.getEntityStructure("Person_entity"); @@ -371,26 +375,58 @@ import("JditoFilter_lib"); // //logging.log("recordBlockSize -> " + recordBlockSize); -try -{ - notification.addNotification(util.getNewUUID(), null, null, null, "_____SYSTEM_NOTIFICATION_MESSAGE", notification.PRIO_NORMAL, 1, notification.STATE_UNSEEN, [EmployeeUtils.getCurrentUserId()], "message", "description"); - -} -catch (exception) -{ - logging.log("exception -> " + exception); -} - - - -//notification.addNotification(util.getNewUUID(), null, null, null, notification., notification.PRIO_NORMAL, 2, notification.STATE_UNSEEN, [user], message, description); - - +//try +//{ +// let sourceContactId = "sourceContactId"; +// let targetContactId = "targetContactId"; +// +// var activityDataForInsert = { +// subject: "Es wurde ein Personendatensatz in diesen integriert", +// content: "Person mit ID " + sourceContactId + " wurde in Person mit ID " + targetContactId + " integriert", +// //categoryKeywordId: $KeywordRegistry.ac +// directionKeywordId: "x", +// responsibleContactId: EmployeeUtils.getCurrentContactId() +// }; +// +// var activityLinks = [["Person", "6e667085-bb97-4039-8dfe-2230002985e0"]] +// +// //activityLinks = ArrayUtils.distinct2d(activityLinks);//TODO: better check before adding the elements into the array if it already exists there +// +// var activityRes = ActivityUtils.insertNewActivity(activityDataForInsert, activityLinks, null, db.getCurrentAlias()); +//} +//catch (exception) +//{ +// logging.log("exception -> " + exception); +//} +////notification.addNotification(util.getNewUUID(), null, null, null, notification., notification.PRIO_NORMAL, 2, notification.STATE_UNSEEN, [user], message, description); +//let currentContactId = EmployeeUtils.getCurrentContactId(); +//DuplicateScannerUtils.CreateMergeSuccessActivity("a2e084e2-d68a-4f1e-a1bb-f8d46ad6293d", "6e667085-bb97-4039-8dfe-2230002985e0", currentContactId, "Person"); +//logging.log("$KeywordRegistry.activityDirection$internal() -> " + $KeywordRegistry.activityDirection$internal()); +//let processParameters = { +// filterName: "PersonDuplicates", +// targetEntity: "Person_entity" //process.execute is only able to handle strings +//} +//let userId = EmployeeUtils.getCurrentUserId(); +//if(userId == null) +// userId == ""; +//try +//{ +// let processId = "manualrun_rebuild_duplicatecache_" + util.getNewUUID(); +// process.executeTimer(processId, "RebuildAllDuplicatesCache_serverProcess", 0, true, false, process.TIMERTYPE_SERVER_RUN, userId, false, process.THREADPRIORITY_LOW) +// process.stopTimer(processId); +// logging.log("test -> "); +// process.executeAsync("RebuildAllDuplicateCaches_serverProcess", processParameters, false, userId, process.THREADPRIORITY_LOW) +// logging.log("test2 -> "); +//} +//catch (exception) +//{ +// logging.log(" exception-> " + exception); +//} diff --git a/entity/Person_entity/recordcontainers/db/onDBInsert.js b/entity/Person_entity/recordcontainers/db/onDBInsert.js index 29d0967acd..eb22217f25 100644 --- a/entity/Person_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Person_entity/recordcontainers/db/onDBInsert.js @@ -54,6 +54,9 @@ let descriptionText = "%0 duplicates have been identified."; if(scanResults.length == 1) descriptionText = "%0 duplicate has been identified." +if(userId == null) + userId = ""; + let description = translate.withArguments(descriptionText, [scanResults.length]); let notificationConfig = notification.createConfig() -- GitLab