From 2fb27e55f61d3945795cb0736bb409a4abbe3d09 Mon Sep 17 00:00:00 2001
From: Pascal Neub <p.neub@adito.de>
Date: Thu, 6 May 2021 10:00:39 +0000
Subject: [PATCH] duplicate documentation

---
 .../DuplicateOrganisation_entity.aod          |  1 +
 .../documentation.adoc                        | 17 +++++++++++
 .../DuplicatePerson_entity.aod                |  1 +
 .../DuplicatePerson_entity/documentation.adoc | 17 +++++++++++
 .../DuplicateScanner_entity.aod               |  1 -
 .../documentation.adoc                        | 30 +++++++++++++++----
 .../DuplicateMerge_lib/DuplicateMerge_lib.aod |  1 +
 process/DuplicateMerge_lib/documentation.adoc |  5 ++++
 .../DuplicateScanner_lib.aod                  |  1 +
 .../DuplicateScanner_lib/documentation.adoc   | 15 ++++++++++
 process/IndexSearch_lib/IndexSearch_lib.aod   |  1 +
 process/IndexSearch_lib/documentation.adoc    |  3 ++
 .../documentation.adoc                        | 12 ++++++++
 .../rebuildDuplicates_serverProcess.aod       |  1 +
 14 files changed, 100 insertions(+), 6 deletions(-)
 create mode 100644 entity/DuplicateOrganisation_entity/documentation.adoc
 create mode 100644 entity/DuplicatePerson_entity/documentation.adoc
 create mode 100644 process/DuplicateMerge_lib/documentation.adoc
 create mode 100644 process/DuplicateScanner_lib/documentation.adoc
 create mode 100644 process/IndexSearch_lib/documentation.adoc
 create mode 100644 process/rebuildDuplicates_serverProcess/documentation.adoc

diff --git a/entity/DuplicateOrganisation_entity/DuplicateOrganisation_entity.aod b/entity/DuplicateOrganisation_entity/DuplicateOrganisation_entity.aod
index eb3318d1aa..e651b0227e 100644
--- a/entity/DuplicateOrganisation_entity/DuplicateOrganisation_entity.aod
+++ b/entity/DuplicateOrganisation_entity/DuplicateOrganisation_entity.aod
@@ -3,6 +3,7 @@
   <name>DuplicateOrganisation_entity</name>
   <title>Duplicate</title>
   <majorModelMode>DISTRIBUTED</majorModelMode>
+  <documentation>%aditoprj%/entity/DuplicateOrganisation_entity/documentation.adoc</documentation>
   <grantCreate v="false" />
   <grantUpdate v="false" />
   <grantDelete v="false" />
diff --git a/entity/DuplicateOrganisation_entity/documentation.adoc b/entity/DuplicateOrganisation_entity/documentation.adoc
new file mode 100644
index 0000000000..73695092a6
--- /dev/null
+++ b/entity/DuplicateOrganisation_entity/documentation.adoc
@@ -0,0 +1,17 @@
+= DuplicateOrganisation_entity
+
+== Overview
+
+Shows the duplicates of a record. 
+The views are only referenced in the OrganisationMain_view. 
+
+This entity is used to show all duplicates of an organisation, merge duplicates to one record and to ignore duplicates.
+
+==== Actions
+
+* ignoreDuplicates: The selected record is marked as no duplicate.
+* mergeselectedintocurrent: The selected record will be merged into the current opened one.
+* mergecurrentintoselected: Same behavior as with the mergeselectedintocurrent action only the other way.
+
+== AID
+More information on duplicates can be found in the AID60 or in the documentation of the DuplicateScanner_entity
\ No newline at end of file
diff --git a/entity/DuplicatePerson_entity/DuplicatePerson_entity.aod b/entity/DuplicatePerson_entity/DuplicatePerson_entity.aod
index 2d5dd73d04..76bf7dd0ac 100644
--- a/entity/DuplicatePerson_entity/DuplicatePerson_entity.aod
+++ b/entity/DuplicatePerson_entity/DuplicatePerson_entity.aod
@@ -3,6 +3,7 @@
   <name>DuplicatePerson_entity</name>
   <title>Duplicate</title>
   <majorModelMode>DISTRIBUTED</majorModelMode>
+  <documentation>%aditoprj%/entity/DuplicatePerson_entity/documentation.adoc</documentation>
   <grantCreate v="false" />
   <grantUpdate v="false" />
   <grantDelete v="false" />
