Skip to content
Snippets Groups Projects
Commit b4fd353f authored by David Büchler's avatar David Büchler
Browse files

Removed loggings

updated server processes to use the same latest api functions
removed notification in Persons OnUpdate because it's unclear if this is necessary or not. Has to be fully removed or uncommentedwhen this decision has been made.
parent 09bef189
No related branches found
No related tags found
No related merge requests found
import("system.logging");
import("system.logging");
import("DuplicateScanner_lib");
var filterName = "OrganisationDuplicates";
var targetEntity = "Organisation_entity";
var recordBlockSize = DuplicateScannerUtils.GetBlockSize();
let duplicateFieldsConfig = DuplicateScannerUtils.LoadIndexFieldsConfiguration(filterName, targetEntity);
let resultFields = DuplicateScannerUtils.LoadResultFields(filterName, targetEntity);
logging.log(filterName + ": Delete duplicates -> ");
DuplicateScannerUtils.DeleteDuplicateClustersByTargetEntity(targetEntity);
logging.log(filterName + ": Recalculate duplicates -> ");
DuplicateScannerUtils.RebuildDuplicatesCache(filterName, targetEntity, recordBlockSize,
duplicateFieldsConfig, resultFields, null);
DuplicateScannerUtils.RebuildDuplicatesCache(filterName, targetEntity, recordBlockSize, null);
logging.log(filterName + ": Refresh unrelated duplicates -> ");
DuplicateScannerUtils.RefreshUnrelatedDuplicateRelations(targetEntity);
......
......@@ -5,7 +5,6 @@ import("DuplicateScanner_lib");
var filterName = "PersonDuplicates";
var targetEntity = "Person_entity";
var recordBlockSize = DuplicateScannerUtils.GetBlockSize();
logging.log("recordBlockSize -> " + recordBlockSize);
logging.log(filterName + ": Delete duplicates -> ");
DuplicateScannerUtils.DeleteDuplicateClustersByTargetEntity(targetEntity);
......
......@@ -8,68 +8,64 @@ import("DuplicateScanner_lib");
import("system.notification");
import("system.project");
let targetEntity = "Person_entity";
//let targetEntity = "Person_entity";
let contactId = vars.get("$local.uid");
DataPrivacyUtils.notifyNeedDataPrivacyUpdate(contactId);
let valuesToCheck = {};
var entityModel = 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)
{
field = entityModel.fields[fieldname];
if(field.fieldType == project.ENTITYFIELDTYPE_FIELD)
{
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);
}
}
}
let scanResults = DuplicateScannerUtils.ScanForDuplicates("PersonDuplicates", targetEntity,
valuesToCheck, null);
//If we found duplicates, cache them
if(scanResults != null && scanResults.length > 0)
{
let insertCount = DuplicateScannerUtils.CacheNewScanResults(contactId, scanResults, targetEntity);
logging.log("insertCount -> " + insertCount);
let userId = EmployeeUtils.getCurrentUserId();
let caption = translate.text("Duplicates have been found");
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()
.addUserWithId(userId)
.forcedPriority(notification.PRIO_NORMAL)
.notificationType("_____SYSTEM_NOTIFICATION_MESSAGE")
.initialState(notification.STATE_UNSEEN)
.caption(caption)
.description(description)
.daysToLive(1);
notification.addNotificationWith(notificationConfig);
//notification.addNotification(util.getNewUUID(), null, null, null, "_____SYSTEM_NOTIFICATION_MESSAGE", notification.PRIO_NORMAL, 1, notification.STATE_UNSEEN, [EmployeeUtils.getCurrentUserId()], "message", "description");
}
\ No newline at end of file
//let valuesToCheck = {};
//
//var entityModel = 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)
//{
// field = entityModel.fields[fieldname];
// if(field.fieldType == project.ENTITYFIELDTYPE_FIELD)
// {
// 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);
// }
// }
//}
//
//let scanResults = DuplicateScannerUtils.ScanForDuplicates("PersonDuplicates", targetEntity,
//valuesToCheck, null);
//
////If we found duplicates, cache them
//if(scanResults != null && scanResults.length > 0)
//{
// let insertCount = DuplicateScannerUtils.CacheNewScanResults(contactId, scanResults, targetEntity);
// logging.log("insertCount -> " + insertCount);
//
// let userId = EmployeeUtils.getCurrentUserId();
// let caption = translate.text("Duplicates have been found");
// 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()
// .addUserWithId(userId)
// .forcedPriority(notification.PRIO_NORMAL)
// .notificationType("_____SYSTEM_NOTIFICATION_MESSAGE")
// .initialState(notification.STATE_UNSEEN)
// .caption(caption)
// .description(description)
// .daysToLive(1);
//
// notification.addNotificationWith(notificationConfig);
//}
\ No newline at end of file
This diff is collapsed.
import("system.logging");
import("DuplicateScanner_lib");
/*
......@@ -25,26 +26,30 @@ var filterName = "PersonDuplicates";
var targetEntity = "Person_entity";
var recordBlockSize = DuplicateScannerUtils.GetBlockSize();
logging.log(filterName + ": Delete duplicates -> ");
DuplicateScannerUtils.DeleteDuplicateClustersByTargetEntity(targetEntity);
logging.log(filterName + ": Recalculate duplicates -> ");
DuplicateScannerUtils.RebuildDuplicatesCache(filterName, targetEntity, recordBlockSize, null);
logging.log(filterName + ": Refresh unrelated duplicates -> ");
DuplicateScannerUtils.RefreshUnrelatedDuplicateRelations(targetEntity);
logging.log(filterName + ": Done rebuilding ");
// Build Organisation duplicate cache
//filterName = "OrganisationDuplicates";
//targetEntity = "Organisation_entity";
//resultFieldsIdFieldName = "CONTACTID";
//queryPersonContactIds = "select CONTACTID, ORGANISATION.\"NAME\" from ORGANISATION"
// + " join CONTACT on CONTACT.CONTACTID = ORGANISATION.ORGANISATIONID"
// + " where CONTACTID != '0'";
//tmpFieldsInFilterRay = ["CONTACTID", "NAME"];
//
//DuplicateScannerUtils.DeleteDuplicateClustersByTargetEntity(targetEntity)
//
//DuplicateScannerUtils.RebuildDuplicatesCache(filterName, targetEntity, queryPersonContactIds,
//tmpFieldsInFilterRay, resultFieldsIdFieldName);
//
//DuplicateScannerUtils.RefreshUnrelatedDuplicateRelations(targetEntity);
\ No newline at end of file
filterName = "OrganisationDuplicates";
targetEntity = "Organisation_entity";
logging.log(filterName + ": Delete duplicates -> ");
DuplicateScannerUtils.DeleteDuplicateClustersByTargetEntity(targetEntity);
logging.log(filterName + ": Recalculate duplicates -> ");
DuplicateScannerUtils.RebuildDuplicatesCache(filterName, targetEntity, recordBlockSize, null);
logging.log(filterName + ": Refresh unrelated duplicates -> ");
DuplicateScannerUtils.RefreshUnrelatedDuplicateRelations(targetEntity);
logging.log(filterName + ": Done rebuilding ");
\ No newline at end of file
......@@ -25,15 +25,16 @@ import("DuplicateScanner_lib");
var filterName = vars.get("$local.filterName");
var targetEntity = vars.get("$local.targetEntity");
logging.log("filterName -> " + filterName);
logging.log("targetEntity -> " + targetEntity);
var recordBlockSize = DuplicateScannerUtils.GetBlockSize();
let duplicateFieldsConfig = DuplicateScannerUtils.LoadIndexFieldsConfiguration(filterName, targetEntity);
let resultFields = DuplicateScannerUtils.LoadResultFields(filterName, targetEntity);
logging.log(filterName + ": Delete duplicates -> ");
DuplicateScannerUtils.DeleteDuplicateClustersByTargetEntity(targetEntity);
DuplicateScannerUtils.RebuildDuplicatesCache(filterName, targetEntity, recordBlockSize,
duplicateFieldsConfig, resultFields, null);
logging.log(filterName + ": Recalculate duplicates -> ");
DuplicateScannerUtils.RebuildDuplicatesCache(filterName, targetEntity, recordBlockSize, null);
logging.log(filterName + ": Refresh unrelated duplicates -> ");
DuplicateScannerUtils.RefreshUnrelatedDuplicateRelations(targetEntity);
logging.log(filterName + ": Done rebuilding ");
DuplicateScannerUtils.RefreshUnrelatedDuplicateRelations(targetEntity);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment