aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2
diff options
context:
space:
mode:
authorChristian Kollmann <christian.kollmann@a-sit.at>2021-02-22 15:06:43 +0100
committerChristian Kollmann <christian.kollmann@a-sit.at>2021-02-22 15:44:05 +0100
commit87e5fa9dd9966d427e45e36b9c3530b3c28d1f32 (patch)
tree07eb4da99e45b987a9aecc98ff8b0187866e2607 /eidas_modules/authmodule-eIDAS-v2
parent17205492d16f39009414399a2e17347986b50cbc (diff)
downloadNational_eIDAS_Gateway-87e5fa9dd9966d427e45e36b9c3530b3c28d1f32.tar.gz
National_eIDAS_Gateway-87e5fa9dd9966d427e45e36b9c3530b3c28d1f32.tar.bz2
National_eIDAS_Gateway-87e5fa9dd9966d427e45e36b9c3530b3c28d1f32.zip
Refactor: Use less static imports
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java40
1 files changed, 16 insertions, 24 deletions
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 4d5daa6e..81035f6d 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
@@ -30,6 +30,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.ManualFixNeces
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.WorkflowException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.CountrySpecificDetailSearchProcessor;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.RegisterSearchService;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils;
import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
import at.gv.egiz.eaaf.core.exceptions.EaafStorageException;
import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
@@ -68,18 +69,6 @@ import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.eIDAS_A
import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.eIDAS_ATTR_PERSONALIDENTIFIER;
import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.eIDAS_ATTR_PLACEOFBIRTH;
import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.eIDAS_ATTR_TAXREFERENCE;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils.processAddress;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils.processBirthName;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils.processCountryCode;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils.processDateOfBirthToString;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils.processFamilyName;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils.processGivenName;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils.processPlaceOfBirth;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils.processPseudonym;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils.processTaxReference;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils.translateAddressAttribute;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils.translateDateAttribute;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils.translateStringListAttribute;
/**
* Task that searches registers (ERnP and ZMR) before adding person to SZR.
@@ -89,6 +78,7 @@ import static at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasRespon
*/
@Slf4j
@Component("InitialSearchTask")
+@SuppressWarnings("PMD.TooManyStaticImports")
public class InitialSearchTask extends AbstractAuthServletTask {
private final List<CountrySpecificDetailSearchProcessor> handlers;
@@ -259,18 +249,19 @@ public class InitialSearchTask extends AbstractAuthServletTask {
private SimpleEidasData convertSimpleMapToSimpleData(Map<String, Object> eidasAttrMap)
throws EidasAttributeException {
SimpleEidasData result = new SimpleEidasData();
- result.setCitizenCountryCode(processCountryCode(eidasAttrMap.get(eIDAS_ATTR_PERSONALIDENTIFIER)));
+ result.setCitizenCountryCode(EidasResponseUtils.processCountryCode(
+ eidasAttrMap.get(eIDAS_ATTR_PERSONALIDENTIFIER)));
// MDS attributes
- result.setPseudonym(processPseudonym(eidasAttrMap.get(eIDAS_ATTR_PERSONALIDENTIFIER)));
- result.setFamilyName(processFamilyName(eidasAttrMap.get(eIDAS_ATTR_CURRENTFAMILYNAME)));
- result.setGivenName(processGivenName(eidasAttrMap.get(eIDAS_ATTR_CURRENTGIVENNAME)));
- result.setDateOfBirth(processDateOfBirthToString(eidasAttrMap.get(eIDAS_ATTR_DATEOFBIRTH)));
+ result.setPseudonym(EidasResponseUtils.processPseudonym(eidasAttrMap.get(eIDAS_ATTR_PERSONALIDENTIFIER)));
+ result.setFamilyName(EidasResponseUtils.processFamilyName(eidasAttrMap.get(eIDAS_ATTR_CURRENTFAMILYNAME)));
+ result.setGivenName(EidasResponseUtils.processGivenName(eidasAttrMap.get(eIDAS_ATTR_CURRENTGIVENNAME)));
+ result.setDateOfBirth(EidasResponseUtils.processDateOfBirthToString(eidasAttrMap.get(eIDAS_ATTR_DATEOFBIRTH)));
// additional attributes
- result.setPlaceOfBirth(processPlaceOfBirth(eidasAttrMap.get(eIDAS_ATTR_PLACEOFBIRTH)));
- result.setBirthName(processBirthName(eidasAttrMap.get(eIDAS_ATTR_BIRTHNAME)));
- result.setAddress(processAddress(eidasAttrMap.get(eIDAS_ATTR_CURRENTADDRESS)));
+ result.setPlaceOfBirth(EidasResponseUtils.processPlaceOfBirth(eidasAttrMap.get(eIDAS_ATTR_PLACEOFBIRTH)));
+ result.setBirthName(EidasResponseUtils.processBirthName(eidasAttrMap.get(eIDAS_ATTR_BIRTHNAME)));
+ result.setAddress(EidasResponseUtils.processAddress(eidasAttrMap.get(eIDAS_ATTR_CURRENTADDRESS)));
if (eidasAttrMap.containsKey(eIDAS_ATTR_TAXREFERENCE)) {
- result.setTaxNumber(processTaxReference(eidasAttrMap.get(eIDAS_ATTR_TAXREFERENCE)));
+ result.setTaxNumber(EidasResponseUtils.processTaxReference(eidasAttrMap.get(eIDAS_ATTR_TAXREFERENCE)));
}
//TODO other additional attributes
return result;
@@ -282,7 +273,7 @@ public class InitialSearchTask extends AbstractAuthServletTask {
for (final AttributeDefinition<?> el : attributeMap.keySet()) {
final Class<?> parameterizedType = el.getParameterizedType();
if (DateTime.class.equals(parameterizedType)) {
- final DateTime attribute = translateDateAttribute(el, attributeMap.get(el).asList());
+ final DateTime attribute = EidasResponseUtils.translateDateAttribute(el, attributeMap.get(el).asList());
if (attribute != null) {
result.put(el.getFriendlyName(), attribute);
log.trace("Find attr '{}' with value: {}", el.getFriendlyName(), attribute.toString());
@@ -290,7 +281,8 @@ public class InitialSearchTask extends AbstractAuthServletTask {
log.info("Ignore empty 'DateTime' attribute");
}
} else if (PostalAddress.class.equals(parameterizedType)) {
- final PostalAddress addressAttribute = translateAddressAttribute(el, attributeMap.get(el).asList());
+ final PostalAddress addressAttribute = EidasResponseUtils
+ .translateAddressAttribute(el, attributeMap.get(el).asList());
if (addressAttribute != null) {
result.put(el.getFriendlyName(), addressAttribute);
log.trace("Find attr '{}' with value: {}", el.getFriendlyName(), addressAttribute.toString());
@@ -298,7 +290,7 @@ public class InitialSearchTask extends AbstractAuthServletTask {
log.info("Ignore empty 'PostalAddress' attribute");
}
} else {
- final List<String> natPersonIdObj = translateStringListAttribute(el, attributeMap.get(el));
+ final List<String> natPersonIdObj = EidasResponseUtils.translateStringListAttribute(el, attributeMap.get(el));
final String stringAttr = natPersonIdObj.get(0);
if (StringUtils.isNotEmpty(stringAttr)) {
result.put(el.getFriendlyName(), stringAttr);