diff --git a/entity/DuplicatePerson_entity/documentation.adoc b/entity/DuplicatePerson_entity/documentation.adoc
new file mode 100644
index 0000000000..8d2e8be6b1
--- /dev/null
+++ b/entity/DuplicatePerson_entity/documentation.adoc
@@ -0,0 +1,17 @@
+= DuplicateOrganisation_entity
+
+== Overview
+
+Shows the duplicates of a record. 
+The views are only referenced in the PersonMain_view. 
+
+This entity is used to show all duplicates of a person, merge duplicates to one record and to ignore duplicates.
+
+==== Actions
+
+* ignoreDuplicates: The selected record is marked as no duplicate.
+* mergeselectedintocurrent: The selected record will be merged into the current opened one.
+* mergecurrentintoselected: Same behavior as with the mergeselectedintocurrent action only the other way.
+
+== AID
+More information on duplicates can be found in the AID60 or in the documentation of the DuplicateScanner_entity
diff --git a/entity/DuplicateScanner_entity/DuplicateScanner_entity.aod b/entity/DuplicateScanner_entity/DuplicateScanner_entity.aod
index 220ca8da86..b94abcf358 100644
--- a/entity/DuplicateScanner_entity/DuplicateScanner_entity.aod
+++ b/entity/DuplicateScanner_entity/DuplicateScanner_entity.aod
@@ -97,7 +97,6 @@
       <name>DBRecordContainer</name>
       <onDBInsert>%aditoprj%/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBInsert.js</onDBInsert>
       <onDBUpdate>%aditoprj%/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBUpdate.js</onDBUpdate>
-      <onDBDelete>%aditoprj%/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBDelete.js</onDBDelete>
       <alias>Data_alias</alias>
       <recordFieldMappings>
         <dbRecordFieldMapping>
diff --git a/entity/DuplicateScanner_entity/documentation.adoc b/entity/DuplicateScanner_entity/documentation.adoc
index 6284402b76..63f59e3f44 100644
--- a/entity/DuplicateScanner_entity/documentation.adoc
+++ b/entity/DuplicateScanner_entity/documentation.adoc
@@ -1,7 +1,27 @@
-=DuplicateScanner_entity
+= DuplicateScanner_entity
 
-A "DuplicateScanner" is a definition 
-- WHICH objects may be searched for duplicates
-- and HOW these are searched 
+== Overview
+The duplicate scanner is the configuration for duplicate recognition.
+It defines WHICH objects may be searched for duplicates and HOW these are searched.
 
-Speaking of this, the duplicate scanner is the configuration for duplicate recognition.
+== Technical details
+The filter is a field with contentType: FILTER_TREE which is loaded in the onInsert/onUpdate of the db recordcontainer.
+
+All records in the DuplicateScanner cannot be deleted/created
+and should be created via liquibase scripts, during the implementation of the duplicates for a new entity. Note that, the provider and the entity must be set in the filter.
+
+The field EXTERNAL_SERVICE_USAGE_ALLOWED is deprecated and is not used in the implementation as of 06 May 2021.
+
+The field FILTER_NAME is only used as displayName in the UI and is irrelevant for the duplicate search.
+
+SCAN_PATTERN defines the filter. Note that, the provider of the ENTITY_TO_SCAN_NAME must use an index recordContainer.
+
+ID_FIELD_NAME the uid field for the duplicate search. Note that currently, it must be the uid field of the entity.
+
+==== Actions
+* rebuild: rebuilds all duplicates see rebuildDuplicates_serverProcess.
+* viewDuplicates: opens the target entity with default duplicate filter.
+
+== AID
+
+Further information and how to implement custom duplicate functionality can be found in AID60 Duplicates
diff --git a/process/DuplicateMerge_lib/DuplicateMerge_lib.aod b/process/DuplicateMerge_lib/DuplicateMerge_lib.aod
index bc0eb02352..0b31b47ada 100644
--- a/process/DuplicateMerge_lib/DuplicateMerge_lib.aod
+++ b/process/DuplicateMerge_lib/DuplicateMerge_lib.aod
@@ -2,6 +2,7 @@
 <process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.2">
   <name>DuplicateMerge_lib</name>
   <majorModelMode>DISTRIBUTED</majorModelMode>
+  <documentation>%aditoprj%/process/DuplicateMerge_lib/documentation.adoc</documentation>
   <process>%aditoprj%/process/DuplicateMerge_lib/process.js</process>
   <variants>
     <element>LIBRARY</element>
diff --git a/process/DuplicateMerge_lib/documentation.adoc b/process/DuplicateMerge_lib/documentation.adoc
new file mode 100644
index 0000000000..09fc1f7557
--- /dev/null
+++ b/process/DuplicateMerge_lib/documentation.adoc
@@ -0,0 +1,5 @@
+= DuplicateMerge_lib
+
+Provides functionalities for merging 2 datasets. Currently implemented for Person and Organisation.
+
+This lib is, among other things, able to create activities for the merge and to update the duplicates for the merged datasets.
diff --git a/process/DuplicateScanner_lib/DuplicateScanner_lib.aod b/process/DuplicateScanner_lib/DuplicateScanner_lib.aod
index 6b45659f20..bf45bdb540 100644
--- a/process/DuplicateScanner_lib/DuplicateScanner_lib.aod
+++ b/process/DuplicateScanner_lib/DuplicateScanner_lib.aod
@@ -2,6 +2,7 @@
 <process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.2">
   <name>DuplicateScanner_lib</name>
   <majorModelMode>DISTRIBUTED</majorModelMode>
