aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2/src/main
diff options
context:
space:
mode:
authorChristian Kollmann <christian.kollmann@a-sit.at>2021-01-12 15:08:17 +0100
committerChristian Kollmann <christian.kollmann@a-sit.at>2021-01-12 15:15:51 +0100
commitfb99ff15185b4f3b10d4c72270787b04281494bf (patch)
treee37b8de6a1fcbde6ea944b6a04612a2d3ddb682e /eidas_modules/authmodule-eIDAS-v2/src/main
parent50c82048f034803a3486368d2c5cb3ad09eb07b3 (diff)
downloadNational_eIDAS_Gateway-fb99ff15185b4f3b10d4c72270787b04281494bf.tar.gz
National_eIDAS_Gateway-fb99ff15185b4f3b10d4c72270787b04281494bf.tar.bz2
National_eIDAS_Gateway-fb99ff15185b4f3b10d4c72270787b04281494bf.zip
Use generic list types in parameters and return types
List instead of ArrayList allows for easier mocking and stubbing
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/MergedRegisterSearchResult.java8
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/DummyErnpClient.java26
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/IErnpClient.java10
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java13
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java14
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java19
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/DummyZmrClient.java26
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/IZmrClient.java10
8 files changed, 53 insertions, 73 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/MergedRegisterSearchResult.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/MergedRegisterSearchResult.java
index 7703af2a..e147b8aa 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/MergedRegisterSearchResult.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/MergedRegisterSearchResult.java
@@ -26,15 +26,15 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.dao;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.WorkflowException;
import lombok.Data;
-import java.util.ArrayList;
+import java.util.List;
@Data
public class MergedRegisterSearchResult {
- final ArrayList<RegisterResult> resultsZmr;
- final ArrayList<RegisterResult> resultsErnp;
+ final List<RegisterResult> resultsZmr;
+ final List<RegisterResult> resultsErnp;
- public MergedRegisterSearchResult(ArrayList<RegisterResult> resultsZmr, ArrayList<RegisterResult> resultsErnp) {
+ public MergedRegisterSearchResult(List<RegisterResult> resultsZmr, List<RegisterResult> resultsErnp) {
this.resultsZmr = resultsZmr;
this.resultsErnp = resultsErnp;
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/DummyErnpClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/DummyErnpClient.java
index 3b49ab95..e514c808 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/DummyErnpClient.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/DummyErnpClient.java
@@ -27,30 +27,34 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
import org.springframework.stereotype.Service;
-import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
@Service("ErnbClientForeIDAS")
public class DummyErnpClient implements IErnpClient {
@Override
- public ArrayList<RegisterResult> searchWithPersonIdentifier(String personIdentifier) {
- return resultEmpty();
+ public List<RegisterResult> searchWithPersonIdentifier(String personIdentifier) {
+ return Collections.emptyList();
}
@Override
- public ArrayList<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth) {
- return resultEmpty();//TODO will I only receive matches where all three values match perfectly?
+ public List<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth) {
+ //TODO will I only receive matches where all three values match perfectly?
+ return Collections.emptyList();
}
@Override
- public ArrayList<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
+ public List<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
String birthPlace, String birthName) {
- return resultEmpty();//TODO
+ //TODO
+ return Collections.emptyList();
}
@Override
- public ArrayList<RegisterResult> searchItSpecific(String taxNumber) {
- return resultEmpty();//TODO
+ public List<RegisterResult> searchItSpecific(String taxNumber) {
+ //TODO
+ return Collections.emptyList();
}
@Override
@@ -58,9 +62,5 @@ public class DummyErnpClient implements IErnpClient {
//TODO
}
- private ArrayList<RegisterResult> resultEmpty() {
- return new ArrayList<RegisterResult>();//Nobody found
- }
-
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/IErnpClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/IErnpClient.java
index 01ac88fb..b9641c5c 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/IErnpClient.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/IErnpClient.java
@@ -26,18 +26,18 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
-import java.util.ArrayList;
+import java.util.List;
public interface IErnpClient {
- ArrayList<RegisterResult> searchWithPersonIdentifier(String personIdentifier);
+ List<RegisterResult> searchWithPersonIdentifier(String personIdentifier);
- ArrayList<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth);
+ List<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth);
- ArrayList<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
+ List<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
String birthPlace, String birthName);
- ArrayList<RegisterResult> searchItSpecific(String taxNumber);
+ List<RegisterResult> searchItSpecific(String taxNumber);
void update(RegisterResult registerResult, SimpleEidasData eidData);
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java
index a29725c8..544d5b0c 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java
@@ -30,7 +30,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp.IErnpClient;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.IZmrClient;
-import java.util.ArrayList;
+import java.util.List;
public class DeSpecificDetailSearchProcessor extends CountrySpecificDetailSearchProcessor {
@@ -54,17 +54,12 @@ public class DeSpecificDetailSearchProcessor extends CountrySpecificDetailSearch
@Override
public MergedRegisterSearchResult search(SimpleEidasData eidData) {
-
-
- ArrayList<RegisterResult> resultsZmr =
+ List<RegisterResult> resultsZmr =
zmrClient.searchDeSpecific(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth(),
eidData.getPlaceOfBirth(), eidData.getBirthName());
-
- ArrayList<RegisterResult> resultsErnb =
+ List<RegisterResult> resultsErnb =
ernbClient.searchDeSpecific(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth(),
eidData.getPlaceOfBirth(), eidData.getBirthName());
-
- MergedRegisterSearchResult searchResult = new MergedRegisterSearchResult(resultsZmr, resultsErnb);
- return searchResult;
+ return new MergedRegisterSearchResult(resultsZmr, resultsErnb);
}
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java
index e730066d..370a111c 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java
@@ -30,7 +30,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp.IErnpClient;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.IZmrClient;
-import java.util.ArrayList;
+import java.util.List;
public class ItSpecificDetailSearchProcessor extends CountrySpecificDetailSearchProcessor {
@@ -51,14 +51,8 @@ public class ItSpecificDetailSearchProcessor extends CountrySpecificDetailSearch
@Override
public MergedRegisterSearchResult search(SimpleEidasData eidData) {
-
- ArrayList<RegisterResult> resultsZmr =
- zmrClient.searchItSpecific(eidData.getTaxNumber());
-
- ArrayList<RegisterResult> resultsErnb =
- ernbClient.searchItSpecific(eidData.getTaxNumber());
-
- MergedRegisterSearchResult searchResult = new MergedRegisterSearchResult(resultsZmr, resultsErnb);
- return searchResult;
+ List<RegisterResult> resultsZmr = zmrClient.searchItSpecific(eidData.getTaxNumber());
+ List<RegisterResult> resultsErnb = ernbClient.searchItSpecific(eidData.getTaxNumber());
+ return new MergedRegisterSearchResult(resultsZmr, resultsErnb);
}
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java
index ba05ef0d..fd9e93e0 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java
@@ -52,7 +52,6 @@ import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -205,12 +204,10 @@ public class InitialSearchTask extends AbstractAuthServletTask {
private String step8RegisterSearchWithMds(MergedRegisterSearchResult initialSearchResult,
SimpleEidasData eidData) {
log.trace("Starting step8RegisterSearchWithMds");
- ArrayList<RegisterResult> resultsZmr =
+ List<RegisterResult> resultsZmr =
zmrClient.searchWithMds(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth());
-
- ArrayList<RegisterResult> resultsErnp =
+ List<RegisterResult> resultsErnp =
ernpClient.searchWithMds(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth());
-
MergedRegisterSearchResult mdsSearchResult = new MergedRegisterSearchResult(resultsZmr, resultsErnp);
log.debug("Automerge " + initialSearchResult + " with " + eidData + " " + mdsSearchResult);
//TODO implement next phase and return correct value
@@ -218,15 +215,9 @@ public class InitialSearchTask extends AbstractAuthServletTask {
}
private MergedRegisterSearchResult searchInZmrAndErnp(String personIdentifier) {
-
- ArrayList<RegisterResult> resultsZmr =
- zmrClient.searchWithPersonIdentifier(personIdentifier);
-
- ArrayList<RegisterResult> resultsErnp =
- ernpClient.searchWithPersonIdentifier(personIdentifier);
-
- MergedRegisterSearchResult initialSearchResult = new MergedRegisterSearchResult(resultsZmr, resultsErnp);
- return initialSearchResult;
+ List<RegisterResult> resultsZmr = zmrClient.searchWithPersonIdentifier(personIdentifier);
+ List<RegisterResult> resultsErnp = ernpClient.searchWithPersonIdentifier(personIdentifier);
+ return new MergedRegisterSearchResult(resultsZmr, resultsErnp);
}
private SimpleEidasData convertSimpleMapToSimpleData(Map<String, Object> eidasAttrMap)
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/DummyZmrClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/DummyZmrClient.java
index 60dd2ef2..b12c1bcb 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/DummyZmrClient.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/DummyZmrClient.java
@@ -27,30 +27,34 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
import org.springframework.stereotype.Service;
-import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
@Service("ZmrClientForeIDAS")
public class DummyZmrClient implements IZmrClient {
@Override
- public ArrayList<RegisterResult> searchWithPersonIdentifier(String personIdentifier) {
- return resultEmpty();
+ public List<RegisterResult> searchWithPersonIdentifier(String personIdentifier) {
+ return Collections.emptyList();
}
@Override
- public ArrayList<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth) {
- return resultEmpty();//TODO will I only receive matches where all three values match perfectly?
+ public List<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth) {
+ //TODO will I only receive matches where all three values match perfectly?
+ return Collections.emptyList();
}
@Override
- public ArrayList<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
+ public List<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
String birthPlace, String birthName) {
- return resultEmpty();//TODO
+ //TODO
+ return Collections.emptyList();
}
@Override
- public ArrayList<RegisterResult> searchItSpecific(String taxNumber) {
- return resultEmpty();//TODO
+ public List<RegisterResult> searchItSpecific(String taxNumber) {
+ //TODO
+ return Collections.emptyList();
}
@Override
@@ -58,8 +62,4 @@ public class DummyZmrClient implements IZmrClient {
//TODO
}
- private ArrayList<RegisterResult> resultEmpty() {
- return new ArrayList<RegisterResult>();//Nobody found
- }
-
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/IZmrClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/IZmrClient.java
index 3a518e64..5175cd7b 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/IZmrClient.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/IZmrClient.java
@@ -26,18 +26,18 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
-import java.util.ArrayList;
+import java.util.List;
public interface IZmrClient {
- ArrayList<RegisterResult> searchWithPersonIdentifier(String personIdentifier);
+ List<RegisterResult> searchWithPersonIdentifier(String personIdentifier);
- ArrayList<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth);
+ List<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth);
- ArrayList<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
+ List<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
String birthPlace, String birthName);
- ArrayList<RegisterResult> searchItSpecific(String taxNumber);
+ List<RegisterResult> searchItSpecific(String taxNumber);
void update(RegisterResult registerResult, SimpleEidasData eidData);
}