6
6
use CommonGateway \VrijBRPToZGWBundle \Service \VrijBrpService ;
7
7
use CommonGateway \CoreBundle \ActionHandler \ActionHandlerInterface ;
8
8
9
+ /**
10
+ * Handler for synchronizing collections from external sources.
11
+ *
12
+ * @author Robert Zondervan, Barry Brands, Ruben van der Linde
13
+ * @license EUPL<github.com/ConductionNL/contactcatalogus/blob/master/LICENSE.md>
14
+ *
15
+ * @category ActionHandler
16
+ */
9
17
class SynchronizeCollectionHandler implements ActionHandlerInterface
10
18
{
11
19
12
20
13
21
/**
14
- * @param NewSynchronizationService $synchronizationService
22
+ * @param NewSynchronizationService $syncService
23
+ * @param VrijBrpService $vrijBrpService
15
24
*/
16
25
public function __construct (
17
- private readonly NewSynchronizationService $ synchronizationService ,
18
- private readonly VrijBrpService $ vrijBrpService ,
19
- ) {
26
+ private readonly NewSynchronizationService $ syncService ,
27
+ private readonly VrijBrpService $ vrijBrpService ,
28
+ )
29
+ {
20
30
21
31
}//end __construct()
22
32
@@ -25,16 +35,63 @@ public function __construct(
25
35
* This function returns the requered configuration as a [json-schema](https://json-schema.org/) array.
26
36
*
27
37
* @throws array a [json-schema](https://json-schema.org/) that this action should comply to
38
+ *
39
+ * @return array The configuration of the handler.
28
40
*/
29
41
public function getConfiguration (): array
30
42
{
31
43
return [
32
- '$id ' => 'https://commongateway.nl/ActionHandler/SynchronizationCollectionHandler.ActionHandler.json ' ,
33
- '$schema ' => 'https://docs.commongateway.nl/schemas/ActionHandler.schema.json ' ,
34
- 'title ' => 'SynchronizationCollectionHandler ' ,
44
+ '$id ' => 'https://commongateway.nl/ActionHandler/SynchronizationCollectionHandler.ActionHandler.json ' ,
45
+ '$schema ' => 'https://docs.commongateway.nl/schemas/ActionHandler.schema.json ' ,
46
+ 'title ' => 'SynchronizationCollectionHandler ' ,
35
47
'description ' => '' ,
36
- 'required ' => [],
37
- 'properties ' => [],
48
+ 'required ' => ['source ' , 'schema ' , 'endpoint ' , 'idField ' , 'resultsPath ' ],
49
+ 'properties ' => [
50
+ 'source ' => [
51
+ 'type ' => 'string ' ,
52
+ 'description ' => 'The source where the publication belongs to. ' ,
53
+ 'example ' => 'https://commongateway.woo.nl/source/buren.openwoo.source.json ' ,
54
+ 'required ' => true ,
55
+ ],
56
+ 'schema ' => [
57
+ 'type ' => 'string ' ,
58
+ 'description ' => 'The publication schema. ' ,
59
+ 'example ' => 'https://commongateway.nl/woo.publicatie.schema.json ' ,
60
+ 'reference ' => 'https://commongateway.nl/woo.publicatie.schema.json ' ,
61
+ 'required ' => true ,
62
+ ], 'mapping ' => [
63
+ 'type ' => 'string ' ,
64
+ 'description ' => 'The mapping for open woo to publication. ' ,
65
+ 'example ' => 'https://commongateway.nl/mapping/woo.openWooToWoo.mapping.json ' ,
66
+ 'reference ' => 'https://commongateway.nl/mapping/woo.openWooToWoo.mapping.json ' ,
67
+ 'required ' => false ,
68
+ ],
69
+ 'endpoint ' => [
70
+ 'type ' => 'string ' ,
71
+ 'description ' => 'The endpoint of the source. ' ,
72
+ 'example ' => '/wp-json/owc/openwoo/v1/items ' ,
73
+ 'required ' => true ,
74
+ ],
75
+ 'idField ' => [
76
+ 'type ' => 'string ' ,
77
+ 'description ' => 'Dot-array location of the field that contains the id ' ,
78
+ 'example ' => 'dossierId ' ,
79
+ 'required ' => true ,
80
+ ],
81
+ 'resultsPath ' => [
82
+ 'type ' => 'string ' ,
83
+ 'description ' => 'Dot-array location of the field that contains the results ' ,
84
+ 'example ' => 'dossierId ' ,
85
+ 'required ' => true ,
86
+ ],
87
+ 'body ' => [
88
+ 'type ' => 'array ' ,
89
+ 'description ' => 'Body that will be sent to the source if necessary. ' ,
90
+ 'example ' => 'dossierId ' ,
91
+ 'required ' => false ,
92
+ ],
93
+ ],
94
+
38
95
];
39
96
40
97
}//end getConfiguration()
@@ -43,7 +100,7 @@ public function getConfiguration(): array
43
100
/**
44
101
* Run the actual business logic in the appropriate server.
45
102
*
46
- * @param array $data The data from the call
103
+ * @param array $data The data from the call
47
104
* @param array $configuration The configuration of the action
48
105
*
49
106
* @return array
@@ -52,7 +109,7 @@ public function run(array $data, array $configuration): array
52
109
{
53
110
$ configuration = $ this ->vrijBrpService ->setVrijBRPDefaults ($ configuration );
54
111
55
- return $ this ->synchronizationService ->synchronizeCollectionHandler ($ data , $ configuration );
112
+ return $ this ->syncService ->synchronizeCollectionHandler ($ data , $ configuration );
56
113
57
114
}//end run()
58
115
0 commit comments