summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/gv/util/data/ElectronicIdentity.java27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/main/java/at/gv/util/data/ElectronicIdentity.java b/src/main/java/at/gv/util/data/ElectronicIdentity.java
index afbf652..c85c8b9 100644
--- a/src/main/java/at/gv/util/data/ElectronicIdentity.java
+++ b/src/main/java/at/gv/util/data/ElectronicIdentity.java
@@ -95,6 +95,7 @@ public final class ElectronicIdentity implements Serializable, Empty, RoleContai
private static final String BPK_NAME_QUALIFIER = "urn:publicid:gv.at:cdid+bpk";
private static final String WBPK_NAME_QUALIFIER_PREFIX = "urn:publicid:gv.at:wbpk";
private static final String BASE_NAME_QUALIFIER = "urn:publicid:gv.at:baseid";
+ private static final String BPK_NAME_QUALIFIER_PREFIX_WITH_TARGET = "urn:publicid:gv.at:cdid+";
private String firstName;
private String title;
@@ -289,6 +290,15 @@ public final class ElectronicIdentity implements Serializable, Empty, RoleContai
this.bpk = this.getNameIdentifier();
}
+ if (this.getNameQualifier() != null
+ && this.getNameQualifier().startsWith(BPK_NAME_QUALIFIER_PREFIX_WITH_TARGET)
+ && MiscUtil.isEmpty(this.getBpk())
+ && MiscUtil.isNotEmpty(this.getNameIdentifier())) {
+ log.debug("NameQualifier starts with \"" + BPK_NAME_QUALIFIER_PREFIX_WITH_TARGET
+ + "\". We have a bpk for target: " + this.getNameQualifier());
+ this.bpk = this.getNameIdentifier();
+ }
+
if (MiscUtil.isNotEmpty(this.getBaseId())) {
log.debug("BaseId present -> calculating zbpk");
this.zbpk = BpkUtil.calcZBPK(this.getBaseId());
@@ -450,9 +460,20 @@ public final class ElectronicIdentity implements Serializable, Empty, RoleContai
.createUnmarshaller().unmarshal(personNode);
PhysicalPersonType ppt = pptElement.getValue();
String baseId = ppt.getIdentification().get(0).getValue().getValue();
- this.setBaseId(baseId);
- this.setZbpk(BpkUtil.calcZBPK(baseId));
- this.setVzbpk(BpkUtil.calcVZBPK(baseId));
+ String baseIdType = ppt.getIdentification().get(0).getType();
+ if (BASE_NAME_QUALIFIER.equals(baseIdType)) {
+ this.setBaseId(baseId);
+ this.setZbpk(BpkUtil.calcZBPK(baseId));
+ this.setVzbpk(BpkUtil.calcVZBPK(baseId));
+
+ } else {
+ log.info("Get no baseId. Set it as it is ... ");
+ this.nameIdentifier = baseId;
+ this.nameQualifier = baseIdType;
+ updateAll();
+
+ }
+
this.setDateOfBirth(MiscUtil.parseXMLDate(ppt.getDateOfBirth(), TimeZone.getTimeZone("UTC")));
this.setFirstName(ppt.getName().getGivenName().get(0));
this.setLastName(ppt.getName().getFamilyName().get(0).getValue());