Skip to content

Commit f61236c

Browse files
authored
Merge pull request #120 from ConductionNL/feature/check-to-use-pagination
Check if have to use pagination
2 parents 4d48122 + 4119fb7 commit f61236c

File tree

4 files changed

+49
-28
lines changed

4 files changed

+49
-28
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
{
22
"name": "Xxllnc suite to Publication",
3-
"description": "",
4-
"version": "",
5-
"reference": "",
3+
"version": "0.0.1",
64
"mapping": {
7-
"title": "omschrijving",
8-
"summary": "zaaktypeomschrijving",
9-
"description": "zaaktypeomschrijving",
10-
"published" : "",
11-
"modified" : "{{ 'now'|date(H:i:sTm-d-Y') }}",
12-
"status": "Concept",
13-
"catalog": "",
14-
"publicationType": ""
15-
},
16-
"unset": [],
17-
"cast": {
18-
"title": "unsetIfValue==omschrijving",
19-
"summary": "unsetIfValue==zaaktypeomschrijving",
20-
"description": "unsetIfValue==zaaktypeomschrijving",
21-
"published" : "unsetIfValue==",
22-
"catalog": "unsetIfValue==",
23-
"publicationType": "unsetIfValue=="
5+
"title": "omschrijving",
6+
"summary": "zaaktypeomschrijving",
7+
"description": "zaaktypeomschrijving",
8+
"category": "{% if zaaktypecode|default %}{% set wooVerzoekenEnBesluiten = ['LP00000431', 'B1873', 'cherry'] %}{% set klachtoordelen = ['LP00000091', 'LP00001132', 'LP00000121', 'B0757', 'LP00000832', 'LP00001096'] %}{% if zaaktypecode in wooVerzoekenEnBesluiten %}{{ 'Woo-verzoeken en -besluiten' }}{% elseif zaaktypecode in klachtoordelen %}{{ 'Klachtoordelen' }}{% endif %}{% endif %}",
9+
"published": "startdatum",
10+
"modified": "{{ 'now'|date('H:i:sTm-d-Y') }}",
11+
"attachments": "[{% if files|default %}{% for file in files %} { {% if file['titel']|default %}\"title\": \"{{ file['titel'] }}\",{% endif %}\"labels\": [\"{{ 'Informatieverzoek' }}\"],{% if file['formaat']|default %}\"extension\": \"{{ file['formaat']|split('/')|last }}\",\"type\": \"{{ file['formaat'] }}\",{% endif %}{% if file['inhoud']|default and file['formaat']|default %}\"accessUrl\": \"data:{{ file['formaat'] }};base64,{{ file.inhoud }}\"{% endif %} }{{ loop.last ? '' : ',' }} {% endfor %}{% endif %}]",
12+
"status": "Concept"
13+
},
14+
"unset": [
15+
""
16+
],
17+
"cast": {
18+
"title": "unsetIfValue==omschrijving",
19+
"summary": "unsetIfValue==zaaktypeomschrijving",
20+
"description": "unsetIfValue==zaaktypeomschrijving",
21+
"category": "unsetIfValue==",
22+
"published": "unsetIfValue==startdatum",
23+
"attachments": "jsonToArray"
2424
},
2525
"passThrough": false
2626
}

configurations/sharepoint-woo/synchronizations/xxllnc-suite-to-publications.json

+13-7
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@
77
"sourceHash": "",
88
"sourceTargetMapping": "1",
99
"sourceConfig": {
10-
"idPosition": "id",
11-
"resultsPosition": "results",
12-
"endpoint": "/tlb/zaaksysteem/api/v1/zaken",
13-
"headers": [],
14-
"query.startdatum__gte": "2024-07-06",
15-
"query.einddatum__lt": "2024-08-01"
16-
},
10+
"idPosition": "identificatie",
11+
"resultsPosition": "results",
12+
"endpoint": "\/tlb\/zaaksysteem\/api\/v1\/zaken",
13+
"headers": [],
14+
"query.startdatum__gte": "2024-08-01",
15+
"query.einddatum__lt": "2025-01-01",
16+
"usesPagination": "false",
17+
"extraDataConfigs.0.staticEndpoint": "/tlb/zaaksysteem/api/v1/zaken/{{ originId }}/informatieobjecten",
18+
"extraDataConfigs.0.mergeExtraData": "true",
19+
"extraDataConfigs.0.keyToSetExtraData": "files",
20+
"extraDataConfigs.0.resultsLocation": "results",
21+
"extraDataConfigs.0.extraDataConfigPerResult.staticEndpoint": "/tlb/zaaksysteem/api/v1/informatieobjecten/{{ originId }}"
22+
},
1723
"targetId": "1/1",
1824
"targetType": "register/schema"
1925
}

lib/Db/Synchronization.php

+15
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@ public function __construct() {
6565
$this->addType(fieldName:'followUps', type: 'json');
6666
}
6767

68+
/**
69+
* Checks through sourceConfig if the source of this sync uses pagination
70+
*
71+
* @return bool true if its uses pagination
72+
*/
73+
public function usesPagination(): bool
74+
{
75+
if (isset($this->sourceConfig['usesPagination']) === true && ($this->sourceConfig['usesPagination'] === false || $this->sourceConfig['usesPagination'] === 'false')) {
76+
return false;
77+
}
78+
79+
// By default sources use basic pagination.
80+
return true;
81+
}
82+
6883
public function getJsonFields(): array
6984
{
7085
return array_keys(

lib/Service/SynchronizationService.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ public function getAllObjectsFromApi(Synchronization $synchronization, ?bool $is
554554
$objects = array_merge($objects, $this->getAllObjectsFromArray($body, $synchronization));
555555
}
556556

557-
if ($useNextEndpoint === false) {
557+
if ($useNextEndpoint === false && $synchronization->usesPagination() === true) {
558558
do {
559559
$config = $this->getNextPage(config: $config, sourceConfig: $sourceConfig, currentPage: $currentPage);
560560
$response = $this->callService->call(source: $source, endpoint: $endpoint, method: 'GET', config: $config)->getResponse();

0 commit comments

Comments
 (0)