aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2/src/main/java
diff options
context:
space:
mode:
authorChristian Kollmann <christian.kollmann@a-sit.at>2021-02-22 13:43:29 +0100
committerChristian Kollmann <christian.kollmann@a-sit.at>2021-02-22 13:43:29 +0100
commit5207fa3eedfaf2d8b6e27ff38c32a716fb25193c (patch)
tree537ef2b6ebf2e58384c26b55c772d225de551859 /eidas_modules/authmodule-eIDAS-v2/src/main/java
parentaf3a2414540852d0b9581a21f02e52f5576be1ea (diff)
downloadNational_eIDAS_Gateway-5207fa3eedfaf2d8b6e27ff38c32a716fb25193c.tar.gz
National_eIDAS_Gateway-5207fa3eedfaf2d8b6e27ff38c32a716fb25193c.tar.bz2
National_eIDAS_Gateway-5207fa3eedfaf2d8b6e27ff38c32a716fb25193c.zip
Refactor: Use EqualsBuilder for equality checks
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main/java')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java48
1 files changed, 10 insertions, 38 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java
index 17f2b1ee..84327941 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java
@@ -26,6 +26,7 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.dao;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.WorkflowException;
import at.gv.e_government.reference.namespace.persondata._20020228.PostalAddressType;
import lombok.Data;
+import org.apache.commons.lang3.builder.EqualsBuilder;
@Data
public class SimpleEidasData {
@@ -52,44 +53,15 @@ public class SimpleEidasData {
* @throws WorkflowException if multiple results have been found
*/
public boolean equalsRegisterData(MergedRegisterSearchResult result) throws WorkflowException {
- return equalsRegisterData(result.getResult());
+ return new EqualsBuilder()
+ .append(result.getResult().getPseudonym(), pseudonym)
+ .append(result.getResult().getGivenName(), givenName)
+ .append(result.getResult().getFamilyName(), familyName)
+ .append(result.getResult().getDateOfBirth(), dateOfBirth)
+ .append(result.getResult().getPlaceOfBirth(), placeOfBirth)
+ .append(result.getResult().getBirthName(), birthName)
+ .append(result.getResult().getTaxNumber(), taxNumber)
+ .isEquals();
}
- private boolean equalsRegisterData(RegisterResult result) {
- if (!result.getPseudonym().equals(pseudonym)) {
- return false;
- }
- if (!result.getGivenName().equals(givenName)) {
- return false;
- }
- if (!result.getFamilyName().equals(familyName)) {
- return false;
- }
- if (!result.getDateOfBirth().equals(dateOfBirth)) {
- return false;
- }
- if (!equals(result.getPlaceOfBirth(), placeOfBirth)) {
- return false;
- }
- if (!equals(result.getBirthName(), birthName)) {
- return false;
- }
- if (!equals(result.getTaxNumber(), taxNumber)) {
- return false;
- }
- return true;
- }
-
- private boolean equals(String a, String b) {
- if (a == null && b == null) {
- return true;
- }
- if (a == null) {
- return false;
- }
- if (b == null) {
- return false;
- }
- return a.equals(b);
- }
}