aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kollmann <christian.kollmann@a-sit.at>2021-12-02 16:05:57 +0100
committerChristian Kollmann <christian.kollmann@a-sit.at>2021-12-07 10:07:15 +0100
commitac56869c2a981e40d6cf4637fb8fd46c06207c9d (patch)
treef6e7ae5ed63dcf8a822e88d9a3e16f527f5a1e38
parent6fff1b53525348d531c96b45c920a8ce72288f60 (diff)
downloadNational_eIDAS_Gateway-ac56869c2a981e40d6cf4637fb8fd46c06207c9d.tar.gz
National_eIDAS_Gateway-ac56869c2a981e40d6cf4637fb8fd46c06207c9d.tar.bz2
National_eIDAS_Gateway-ac56869c2a981e40d6cf4637fb8fd46c06207c9d.zip
Add PLZ to search for adresses in ZMR
-rw-r--r--basicConfig/properties/messages.properties1
-rw-r--r--basicConfig/properties/messages_de.properties1
-rw-r--r--basicConfig/templates/residency.html312
-rw-r--r--connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java69
-rw-r--r--connector/src/main/resources/templates/residency.html26
-rw-r--r--connector/src/test/resources/config/properties/messages.properties1
-rw-r--r--connector/src/test/resources/config/properties/messages_de.properties1
-rw-r--r--connector/src/test/resources/config/templates/residency.html26
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrAddressSoapClient.java3
9 files changed, 250 insertions, 190 deletions
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}">
<head>
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="$contextPath/static/css/css_country.css" th:href="@{/static/css/css_country.css}"/>
- <script type="text/javascript" src="$contextPath/static/js/jquery-3.6.0.js"
- th:attr="src=@{/static/js/jquery-3.6.0.min.js}"></script>
- <title th:text="#{gui.residency.title}">Österreichischer Wohnsitz</title>
- <script type="text/javascript" th:inline="javascript">
- $(document).ready(function () {
- $("#textResult").hide();
- $("#tableResult").hide();
- $("#loading").hide();
- $.ajaxSetup({
- beforeSend: function () {
- $("#loading").show();
- },
- complete: function () {
- $("#loading").hide();
- }
- });
- });
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="stylesheet" href="$contextPath/static/css/css_country.css" th:href="@{/static/css/css_country.css}"/>
+ <script type="text/javascript" src="$contextPath/static/js/jquery-3.6.0.js"
+ th:attr="src=@{/static/js/jquery-3.6.0.min.js}"></script>
+ <title th:text="#{gui.residency.title}">Österreichischer Wohnsitz</title>
+ <script type="text/javascript" th:inline="javascript">
+ $(document).ready(function () {
+ $("#textResult").hide();
+ $("#tableResult").hide();
+ $("#loading").hide();
+ $.ajaxSetup({
+ beforeSend: function () {
+ $("#loading").show();
+ },
+ complete: function () {
+ $("#loading").hide();
+ }
+ });
+ });
- function search() {
- let updatedText = /*[[#{gui.residency.updated}]]*/ 'Updated text';
- let errorText = /*[[#{gui.residency.error}]]*/ 'Error';
- let applyText = /*[[#{gui.residency.apply}]]*/ 'Apply';
- 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()) {
- $("#textResult").show().text(invalidInputText);
- return;
- }
- $.ajax({
- type: "POST",
- url: "http://localhost:8080/ms_connector/residency/search",
- data: $("#inputForm").serialize()
- }).done(function (data, textStatus, jqXHR) {
- if (data["resultCount"] == 1) {
- $("#textResult").show().text(uniqueText);
- $("#tableResult tbody").empty();
- $("#tableResult").hide();
- $("#inputForm #inputMunicipality").val(data["results"][0]["municipality"]);
- $("#inputForm #inputVillage").val(data["results"][0]["village"]);
- $("#inputForm #inputStreet").val(data["results"][0]["street"]);
- $("#inputForm #inputNumber").val(data["results"][0]["number"]);
- return;
+ function search() {
+ let updatedText = /*[[#{gui.residency.updated}]]*/ 'Updated text';
+ let errorText = /*[[#{gui.residency.error}]]*/ 'Error';
+ let applyText = /*[[#{gui.residency.apply}]]*/ 'Apply';
+ 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 #inputPostleitzahl").val().trim() &&
+ !$("#inputForm #inputVillage").val().trim()) {
+ $("#textResult").show().text(invalidInputText);
+ return;
+ }
+ $.ajax({
+ type: "POST",
+ url: "http://localhost:8080/ms_connector/residency/search",
+ data: $("#inputForm").serialize()
+ }).done(function (data, textStatus, jqXHR) {
+ if (data["resultCount"] == 1) {
+ $("#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"]);
+ $("#inputForm #inputNumber").val(data["results"][0]["number"]);
+ return;
+ }
+ $("#textResult").show().text(foundText.replace("{0}", data["resultCount"]));
+ $("#tableResult").show();
+ $("#tableResult tbody").empty();
+ $.each(data.results, function (i, output) {
+ $("#tableResult tbody")
+ .append($("<tr>")
+ .append($("<td>").text(output["postleitzahl"] !== null ? output["postleitzahl"] : ""))
+ .append($("<td>").text(output["municipality"] !== null ? output["municipality"] : ""))
+ .append($("<td>").text(output["village"] !== null ? output["village"] : ""))
+ .append($("<td>").text(output["street"] !== null ? output["street"] : ""))
+ .append($("<td>").text(output["number"] !== null ? output["number"] : ""))
+ .append($("<td>").text(applyText).attr("href", "#").click(function () {
+ $("#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);
+ })
}
- $("#textResult").show().text(foundText.replace("{0}", data["resultCount"]));
- $("#tableResult").show();
- $("#tableResult tbody").empty();
- $.each(data.results, function (i, output) {
- $("#tableResult tbody")
- .append($("<tr>")
- .append($("<td>").text(output["municipality"] !== null ? output["municipality"] : ""))
- .append($("<td>").text(output["village"] !== null ? output["village"] : ""))
- .append($("<td>").text(output["street"] !== null ? output["street"] : ""))
- .append($("<td>").text(output["number"] !== null ? output["number"] : ""))
- .append($("<td>").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());
- $("#textResult").show().text(updatedText);
- search();
- }))
- );
- })
- }).fail(function (jqXHR, textStatus, errorThrown) {
- $("#textResult").show().text(errorText);
- })
- }
- function clearInput() {
- $("#inputForm #inputMunicipality").val("");
- $("#inputForm #inputVillage").val("");
- $("#inputForm #inputStreet").val("");
- $("#inputForm #inputNumber").val("");
- $("#textResult").hide();
- $("#tableResult").hide();
- }
- </script>
- <style>
- td {
- padding: 0.5em;
- margin: 0.5em;
- }
- </style>
+ function clearInput() {
+ $("#inputForm #inputMunicipality").val("");
+ $("#inputForm #inputVillage").val("");
+ $("#inputForm #inputStreet").val("");
+ $("#inputForm #inputNumber").val("");
+ $("#textResult").hide();
+ $("#tableResult").hide();
+ }
+ </script>
+ <style>
+ td {
+ padding: 0.5em;
+ margin: 0.5em;
+ }
+ </style>
</head>
<body>
<div id="page">
- <div class="languageselection" th:include="language_selection :: selectlanguage">
- LanguageSelectionBlock
- </div>
+ <div class="languageselection" th:include="language_selection :: selectlanguage">
+ LanguageSelectionBlock
+ </div>
- <h2 th:text="#{gui.residency.header.selection}">Search your Austrian Residency</h2>
+ <h2 th:text="#{gui.residency.header.selection}">Search your Austrian Residency</h2>
- <div id="residency">
- <form id="inputForm" method="post" action="$contextPath$submitEndpoint"
- th:attr="action=@{${submitEndpoint}}">
- <div th:text="#{gui.residency.header.help}">Please enter a Municipality or Village first</div>
- <div>
- <label for="inputMunicipality" th:text="#{gui.residency.input.municipality}">Municipality</label>
- <input type="text" id="inputMunicipality" name="municipality" value=""/>
- </div>
- <div>
- <label for="inputVillage" th:text="#{gui.residency.input.village}">Village</label>
- <input type="text" id="inputVillage" name="village" value=""/>
- </div>
- <div>
- <label for="inputStreet" th:text="#{gui.residency.input.street}">Street</label>
- <input type="text" id="inputStreet" name="street" value=""/>
- </div>
- <div>
- <label for="inputNumber" th:text="#{gui.residency.input.number}">Number</label>
- <input type="text" id="inputNumber" name="number" value=""/>
- </div>
- <div>
- <button type="button" class="block" onclick="search()" th:attr="value=#{gui.residency.search}">Search
- </button>
- </div>
- <div>
- <button type="button" class="block" onclick="clearInput()" th:attr="value=#{gui.residency.clear}">Clear
- </button>
- </div>
- <div>
- <button type="button" class="block" th:attr="value=#{gui.residency.proceed}">Proceed</button>
- </div>
- <div>
- <img id="loading" src="$contextPath/static/img/ajax-loader.gif"
- th:attr="src=@{/static/img/ajax-loader.gif}" />
- </div>
- <input type="hidden" name="pendingid" value="$pendingid" th:attr="value=${pendingid}"/>
- </form>
- </div>
-
- <div id="result">
- <div>
- <p><span id="textResult"></span></p>
+ <div id="residency">
+ <form id="inputForm" method="post" action="$contextPath$submitEndpoint"
+ th:attr="action=@{${submitEndpoint}}">
+ <div th:text="#{gui.residency.header.help}">Please enter a Municipality or Village first</div>
+ <div>
+ <label for="inputPostleitzahl" th:text="#{gui.residency.input.postleitzahl}">Postleitzahl</label>
+ <input type="text" id="inputPostleitzahl" name="postleitzahl" value=""/>
+ </div>
+ <div>
+ <label for="inputMunicipality" th:text="#{gui.residency.input.municipality}">Municipality</label>
+ <input type="text" id="inputMunicipality" name="municipality" value=""/>
+ </div>
+ <div>
+ <label for="inputVillage" th:text="#{gui.residency.input.village}">Village</label>
+ <input type="text" id="inputVillage" name="village" value=""/>
+ </div>
+ <div>
+ <label for="inputStreet" th:text="#{gui.residency.input.street}">Street</label>
+ <input type="text" id="inputStreet" name="street" value=""/>
+ </div>
+ <div>
+ <label for="inputNumber" th:text="#{gui.residency.input.number}">Number</label>
+ <input type="text" id="inputNumber" name="number" value=""/>
+ </div>
+ <div>
+ <button type="button" class="block" onclick="search()" th:attr="value=#{gui.residency.search}">Search
+ </button>
+ </div>
+ <div>
+ <button type="button" class="block" onclick="clearInput()" th:attr="value=#{gui.residency.clear}">Clear
+ </button>
+ </div>
+ <div>
+ <button type="button" class="block" th:attr="value=#{gui.residency.proceed}">Proceed</button>
+ </div>
+ <div>
+ <img id="loading" src="$contextPath/static/img/ajax-loader.gif"
+ th:attr="src=@{/static/img/ajax-loader.gif}"/>
+ </div>
+ <input type="hidden" name="pendingid" value="$pendingid" th:attr="value=${pendingid}"/>
+ </form>
</div>
- <table id="tableResult">
- <thead>
- <tr>
- <th th:text="#{gui.residency.input.municipality}">Municipality</th>
- <th th:text="#{gui.residency.input.village}">Village</th>
- <th th:text="#{gui.residency.input.street}">Street</th>
- <th th:text="#{gui.residency.input.number}">Number</th>
- <th th:text="#{gui.residency.apply}">Apply</th>
- </tr>
- </thead>
- <tbody>
- </tbody>
- </table>
- </div>
+ <div id="result">
+ <div>
+ <p><span id="textResult"></span></p>
+ </div>
+ <table id="tableResult">
+ <thead>
+ <tr>
+ <th th:text="#{gui.residency.input.postleitzahl}">Postleitzahl</th>
+ <th th:text="#{gui.residency.input.municipality}">Municipality</th>
+ <th th:text="#{gui.residency.input.village}">Village</th>
+ <th th:text="#{gui.residency.input.street}">Street</th>
+ <th th:text="#{gui.residency.input.number}">Number</th>
+ <th th:text="#{gui.residency.apply}">Apply</th>
+ </tr>
+ </thead>
+ <tbody>
+
+ </tbody>
+ </table>
+ </div>
- <form class="block" method="post" action="$contextPath$submitEndpoint" th:attr="action=@{${submitEndpoint}}">
- <input type="submit" class="btn btn-outline-primary btn-block" value="Abbrechen/Cancel"
- th:attr="value=#{gui.residency.cancel}">
- <input type="hidden" name="stopAuthProcess" value="true">
- <input type="hidden" name="pendingid" value="$pendingid" th:attr="value=${pendingid}">
- </form>
+ <form class="block" method="post" action="$contextPath$submitEndpoint" th:attr="action=@{${submitEndpoint}}">
+ <input type="submit" class="btn btn-outline-primary btn-block" value="Abbrechen/Cancel"
+ th:attr="value=#{gui.residency.cancel}">
+ <input type="hidden" name="stopAuthProcess" value="true">
+ <input type="hidden" name="pendingid" value="$pendingid" th:attr="value=${pendingid}">
+ </form>
</div>
</body>
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<AdresssucheResult> search(@RequestParam("municipality") String municipality,
+ public ResponseEntity<AdresssucheResult> 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<AdresssucheOutput> 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<AdresssucheOutput> 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<AdresssucheOutput> results;
private final int resultCount;
- private final boolean moreResults;
- private final String detailLevel;
-
}
@Data
@AllArgsConstructor
public static class AdresssucheOutput implements Comparable<AdresssucheOutput> {
+ 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($("<tr>")
+ .append($("<td>").text(output["postleitzahl"] !== null ? output["postleitzahl"] : ""))
.append($("<td>").text(output["municipality"] !== null ? output["municipality"] : ""))
.append($("<td>").text(output["village"] !== null ? output["village"] : ""))
.append($("<td>").text(output["street"] !== null ? output["street"] : ""))
.append($("<td>").text(output["number"] !== null ? output["number"] : ""))
.append($("<td>").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);
})
@@ -107,6 +114,10 @@
th:attr="action=@{${submitEndpoint}}">
<div th:text="#{gui.residency.header.help}">Please enter a Municipality or Village first</div>
<div>
+ <label for="inputPostleitzahl" th:text="#{gui.residency.input.postleitzahl}">Postleitzahl</label>
+ <input type="text" id="inputPostleitzahl" name="postleitzahl" value=""/>
+ </div>
+ <div>
<label for="inputMunicipality" th:text="#{gui.residency.input.municipality}">Municipality</label>
<input type="text" id="inputMunicipality" name="municipality" value=""/>
</div>
@@ -134,8 +145,8 @@
<button type="button" class="block" th:attr="value=#{gui.residency.proceed}">Proceed</button>
</div>
<div>
- <img id="loading" src="$contextPath/static/img/ajax-loader.gif"
- th:attr="src=@{/static/img/ajax-loader.gif}" />
+ <img id="loading" src="$contextPath/static/img/ajax-loader.gif"
+ th:attr="src=@{/static/img/ajax-loader.gif}"/>
</div>
<input type="hidden" name="pendingid" value="$pendingid" th:attr="value=${pendingid}"/>
</form>
@@ -148,6 +159,7 @@
<table id="tableResult">
<thead>
<tr>
+ <th th:text="#{gui.residency.input.postleitzahl}">Postleitzahl</th>
<th th:text="#{gui.residency.input.municipality}">Municipality</th>
<th th:text="#{gui.residency.input.village}">Village</th>
<th th:text="#{gui.residency.input.street}">Street</th>
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($("<tr>")
+ .append($("<td>").text(output["postleitzahl"] !== null ? output["postleitzahl"] : ""))
.append($("<td>").text(output["municipality"] !== null ? output["municipality"] : ""))
.append($("<td>").text(output["village"] !== null ? output["village"] : ""))
.append($("<td>").text(output["street"] !== null ? output["street"] : ""))
.append($("<td>").text(output["number"] !== null ? output["number"] : ""))
.append($("<td>").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);
})
@@ -107,6 +114,10 @@
th:attr="action=@{${submitEndpoint}}">
<div th:text="#{gui.residency.header.help}">Please enter a Municipality or Village first</div>
<div>
+ <label for="inputPostleitzahl" th:text="#{gui.residency.input.postleitzahl}">Postleitzahl</label>
+ <input type="text" id="inputPostleitzahl" name="postleitzahl" value=""/>
+ </div>
+ <div>
<label for="inputMunicipality" th:text="#{gui.residency.input.municipality}">Municipality</label>
<input type="text" id="inputMunicipality" name="municipality" value=""/>
</div>
@@ -134,8 +145,8 @@
<button type="button" class="block" th:attr="value=#{gui.residency.proceed}">Proceed</button>
</div>
<div>
- <img id="loading" src="$contextPath/static/img/ajax-loader.gif"
- th:attr="src=@{/static/img/ajax-loader.gif}" />
+ <img id="loading" src="$contextPath/static/img/ajax-loader.gif"
+ th:attr="src=@{/static/img/ajax-loader.gif}"/>
</div>
<input type="hidden" name="pendingid" value="$pendingid" th:attr="value=${pendingid}"/>
</form>
@@ -148,6 +159,7 @@
<table id="tableResult">
<thead>
<tr>
+ <th th:text="#{gui.residency.input.postleitzahl}">Postleitzahl</th>
<th th:text="#{gui.residency.input.municipality}">Municipality</th>
<th th:text="#{gui.residency.input.village}">Village</th>
<th th:text="#{gui.residency.input.street}">Street</th>
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;