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

Allgemeine Dublettenansicht: Neuer Reiter für Organisation

Es werden sowohl die Organisationscluster angezeigt als auch analog zu den Personen eine Tabelle mit ignorierten Dublettenkombinationen. Entsprechende Aktionen werden ebenso angezeigt.
DuplicatesUnrelated wurde um Logik für Organisationen erweitert
Duplicates wurde um Logik für Organisationen erweitert
parent 00f0cd1e
No related branches found
No related tags found
No related merge requests found
Showing
with 196 additions and 10 deletions
......@@ -48,6 +48,11 @@
<expose v="true" />
<mandatory v="true" />
</entityParameter>
<entityParameter>
<name>ClusterId_param</name>
<expose v="true" />
<mandatory v="false" />
</entityParameter>
</children>
</entityProvider>
<entityField>
......
......@@ -7,6 +7,9 @@ var INDEX_SOURCE_INFO1 = 1;
var INDEX_SOURCE_INFO2 = 2;
var INDEX_UNRELATED_INFO1 = 3;
var INDEX_UNRELATED_INFO2 = 4;
var INDEX_SOURCE_INFO = 1;
var INDEX_UNRELATED_INFO = 2;
let unrelatedDuplicates = [];
let resultUnrelatedDuplicates = [];
......@@ -28,17 +31,46 @@ if(targetEntity == 'Person_entity')
if(clusterId != null && clusterId != "")
query += " where ud.CLUSTERID = '" + clusterId + "'";
}
else
{
query = "select ud.ID,"
+ " oSource.\"NAME\","
+ " oUnrelated.\"NAME\""
+ " from UNRELATEDDUPLICATES ud"
+ " join CONTACT cUnrelated on cUnrelated.CONTACTID = ud.UNRELATEDDUPLICATEID"
+ " join Organisation oUnrelated on oUnrelated.ORGANISATIONID = cUnrelated.CONTACTID"
+ " join CONTACT cSource on cSource.CONTACTID = ud.SOURCEDUPLICATEID"
+ " join Organisation oSource on oSource.ORGANISATIONID = cSource.CONTACTID"
//If the clusterid parameter is present, only load the duplicates for this particular cluster
if(clusterId != null && clusterId != "")
query += " where ud.CLUSTERID = '" + clusterId + "'";
}
unrelatedDuplicates = db.table(query);
for (let i = 0; i < unrelatedDuplicates.length; i++)
{
let id = unrelatedDuplicates[i][INDEX_ID];
let sourceInfo1 = unrelatedDuplicates[i][INDEX_SOURCE_INFO1];
let sourceInfo2 = unrelatedDuplicates[i][INDEX_SOURCE_INFO2];
let unrelatedInfo1 = unrelatedDuplicates[i][INDEX_UNRELATED_INFO1];
let unrelatedInfo2 = unrelatedDuplicates[i][INDEX_UNRELATED_INFO2];
let sourceInfo = "";
let unrelatedInfo = "";
if(targetEntity == 'Person_entity')
{
let sourceInfo1 = unrelatedDuplicates[i][INDEX_SOURCE_INFO1];
let sourceInfo2 = unrelatedDuplicates[i][INDEX_SOURCE_INFO2];
let unrelatedInfo1 = unrelatedDuplicates[i][INDEX_UNRELATED_INFO1];
let unrelatedInfo2 = unrelatedDuplicates[i][INDEX_UNRELATED_INFO2];
sourceInfo = sourceInfo1 + " " + sourceInfo2;
unrelatedInfo = unrelatedInfo1 + " " + unrelatedInfo2;
}
else
{
sourceInfo = unrelatedDuplicates[i][INDEX_SOURCE_INFO];
unrelatedInfo = unrelatedDuplicates[i][INDEX_UNRELATED_INFO];
}
resultUnrelatedDuplicates.push([id, sourceInfo1 + " " + sourceInfo2, unrelatedInfo1 + " " + unrelatedInfo2]);
resultUnrelatedDuplicates.push([id, sourceInfo, unrelatedInfo]);
}
result.object(resultUnrelatedDuplicates);
\ No newline at end of file
......@@ -123,6 +123,14 @@
</entityActionField>
</children>
</entityActionGroup>
<entityConsumer>
<name>DuplicatesUnrelatedOrganisationConsumer</name>
<dependency>
<name>dependency</name>
<entityName>DuplicatesUnrelated_entity</entityName>
<fieldName>UnrelatedOrganisationsProvider</fieldName>
</dependency>
</entityConsumer>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
......
......@@ -8,6 +8,7 @@ var INDEX_ID = 0;
var INDEX_CLUSTERID = 1;
var INDEX_FIRSTNAME = 2;
var INDEX_LASTNAME = 3;
var INDEX_ORGNAME = 2;
let targetEntity = vars.get("$param.TargetEntity");
let duplicates = [];
......@@ -29,8 +30,16 @@ if(targetEntity == "Person_entity")
}
else
duplicateInfosQuery = "orgquery";
{
duplicateInfosQuery = SqlCondition.begin()
.and("DUPLICATEID not in (select UNRELATEDDUPLICATES.UNRELATEDDUPLICATEID from UNRELATEDDUPLICATES)")
.andIn("DUPLICATECLUSTERS.CLUSTERID", vars.get("$local.idvalues"))
.buildSql("select DUPLICATECLUSTERS.ID, CLUSTERID, ORGANISATION.\"NAME\""
+ " from DUPLICATECLUSTERS"
+ " join CONTACT on CONTACT.CONTACTID = DUPLICATEID"
+ " join ORGANISATION on ORGANISATION.ORGANISATIONID = CONTACT.CONTACTID", "1=2", " ORDER BY CLUSTERID");
}
let duplicateInfos = db.table(duplicateInfosQuery);
let recordClusterId = "";
......@@ -47,7 +56,7 @@ for (let i = 0; i < duplicateInfos.length; i++)
if(targetEntity == "Person_entity")
currentDescription = duplicateInfos[i][INDEX_FIRSTNAME] + " " + duplicateInfos[i][INDEX_LASTNAME];
else
currentDescription = "orgfields";
currentDescription = duplicateInfos[i][INDEX_ORGNAME];
if(i == 0)
{
......
......@@ -27,5 +27,17 @@
<name>7cdb6ca7-e99d-4eb6-897a-0953157bf62f</name>
<view>DuplicatesUnrelatedCluster_view</view>
</neonViewReference>
<neonViewReference>
<name>4b9a1a26-e14f-4246-b474-8bfb3e3a95b0</name>
<view>OrganisationDuplicatesTab_view</view>
</neonViewReference>
<neonViewReference>
<name>f9b46eab-7417-4f61-b7cd-dc772c04ddc0</name>
<view>OrganisationDuplicatesFilter_view</view>
</neonViewReference>
<neonViewReference>
<name>d68a425a-037a-4725-8dc1-b0afac277bdd</name>
<view>OrganisationUnrelatedDuplicates_view</view>
</neonViewReference>
</references>
</neonContext>
......@@ -13,5 +13,10 @@
<entityField>#ENTITY</entityField>
<view>PersonDublicatesTab_view</view>
</neonViewReference>
<neonViewReference>
<name>8e19d057-58da-4db8-8119-ecf070af86ab</name>
<entityField>#ENTITY</entityField>
<view>OrganisationDuplicatesTab_view</view>
</neonViewReference>
</children>
</neonView>
......@@ -2,4 +2,29 @@
<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>DuplicatesUnrelatedOrganisationFilter_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<layout>
<boxLayout>
<name>layout</name>
</boxLayout>
</layout>
<children>
<tableViewTemplate>
<name>UnrelatedOrganisations</name>
<hideContentSearch v="true" />
<entityField>#ENTITY</entityField>
<isCreatable v="false" />
<isEditable v="false" />
<title>Unrelated organisation duplicates</title>
<columns>
<neonTableColumn>
<name>04681f8d-b941-4a66-be50-6ac08d6f52a4</name>
<entityField>SourceDuplicateDescription</entityField>
</neonTableColumn>
<neonTableColumn>
<name>b293ed18-ebf5-474e-8ec2-851a3562b4d5</name>
<entityField>UnrelatedDuplicateDescription</entityField>
</neonTableColumn>
</columns>
</tableViewTemplate>
</children>
</neonView>
<?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>OrganisationDuplicatesFilter_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<layout>
<boxLayout>
<name>layout</name>
</boxLayout>
</layout>
<children>
<tableViewTemplate>
<name>OrganisationDuplicatesTable</name>
<favoriteActionGroup2>DuplicateClusterActionGroup</favoriteActionGroup2>
<hideContentSearch v="true" />
<entityField>#ENTITY</entityField>
<isCreatable v="false" />
<isEditable v="false" />
<isDeletable v="false" />
<columns>
<neonTableColumn>
<name>ebe8d904-449c-49bd-915c-5b4fee894bc2</name>
<entityField>CLUSTER_DESCRIPTION</entityField>
</neonTableColumn>
<neonTableColumn>
<name>48db4335-6bdb-4a6a-809e-f9c371733f85</name>
<entityField>COUNT_DUPLICATES_IN_CLUSTER</entityField>
</neonTableColumn>
</columns>
</tableViewTemplate>
</children>
</neonView>
<?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>OrganisationDuplicatesTab_view</name>
<title>Organisation duplicates</title>
<majorModelMode>DISTRIBUTED</majorModelMode>
<layout>
<boxLayout>
<name>layout</name>
<direction>HORIZONTAL</direction>
</boxLayout>
</layout>
<children>
<neonViewReference>
<name>8b4ab951-afb3-4fac-915b-89226ab2f849</name>
<entityField>SelfOrganisationDuplicatesConsumer</entityField>
<view>OrganisationDuplicatesFilter_view</view>
</neonViewReference>
<neonViewReference>
<name>d1e2ba4a-a5d6-4bba-a646-5918490e43a4</name>
<entityField>#ENTITY</entityField>
<view>OrganisationUnrelatedDuplicates_view</view>
</neonViewReference>
</children>
</neonView>
<?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>OrganisationUnrelatedDuplicates_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<layout>
<boxLayout>
<name>layout</name>
</boxLayout>
</layout>
<children>
<neonViewReference>
<name>edc0822d-4388-4e3d-93d7-2e46e32f5742</name>
<entityField>DuplicatesUnrelatedOrganisationConsumer</entityField>
<view>DuplicatesUnrelatedOrganisationFilter_view</view>
</neonViewReference>
</children>
</neonView>
import("DuplicateScanner_lib");
// Build Organisation duplicate cache
/*
* 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
* Step #2
* The duplicates cache gets rebuilt
*
* Step #3:
* 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.
*
* Relations between unrelated duplicates are deleted, if no cluster contains the same combination of duplicate ids
*/
// Build Person duplicate cache
var filterName = "PersonDuplicates";
var targetEntity = "Person_entity";
......
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