-
Notifications
You must be signed in to change notification settings - Fork 0
Synchronization code and notifications #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4baf8ab
9e37d5b
76788b9
7e2d951
f0157ca
d685549
1412230
4487cd5
6cb974a
e347b94
51acdf1
7812fa4
8b6ac08
8b741c4
6cd053e
0ab4521
046f554
cb3c2b8
dfef965
4d97d5f
efd6c9a
2dd91fc
05c15d8
df2fced
d6b3ef2
8bb4d78
138d1a7
868ed7e
fd91f99
6e81f5d
d0cd60a
ded5511
eec1b1d
46eb04a
a5c5ce3
f1a7474
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"title": "Sync Cases from VrijBRP", | ||
"$id": "https://commongateway.nl/action/vrijbrp.synczaken.action.json", | ||
"$schema": "https://docs.commongateway.nl/schemas/Action.schema.json", | ||
"version": "0.0.1", | ||
"listens": [ | ||
"vrijbrp.zaken.sync" | ||
], | ||
"throws": [], | ||
"conditions": { | ||
"==": [ | ||
1, | ||
1 | ||
] | ||
}, | ||
"class": "CommonGateway\\VrijBRPToZGWBundle\\ActionHandler\\SynchronizeCollectionHandler", | ||
"configuration": { | ||
"source": "https://vrijbrp.nl/source/vrijbrp.dossiers.source.json", | ||
"schema": "https://vng.opencatalogi.nl/schemas/zrc.zaak.schema.json", | ||
"mapping": "https://commongateway.nl/mapping/vrijbrp.dossierToZaak.mapping.json", | ||
"endpoint": "/api/v1/dossiers/search", | ||
"idField": "dossierId", | ||
"resultsPath": "result.content", | ||
"method": "POST", | ||
"body": { | ||
"types": [ | ||
"intra_mun_relocation", | ||
"inter_mun_relocation" | ||
] | ||
} | ||
}, | ||
"isLockable": false, | ||
"isEnabled": true | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"title": "CreateCaseNotification", | ||
"$id": "https://commongateway.nl/action/vrijbrp.createCaseNotification.action.json", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe use vrijbrp.nl here instead |
||
"$schema": "https://docs.commongateway.nl/schemas/Action.schema.json", | ||
"version": "0.0.1", | ||
"description": "This is an example Action. This action is triggered when commongateway.object.create event is thrown and the data (object) of the event has entity = https://example.com/schema/example.schema.json. In order for this condition to work the ref https://example.com/schema/example.schema.json has to be translated to an id, see installation.json['actions']['fixConfigRef'] for how to do this.", | ||
"listens": [ | ||
"commongateway.object.post.create" | ||
], | ||
"conditions": | ||
{ | ||
"==": [ | ||
{ | ||
"var": "entity.reference" | ||
}, "https://vng.opencatalogi.nl/schemas/zrc.zaak.schema.json" | ||
] | ||
}, | ||
"class": "CommonGateway\\VrijBRPToZGWBundle\\ActionHandler\\NotificationCaseHandler", | ||
"configuration": { | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"title": "CreateStatusNotification", | ||
"$id": "https://commongateway.nl/action/vrijbrp.createStatusNotification.action.json", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe use vrijbrp.nl here instead |
||
"$schema": "https://docs.commongateway.nl/schemas/Action.schema.json", | ||
"version": "0.0.1", | ||
"description": "This is an example Action. This action is triggered when commongateway.object.create event is thrown and the data (object) of the event has entity = https://example.com/schema/example.schema.json. In order for this condition to work the ref https://example.com/schema/example.schema.json has to be translated to an id, see installation.json['actions']['fixConfigRef'] for how to do this.", | ||
"listens": [ | ||
"commongateway.object.post.create" | ||
], | ||
"conditions": | ||
{ | ||
"==": [ | ||
{ | ||
"var": "entity.reference" | ||
}, "https://vng.opencatalogi.nl/schemas/zrc.status.schema.json" | ||
] | ||
}, | ||
"class": "CommonGateway\\VrijBRPToZGWBundle\\ActionHandler\\NotificationUpdateHandler", | ||
"configuration": { | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"title": "DossierToZaakDetail", | ||
"$id": "https://commongateway.nl/mapping/vrijbrp.dossierToZaakDetail.mapping.json", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe use vrijbrp.nl here instead |
||
"$schema": "https://docs.commongateway.nl/schemas/Mapping.schema.json", | ||
"version": "0.0.1", | ||
"passTrough": false, | ||
"mapping": { | ||
"_sourceId": "dossier.dossierId", | ||
"identificatie": "dossier.dossierId", | ||
"omschrijving": "dossier.description", | ||
"bronorganisatie": "bronorganisatie", | ||
"verantwoordelijkeOrganisatie": "bronorganisatie", | ||
"zaaktype": "zaaktypeUrl", | ||
"registratiedatum": "dossier.entryDateTime", | ||
"startdatum": "startDate", | ||
"rollen": "[{% if declarant.bsn|default %}{% set bsnArray = {'bsn': declarant.bsn, 'dossierId': dossier.dossierId} %}{% if roltypeUrl|default %}{% set bsnArray = bsnArray|merge({'roltypeUrl': roltypeUrl}) %}{% endif %}{{ map('https:\/\/commongateway.nl\/mapping\/vrijbrp.bsnToRol.mapping.json', bsnArray)|json_encode }}{% endif %}]", | ||
"zaakinformatieobjecten": "[{% if documents|default %}{% set index = 0 %}{% for document in documents %}{% if index > 0 %}, {% endif %}{% if bronorganisatie|default %}{% set document = document|merge({'bronorganisatie': bronorganisatie}) %}{% endif %}{% if informatieobjecttypeUrl|default %}{% set document = document|merge({'informatieobjecttypeUrl': informatieobjecttypeUrl}) %}{% endif %}{{ map('https:\/\/commongateway.nl\/mapping\/vrijbrp.documentToZaakInformatieObject.mapping.json', document)|json_encode }}{% set index = index + 1 %}{% endfor %}{% endif %}]", | ||
"status": "{% if dossier.status|default %}{% if dossier.dossierId|default %}{% set status = dossier.status|merge({'dossierId': dossier.dossierId}) %}{% else %}{% set status = dossier.status %}{% endif %}{{ map('https:\/\/commongateway.nl\/mapping\/vrijbrp.statusToZGWStatus.mapping.json', status)|json_encode }}{% endif %}", | ||
"eigenschappen": "[{\"naam\": \"VERHUISDATUM\", \"waarde\": \"{{ dossier.startDate }}\", \"eigenschap\": {\"_sourceId\": \"VERHUISDATUM\", \"naam\": \"VERHUISDATUM\"}},{\"naam\": \"STRAATNAAM_NIEUW\", \"waarde\": \"{{ newAddress.street }}\", \"eigenschap\": {\"_sourceId\": \"STRAATNAAM_NIEUW\", \"naam\": \"STRAATNAAM_NIEUW\"}},{\"naam\": \"HUISNUMMER_NIEUW\", \"waarde\": \"{{ newAddress.houseNumber }}\", \"eigenschap\": {\"_sourceId\": \"HUISNUMMER_NIEUW\", \"naam\": \"HUISNUMMER_NIEUW\"}},{\"naam\": \"HUISLETTER_NIEUW\", \"waarde\": \"{{ newAddress.houseLetter }}\", \"eigenschap\": {\"_sourceId\": \"HUISLETTER_NIEUW\", \"naam\": \"HUISLETTER_NIEUW\"}},{\"naam\": \"TOEVOEGINGHUISNUMMER_NIEUW\", \"waarde\": \"{{ newAddress.houseNumberAddition }}\", \"eigenschap\": {\"_sourceId\": \"TOEVOEGINGHUISNUMMER_NIEUW\", \"naam\": \"TOEVOEGINGHUISNUMMER_NIEUW\"}},{\"naam\": \"POSTCODE_NIEUW\", \"waarde\": \"{{ newAddress.postalCode }}\", \"eigenschap\": {\"_sourceId\": \"POSTCODE_NIEUW\", \"naam\": \"POSTCODE_NIEUW\"}},{\"naam\": \"WOONPLAATS_NIEUW\", \"waarde\": \"{{ newAddress.residence }}\", \"eigenschap\": {\"_sourceId\": \"WOONPLAATS_NIEUW\", \"naam\": \"WOONPLAATS_NIEUW\"}},{% if newAddress.mainOccupant|default and newAddress.mainOccupant.bsn|default %}{\"naam\": \"BSN_HOOFDBEWONER\", \"waarde\": \"{{ newAddress.mainOccupant.bsn }}\", \"eigenschap\": {\"_sourceId\": \"BSN_HOOFDBEWONER\", \"naam\": \"BSN_HOOFDBEWONER\"}},{% endif %}{% if previousMunicipality.code|default %}{\"naam\": \"GEMEENTECODE\", \"waarde\": \"{{ previousMunicipality.code }}\", \"eigenschap\": {\"_sourceId\": \"GEMEENTECODE\", \"naam\": \"GEMEENTECODE\"}},{% endif %}{% set index = 0 %}{% for relocator in relocators %}{\"naam\": \"MEEVERHUIZENDE_GEZINSLEDEN.MEEVERHUIZEND_GEZINSLID.{{ index }}.BSN\", \"waarde\": \"{{ relocator.bsn }}\", \"eigenschap\": {\"_sourceId\": \"MEEVERHUIZENDE_GEZINSLEDEN.MEEVERHUIZEND_GEZINSLID.{{ index }}.BSN\", \"naam\": \"MEEVERHUIZENDE_GEZINSLEDEN.MEEVERHUIZEND_GEZINSLID.{{ index }}.BSN\"}},{\"naam\": \"MEEVERHUIZENDE_GEZINSLEDEN.MEEVERHUIZEND_GEZINSLID.{{ index }}.ROL\", \"waarde\": \"{{ relocator.declarationType }}\", \"eigenschap\": {\"_sourceId\": \"MEEVERHUIZENDE_GEZINSLEDEN.MEEVERHUIZEND_GEZINSLID.{{ index }}.ROL\", \"naam\": \"MEEVERHUIZENDE_GEZINSLEDEN.MEEVERHUIZEND_GEZINSLID.{{ index }}.ROL\"}},{% endfor %}{\"naam\": \"AANTAL_PERS_NIEUW_ADRES\", \"waarde\": \"{{ newAddress.numberOfResidents }}\", \"eigenschap\": {\"_sourceId\": \"AANTAL_PERS_NIEUW_ADRES\", \"naam\": \"AANTAL_PERS_NIEUW_ADRES\"}}]" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks weird / not right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not an optimal mapping, that I grant you, but this is tested against the eigenschappen we have in the current SimXML to ZGW bundle |
||
}, | ||
"cast": { | ||
"_sourceId": "unsetIfValue==dossierId", | ||
"identificatie": "unsetIfValue==dossierId", | ||
"omschrijving": "unsetIfValue==description", | ||
"bronorganisatie": "unsetIfValue==bronorganisatie", | ||
"verantwoordelijkeOrganisatie": "unsetIfValue==bronorganisatie", | ||
"zaaktype": "unsetIfValue==zaaktypeUrl", | ||
"registratiedatum": "unsetIfValue==entryDateTime", | ||
"startdatum": "unsetIfValue==startDate", | ||
"rollen": "jsonToArray", | ||
"zaakinformatieobjecten": "jsonToArray", | ||
"status": "jsonToArray", | ||
"eigenschappen": "jsonToArray" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
Check failure on line 2 in src/ActionHandler/NotificationCaseHandler.php
|
||
namespace CommonGateway\VrijBRPToZGWBundle\ActionHandler; | ||
|
||
use CommonGateway\VrijBRPToZGWBundle\Service\NewSynchronizationService; | ||
use CommonGateway\VrijBRPToZGWBundle\Service\VrijBrpService; | ||
use CommonGateway\CoreBundle\ActionHandler\ActionHandlerInterface; | ||
/** | ||
* Handler for firing notifications for new cases. | ||
* | ||
* @author Robert Zondervan, Barry Brands, Ruben van der Linde | ||
* @license EUPL<github.com/ConductionNL/contactcatalogus/blob/master/LICENSE.md> | ||
* | ||
* @category ActionHandler | ||
*/ | ||
class NotificationCaseHandler implements ActionHandlerInterface | ||
{ | ||
|
||
|
||
/** | ||
* The constructor. | ||
* | ||
* @param VrijBrpService $vrijBrpService The VrijBRP Service | ||
*/ | ||
public function __construct( | ||
private readonly VrijBrpService $vrijBrpService, | ||
) { | ||
|
||
}//end __construct() | ||
|
||
|
||
/** | ||
* This function returns the requered configuration as a [json-schema](https://json-schema.org/) array. | ||
* | ||
* @throws array a [json-schema](https://json-schema.org/) that this action should comply to | ||
* @return array The default configuration options of this action handler. | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing @return tag in function comment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has been updated, but somehow Github does not show (@MWest2020 ) |
||
public function getConfiguration(): array | ||
{ | ||
return [ | ||
'$id' => 'https://commongateway.nl/ActionHandler/SynchronizationCollectionHandler.ActionHandler.json', | ||
'$schema' => 'https://docs.commongateway.nl/schemas/ActionHandler.schema.json', | ||
'title' => 'SynchronizationCollectionHandler', | ||
'description' => '', | ||
'required' => [], | ||
'properties' => [], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing properties in Handler here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This action does not take configuration |
||
]; | ||
|
||
}//end getConfiguration() | ||
|
||
|
||
/** | ||
* Run the actual business logic in the appropriate server. | ||
* | ||
* @param array $data The data from the call | ||
* @param array $configuration The configuration of the action | ||
* | ||
* @return array The updated data array | ||
*/ | ||
public function run(array $data, array $configuration): array | ||
{ | ||
return $this->vrijBrpService->createCaseNotification($data, $configuration); | ||
|
||
}//end run() | ||
|
||
|
||
}//end class |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
Check failure on line 2 in src/ActionHandler/NotificationUpdateHandler.php
|
||
namespace CommonGateway\VrijBRPToZGWBundle\ActionHandler; | ||
|
||
use CommonGateway\VrijBRPToZGWBundle\Service\NewSynchronizationService; | ||
use CommonGateway\VrijBRPToZGWBundle\Service\VrijBrpService; | ||
use CommonGateway\CoreBundle\ActionHandler\ActionHandlerInterface; | ||
|
||
/** | ||
* Handler for firing notifications for new statuses. | ||
* | ||
* @author Robert Zondervan, Barry Brands, Ruben van der Linde | ||
* @license EUPL<github.com/ConductionNL/contactcatalogus/blob/master/LICENSE.md> | ||
* | ||
* @category ActionHandler | ||
*/ | ||
class NotificationUpdateHandler implements ActionHandlerInterface | ||
{ | ||
|
||
|
||
/** | ||
* The constructor. | ||
* | ||
* @param VrijBrpService $vrijBrpService The VrijBRP Service | ||
*/ | ||
public function __construct( | ||
private readonly VrijBrpService $vrijBrpService, | ||
) { | ||
|
||
}//end __construct() | ||
|
||
|
||
/** | ||
* This function returns the requered configuration as a [json-schema](https://json-schema.org/) array. | ||
* | ||
* @throws array a [json-schema](https://json-schema.org/) that this action should comply to | ||
* @return array The default configuration options of this action handler. | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing @return tag in function comment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has been updated, but somehow Github does not show (@MWest2020 ) |
||
public function getConfiguration(): array | ||
{ | ||
return [ | ||
'$id' => 'https://commongateway.nl/ActionHandler/SynchronizationCollectionHandler.ActionHandler.json', | ||
'$schema' => 'https://docs.commongateway.nl/schemas/ActionHandler.schema.json', | ||
'title' => 'SynchronizationCollectionHandler', | ||
'description' => '', | ||
'required' => [], | ||
'properties' => [], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing properties in Handler here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This action does not take configuration as of yet |
||
]; | ||
|
||
}//end getConfiguration() | ||
|
||
|
||
/** | ||
* Run the actual business logic in the appropriate server. | ||
* | ||
* @param array $data The data from the call | ||
* @param array $configuration The configuration of the action | ||
* | ||
* @return array The updated data array. | ||
*/ | ||
public function run(array $data, array $configuration): array | ||
{ | ||
return $this->vrijBrpService->createStatusNotification($data, $configuration); | ||
|
||
}//end run() | ||
|
||
|
||
}//end class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe use vrijbrp.nl here instead
different domain than mappings from https://github.com/CommonGateway/VrijBRPToZGWBundle/pull/1/files
might be better to be consistent with these references
https://github.com/CommonGateway/VrijBRPToZGWBundle/pull/2/files#r1787422666
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the domain from https://github.com/CommonGateway/VrijBRPToZGWBundle/pull/1/files, that's exactly why I changed the domains to commongateway.nl