+  <documentation>%aditoprj%/process/DuplicateScanner_lib/documentation.adoc</documentation>
   <process>%aditoprj%/process/DuplicateScanner_lib/process.js</process>
   <alias>Data_alias</alias>
   <variants>
diff --git a/process/DuplicateScanner_lib/documentation.adoc b/process/DuplicateScanner_lib/documentation.adoc
new file mode 100644
index 0000000000..d824334d2f
--- /dev/null
+++ b/process/DuplicateScanner_lib/documentation.adoc
@@ -0,0 +1,15 @@
+= DuplicateScanner_lib
+
+Provides a utility function for reading scan patterns (getScannerByEntity).
+
+Provides functions to create duplicate filterExtensions (getDuplicateConditionalListSql).
+
+Provides functions to manage ignored duplicates (filterIgnored, updateIgnored).
+
+Provides functions to search for ignored duplicates.
+The base function is DuplicateScannerUtils.getDuplicateIds. The other helper functions are
+    DuplicateScannerUtils.getDuplicateIdsByEntityScanner and DuplicateScannerUtils.getDuplicateIdsByEntityObj.
+    both call the base function but simplify the call for the 2 usecases:
+
+* get all duplicateids of a dataset by entity and uid: getDuplicateIdsByEntityScanner
+* get all duplicateids of a dataset based on the entity and the variable (if the dataset has not been saved yet).
diff --git a/process/IndexSearch_lib/IndexSearch_lib.aod b/process/IndexSearch_lib/IndexSearch_lib.aod
index b5a2aacd8c..966a62229e 100644
--- a/process/IndexSearch_lib/IndexSearch_lib.aod
+++ b/process/IndexSearch_lib/IndexSearch_lib.aod
@@ -2,6 +2,7 @@
 <process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.2">
   <name>IndexSearch_lib</name>
   <majorModelMode>DISTRIBUTED</majorModelMode>
+  <documentation>%aditoprj%/process/IndexSearch_lib/documentation.adoc</documentation>
   <process>%aditoprj%/process/IndexSearch_lib/process.js</process>
   <variants>
     <element>LIBRARY</element>
diff --git a/process/IndexSearch_lib/documentation.adoc b/process/IndexSearch_lib/documentation.adoc
new file mode 100644
index 0000000000..e1a46041bb
--- /dev/null
+++ b/process/IndexSearch_lib/documentation.adoc
@@ -0,0 +1,3 @@
+= IndexSearch_lib
+
+Provides functionality to generate a adito-solr indexquery
diff --git a/process/rebuildDuplicates_serverProcess/documentation.adoc b/process/rebuildDuplicates_serverProcess/documentation.adoc
new file mode 100644
index 0000000000..b76ecd1451
--- /dev/null
+++ b/process/rebuildDuplicates_serverProcess/documentation.adoc
@@ -0,0 +1,12 @@
+= rebuildDuplicate_serverProcess
+
+== Overview
+Manages the asynchronous server-side recalculation of all duplicates of an entity.
+This process should only be necessary initially and possibly during data imports.
+
+== Technical Details
+Currently the process is called in the rebuild action of the DuplicateScanner_entity.
+
+The batchsize of the process (how many data sets should be loaded at once)
+can be determined by the preference custom.duplicates.dataBlockSize.
+The default value is 5000.
diff --git a/process/rebuildDuplicates_serverProcess/rebuildDuplicates_serverProcess.aod b/process/rebuildDuplicates_serverProcess/rebuildDuplicates_serverProcess.aod
index 3a72b0bfc4..e28fee4a9b 100644
--- a/process/rebuildDuplicates_serverProcess/rebuildDuplicates_serverProcess.aod
+++ b/process/rebuildDuplicates_serverProcess/rebuildDuplicates_serverProcess.aod
@@ -5,6 +5,7 @@
 This process can only be executed within the client.
 The action (Rebuild selected entries) can be found in the administration context "Duplicate Configuration".</description>
   <majorModelMode>DISTRIBUTED</majorModelMode>
+  <documentation>%aditoprj%/process/rebuildDuplicates_serverProcess/documentation.adoc</documentation>
   <process>%aditoprj%/process/rebuildDuplicates_serverProcess/process.js</process>
   <alias>Data_alias</alias>
   <variants>
-- 
GitLab