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

Dublettensuche wird nun ausgeführt und im Reiter Dubletten in der Person angezeigt

Die Anzahl der Felder, welche durch den RecordContainer zurückgegeben werden sollen, muss per Field gesteuert werden.
parent 5b72c3e8
No related branches found
No related tags found
No related merge requests found
Showing
with 255 additions and 7 deletions
<?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.10" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.10">
<name>Duplicates_entity</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<recordContainer>jditoRecordContainer</recordContainer>
<entityFields>
<entityProvider>
<name>#PROVIDER</name>
<targetContextField>targetEntity</targetContextField>
<targetIdField>UID</targetIdField>
</entityProvider>
<entityParameter>
<name>filterName_param</name>
<expose v="true" />
<mandatory v="true" />
</entityParameter>
<entityParameter>
<name>targetEntity_param</name>
<expose v="true" />
<mandatory v="true" />
</entityParameter>
<entityParameter>
<name>valuesToScan_param</name>
<expose v="true" />
<mandatory v="true" />
</entityParameter>
<entityParameter>
<name>resultFields_param</name>
<expose v="true" />
<mandatory v="true" />
</entityParameter>
<entityField>
<name>VALUE1</name>
</entityField>
<entityField>
<name>VALUE2</name>
</entityField>
<entityField>
<name>VALUE3</name>
</entityField>
<entityProvider>
<name>DuplicatesProvider</name>
<dependencies>
<entityDependency>
<name>ea8abf2a-d8b8-4f83-a68e-664b3b23d822</name>
<entityName>Person_entity</entityName>
<fieldName>PersonDuplicates</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
</entityProvider>
<entityField>
<name>targetEntity</name>
</entityField>
<entityField>
<name>UID</name>
</entityField>
<entityParameter>
<name>resultFieldsIdFieldName_param</name>
<expose v="true" />
<mandatory v="true" />
</entityParameter>
<entityField>
<name>maxReturnValueCount</name>
<valueProcess>%aditoprj%/entity/Duplicates_entity/entityfields/maxreturnvaluecount/valueProcess.js</valueProcess>
</entityField>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
<name>jditoRecordContainer</name>
<jDitoRecordAlias>Data_alias</jDitoRecordAlias>
<contentProcess>%aditoprj%/entity/Duplicates_entity/recordcontainers/jditorecordcontainer/contentProcess.js</contentProcess>
<recordFieldMappings>
<jDitoRecordFieldMapping>
<name>UID.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>VALUE1.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>VALUE2.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>VALUE3.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>targetEntity.value</name>
</jDitoRecordFieldMapping>
</recordFieldMappings>
</jDitoRecordContainer>
</recordContainers>
</entity>
import("system.result");
import("system.vars");
import("DuplicateScanner_lib");
import("system.logging");
var filterName = vars.get("$param.filterName_param");
var targetEntity = vars.get("$param.targetEntity_param");
var values = JSON.parse(vars.get("$param.valuesToScan_param"));
var resultFields = JSON.parse(vars.get("$param.resultFields_param"));
var resultFieldsIdFieldName = vars.get("$param.resultFieldsIdFieldName_param");
var maxRecorValues = parseInt(vars.get("$field.maxReturnValueCount"), 10);
logging.log("filterName -> " + filterName);
logging.log("targetEntity -> " + targetEntity);
logging.log("values -> " + values);
logging.log("resultFields -> " + resultFields);
var duplicates = DuplicateScannerUtils.ScanForDuplicates(filterName, targetEntity, values, resultFields);
logging.log("duplicates -> " + JSON.stringify(duplicates));
//[{"FIRSTNAME":"Markus","LASTNAME":"Altinger","PERSONID":"0a611832-9476-481e-bde5-af3c3a98f1b4"},
//{"FIRSTNAME":"Marshel","LASTNAME":"Ericson","PERSONID":"44c5d7db-b96e-4f67-a00f-c206cd3f7e1b"}]
var returnRay = [];
logging.log("duplicates.length -> " + duplicates.length);
for (i = 0; i < duplicates.length; i++)
{
logging.log("i -> " + i);
let newRecord = _compileSingleRecord(duplicates[i], resultFieldsIdFieldName, maxRecorValues);
logging.log("newRecord -> " + newRecord);
returnRay.push(newRecord);
}
result.object(returnRay);
function _compileSingleRecord(pDuplicate, pIdFieldName, maxRecordValues)
{
let newRecord = [];
let recordId = pDuplicate[pIdFieldName];
newRecord.push(recordId);
let recordCount = 0;
for(recordValue in pDuplicate)
{
logging.log("recordKey -> " + recordValue);
logging.log("revordValue -> " + pDuplicate[recordValue]);
recordCount++;
//The record Id has already been added, only the rest gets added
if(recordValue != pIdFieldName)
newRecord.push(pDuplicate[recordValue]);
logging.log("recourdcount -> " + recordCount);
logging.log("maxRecordValues-1 -> " + (maxRecordValues-1));
//subtract 2 because in this for loop only the values get added
//The id as well as the targetContext are handled separately
if(recordCount == maxRecordValues-2)
break;
}
logging.log("newRecord.length -> " + newRecord.length);
logging.log("maxRecordValues -> " + maxRecordValues);
//If there are less elements than required, fill the record with empty strings
if(newRecord.length < maxRecordValues)
{
let elementsToFill = maxRecordValues - newRecord.length;
for (a = 0; a < elementsToFill; a++)
{
newRecord.push("");
}
}
logging.log("newRecord -> " + newRecord);
return newRecord;
}
\ No newline at end of file
import("system.result");
result.string("PersonDuplicates");
\ No newline at end of file
import("system.result");
result.string(JSON.stringify(["FIRSTNAME", "LASTNAME", "PERSONID"]));
\ No newline at end of file
import("system.result");
result.string("PERSONID");
\ No newline at end of file
import("system.result");
result.string("Person_entity");
\ No newline at end of file
import("system.logging");
import("system.result");
import("system.vars");
// var adresses = vars.get("$field.PersAddresses");
// var organisation = vars.get("$field.ORGANISATION_NAME");
// var organisationAdress = vars.get("$field.OrgAddresses");
//
// logging.log("adresses -> " + adresses);
// logging.log("firstname -> " + firstname);
// logging.log("organisation -> " + organisation);
// logging.log("organisationAdress -> " + organisationAdress);
var firstname = vars.get("$field.FIRSTNAME");
var lastname = vars.get("$field.LASTNAME");
let gender = vars.get("$field.GENDER");
result.object({FIRSTNAME: firstname, LASTNAME: lastname, GENDER: gender});
\ No newline at end of file
<?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>Duplicates</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<entity>Duplicates_entity</entity>
<references>
<neonViewReference>
<name>fe767c88-a869-4fe6-b61d-8727faad7a12</name>
<view>DuplicatesFilter_view</view>
</neonViewReference>
</references>
</neonContext>
<?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.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.1">
<name>DuplicatesFilter_view</name>
<title>Duplicates</title>
<majorModelMode>DISTRIBUTED</majorModelMode>
<layout>
<boxLayout>
<name>layout</name>
</boxLayout>
</layout>
<children>
<tableViewTemplate>
<name>DuplicatesTable</name>
<entityField>#ENTITY</entityField>
<isCreatable v="false" />
<isEditable v="false" />
<columns>
<neonTableColumn>
<name>6d6aef18-53c9-4a43-8929-c421ea2d1889</name>
<entityField>VALUE1</entityField>
</neonTableColumn>
<neonTableColumn>
<name>24e1bc96-a1a4-4923-a3a6-816009f68276</name>
<entityField>VALUE2</entityField>
</neonTableColumn>
<neonTableColumn>
<name>b90994bf-7398-4f27-b303-4326a30f8fad</name>
<entityField>VALUE3</entityField>
</neonTableColumn>
</columns>
</tableViewTemplate>
</children>
</neonView>
...@@ -64,5 +64,10 @@ ...@@ -64,5 +64,10 @@
<entityField>DSGVOEntries</entityField> <entityField>DSGVOEntries</entityField>
<view>DSGVOFilter_view</view> <view>DSGVOFilter_view</view>
</neonViewReference> </neonViewReference>
<neonViewReference>
<name>17b890d6-c734-4607-92dc-af87c90c1156</name>
<entityField>PersonDuplicates</entityField>
<view>DuplicatesFilter_view</view>
</neonViewReference>
</children> </children>
</neonView> </neonView>
import("system.vars");
import("system.net"); import("system.net");
import("system.logging"); import("system.logging");
import("system.db"); import("system.db");
...@@ -100,7 +101,7 @@ _DuplicateScannerUtils._applyPreFilter = function(pTargetEntity, pFilterCountCha ...@@ -100,7 +101,7 @@ _DuplicateScannerUtils._applyPreFilter = function(pTargetEntity, pFilterCountCha
loadRowsConfig = loadRowsConfig.fields(pTargetEntityResultFields); loadRowsConfig = loadRowsConfig.fields(pTargetEntityResultFields);
let resultRows = entities.getRows(loadRowsConfig); let resultRows = entities.getRows(loadRowsConfig);
logging.log("foundRows -> " + JSON.stringify(resultRows));
return resultRows; return resultRows;
} }
} }
...@@ -140,11 +141,10 @@ _DuplicateScannerUtils._getExternalServiceConfiguration = function(pFormattedJso ...@@ -140,11 +141,10 @@ _DuplicateScannerUtils._getExternalServiceConfiguration = function(pFormattedJso
_DuplicateScannerUtils._loadFilters = function(pFilterName, pTargetEntity) _DuplicateScannerUtils._loadFilters = function(pFilterName, pTargetEntity)
{ {
let query = "select \"CONDITION\", COUNT_CHARACTERS_TO_USE, MAX_RESULTS_TRESHOLD from DUPLICATESCANCONDITIONCONFIG" let query = "select \"CONDITION\", COUNT_CHARACTERS_TO_USE, MAX_RESULTS_THRESHOLD from DUPLICATESCANCONDITIONCONFIG"
+ " join DUPLICATESCANNER on DUPLICATESCANNER.ID = DUPLICATESCANCONDITIONCONFIG.DUPLICATESCAN_ID" + " join DUPLICATESCANNER on DUPLICATESCANNER.ID = DUPLICATESCANCONDITIONCONFIG.DUPLICATESCAN_ID"
+ " where FILTER_NAME = '" + pFilterName + "'" + " where FILTER_NAME = '" + pFilterName + "'"
+ " and ENTITY_TO_SCAN_NAME = '" + pTargetEntity + "'"; + " and ENTITY_TO_SCAN_NAME = '" + pTargetEntity + "'";
return db.table(query); return db.table(query);
} }
...@@ -161,10 +161,11 @@ _DuplicateScannerUtils._insertValuesInFilterTemplate = function(pJsonRootNode, p ...@@ -161,10 +161,11 @@ _DuplicateScannerUtils._insertValuesInFilterTemplate = function(pJsonRootNode, p
let fieldValue = pEntitiyFieldAndValueMap[fieldName]; let fieldValue = pEntitiyFieldAndValueMap[fieldName];
pCountCharsOfValueToUse = parseInt(pCountCharsOfValueToUse, 10); pCountCharsOfValueToUse = parseInt(pCountCharsOfValueToUse, 10);
// logging.log("fieldName -> " + fieldName); logging.log("pEntitiyFieldAndValueMap -> " + JSON.stringify(pEntitiyFieldAndValueMap));
// logging.log("fieldValue -> " + fieldValue); logging.log("fieldName -> " + fieldName);
// logging.log("fieldValue.length -> " + fieldValue.length); logging.log("fieldValue -> " + fieldValue);
// logging.log("pCountCharsOfValueToUse -> " + pCountCharsOfValueToUse); logging.log("fieldValue.length -> " + fieldValue.length);
logging.log("pCountCharsOfValueToUse -> " + pCountCharsOfValueToUse);
if(_DuplicateScannerUtils._isValueLongerThanCharsToUse(fieldValue.length, pCountCharsOfValueToUse)) if(_DuplicateScannerUtils._isValueLongerThanCharsToUse(fieldValue.length, pCountCharsOfValueToUse))
{ {
......
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