Skip to content

Commit

Permalink
Merge pull request #121 from ConductionNL/development
Browse files Browse the repository at this point in the history
Dev to main
  • Loading branch information
bbrands02 authored Dec 5, 2024
2 parents 24df305 + f61236c commit 368bba4
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@
"category": "d.woo_x005f_categorie",
"published": "{% if d['woo_x005f_publicatiedatum']|default %}{{ d['woo_x005f_publicatiedatum']|date('Y-m-d') }}{% endif %}",
"modified": "d.vti_x005f_nexttolasttimemodified",
"attachments": "[ {% for file in fileUrls %} { {% if file['Name']|default %}\"title\": \"{{ file['Name'] }}\",{% endif %}{% if file['d']['document_x005f_label']|default %}\"labels\": [\"{{ file['d']['document_x005f_label'] }}\"],{% endif %}{% if file['__metadata']['uri']|default %}\"downloadUrl\": {\"downloadUrl\": \"{{ file['__metadata']['uri']~'/$value' }}\", \"source\": \"1\"}{% endif %} }{{ loop.last ? '' : ',' }} {% endfor %} ]",
"status": "{% if d['woo_x005f_publicatiedatum']|default %}Published{% else %}Concept{% endif %}",
"catalog": ""
"attachments": "[ {% for file in fileUrls %} { {% if file['Name']|default %}\"title\": \"{{ file['Name'] }}\",{% endif %}{% if file['d']['document_x005f_label']|default %}\"labels\": [\"{{ file['d']['document_x005f_label'] }}\"],{% endif %}{% if file['__metadata']['uri']|default %}\"downloadUrl\": {\"accessUrl\": \"{{ file['__metadata']['uri']~'/$value' }}\", \"source\": \"1\"}{% endif %} }{{ loop.last ? '' : ',' }} {% endfor %} ]",
"status": "Concept",
"catalog": "",
"publicationType": ""
},
"unset": [],
"cast": {
"title": "unsetIfValue==d.woo_x005f_titel",
"description": "unsetIfValue==d.woo_x005f_beschrijving",
"summary": "unsetIfValue==d.woo_x005f_samenvatting",
"category": "unsetIfValue==d.woo_x005f_categorie",
"published": "unsetIfValue==d.woo_x005f_publicatiedatum",
"published": "unsetIfValue==",
"modified": "unsetIfValue==d.vti_x005f_nexttolasttimemodified",
"attachments": "jsonToArray"
"attachments": "jsonToArray",
"publicationType": "unsetIfValue==",
"catalog": "unsetIfValue=="
},
"passThrough": false
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
{
"name": "Xxllnc suite to Publication",
"description": "",
"version": "",
"reference": "",
"version": "0.0.1",
"mapping": {
"title": "omschrijving",
"summary": "zaaktypeomschrijving",
"description": "zaaktypeomschrijving",
"published" : "{% if startdatum|default %}{{ startdatum|date('Y-m-d') }}{% endif %}",
"modified" : "{{ 'now'|date(H:i:sTm-d-Y') }}",
"status": "{% if startdatum|default %}Published{% else %}Concept{% endif %}",
"catalog": ""
},
"unset": [],
"cast": {
"title": "unsetIfValue==omschrijving",
"summary": "unsetIfValue==zaaktypeomschrijving",
"description": "unsetIfValue==zaaktypeomschrijving",
"published" : "unsetIfValue=="
"title": "omschrijving",
"summary": "zaaktypeomschrijving",
"description": "zaaktypeomschrijving",
"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 %}",
"published": "startdatum",
"modified": "{{ 'now'|date('H:i:sTm-d-Y') }}",
"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 %}]",
"status": "Concept"
},
"unset": [
""
],
"cast": {
"title": "unsetIfValue==omschrijving",
"summary": "unsetIfValue==zaaktypeomschrijving",
"description": "unsetIfValue==zaaktypeomschrijving",
"category": "unsetIfValue==",
"published": "unsetIfValue==startdatum",
"attachments": "jsonToArray"
},
"passThrough": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@
"sourceHash": "",
"sourceTargetMapping": "1",
"sourceConfig": {
"idPosition": "id",
"resultsPosition": "results",
"endpoint": "/tlb/zaaksysteem/api/v1/zaken",
"headers": [],
"query.startdatum__gte": "2024-07-06",
"query.einddatum__lt": "2024-08-01"
},
"idPosition": "identificatie",
"resultsPosition": "results",
"endpoint": "\/tlb\/zaaksysteem\/api\/v1\/zaken",
"headers": [],
"query.startdatum__gte": "2024-08-01",
"query.einddatum__lt": "2025-01-01",
"usesPagination": "false",
"extraDataConfigs.0.staticEndpoint": "/tlb/zaaksysteem/api/v1/zaken/{{ originId }}/informatieobjecten",
"extraDataConfigs.0.mergeExtraData": "true",
"extraDataConfigs.0.keyToSetExtraData": "files",
"extraDataConfigs.0.resultsLocation": "results",
"extraDataConfigs.0.extraDataConfigPerResult.staticEndpoint": "/tlb/zaaksysteem/api/v1/informatieobjecten/{{ originId }}"
},
"targetId": "1/1",
"targetType": "register/schema"
}
2 changes: 2 additions & 0 deletions lib/Cron/ActionTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ public function run($argument)
}
}

$this->jobLogMapper->update(entity: $jobLog);

// Let's report back about what we have just done
return $jobLog;
}
Expand Down
15 changes: 15 additions & 0 deletions lib/Db/Synchronization.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ public function __construct() {
$this->addType(fieldName:'followUps', type: 'json');
}

/**
* Checks through sourceConfig if the source of this sync uses pagination
*
* @return bool true if its uses pagination
*/
public function usesPagination(): bool
{
if (isset($this->sourceConfig['usesPagination']) === true && ($this->sourceConfig['usesPagination'] === false || $this->sourceConfig['usesPagination'] === 'false')) {
return false;
}

// By default sources use basic pagination.
return true;
}

public function getJsonFields(): array
{
return array_keys(
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/SynchronizationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ public function getAllObjectsFromApi(Synchronization $synchronization, ?bool $is
$objects = array_merge($objects, $this->getAllObjectsFromArray($body, $synchronization));
}

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

0 comments on commit 368bba4

Please sign in to comment.