From 47565187c7f273c49e0347fb5ad34ae4a3d1f616 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Mon, 29 Nov 2021 08:56:51 +0100 Subject: add SOAP client to search addresses and add first simple test to request address information from real TEST ZMR --- .../eidas/v2/clients/zmr/ZmrAddressSoapClient.java | 283 +++++++++++++++++++++ 1 file changed, 283 insertions(+) create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrAddressSoapClient.java (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main/java') diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrAddressSoapClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrAddressSoapClient.java new file mode 100644 index 00000000..d869ca37 --- /dev/null +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrAddressSoapClient.java @@ -0,0 +1,283 @@ +package at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.zmr; + +import java.math.BigInteger; +import java.net.URL; +import java.text.MessageFormat; +import java.util.List; + +import javax.annotation.Nonnull; +import javax.annotation.PostConstruct; +import javax.xml.ws.BindingProvider; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.lang.Nullable; + +import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.AbstractSoapClient; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasSAuthenticationException; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.ZmrCommunicationException; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.VersionHolder; +import at.gv.bmi.namespace.zmr_su.base._20040201_.address.ClientInfoType; +import at.gv.bmi.namespace.zmr_su.base._20040201_.address.Organisation; +import at.gv.bmi.namespace.zmr_su.base._20040201_.address.RequestType; +import at.gv.bmi.namespace.zmr_su.base._20040201_.address.ResponseType; +import at.gv.bmi.namespace.zmr_su.base._20040201_.address.Service; +import at.gv.bmi.namespace.zmr_su.base._20040201_.address.ServiceFault_Exception; +import at.gv.bmi.namespace.zmr_su.base._20040201_.address.ServicePort; +import at.gv.bmi.namespace.zmr_su.base._20040201_.address.WorkflowInfoClient; +import at.gv.bmi.namespace.zmr_su.base._20040201_.address.WorkflowInfoServer; +import at.gv.bmi.namespace.zmr_su.zrm._20040201_.address.Adressdaten; +import at.gv.bmi.namespace.zmr_su.zrm._20040201_.address.AdresssucheInfoType; +import at.gv.bmi.namespace.zmr_su.zrm._20040201_.address.AdresssucheRequest; +import at.gv.bmi.namespace.zmr_su.zrm._20040201_.address.AdresssuchergebnisType; +import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NonNull; +import lombok.extern.slf4j.Slf4j; + +/** + * ZMR SOAP client for search-address operations. + * + * @author tlenz + * + */ +@Slf4j +public class ZmrAddressSoapClient extends AbstractSoapClient { + + private static final String CLIENT_DEFAULT = "ZMR-AddressSearch Client"; + private static final String CLIENT_INFO = "eIDAS MS-Connector v{0}"; + + private static final String LOGMSG_ZMR_SOAP_ERROR = + "ZMR anwser for transaction: {0} with code: {1} and message: {2}"; + private static final String LOGMSG_ZMR_ERROR = + "Receive an error from ZMR during '{}' operation with msg: {}"; + private static final String LOGMSG_ZMR_RESP_PROCESS = + "Proces ZMR response during '{}' operation failes with msg: {}"; + + private static final String ERROR_MATCHING_07 = "module.eidasauth.matching.07"; + private static final String ERROR_MATCHING_99 = "module.eidasauth.matching.99"; + + private static final String PROCESS_GENERAL = "GP_Abfragen"; + private static final String PROCESS_TASK_ADDRESS_WIZZARD = "ZMR_VO_Adresssuche_im_GWR__6"; + + private static final String PROCESS_TASK_RESPONSE_LEVEL_CITY = "Ortschaft"; + private static final String PROCESS_TASK_RESPONSE_LEVEL_STREET = "Strassenname"; + private static final String PROCESS_TASK_RESPONSE_LEVEL_NUMBER = "Orientierungsnummer"; + + + private static final String PROCESS_ADDRESS_WIZZARD = "PROCESS_SEARCH_WITH_ADDRESS_WIZZARD"; + + private static final String SEARCH_TYPE = "ADRESSSUCHE"; + + + @Autowired VersionHolder versionHolder; + private ServicePort zmrClient; + + @Getter + @AllArgsConstructor + public static class AddressInfo { + private final BigInteger processId; + private final List personResult; + private final DetailLevel level; + + } + + public enum DetailLevel { CITY, STREET, NUMBER, UNKNOWN } + + /** + * Get address information based on ZMR data. + * + * @param addressInfo Search parameters + * @return Address data + * @throws EidasSAuthenticationException In case of an error + */ + public AddressInfo searchAddress(@NonNull Adressdaten addressInfo) + throws EidasSAuthenticationException { + return searchAddress(addressInfo, null); + + } + + /** + * Get address information based on ZMR data. + * + * @param addressInfo Search parameters + * @param prozessInstanzId processId in case of associated requests + * @return Address data + * @throws EidasSAuthenticationException In case of an error + */ + public AddressInfo searchAddress(@NonNull Adressdaten addressInfo, @Nullable BigInteger prozessInstanzId) + throws EidasSAuthenticationException { + try { + RequestType req = new RequestType(); + + // set generic informations + req.setClientInfo(generateClientInfos()); + req.setWorkflowInfoClient(generateWorkFlowInfos(PROCESS_TASK_ADDRESS_WIZZARD, null)); + + AdresssucheRequest search = new AdresssucheRequest(); + req.setAdresssucheRequest(search); + + // set static search type + AdresssucheInfoType searchType = new AdresssucheInfoType(); + searchType.setSuchart(SEARCH_TYPE); + search.setAdresssucheInfo(searchType); + + // set search parameters + search.setAdressdaten(addressInfo); + + // request ZMR address services + log.debug("Requesting ZMR for adddress search ...."); + ResponseType resp = zmrClient.service(req, null); + log.debug("Receice response for address search with #{} elements", + resp.getAdresssucheResponse().getAdresssuchergebnis().getGefundeneSaetze()); + + return new AddressInfo( + extractZmrProcessId(resp.getWorkflowInfoServer()), + resp.getAdresssucheResponse().getAdresssuchergebnis().getAdressdaten(), + extractAddressDetailLevel(resp.getAdresssucheResponse().getAdresssuchergebnis())); + + } catch (final ServiceFault_Exception e) { + final String errorMsg = extractReasonFromError(e); + log.warn(LOGMSG_ZMR_ERROR, PROCESS_ADDRESS_WIZZARD, errorMsg); + throw new ZmrCommunicationException(ERROR_MATCHING_07, new Object[] { errorMsg }, e); + + } catch (final Exception e) { + log.warn(LOGMSG_ZMR_RESP_PROCESS, PROCESS_ADDRESS_WIZZARD, e.getMessage()); + throw new EidasSAuthenticationException(ERROR_MATCHING_99, new Object[] { e.getMessage() }, e); + + } + } + + @PostConstruct + private void initialize() throws EaafConfigurationException { + // set-up the ZMR client + initializeTechnicalZmrClient(); + + } + + private void initializeTechnicalZmrClient() throws EaafConfigurationException { + log.info("Starting ZMR-AddressSearch Client initialization .... "); + final URL url = ZmrAddressSoapClient.class.getResource("/wsdl/addresssearching_client/wsdl/Service.wsdl"); + final Service zmrService = new Service(url); + zmrClient = zmrService.getService(); + + final String zmrServiceUrl = basicConfig.getBasicConfiguration( + Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_ENDPOINT); + if (StringUtils.isEmpty(zmrServiceUrl)) { + log.error("No ZMR-AddressSearch service-URL found. ZMR-AddressSearch-Client initalisiation failed."); + throw new RuntimeException( + "No ZMR-AddressSearch service URL found. ZMR-AddressSearch-Client initalisiation failed."); + + } + + // inject handler + log.info("Use ZMR-AddressSearch service-URL: " + zmrServiceUrl); + injectBindingProvider((BindingProvider) zmrClient, CLIENT_DEFAULT, zmrServiceUrl, + basicConfig.getBasicConfigurationBoolean(Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_DEBUG_TRACEMESSAGES, + false)); + + // inject http parameters and SSL context + log.debug("Inject HTTP client settings ... "); + injectHttpClient(zmrClient, HttpClientConfig.builder() + .clientName(CLIENT_DEFAULT) + .clientType(CLIENT_DEFAULT) + .clientUrl(zmrServiceUrl) + .connectionTimeout(basicConfig.getBasicConfiguration( + Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_TIMEOUT_CONNECTION, + Constants.HTTP_CLIENT_DEFAULT_TIMEOUT_CONNECTION)) + .responseTimeout(basicConfig.getBasicConfiguration( + Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_TIMEOUT_RESPONSE, + Constants.HTTP_CLIENT_DEFAULT_TIMEOUT_RESPONSE)) + .keyStoreConfig(buildKeyStoreConfiguration( + Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_SSL_KEYSTORE_TYPE, + Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_SSL_KEYSTORE_PATH, + Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_SSL_KEYSTORE_PASSWORD, + Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_SSL_KEYSTORE_NAME, + "ZMR-AddressSearch SSL Client-Authentication KeyStore")) + .keyAlias(basicConfig.getBasicConfiguration(Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_SSL_KEYS_ALIAS)) + .keyPassword(basicConfig.getBasicConfiguration( + Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_SSL_KEY_PASSWORD)) + .trustAll(false) + .trustStoreConfig(buildKeyStoreConfiguration( + Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_SSL_TRUSTSTORE_TYPE, + Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_SSL_TRUSTSTORE_PATH, + Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_SSL_TRUSTSTORE_PASSWORD, + Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_SSL_TRUSTSTORE_NAME, + "ZMR-AddressSearch SSL Client-Authentication TrustStore")) + .build()); + + } + + @Nonnull + private ClientInfoType generateClientInfos() { + final ClientInfoType clientInfo = new ClientInfoType(); + final Organisation clientOrganisation = new Organisation(); + clientInfo.setOrganisation(clientOrganisation); + + // set client information + clientInfo.setClient(MessageFormat.format(CLIENT_INFO, versionHolder.getVersion())); + + // set Behoerdennummer as organization identifier + clientOrganisation.setBehoerdenNr(basicConfig.getBasicConfiguration( + Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_REQ_ORGANIZATION_NR)); + + return clientInfo; + } + + @Nonnull + private static String extractReasonFromError(ServiceFault_Exception e) { + if (e.getFaultInfo() != null) { + return MessageFormat.format(LOGMSG_ZMR_SOAP_ERROR, + e.getFaultInfo().getServerTransaktionNr().toString(), + e.getFaultInfo().getErrorCode(), + e.getFaultInfo().getErrorMessage()); + + } else { + log.error("ZMR response without error code", e); + return e.getMessage(); + + } + } + + @Nonnull + private static WorkflowInfoClient generateWorkFlowInfos(@Nonnull String subStepName, + @Nullable BigInteger prozessInstanzId) { + final WorkflowInfoClient infos = new WorkflowInfoClient(); + infos.setProzessName(PROCESS_GENERAL); + infos.setVorgangName(subStepName); + + //set processId that we received from ZMR before, if already available + if (prozessInstanzId != null) { + infos.setProzessInstanzID(prozessInstanzId); + + } + + return infos; + + } + + private static BigInteger extractZmrProcessId(WorkflowInfoServer workflowInfoServer) { + return workflowInfoServer != null ? workflowInfoServer.getProzessInstanzID() : null; + + } + + private static DetailLevel extractAddressDetailLevel(AdresssuchergebnisType value) { + switch (value.getDetailgrad()) { + case PROCESS_TASK_RESPONSE_LEVEL_CITY: + return DetailLevel.CITY; + + case PROCESS_TASK_RESPONSE_LEVEL_STREET: + return DetailLevel.STREET; + + case PROCESS_TASK_RESPONSE_LEVEL_NUMBER: + return DetailLevel.NUMBER; + + default: + return DetailLevel.UNKNOWN; + + } + } + +} -- cgit v1.2.3 From e5934d538aabcfc1f3b92472753de729d6ce1cce Mon Sep 17 00:00:00 2001 From: Christian Kollmann Date: Thu, 2 Dec 2021 09:06:55 +0100 Subject: Search with user provided input in ZMR for addresses --- basicConfig/properties/messages.properties | 6 +- basicConfig/properties/messages_de.properties | 6 +- basicConfig/templates/residency.html | 13 ++- .../controller/AdresssucheController.java | 84 +++++++++++++--- .../src/main/resources/templates/residency.html | 13 ++- .../config/properties/messages.properties | 6 +- .../config/properties/messages_de.properties | 6 +- .../test/resources/config/templates/residency.html | 13 ++- .../eidas/v2/clients/zmr/ZmrAddressSoapClient.java | 110 +++++++++++---------- 9 files changed, 176 insertions(+), 81 deletions(-) (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main/java') diff --git a/basicConfig/properties/messages.properties b/basicConfig/properties/messages.properties index 4d9f48a0..51a5f27a 100644 --- a/basicConfig/properties/messages.properties +++ b/basicConfig/properties/messages.properties @@ -123,4 +123,8 @@ gui.residency.cancel=Cancel gui.residency.search=Search gui.residency.proceed=Proceed gui.residency.updated=Updated your input -gui.residency.error=Error on Backend Call \ No newline at end of file +gui.residency.error=Error on Backend Call +gui.residency.input.municipality=Municipality +gui.residency.input.village=Village +gui.residency.input.street=Street +gui.residency.input.number=Number \ No newline at end of file diff --git a/basicConfig/properties/messages_de.properties b/basicConfig/properties/messages_de.properties index cfbd98da..c2d1edba 100644 --- a/basicConfig/properties/messages_de.properties +++ b/basicConfig/properties/messages_de.properties @@ -122,4 +122,8 @@ gui.residency.cancel=Abbrechen gui.residency.search=Suche gui.residency.proceed=Weiter gui.residency.updated=Eingabe aktualisiert -gui.residency.error=Fehler bei Addresssuche \ No newline at end of file +gui.residency.error=Fehler bei Addresssuche +gui.residency.input.municipality=Gemeinde +gui.residency.input.village=Ortschaft +gui.residency.input.street=Straße +gui.residency.input.number=Nummer \ No newline at end of file diff --git a/basicConfig/templates/residency.html b/basicConfig/templates/residency.html index 96fa13f8..3c3c05d7 100644 --- a/basicConfig/templates/residency.html +++ b/basicConfig/templates/residency.html @@ -20,7 +20,8 @@ url: "http://localhost:8080/ms_connector/residency/search", data: $("#inputForm").serialize() }).done(function (data, textStatus, jqXHR) { - $("#inputCity").val(data["city"]); + $("#inputMunicipality").val(data["municipality"]); + $("#inputVillage").val(data["village"]); $("#inputStreet").val(data["street"]); $("#inputNumber").val(data["number"]); $("#textInfo").text(updatedText); @@ -43,11 +44,15 @@

Infotext

-
- - + + +
+
+ +
diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java index 35f56012..8b25a7bd 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java @@ -25,13 +25,19 @@ package at.asitplus.eidas.specific.connector.controller; import at.asitplus.eidas.specific.connector.MsEidasNodeConstants; import at.asitplus.eidas.specific.connector.gui.StaticGuiBuilderConfiguration; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.zmr.ZmrAddressSoapClient; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasSAuthenticationException; +import at.gv.bmi.namespace.zmr_su.zrm._20040201_.address.Adressdaten; +import at.gv.e_government.reference.namespace.persondata.de._20040201.PostAdresseTyp; +import at.gv.e_government.reference.namespace.persondata.de._20040201.ZustelladresseTyp; import at.gv.egiz.eaaf.core.api.gui.IGuiBuilderConfiguration; import at.gv.egiz.eaaf.core.api.gui.ISpringMvcGuiFormBuilder; import at.gv.egiz.eaaf.core.api.idp.IConfiguration; import at.gv.egiz.eaaf.core.api.utils.IPendingRequestIdGenerationStrategy; import at.gv.egiz.eaaf.core.exceptions.GuiBuildException; -import at.gv.egiz.eaaf.core.exceptions.PendingReqIdValidationException; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.ResourceLoader; import org.springframework.http.ResponseEntity; @@ -61,6 +67,9 @@ public class AdresssucheController { @Autowired private ResourceLoader resourceLoader; + @Autowired + private ZmrAddressSoapClient client; + @Autowired private IPendingRequestIdGenerationStrategy pendingReqGeneration; @@ -79,11 +88,12 @@ public class AdresssucheController { } @RequestMapping(value = {"/residency/search"}, method = {RequestMethod.POST}) - public ResponseEntity search(@RequestParam("city") String city, + public ResponseEntity search(@RequestParam("municipality") String municipality, + @RequestParam("village") String village, @RequestParam("street") String street, @RequestParam("number") String number, @RequestParam("pendingid") String pendingId) { - log.info("Search with '{}', '{}', '{}'", city, street, number); + log.info("Search with '{}', '{}', '{}'", municipality, street, number); // TODO validate pendingId // try { // pendingReqGeneration.validateAndGetPendingRequestId(pendingId); @@ -91,23 +101,74 @@ public class AdresssucheController { // log.warn("Search with pendingId '{}' is not valid", pendingId); // return ResponseEntity.badRequest().build(); // } - AdresssucheOutput output = new AdresssucheOutput("Where the streets have no name", "No Name", "42"); - return ResponseEntity.ok(output); + try { + Adressdaten searchInput = buildSearchInput(municipality, village, street, number); + ZmrAddressSoapClient.AddressInfo searchOutput = client.searchAddress(searchInput); + AdresssucheOutput output = buildResponse(searchOutput); + return ResponseEntity.ok(output); + } catch (EidasSAuthenticationException e) { + log.warn("Search failed", e); + return ResponseEntity.badRequest().build(); + } + } + + private AdresssucheOutput buildResponse(ZmrAddressSoapClient.AddressInfo searchOutput) { + if (searchOutput.getPersonResult().isEmpty()) { + log.warn("No result from ZMR"); + return new AdresssucheOutput(null, null, null, null); + } + Adressdaten adressdaten = searchOutput.getPersonResult().iterator().next(); + String municipality = adressdaten.getPostAdresse().getGemeinde(); + String village = adressdaten.getPostAdresse().getOrtschaft(); + String street = adressdaten.getPostAdresse().getZustelladresse().getStrassenname(); + String number = adressdaten.getPostAdresse().getZustelladresse().getOrientierungsnummer(); + log.debug("Result from ZMR: '{}', '{}', '{}', '{}'", municipality, village, street, number); + return new AdresssucheOutput(municipality, village, street, number); + } + + @NotNull + private Adressdaten buildSearchInput(String municipality, String village, String street, String number) { + PostAdresseTyp postAdresse = new PostAdresseTyp(); + if (StringUtils.isNotBlank(municipality)) { + postAdresse.setGemeinde(municipality); + } + if (StringUtils.isNotBlank(village)) { + postAdresse.setOrtschaft(village); + } + if (StringUtils.isNotBlank(street) || StringUtils.isNotBlank(number)) { + ZustelladresseTyp zustelladresse = new ZustelladresseTyp(); + if (StringUtils.isNotBlank(street)) { + zustelladresse.setStrassenname(street); + } + if (StringUtils.isNotBlank(number)) { + zustelladresse.setOrientierungsnummer(number); + } + postAdresse.setZustelladresse(zustelladresse); + } + Adressdaten searchInput = new Adressdaten(); + searchInput.setPostAdresse(postAdresse); + return searchInput; } public static class AdresssucheOutput { - private final String city; + private final String municipality; + private final String village; private final String street; private final String number; - public AdresssucheOutput(String city, String street, String number) { - this.city = city; + public AdresssucheOutput(String municipality, String village, String street, String number) { + this.municipality = municipality; + this.village = village; this.street = street; this.number = number; } - public String getCity() { - return city; + public String getMunicipality() { + return municipality; + } + + public String getVillage() { + return village; } public String getStreet() { @@ -121,7 +182,8 @@ public class AdresssucheController { @Override public String toString() { return "AdresssucheOutput{" + - "city='" + city + '\'' + + "municipality='" + municipality + '\'' + + ", village='" + village + '\'' + ", street='" + street + '\'' + ", number='" + number + '\'' + '}'; diff --git a/connector/src/main/resources/templates/residency.html b/connector/src/main/resources/templates/residency.html index 44ae4bd5..38f490ca 100644 --- a/connector/src/main/resources/templates/residency.html +++ b/connector/src/main/resources/templates/residency.html @@ -20,7 +20,8 @@ url: "http://localhost:8080/ms_connector/residency/search", data: $("#inputForm").serialize() }).done(function (data, textStatus, jqXHR) { - $("#inputCity").val(data["city"]); + $("#inputMunicipality").val(data["municipality"]); + $("#inputVillage").val(data["village"]); $("#inputStreet").val(data["street"]); $("#inputNumber").val(data["number"]); $("#textInfo").text(updatedText); @@ -43,11 +44,15 @@

Infotext

-
- - + + +
+
+ +
diff --git a/connector/src/test/resources/config/properties/messages.properties b/connector/src/test/resources/config/properties/messages.properties index 8ffc5560..1e0f04d0 100644 --- a/connector/src/test/resources/config/properties/messages.properties +++ b/connector/src/test/resources/config/properties/messages.properties @@ -110,4 +110,8 @@ gui.residency.cancel=Cancel gui.residency.search=Search gui.residency.proceed=Proceed gui.residency.updated=Updated your input -gui.residency.error=Error on Backend Call \ No newline at end of file +gui.residency.error=Error on Backend Call +gui.residency.input.municipality=Municipality +gui.residency.input.village=Village +gui.residency.input.street=Street +gui.residency.input.number=Number \ No newline at end of file diff --git a/connector/src/test/resources/config/properties/messages_de.properties b/connector/src/test/resources/config/properties/messages_de.properties index a79aa41a..e0eea9d1 100644 --- a/connector/src/test/resources/config/properties/messages_de.properties +++ b/connector/src/test/resources/config/properties/messages_de.properties @@ -111,4 +111,8 @@ gui.residency.cancel=Abbrechen gui.residency.search=Suche gui.residency.proceed=Weiter gui.residency.updated=Eingabe aktualisiert -gui.residency.error=Fehler bei Addresssuche \ No newline at end of file +gui.residency.error=Fehler bei Addresssuche +gui.residency.input.municipality=Gemeinde +gui.residency.input.village=Ortschaft +gui.residency.input.street=Straße +gui.residency.input.number=Nummer \ No newline at end of file diff --git a/connector/src/test/resources/config/templates/residency.html b/connector/src/test/resources/config/templates/residency.html index 8845cba0..17e21044 100644 --- a/connector/src/test/resources/config/templates/residency.html +++ b/connector/src/test/resources/config/templates/residency.html @@ -20,7 +20,8 @@ url: "http://localhost:8080/ms_connector/residency/search", data: $("#inputForm").serialize() }).done(function (data, textStatus, jqXHR) { - $("#inputCity").val(data["city"]); + $("#inputMunicipality").val(data["municipality"]); + $("#inputVillage").val(data["village"]); $("#inputStreet").val(data["street"]); $("#inputNumber").val(data["number"]); $("#textInfo").text(updatedText); @@ -43,11 +44,15 @@

Infotext

-
- - + + +
+
+ +
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrAddressSoapClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrAddressSoapClient.java index d869ca37..5fb839af 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrAddressSoapClient.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrAddressSoapClient.java @@ -39,18 +39,18 @@ import lombok.extern.slf4j.Slf4j; /** * ZMR SOAP client for search-address operations. - * + * * @author tlenz * */ @Slf4j public class ZmrAddressSoapClient extends AbstractSoapClient { - + private static final String CLIENT_DEFAULT = "ZMR-AddressSearch Client"; private static final String CLIENT_INFO = "eIDAS MS-Connector v{0}"; - + private static final String LOGMSG_ZMR_SOAP_ERROR = - "ZMR anwser for transaction: {0} with code: {1} and message: {2}"; + "ZMR anwser for transaction: {0} with code: {1} and message: {2}"; private static final String LOGMSG_ZMR_ERROR = "Receive an error from ZMR during '{}' operation with msg: {}"; private static final String LOGMSG_ZMR_RESP_PROCESS = @@ -58,37 +58,37 @@ public class ZmrAddressSoapClient extends AbstractSoapClient { private static final String ERROR_MATCHING_07 = "module.eidasauth.matching.07"; private static final String ERROR_MATCHING_99 = "module.eidasauth.matching.99"; - + private static final String PROCESS_GENERAL = "GP_Abfragen"; private static final String PROCESS_TASK_ADDRESS_WIZZARD = "ZMR_VO_Adresssuche_im_GWR__6"; - + private static final String PROCESS_TASK_RESPONSE_LEVEL_CITY = "Ortschaft"; private static final String PROCESS_TASK_RESPONSE_LEVEL_STREET = "Strassenname"; private static final String PROCESS_TASK_RESPONSE_LEVEL_NUMBER = "Orientierungsnummer"; - - + + private static final String PROCESS_ADDRESS_WIZZARD = "PROCESS_SEARCH_WITH_ADDRESS_WIZZARD"; - + private static final String SEARCH_TYPE = "ADRESSSUCHE"; - - - @Autowired VersionHolder versionHolder; + + + @Autowired VersionHolder versionHolder; private ServicePort zmrClient; - + @Getter @AllArgsConstructor - public static class AddressInfo { + public static class AddressInfo { private final BigInteger processId; private final List personResult; private final DetailLevel level; - + } - + public enum DetailLevel { CITY, STREET, NUMBER, UNKNOWN } - + /** - * Get address information based on ZMR data. - * + * Get address information based on ZMR data. + * * @param addressInfo Search parameters * @return Address data * @throws EidasSAuthenticationException In case of an error @@ -96,12 +96,12 @@ public class ZmrAddressSoapClient extends AbstractSoapClient { public AddressInfo searchAddress(@NonNull Adressdaten addressInfo) throws EidasSAuthenticationException { return searchAddress(addressInfo, null); - + } - + /** - * Get address information based on ZMR data. - * + * Get address information based on ZMR data. + * * @param addressInfo Search parameters * @param prozessInstanzId processId in case of associated requests * @return Address data @@ -111,33 +111,33 @@ public class ZmrAddressSoapClient extends AbstractSoapClient { throws EidasSAuthenticationException { try { RequestType req = new RequestType(); - + // set generic informations req.setClientInfo(generateClientInfos()); req.setWorkflowInfoClient(generateWorkFlowInfos(PROCESS_TASK_ADDRESS_WIZZARD, null)); - + AdresssucheRequest search = new AdresssucheRequest(); req.setAdresssucheRequest(search); - + // set static search type AdresssucheInfoType searchType = new AdresssucheInfoType(); searchType.setSuchart(SEARCH_TYPE); search.setAdresssucheInfo(searchType); - + // set search parameters - search.setAdressdaten(addressInfo); + search.setAdressdaten(addressInfo); // request ZMR address services log.debug("Requesting ZMR for adddress search ...."); ResponseType resp = zmrClient.service(req, null); - log.debug("Receice response for address search with #{} elements", - resp.getAdresssucheResponse().getAdresssuchergebnis().getGefundeneSaetze()); - + log.debug("Receice response for address search with #{} elements", + resp.getAdresssucheResponse().getAdresssuchergebnis().getGefundeneSaetze()); + return new AddressInfo( - extractZmrProcessId(resp.getWorkflowInfoServer()), - resp.getAdresssucheResponse().getAdresssuchergebnis().getAdressdaten(), + extractZmrProcessId(resp.getWorkflowInfoServer()), + resp.getAdresssucheResponse().getAdresssuchergebnis().getAdressdaten(), extractAddressDetailLevel(resp.getAdresssucheResponse().getAdresssuchergebnis())); - + } catch (final ServiceFault_Exception e) { final String errorMsg = extractReasonFromError(e); log.warn(LOGMSG_ZMR_ERROR, PROCESS_ADDRESS_WIZZARD, errorMsg); @@ -154,7 +154,7 @@ public class ZmrAddressSoapClient extends AbstractSoapClient { private void initialize() throws EaafConfigurationException { // set-up the ZMR client initializeTechnicalZmrClient(); - + } private void initializeTechnicalZmrClient() throws EaafConfigurationException { @@ -206,10 +206,10 @@ public class ZmrAddressSoapClient extends AbstractSoapClient { Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_SSL_TRUSTSTORE_PASSWORD, Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_SSL_TRUSTSTORE_NAME, "ZMR-AddressSearch SSL Client-Authentication TrustStore")) - .build()); - + .build()); + } - + @Nonnull private ClientInfoType generateClientInfos() { final ClientInfoType clientInfo = new ClientInfoType(); @@ -218,14 +218,14 @@ public class ZmrAddressSoapClient extends AbstractSoapClient { // set client information clientInfo.setClient(MessageFormat.format(CLIENT_INFO, versionHolder.getVersion())); - + // set Behoerdennummer as organization identifier clientOrganisation.setBehoerdenNr(basicConfig.getBasicConfiguration( Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_REQ_ORGANIZATION_NR)); - + return clientInfo; } - + @Nonnull private static String extractReasonFromError(ServiceFault_Exception e) { if (e.getFaultInfo() != null) { @@ -239,10 +239,10 @@ public class ZmrAddressSoapClient extends AbstractSoapClient { return e.getMessage(); } - } - + } + @Nonnull - private static WorkflowInfoClient generateWorkFlowInfos(@Nonnull String subStepName, + private static WorkflowInfoClient generateWorkFlowInfos(@Nonnull String subStepName, @Nullable BigInteger prozessInstanzId) { final WorkflowInfoClient infos = new WorkflowInfoClient(); infos.setProzessName(PROCESS_GENERAL); @@ -251,33 +251,35 @@ public class ZmrAddressSoapClient extends AbstractSoapClient { //set processId that we received from ZMR before, if already available if (prozessInstanzId != null) { infos.setProzessInstanzID(prozessInstanzId); - + } - + return infos; } - + private static BigInteger extractZmrProcessId(WorkflowInfoServer workflowInfoServer) { - return workflowInfoServer != null ? workflowInfoServer.getProzessInstanzID() : null; + return workflowInfoServer != null ? workflowInfoServer.getProzessInstanzID() : null; } - + private static DetailLevel extractAddressDetailLevel(AdresssuchergebnisType value) { + if (value.getDetailgrad() == null) + return DetailLevel.UNKNOWN; switch (value.getDetailgrad()) { case PROCESS_TASK_RESPONSE_LEVEL_CITY: return DetailLevel.CITY; - + case PROCESS_TASK_RESPONSE_LEVEL_STREET: return DetailLevel.STREET; - + case PROCESS_TASK_RESPONSE_LEVEL_NUMBER: return DetailLevel.NUMBER; - + default: return DetailLevel.UNKNOWN; - + } } - + } -- cgit v1.2.3 From ac56869c2a981e40d6cf4637fb8fd46c06207c9d Mon Sep 17 00:00:00 2001 From: Christian Kollmann Date: Thu, 2 Dec 2021 16:05:57 +0100 Subject: Add PLZ to search for adresses in ZMR --- basicConfig/properties/messages.properties | 1 + basicConfig/properties/messages_de.properties | 1 + basicConfig/templates/residency.html | 312 +++++++++++---------- .../controller/AdresssucheController.java | 69 +++-- .../src/main/resources/templates/residency.html | 26 +- .../config/properties/messages.properties | 1 + .../config/properties/messages_de.properties | 1 + .../test/resources/config/templates/residency.html | 26 +- .../eidas/v2/clients/zmr/ZmrAddressSoapClient.java | 3 +- 9 files changed, 250 insertions(+), 190 deletions(-) (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main/java') diff --git a/basicConfig/properties/messages.properties b/basicConfig/properties/messages.properties index 76ce5b16..ab7988c9 100644 --- a/basicConfig/properties/messages.properties +++ b/basicConfig/properties/messages.properties @@ -131,6 +131,7 @@ gui.residency.found=Found {0} results gui.residency.unique=Unique result found, please proceed gui.residency.error=Error on Backend Call gui.residency.apply=Apply +gui.residency.input.postleitzahl=Postcode gui.residency.input.municipality=Municipality gui.residency.input.village=Village gui.residency.input.street=Street diff --git a/basicConfig/properties/messages_de.properties b/basicConfig/properties/messages_de.properties index bca258ee..e539c2d9 100644 --- a/basicConfig/properties/messages_de.properties +++ b/basicConfig/properties/messages_de.properties @@ -130,6 +130,7 @@ gui.residency.found={0} Ergebnisse gefunden gui.residency.unique=Eindeutiges Ergebnis gefunden, bitte fortfahren gui.residency.error=Fehler bei Addresssuche gui.residency.apply=Übernehmen +gui.residency.input.postleitzahl=PLZ gui.residency.input.municipality=Gemeinde gui.residency.input.village=Ortschaft gui.residency.input.street=Straße diff --git a/basicConfig/templates/residency.html b/basicConfig/templates/residency.html index 9dc1153d..b434b9f9 100644 --- a/basicConfig/templates/residency.html +++ b/basicConfig/templates/residency.html @@ -5,168 +5,180 @@ th:with="lang=${#locale.language}" th:lang="${lang}"> - - - - - Österreichischer Wohnsitz - + Österreichischer Wohnsitz + - + function clearInput() { + $("#inputForm #inputMunicipality").val(""); + $("#inputForm #inputVillage").val(""); + $("#inputForm #inputStreet").val(""); + $("#inputForm #inputNumber").val(""); + $("#textResult").hide(); + $("#tableResult").hide(); + } + +
-
- LanguageSelectionBlock -
+
+ LanguageSelectionBlock +
-

Search your Austrian Residency

+

Search your Austrian Residency

-
- -
Please enter a Municipality or Village first
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
-
- -
-
- -
-
- -
- - -
- -
-
-

+
+
+
Please enter a Municipality or Village first
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
- - - - - - - - - - - - -
MunicipalityVillageStreetNumberApply
-
+
+
+

+
+ + + + + + + + + + + + + + +
PostleitzahlMunicipalityVillageStreetNumberApply
+
-
- - - -
+
+ + + +
diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java index c35aa8b9..f71917c3 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java @@ -30,11 +30,12 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasSAuthenti import at.gv.bmi.namespace.zmr_su.zrm._20040201_.address.Adressdaten; import at.gv.e_government.reference.namespace.persondata.de._20040201.PostAdresseTyp; import at.gv.e_government.reference.namespace.persondata.de._20040201.ZustelladresseTyp; -import at.gv.egiz.eaaf.core.api.gui.IGuiBuilderConfiguration; import at.gv.egiz.eaaf.core.api.gui.ISpringMvcGuiFormBuilder; import at.gv.egiz.eaaf.core.api.idp.IConfiguration; import at.gv.egiz.eaaf.core.api.utils.IPendingRequestIdGenerationStrategy; +import at.gv.egiz.eaaf.core.exceptions.EaafException; import at.gv.egiz.eaaf.core.exceptions.GuiBuildException; +import at.gv.egiz.eaaf.core.exceptions.PendingReqIdValidationException; import lombok.AllArgsConstructor; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -51,7 +52,10 @@ import org.springframework.web.bind.annotation.RequestParam; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Set; import java.util.stream.Collectors; /** @@ -78,9 +82,13 @@ public class AdresssucheController { @Autowired private IPendingRequestIdGenerationStrategy pendingReqGeneration; + /** + * Show the "residency.html" directly. + * TODO Remove this after testing. + */ @RequestMapping(value = {"/test"}, method = {RequestMethod.GET}) - public void test(HttpServletRequest request, HttpServletResponse response) throws GuiBuildException { - final IGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( + public void test(HttpServletRequest request, HttpServletResponse response) throws GuiBuildException, EaafException { + final StaticGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( basicConfig, "http://localhost:8080/ms_connector/", basicConfig.getBasicConfiguration(//TODO @@ -88,26 +96,34 @@ public class AdresssucheController { MsEidasNodeConstants.TEMPLATE_HTML_RESIDENCY), MsEidasNodeConstants.ENDPOINT_RESIDENCY_INPUT, resourceLoader); - // TODO Set the pendingId somehow + config.putCustomParameter(null, "pendingid", pendingReqGeneration.generateExternalPendingRequestId()); guiBuilder.build(request, response, config, "Query Austrian residency"); } + /** + * Performs search for addresses in ZMR. + */ @RequestMapping(value = {"/residency/search"}, method = {RequestMethod.POST}) - public ResponseEntity search(@RequestParam("municipality") String municipality, + public ResponseEntity search(@RequestParam("postleitzahl") String postleitzahl, + @RequestParam("municipality") String municipality, @RequestParam("village") String village, @RequestParam("street") String street, @RequestParam("number") String number, @RequestParam("pendingid") String pendingId) { - log.info("Search with '{}', '{}', '{}'", municipality, street, number); - // TODO validate pendingId -// try { -// pendingReqGeneration.validateAndGetPendingRequestId(pendingId); -// } catch (PendingReqIdValidationException e) { -// log.warn("Search with pendingId '{}' is not valid", pendingId); -// return ResponseEntity.badRequest().build(); -// } + log.info("Search with '{}', '{}', '{}', '{}', '{}'", + postleitzahl.replaceAll("[\r\n]", ""), + municipality.replaceAll("[\r\n]", ""), + village.replaceAll("[\r\n]", ""), + street.replaceAll("[\r\n]", ""), + number.replaceAll("[\r\n]", "")); try { - Adressdaten searchInput = buildSearchInput(municipality, village, street, number); + pendingReqGeneration.validateAndGetPendingRequestId(pendingId); + } catch (PendingReqIdValidationException e) { + log.warn("Search with pendingId '{}' is not valid", pendingId.replaceAll("[\r\n]", "")); + return ResponseEntity.badRequest().build(); + } + try { + Adressdaten searchInput = buildSearchInput(postleitzahl, municipality, village, street, number); ZmrAddressSoapClient.AddressInfo searchOutput = client.searchAddress(searchInput); AdresssucheResult output = buildResponse(searchOutput); return ResponseEntity.ok(output); @@ -120,24 +136,28 @@ public class AdresssucheController { private AdresssucheResult buildResponse(ZmrAddressSoapClient.AddressInfo searchOutput) { if (searchOutput.getPersonResult().isEmpty()) { log.warn("No result from ZMR"); - return new AdresssucheResult(Collections.emptyList(), 0, false, null); + return new AdresssucheResult(Collections.emptyList(), 0); } - boolean moreResults = false; - new HashSet<>(); log.info("Result level is {}", searchOutput.getLevel()); Set result = searchOutput.getPersonResult().stream() .map(Adressdaten::getPostAdresse) - .map(it -> new AdresssucheOutput(it.getGemeinde(), it.getOrtschaft(), + .map(it -> new AdresssucheOutput(it.getPostleitzahl(), it.getGemeinde(), it.getOrtschaft(), it.getZustelladresse().getStrassenname(), it.getZustelladresse().getOrientierungsnummer())) .collect(Collectors.toSet()); // TODO Add configuration option for the limit of 30 List sorted = result.stream().sorted().limit(30).collect(Collectors.toList()); - return new AdresssucheResult(sorted, result.size(), moreResults, searchOutput.getLevel().name()); + return new AdresssucheResult(sorted, result.size()); } - @NotNull - private Adressdaten buildSearchInput(String municipality, String village, String street, String number) { + private Adressdaten buildSearchInput(String postleitzahl, + String municipality, + String village, + String street, + String number) { PostAdresseTyp postAdresse = new PostAdresseTyp(); + if (StringUtils.isNotBlank(postleitzahl)) { + postAdresse.setPostleitzahl(postleitzahl); + } if (StringUtils.isNotBlank(municipality)) { postAdresse.setGemeinde(municipality); } @@ -164,14 +184,12 @@ public class AdresssucheController { public static class AdresssucheResult { private final Collection results; private final int resultCount; - private final boolean moreResults; - private final String detailLevel; - } @Data @AllArgsConstructor public static class AdresssucheOutput implements Comparable { + private final String postleitzahl; private final String municipality; private final String village; private final String street; @@ -180,6 +198,7 @@ public class AdresssucheController { @Override public int compareTo(@NotNull AdresssucheOutput o) { return new CompareToBuilder() + .append(this.postleitzahl, o.postleitzahl) .append(this.municipality, o.municipality) .append(this.village, o.village) .append(this.street, o.street) diff --git a/connector/src/main/resources/templates/residency.html b/connector/src/main/resources/templates/residency.html index 3f0532dd..b434b9f9 100644 --- a/connector/src/main/resources/templates/residency.html +++ b/connector/src/main/resources/templates/residency.html @@ -33,7 +33,8 @@ let foundText = /*[[#{gui.residency.found}]]*/ 'Found {0}'; let uniqueText = /*[[#{gui.residency.unique}]]*/ 'Unique'; let invalidInputText = /*[[#{gui.residency.header.inputinvalid}]]*/ 'Invalid'; - if (!$("#inputForm #inputMunicipality").val().trim() && !$("#inputForm #inputVillage").val().trim()) { + if (!$("#inputForm #inputMunicipality").val().trim() && !$("#inputForm #inputPostleitzahl").val().trim() && + !$("#inputForm #inputVillage").val().trim()) { $("#textResult").show().text(invalidInputText); return; } @@ -46,6 +47,7 @@ $("#textResult").show().text(uniqueText); $("#tableResult tbody").empty(); $("#tableResult").hide(); + $("#inputForm #inputPostleitzahl").val(data["results"][0]["postleitzahl"]); $("#inputForm #inputMunicipality").val(data["results"][0]["municipality"]); $("#inputForm #inputVillage").val(data["results"][0]["village"]); $("#inputForm #inputStreet").val(data["results"][0]["street"]); @@ -58,20 +60,25 @@ $.each(data.results, function (i, output) { $("#tableResult tbody") .append($("") + .append($("").text(output["postleitzahl"] !== null ? output["postleitzahl"] : "")) .append($("").text(output["municipality"] !== null ? output["municipality"] : "")) .append($("").text(output["village"] !== null ? output["village"] : "")) .append($("").text(output["street"] !== null ? output["street"] : "")) .append($("").text(output["number"] !== null ? output["number"] : "")) .append($("").text(applyText).attr("href", "#").click(function () { - $("#inputForm #inputMunicipality").val($(this).parent().children("td:nth-child(1)").text()); - $("#inputForm #inputVillage").val($(this).parent().children("td:nth-child(2)").text()); - $("#inputForm #inputStreet").val($(this).parent().children("td:nth-child(3)").text()); - $("#inputForm #inputNumber").val($(this).parent().children("td:nth-child(4)").text()); + $("#inputForm #inputPostleitzahl").val($(this).parent().children("td:nth-child(1)").text()); + $("#inputForm #inputMunicipality").val($(this).parent().children("td:nth-child(2)").text()); + $("#inputForm #inputVillage").val($(this).parent().children("td:nth-child(3)").text()); + $("#inputForm #inputStreet").val($(this).parent().children("td:nth-child(4)").text()); + $("#inputForm #inputNumber").val($(this).parent().children("td:nth-child(5)").text()); $("#textResult").show().text(updatedText); search(); })) ); }) + if (data.results.length == 0) { + $("#tableResult").hide(); + } }).fail(function (jqXHR, textStatus, errorThrown) { $("#textResult").show().text(errorText); }) @@ -106,6 +113,10 @@
Please enter a Municipality or Village first
+
+ + +
@@ -134,8 +145,8 @@
- +
@@ -148,6 +159,7 @@ + diff --git a/connector/src/test/resources/config/properties/messages.properties b/connector/src/test/resources/config/properties/messages.properties index 51befbfc..2f99d892 100644 --- a/connector/src/test/resources/config/properties/messages.properties +++ b/connector/src/test/resources/config/properties/messages.properties @@ -118,6 +118,7 @@ gui.residency.found=Found {0} results gui.residency.unique=Unique result found, please proceed gui.residency.error=Error on Backend Call gui.residency.apply=Apply +gui.residency.input.postleitzahl=Postcode gui.residency.input.municipality=Municipality gui.residency.input.village=Village gui.residency.input.street=Street diff --git a/connector/src/test/resources/config/properties/messages_de.properties b/connector/src/test/resources/config/properties/messages_de.properties index c67e445f..ead751d0 100644 --- a/connector/src/test/resources/config/properties/messages_de.properties +++ b/connector/src/test/resources/config/properties/messages_de.properties @@ -119,6 +119,7 @@ gui.residency.found={0} Ergebnisse gefunden gui.residency.unique=Eindeutiges Ergebnis gefunden, bitte fortfahren gui.residency.error=Fehler bei Addresssuche gui.residency.apply=Übernehmen +gui.residency.input.postleitzahl=PLZ gui.residency.input.municipality=Gemeinde gui.residency.input.village=Ortschaft gui.residency.input.street=Straße diff --git a/connector/src/test/resources/config/templates/residency.html b/connector/src/test/resources/config/templates/residency.html index 77c13fb7..99de851a 100644 --- a/connector/src/test/resources/config/templates/residency.html +++ b/connector/src/test/resources/config/templates/residency.html @@ -33,7 +33,8 @@ let foundText = /*[[#{gui.residency.found}]]*/ 'Found {0}'; let uniqueText = /*[[#{gui.residency.unique}]]*/ 'Unique'; let invalidInputText = /*[[#{gui.residency.header.inputinvalid}]]*/ 'Invalid'; - if (!$("#inputForm #inputMunicipality").val().trim() && !$("#inputForm #inputVillage").val().trim()) { + if (!$("#inputForm #inputMunicipality").val().trim() && !$("#inputForm #inputPostleitzahl").val().trim() && + !$("#inputForm #inputVillage").val().trim()) { $("#textResult").show().text(invalidInputText); return; } @@ -46,6 +47,7 @@ $("#textResult").show().text(uniqueText); $("#tableResult tbody").empty(); $("#tableResult").hide(); + $("#inputForm #inputPostleitzahl").val(data["results"][0]["postleitzahl"]); $("#inputForm #inputMunicipality").val(data["results"][0]["municipality"]); $("#inputForm #inputVillage").val(data["results"][0]["village"]); $("#inputForm #inputStreet").val(data["results"][0]["street"]); @@ -58,20 +60,25 @@ $.each(data.results, function (i, output) { $("#tableResult tbody") .append($("") + .append($("
Postleitzahl Municipality Village Street
").text(output["postleitzahl"] !== null ? output["postleitzahl"] : "")) .append($("").text(output["municipality"] !== null ? output["municipality"] : "")) .append($("").text(output["village"] !== null ? output["village"] : "")) .append($("").text(output["street"] !== null ? output["street"] : "")) .append($("").text(output["number"] !== null ? output["number"] : "")) .append($("").text(applyText).attr("href", "#").click(function () { - $("#inputForm #inputMunicipality").val($(this).parent().children("td:nth-child(1)").text()); - $("#inputForm #inputVillage").val($(this).parent().children("td:nth-child(2)").text()); - $("#inputForm #inputStreet").val($(this).parent().children("td:nth-child(3)").text()); - $("#inputForm #inputNumber").val($(this).parent().children("td:nth-child(4)").text()); + $("#inputForm #inputPostleitzahl").val($(this).parent().children("td:nth-child(1)").text()); + $("#inputForm #inputMunicipality").val($(this).parent().children("td:nth-child(2)").text()); + $("#inputForm #inputVillage").val($(this).parent().children("td:nth-child(3)").text()); + $("#inputForm #inputStreet").val($(this).parent().children("td:nth-child(4)").text()); + $("#inputForm #inputNumber").val($(this).parent().children("td:nth-child(5)").text()); $("#textResult").show().text(updatedText); search(); })) ); }) + if (data.results.length == 0) { + $("#tableResult").hide(); + } }).fail(function (jqXHR, textStatus, errorThrown) { $("#textResult").show().text(errorText); }) @@ -106,6 +113,10 @@
Please enter a Municipality or Village first
+
+ + +
@@ -134,8 +145,8 @@
- +
@@ -148,6 +159,7 @@ + diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrAddressSoapClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrAddressSoapClient.java index 5fb839af..6e146ddf 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrAddressSoapClient.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrAddressSoapClient.java @@ -264,8 +264,9 @@ public class ZmrAddressSoapClient extends AbstractSoapClient { } private static DetailLevel extractAddressDetailLevel(AdresssuchergebnisType value) { - if (value.getDetailgrad() == null) + if (value.getDetailgrad() == null) { return DetailLevel.UNKNOWN; + } switch (value.getDetailgrad()) { case PROCESS_TASK_RESPONSE_LEVEL_CITY: return DetailLevel.CITY; -- cgit v1.2.3
Postleitzahl Municipality Village Street