aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/moazs/scheme
diff options
context:
space:
mode:
authorChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-08-28 13:34:41 +0200
committerChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-08-28 13:36:35 +0200
commit70e8a1b80fea9d61c46dbd55aa1b461a8bb3a0f7 (patch)
treed653c457ebf7331d7aa07b9c6f1ea122312480e3 /src/main/java/at/gv/egiz/moazs/scheme
parentff0a32339c4e8dbc81be89a38990f3963c285121 (diff)
downloadmoa-zs-70e8a1b80fea9d61c46dbd55aa1b461a8bb3a0f7.tar.gz
moa-zs-70e8a1b80fea9d61c46dbd55aa1b461a8bb3a0f7.tar.bz2
moa-zs-70e8a1b80fea9d61c46dbd55aa1b461a8bb3a0f7.zip
Fixes and Refactoring
- JAXB Hack: Handle InterruptionException properly (as in [1], "Dont swallow Interrupts") - Mzs2MsgConverter: Rename convert(Person) to convertReceiverPerson(Person) to emphasize that this method can only be used to convert Receiver Persons (Reminder: Receiver Persons are PhysicalPersons / CorporateBodies. SenderPersons can also be Authorities) - Mzs2MsgConverter: Remove assertion because not needed anymore. - Refactor: Move mzs:DeliveryRequest validation out ouf augmenter and into service. - Refactor: Create a single entry point for validating a mzs:DeliveryRequest. - Remove unused imports. - Fix log messages. [1] https://www.ibm.com/developerworks/java/library/j-jtp05236/index.html?ca=drs-#2.1
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/scheme')
-rw-r--r--src/main/java/at/gv/egiz/moazs/scheme/Mzs2MsgConverter.java12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/scheme/Mzs2MsgConverter.java b/src/main/java/at/gv/egiz/moazs/scheme/Mzs2MsgConverter.java
index f2e6861..07df9f8 100644
--- a/src/main/java/at/gv/egiz/moazs/scheme/Mzs2MsgConverter.java
+++ b/src/main/java/at/gv/egiz/moazs/scheme/Mzs2MsgConverter.java
@@ -134,7 +134,7 @@ public class Mzs2MsgConverter {
var builder = receiverBuilder()
.withPreAdviceNote(receiver.getPreAdviceNote())
.withAdditionalCriteria(receiver.getAdditionalCriteria())
- .withPerson(convert(receiver.getPerson()))
+ .withPerson(convertReceiverPerson(receiver.getPerson()))
.withAddress(convertAddresses(receiver.getAddress()));
if (receiver.getIdentification() != null) builder.withIdentification(convert(receiver.getIdentification()));
@@ -250,15 +250,11 @@ public class Mzs2MsgConverter {
//------------ PERSONS --------------------
- public JAXBElement<? extends AbstractPersonType> convert(
+ public JAXBElement<? extends AbstractPersonType> convertReceiverPerson(
JAXBElement<? extends at.gv.zustellung.app2mzs.xsd.persondata.AbstractPersonType> jaxbPerson) {
var mzsPerson = jaxbPerson.getValue();
- //todo: move this to mzs
- Assert.isTrue(personIsPhysical(mzsPerson) || personIsCorporateBody(mzsPerson),
- "Person is neither a PhysicalPerson nor a CorporateBody.");
-
if (personIsPhysical(mzsPerson)) {
var msgPerson = convert((at.gv.zustellung.app2mzs.xsd.persondata.PhysicalPersonType) mzsPerson);
return personFactory.createPhysicalPerson(msgPerson);
@@ -272,10 +268,6 @@ public class Mzs2MsgConverter {
return person instanceof at.gv.zustellung.app2mzs.xsd.persondata.PhysicalPersonType;
}
- private boolean personIsCorporateBody(at.gv.zustellung.app2mzs.xsd.persondata.AbstractPersonType person) {
- return person instanceof at.gv.zustellung.app2mzs.xsd.persondata.CorporateBodyType;
- }
-
public CorporateBodyType convert(at.gv.zustellung.app2mzs.xsd.persondata.CorporateBodyType corporateBody) {
return corporateBodyTypeBuilder()
.withFullName(corporateBody.getFullName())