diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 282abd579913e29c00c5e56c589a90af2da5aa17..1b9b1db13c63052e9b9c7f45ac52e8f9fee624ca 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,10 +14,13 @@ maven_deploy_snapshot: stage: deploy image: harbor.contezza.nl/tooling/cicd-image:node18-openjdk17 script: + - git config --global user.email "beheer@contezza.nl" + - git config --global user.name "Contezza" + - git checkout -B $CI_COMMIT_REF_NAME - mvn deploy -DskipTests=true $MAVEN_CLI_OPTS only: variables: - - $CI_COMMIT_MESSAGE =~ /deploy/ + - $CI_COMMIT_MESSAGE =~ /create-snapshot/ tags: - cntz-cicd diff --git a/.vscode/settings.json b/.vscode/settings.json index 5fea20e8112f39eb8be81753c6f7574bdf7391cb..147d1ff943f0b28bf7e6695fccbede8dbc11397e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -85,6 +85,7 @@ "contezza", "Creatiedatum", "DOCUMENTEN", + "enkelvoudiginformatieobject", "Enkelvoudiginformatieobject", "ENKELVOUDIGINFORMATIEOBJECT", "enkelvoudiginformatieobjecten", @@ -99,6 +100,7 @@ "Inhoud", "initialise", "integriteit", + "jakarta", "KANAAL", "kenmerken", "LEZEN", @@ -117,7 +119,9 @@ "vaststelling", "versie", "VERSIONABLE", + "Vertrouwelijkheidaanduiding", "VERTROUWELIJKHEIDAANDUIDING", + "vertrouwlijkheid", "VERWIJDEREN", "Waarde", "webscript", diff --git a/docs/src/docs/asciidoc/includes/_introduction.adoc b/docs/src/docs/asciidoc/includes/_introduction.adoc index 4a168abe64c7c9966bbf6d1a84d69c74e74eb5df..b00cc64a482775ba4e0ef921b3fc7d0e9538f871 100644 --- a/docs/src/docs/asciidoc/includes/_introduction.adoc +++ b/docs/src/docs/asciidoc/includes/_introduction.adoc @@ -91,9 +91,9 @@ Voeg onderstaande instellingen toe in bestand `alfresco-global.properties` voor .alfresco-global.properties ---- drc.nrc.enabled=true -drc.nrc.basePath=http://localhost:8000/api/v1 -drc.nrc.clientId= -drc.nrc.secret= +zgw.nrc.0.baseUrl=http://localhost:8000/api/v1 +zgw.nrc.0.clientId= +zgw.nrc.0.secret= ---- === Autorisaties (AC) @@ -104,9 +104,9 @@ Voeg onderstaande instellingen toe in bestand `alfresco-global.properties` voor .alfresco-global.properties ---- drc.ac.enabled=true -drc.ac.basePath=http://localhost:8000/autorisaties/api/v1 -drc.ac.clientId= -drc.ac.secret= +zgw.ac.0.baseUrl=http://localhost:8000/autorisaties/api/v1 +zgw.ac.0.clientId= +zgw.ac.0.secret= ---- === Besluitregistratiecomponent (BRC) @@ -116,9 +116,10 @@ Voeg onderstaande instellingen toe in bestand `alfresco-global.properties` voor [source,properties] .alfresco-global.properties ---- -drc.brc.basePath=http://open-zaak.local:8000/besluiten/api/v1 -drc.brc.clientId= -drc.brc.secret= +drc.brc.enabled=true +zgw.brc.0.baseUrl=http://open-zaak.local:8000/besluiten/api/v1 +zgw.brc.0.clientId= +zgw.brc.0.secret= ---- === Zaaktypecatalogus (ZTC) @@ -128,9 +129,10 @@ Voeg onderstaande instellingen toe in bestand `alfresco-global.properties` voor [source,properties] .alfresco-global.properties ---- -drc.ztc.basePath=http://open-zaak.local:8000/catalogi/api/v1 -drc.ztc.clientId=openzaak -drc.ztc.secret=openzaak +drc.zrc.enabled=true +zgw.zrc.0.baseUrl=http://open-zaak.local:8000/catalogi/api/v1 +zgw.zrc.0.clientId= +zgw.zrc.0.secret= ---- === Zaakregistratiecomponent (ZRC) @@ -140,9 +142,10 @@ Voeg onderstaande instellingen toe in bestand `alfresco-global.properties` voor [source,properties] .alfresco-global.properties ---- -drc.zrc.basePath=http://open-zaak.local:8000/zaken/api/v1 -drc.zrc.clientId=openzaak -drc.zrc.secret=openzaak +drc.ztc.enabled=true +zgw.ztc.0.baseUrl=http://open-zaak.local:8000/zaken/api/v1 +zgw.ztc.0.clientId= +zgw.ztc.0.secret= ---- === Meerdere accounts diff --git a/docs/src/docs/asciidoc/includes/_release_notes.adoc b/docs/src/docs/asciidoc/includes/_release_notes.adoc index 0fd9ac54c76c88cbe5d2172fceefe2c56d22a608..b3b5b7a45a620d71c3408838663d5dbd824835b6 100644 --- a/docs/src/docs/asciidoc/includes/_release_notes.adoc +++ b/docs/src/docs/asciidoc/includes/_release_notes.adoc @@ -7,6 +7,10 @@ Overzicht van de release notities. |=== |Datum |Versie |Omschrijving +|2025-06-26 +|2.3.0 +|Client library vervangen door nieuwe ZGW API (https://support.contezza.nl/issues/32565[#32565]). + |2025-05-28 |2.2.3 |Niet altijd de bestandsdelen ophalen als er geen bestandsdelen meer zijn (https://support.contezza.nl/issues/32211[#32211]). diff --git a/integration-tests/src/test/java/nl/contezza/drc/tests/GebruiksrechtenReadTest.java b/integration-tests/src/test/java/nl/contezza/drc/tests/GebruiksrechtenReadTest.java index 5865fdce015e5a4248afaf29c7ded4e3d72d0d8a..88138ffa52277e6480688f7b8cb4c8d1aa33180f 100644 --- a/integration-tests/src/test/java/nl/contezza/drc/tests/GebruiksrechtenReadTest.java +++ b/integration-tests/src/test/java/nl/contezza/drc/tests/GebruiksrechtenReadTest.java @@ -31,20 +31,25 @@ public class GebruiksrechtenReadTest extends RestTest { json = new JsonPath(ztcService.createInformatieObjectType(catalogusUrl).asString()); informatieobjecttypeUrl = json.getString("url").replace(ZTC_BASE_URI, ZTC_DOCKER_URI); - Response res = ztcService.publishInformatieObjectType(informatieobjecttypeUrl.substring(informatieobjecttypeUrl.lastIndexOf('/') + 1).trim()); + Response res = ztcService.publishInformatieObjectType( + informatieobjecttypeUrl.substring(informatieobjecttypeUrl.lastIndexOf('/') + 1).trim()); Assert.assertEquals(res.getStatusCode(), 200); } /** - * See {@link <a href="https://github.com/VNG-Realisatie/documenten-api/blob/1.0.0/src/drc/api/tests/test_auth.py#L148">python code</a>}. + * See {@link <a href= + * "https://github.com/VNG-Realisatie/documenten-api/blob/1.0.0/src/drc/api/tests/test_auth.py#L148">python + * code</a>}. */ - @Test(groups = "GebruiksrechtenRead") + @Test(groups = "GebruiksrechtenRead", enabled = true) public void test_list_gebruiksrechten_limited_to_authorized_zaken() { EIOService eioService = new EIOService(); - JsonPath json1 = new JsonPath(eioService.testCreate(informatieobjecttypeUrl, "beschrijving1", "inhoud1", "openbaar").asString()); - JsonPath json2 = new JsonPath(eioService.testCreate(informatieobjecttypeUrl, "beschrijving2", "inhoud2", "vertrouwelijk").asString()); + JsonPath json1 = new JsonPath( + eioService.testCreate(informatieobjecttypeUrl, "beschrijving1", "inhoud1", "openbaar").asString()); + JsonPath json2 = new JsonPath( + eioService.testCreate(informatieobjecttypeUrl, "beschrijving2", "inhoud2", "vertrouwelijk").asString()); GebruiksrechtenService gebruiksrechtenService = new GebruiksrechtenService(); Response res1 = gebruiksrechtenService.create(json1.getString("url")); @@ -58,31 +63,38 @@ public class GebruiksrechtenReadTest extends RestTest { String acUrl = res.body().path("results[0].url"); - res = authService.updatePartial(acUrl, new JSONArray().put(DRCRequestSpecification.CLIENT_ID_READONLY), new JSONArray().put("documenten.lezen"), informatieobjecttypeUrl, + res = authService.updatePartial(acUrl, new JSONArray().put(DRCRequestSpecification.CLIENT_ID_READONLY), + new JSONArray().put("documenten.lezen"), informatieobjecttypeUrl, "openbaar"); Assert.assertEquals(res.getStatusCode(), 200); wait(2000); - res = gebruiksrechtenService.get(DRCRequestSpecification.getReadonly(), new JsonPath(res1.asString()).getString("url")); + res = gebruiksrechtenService.get(DRCRequestSpecification.getReadonly(), + new JsonPath(res1.asString()).getString("url")); Assert.assertEquals(res.getStatusCode(), 200); - res = gebruiksrechtenService.get(DRCRequestSpecification.getReadonly(), new JsonPath(res2.asString()).getString("url")); + res = gebruiksrechtenService.get(DRCRequestSpecification.getReadonly(), + new JsonPath(res2.asString()).getString("url")); Assert.assertEquals(res.getStatusCode(), 403); } /** - * See {@link <a href="https://github.com/VNG-Realisatie/documenten-api/blob/1.0.0/src/drc/api/tests/test_auth.py#L175">python code</a>}. + * See {@link <a href= + * "https://github.com/VNG-Realisatie/documenten-api/blob/1.0.0/src/drc/api/tests/test_auth.py#L175">python + * code</a>}. */ - @Test(groups = "GebruiksrechtenRead") + @Test(groups = "GebruiksrechtenRead", enabled = true) public void test_create_gebruiksrechten_limited_to_authorized_zaken() { EIOService eioService = new EIOService(); - JsonPath json1 = new JsonPath(eioService.testCreate(informatieobjecttypeUrl, "beschrijving1", "inhoud1", "openbaar").asString()); - JsonPath json2 = new JsonPath(eioService.testCreate(informatieobjecttypeUrl, "beschrijving2", "inhoud2", "vertrouwelijk").asString()); + JsonPath json1 = new JsonPath( + eioService.testCreate(informatieobjecttypeUrl, "beschrijving1", "inhoud1", "openbaar").asString()); + JsonPath json2 = new JsonPath( + eioService.testCreate(informatieobjecttypeUrl, "beschrijving2", "inhoud2", "vertrouwelijk").asString()); GebruiksrechtenService gebruiksrechtenService = new GebruiksrechtenService(); Response res1 = gebruiksrechtenService.create(DRCRequestSpecification.getWrongScope(), json1.getString("url")); diff --git a/integration-tests/src/test/java/nl/contezza/drc/tests/InformatieObjectReadCorrectScopeTest.java b/integration-tests/src/test/java/nl/contezza/drc/tests/InformatieObjectReadCorrectScopeTest.java index 4cd7f24df4c7da30de455e50559e073b0ba54bd9..eb5891ca364d23929749d3b3d7468d56495b2f4c 100644 --- a/integration-tests/src/test/java/nl/contezza/drc/tests/InformatieObjectReadCorrectScopeTest.java +++ b/integration-tests/src/test/java/nl/contezza/drc/tests/InformatieObjectReadCorrectScopeTest.java @@ -40,7 +40,7 @@ public class InformatieObjectReadCorrectScopeTest extends RestTest { * "https://github.com/VNG-Realisatie/documenten-api/blob/1.0.0/src/drc/api/tests/test_auth.py#L49">python * code</a>}. */ - @Test(groups = "InformatieObjectReadCorrectScope") + @Test(groups = "InformatieObjectReadCorrectScope", enabled = true) public void test_io_list() { EIOService eioService = new EIOService(); @@ -78,7 +78,7 @@ public class InformatieObjectReadCorrectScopeTest extends RestTest { * "https://github.com/VNG-Realisatie/documenten-api/blob/1.0.0/src/drc/api/tests/test_auth.py#L87">python * code</a>}. */ - @Test(groups = "InformatieObjectReadCorrectScope") + @Test(groups = "InformatieObjectReadCorrectScope", enabled = true) public void test_io_retrieve() { EIOService eioService = new EIOService(); @@ -123,7 +123,7 @@ public class InformatieObjectReadCorrectScopeTest extends RestTest { * "https://github.com/VNG-Realisatie/documenten-api/blob/1.0.0/src/drc/api/tests/test_auth.py#L109">python * code</a>}. */ - @Test(groups = "InformatieObjectReadCorrectScope") + @Test(groups = "InformatieObjectReadCorrectScope", enabled = true) public void test_read_superuser() { EIOService eioService = new EIOService(); diff --git a/integration-tests/src/test/java/nl/contezza/drc/tests/OioReadTest.java b/integration-tests/src/test/java/nl/contezza/drc/tests/OioReadTest.java index d0bca23057650d6523c65a1bf2098c762f4f499b..6d899cf5db1ed9bb069af5894ede076f6b38b6ee 100644 --- a/integration-tests/src/test/java/nl/contezza/drc/tests/OioReadTest.java +++ b/integration-tests/src/test/java/nl/contezza/drc/tests/OioReadTest.java @@ -61,7 +61,7 @@ public class OioReadTest extends RestTest { * "https://github.com/VNG-Realisatie/documenten-api/blob/1.0.0/src/drc/api/tests/test_auth.py#L212">python * code</a>}. */ - @Test(groups = "OioRead") + @Test(groups = "OioRead", enabled = true) public void test_list_oio_limited_to_authorized_zaken() { String zaakUrl = zaakTestObject.getString("url").replace(ZRC_BASE_URI, ZRC_DOCKER_URI); @@ -123,7 +123,7 @@ public class OioReadTest extends RestTest { * "https://github.com/VNG-Realisatie/documenten-api/blob/1.0.0/src/drc/api/tests/test_auth.py#L242">python * code</a>}. */ - @Test(groups = "OioRead") + @Test(groups = "OioRead", enabled = true) public void test_detail_oio_limited_to_authorized_zaken() { ZRCService zrcService = new ZRCService(); diff --git a/platform/pom.xml b/platform/pom.xml index 6232657e5af855e1dcab4bfa6ce6452953330b9b..424156d2724e90301a49961f6e3eac34727fa96c 100644 --- a/platform/pom.xml +++ b/platform/pom.xml @@ -1,5 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> @@ -33,12 +35,10 @@ <version>${contezza.contezza-jwt.version}</version> </dependency> - <!-- VNG Realisatie --> - <dependency> - <groupId>nl.vng.commonground</groupId> - <artifactId>vngr-client-api</artifactId> - <version>${vngr.client-api.version}</version> + <groupId>nl.contezza.addons</groupId> + <artifactId>contezza-zgw-api-client-platform</artifactId> + <version>${contezza.contezza-zgw-api-client.version}</version> </dependency> <!-- Thirdparty --> @@ -157,7 +157,8 @@ <version>3.1.0</version> <configuration> <encoding>UTF-8</encoding> - <nonFilteredFileExtensions> <!-- jpg, jpeg, gif, bmp and png are added automatically --> + <nonFilteredFileExtensions> <!-- jpg, jpeg, gif, bmp and png are added + automatically --> <nonFilteredFileExtension>ftl</nonFilteredFileExtension> <nonFilteredFileExtension>acp</nonFilteredFileExtension> <nonFilteredFileExtension>svg</nonFilteredFileExtension> @@ -301,8 +302,10 @@ <excludeScope>compile</excludeScope> </configuration> </execution> - <!-- Collect extensions (JARs or AMPs) declared in this module to be deployed to docker --> - <!-- https://stackoverflow.com/questions/30642630/artifact-has-not-been-packaged-yet --> + <!-- Collect extensions (JARs or AMPs) declared in this module to be deployed to + docker --> + <!-- + https://stackoverflow.com/questions/30642630/artifact-has-not-been-packaged-yet --> <execution> <id>collect-extensions</id> <phase>package</phase> @@ -312,7 +315,8 @@ <configuration> <outputDirectory>${project.build.directory}/extensions</outputDirectory> <includeScope>runtime</includeScope> - <!-- IMPORTANT: if using amp dependencies only, add <includeTypes>amp</includeTypes> --> + <!-- IMPORTANT: if using amp dependencies only, add + <includeTypes>amp</includeTypes> --> </configuration> </execution> @@ -400,7 +404,8 @@ <configuration> <target> <!-- Use Ant's copy task to copy files --> - <copy todir="${project.build.outputDirectory}/alfresco/module/${project.artifactId}"> + <copy + todir="${project.build.outputDirectory}/alfresco/module/${project.artifactId}"> <fileset dir="../docs/target/generated-docs" includes="*.pdf" /> </copy> </target> @@ -423,7 +428,8 @@ </executions> </plugin> - <!-- Runs the integration tests, any class that follows naming convention "**/IT*.java", "**/*IT.java", and "**/*ITCase.java" will be considered an integration test --> + <!-- Runs the integration tests, any class that follows naming convention "**/IT*.java", + "**/*IT.java", and "**/*ITCase.java" will be considered an integration test --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> @@ -473,7 +479,8 @@ </execution> </executions> <configuration> - <!-- For more information about how to configure JRebel plugin see: http://manuals.zeroturnaround.com/jrebel/standalone/maven.html#maven-rebel-xml --> + <!-- For more information about how to configure JRebel plugin see: + http://manuals.zeroturnaround.com/jrebel/standalone/maven.html#maven-rebel-xml --> <classpath> <fallback>all</fallback> <resources> @@ -484,7 +491,9 @@ </resources> </classpath> - <!-- alwaysGenerate - default is false If 'false' - rebel.xml is generated if timestamps of pom.xml and the current rebel.xml file are not equal. If 'true' - rebel.xml will always + <!-- alwaysGenerate - default is false If 'false' - rebel.xml is generated if + timestamps of pom.xml and the current rebel.xml file are not equal. If 'true' - + rebel.xml will always be generated --> <alwaysGenerate>true</alwaysGenerate> </configuration> diff --git a/platform/src/main/docker/alfresco-global.properties b/platform/src/main/docker/alfresco-global.properties index 68777ee7f359b3b0892e0c428c9aa1720e4cc418..6ca1985d71e0e37bb28df41e3040fb19dfa17d7e 100644 --- a/platform/src/main/docker/alfresco-global.properties +++ b/platform/src/main/docker/alfresco-global.properties @@ -66,53 +66,47 @@ drc.maxChunkSize=50 audit.filter.alfresco-access.transaction.user=~System;~null;.* -#drc.nrc.basePath=http://tezza-open-notificaties.local:8000/api/v1 -#drc.nrc.clientId=tezza-notificaties-test -#drc.nrc.secret=4RhynhXSxDeQqepF +#--- Alfresco Documenten API API TEST ---# +# When running test in docker +alfresco.host=drc-docker-platform.local -#drc.ac.basePath=http://tezza-openzaak.local:8000/autorisaties/api/v1 -#drc.ac.clientId=tezza-alfresco-test -#drc.ac.secret=vz7GtKkmb2Gp47GP +drc.url.overwrite= -#drc.ztc.basePath=http://tezza-openzaak.local:8000/catalogi/api/v1 -#drc.ztc.clientId=tezza-alfresco-test -#drc.ztc.secret=vz7GtKkmb2Gp47GP +# Transactional query for supporting unit tests +# https://docs.alfresco.com/search-services/latest/config/transactional/#configuring-an-optional-patch-for-upgrade +system.metadata-query-indexes-more.ignored=false +system.metadata-query-indexes.ignored=false -#drc.zrc.basePath=http://tezza-openzaak.local:8000/zaken/api/v1 -#drc.zrc.clientId=tezza-alfresco-test -#drc.zrc.secret=vz7GtKkmb2Gp47GP +# Custom ZGW Api Client -#drc.brc.basePath=http://tezza-openzaak.local:8000/zaken/api/v1 -#drc.brc.clientId=tezza-alfresco-test -#drc.brc.secret=vz7GtKkmb2Gp47GP +zgw.openzaak.baseUrl=http://open-zaak.local:8000 +zgw.openzaak.clientId=openzaak +zgw.openzaak.secret=openzaak -#--- Alfresco Documenten API API TEST ---# -# When running test in docker -alfresco.host=drc-docker-platform.local +zgw.notificaties.baseUrl=http://open-notificaties.local:8000 +zgw.notificaties.clientId=openzaak +zgw.notificaties.secret=openzaak -drc.nrc.basePath=http://open-notificaties.local:8000/api/v1 -drc.nrc.clientId=openzaak -drc.nrc.secret=openzaak +zgw.ac.0.baseUrl=${zgw.openzaak.baseUrl}/autorisaties/api/v1 +zgw.ac.0.clientId=${zgw.openzaak.clientId} +zgw.ac.0.secret=${zgw.openzaak.secret} -drc.ztc.basePath=http://open-zaak.local:8000/catalogi/api/v1 -drc.ztc.clientId=openzaak -drc.ztc.secret=openzaak +zgw.brc.0.baseUrl=${zgw.openzaak.baseUrl}/besluiten/api/v1 +zgw.brc.0.clientId=${zgw.openzaak.clientId} +zgw.brc.0.secret=${zgw.openzaak.secret} -drc.zrc.basePath=http://open-zaak.local:8000/zaken/api/v1 -drc.zrc.clientId=openzaak -drc.zrc.secret=openzaak +zgw.zrc.0.baseUrl=${zgw.openzaak.baseUrl}/zaken/api/v1 +zgw.zrc.0.clientId=${zgw.openzaak.clientId} +zgw.zrc.0.secret=${zgw.openzaak.secret} -drc.brc.basePath=http://open-zaak.local:8000/besluiten/api/v1 -drc.brc.clientId=openzaak -drc.brc.secret=openzaak +zgw.ztc.0.baseUrl=${zgw.openzaak.baseUrl}/catalogi/api/v1 +zgw.ztc.0.clientId=${zgw.openzaak.clientId} +zgw.ztc.0.secret=${zgw.openzaak.secret} -drc.ac.basePath=http://open-zaak.local:8000/autorisaties/api/v1 -drc.ac.clientId=openzaak -drc.ac.secret=openzaak - -drc.url.overwrite= +zgw.nrc.0.baseUrl=${zgw.notificaties.baseUrl}/api/v1 +zgw.nrc.0.clientId=${zgw.notificaties.clientId} +zgw.nrc.0.secret=${zgw.notificaties.secret} -# Transactional query for supporting unit tests -# https://docs.alfresco.com/search-services/latest/config/transactional/#configuring-an-optional-patch-for-upgrade -system.metadata-query-indexes-more.ignored=false -system.metadata-query-indexes.ignored=false +zgw.ztc.1.baseUrl=${zgw.openzaak.baseUrl}/catalogi/api/v1 +zgw.ztc.1.clientId=${zgw.openzaak.clientId} +zgw.ztc.1.secret=${zgw.openzaak.secret} \ No newline at end of file diff --git a/platform/src/main/java/nl/contezza/drc/helper/DRCValidationHelper.java b/platform/src/main/java/nl/contezza/drc/helper/DRCValidationHelper.java index 9916190cd569f55cffad9293ae1ea48fb1b261a9..680cdf1b3f35d02ce904baa5bf006b11810e04ba 100644 --- a/platform/src/main/java/nl/contezza/drc/helper/DRCValidationHelper.java +++ b/platform/src/main/java/nl/contezza/drc/helper/DRCValidationHelper.java @@ -18,6 +18,7 @@ package nl.contezza.drc.helper; import java.io.IOException; import java.io.Serializable; import java.net.MalformedURLException; +import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.time.LocalDate; @@ -57,12 +58,11 @@ import nl.contezza.drc.service.DRCCatalogiService; import nl.contezza.drc.service.DRCService; import nl.contezza.drc.service.DRCZakenService; import nl.contezza.drc.util.ElfProef; -import nl.vngrealisatie.brc.model.Besluit; -import nl.vngrealisatie.brc.model.BesluitInformatieObject; -import nl.vngrealisatie.zrc.model.Zaak; -import nl.vngrealisatie.zrc.model.ZaakInformatieObject; -import nl.vngrealisatie.ztc.ApiResponse; -import nl.vngrealisatie.ztc.model.InformatieObjectType; +import nl.contezza.zgw.client.brc.model.Besluit; +import nl.contezza.zgw.client.brc.model.BesluitInformatieObject; +import nl.contezza.zgw.client.zrc.model.ZaakExpanded; +import nl.contezza.zgw.client.zrc.model.ZaakInformatieObject; +import nl.contezza.zgw.client.ztc.model.InformatieObjectType; /** * Validation helper to be compliant with the DRC API. @@ -252,10 +252,10 @@ public class DRCValidationHelper { String uri = (String) props.get(RGBZModel.PROP_INFORMATIEOBJECTTYPE); if (isValidURL(uri) && isValidUUID(uri)) { - ApiResponse<InformatieObjectType> response = drcCatalogiService.informatieobjecttypeRead(uri); + InformatieObjectType response = drcCatalogiService.informatieobjecttypeRead(uri); if (response != null) { props.put(RGBZModel.PROP_VERTROUWELIJKHEIDAANDUIDING, - response.getData().getVertrouwelijkheidaanduiding().toString()); + response.getVertrouwelijkheidaanduiding().toString()); } } } @@ -365,11 +365,12 @@ public class DRCValidationHelper { invalidParams); } else { if (objectType.equals("zaak") && isZRCEnabled) { - Zaak response = drcZakenService.zaakRead(objectUrl); + ZaakExpanded response = drcZakenService.zaakRead(objectUrl); if (response == null) { invalidParams.add(newFieldValidationError("object", CODE_INVALID_RESOURCE)); } else { - List<ZaakInformatieObject> items = drcZakenService.zaakinformatieobjectList(response.getUrl(), + List<ZaakInformatieObject> items = drcZakenService.zaakinformatieobjectList( + response.getUrl().toString(), informatieObjectUrl); if (items.size() == 0) { invalidParams.add(newFieldValidationError("nonFieldErrors", CODE_INCONSISTENT_RELATION)); @@ -381,7 +382,7 @@ public class DRCValidationHelper { invalidParams.add(newFieldValidationError("object", CODE_INVALID_RESOURCE)); } else { List<BesluitInformatieObject> items = drcBesluitenService - .besluitinformatieobjectList(response.getUrl(), informatieObjectUrl); + .besluitinformatieobjectList(response.getUrl(), URI.create(informatieObjectUrl)); if (items.size() == 0) { invalidParams.add(newFieldValidationError("nonFieldErrors", CODE_INCONSISTENT_RELATION)); } @@ -1144,14 +1145,14 @@ public class DRCValidationHelper { invalidParams); } - ApiResponse<InformatieObjectType> response = drcCatalogiService.informatieobjecttypeRead(value); + InformatieObjectType response = drcCatalogiService.informatieobjecttypeRead(value); if (response == null) { invalidParams.add(newFieldValidationError("informatieobjecttype", CODE_INVALID_RESOURCE)); return invalidParams; } else if (response != null) { - InformatieObjectType iot = response.getData(); - if (iot.isConcept()) { + InformatieObjectType iot = response; + if (iot.getConcept()) { invalidParams.add(newFieldValidationError("informatieobjecttype", CODE_NOT_PUBLISHED)); return invalidParams; } diff --git a/platform/src/main/java/nl/contezza/drc/messaging/DRCMessageListener.java b/platform/src/main/java/nl/contezza/drc/messaging/DRCMessageListener.java index f2008babd5b558e6fae43246b739562bf8896dec..ce626f22f51461bacd163749c95d9ce4f0425cb2 100644 --- a/platform/src/main/java/nl/contezza/drc/messaging/DRCMessageListener.java +++ b/platform/src/main/java/nl/contezza/drc/messaging/DRCMessageListener.java @@ -16,6 +16,7 @@ package nl.contezza.drc.messaging; import java.io.Serializable; +import java.net.URI; import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; @@ -27,7 +28,7 @@ import org.apache.commons.logging.LogFactory; import nl.contezza.drc.model.RGBZModel; import nl.contezza.drc.service.DRCNotificatiesService; import nl.contezza.drc.service.DRCService; -import nl.vngrealisatie.nrc.model.Message; +import nl.contezza.zgw.client.nrc.model.Message; public class DRCMessageListener { @@ -109,13 +110,13 @@ public class DRCMessageListener { NodeRef ref = new NodeRef(message.getNodeRef()); if (message.getIsEnkelvoudiginformatieobject()) { nrcMessage.setResource(RESOURCE_EIO); - nrcMessage.setResourceUrl(getEnkelvoudiginformatieobjectenUrl(message)); + nrcMessage.setResourceUrl(URI.create(getEnkelvoudiginformatieobjectenUrl(message))); } else if (drcService.isGebruiksrechtItem(ref)) { nrcMessage.setResource(RESOURCE_GEBRUIKSRECHT); - nrcMessage.setResourceUrl(getGebruiksrechtenUrl(message)); + nrcMessage.setResourceUrl(URI.create(getGebruiksrechtenUrl(message))); } - nrcMessage.setHoofdObject(getEnkelvoudiginformatieobjectenUrl(message)); + nrcMessage.setHoofdObject(URI.create(getEnkelvoudiginformatieobjectenUrl(message))); nrcMessage.setKanaal(KANAAL); if (message.getBehaviourType().equals(NodeMessage.BehaviourType.CREATE)) { diff --git a/platform/src/main/java/nl/contezza/drc/service/AuthLevel.java b/platform/src/main/java/nl/contezza/drc/service/AuthLevel.java index fe256a004c7e5082f67e5db899607a2f64d985a3..d75311f44eec68a00df97e485e5a991140d1ad9b 100644 --- a/platform/src/main/java/nl/contezza/drc/service/AuthLevel.java +++ b/platform/src/main/java/nl/contezza/drc/service/AuthLevel.java @@ -17,7 +17,7 @@ package nl.contezza.drc.service; import java.util.List; -import nl.vngrealisatie.ac.model.Drc; +import nl.contezza.zgw.client.ac.model.Drc; public class AuthLevel { diff --git a/platform/src/main/java/nl/contezza/drc/service/DRCAutorisatiesService.java b/platform/src/main/java/nl/contezza/drc/service/DRCAutorisatiesService.java index 3fc75be10d18b0978c837cc8eee5bd59c75d1388..b8d50f9babbc67320c16cead9b96eb2770ad6035 100644 --- a/platform/src/main/java/nl/contezza/drc/service/DRCAutorisatiesService.java +++ b/platform/src/main/java/nl/contezza/drc/service/DRCAutorisatiesService.java @@ -27,15 +27,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; -import nl.vngrealisatie.ac.ApiClient; -import nl.vngrealisatie.ac.ApiException; -import nl.vngrealisatie.ac.Configuration; -import nl.vngrealisatie.ac.api.ApplicatiesApi; -import nl.vngrealisatie.ac.model.Applicatie; -import nl.vngrealisatie.ac.model.AutorisatieBase; -import nl.vngrealisatie.ac.model.AutorisatieBase.ComponentEnum; -import nl.vngrealisatie.ac.model.Drc; -import nl.vngrealisatie.ac.model.InlineResponse200; +import nl.contezza.zgw.client.ac.model.Applicatie; +import nl.contezza.zgw.client.ac.model.AutorisatieBase; +import nl.contezza.zgw.client.ac.model.AutorisatieBase.ComponentEnum; +import nl.contezza.zgw.client.ac.model.Drc; +import nl.contezza.zgw.service.ZgwAcService; public class DRCAutorisatiesService { @@ -60,26 +56,13 @@ public class DRCAutorisatiesService { @Value("${drc.ac.enabled}") private Boolean isEnabled; - @Value("${drc.ac.basePath}") - private String basePath; - @Value("${drc.ac.clientId}") - private String clientId; - @Value("${drc.ac.secret}") - private String secret; - @Value("${drc.ac.tokenExpiresInMinutes}") - private Integer tokenExpiresInMinutes; - @Value("${drc.ac.debugEnabled}") - private Boolean debugEnabled; - @Value("${drc.ac.connectTimeoutInMilliseconds}") - private Integer connectTimeoutInMilliseconds; - @Value("${drc.ac.readTimeoutInMilliseconds}") - private Integer readTimeoutInMilliseconds; - @Value("${drc.ac.writeTimeoutInMilliseconds}") - private Integer writeTimeoutInMilliseconds; @Autowired @Qualifier("DRCService") protected DRCService drcService; + @Autowired + @Qualifier("zgwAcService") + protected ZgwAcService zgwAcService; public Boolean isEnabled() { return isEnabled; @@ -120,7 +103,7 @@ public class DRCAutorisatiesService { for (Applicatie app : list) { - if (app.isHeeftAlleAutorisaties()) { + if (app.getHeeftAlleAutorisaties()) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(String.format("Applicatie '%s' has all authorizations.", app.getLabel())); } @@ -151,7 +134,7 @@ public class DRCAutorisatiesService { } if ((levelCurrent <= levelMax) && auth.getScopes().contains(scope) - && isSameUuid(drc.getInformatieobjecttype(), iotUrl)) { + && isSameUuid(drc.getInformatieobjecttype().toString(), iotUrl)) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(String.format("Applicatie '%s' has scope '%s', level '%s' and url '%s'.", @@ -193,7 +176,7 @@ public class DRCAutorisatiesService { List<AutorisatieBase> autorisaties = app.getAutorisaties(); AuthLevel a = new AuthLevel(); - a.setAllAuth(app.isHeeftAlleAutorisaties()); + a.setAllAuth(app.getHeeftAlleAutorisaties()); List<Drc> cList = new ArrayList<>(); for (AutorisatieBase auth : autorisaties) { if (ComponentEnum.DRC.equals(auth.getComponent())) { @@ -224,31 +207,6 @@ public class DRCAutorisatiesService { return false; } - /** - * Get a instance of the configured Autorisatiecomponent (AC) client. - * - * @return ApiClient the AC API client - */ - private ApiClient client() { - ApiClient client = Configuration.getDefaultApiClient(); - client.setBasePath(basePath); - client.setAccessToken(drcService.getToken(clientId, secret, tokenExpiresInMinutes)); - client.setConnectTimeout(connectTimeoutInMilliseconds); - client.setReadTimeout(readTimeoutInMilliseconds); - client.setWriteTimeout(writeTimeoutInMilliseconds); - client.setDebugging(debugEnabled); - return client; - } - - /** - * The ApplicatiesApi from AC. - * - * @return ApplicatiesApi api - */ - public ApplicatiesApi getApplicatiesApi() { - return new ApplicatiesApi(client()); - } - /** * Geef een collectie van applicaties, met ingesloten autorisaties. De * autorisaties zijn gedefinieerd op een specifieke component, bijvoorbeeld het @@ -265,14 +223,12 @@ public class DRCAutorisatiesService { * @return List<Applicatie> list of applications */ public List<Applicatie> applicatieList(String clientId) { - ApplicatiesApi api = getApplicatiesApi(); try { - InlineResponse200 response = api.applicatieList(clientId, null); + List<Applicatie> list = zgwAcService.applicatieList(clientId, null); List<Applicatie> result = new ArrayList<Applicatie>(); // Filter response - List<Applicatie> list = response.getResults(); for (Applicatie app : list) { List<String> ids = app.getClientIds(); for (String id : ids) { @@ -283,7 +239,7 @@ public class DRCAutorisatiesService { } return result; - } catch (ApiException e) { + } catch (Exception e) { LOGGER.error(e); } return null; diff --git a/platform/src/main/java/nl/contezza/drc/service/DRCBesluitenService.java b/platform/src/main/java/nl/contezza/drc/service/DRCBesluitenService.java index 8875a81f98093b78620ebc92bddc135174f54ebb..b46f4e11a3438552cf8166e77f79629ba5348284 100644 --- a/platform/src/main/java/nl/contezza/drc/service/DRCBesluitenService.java +++ b/platform/src/main/java/nl/contezza/drc/service/DRCBesluitenService.java @@ -15,8 +15,8 @@ */ package nl.contezza.drc.service; +import java.net.URI; import java.util.List; -import java.util.UUID; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; @@ -24,15 +24,10 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; -import nl.vngrealisatie.brc.ApiClient; -import nl.vngrealisatie.brc.ApiException; -import nl.vngrealisatie.brc.Configuration; -import nl.vngrealisatie.brc.api.BesluitenApi; -import nl.vngrealisatie.brc.api.BesluitinformatieobjectenApi; -import nl.vngrealisatie.brc.model.Besluit; -import nl.vngrealisatie.brc.model.BesluitInformatieObject; +import nl.contezza.zgw.client.brc.model.Besluit; +import nl.contezza.zgw.client.brc.model.BesluitInformatieObject; +import nl.contezza.zgw.service.ZgwBrcService; public class DRCBesluitenService { @@ -40,42 +35,12 @@ public class DRCBesluitenService { private static final Log LOGGER = LogFactory.getLog(DRCBesluitenService.class); - @Value("${drc.brc.basePath}") - private String basePath; - @Value("${drc.brc.clientId}") - private String clientId; - @Value("${drc.brc.secret}") - private String secret; - @Value("${drc.brc.tokenExpiresInMinutes}") - private Integer tokenExpiresInMinutes; - @Value("${drc.brc.debugEnabled}") - private Boolean debugEnabled; - @Value("${drc.brc.connectTimeoutInMilliseconds}") - private Integer connectTimeoutInMilliseconds; - @Value("${drc.brc.readTimeoutInMilliseconds}") - private Integer readTimeoutInMilliseconds; - @Value("${drc.brc.writeTimeoutInMilliseconds}") - private Integer writeTimeoutInMilliseconds; - @Autowired @Qualifier("DRCService") protected DRCService drcService; - - /** - * Get a instance of the configured Zaaktypecatalogus (ZTC) client. - * - * @return ApiClient the BRC API client - */ - private ApiClient client() { - ApiClient client = Configuration.getDefaultApiClient(); - client.setBasePath(basePath); - client.setAccessToken(drcService.getToken(clientId, secret, tokenExpiresInMinutes)); - client.setConnectTimeout(connectTimeoutInMilliseconds); - client.setReadTimeout(readTimeoutInMilliseconds); - client.setWriteTimeout(writeTimeoutInMilliseconds); - client.setDebugging(debugEnabled); - return client; - } + @Autowired + @Qualifier("zgwBrcService") + protected ZgwBrcService zgwBrcService; /** * Get specific besluit. @@ -84,12 +49,9 @@ public class DRCBesluitenService { * @return Besluit the besluit */ public Besluit besluitRead(String uuid) { - BesluitenApi api = getBesluitenApi(); - UUID uid = UUID.fromString(drcService.getUuidFromUrl(uuid)); try { - Besluit response = api.besluitRead(uid); - return response; - } catch (ApiException e) { + return zgwBrcService.besluitRead(uuid, null); + } catch (Exception e) { LOGGER.error(e); } return null; @@ -101,32 +63,12 @@ public class DRCBesluitenService { * @param informatieobject * @return */ - public List<BesluitInformatieObject> besluitinformatieobjectList(String besluit, String informatieobject) { - BesluitinformatieobjectenApi api = getBesluitinformatieobjectenApi(); + public List<BesluitInformatieObject> besluitinformatieobjectList(URI besluit, URI informatieobject) { try { - List<BesluitInformatieObject> response = api.besluitinformatieobjectList(besluit, informatieobject); - return response; - } catch (ApiException e) { + return zgwBrcService.besluitinformatieobjectList(besluit, informatieobject); + } catch (Exception e) { LOGGER.error(e); } return null; } - - /** - * The BesluitenAPI from BRC. - * - * @return BesluitenAPI api - */ - public BesluitenApi getBesluitenApi() { - return new BesluitenApi(client()); - } - - /** - * The BesluitinformatieobjectenApi from BRC. - * - * @return BesluitinformatieobjectenApi api - */ - public BesluitinformatieobjectenApi getBesluitinformatieobjectenApi() { - return new BesluitinformatieobjectenApi(client()); - } } \ No newline at end of file diff --git a/platform/src/main/java/nl/contezza/drc/service/DRCCatalogiService.java b/platform/src/main/java/nl/contezza/drc/service/DRCCatalogiService.java index 917eb77f64aa0911b238d3ff3170a7b345bf1420..7864c126006fd152960525ad6cff6ff8d58807af 100644 --- a/platform/src/main/java/nl/contezza/drc/service/DRCCatalogiService.java +++ b/platform/src/main/java/nl/contezza/drc/service/DRCCatalogiService.java @@ -15,23 +15,16 @@ */ package nl.contezza.drc.service; -import java.util.UUID; - import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; import nl.contezza.drc.helper.DRCValidationHelper; -import nl.vngrealisatie.ztc.ApiClient; -import nl.vngrealisatie.ztc.ApiException; -import nl.vngrealisatie.ztc.ApiResponse; -import nl.vngrealisatie.ztc.Configuration; -import nl.vngrealisatie.ztc.api.InformatieobjecttypenApi; -import nl.vngrealisatie.ztc.model.InformatieObjectType; +import nl.contezza.zgw.client.ztc.model.InformatieObjectType; +import nl.contezza.zgw.service.ZgwZtcService; public class DRCCatalogiService { @@ -39,74 +32,22 @@ public class DRCCatalogiService { private static final Log LOGGER = LogFactory.getLog(DRCCatalogiService.class); - @Value("${drc.ztc.basePath}") - private String basePath; - @Value("${drc.ztc.clientId}") - private String clientId; - @Value("${drc.ztc.secret}") - private String secret; - @Value("${drc.ztc.tokenExpiresInMinutes}") - private Integer tokenExpiresInMinutes; - @Value("${drc.ztc.debugEnabled}") - private Boolean debugEnabled; - @Value("${drc.ztc.connectTimeoutInMilliseconds}") - private Integer connectTimeoutInMilliseconds; - @Value("${drc.ztc.readTimeoutInMilliseconds}") - private Integer readTimeoutInMilliseconds; - @Value("${drc.ztc.writeTimeoutInMilliseconds}") - private Integer writeTimeoutInMilliseconds; - @Autowired @Qualifier("DRCService") protected DRCService drcService; @Autowired @Qualifier("DRCValidationHelper") protected DRCValidationHelper drcValidationHelper; + @Autowired + @Qualifier("zgwZtcService") + protected ZgwZtcService zgwZtcService; - /** - * Get a instance of the configured Zaaktypecatalogus (ZTC) client. - * - * @return ApiClient the ZTC API client - */ - private ApiClient client() { - ApiClient client = Configuration.getDefaultApiClient(); - client.setBasePath(basePath); - client.setAccessToken(drcService.getToken(clientId, secret, tokenExpiresInMinutes)); - client.setConnectTimeout(connectTimeoutInMilliseconds); - client.setReadTimeout(readTimeoutInMilliseconds); - client.setWriteTimeout(writeTimeoutInMilliseconds); - client.setDebugging(debugEnabled); - return client; - } - - public ApiResponse<InformatieObjectType> informatieobjecttypeRead(String uuid) { - InformatieobjecttypenApi api = getInformatieobjecttypenApi(); - UUID uid = null; - - String value = drcService.getUuidFromUrl(uuid); - if (drcValidationHelper.isValidUUID(value)) { - uid = UUID.fromString(value); - } - - if (uid == null) { - return null; - } - + public InformatieObjectType informatieobjecttypeRead(String uuid) { try { - ApiResponse<InformatieObjectType> response = api.informatieobjecttypeReadWithHttpInfo(uid, null); - return response; - } catch (ApiException e) { + return zgwZtcService.informatieobjecttypeRetrieve(uuid, null); + } catch (Exception e) { LOGGER.error(e); } return null; } - - /** - * The InformatieobjecttypenApi from ZTC. - * - * @return InformatieobjecttypenApi api - */ - public InformatieobjecttypenApi getInformatieobjecttypenApi() { - return new InformatieobjecttypenApi(client()); - } } \ No newline at end of file diff --git a/platform/src/main/java/nl/contezza/drc/service/DRCNotificatiesService.java b/platform/src/main/java/nl/contezza/drc/service/DRCNotificatiesService.java index b4df73d050084a0193465dc6b7682bd900ff64f1..877d3d3a5032f7385140ab048a3f438b8362754e 100644 --- a/platform/src/main/java/nl/contezza/drc/service/DRCNotificatiesService.java +++ b/platform/src/main/java/nl/contezza/drc/service/DRCNotificatiesService.java @@ -21,15 +21,9 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; -import nl.vngrealisatie.nrc.ApiClient; -import nl.vngrealisatie.nrc.ApiException; -import nl.vngrealisatie.nrc.Configuration; -import nl.vngrealisatie.nrc.api.AbonnementApi; -import nl.vngrealisatie.nrc.api.KanaalApi; -import nl.vngrealisatie.nrc.api.NotificatiesApi; -import nl.vngrealisatie.nrc.model.Message; +import nl.contezza.zgw.client.nrc.model.Message; +import nl.contezza.zgw.service.ZgwNrcService; /** * DRC Notificatie Service. @@ -45,65 +39,9 @@ public class DRCNotificatiesService { @Qualifier("DRCService") protected DRCService drcService; - @Value("${drc.nrc.basePath}") - private String basePath; - @Value("${drc.nrc.clientId}") - private String clientId; - @Value("${drc.nrc.secret}") - private String secret; - @Value("${drc.nrc.tokenExpiresInMinutes}") - private Integer tokenExpiresInMinutes; - @Value("${drc.nrc.debugEnabled}") - private Boolean debugEnabled; - @Value("${drc.nrc.connectTimeoutInMilliseconds}") - private Integer connectTimeoutInMilliseconds; - @Value("${drc.nrc.readTimeoutInMilliseconds}") - private Integer readTimeoutInMilliseconds; - @Value("${drc.nrc.writeTimeoutInMilliseconds}") - private Integer writeTimeoutInMilliseconds; - - /** - * Get a instance of the configured Notificatiecomponent (NRC) client. - * - * @return ApiClient the NRC API client - */ - private ApiClient client() { - ApiClient client = Configuration.getDefaultApiClient(); - client.setBasePath(basePath); - client.setAccessToken(drcService.getToken(clientId, secret, tokenExpiresInMinutes)); - client.setConnectTimeout(connectTimeoutInMilliseconds); - client.setReadTimeout(readTimeoutInMilliseconds); - client.setWriteTimeout(writeTimeoutInMilliseconds); - client.setDebugging(debugEnabled); - return client; - } - - /** - * The AbonnementApi from NRC. - * - * @return AbonnementApi api - */ - public AbonnementApi getAbonnementApi() { - return new AbonnementApi(client()); - } - - /** - * The KanaalApi from NRC. - * - * @return KanaalApi api - */ - public KanaalApi getKanaalApi() { - return new KanaalApi(client()); - } - - /** - * The NotificatiesApi from NRC. - * - * @return NotificatiesApi api - */ - public NotificatiesApi getNotificatiesApi() { - return new NotificatiesApi(client()); - } + @Autowired + @Qualifier("zgwNrcService") + protected ZgwNrcService zgwNrcService; /** * Publish a notification. @@ -112,11 +50,9 @@ public class DRCNotificatiesService { * @return Message or null */ public Message notificatiesCreate(Message body) { - NotificatiesApi api = getNotificatiesApi(); try { - Message response = api.notificatiesCreate(body); - return response; - } catch (ApiException e) { + return zgwNrcService.notificatiesCreate(body); + } catch (Exception e) { LOGGER.error(e); } return null; diff --git a/platform/src/main/java/nl/contezza/drc/service/DRCZakenService.java b/platform/src/main/java/nl/contezza/drc/service/DRCZakenService.java index 1b02884cd0d540e27091da3db4af8e383059f906..8f6d62fd2fb38753d553ec7f09cc03b338d42100 100644 --- a/platform/src/main/java/nl/contezza/drc/service/DRCZakenService.java +++ b/platform/src/main/java/nl/contezza/drc/service/DRCZakenService.java @@ -16,7 +16,6 @@ package nl.contezza.drc.service; import java.util.List; -import java.util.UUID; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; @@ -24,15 +23,10 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; -import nl.vngrealisatie.zrc.ApiClient; -import nl.vngrealisatie.zrc.ApiException; -import nl.vngrealisatie.zrc.Configuration; -import nl.vngrealisatie.zrc.api.ZaakinformatieobjectenApi; -import nl.vngrealisatie.zrc.api.ZakenApi; -import nl.vngrealisatie.zrc.model.Zaak; -import nl.vngrealisatie.zrc.model.ZaakInformatieObject; +import nl.contezza.zgw.client.zrc.model.ZaakExpanded; +import nl.contezza.zgw.client.zrc.model.ZaakInformatieObject; +import nl.contezza.zgw.service.ZgwZrcService; public class DRCZakenService { @@ -40,44 +34,12 @@ public class DRCZakenService { private static final Log LOGGER = LogFactory.getLog(DRCZakenService.class); - private static final String CRS_DEFAULT = "EPSG:4326"; - - @Value("${drc.zrc.basePath}") - private String basePath; - @Value("${drc.zrc.clientId}") - private String clientId; - @Value("${drc.zrc.secret}") - private String secret; - @Value("${drc.zrc.tokenExpiresInMinutes}") - private Integer tokenExpiresInMinutes; - @Value("${drc.zrc.debugEnabled}") - private Boolean debugEnabled; - @Value("${drc.zrc.connectTimeoutInMilliseconds}") - private Integer connectTimeoutInMilliseconds; - @Value("${drc.zrc.readTimeoutInMilliseconds}") - private Integer readTimeoutInMilliseconds; - @Value("${drc.zrc.writeTimeoutInMilliseconds}") - private Integer writeTimeoutInMilliseconds; - @Autowired @Qualifier("DRCService") protected DRCService drcService; - - /** - * Get a instance of the configured Zaaktypecatalogus (ZTC) client. - * - * @return ApiClient the ZRC API client - */ - private ApiClient client() { - ApiClient client = Configuration.getDefaultApiClient(); - client.setBasePath(basePath); - client.setAccessToken(drcService.getToken(clientId, secret, tokenExpiresInMinutes)); - client.setConnectTimeout(connectTimeoutInMilliseconds); - client.setReadTimeout(readTimeoutInMilliseconds); - client.setWriteTimeout(writeTimeoutInMilliseconds); - client.setDebugging(debugEnabled); - return client; - } + @Autowired + @Qualifier("zgwZrcService") + protected ZgwZrcService zgwZrcService; /** * Get specific case. @@ -85,16 +47,14 @@ public class DRCZakenService { * @param uuid String unique identifier or URL * @return Zaak the complete case */ - public Zaak zaakRead(String uuid) { - ZakenApi api = getZakenApi(); - UUID uid = UUID.fromString(drcService.getUuidFromUrl(uuid)); + public ZaakExpanded zaakRead(String uuid) { try { - Zaak response = api.zaakRead(uid, CRS_DEFAULT, CRS_DEFAULT, null); + ZaakExpanded response = zgwZrcService.zaakRetrieve(uuid, ""); if (LOGGER.isDebugEnabled()) { LOGGER.debug(response); } return response; - } catch (ApiException e) { + } catch (Exception e) { LOGGER.error(e); } return null; @@ -108,34 +68,17 @@ public class DRCZakenService { * @return List<ZaakInformatieObject> */ public List<ZaakInformatieObject> zaakinformatieobjectList(String zaak, String informatieobject) { - ZaakinformatieobjectenApi api = getZaakinformatieobjectenApi(); try { - List<ZaakInformatieObject> response = api.zaakinformatieobjectList(zaak, informatieobject); + List<ZaakInformatieObject> response = zgwZrcService.zaakinformatieobjectList( + zaak, + informatieobject); if (LOGGER.isDebugEnabled()) { LOGGER.debug(response); } return response; - } catch (ApiException e) { + } catch (Exception e) { LOGGER.error(e); } return null; } - - /** - * The ZakenAPI from ZRC. - * - * @return ZakenApi api - */ - public ZakenApi getZakenApi() { - return new ZakenApi(client()); - } - - /** - * The ZaakinformatieobjectenApi from ZRC. - * - * @return ZaakinformatieobjectenApi api - */ - public ZaakinformatieobjectenApi getZaakinformatieobjectenApi() { - return new ZaakinformatieobjectenApi(client()); - } } \ No newline at end of file diff --git a/platform/src/main/java/nl/contezza/drc/webscript/AbstractDrcDeclarativeWebScript.java b/platform/src/main/java/nl/contezza/drc/webscript/AbstractDrcDeclarativeWebScript.java index 46447fa5b9d9ea86cf24e81f47eee393fb294ef0..798ed2bbc90e0d9d8d65eccd6aa8fb73c79521d2 100644 --- a/platform/src/main/java/nl/contezza/drc/webscript/AbstractDrcDeclarativeWebScript.java +++ b/platform/src/main/java/nl/contezza/drc/webscript/AbstractDrcDeclarativeWebScript.java @@ -65,9 +65,8 @@ import nl.contezza.drc.service.DRCAuditService; import nl.contezza.drc.service.DRCAutorisatiesService; import nl.contezza.drc.service.DRCCatalogiService; import nl.contezza.drc.service.DRCService; -import nl.vngrealisatie.ac.model.Drc; -import nl.vngrealisatie.ztc.ApiResponse; -import nl.vngrealisatie.ztc.model.InformatieObjectType; +import nl.contezza.zgw.client.ac.model.Drc; +import nl.contezza.zgw.client.ztc.model.InformatieObjectType; /** * The abstract class used for all DRC related API's. @@ -178,9 +177,9 @@ public abstract class AbstractDrcDeclarativeWebScript extends DeclarativeWebScri jsonRequest.toString())); } - ApiResponse<InformatieObjectType> res = drcCatalogiService.informatieobjecttypeRead(iotUrl); + InformatieObjectType res = drcCatalogiService.informatieobjecttypeRead(iotUrl); if (res != null) { - confidentialityName = res.getData().getVertrouwelijkheidaanduiding().toString(); + confidentialityName = res.getVertrouwelijkheidaanduiding().toString(); } } } else if (SCOPE_DOCUMENTEN_LEZEN.equalsIgnoreCase(scope) || SCOPE_DOCUMENTEN_BIJWERKEN.equalsIgnoreCase(scope) @@ -252,7 +251,8 @@ public abstract class AbstractDrcDeclarativeWebScript extends DeclarativeWebScri } // Get scopes for IOT - Drc comp = authLevels.get(0).getDrcComponents().stream().filter(f -> f.getInformatieobjecttype().equals(docIot)) + Drc comp = authLevels.get(0).getDrcComponents().stream() + .filter(f -> f.getInformatieobjecttype().toString().equals(docIot)) .findFirst().orElse(null); if (comp != null && comp.getScopes().contains(SCOPE_DOCUMENTEN_LEZEN)) { Integer levelCurrent = DRCAutorisatiesService.levels.get(docAuthLevel); @@ -321,7 +321,7 @@ public abstract class AbstractDrcDeclarativeWebScript extends DeclarativeWebScri String docAuthLevel = (String) nodeService.getProperty(eioRef, RGBZModel.PROP_VERTROUWELIJKHEIDAANDUIDING); Drc comp = authLevels.get(0).getDrcComponents().stream() - .filter(f -> f.getInformatieobjecttype().equals(docIot)).findFirst().orElse(null); + .filter(f -> f.getInformatieobjecttype().toString().equals(docIot)).findFirst().orElse(null); if (comp == null) { drcValidationHelper.createDrcException(DRCValidationHelper.CODE_PERMISSION_DENIED, 403); diff --git a/platform/src/main/java/nl/contezza/drc/webscript/enkelvoudiginformatieobjecten/EnkelvoudiginformatieobjectenGet.java b/platform/src/main/java/nl/contezza/drc/webscript/enkelvoudiginformatieobjecten/EnkelvoudiginformatieobjectenGet.java index 23e8e65563bad5ef4809f98197f90ce341d4531f..548a4b7a32523da92a7e10f5d31f4d63c129ebdf 100644 --- a/platform/src/main/java/nl/contezza/drc/webscript/enkelvoudiginformatieobjecten/EnkelvoudiginformatieobjectenGet.java +++ b/platform/src/main/java/nl/contezza/drc/webscript/enkelvoudiginformatieobjecten/EnkelvoudiginformatieobjectenGet.java @@ -43,7 +43,7 @@ import nl.contezza.drc.service.AuthLevel; import nl.contezza.drc.util.DateUtil; import nl.contezza.drc.util.ETag; import nl.contezza.drc.webscript.AbstractDrcDeclarativeWebScript; -import nl.vngrealisatie.ac.model.Drc; +import nl.contezza.zgw.client.ac.model.Drc; public class EnkelvoudiginformatieobjectenGet extends AbstractDrcDeclarativeWebScript { diff --git a/platform/src/main/resources/alfresco/module/alfresco-documenten-api-platform/alfresco-global.properties b/platform/src/main/resources/alfresco/module/alfresco-documenten-api-platform/alfresco-global.properties index aadb1165c33f95429307d052028e705487dc1586..c648ad8fdd9c8ba539346f24b7a27221fb28cc12 100644 --- a/platform/src/main/resources/alfresco/module/alfresco-documenten-api-platform/alfresco-global.properties +++ b/platform/src/main/resources/alfresco/module/alfresco-documenten-api-platform/alfresco-global.properties @@ -16,61 +16,6 @@ drc.maxChunkSize=104857600 # Property validations drc.validation.enabled=true -drc.nrc.enabled=true -# Notificatieregistratiecomponent (NRC) -drc.nrc.basePath=${api.nrc.basePath} -drc.nrc.clientId=${api.nrc.clientId} -drc.nrc.secret=${api.nrc.secret} -drc.nrc.tokenExpiresInMinutes=10 -drc.nrc.debugEnabled=false -drc.nrc.connectTimeoutInMilliseconds=30000 -drc.nrc.readTimeoutInMilliseconds=0 -drc.nrc.writeTimeoutInMilliseconds=0 - -drc.ac.enabled=false -# Autorisatiecomponent (AC) -drc.ac.basePath=${api.ac.basePath} -drc.ac.clientId=${api.ac.clientId} -drc.ac.secret=${api.ac.secret} -drc.ac.tokenExpiresInMinutes=10 -drc.ac.debugEnabled=false -drc.ac.connectTimeoutInMilliseconds=30000 -drc.ac.readTimeoutInMilliseconds=0 -drc.ac.writeTimeoutInMilliseconds=0 - -drc.ztc.enabled=true -# Zaaktypecatalogus (ZTC) -drc.ztc.basePath=${api.ztc.basePath} -drc.ztc.clientId=${api.ztc.clientId} -drc.ztc.secret=${api.ztc.secret} -drc.ztc.tokenExpiresInMinutes=10 -drc.ztc.debugEnabled=false -drc.ztc.connectTimeoutInMilliseconds=30000 -drc.ztc.readTimeoutInMilliseconds=0 -drc.ztc.writeTimeoutInMilliseconds=0 - -drc.zrc.enabled=true -# Zaakregistratiecomponent (ZRC) -drc.zrc.basePath=${api.zrc.basePath} -drc.zrc.clientId=${api.zrc.clientId} -drc.zrc.secret=${api.zrc.secret} -drc.zrc.tokenExpiresInMinutes=10 -drc.zrc.debugEnabled=false -drc.zrc.connectTimeoutInMilliseconds=30000 -drc.zrc.readTimeoutInMilliseconds=0 -drc.zrc.writeTimeoutInMilliseconds=0 - -drc.brc.enabled=true -# Besluitregistratiecomponent (ZRC) -drc.brc.basePath=${api.brc.basePath} -drc.brc.clientId=${api.brc.clientId} -drc.brc.secret=${api.brc.secret} -drc.brc.tokenExpiresInMinutes=10 -drc.brc.debugEnabled=false -drc.brc.connectTimeoutInMilliseconds=30000 -drc.brc.readTimeoutInMilliseconds=0 -drc.brc.writeTimeoutInMilliseconds=0 - # Document identifier format drc.identifier.prefix= drc.identifier.dateFormat=yyyy @@ -99,4 +44,43 @@ audit.filter.alfresco-access.transaction.path=~.*/sys:archivedItem.*;~.*/ver:.*; drc.url.overwrite= # Specifies the actions that will not be audited -#audit.filter.alfresco-access.transaction.action=READ;MOVE;COPY;CHECK IN;CHECK OUT;CANCEL CHECK OUT;CREATE VERSION;readContent;addNodeAspect;deleteNodeAspect;updateNodeProperties \ No newline at end of file +#audit.filter.alfresco-access.transaction.action=READ;MOVE;COPY;CHECK IN;CHECK OUT;CANCEL CHECK OUT;CREATE VERSION;readContent;addNodeAspect;deleteNodeAspect;updateNodeProperties + +# ZGW API +drc.ac.enabled=false +# Autorisatiecomponent (AC) +zgw.ac.0.baseUrl=${api.ac.basePath} +zgw.ac.0.clientId=${api.ac.clientId} +zgw.ac.0.secret=${api.ac.secret} + +drc.brc.enabled=true +# Besluitregistratiecomponent (ZRC) +zgw.brc.0.baseUrl=${api.brc.basePath} +zgw.brc.0.clientId=${api.brc.clientId} +zgw.brc.0.secret=${api.brc.secret} + +drc.zrc.enabled=true +# Zaakregistratiecomponent (ZRC) +zgw.zrc.0.baseUrl=${api.zrc.basePath} +zgw.zrc.0.clientId=${api.zrc.clientId} +zgw.zrc.0.secret=${api.zrc.secret} + +drc.ztc.enabled=true +# Zaaktypecatalogus (ZTC) +zgw.ztc.0.baseUrl=${api.ztc.basePath} +zgw.ztc.0.clientId=${api.ztc.clientId} +zgw.ztc.0.secret=${api.ztc.secret} + +drc.nrc.enabled=true +# Notificatieregistratiecomponent (NRC) +zgw.nrc.0.baseUrl=${api.nrc.basePath} +zgw.nrc.0.clientId=${api.nrc.clientId} +zgw.nrc.0.secret=${api.nrc.secret} + +# Objecten +zgw.objects.0.baseUrl=${api.objects.basePath} +zgw.objects.0.apiKey=${api.objects.apiKey} + +# Objecttypen +zgw.objecttypes.0.baseUrl=${api.objecttypes.basePat} +zgw.objecttypes.0.apiKey=${api.objecttypes.apiKey} \ No newline at end of file diff --git a/pom.xml b/pom.xml index f8aa52e5bb0b7f8427cef7bfce3484e0de376a3d..434cb9577be384176177f8c764b37e0b90659cb8 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>nl.contezza.tezza</groupId> <artifactId>alfresco-documenten-api</artifactId> @@ -41,8 +43,10 @@ <docker.share.image>${image.registry}/base/alfresco-enterprise-share/23</docker.share.image> <docker.ass.image>${image.registry}/base/alfresco-search-services</docker.ass.image> <docker.activemq.image>${image.registry}/docker.io/alfresco/alfresco-activemq</docker.activemq.image> - <docker.transform-core-aio.image>${image.registry}/docker.io/alfresco/alfresco-transform-core-aio</docker.transform-core-aio.image> - <docker.shared-file-store.image>${image.registry}/quay.io/alfresco/alfresco-shared-file-store</docker.shared-file-store.image> + <docker.transform-core-aio.image> + ${image.registry}/docker.io/alfresco/alfresco-transform-core-aio</docker.transform-core-aio.image> + <docker.shared-file-store.image> + ${image.registry}/quay.io/alfresco/alfresco-shared-file-store</docker.shared-file-store.image> <docker.transform-router.image>${image.registry}/quay.io/alfresco/alfresco-transform-router</docker.transform-router.image> <!-- Alfresco Modules --> @@ -51,9 +55,7 @@ <!-- Contezza Modules --> <contezza.contezza-jwt.version>2.1.0</contezza.contezza-jwt.version> - - <!-- Open Zaak / VNG Realisatie --> - <vngr.client-api.version>1.0.0</vngr.client-api.version> + <contezza.contezza-zgw-api-client.version>0.1.0</contezza.contezza-zgw-api-client.version> <!-- Thirdparty Modules --> <thirdparty.orderofthebee-support-tools.version>1.2.2.0</thirdparty.orderofthebee-support-tools.version>