diff --git a/Installation/Action/openindex.woo.SyncTilburgCasesAction.action.json b/Installation/Action/openindex.woo.SyncTilburgCasesAction.action.json new file mode 100644 index 0000000..576ad9c --- /dev/null +++ b/Installation/Action/openindex.woo.SyncTilburgCasesAction.action.json @@ -0,0 +1,30 @@ +{ + "title" : "OpenIndex SyncTilburgCasesAction", + "$id" : "https://openwoo.app/openindex.woo.SyncTilburgCasesAction.action.json", + "$schema" : "https://docs.commongateway.nl/schemas/Action.schema.json", + "version" : "0.0.1", + "listens" : [ + "tilburg.openindex.default.listens" + ], + "configuration" : { + "oin" : "00000001001172773000", + "portalUrl" : "https://conductionnl.github.io/woo-website-tubbergen", + "source" : "https://openwoo.app/source/openindex.tilburg.zaaksysteem.source.json", + "schema" : "https://openwoo.app/schemas/publication.schema.json", + "mapping" : "https://openwoo.app/mapping/openindex.woo.tilburgCaseToWoo.mapping.json", + "organisatie" : "Gemeente Tilburg", + "caseIndex" : "/v1/zaken", + "caseDetail" : "/v1/zaken/:identificatie/informatieobjecten", + "caseDocument" : "/v1/informatieobjecten/:identificatie", + "fileEndpoint" : "https://openwoo.app/openindex.woo.ViewFile.endpoint.json", + "rateLimitStart": "2024-06-06", + "rateLimitEnd": "2024-08-01" + }, + "conditions" : { + "==" : [ + 1, + 1 + ] + }, + "class" : "CommonGateway\\OpenIndex\\ActionHandler\\SyncTilburgCasesHandler" +} diff --git a/Installation/Action/openindex.woo.viewFileAction.action.json b/Installation/Action/openindex.woo.viewFileAction.action.json new file mode 100644 index 0000000..0a45b8e --- /dev/null +++ b/Installation/Action/openindex.woo.viewFileAction.action.json @@ -0,0 +1,15 @@ +{ + "title": "OpenIndex ViewFileAction", + "$id": "https://commongateway.nl/openindex.woo.ViewFileAction.action.json", + "$schema": "https://docs.commongateway.nl/schemas/Action.schema.json", + "version": "0.0.1", + "listens": ["woo.openindex.file.view"], + "configuration": { + "schemaThisFileBelongsTo": ["https://openwoo.app/schemas/publication.schema.json", "https://openwoo.app/schemas/attachment.schema.json"] + }, + "conditions": + { + "==": [1, 1] + }, + "class": "CommonGateway\\OpenIndex\\ActionHandler\\ViewFileHandler" +} diff --git a/Installation/Cronjob/openindex.tilburg.default.cronjob.json b/Installation/Cronjob/openindex.tilburg.default.cronjob.json new file mode 100644 index 0000000..dd052ff --- /dev/null +++ b/Installation/Cronjob/openindex.tilburg.default.cronjob.json @@ -0,0 +1,12 @@ +{ + "title": "OpenIndex Tilburg default cronjob", + "$id": "https://openwoo.app/openindex.tilburg.default.cronjob.json", + "$schema": "https://docs.commongateway.nl/schemas/Cronjob.schema.json", + "version": "0.0.1", + "description": "This cronjob fires the OpenIndex Tilburg actions every night at 03.00", + "crontab": "0 3 * * *", + "throws": [ + "tilburg.openindex.default.listens" + ], + "isEnabled": false +} diff --git a/Installation/Mapping/openindex.woo.tilburgCaseToWoo.mapping.json b/Installation/Mapping/openindex.woo.tilburgCaseToWoo.mapping.json new file mode 100644 index 0000000..153f28e --- /dev/null +++ b/Installation/Mapping/openindex.woo.tilburgCaseToWoo.mapping.json @@ -0,0 +1,27 @@ +{ + "title" : "OpenIndex TilburgCaseToWoo", + "$id" : "https://openwoo.app/mapping/openindex.woo.tilburgCaseToWoo.mapping.json", + "$schema" : "https://docs.commongateway.nl/schemas/Mapping.schema.json", + "version" : "0.0.1", + "passTrough" : false, + "mapping" : { + "_sourceId" : "identificatie", + "reference" : "identificatie", + "title" : "omschrijving", + "summary" : "zaaktypeomschrijving", + "description" : "zaaktypeomschrijving", + "image" : "", + "category" : "Woo-verzoeken en -besluiten", + "portal" : "", + "publicationDate" : "startdatum", + "featured" : "false", + "schema" : "https://openwoo.app/schemas/metadata.tooi_verzoeken_en_besluiten.schema.json", + "attachments" : "[]", + "data.datumBesluit" : "startdatum", + "data.datumOntvangst": "startdatum" + }, + "cast" : { + "featured": "bool", + "attachments" : "jsonToArray" + } +} diff --git a/Installation/Mapping/openindex.woo.tilburgCustomFields.mapping.json b/Installation/Mapping/openindex.woo.tilburgCustomFields.mapping.json new file mode 100644 index 0000000..c240fcc --- /dev/null +++ b/Installation/Mapping/openindex.woo.tilburgCustomFields.mapping.json @@ -0,0 +1,11 @@ +{ + "title" : "OpenIndex TilburgCustomFields", + "$id" : "https://openwoo.app/mapping/openindex.woo.tilburgCustomFields.mapping.json", + "$schema" : "https://docs.commongateway.nl/schemas/Mapping.schema.json", + "version" : "0.0.1", + "passTrough" : false, + "mapping" : { + "_sourceId" : "id", + "metadata.statuscode" : "statuscode" + } +} diff --git a/Installation/Mapping/openindex.woo.tilburgDocumentSetSourceId.mapping.json b/Installation/Mapping/openindex.woo.tilburgDocumentSetSourceId.mapping.json new file mode 100644 index 0000000..c071ab5 --- /dev/null +++ b/Installation/Mapping/openindex.woo.tilburgDocumentSetSourceId.mapping.json @@ -0,0 +1,11 @@ +{ + "title" : "OpenIndex TilburgDocumentSetSourceId", + "$id" : "https://openwoo.app/mapping/openindex.woo.tilburgDocumentSetSourceId.schema.json", + "$schema" : "https://docs.commongateway.nl/schemas/Mapping.schema.json", + "version" : "0.0.1", + "passTrough" : false, + "mapping" : { + "_sourceId" : "identificatie", + "titel" : "Temporarily title so a object gets created for file fetching and url genering." + } +} diff --git a/Installation/Mapping/openindex.woo.tilburgDocumentToAttachment.mapping.json b/Installation/Mapping/openindex.woo.tilburgDocumentToAttachment.mapping.json new file mode 100644 index 0000000..9ede324 --- /dev/null +++ b/Installation/Mapping/openindex.woo.tilburgDocumentToAttachment.mapping.json @@ -0,0 +1,14 @@ +{ + "title" : "OpenIndex tilburgDocumentToAttachment", + "$id" : "https://openwoo.app/mapping/openindex.woo.tilburgDocumentToAttachment.mapping.json", + "$schema" : "https://docs.commongateway.nl/schemas/Mapping.schema.json", + "version" : "0.0.1", + "passTrough" : false, + "mapping" : { + "_sourceId" : "identificatie", + "id" : "identificatie", + "title" : "titel", + "accessURL" : "link", + "type" : "formaat" + } +} diff --git a/Installation/Schema/Attachment.schema.json b/Installation/Schema/Attachment.schema.json index 763f664..59ff4f0 100644 --- a/Installation/Schema/Attachment.schema.json +++ b/Installation/Schema/Attachment.schema.json @@ -47,7 +47,7 @@ "accessURL": { "type": "string", "format": "url", - "description": "The URL to the original document, this URL should be accessible to Open Index. When there is an ‘POST` or `PUT` request to Open Index then Open Index wil try to get the original file from the URL and use it to fill thedocumentText, type, extensionand size` properties", + "description": "The URL to the original document, this URL should be accessible to Open Index. When there is an ‘POST` or `PUT` request to Open Index then Open Index wil try to get the original file from the URL and use it to fill the documentText, type, extension and size` properties", "required": true }, "downloadURL": { @@ -104,7 +104,7 @@ }, "license": { "type": "string" - }, + } }, "required": [ "url" diff --git a/Installation/Schema/Metadata.tooi_klachtoordelen.schema.json b/Installation/Schema/Metadata.tooi_klachtoordelen.schema.json index 277095e..fd61d51 100644 --- a/Installation/Schema/Metadata.tooi_klachtoordelen.schema.json +++ b/Installation/Schema/Metadata.tooi_klachtoordelen.schema.json @@ -2,7 +2,7 @@ "title": "Metadata TOOI klachtoordelen", "$id": "https://openwoo.app/schemas/metadata.tooi_klachtoordelen.schema.json", "$schema": "https://docs.commongateway.nl/schemas/Entity.schema.json", - "version": "0.0.1", + "version": "0.0.2", "type": "object", "description": "Schriftelijke oordelen in klachtprocedures.", "properties": { @@ -47,7 +47,7 @@ }, "termijnoverschrijding": { "type": "string", - "format": "ISO-8601", + "format": "date-time", "description":"Een (evenuteel) overschrijding van het beantwoordings termijn termijn" }, "organisatieonderdeel": { diff --git a/Installation/Schema/Metadata.tooi_verzoeken_en_besluiten.schema.json b/Installation/Schema/Metadata.tooi_verzoeken_en_besluiten.schema.json index 90198ad..c92c688 100644 --- a/Installation/Schema/Metadata.tooi_verzoeken_en_besluiten.schema.json +++ b/Installation/Schema/Metadata.tooi_verzoeken_en_besluiten.schema.json @@ -1,8 +1,8 @@ { "title": "Metadata TOOI Woo-verzoeken en -besluiten", - "$id": "https://openwoo.app/schemas/metadata.tooi_wetten_en_algemeen_verbindende_voorschriften.schema.json", + "$id": "https://openwoo.app/schemas/metadata.tooi_verzoeken_en_besluiten.schema.json", "$schema": "https://docs.commongateway.nl/schemas/Entity.schema.json", - "version": "0.0.1", + "version": "0.0.2", "type": "object", "description": "Inhoud van schriftelijke Woo-verzoeken en besluiten daarop, inclusief verstrekte informatie.", "properties": { @@ -47,7 +47,7 @@ }, "termijnoverschrijding": { "type": "string", - "format": "ISO-8601", + "format": "date-time", "description":"Een (evenuteel) overschrijding van het beantwoordings termijn termijn" }, "values": { diff --git a/Installation/Source/openindex.tilburg.zaaksysteem.source.json b/Installation/Source/openindex.tilburg.zaaksysteem.source.json new file mode 100644 index 0000000..45392ea --- /dev/null +++ b/Installation/Source/openindex.tilburg.zaaksysteem.source.json @@ -0,0 +1,14 @@ +{ + "title" : "OpenIndex Tilburg Zaaksysteem", + "$id" : "https://openwoo.app/source/openindex.tilburg.zaaksysteem.source.json", + "$schema" : "https://docs.commongateway.nl/schemas/Gateway.schema.json", + "version" : "0.0.1", + "description" : "OpenIndex Tilburg Zaaksysteem api", + "location" : "https://secure1.acc.enable-u.cloud/tlb/zaaksysteem/api", + "headers" : { + "Accept" : "*/*", + "Host" : "localhost", + "Content-Type" : "application/json" + }, + "isEnabled" : true +} diff --git a/Installation/installation.json b/Installation/installation.json index b5dd627..eaf40bf 100644 --- a/Installation/installation.json +++ b/Installation/installation.json @@ -14,6 +14,16 @@ "path": "attachments", "methods": [], "version": "0.0.1" + }, + { + "$id": "https://openwoo.app/openindex.woo.ViewFile.endpoint.json", + "version": "0.0.1", + "reference": "https://openwoo.app/schemas/attachment.schema.json", + "path": "openindex-view-file", + "methods": ["GET"], + "throws": [ + "woo.openindex.file.view" + ] } ] } diff --git a/Resources/config/services.yaml b/Resources/config/services.yaml index b59d04d..5520609 100644 --- a/Resources/config/services.yaml +++ b/Resources/config/services.yaml @@ -13,16 +13,16 @@ services: - '../../src/DependencyInjection/' - '../../src/Entity/' - '../../src/Resources/' - - '../../src/OpenIndex.php' + - '../../src/OpenIndexExtension.php' # this config only applies to the services created by this file -# _instanceof: + _instanceof: # actionHandlers whose classes are instances of ActionHandlerInterface will be tagged automatically and set to public -# CommonGateway\OpenIndex\ActionHandler\ActionHandlerInterface: -# public: true -# tags: ['commongateway.action_handlers'] + CommonGateway\CoreBundle\ActionHandler\ActionHandlerInterface: + public: true + tags: ['commongateway.action_handlers'] # installers whose classes are instances of InstallerInterface will be tagged automatically and set to public -# CommonGateway\OpenIndex\Installer\InstallerInterface: -# public: true -# tags: ['commongateway.installer'] + CommonGateway\CoreBundle\Installer\InstallerInterface: + public: true + tags: ['commongateway.installer'] diff --git a/composer.json b/composer.json index 0a413d8..eb17bf1 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "minimum-stability": "dev", "require": { "php": ">=8.2", - "commongateway/corebundle": "^1.1.52 | <2.0" + "commongateway/corebundle": "^1.2.23 | <2.0" }, "require-dev": { "symfony/dependency-injection": "~3.4|~4.1|~5.0" diff --git a/docs/schema/Attachment.md b/docs/schema/Attachment.md index e68d880..8c62734 100644 --- a/docs/schema/Attachment.md +++ b/docs/schema/Attachment.md @@ -2,7 +2,7 @@ An attachment object -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Attachment.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Attachment.svg) ## Properties @@ -14,13 +14,13 @@ An attachment object | summary | string | A short summary of the subject for the overview page | No | | description | string | An extensive description of the subject for display on the subject page | No | | labels | array | Possible labels on the attachment that are used to assess what kind of file it is | No | -| url | string | The URL to the original document, this URL should be accessible to Open Index. When there is an ‘POST` or `PUT` request to Open Index then Open Index wil try to get the original file from the URL and use it to fill the `documentText`,` type`, ` extension` and ` size` properties | Yes | -| content | string | The text from the original document, which is included in the search index to facilitate searching of documents. This value is automatically updated and thus cannot be set via the API | No | +| accessURL | string | The URL to the original document, this URL should be accessible to Open Index. When there is an ‘POST` or `PUT` request to Open Index then Open Index wil try to get the original file from the URL and use it to fill the documentText, type, extension and size` properties | No | +| downloadURL | string | The URL to download the document. | No | | type | string | The MIME type of the attachment, determined at the time of reading and recorded for display in the UI. This value is automatically updated and thus cannot be set via the API | No | | extension | string | The extension of the attachment, determined at the time of reading and recorded for display in the UI. This value is automatically updated and thus cannot be set via the API | No | | size | integer | The size of the attachment in bytes, determined at the time of reading and recorded for display in the UI. This value is automatically updated and thus cannot be set via the API | No | | anonymization | object | Whether the attachment is properly annonymized and the results there of | No | -| language | object | The language and language level of the object | No | +| languageObject | object | The language and language level of the object | No | | version_of | string | Is this attachment a version of another attachment, e.g. annonymized or pdf rendering of another document | No | | hash | string | **Generated** A file hash is essential for ensuring the uniqueness and integrity of files. It serves several critical purposes: @@ -36,3 +36,6 @@ Data Deduplication: In systems that store large amounts of data, file hashes hel Digital Signatures and Certificates: Hashes are integral to the functioning of digital signatures and certificates, which verify the identity of the sender and ensure that the file has not been altered. Overall, file hashes are a fundamental tool in data management and cybersecurity, ensuring that files remain unique, intact, and secure. | No | +| published | string | N/A | No | +| modified | string | N/A | No | +| license | string | N/A | No | diff --git a/docs/schema/Attachment.puml b/docs/schema/Attachment.puml index 488608c..c394c6a 100644 --- a/docs/schema/Attachment.puml +++ b/docs/schema/Attachment.puml @@ -10,14 +10,17 @@ class Attachment { + summary: string + description: string + labels: array - + url: string - + content: string + + accessURL: string + + downloadURL: string + type: string + extension: string + size: integer + anonymization: object - + language: object + + languageObject: object + version_of: string + hash: string + + published: string + + modified: string + + license: string } @enduml diff --git a/docs/schema/Index.md b/docs/schema/Index.md index c39b110..e06ef9b 100644 --- a/docs/schema/Index.md +++ b/docs/schema/Index.md @@ -2,7 +2,7 @@ An externally found index that can be used as a source in federative search queries -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Index.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Index.svg) ## Properties diff --git a/docs/schema/Metadata.oc_publiccode.md b/docs/schema/Metadata.oc_publiccode.md index 797c017..6c6f5cf 100644 --- a/docs/schema/Metadata.oc_publiccode.md +++ b/docs/schema/Metadata.oc_publiccode.md @@ -2,7 +2,7 @@ Adviezen over ontwerpen en andere onderwerpen van adviescolleges of -commissies, exclusief adviezen die betrekking hebben op individuele gevallen. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.oc_publiccode.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.oc_publiccode.svg) ## Properties diff --git a/docs/schema/Metadata.ods_agenda_item.md b/docs/schema/Metadata.ods_agenda_item.md index fd51af8..9d252f3 100644 --- a/docs/schema/Metadata.ods_agenda_item.md +++ b/docs/schema/Metadata.ods_agenda_item.md @@ -2,7 +2,7 @@ Adviezen over ontwerpen en andere onderwerpen van adviescolleges of -commissies, exclusief adviezen die betrekking hebben op individuele gevallen. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.ods_agenda_item.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.ods_agenda_item.svg) ## Properties diff --git a/docs/schema/Metadata.tooi_adviezen.md b/docs/schema/Metadata.tooi_adviezen.md index 9d04c92..56b8c48 100644 --- a/docs/schema/Metadata.tooi_adviezen.md +++ b/docs/schema/Metadata.tooi_adviezen.md @@ -2,7 +2,7 @@ Adviezen over ontwerpen en andere onderwerpen van adviescolleges of -commissies, exclusief adviezen die betrekking hebben op individuele gevallen. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.tooi_adviezen.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.tooi_adviezen.svg) ## Properties diff --git a/docs/schema/Metadata.tooi_agendas_en_besluitenlijsten_bestuurscolleges.md b/docs/schema/Metadata.tooi_agendas_en_besluitenlijsten_bestuurscolleges.md index 9c2309a..6a228e0 100644 --- a/docs/schema/Metadata.tooi_agendas_en_besluitenlijsten_bestuurscolleges.md +++ b/docs/schema/Metadata.tooi_agendas_en_besluitenlijsten_bestuurscolleges.md @@ -2,7 +2,7 @@ Agenda’s en besluitenlijsten van vergaderingen van diverse bestuurlijke organen. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.tooi_agendas_en_besluitenlijsten_bestuurscolleges.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.tooi_agendas_en_besluitenlijsten_bestuurscolleges.svg) ## Properties diff --git a/docs/schema/Metadata.tooi_bereikbaarheidsgegevens.md b/docs/schema/Metadata.tooi_bereikbaarheidsgegevens.md index e45ccdd..700c494 100644 --- a/docs/schema/Metadata.tooi_bereikbaarheidsgegevens.md +++ b/docs/schema/Metadata.tooi_bereikbaarheidsgegevens.md @@ -2,7 +2,7 @@ Bereikbaarheidsinformatie van bestuursorganen en hun organisatieonderdelen. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.tooi_bereikbaarheidsgegevens.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.tooi_bereikbaarheidsgegevens.svg) ## Properties diff --git a/docs/schema/Metadata.tooi_beschikkingen.md b/docs/schema/Metadata.tooi_beschikkingen.md index 80a1eb3..4796e0d 100644 --- a/docs/schema/Metadata.tooi_beschikkingen.md +++ b/docs/schema/Metadata.tooi_beschikkingen.md @@ -2,7 +2,7 @@ Beschikkingen, uitgezonderd specifieke categorieën. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.tooi_beschikkingen.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.tooi_beschikkingen.svg) ## Properties diff --git a/docs/schema/Metadata.tooi_bij_vertegenwoordigende_organen_ingekomen_stukken.md b/docs/schema/Metadata.tooi_bij_vertegenwoordigende_organen_ingekomen_stukken.md index ae8f45e..1539d7d 100644 --- a/docs/schema/Metadata.tooi_bij_vertegenwoordigende_organen_ingekomen_stukken.md +++ b/docs/schema/Metadata.tooi_bij_vertegenwoordigende_organen_ingekomen_stukken.md @@ -2,7 +2,7 @@ Ingekomen stukken bij diverse overheidsorganen, uitgezonderd bepaalde vertrouwelijke informatie of individuele gevallen. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.tooi_bij_vertegenwoordigende_organen_ingekomen_stukken.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.tooi_bij_vertegenwoordigende_organen_ingekomen_stukken.svg) ## Properties diff --git a/docs/schema/Metadata.tooi_convenanten.md b/docs/schema/Metadata.tooi_convenanten.md index d26b246..e0058ff 100644 --- a/docs/schema/Metadata.tooi_convenanten.md +++ b/docs/schema/Metadata.tooi_convenanten.md @@ -2,7 +2,7 @@ Convenanten. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.tooi_convenanten.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.tooi_convenanten.svg) ## Properties diff --git a/docs/schema/Metadata.tooi_jaarplannen_en_jaarverslagen.md b/docs/schema/Metadata.tooi_jaarplannen_en_jaarverslagen.md index 2e03509..d4d0bc4 100644 --- a/docs/schema/Metadata.tooi_jaarplannen_en_jaarverslagen.md +++ b/docs/schema/Metadata.tooi_jaarplannen_en_jaarverslagen.md @@ -2,7 +2,7 @@ Jaarplannen en jaarverslagen van bestuursorganen over hun taakuitvoering. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.tooi_jaarplannen_en_jaarverslagen.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.tooi_jaarplannen_en_jaarverslagen.svg) ## Properties diff --git a/docs/schema/Metadata.tooi_klachtoordelen.md b/docs/schema/Metadata.tooi_klachtoordelen.md index bee3581..8ec2c70 100644 --- a/docs/schema/Metadata.tooi_klachtoordelen.md +++ b/docs/schema/Metadata.tooi_klachtoordelen.md @@ -2,7 +2,7 @@ Schriftelijke oordelen in klachtprocedures. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.tooi_klachtoordelen.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.tooi_klachtoordelen.svg) ## Properties diff --git a/docs/schema/Metadata.tooi_onderzoeksrapporten.md b/docs/schema/Metadata.tooi_onderzoeksrapporten.md index 03cac4f..a2c8540 100644 --- a/docs/schema/Metadata.tooi_onderzoeksrapporten.md +++ b/docs/schema/Metadata.tooi_onderzoeksrapporten.md @@ -2,7 +2,7 @@ Onderzoeksrapporten opgesteld op verzoek van bestuursorganen die geen taakuitvoering zijn, gericht op organisatie of beleidsevaluatie. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.tooi_onderzoeksrapporten.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.tooi_onderzoeksrapporten.svg) ## Properties diff --git a/docs/schema/Metadata.tooi_ontwerpen_van_wet_en_regelgeving_met_adviesaanvraag.md b/docs/schema/Metadata.tooi_ontwerpen_van_wet_en_regelgeving_met_adviesaanvraag.md index 38b18b9..23aa963 100644 --- a/docs/schema/Metadata.tooi_ontwerpen_van_wet_en_regelgeving_met_adviesaanvraag.md +++ b/docs/schema/Metadata.tooi_ontwerpen_van_wet_en_regelgeving_met_adviesaanvraag.md @@ -2,7 +2,7 @@ Ontwerpen van wetgeving waarover extern advies is gevraagd, inclusief de adviesaanvraag. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.tooi_ontwerpen_van_wet_en_regelgeving_met_adviesaanvraag.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.tooi_ontwerpen_van_wet_en_regelgeving_met_adviesaanvraag.svg) ## Properties diff --git a/docs/schema/Metadata.tooi_organisatie_en_werkwijze.md b/docs/schema/Metadata.tooi_organisatie_en_werkwijze.md index b15c495..61efec3 100644 --- a/docs/schema/Metadata.tooi_organisatie_en_werkwijze.md +++ b/docs/schema/Metadata.tooi_organisatie_en_werkwijze.md @@ -2,7 +2,7 @@ Informatie over de organisatie en werkwijze van bestuursorganen. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.tooi_organisatie_en_werkwijze.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.tooi_organisatie_en_werkwijze.svg) ## Properties diff --git a/docs/schema/Metadata.tooi_overige_besluiten_van_algemene_strekking.md b/docs/schema/Metadata.tooi_overige_besluiten_van_algemene_strekking.md index 1aaba66..70bb2ac 100644 --- a/docs/schema/Metadata.tooi_overige_besluiten_van_algemene_strekking.md +++ b/docs/schema/Metadata.tooi_overige_besluiten_van_algemene_strekking.md @@ -2,7 +2,7 @@ Overige besluiten van algemene strekking. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.tooi_overige_besluiten_van_algemene_strekking.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.tooi_overige_besluiten_van_algemene_strekking.svg) ## Properties diff --git a/docs/schema/Metadata.tooi_subsidieverplichtingen_anders_dan_met_beschikking.md b/docs/schema/Metadata.tooi_subsidieverplichtingen_anders_dan_met_beschikking.md index 59b114d..1c63272 100644 --- a/docs/schema/Metadata.tooi_subsidieverplichtingen_anders_dan_met_beschikking.md +++ b/docs/schema/Metadata.tooi_subsidieverplichtingen_anders_dan_met_beschikking.md @@ -2,7 +2,7 @@ Subsidieverplichtingen die niet via een beschikking lopen, specifiek bij Ministerie van Binnenlandse Zaken. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.tooi_subsidieverplichtingen_anders_dan_met_beschikking.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.tooi_subsidieverplichtingen_anders_dan_met_beschikking.svg) ## Properties diff --git a/docs/schema/Metadata.tooi_vergaderstukken_decentrale_overheden.md b/docs/schema/Metadata.tooi_vergaderstukken_decentrale_overheden.md index 3ada0dc..5d30934 100644 --- a/docs/schema/Metadata.tooi_vergaderstukken_decentrale_overheden.md +++ b/docs/schema/Metadata.tooi_vergaderstukken_decentrale_overheden.md @@ -2,7 +2,7 @@ Vergaderstukken en verslagen van diverse decentrale overheden en hun commissies. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.tooi_vergaderstukken_decentrale_overheden.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.tooi_vergaderstukken_decentrale_overheden.svg) ## Properties diff --git a/docs/schema/Metadata.tooi_vergaderstukken_staten_generaal.md b/docs/schema/Metadata.tooi_vergaderstukken_staten_generaal.md index e6a5bd4..39ed85c 100644 --- a/docs/schema/Metadata.tooi_vergaderstukken_staten_generaal.md +++ b/docs/schema/Metadata.tooi_vergaderstukken_staten_generaal.md @@ -2,7 +2,7 @@ Vergaderstukken en verslagen van de Staten-Generaal, uitgezonderd vertrouwelijke informatie verstrekt aan de Staten-Generaal. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.tooi_vergaderstukken_staten_generaal.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.tooi_vergaderstukken_staten_generaal.svg) ## Properties diff --git a/docs/schema/Metadata.tooi_verzoeken_en_besluiten.md b/docs/schema/Metadata.tooi_verzoeken_en_besluiten.md index 8bc2574..1fdc2d7 100644 --- a/docs/schema/Metadata.tooi_verzoeken_en_besluiten.md +++ b/docs/schema/Metadata.tooi_verzoeken_en_besluiten.md @@ -2,7 +2,7 @@ Inhoud van schriftelijke Woo-verzoeken en besluiten daarop, inclusief verstrekte informatie. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.tooi_verzoeken_en_besluiten.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.tooi_verzoeken_en_besluiten.svg) ## Properties diff --git a/docs/schema/Metadata.tooi_wetten_en_algemeen_verbindende_voorschriften.md b/docs/schema/Metadata.tooi_wetten_en_algemeen_verbindende_voorschriften.md index 038b169..1ea1c83 100644 --- a/docs/schema/Metadata.tooi_wetten_en_algemeen_verbindende_voorschriften.md +++ b/docs/schema/Metadata.tooi_wetten_en_algemeen_verbindende_voorschriften.md @@ -2,7 +2,7 @@ Wetten en andere algemeen verbindende voorschriften. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Metadata.tooi_wetten_en_algemeen_verbindende_voorschriften.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Metadata.tooi_wetten_en_algemeen_verbindende_voorschriften.svg) ## Properties diff --git a/docs/schema/Organization.md b/docs/schema/Organization.md index 4dbe7dd..688a879 100644 --- a/docs/schema/Organization.md +++ b/docs/schema/Organization.md @@ -2,7 +2,7 @@ An organization that provides a publication or index -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Organization.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Organization.svg) ## Properties @@ -16,4 +16,4 @@ An organization that provides a publication or index | oin | string | N/A | No | | tooi | string | N/A | No | | rsin | string | The RSIN of the Non-natural person being the organization that created the case. This must be a valid RSIN consisting of 9 digits and comply with the 11-test as described in https://en.wikipedia.org/wiki/Burgerservicenummer#11-proef. | No | -| name | string | N/A | No | +| pki | string | Het PKI certificaat wat word gebruik om namens deze organisatie te publiceren | No | diff --git a/docs/schema/Organization.puml b/docs/schema/Organization.puml index a027450..51874c6 100644 --- a/docs/schema/Organization.puml +++ b/docs/schema/Organization.puml @@ -12,6 +12,6 @@ class Organization { + oin: string + tooi: string + rsin: string - + name: string + + pki: string } @enduml diff --git a/docs/schema/Publication.md b/docs/schema/Publication.md index 8b5bdf2..4939750 100644 --- a/docs/schema/Publication.md +++ b/docs/schema/Publication.md @@ -2,7 +2,7 @@ The publication object is the core of Open Index, acting as a metadata wrapper for objects and thereby forming the common link between different publications from, for example, WOO and OC. -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Publication.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Publication.svg) ## Properties @@ -24,6 +24,9 @@ The publication object is the core of Open Index, acting as a metadata wrapper f | attachments | array | N/A | No | | attachment_count | integer | **Generated** The amount of attachments belonging to this publication | No | | themes | array | The urls of the theme's associated with this publication | No | -| data | object | N/A | Yes | +| data | array | N/A | Yes | | anonymization | object | Whether the attachment is properly annonymized and the results there of | No | -| language | object | The language and language level of the object | No | +| languageObject | object | The language and language level of the object | No | +| published | string | N/A | No | +| modified | string | N/A | No | +| license | string | N/A | No | diff --git a/docs/schema/Publication.puml b/docs/schema/Publication.puml index 54d98ca..27a121c 100644 --- a/docs/schema/Publication.puml +++ b/docs/schema/Publication.puml @@ -20,8 +20,11 @@ class Publication { + attachments: array + attachment_count: integer + themes: array - + data: object + + data: array + anonymization: object - + language: object + + languageObject: object + + published: string + + modified: string + + license: string } @enduml diff --git a/docs/schema/README.md b/docs/schema/README.md index 78ed2f0..d6955b7 100644 --- a/docs/schema/README.md +++ b/docs/schema/README.md @@ -4,27 +4,27 @@ | Class | Documentation | |-------|--------------| -| Metadata Open Catalogi Publiccode | [Metadata.oc_publiccode.md](Metadata.oc_publiccode.md) | -| Index | [Index.md](Index.md) | | Organization | [Organization.md](Organization.md) | -| Metadata TOOI organisatie en werkwijze | [Metadata.tooi_organisatie_en_werkwijze.md](Metadata.tooi_organisatie_en_werkwijze.md) | +| Index | [Index.md](Index.md) | +| Metadata TOOI jaarplannen en jaarverslagen | [Metadata.tooi_jaarplannen_en_jaarverslagen.md](Metadata.tooi_jaarplannen_en_jaarverslagen.md) | +| Metadata TOOI ontwerpen van wet- en regelgeving met adviesaanvraag | [Metadata.tooi_ontwerpen_van_wet_en_regelgeving_met_adviesaanvraag.md](Metadata.tooi_ontwerpen_van_wet_en_regelgeving_met_adviesaanvraag.md) | +| Metadata TOOI subsidieverplichtingen anders dan met beschikking | [Metadata.tooi_subsidieverplichtingen_anders_dan_met_beschikking.md](Metadata.tooi_subsidieverplichtingen_anders_dan_met_beschikking.md) | | Metadata TOOI onderzoeksrapporten | [Metadata.tooi_onderzoeksrapporten.md](Metadata.tooi_onderzoeksrapporten.md) | -| Metadata TOOI Woo-verzoeken en -besluiten | [Metadata.tooi_verzoeken_en_besluiten.md](Metadata.tooi_verzoeken_en_besluiten.md) | +| Metadata TOOI convenanten | [Metadata.tooi_convenanten.md](Metadata.tooi_convenanten.md) | | Metadata TOOI vergaderstukken decentrale overheden | [Metadata.tooi_vergaderstukken_decentrale_overheden.md](Metadata.tooi_vergaderstukken_decentrale_overheden.md) | -| Publication | [Publication.md](Publication.md) | -| Metadata Open Catalogi Publiccode | [Metadata.ods_agenda_item.md](Metadata.ods_agenda_item.md) | -| Metadata TOOI subsidieverplichtingen anders dan met beschikking | [Metadata.tooi_subsidieverplichtingen_anders_dan_met_beschikking.md](Metadata.tooi_subsidieverplichtingen_anders_dan_met_beschikking.md) | -| Metadata TOOI agenda’s en besluitenlijsten bestuurscolleges | [Metadata.tooi_agendas_en_besluitenlijsten_bestuurscolleges.md](Metadata.tooi_agendas_en_besluitenlijsten_bestuurscolleges.md) | | Metadata TOOI wetten en algemeen verbindende voorschriften | [Metadata.tooi_wetten_en_algemeen_verbindende_voorschriften.md](Metadata.tooi_wetten_en_algemeen_verbindende_voorschriften.md) | -| Metadata TOOI jaarplannen en jaarverslagen | [Metadata.tooi_jaarplannen_en_jaarverslagen.md](Metadata.tooi_jaarplannen_en_jaarverslagen.md) | -| Metadata TOOI convenanten | [Metadata.tooi_convenanten.md](Metadata.tooi_convenanten.md) | -| Metadata TOOI ontwerpen van wet- en regelgeving met adviesaanvraag | [Metadata.tooi_ontwerpen_van_wet_en_regelgeving_met_adviesaanvraag.md](Metadata.tooi_ontwerpen_van_wet_en_regelgeving_met_adviesaanvraag.md) | -| Metadata TOOI vergaderstukken Staten-Generaal | [Metadata.tooi_vergaderstukken_staten_generaal.md](Metadata.tooi_vergaderstukken_staten_generaal.md) | -| Metadata TOOI beschikkingen | [Metadata.tooi_beschikkingen.md](Metadata.tooi_beschikkingen.md) | +| Metadata TOOI agenda’s en besluitenlijsten bestuurscolleges | [Metadata.tooi_agendas_en_besluitenlijsten_bestuurscolleges.md](Metadata.tooi_agendas_en_besluitenlijsten_bestuurscolleges.md) | +| Metadata Open Catalogi Publiccode | [Metadata.oc_publiccode.md](Metadata.oc_publiccode.md) | +| Metadata Open Catalogi Publiccode | [Metadata.ods_agenda_item.md](Metadata.ods_agenda_item.md) | | Metadata TOOI bereikbaarheidsgegevens | [Metadata.tooi_bereikbaarheidsgegevens.md](Metadata.tooi_bereikbaarheidsgegevens.md) | -| Theme | [Theme.md](Theme.md) | | Metadata TOOI klachtoordelen | [Metadata.tooi_klachtoordelen.md](Metadata.tooi_klachtoordelen.md) | +| Theme | [Theme.md](Theme.md) | +| Metadata TOOI vergaderstukken Staten-Generaal | [Metadata.tooi_vergaderstukken_staten_generaal.md](Metadata.tooi_vergaderstukken_staten_generaal.md) | | Metadata TOOI adviezen | [Metadata.tooi_adviezen.md](Metadata.tooi_adviezen.md) | -| Attachment | [Attachment.md](Attachment.md) | -| Metadata TOOI overige besluiten van algemene strekking | [Metadata.tooi_overige_besluiten_van_algemene_strekking.md](Metadata.tooi_overige_besluiten_van_algemene_strekking.md) | | Metadata TOOI bij vertegenwoordigende organen ingekomen stukken | [Metadata.tooi_bij_vertegenwoordigende_organen_ingekomen_stukken.md](Metadata.tooi_bij_vertegenwoordigende_organen_ingekomen_stukken.md) | +| Metadata TOOI beschikkingen | [Metadata.tooi_beschikkingen.md](Metadata.tooi_beschikkingen.md) | +| Metadata TOOI Woo-verzoeken en -besluiten | [Metadata.tooi_verzoeken_en_besluiten.md](Metadata.tooi_verzoeken_en_besluiten.md) | +| Metadata TOOI overige besluiten van algemene strekking | [Metadata.tooi_overige_besluiten_van_algemene_strekking.md](Metadata.tooi_overige_besluiten_van_algemene_strekking.md) | +| Metadata TOOI organisatie en werkwijze | [Metadata.tooi_organisatie_en_werkwijze.md](Metadata.tooi_organisatie_en_werkwijze.md) | +| Publication | [Publication.md](Publication.md) | +| Attachment | [Attachment.md](Attachment.md) | diff --git a/docs/schema/Theme.md b/docs/schema/Theme.md index c30cfd8..4f216a6 100644 --- a/docs/schema/Theme.md +++ b/docs/schema/Theme.md @@ -2,7 +2,7 @@ A thematic clustering of publications in a manner logical for searching, can also be used for topics. Themes exist within a single index and are thus organization specific unless the index is shared by multiple organizations -![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/update-schemas/docs/schema/Theme.svg) +![Class Diagram](https://github.com/CommonGateway/OpenIndex/blob/tilburg-cases-sync/docs/schema/Theme.svg) ## Properties diff --git a/docs/schema/all_schema_classes.puml b/docs/schema/all_schema_classes.puml index 5d8cd2c..515462d 100644 --- a/docs/schema/all_schema_classes.puml +++ b/docs/schema/all_schema_classes.puml @@ -2,41 +2,28 @@ title: All schemas footer: Common Gateway Plugin | Commongateway | Openindex header: Schema -class MetadataOpenCatalogiPubliccode { - + tooiCategorieNaam: string - + tooiCategorieId: string - + tooiCategorieUri: string - + tooiThemaNaam: string - + tooiThemaId: string - + tooiThemaUri: string - + oprdachtgever: string - + onderdeelTaak: string - + onderwerp: string - + feitelijkMateriaal: boolean - + values: array -} -class Index { +class Organization { + id: string + title: string + summary: string + description: string + image: string - + url: string - + status: integer - + organization: object + + oin: string + + tooi: string + + rsin: string + + pki: string } -class Organization { +class Index { + id: string + title: string + summary: string + description: string + image: string - + oin: string - + tooi: string - + rsin: string - + name: string + + url: string + + status: integer + + organization: object } -class MetadataTOOIorganisatieenwerkwijze { +class MetadataTOOIjaarplannenenjaarverslagen { + tooiCategorieNaam: string + tooiCategorieId: string + tooiCategorieUri: string @@ -45,7 +32,7 @@ class MetadataTOOIorganisatieenwerkwijze { + tooiThemaUri: string + values: array } -class MetadataTOOIonderzoeksrapporten { +class MetadataTOOIontwerpenvanwet-enregelgevingmetadviesaanvraag { + tooiCategorieNaam: string + tooiCategorieId: string + tooiCategorieUri: string @@ -54,19 +41,16 @@ class MetadataTOOIonderzoeksrapporten { + tooiThemaUri: string + values: array } -class MetadataTOOIWoo-verzoekenen-besluiten { +class MetadataTOOIsubsidieverplichtingenandersdanmetbeschikking { + tooiCategorieNaam: string + tooiCategorieId: string + tooiCategorieUri: string + tooiThemaNaam: string + tooiThemaId: string + tooiThemaUri: string - + datumBesluit: string - + datumOntvangst: string - + termijnoverschrijding: string + values: array } -class MetadataTOOIvergaderstukkendecentraleoverheden { +class MetadataTOOIonderzoeksrapporten { + tooiCategorieNaam: string + tooiCategorieId: string + tooiCategorieUri: string @@ -75,41 +59,25 @@ class MetadataTOOIvergaderstukkendecentraleoverheden { + tooiThemaUri: string + values: array } -class Publication { - + id: string - + reference: string - + title: string - + summary: string - + description: string - + image: string - + category: string - + portal: string - + publicationDate: string - + featured: boolean - + organization: object - + schema: string - + status: string - + attachments: array - + attachment_count: integer - + themes: array - + data: object - + anonymization: object - + language: object +class MetadataTOOIconvenanten { + + tooiCategorieNaam: string + + tooiCategorieId: string + + tooiCategorieUri: string + + tooiThemaNaam: string + + tooiThemaId: string + + tooiThemaUri: string + + values: array } -class MetadataOpenCatalogiPubliccode { +class MetadataTOOIvergaderstukkendecentraleoverheden { + tooiCategorieNaam: string + tooiCategorieId: string + tooiCategorieUri: string + tooiThemaNaam: string + tooiThemaId: string + tooiThemaUri: string - + oprdachtgever: string - + onderdeelTaak: string - + onderwerp: string - + feitelijkMateriaal: boolean + values: array } -class MetadataTOOIsubsidieverplichtingenandersdanmetbeschikking { +class MetadataTOOIwettenenalgemeenverbindendevoorschriften { + tooiCategorieNaam: string + tooiCategorieId: string + tooiCategorieUri: string @@ -127,25 +95,33 @@ class MetadataTOOIagenda’senbesluitenlijstenbestuurscolleges { + tooiThemaUri: string + values: array } -class MetadataTOOIwettenenalgemeenverbindendevoorschriften { +class MetadataOpenCatalogiPubliccode { + tooiCategorieNaam: string + tooiCategorieId: string + tooiCategorieUri: string + tooiThemaNaam: string + tooiThemaId: string + tooiThemaUri: string + + oprdachtgever: string + + onderdeelTaak: string + + onderwerp: string + + feitelijkMateriaal: boolean + values: array } -class MetadataTOOIjaarplannenenjaarverslagen { +class MetadataOpenCatalogiPubliccode { + tooiCategorieNaam: string + tooiCategorieId: string + tooiCategorieUri: string + tooiThemaNaam: string + tooiThemaId: string + tooiThemaUri: string + + oprdachtgever: string + + onderdeelTaak: string + + onderwerp: string + + feitelijkMateriaal: boolean + values: array } -class MetadataTOOIconvenanten { +class MetadataTOOIbereikbaarheidsgegevens { + tooiCategorieNaam: string + tooiCategorieId: string + tooiCategorieUri: string @@ -154,15 +130,32 @@ class MetadataTOOIconvenanten { + tooiThemaUri: string + values: array } -class MetadataTOOIontwerpenvanwet-enregelgevingmetadviesaanvraag { +class MetadataTOOIklachtoordelen { + tooiCategorieNaam: string + tooiCategorieId: string + tooiCategorieUri: string + tooiThemaNaam: string + tooiThemaId: string + tooiThemaUri: string + + datumBesluit: string + + datumOntvangst: string + + termijnoverschrijding: string + + organisatieonderdeel: string + + functiebenaming: string + + gedraging: string + + bevindingen: string + + oordeel: string + + conclusies: string + values: array } +class Theme { + + id: string + + title: string + + summary: string + + description: string + + image: string + + publications: integer +} class MetadataTOOIvergaderstukkenStaten-Generaal { + tooiCategorieNaam: string + tooiCategorieId: string @@ -172,16 +165,20 @@ class MetadataTOOIvergaderstukkenStaten-Generaal { + tooiThemaUri: string + values: array } -class MetadataTOOIbeschikkingen { +class MetadataTOOIadviezen { + tooiCategorieNaam: string + tooiCategorieId: string + tooiCategorieUri: string + tooiThemaNaam: string + tooiThemaId: string + tooiThemaUri: string + + oprdachtgever: string + + onderdeelTaak: string + + onderwerp: string + + feitelijkMateriaal: boolean + values: array } -class MetadataTOOIbereikbaarheidsgegevens { +class MetadataTOOIbijvertegenwoordigendeorganeningekomenstukken { + tooiCategorieNaam: string + tooiCategorieId: string + tooiCategorieUri: string @@ -190,15 +187,16 @@ class MetadataTOOIbereikbaarheidsgegevens { + tooiThemaUri: string + values: array } -class Theme { - + id: string - + title: string - + summary: string - + description: string - + image: string - + publications: integer +class MetadataTOOIbeschikkingen { + + tooiCategorieNaam: string + + tooiCategorieId: string + + tooiCategorieUri: string + + tooiThemaNaam: string + + tooiThemaId: string + + tooiThemaUri: string + + values: array } -class MetadataTOOIklachtoordelen { +class MetadataTOOIWoo-verzoekenen-besluiten { + tooiCategorieNaam: string + tooiCategorieId: string + tooiCategorieUri: string @@ -208,27 +206,50 @@ class MetadataTOOIklachtoordelen { + datumBesluit: string + datumOntvangst: string + termijnoverschrijding: string - + organisatieonderdeel: string - + functiebenaming: string - + gedraging: string - + bevindingen: string - + oordeel: string - + conclusies: string + values: array } -class MetadataTOOIadviezen { +class MetadataTOOIoverigebesluitenvanalgemenestrekking { + tooiCategorieNaam: string + tooiCategorieId: string + tooiCategorieUri: string + tooiThemaNaam: string + tooiThemaId: string + tooiThemaUri: string - + oprdachtgever: string - + onderdeelTaak: string - + onderwerp: string - + feitelijkMateriaal: boolean + values: array } +class MetadataTOOIorganisatieenwerkwijze { + + tooiCategorieNaam: string + + tooiCategorieId: string + + tooiCategorieUri: string + + tooiThemaNaam: string + + tooiThemaId: string + + tooiThemaUri: string + + values: array +} +class Publication { + + id: string + + reference: string + + title: string + + summary: string + + description: string + + image: string + + category: string + + portal: string + + publicationDate: string + + featured: boolean + + organization: object + + schema: string + + status: string + + attachments: array + + attachment_count: integer + + themes: array + + data: array + + anonymization: object + + languageObject: object + + published: string + + modified: string + + license: string +} class Attachment { + id: string + reference: string @@ -236,32 +257,17 @@ class Attachment { + summary: string + description: string + labels: array - + url: string - + content: string + + accessURL: string + + downloadURL: string + type: string + extension: string + size: integer + anonymization: object - + language: object + + languageObject: object + version_of: string + hash: string -} -class MetadataTOOIoverigebesluitenvanalgemenestrekking { - + tooiCategorieNaam: string - + tooiCategorieId: string - + tooiCategorieUri: string - + tooiThemaNaam: string - + tooiThemaId: string - + tooiThemaUri: string - + values: array -} -class MetadataTOOIbijvertegenwoordigendeorganeningekomenstukken { - + tooiCategorieNaam: string - + tooiCategorieId: string - + tooiCategorieUri: string - + tooiThemaNaam: string - + tooiThemaId: string - + tooiThemaUri: string - + values: array + + published: string + + modified: string + + license: string } @enduml diff --git a/src/ActionHandler/SyncTilburgCasesHandler.php b/src/ActionHandler/SyncTilburgCasesHandler.php new file mode 100644 index 0000000..afe9f87 --- /dev/null +++ b/src/ActionHandler/SyncTilburgCasesHandler.php @@ -0,0 +1,156 @@ +SyncTilburgCasesHandler. + * + * @package CommonGateway\OpenIndex + * @license EUPL + * + * @author Yoeri Dekker , Wilco Louwerse + * @category ActionHandler + */ +class SyncTilburgCasesHandler implements ActionHandlerInterface +{ + + /** + * @var SyncTilburgCasesService + */ + private SyncTilburgCasesService $service; + + + /** + * SyncTilburgCasesHandler constructor. + * + * @param SyncTilburgCasesService $service + */ + public function __construct(SyncTilburgCasesService $service) + { + $this->service = $service; + + }//end __construct() + + + /** + * This function returns the required 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 + */ + public function getConfiguration(): array + { + return [ + '$id' => 'https://commongateway.nl/ActionHandler/woo.SyncTilburgCasesHandler.actionHandler.json', + '$schema' => 'https://docs.commongateway.nl/schemas/ActionHandler.schema.json', + 'title' => 'SyncTilburgCasesHandler', + 'description' => 'Handles the sync for TIP cases.', + 'required' => [ + 'oin', + 'portalUrl', + 'source', + 'schema', + 'mapping', + 'organisatie', + 'caseIndex', + 'caseDetail', + 'fileEndpoint', + ], + 'properties' => [ + 'oin' => [ + 'type' => 'string', + 'description' => 'The oin of the municipality.', + 'example' => '00000001001172773000', + 'required' => true, + ], + 'portalUrl' => [ + 'type' => 'string', + 'description' => 'The portal url of the publication.', + 'example' => 'https://conductionnl.github.io/woo-website-buren', + 'required' => true, + ], + 'source' => [ + 'type' => 'string', + 'description' => 'The source where the publication belongs to.', + 'example' => 'https://openwoo.app/source/openindex.tilburg.zaaksysteem.source.json', + 'required' => true, + ], + 'schema' => [ + 'type' => 'string', + 'description' => 'The publication schema.', + 'example' => 'https://openwoo.app/schemas/publication.schema.json', + 'reference' => 'https://openwoo.app/schemas/publication.schema.json', + 'required' => true, + ], + 'mapping' => [ + 'type' => 'string', + 'description' => 'The mapping for TIP case to publication.', + 'example' => 'https://openwoo.app/mapping/openindex.woo.tilburgCaseToWoo.mapping.json', + 'reference' => 'https://openwoo.app/mapping/openindex.woo.tilburgCaseToWoo.mapping.json', + 'required' => true, + ], + 'organisatie' => [ + 'type' => 'string', + 'description' => 'The organisation.', + 'example' => 'Gemeente Tilburg', + 'required' => true, + ], + 'caseIndex' => [ + 'type' => 'string', + 'description' => 'The endpoint for the case index.', + 'example' => '/v1/zaken', + 'required' => true, + ], + 'caseDetail' => [ + 'type' => 'string', + 'description' => 'The endpoint for the case details.', + 'example' => '/v1/zaken/:identificatie/informatieobjecten', + 'required' => true, + ], + 'fileEndpoint' => [ + 'type' => 'string', + 'description' => 'The endpoint reference for documents.', + 'example' => 'https://openwoo.app/openindex.woo.ViewFile.endpoint.json', + 'required' => true, + ], + 'rateLimitStart' => [ + 'type' => 'string', + 'description' => 'Start date of the fixed date range that is used to fetch a maximum amount of objects to avoid rate limiting.', + 'example' => '2024-06-06', + 'required' => true, + ], + 'rateLimitEnd' => [ + 'type' => 'string', + 'description' => 'End date of the fixed date range that is used to fetch a maximum amount of objects to avoid rate limiting.', + 'example' => '2024-08-01', + 'required' => true, + ], + ], + ]; + + }//end getConfiguration() + + + /** + * This function runs the SyncTilburgCases service plugin. + * + * @param array $data The data from the call + * @param array $configuration The configuration of the action + * + * @return array + * @throws TransportExceptionInterface|LoaderError|RuntimeError|SyntaxError + */ + public function run(array $data, array $configuration): array + { + return $this->service->SyncTilburgCasesHandler($data, $configuration); + + }//end run() + + +}//end class diff --git a/src/ActionHandler/ViewFileHandler.php b/src/ActionHandler/ViewFileHandler.php new file mode 100644 index 0000000..a3f6110 --- /dev/null +++ b/src/ActionHandler/ViewFileHandler.php @@ -0,0 +1,78 @@ +viewFileHandler. + * + * @author Conduction BV , Barry Brands + * @license EUPL + * + * @package CommonGateway\OpenIndex + * @category ActionHandler + */ +class ViewFileHandler implements ActionHandlerInterface +{ + + /** + * @var FileService + */ + private FileService $service; + + + /** + * ViewFileHandler constructor. + * + * @param FileService $service + */ + public function __construct(FileService $service) + { + $this->service = $service; + + }//end __construct() + + + /** + * This function returns the required 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 + */ + public function getConfiguration(): array + { + return [ + '$id' => 'https://commongateway.nl/woo.ViewFileAction.action.json', + '$schema' => 'https://docs.commongateway.nl/schemas/ActionHandler.schema.json', + 'title' => 'ViewFileHandler', + 'description' => 'Handles the file view for woo bijlagen and documents.', + 'required' => [], + 'properties' => [], + ]; + + }//end getConfiguration() + + + /** + * This function runs the ViewFile service plugin. + * + * @param array $data The data from the call + * @param array $configuration The configuration of the action + * + * @throws TransportExceptionInterface|LoaderError|RuntimeError|SyntaxError + * + * @return array + */ + public function run(array $data, array $configuration): array + { + return $this->service->viewFileHandler($data, $configuration); + + }//end run() + + +}//end class diff --git a/src/Service/FileService.php b/src/Service/FileService.php new file mode 100644 index 0000000..2c1b50f --- /dev/null +++ b/src/Service/FileService.php @@ -0,0 +1,282 @@ +, Barry Brands . + * @license EUPL + * + * @package CommonGateway\OpenIndex + * @category Service + */ +class FileService +{ + + /** + * @var CallService + */ + private CallService $callService; + + /** + * @var EntityManagerInterface + */ + private EntityManagerInterface $entityManager; + + /** + * @var SymfonyStyle|null + */ + private ?SymfonyStyle $style = null; + + /** + * @var LoggerInterface $logger. + */ + private LoggerInterface $logger; + + /** + * @var ParameterBagInterface $parameterBag. + */ + private ParameterBagInterface $parameterBag; + + /** + * @var Parser $pdfParser. + */ + private Parser $pdfParser; + + /** + * @var array + */ + private array $data; + + /** + * @var array + */ + private array $configuration; + + + /** + * FileService constructor. + * + * @param CallService $callService + * @param EntityManagerInterface $entityManager + * @param LoggerInterface $pluginLogger + * @param ParameterBagInterface $parameterBag + */ + public function __construct( + CallService $callService, + EntityManagerInterface $entityManager, + LoggerInterface $pluginLogger, + ParameterBagInterface $parameterBag + ) { + $this->callService = $callService; + $this->entityManager = $entityManager; + $this->logger = $pluginLogger; + $this->parameterBag = $parameterBag; + $this->pdfParser = new Parser(); + + }//end __construct() + + + /** + * Set symfony style in order to output to the console. + * + * @param SymfonyStyle $style + * + * @return self + * + * @todo change to monolog + */ + public function setStyle(SymfonyStyle $style): self + { + $this->style = $style; + + return $this; + + }//end setStyle() + + + /** + * Gets the inhoud of the document from a different endpoint that has the metadata. + * + * @param string $caseId Case id. + * @param string $documentId Document id. + * @param Source $zaaksysteem Xxllnc zaaksysteem api v1. + * + * @return string|null $this->callService->decodeResponse() Decoded requested document as PHP array. + */ + public function getInhoudDocument(string $caseId, string $documentId, string $mimeType, Source $zaaksysteem): ?string + { + try { + isset($this->style) === true && $this->style->info("Fetching inhoud document: $documentId for case $caseId"); + $this->logger->info("Fetching inhoud document: $documentId for case $caseId", ['plugin' => 'common-gateway/open-index']); + $response = $this->callService->call($zaaksysteem, "/v1/case/$caseId/document/$documentId/download", 'GET', [], false); + return $this->callService->decodeResponse($zaaksysteem, $response, $mimeType); + } catch (Exception $e) { + isset($this->style) === true && $this->style->error("Failed to fetch inhoud of document: $documentId, message: {$e->getMessage()}"); + $this->logger->error("Failed to fetch inhoud of document: $documentId, message: {$e->getMessage()}", ['plugin' => 'common-gateway/open-index']); + return null; + } + + }//end getInhoudDocument() + + + /** + * Creates or updates a file associated with a given Value instance. + * + * This method handles the logic for creating or updating a file based on + * provided data. If an existing file is associated with the Value, + * it updates the file's properties; otherwise, it creates a new file. + * + * @param Value $value The object entity associated with the file. + * @param string $title File title. + * @param string $base64 Encoded base64. + * @param string $mimeType Mimetype of file. + * @param Endpoint $downloadEndpoint Endpoint to use for downloading the file. + * + * @return void + */ + public function createOrUpdateFile(Value $value, string $title, string $base64, string $mimeType, Endpoint $downloadEndpoint): string + { + if ($value->getFiles()->count() > 0) { + $file = $value->getFiles()->first(); + } else { + $file = new File(); + } + + $file->setName($title); + $file->setBase64($base64); + $file->setMimeType(($mimeType ?? 'application/pdf')); + $extension = match ($file->getMimeType()) { + 'pdf', 'application/pdf' => 'pdf', + default => '', + }; + + $file->setExtension($extension); + $file->setSize(mb_strlen(\Safe\base64_decode($base64))); + $file->setValue($value); + + $this->entityManager->persist($file); + $this->entityManager->flush(); + + return $this->generateDownloadEndpoint($file->getId()->toString(), $downloadEndpoint); + + }//end createOrUpdateFile() + + + /** + * Generates a download endpoint from the id of an 'WOO Object' and the endpoint for downloads. + * + * @param string $id The id of the WOO object. + * @param Endpoint $downloadEndpoint The endpoint for downloads. + * + * @return string The endpoint to download the document from. + */ + public function generateDownloadEndpoint(string $id, Endpoint $downloadEndpoint): string + { + // Unset the last / from the app_url. + $baseUrl = rtrim($this->parameterBag->get('app_url'), '/'); + + $pathArray = $downloadEndpoint->getPath(); + foreach ($pathArray as $key => $value) { + if ($value == 'id' || $value == '[id]' || $value == '{id}') { + $pathArray[$key] = $id; + } + } + + return $baseUrl.'/api/'.implode('/', $pathArray); + + }//end generateDownloadEndpoint() + + + /** + * Extracts text from a document (File). + * + * @param Value $value The value associated with the file. + * + * @return string|null + */ + public function getTextFromDocument(Value $value): ?string + { + if ($value->getFiles()->count() > 0) { + $file = $value->getFiles()->first(); + } else { + return null; + } + + switch ($file->getMimeType()) { + case 'pdf': + case 'application/pdf': + try { + $pdf = $this->pdfParser->parseContent(\Safe\base64_decode($file->getBase64())); + $text = $pdf->getText(); + } catch (\Exception $e) { + $this->logger->error('Something went wrong extracting text from '.$file->getName().' '.$e->getMessage()); + $this->style && $this->style->error('Something went wrong extracting text from '.$file->getName().' '.$e->getMessage()); + + $text = null; + } + break; + default: + $text = null; + } + + return $text; + + }//end getTextFromDocument() + + + /** + * Returns the data from an document as a response. + * + * @param array $data The data passed by the action. + * @param array $configuration The configuration of the action. + * + * @return array + */ + public function viewFileHandler(array $data, array $configuration): array + { + $this->data = $data; + + $parameters = $this->data; + $path = $this->data['path']; + + $file = $this->entityManager->getRepository('App:File')->find($path['id']); + + // Make sure only files for the configured schema are retrievable. + if ($file instanceof File === false + || $file->getValue() === null + || $file->getValue()->getObjectEntity() === null + || $file->getValue()->getObjectEntity()->getEntity() === null + || $file->getValue()->getObjectEntity()->getEntity()->getReference() === null + || isset($configuration['schemaThisFileBelongsTo']) === false + || in_array($file->getValue()->getObjectEntity()->getEntity()->getReference(), $configuration['schemaThisFileBelongsTo']) === false + ) { + return ['response' => new Response('{"message" => "File not found or file doesn\'t belong to the configured schema."}', 400, ['content-type' => 'application/json'])]; + } + + if ($file->getMimeType() === "text/plain") { + $responseBody = $file->getBase64(); + } else { + $responseBody = \Safe\base64_decode($file->getBase64()); + } + + return ['response' => new Response($responseBody, 200, ['content-type' => $file->getMimeType()])]; + + }//end viewFileHandler() + + +}//end class diff --git a/src/Service/OpenIndexService.php b/src/Service/OpenIndexService.php index 260bae9..6385621 100644 --- a/src/Service/OpenIndexService.php +++ b/src/Service/OpenIndexService.php @@ -56,7 +56,7 @@ public function validatePublication(ObjectEntity $object, string $method) $validationErrors = $this->validationService->validateData($objectArray['data'], $schemaEntity, $method); if ($validationErrors !== null) { - $this->pluginLogger->error(message: 'This object could not be safed due to validation errors.', context: ['plugin' => 'common-gateway/woo-bundle', 'errors' => $validationErrors]); + $this->pluginLogger->error(message: 'This object could not be safed due to validation errors.', context: ['plugin' => 'common-gateway/open-index', 'errors' => $validationErrors]); $response = new Response( content: json_encode( [ diff --git a/src/Service/SyncTilburgCasesService.php b/src/Service/SyncTilburgCasesService.php new file mode 100644 index 0000000..ee401d0 --- /dev/null +++ b/src/Service/SyncTilburgCasesService.php @@ -0,0 +1,555 @@ + + * + * @author Acato BV , Wilco Louwerse + * @category Service + */ +class SyncTilburgCasesService +{ + + /** + * @var GatewayResourceService + */ + private GatewayResourceService $resourceService; + + /** + * @var CallService + */ + private CallService $callService; + + /** + * @var SynchronizationService + */ + private SynchronizationService $syncService; + + /** + * @var MappingService + */ + private MappingService $mappingService; + + /** + * @var EntityManagerInterface + */ + private EntityManagerInterface $entityManager; + + /** + * @var SymfonyStyle|null + */ + private ?SymfonyStyle $style = null; + + /** + * @var LoggerInterface $logger . + */ + private LoggerInterface $logger; + + /** + * @var ValidationService $validationService . + */ + private ValidationService $validationService; + + /** + * @var CacheService $cacheService . + */ + private CacheService $cacheService; + + /** + * @var ObjectEntityService + */ + private ObjectEntityService $gatewayOEService; + + /** + * @var FileService $fileService . + */ + private FileService $fileService; + + /** + * @var array + */ + private array $data; + + /** + * @var array + */ + private array $configuration; + + /** + * @var Parser $pdfParser . + */ + private Parser $pdfParser; + + /** + * @var HydrationService $hydrationService . + */ + private HydrationService $hydrationService; + + + /** + * SyncTilburgCasesService constructor. + * + * @param GatewayResourceService $resourceService + * @param CallService $callService + * @param SynchronizationService $syncService + * @param EntityManagerInterface $entityManager + * @param MappingService $mappingService + * @param LoggerInterface $pluginLogger + * @param ValidationService $validationService + * @param ObjectEntityService $gatewayOEService + * @param FileService $fileService + * @param CacheService $cacheService + */ + public function __construct( + GatewayResourceService $resourceService, + CallService $callService, + SynchronizationService $syncService, + EntityManagerInterface $entityManager, + MappingService $mappingService, + LoggerInterface $pluginLogger, + ValidationService $validationService, + FileService $fileService, + CacheService $cacheService, + ObjectEntityService $gatewayOEService + ) { + $this->resourceService = $resourceService; + $this->callService = $callService; + $this->syncService = $syncService; + $this->entityManager = $entityManager; + $this->mappingService = $mappingService; + $this->logger = $pluginLogger; + $this->validationService = $validationService; + $this->fileService = $fileService; + $this->cacheService = $cacheService; + $this->gatewayOEService = $gatewayOEService; + $this->pdfParser = new Parser(); + + }//end __construct() + + + /** + * Set symfony style in order to output to the console. + * + * @param SymfonyStyle $style + * + * @return self + * + * @todo change to monolog + */ + public function setStyle(SymfonyStyle $style): self + { + $this->style = $style; + + return $this; + + }//end setStyle() + + + /** + * Handles the synchronization of TIP cases. + * + * @param array $data + * @param array $configuration + * + * @return array + * @throws Exception|InvalidArgumentException + */ + public function SyncTilburgCasesHandler(array $data, array $configuration): array + { + // Setup data and configuration. + $this->data = $data; + $this->configuration = $configuration; + + // Define source, schema and mapping. + $source = $this->resourceService->getSource($this->configuration['source'], 'common-gateway/open-index'); + $schema = $this->resourceService->getSchema($this->configuration['schema'], 'common-gateway/open-index'); + $mapping = $this->resourceService->getMapping($this->configuration['mapping'], 'common-gateway/open-index'); + + // For documents. + $documentSourceIdMapping = $this->resourceService->getMapping("https://openwoo.app/mapping/openindex.woo.tilburgDocumentSetSourceId.schema.json", "common-gateway/open-index"); + $documentMapping = $this->resourceService->getMapping("https://openwoo.app/mapping/openindex.woo.tilburgDocumentToAttachment.mapping.json", "common-gateway/open-index"); + $fileEndpoint = $this->resourceService->getEndpoint($this->configuration['fileEndpoint'], 'common-gateway/open-index'); + + if ($source instanceof Source === false || $schema instanceof Schema === false || $mapping instanceof Mapping === false) { + return []; + } + + // @todo: Implement a way to fetch all objects from the TIP. + // For now, this fixed date range is used to fetch 28 objects to avoid rate limiting. + $results = $this->fetchObjects($source, $this->configuration['rateLimitStart'], $this->configuration['rateLimitEnd']); + $this->entityManager->flush(); + + $responseItems = []; + $this->hydrationService = new HydrationService($this->syncService, $this->entityManager); + + foreach ($results as $result) { + // Map the result. + $mappedResult = $this->map($mapping, $result); + + // Add organisation data. + $mappedResult = array_merge( + $mappedResult, + [ + 'organization' => [ + 'oin' => $this->configuration['oin'], + 'title' => $this->configuration['organisatie'], + 'summary' => $this->configuration['organisatie'], + ], + ] + ); + + // Run validation against the provided schema. + if (! $this->isValidData($mappedResult, $schema)) { + continue; + } + + // Fetch all documents for the publication and save them for later enrichment. + $attachments = $this->fetchDetails($source, $result['id']); + if (! empty($attachments)) { + $mappedResult['attachments'] = $this->processTemporaryAttachments($attachments, $documentSourceIdMapping); + } + + // First save the publication object before enriching documents. + $publication = $this->savePublication($mappedResult, $source, $schema, true, true); + if ($publication === false) { + continue; + } + + // Enrich the attached documents. + if (! empty($attachments)) { + $mappedDocuments = []; + foreach ($attachments as $attachment) { + // Add the enriched document to the array of documents. + $mappedDocument = $this->processAttachment($attachment, $source, $documentMapping, $fileEndpoint); + if ($mappedDocument) { + $mappedDocuments[] = $mappedDocument; + } + } + + // Overwrite 'bijlagen' to update the enriched documents. + $mappedResult['attachments'] = $mappedDocuments; + } + + // Update the publication object with the enriched documents. + $publication = $this->savePublication($mappedResult, $source, $schema, true, false); + if ($publication !== false) { + $responseItems[] = $publication->toArray(); + } + }//end foreach + + $this->entityManager->flush(); + + $this->data['response'] = new Response(json_encode($responseItems), 200); + + return $this->data; + + }//end SyncTilburgCasesHandler() + + + /** + * Processes the attachment. + * + * @param array $attachment The attachment that needs to be processed. + * @param Source $source The source entity that provides the source of the result data. + * @param Mapping $mapping The mapping entity that provides the mapping of the result data. + * @param Endpoint $endpoint The endpoint entity that provides the endpoint of the result data. + * + * @return array|bool The processed attachment. + */ + private function processAttachment(array $attachment, Source $source, Mapping $mapping, Endpoint $endpoint): array|bool + { + + // Fetch the actual file from the TIP. + $document = $this->fetchDocument($source, $attachment['identificatie']); + if ($document === false) { + return false; + } + + // Fetch the existing temporary document. + $documentObject = $this->entityManager->getRepository('App:ObjectEntity') + ->findByAnyId($document['identificatie'], $source->getId()->toString()); + + // Define the value. + $value = $documentObject->getValueObject("downloadURL"); + + // Persist? + $this->entityManager->persist($value); + + // Create the actual file with contents. + try { + $url = $this->fileService->createOrUpdateFile( + $value, + $document['titel'], + $document['inhoud'], + $document['formaat'], + $endpoint + ); + } catch (Exception $e) { + $this->logger->error(var_export([ 'ERROR fileService' => $e->getMessage() ], true), [ 'plugin' => 'common-gateway/open-index' ]); + + return false; + } + + // Apply document mapping and add url. + $mappedDocument = $this->map($mapping, $attachment); + + // Get the file extension. + $extension = strtolower(pathinfo($document['titel'], PATHINFO_EXTENSION)); + + // Set default empty document text. + $text = null; + + // Try extracting text from PDF. + if ($extension === 'pdf') { + try { + $pdf = $this->pdfParser->parseContent(\Safe\base64_decode($document['inhoud'])); + $text = $pdf->getText(); + } catch (\Exception $e) { + $this->logger->error(var_export([ 'ERROR pdfParser' => $e->getMessage() ], true), [ 'plugin' => 'common-gateway/open-index' ]); + } + } + + return array_merge( + $mappedDocument, + [ + 'extension' => $extension, + 'downloadURL' => $url, + 'summary' => $text, + ] + ); + + }//end processAttachment() + + + /** + * Saves the publication. + * + * @param array $data The data that needs to be saved. + * @param Source $source The source entity that provides the source of the result data. + * @param Schema $schema The schema entity that provides the schema of the result data. + * @param bool $flush Whether to flush the entity manager. + * @param bool $unsafeHydrate Whether to hydrate the entity in an unsafe way. + * + * @return ObjectEntity|bool The saved publication. + */ + private function savePublication(array $data, Source $source, Schema $schema, $flush=true, $unsafeHydrate=false): ObjectEntity|bool + { + try { + $publication = $this->hydrationService->searchAndReplaceSynchronizations( + $data, + $source, + $schema, + $flush, + $unsafeHydrate + ); + + return $publication; + } catch (Exception $exception) { + $this->logger->error(var_export([ 'ERROR' => $exception->getMessage() ], true), [ 'plugin' => 'common-gateway/open-index' ]); + } + + return false; + + }//end savePublication() + + + /** + * Maps the result to the provided mapping. + * + * @param Mapping $mapping The mapping entity that provides the mapping of the result data. + * @param array $result The result data that needs to be mapped. + * + * @return array The mapped result. + */ + private function map(Mapping $mapping, array $result): array + { + try { + $mappedResult = $this->mappingService->mapping($mapping, $result); + } catch (Exception $exception) { + $this->logger->error(var_export([ 'ERROR mappingService' => $exception->getMessage() ], true), [ 'plugin' => 'common-gateway/open-index' ]); + $mappedResult = []; + } + + return $mappedResult; + + }//end map() + + + /** + * Validates the result against the provided schema. + * + * @param array $result The result data that needs to be validated. + * @param Schema $schema The schema entity that provides the schema of the result data. + * @param string $method The method that is used for the validation. + * + * @return bool The validation result. + */ + private function isValidData(array $result, Schema $schema, string $method='POST'): bool + { + try { + $validationErrors = $this->validationService->validateData($result, $schema, $method); + if (null !== $validationErrors) { + $this->logger->error(var_export([ 'validationErrors' => $validationErrors ], true), [ 'plugin' => 'common-gateway/open-index' ]); + + return false; + } + } catch (Exception $exception) { + $this->logger->error(var_export([ 'ERROR validationService' => $exception->getMessage() ], true), [ 'plugin' => 'common-gateway/open-index' ]); + + return false; + } + + return true; + + }//end isValidData() + + + /** + * Fetches objects from TIP with start and end date. + * + * @param Source $source The source entity that provides the source of the result data. + * @param string $start The start date for the API query. + * @param string $end Teh end date for the API query. + * + * @return array The fetched objects. + */ + private function fetchObjects(Source $source, string $start, string $end): array + { + try { + $response = $this->callService->call( + $source, + $this->configuration['caseIndex'], + 'GET', + [ + 'query' => [ + 'startdatum__gte' => $start, + 'einddatum__lt' => $end, + ], + ] + ); + $decodedResponse = $this->callService->decodeResponse($source, $response); + } catch (Exception $e) { + $this->logger->error('Something went wrong fetching '.$source->getLocation().$this->configuration['caseIndex'].': '.$e->getMessage(), [ 'plugin' => 'common-gateway/open-index' ]); + + return []; + } + + if (isset($decodedResponse['count'], $decodedResponse['results']) && $decodedResponse['count'] > 0) { + return $decodedResponse['results']; + } + + return []; + + }//end fetchObjects() + + + /** + * Fetches details from TIP with identification. + * + * @param Source $source The source entity that provides the source of the result data. + * @param string $identification The identification of the object. + * + * @return array The fetched details. + */ + private function fetchDetails(Source $source, string $identification): array + { + try { + $endpoint = str_replace(':identificatie', $identification, $this->configuration['caseDetail']); + $response = $this->callService->call($source, $endpoint); + $decodedResponse = $this->callService->decodeResponse($source, $response); + } catch (Exception $e) { + $this->logger->error('Something went wrong fetching '.$source->getLocation().$endpoint.': '.$e->getMessage(), [ 'plugin' => 'common-gateway/open-index' ]); + + return []; + } + + if (isset($decodedResponse['count'], $decodedResponse['results']) && $decodedResponse['count'] > 0) { + return $decodedResponse['results']; + } + + return []; + + }//end fetchDetails() + + + /** + * Processes temporary attachments. + * + * @param array $attachments The attachments that need to be processed. + * @param Mapping $mapping The mapping entity that provides the mapping of the result data. + * + * @return array The processed temporary attachments. + */ + private function processTemporaryAttachments(array $attachments, Mapping $mapping): array + { + $temporaryDocuments = []; + if (! empty($attachments)) { + foreach ($attachments as $attachment) { + // Map the document. + $temporaryDocument = $this->map($mapping, $attachment); + $temporaryDocuments[] = $temporaryDocument; + } + } + + return $temporaryDocuments; + + }//end processTemporaryAttachments() + + + /** + * Fetches a document from TIP with identification. + * + * @param Source $source The source entity that provides the source of the result data. + * @param string $identification The identification of the object. + * + * @return array|bool The fetched document. + */ + private function fetchDocument(Source $source, string $identification): array|bool + { + try { + $endpoint = str_replace(':identificatie', $identification, $this->configuration['caseDocument']); + $response = $this->callService->call($source, $endpoint); + $decodedResponse = $this->callService->decodeResponse($source, $response); + } catch (Exception $e) { + $this->logger->error('Something went wrong fetching '.$source->getLocation().$endpoint.': '.$e->getMessage(), [ 'plugin' => 'common-gateway/open-index' ]); + + return false; + } + + if (! empty($decodedResponse['identificatie'])) { + return $decodedResponse; + } + + return false; + + }//end fetchDocument() + + +}//end class