summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCGantert345 <57003061+CGantert345@users.noreply.github.com>2022-04-14 15:09:45 +0200
committerCGantert345 <57003061+CGantert345@users.noreply.github.com>2022-04-14 15:09:45 +0200
commit8770b99fdb6f47dea7b1f598633407e67b22572f (patch)
tree5d1fc48cf597cb12cfb125192fe8c4ff9765c95b
parentunit test for fcb version 1 including all elements (diff)
downloadUIC-barcode-8770b99fdb6f47dea7b1f598633407e67b22572f.tar
UIC-barcode-8770b99fdb6f47dea7b1f598633407e67b22572f.tar.gz
UIC-barcode-8770b99fdb6f47dea7b1f598633407e67b22572f.tar.bz2
UIC-barcode-8770b99fdb6f47dea7b1f598633407e67b22572f.tar.lz
UIC-barcode-8770b99fdb6f47dea7b1f598633407e67b22572f.tar.xz
UIC-barcode-8770b99fdb6f47dea7b1f598633407e67b22572f.tar.zst
UIC-barcode-8770b99fdb6f47dea7b1f598633407e67b22572f.zip
Diffstat (limited to '')
-rw-r--r--src/main/java/org/uic/barcode/dynamicFrame/v1/DynamicFrame.java38
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/LineType.java14
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java1
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java239
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java217
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV3.java234
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/NumListWrapper.java55
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/NumWrapper.java36
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java118
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/UicEncoderUtils.java36
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/AllElementsTestV2.java1094
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java1
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV3.java1
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/DelayConfirmationTestV3.java1
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV1.java1
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV3.java1
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV1.java1
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV3.java1
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV1.java1
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV3.java1
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV1.java1
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV3.java1
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV1.java1
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV3.java1
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV1.java1
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/AllElementsTestTicketV2.java1410
26 files changed, 3146 insertions, 360 deletions
diff --git a/src/main/java/org/uic/barcode/dynamicFrame/v1/DynamicFrame.java b/src/main/java/org/uic/barcode/dynamicFrame/v1/DynamicFrame.java
index 3bfcbf5..7dbd131 100644
--- a/src/main/java/org/uic/barcode/dynamicFrame/v1/DynamicFrame.java
+++ b/src/main/java/org/uic/barcode/dynamicFrame/v1/DynamicFrame.java
@@ -122,44 +122,6 @@ public class DynamicFrame extends Object{
return UperEncoder.decode(bytes, DynamicFrame.class);
}
- /**
- * Sign level 2 data without a specific security provider.
- *
- * @param key the key
- * @throws Exception the exception
- */
- public void signLevel2(PrivateKey key) throws Exception {
-
- //find the algorithm name for the signature OID
- String algo = AlgorithmNameResolver.getSignatureAlgorithmName(this.getLevel2SignedData().getLevel1Data().level2SigningAlg);
- Signature sig = Signature.getInstance(algo);
- sig.initSign(key);
- byte[] data = level2SignedData.encode();
- sig.update(data);
- byte[] signature = sig.sign();
- this.level2Signature = new OctetString(signature);
-
- }
-
- /**
- * Sign level 2 data.
- *
- * @param key the key
- * @param prov the security Provider
- * @throws Exception the exception
- */
- public void signLevel2(PrivateKey key, Provider prov) throws Exception {
-
- //find the algorithm name for the signature OID
- String algo = AlgorithmNameResolver.getSignatureAlgorithmName(this.getLevel2SignedData().getLevel1Data().level2SigningAlg);
- Signature sig = Signature.getInstance(algo,prov);
- sig.initSign(key);
- byte[] data = level2SignedData.encode();
- sig.update(data);
- this.level2Signature = new OctetString(sig.sign());
-
- }
-
/**
* Adds the dynamic content and encodes it. (API level)
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/LineType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/LineType.java
index fff4499..ffe19a3 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/LineType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/LineType.java
@@ -127,8 +127,11 @@ public class LineType extends Object {
}
public byte[] getBinaryZoneId() {
-
- return binaryZoneId.toByteArray();
+ if (binaryZoneId != null && binaryZoneId.size() > 0) {
+ return binaryZoneId.toByteArray();
+ } else {
+ return null;
+ }
}
public void setCarrierNum(Long carrierNum) {
@@ -177,8 +180,11 @@ public class LineType extends Object {
}
public void setBinaryZoneId(byte[] binaryZoneId) {
-
- this.binaryZoneId = new OctetString(binaryZoneId);
+ if (binaryZoneId != null && binaryZoneId.length > 0) {
+ this.binaryZoneId = new OctetString(binaryZoneId);
+ } else {
+ this.binaryZoneId = null;
+ }
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java
index 30a7dfc..2522355 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java
@@ -314,6 +314,7 @@ public class TravelerType extends Object {
public Date getDateOfBirth() {
if (this.yearOfBirth == null) return null;
+ if (this.monthOfBirth == null) return null;
if (this.dayOfBirth == null) return null;
Calendar cal = Calendar.getInstance();
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java
index 6cf1673..d8934d9 100644
--- a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java
+++ b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java
@@ -350,12 +350,13 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
asnData.setTrainIA5(UicEncoderUtils.getIA5NonNum(document.getTrain()));
asnData.setTrainNum(UicEncoderUtils.getNum(document.getTrain()));
- asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
-
- asnData.setProductIdNum(UicEncoderUtils.getRestrictedNum(document.getProductId(),0,65535));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductId(),0,65535));
-
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,32000);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
+
asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
@@ -363,8 +364,9 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
}
- asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
- asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
+ NumListWrapper w = new NumListWrapper(document.getCarriers(),1,32000);
+ asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setCarrierIA5(w.getStringList());
asnData.setInfoText(document.getInfoText());
asnData.setExtension(encodeExtension(document.getExtension()));
@@ -378,7 +380,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
if (document.getServiceBrand()!= null) {
- asnData.setServiceBrand(UicEncoderUtils.getRestrictedInt(document.getServiceBrand().getServiceBrand(),1,9999));
+ asnData.setServiceBrand(UicEncoderUtils.getRestrictedInt(document.getServiceBrand().getServiceBrand(),1,32000));
asnData.setServiceBrandAbrUTF8(document.getServiceBrand().getServiceBrandAbbreviation());
asnData.setServiceBrandNameUTF8(document.getServiceBrand().getServiceBrandDescription());
@@ -465,9 +467,11 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
asnData.setCoach(UicEncoderUtils.getIA5(places.getCoach()));
asnData.setPlaceDescription(places.getPlaceDescription());
asnData.setPlaceString(UicEncoderUtils.getIA5(places.getPlaceString()));
- asnData.setPlaceNum(SequenceOfPlaceNum.getSequence(UicEncoderUtils.getNumList(places.getPlaces())));
- asnData.setPlaceIA5(UicEncoderUtils.getIA5NonNumList(places.getPlaces()));
+ NumListWrapper w = new NumListWrapper(places.getPlaces(),1,254);
+ asnData.setPlaceNum(SequenceOfPlaceNum.getSequence(w.getNumList()));
+ asnData.setPlaceIA5(w.getStringList());
+
return asnData;
}
@@ -565,20 +569,22 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
ReservationData asnData = new ReservationData();
asnDocument.getTicket().setReservation(asnData);
- asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,32000);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
- asnData.setProductIdNum(UicEncoderUtils.getRestrictedNum(document.getProductId(),0,65535));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductId(),0,65535));
-
asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
asnData.setInfoText(document.getInfoText());
asnData.setExtension(encodeExtension(document.getExtension()));
- asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
- asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
+ NumListWrapper w = new NumListWrapper(document.getCarriers(),1,32000);
+ asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setCarrierIA5(w.getStringList());
if (document.getStationCodeTable() != IStationCodeTable.stationUICReservation && document.getStationCodeTable() != null){
asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
@@ -640,7 +646,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
}
if (document.getServiceBrand()!= null) {
- asnData.setServiceBrand(UicEncoderUtils.getRestrictedInt(document.getServiceBrand().getServiceBrand(),1,9999));
+ asnData.setServiceBrand(UicEncoderUtils.getRestrictedInt(document.getServiceBrand().getServiceBrand(),1,32000));
asnData.setServiceBrandAbrUTF8(document.getServiceBrand().getServiceBrandAbbreviation());
asnData.setServiceBrandNameUTF8(document.getServiceBrand().getServiceBrandDescription());
@@ -708,12 +714,12 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
IncludedOpenTicketType asnData = new IncludedOpenTicketType();
- asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
-
- asnData.setProductIdNum(UicEncoderUtils.getNum(document.getProductId()));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5NonNum(document.getProductId()));
-
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,32000);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
asnData.setInfoText(document.getInfoText());
asnData.setExtension(encodeExtension(document.getExtension()));
@@ -722,12 +728,13 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
}
- asnData.setIncludedCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getIncludedCarriers())));
- asnData.setIncludedCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getIncludedCarriers()));
-
- asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,9999)));
- asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,9999)));
+ NumListWrapper w = new NumListWrapper(document.getIncludedCarriers(),1,32000);
+ asnData.setIncludedCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setIncludedCarriersIA5(w.getStringList());
+ asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,32000)));
+ asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,32000)));
+
asnData.setValidityDates(document.getValidFrom(), document.getValidUntil(), issuingDate);
if (document.getValidFromUTCoffset() != null) {
@@ -871,12 +878,13 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
asnDocument.setTicket(asnTicket);
asnTicket.setOpenTicket(asnData);
- asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,32000);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
- asnData.setProductIdNum(UicEncoderUtils.getNum(document.getProductId()));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5NonNum(document.getProductId()));
-
asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
@@ -896,8 +904,9 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
asnData.setFromStationNameUTF8(document.getFromStationName());
asnData.setToStationNameUTF8(document.getToStationName());
- asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getIncludedCarriers())));
- asnData.setCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getIncludedCarriers()));
+ NumListWrapper w = new NumListWrapper(document.getIncludedCarriers(),1,32000);
+ asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setCarriersIA5(w.getStringList());
asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,32000)));
asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,32000)));
@@ -986,12 +995,13 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
CountermarkData asnData = new CountermarkData();
asnDocument.getTicket().setCounterMark(asnData);
- asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
-
- asnData.setProductIdNum(UicEncoderUtils.getRestrictedNum(document.getProductId(),0,65535));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductId(),0,65535));
-
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,32000);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
+
asnData.setTicketReferenceNum(UicEncoderUtils.getNum(document.getTicketReference()));
asnData.setTicketReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getTicketReference()));
@@ -1043,9 +1053,10 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
asnData.setFromStationNameUTF8(document.getFromStationName());
asnData.setToStationNameUTF8(document.getToStationName());
- asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getIncludedCarriers())));
- asnData.setCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getIncludedCarriers()));
-
+ NumListWrapper w = new NumListWrapper(document.getIncludedCarriers(),1,32000);
+ asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setCarriersIA5(w.getStringList());
+
asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,32000)));
asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,32000)));
@@ -1127,9 +1138,10 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
asnData.setBorder(false);
}
- asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
- asnData.setCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
-
+ NumListWrapper w = new NumListWrapper(document.getCarriers(),1,32000);
+ asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setCarriersIA5(w.getStringList());
+
asnData.setRoute(encodeViaStationCollection(document.getRoute()));
if (document.getRouteId() > 0){
@@ -1371,12 +1383,12 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
ParkingGroundData asnData = new ParkingGroundData();
asnDocument.getTicket().setParkingGround(asnData);
- asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
-
- asnData.setProductIdNum(UicEncoderUtils.getRestrictedNum(document.getProductId(),0,65535));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductId(),0,65535));
-
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,32000);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
@@ -1549,11 +1561,12 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
VoucherData asnData = new VoucherData();
asnDocument.getTicket().setVoucher(asnData);
- asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
-
- asnData.setProductIdNum(UicEncoderUtils.getNum(document.getProductId()));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5NonNum(document.getProductId()));
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,32000);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
@@ -1589,23 +1602,26 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
PassData asnData = new PassData();
asnDocument.getTicket().setPass(asnData);
- asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
-
- asnData.setProductIdNum(UicEncoderUtils.getNum(document.getProductId()));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5NonNum(document.getProductId()));
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,32000);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
asnData.setInfoText(document.getInfoText());
- asnData.setExtension(encodeExtension(document.getExtension()));
+ asnData.setExtension(encodeExtension(document.getExtension()));
- asnData.setIncludedCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getIncludedCarriers())));
- asnData.setIncludedCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getIncludedCarriers()));
-
- asnData.setExcludedCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getExcludedCarriers())));
- asnData.setExcludedCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getExcludedCarriers()));
+ NumListWrapper w = new NumListWrapper(document.getIncludedCarriers(),1,32000);
+ asnData.setIncludedCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setIncludedCarriersIA5(w.getStringList());
+
+ w = new NumListWrapper(document.getExcludedCarriers(),1,32000);
+ asnData.setExcludedCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setExcludedCarriersIA5(w.getStringList());
asnData.setValidityDates(document.getValidFrom(), document.getValidUntil(), issuingDate);
@@ -1736,18 +1752,20 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
FIPTicketData asnData = new FIPTicketData();
asnDocument.getTicket().setFipTicket(asnData);
- asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
-
- asnData.setProductIdNum(UicEncoderUtils.getNum(document.getProductId()));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5NonNum(document.getProductId()));
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,32000);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
- asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
- asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
-
+ NumListWrapper w = new NumListWrapper(document.getCarriers(),1,32000);
+ asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setCarrierIA5(w.getStringList());
+
asnData.setClassCode(convertTravelClass(document.getClassCode()));
asnData.setIncludesSupplements(document.isIncludesSupplements());
@@ -1782,11 +1800,12 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
StationPassageData asnData = new StationPassageData();
asnDocument.getTicket().setStationPassage(asnData);
- asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
-
- asnData.setProductIdNum(UicEncoderUtils.getNum(document.getProductId()));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5NonNum(document.getProductId()));
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,32000);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
@@ -1991,27 +2010,10 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
for (ITicketLink ticket : linkedTickets){
- TicketLinkType asnTicket = new TicketLinkType();
-
- asnTicket.setIssuerName(ticket.getIssuer());
-
- asnTicket.setIssuerPNR(ticket.getIssuerPNR());
-
- asnTicket.setProductOwnerNum(UicEncoderUtils.getNum(ticket.getProductOwner()));
- asnTicket.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(ticket.getProductOwner()));
-
- asnTicket.setReferenceNum(UicEncoderUtils.getNum(ticket.getReference()));
- asnTicket.setReferenceIA5(UicEncoderUtils.getIA5NonNum(ticket.getReference()));
-
- if (ticket.getTicketType() != ITicketType.openTicket && ticket.getTicketType() != null){
- asnTicket.setTicketType(TicketType.valueOf(ticket.getTicketType().name()));
- }
-
- if (ticket.getLinkMode() != ILinkMode.issuedTogether && ticket.getLinkMode() != null){
- asnTicket.setLinkMode(LinkMode.valueOf(ticket.getLinkMode().name()));
+ TicketLinkType asnTicket = convert(ticket);
+ if (asnTicket!= null) {
+ asnList.add(asnTicket);
}
-
- asnList.add(asnTicket);
}
if (asnList.isEmpty()) return null;
@@ -2019,6 +2021,35 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
return asnList;
}
+ private TicketLinkType convert(ITicketLink document) throws EncodingFormatException {
+
+ if (document == null) return null;
+
+ TicketLinkType asnData = new TicketLinkType();
+
+ asnData.setIssuerName(document.getIssuer());
+
+ asnData.setIssuerPNR(document.getIssuerPNR());
+
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+
+ asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ if (document.getTicketType() != ITicketType.openTicket && document.getTicketType() != null){
+ asnData.setTicketType(TicketType.valueOf(document.getTicketType().name()));
+ }
+
+ if (document.getLinkMode() != ILinkMode.issuedTogether && document.getLinkMode() != null){
+ asnData.setLinkMode(LinkMode.valueOf(document.getLinkMode().name()));
+ }
+
+ return asnData;
+ }
+
+
/**
* Encode travelers.
*
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java
index 00c0ce3..3468ec6 100644
--- a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java
+++ b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java
@@ -68,9 +68,11 @@ import org.uic.barcode.ticket.api.asn.omv2.SequenceOfRegisteredLuggageType;
import org.uic.barcode.ticket.api.asn.omv2.SequenceOfServiceBrands;
import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTariffType;
import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTicketLinkType;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTimeRangeType;
import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTransportTypes;
import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTravelerId;
import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTravelerType;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfValidityPeriodType;
import org.uic.barcode.ticket.api.asn.omv2.SequenceOfViaStationType;
import org.uic.barcode.ticket.api.asn.omv2.SeriesDetailType;
import org.uic.barcode.ticket.api.asn.omv2.ServiceType;
@@ -92,11 +94,13 @@ import org.uic.barcode.ticket.api.asn.omv2.VatDetailType;
import org.uic.barcode.ticket.api.asn.omv2.ViaStationType;
import org.uic.barcode.ticket.api.asn.omv2.VoucherData;
import org.uic.barcode.ticket.api.asn.omv2.ZoneType;
+import org.uic.barcode.ticket.api.asn.omv2.CompartmentPositionType;
import org.uic.barcode.ticket.api.spec.IBerth;
import org.uic.barcode.ticket.api.spec.ICarCarriageReservation;
import org.uic.barcode.ticket.api.spec.ICardReference;
import org.uic.barcode.ticket.api.spec.ICompartmentDetails;
import org.uic.barcode.ticket.api.spec.ICompartmentGenderType;
+import org.uic.barcode.ticket.api.spec.ICompartmentPositionType;
import org.uic.barcode.ticket.api.spec.IControlDetail;
import org.uic.barcode.ticket.api.spec.ICounterMark;
import org.uic.barcode.ticket.api.spec.ICustomerCard;
@@ -343,9 +347,13 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setTrainIA5(UicEncoderUtils.getIA5NonNum(document.getTrain()));
asnData.setTrainNum(UicEncoderUtils.getNum(document.getTrain()));
- asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
-
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,65535);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
+
asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
@@ -353,9 +361,11 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
}
- asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
- asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
+ NumListWrapper w = new NumListWrapper(document.getCarriers(),1,32000);
+ asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setCarrierIA5(w.getStringList());
+ asnData.setInfoText(document.getInfoText());
asnData.setExtension(encodeExtension(document.getExtension()));
asnData.setCompartmentDetails(encodeCompartmentDetails(document.getCompartmentDetails()));
@@ -394,7 +404,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setLoadingDeck(LoadingDeckType.valueOf(document.getLoadingDeck().name()));
}
- asnData.setLoadingListEntry(UicEncoderUtils.getRestrictedInt(document.getAttachedSurfboards(),0,999));
+ asnData.setLoadingListEntry(UicEncoderUtils.getRestrictedInt(document.getLoadingListEntry(),0,999));
asnData.setBoatCategory(UicEncoderUtils.getRestrictedInt(document.getBoatCategory(),0,6));
asnData.setCarCategory(UicEncoderUtils.getRestrictedInt(document.getCarCategory(),0,9));
@@ -455,8 +465,10 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setCoach(UicEncoderUtils.getIA5(places.getCoach()));
asnData.setPlaceDescription(places.getPlaceDescription());
asnData.setPlaceString(UicEncoderUtils.getIA5(places.getPlaceString()));
- asnData.setPlaceNum(SequenceOfPlaceNum.getSequence(UicEncoderUtils.getNumList(places.getPlaces())));
- asnData.setPlaceIA5(UicEncoderUtils.getIA5NonNumList(places.getPlaces()));
+
+ NumListWrapper w = new NumListWrapper(places.getPlaces(),1,254);
+ asnData.setPlaceNum(SequenceOfPlaceNum.getSequence(w.getNumList()));
+ asnData.setPlaceIA5(w.getStringList());
return asnData;
}
@@ -483,9 +495,23 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setSpecialAllocation(UicEncoderUtils.getRestrictedInt(compartmentDetails.getSpecialAllocation(), 1,99));
asnData.setSpecialAllocationDescr(compartmentDetails.getSpecialAllocationDescr());
+ asnData.setPosition(convert(compartmentDetails.getPosition()));
return asnData;
}
+ private CompartmentPositionType convert(ICompartmentPositionType position) {
+ if (position == null) {
+ return null;
+ } else if (position.equals(ICompartmentPositionType.lowerLevel)) {
+ return CompartmentPositionType.lowerLevel;
+ } else if (position.equals(ICompartmentPositionType.upperLevel)) {
+ return CompartmentPositionType.upperLevel;
+ } else if (position.equals(ICompartmentPositionType.unspecified)) {
+ return CompartmentPositionType.unspecified;
+ }
+ return null;
+ }
+
/**
* Encode berths.
*
@@ -539,8 +565,12 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
ReservationData asnData = new ReservationData();
asnDocument.getTicket().setReservation(asnData);
- asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,65535);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
@@ -548,8 +578,9 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setInfoText(document.getInfoText());
asnData.setExtension(encodeExtension(document.getExtension()));
- asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
- asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
+ NumListWrapper w = new NumListWrapper(document.getCarriers(),1,32000);
+ asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setCarrierIA5(w.getStringList());
if (document.getStationCodeTable() != IStationCodeTable.stationUICReservation && document.getStationCodeTable() != null){
asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
@@ -599,6 +630,9 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setTypeOfSupplement(UicEncoderUtils.getRestrictedInt(document.getTypeOfSupplement(), 1, 9));
asnData.setPlaces(encodePlaces(document.getPlaces()));
+ if (document.getAdditionalPlaces() != null) {
+ asnData.setAdditionalPlaces(encodePlaces(document.getAdditionalPlaces()));
+ }
asnData.setBicyclePlaces(encodePlaces(document.getBicyclePlaces()));
@@ -689,12 +723,14 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
}
- asnData.setIncludedCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getIncludedCarriers())));
- asnData.setIncludedCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getIncludedCarriers()));
+ NumListWrapper w = new NumListWrapper(document.getIncludedCarriers(),1,32000);
+ asnData.setIncludedCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setIncludedCarriersIA5(w.getStringList());
- asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,9999)));
- asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,9999)));
+ asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,32000)));
+ asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,32000)));
+
asnData.setExcludedTransportTypes(SequenceOfTransportTypes.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedTransportTypes(),0,31)));
asnData.setIncludedTransportTypes(SequenceOfTransportTypes.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedTransportTypes(),0,31)));
@@ -716,6 +752,11 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
if (document.getClassCode() != classCode && document.getClassCode() != null){
asnData.setClassCode(TravelClassType.valueOf(document.getClassCode().name()));
}
+
+ if (document.getServiceLevel() != null && document.getServiceLevel().length() > 0) {
+ asnData.setServiceLevel(document.getServiceLevel());
+ }
+
if (document.getExternalIssuer() > 0) {
asnData.setExternalIssuerId(new Long(document.getExternalIssuer()));
}
@@ -862,8 +903,9 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setFromStationNameUTF8(document.getFromStationName());
asnData.setToStationNameUTF8(document.getToStationName());
- asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getIncludedCarriers())));
- asnData.setCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getIncludedCarriers()));
+ NumListWrapper w = new NumListWrapper(document.getIncludedCarriers(),1,32000);
+ asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setCarriersIA5(w.getStringList());
asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,32000)));
asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,32000)));
@@ -890,6 +932,11 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
if (document.getClassCode() != ITravelClassType.second && document.getClassCode() != null){
asnData.setClassCode(TravelClassType.valueOf(document.getClassCode().name()));
}
+
+ if (document.getServiceLevel() != null && document.getServiceLevel().length() > 0) {
+ asnData.setServiceLevel(document.getServiceLevel());
+ }
+
if (document.getExternalIssuer()>0) {
asnData.setExtIssuerId(new Long(document.getExternalIssuer()));
}
@@ -911,9 +958,12 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setLuggage(encodeLuggage(document.getLuggageRestriction()));
}
+ if (document.getReturnDescription() != null) {
+ asnData.setReturnDescription(encodeReturnDescription(document.getReturnDescription(),issuingDate));
+ }
+
if (document.isReturnIncluded()) {
asnData.setReturnIncluded(true);
- asnData.setReturnDescription(encodeReturnDescription(document.getReturnDescription(),issuingDate));
} else {
asnData.setReturnIncluded(false);
}
@@ -950,6 +1000,8 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
+ asnData.setProductIdNum(UicEncoderUtils.getNum(document.getProductId()));
+ asnData.setProductIdIA5(UicEncoderUtils.getIA5NonNum(document.getProductId()));
asnData.setTicketReferenceNum(UicEncoderUtils.getNum(document.getTicketReference()));
asnData.setTicketReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getTicketReference()));
@@ -1002,8 +1054,9 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setFromStationNameUTF8(document.getFromStationName());
asnData.setToStationNameUTF8(document.getToStationName());
- asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getIncludedCarriers())));
- asnData.setCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getIncludedCarriers()));
+ NumListWrapper w = new NumListWrapper(document.getIncludedCarriers(),1,32000);
+ asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setCarriersIA5(w.getStringList());
asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,32000)));
asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,32000)));
@@ -1017,12 +1070,12 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setClassCode(TravelClassType.valueOf(document.getClassCode().name()));
}
+ if (document.getReturnDescription()!= null) {
+ asnData.setReturnDescription(encodeReturnDescription(document.getReturnDescription(),issuingDate));
+ }
if (document.isReturnIncluded()) {
asnData.setReturnIncluded(true);
- if (document.getReturnDescription()!= null) {
- asnData.setReturnDescription(encodeReturnDescription(document.getReturnDescription(),issuingDate));
- }
} else {
asnData.setReturnIncluded(false);
}
@@ -1087,14 +1140,19 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setBorder(false);
}
- asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
- asnData.setCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
-
+ NumListWrapper w = new NumListWrapper(document.getCarriers(),1,32000);
+ asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setCarriersIA5(w.getStringList());
+
asnData.setRoute(encodeViaStationCollection(document.getRoute()));
if (document.getRouteId() > 0){
- asnData.setSeriesId(new Long(document.getRouteId()));
+ asnData.setRouteId(new Long(document.getRouteId()));
}
+ if (document.getSeriesId() > 0){
+ asnData.setSeriesId(new Long(document.getSeriesId()));
+ }
+
return asnData;
}
@@ -1198,7 +1256,11 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
} else {
DeltaCoordinates delta = new DeltaCoordinates();
delta.setLatitude(Asn1BigInteger.toAsn1(asnData.getFirstEdge().getLatitude() - edge.getLatitude()));
- delta.setLatitude(Asn1BigInteger.toAsn1(asnData.getFirstEdge().getLongitude() - edge.getLongitude()));
+ delta.setLongitude(Asn1BigInteger.toAsn1(asnData.getFirstEdge().getLongitude() - edge.getLongitude()));
+ if (asnData.getEdges() == null) {
+ asnData.setEdges(new SequenceOfDeltaCoordinates());
+ }
+ asnData.getEdges().add(delta);
}
}
@@ -1328,6 +1390,10 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
+
+ asnData.setProductIdNum(UicEncoderUtils.getNum(document.getProductId()));
+ asnData.setProductIdIA5(UicEncoderUtils.getIA5NonNum(document.getProductId()));
+
asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
@@ -1479,7 +1545,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
details.setSeries(UicEncoderUtils.getRestrictedInt(seriesDataDetails.getSeries(), 1, 99999));
details.setSupplyingCarrier(UicEncoderUtils.getRestrictedInt(seriesDataDetails.getSupplyingCarrier(), 1, 9999));
details.setOfferIdentification(UicEncoderUtils.getRestrictedInt(seriesDataDetails.getOfferIdentification(), 1, 99));
- return null;
+ return details;
}
/**
@@ -1509,6 +1575,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
asnData.setInfoText(document.getInfoText());
+ asnData.setExtension(encodeExtension(document.getExtension()));
asnData.setValidity(document.getValidFrom(), document.getValidUntil());
@@ -1552,11 +1619,13 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setInfoText(document.getInfoText());
asnData.setExtension(encodeExtension(document.getExtension()));
- asnData.setIncludedCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getIncludedCarriers())));
- asnData.setIncludedCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getIncludedCarriers()));
-
- asnData.setExcludedCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getExcludedCarriers())));
- asnData.setExcludedCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getExcludedCarriers()));
+ NumListWrapper w = new NumListWrapper(document.getIncludedCarriers(),1,32000);
+ asnData.setIncludedCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setIncludedCarriersIA5(w.getStringList());
+
+ w = new NumListWrapper(document.getExcludedCarriers(),1,32000);
+ asnData.setExcludedCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setExcludedCarriersIA5(w.getStringList());
asnData.setValidityDates(document.getValidFrom(), document.getValidUntil(), issuingDate);
@@ -1636,7 +1705,10 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
TimeRangeType asnRange = new TimeRangeType();
asnRange.setFromTime(new Long(range.getFromTime()));
asnRange.setUntilTime(new Long(range.getUntilTime()));
-
+
+ if (asnData.getExcludedTimeRange() == null) {
+ asnData.setExcludedTimeRange(new SequenceOfTimeRangeType());
+ }
asnData.getExcludedTimeRange().add(asnRange);
}
}
@@ -1655,7 +1727,9 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
}
}
-
+ if (asnData.getValidityPeriod() == null) {
+ asnData.setValidityPeriod(new SequenceOfValidityPeriodType());
+ }
asnData.getValidityPeriod().add(asnRange);
}
}
@@ -1690,14 +1764,17 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
- asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
- asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
-
+ NumListWrapper w = new NumListWrapper(document.getCarriers(),1,32000);
+ asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setCarrierIA5(w.getStringList());
+
if (document.getClassCode() != null) {
asnData.setClassCode(TravelClassType.valueOf(document.getClassCode().name()));
}
if (!document.isIncludesSupplements()){
asnData.setIncludesSupplements(false);
+ } else {
+ asnData.setIncludesSupplements(true);
}
asnData.setNumberOfTravelDays(UicEncoderUtils.getRestrictedInt(document.getNumberOfTravelDates(), 1, 8));
@@ -1937,27 +2014,10 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
for (ITicketLink ticket : linkedTickets){
- TicketLinkType asnTicket = new TicketLinkType();
-
- asnTicket.setIssuerName(ticket.getIssuer());
-
- asnTicket.setIssuerPNR(ticket.getIssuerPNR());
-
- asnTicket.setProductOwnerNum(UicEncoderUtils.getNum(ticket.getProductOwner()));
- asnTicket.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(ticket.getProductOwner()));
-
- asnTicket.setReferenceNum(UicEncoderUtils.getNum(ticket.getReference()));
- asnTicket.setReferenceIA5(UicEncoderUtils.getIA5NonNum(ticket.getReference()));
-
- if (ticket.getTicketType() != ITicketType.openTicket && ticket.getTicketType() != null){
- asnTicket.setTicketType(TicketType.valueOf(ticket.getTicketType().name()));
- }
-
- if (ticket.getLinkMode() != ILinkMode.issuedTogether && ticket.getLinkMode() != null){
- asnTicket.setLinkMode(LinkMode.valueOf(ticket.getLinkMode().name()));
+ TicketLinkType asnTicket = convert(ticket);
+ if (asnTicket != null) {
+ asnList.add(asnTicket);
}
-
- asnList.add(asnTicket);
}
if (asnList.isEmpty()) return null;
@@ -1965,6 +2025,35 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
return asnList;
}
+ private TicketLinkType convert(ITicketLink document) throws EncodingFormatException {
+
+ if (document == null) return null;
+
+ TicketLinkType asnData = new TicketLinkType();
+
+ asnData.setIssuerName(document.getIssuer());
+
+ asnData.setIssuerPNR(document.getIssuerPNR());
+
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,65535);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+
+ asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ if (document.getTicketType() != ITicketType.openTicket && document.getTicketType() != null){
+ asnData.setTicketType(TicketType.valueOf(document.getTicketType().name()));
+ }
+
+ if (document.getLinkMode() != ILinkMode.issuedTogether && document.getLinkMode() != null){
+ asnData.setLinkMode(LinkMode.valueOf(document.getLinkMode().name()));
+ }
+
+ return asnData;
+ }
+
+
/**
* Encode travelers.
*
@@ -2065,6 +2154,12 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setPointOfSale(encodeGeoCoordinate(data.getPointOfSale()));
}
+ asnData.setCurrency(data.getCurrency());
+
+ if (data.getCurrencyFraction() != null) {
+ asnData.setCurrencyFract(data.getCurrencyFraction().longValue());
+ }
+
return asnData;
}
@@ -2157,6 +2252,8 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnCustomerCard.setIncludedServices(SequenceOfUnrestrictedLong.getSequence(UicEncoderUtils.getUnRestrictedIntList(document.getIncludedServices())));
asnCustomerCard.setValidity(document.getValidFrom(), document.getValidUntil());
+
+ asnCustomerCard.setExtension(encodeExtension(document.getExtension()));
return asnDocument;
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV3.java b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV3.java
index fd9995f..e3a6430 100644
--- a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV3.java
+++ b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV3.java
@@ -351,11 +351,12 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
asnData.setTrainIA5(UicEncoderUtils.getIA5NonNum(document.getTrain()));
asnData.setTrainNum(UicEncoderUtils.getNum(document.getTrain()));
- asnData.setProductOwnerNum(UicEncoderUtils.getRestrictedNum(document.getProductOwner(),1,32000));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductOwner(),1,32000));
-
- asnData.setProductIdNum(UicEncoderUtils.getRestrictedNum(document.getProductId(),0,65535));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductId(),0,65535));
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,65535);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
@@ -364,8 +365,9 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
}
- asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
- asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
+ NumListWrapper w = new NumListWrapper(document.getCarriers(),1,32000);
+ asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setCarrierIA5(w.getStringList());
asnData.setInfoText(document.getInfoText());
asnData.setExtension(encodeExtension(document.getExtension()));
@@ -467,8 +469,10 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
asnData.setCoach(UicEncoderUtils.getIA5(places.getCoach()));
asnData.setPlaceDescription(places.getPlaceDescription());
asnData.setPlaceString(UicEncoderUtils.getIA5(places.getPlaceString()));
- asnData.setPlaceNum(SequenceOfPlaceNum.getSequence(UicEncoderUtils.getNumList(places.getPlaces())));
- asnData.setPlaceIA5(UicEncoderUtils.getIA5NonNumList(places.getPlaces()));
+
+ NumListWrapper w = new NumListWrapper(places.getPlaces(),1,254);
+ asnData.setPlaceNum(SequenceOfPlaceNum.getSequence(w.getNumList()));
+ asnData.setPlaceIA5(w.getStringList());
return asnData;
}
@@ -565,20 +569,22 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
ReservationData asnData = new ReservationData();
asnDocument.getTicket().setReservation(asnData);
- asnData.setProductOwnerNum(UicEncoderUtils.getRestrictedNum(document.getProductOwner(),1,32000));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductOwner(),1,32000));
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,65535);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
- asnData.setProductIdNum(UicEncoderUtils.getRestrictedNum(document.getProductId(),0,65535));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductId(),0,65535));
-
asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
asnData.setInfoText(document.getInfoText());
asnData.setExtension(encodeExtension(document.getExtension()));
- asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
- asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
+ NumListWrapper w = new NumListWrapper(document.getCarriers(),1,32000);
+ asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setCarrierIA5(w.getStringList());
if (document.getStationCodeTable() != IStationCodeTable.stationUICReservation && document.getStationCodeTable() != null){
asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
@@ -708,12 +714,12 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
IncludedOpenTicketType asnData = new IncludedOpenTicketType();
- asnData.setProductOwnerNum(UicEncoderUtils.getRestrictedNum(document.getProductOwner(),1,32000));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductOwner(),1,32000));
-
- asnData.setProductIdNum(UicEncoderUtils.getRestrictedNum(document.getProductId(),0,65535));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductId(),0,65535));
-
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,65535);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
asnData.setInfoText(document.getInfoText());
asnData.setExtension(encodeExtension(document.getExtension()));
@@ -722,11 +728,12 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
}
- asnData.setIncludedCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getIncludedCarriers())));
- asnData.setIncludedCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getIncludedCarriers()));
+ NumListWrapper w = new NumListWrapper(document.getIncludedCarriers(),1,32000);
+ asnData.setIncludedCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setIncludedCarriersIA5(w.getStringList());
- asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,9999)));
- asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,9999)));
+ asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,32000)));
+ asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,32000)));
asnData.setExcludedTransportTypes(SequenceOfTransportTypes.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedTransportTypes(),0,31)));
asnData.setIncludedTransportTypes(SequenceOfTransportTypes.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedTransportTypes(),0,31)));
@@ -877,12 +884,13 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
asnDocument.setTicket(asnTicket);
asnTicket.setOpenTicket(asnData);
- asnData.setProductOwnerNum(UicEncoderUtils.getRestrictedNum(document.getProductOwner(),1,32000));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductOwner(),1,32000));
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,65535);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
- asnData.setProductIdNum(UicEncoderUtils.getRestrictedNum(document.getProductId(),0,65535));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductId(),0,65535));
-
asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
@@ -902,8 +910,9 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
asnData.setFromStationNameUTF8(document.getFromStationName());
asnData.setToStationNameUTF8(document.getToStationName());
- asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getIncludedCarriers())));
- asnData.setCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getIncludedCarriers()));
+ NumListWrapper w = new NumListWrapper(document.getIncludedCarriers(),1,32000);
+ asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setCarriersIA5(w.getStringList());
asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,32000)));
asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,32000)));
@@ -995,12 +1004,12 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
CountermarkData asnData = new CountermarkData();
asnDocument.getTicket().setCounterMark(asnData);
- asnData.setProductOwnerNum(UicEncoderUtils.getRestrictedNum(document.getProductOwner(),1,32000));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductOwner(),1,32000));
-
- asnData.setProductIdNum(UicEncoderUtils.getRestrictedNum(document.getProductId(),0,65535));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductId(),0,65535));
-
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,65535);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
asnData.setTicketReferenceNum(UicEncoderUtils.getNum(document.getTicketReference()));
asnData.setTicketReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getTicketReference()));
@@ -1054,8 +1063,9 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
asnData.setFromStationNameUTF8(document.getFromStationName());
asnData.setToStationNameUTF8(document.getToStationName());
- asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getIncludedCarriers())));
- asnData.setCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getIncludedCarriers()));
+ NumListWrapper w = new NumListWrapper(document.getIncludedCarriers(),1,32000);
+ asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setCarriersIA5(w.getStringList());
asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,32000)));
asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,32000)));
@@ -1138,9 +1148,10 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
asnData.setBorder(false);
}
- asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
- asnData.setCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
-
+ NumListWrapper w = new NumListWrapper(document.getCarriers(),1,32000);
+ asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setCarriersIA5(w.getStringList());
+
asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,32000)));
asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,32000)));
@@ -1384,11 +1395,12 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
ParkingGroundData asnData = new ParkingGroundData();
asnDocument.getTicket().setParkingGround(asnData);
- asnData.setProductOwnerNum(UicEncoderUtils.getRestrictedNum(document.getProductOwner(),1,32000));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductOwner(),1,32000));
-
- asnData.setProductIdNum(UicEncoderUtils.getRestrictedNum(document.getProductId(),0,65535));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductId(),0,65535));
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,65535);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
@@ -1560,11 +1572,12 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
VoucherData asnData = new VoucherData();
asnDocument.getTicket().setVoucher(asnData);
- asnData.setProductOwnerNum(UicEncoderUtils.getRestrictedNum(document.getProductOwner(),1,32000));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductOwner(),1,32000));
-
- asnData.setProductIdNum(UicEncoderUtils.getRestrictedNum(document.getProductId(),0,65535));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductId(),0,65535));
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,65535);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
@@ -1602,11 +1615,12 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
PassData asnData = new PassData();
asnDocument.getTicket().setPass(asnData);
- asnData.setProductOwnerNum(UicEncoderUtils.getRestrictedNum(document.getProductOwner(),1,32000));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductOwner(),1,32000));
-
- asnData.setProductIdNum(UicEncoderUtils.getRestrictedNum(document.getProductId(),0,65535));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductId(),0,65535));
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,65535);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
@@ -1614,11 +1628,13 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
asnData.setInfoText(document.getInfoText());
asnData.setExtension(encodeExtension(document.getExtension()));
- asnData.setIncludedCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getIncludedCarriers())));
- asnData.setIncludedCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getIncludedCarriers()));
-
- asnData.setExcludedCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getExcludedCarriers())));
- asnData.setExcludedCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getExcludedCarriers()));
+ NumListWrapper w = new NumListWrapper(document.getIncludedCarriers(),1,32000);
+ asnData.setIncludedCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setIncludedCarriersIA5(w.getStringList());
+
+ w = new NumListWrapper(document.getExcludedCarriers(),1,32000);
+ asnData.setExcludedCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setExcludedCarriersIA5(w.getStringList());
asnData.setValidityDates(document.getValidFrom(), document.getValidUntil(), issuingDate);
@@ -1692,11 +1708,13 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
}
}
- asnData.setIncludedCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getIncludedCarriers())));
- asnData.setIncludedCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getIncludedCarriers()));
+ NumListWrapper w = new NumListWrapper(document.getIncludedCarriers(),1,32000);
+ asnData.setIncludedCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setIncludedCarriersIA5(w.getStringList());
- asnData.setExcludedCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getExcludedCarriers())));
- asnData.setExcludedCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getExcludedCarriers()));
+ w = new NumListWrapper(document.getExcludedCarriers(),1,32000);
+ asnData.setExcludedCarriersNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setExcludedCarriersIA5(w.getStringList());
asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,32000)));
asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,32000)));
@@ -1782,18 +1800,20 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
FIPTicketData asnData = new FIPTicketData();
asnDocument.getTicket().setFipTicket(asnData);
- asnData.setProductOwnerNum(UicEncoderUtils.getRestrictedNum(document.getProductOwner(),1,32000));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductOwner(),1,32000));
-
- asnData.setProductIdNum(UicEncoderUtils.getRestrictedNum(document.getProductId(),0,65535));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductId(),0,65535));
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,65535);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
- asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
- asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
-
+ NumListWrapper w = new NumListWrapper(document.getCarriers(),1,32000);
+ asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(w.getNumList()));
+ asnData.setCarrierIA5(w.getStringList());
+
if (document.getClassCode() != null) {
asnData.setClassCode(TravelClassType.valueOf(document.getClassCode().name()));
}
@@ -1829,11 +1849,12 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
StationPassageData asnData = new StationPassageData();
asnDocument.getTicket().setStationPassage(asnData);
- asnData.setProductOwnerNum(UicEncoderUtils.getRestrictedNum(document.getProductOwner(),1,32000));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductOwner(),1,32000));
-
- asnData.setProductIdNum(UicEncoderUtils.getRestrictedNum(document.getProductId(),0,65535));
- asnData.setProductIdIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductId(),0,65535));
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,32000);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+ wn = new NumWrapper(document.getProductId(),0,65535);
+ asnData.setProductIdNum(wn.getNumber());
+ asnData.setProductIdIA5(wn.getString());
asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
@@ -2038,27 +2059,11 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
for (ITicketLink document : linkedTickets){
- TicketLinkType asnData = new TicketLinkType();
+ TicketLinkType asnData = convert(document);
- asnData.setIssuerName(document.getIssuer());
-
- asnData.setIssuerPNR(document.getIssuerPNR());
-
- asnData.setProductOwnerNum(UicEncoderUtils.getRestrictedNum(document.getProductOwner(),1,32000));
- asnData.setProductOwnerIA5(UicEncoderUtils.getIA5RestrictedNonNum(document.getProductOwner(),1,32000));
-
- asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
- asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
-
- if (document.getTicketType() != ITicketType.openTicket && document.getTicketType() != null){
- asnData.setTicketType(TicketType.valueOf(document.getTicketType().name()));
- }
-
- if (document.getLinkMode() != ILinkMode.issuedTogether && document.getLinkMode() != null){
- asnData.setLinkMode(LinkMode.valueOf(document.getLinkMode().name()));
+ if (asnData != null) {
+ asnList.add(asnData);
}
-
- asnList.add(asnData);
}
if (asnList.isEmpty()) return null;
@@ -2066,6 +2071,35 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
return asnList;
}
+ private TicketLinkType convert(ITicketLink document) throws EncodingFormatException {
+
+ if (document == null) return null;
+
+ TicketLinkType asnData = new TicketLinkType();
+
+ asnData.setIssuerName(document.getIssuer());
+
+ asnData.setIssuerPNR(document.getIssuerPNR());
+
+ NumWrapper wn = new NumWrapper(document.getProductOwner(),1,65535);
+ asnData.setProductOwnerNum(wn.getNumber());
+ asnData.setProductOwnerIA5(wn.getString());
+
+ asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ if (document.getTicketType() != ITicketType.openTicket && document.getTicketType() != null){
+ asnData.setTicketType(TicketType.valueOf(document.getTicketType().name()));
+ }
+
+ if (document.getLinkMode() != ILinkMode.issuedTogether && document.getLinkMode() != null){
+ asnData.setLinkMode(LinkMode.valueOf(document.getLinkMode().name()));
+ }
+
+ return asnData;
+ }
+
+
/**
* Encode travelers.
*
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/NumListWrapper.java b/src/main/java/org/uic/barcode/ticket/api/utils/NumListWrapper.java
new file mode 100644
index 0000000..4d48a81
--- /dev/null
+++ b/src/main/java/org/uic/barcode/ticket/api/utils/NumListWrapper.java
@@ -0,0 +1,55 @@
+package org.uic.barcode.ticket.api.utils;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+import org.uic.barcode.ticket.EncodingFormatException;
+
+public class NumListWrapper {
+
+ private SequenceOfStringIA5 stringList = null;
+ private List<Long> numList = null;
+
+ public NumListWrapper(Collection<String> list, int min, int max) throws EncodingFormatException {
+
+
+ if (list== null || list.isEmpty()) {
+ return;
+ }
+
+ for (String text : list){
+ String ia5 = UicEncoderUtils.getIA5RestrictedNonNum (text,min,max);
+ if (ia5 != null && ia5.length() > 0) {
+ if (stringList == null) {
+ stringList = new SequenceOfStringIA5();
+ }
+ stringList.add(ia5);
+ } else {
+ Long l = UicEncoderUtils.getRestrictedNum (text,min,max);
+ if (l != null) {
+ if (numList == null) {
+ numList = new ArrayList<Long>();
+ }
+ numList.add(l);
+ }
+ }
+
+ }
+ return;
+
+ }
+
+ public SequenceOfStringIA5 getStringList() {
+ return stringList;
+ }
+
+ public List<Long> getNumList() {
+ return numList;
+ }
+
+
+
+
+}
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/NumWrapper.java b/src/main/java/org/uic/barcode/ticket/api/utils/NumWrapper.java
new file mode 100644
index 0000000..2adcdf2
--- /dev/null
+++ b/src/main/java/org/uic/barcode/ticket/api/utils/NumWrapper.java
@@ -0,0 +1,36 @@
+package org.uic.barcode.ticket.api.utils;
+
+import org.uic.barcode.ticket.EncodingFormatException;
+
+public class NumWrapper {
+
+ private String ia5string = null;
+ private Long number = null;
+
+ public NumWrapper(String string, int min, int max) throws EncodingFormatException {
+
+
+ if (string == null || string.isEmpty()) {
+ return;
+ }
+
+ ia5string = UicEncoderUtils.getIA5RestrictedNonNum (string,min,max);
+ if (ia5string == null || ia5string.length() == 0) {
+ number = UicEncoderUtils.getRestrictedNum (string,min,max);
+ }
+ if (ia5string != null && ia5string.length() == 0) {
+ ia5string = null;
+ }
+ return;
+
+ }
+
+ public String getString() {
+ return ia5string;
+ }
+
+ public Long getNumber() {
+ return number;
+ }
+
+}
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java b/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java
index 1f8e25b..70017aa 100644
--- a/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java
+++ b/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java
@@ -5,6 +5,7 @@ package org.uic.barcode.ticket.api.utils;
import java.io.IOException;
import java.util.Date;
+import java.util.Iterator;
import java.util.List;
import org.uic.barcode.ticket.api.asn.omv2.BerthDetailData;
@@ -51,6 +52,7 @@ import org.uic.barcode.ticket.api.asn.omv2.VatDetailType;
import org.uic.barcode.ticket.api.asn.omv2.ViaStationType;
import org.uic.barcode.ticket.api.asn.omv2.VoucherData;
import org.uic.barcode.ticket.api.asn.omv2.ZoneType;
+import org.uic.barcode.ticket.api.asn.omv2.ServiceType;
import org.uic.barcode.ticket.api.impl.SimpleUicTicketObjectFactory;
import org.uic.barcode.ticket.api.spec.IBerth;
import org.uic.barcode.ticket.api.spec.IBerthTypeType;
@@ -94,6 +96,7 @@ import org.uic.barcode.ticket.api.spec.IRoofRackType;
import org.uic.barcode.ticket.api.spec.IRouteSection;
import org.uic.barcode.ticket.api.spec.ISeriesDataDetails;
import org.uic.barcode.ticket.api.spec.IServiceBrand;
+import org.uic.barcode.ticket.api.spec.IServiceType;
import org.uic.barcode.ticket.api.spec.IStationCodeTable;
import org.uic.barcode.ticket.api.spec.IStationPassage;
import org.uic.barcode.ticket.api.spec.ITariff;
@@ -438,6 +441,10 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
document.setArrivalUTCoffset(asnDocument.getDepartureUTCOffset());
}
+ if (asnDocument.getService() != null) {
+ document.setService(convert(asnDocument.getService()));
+ }
+
if(asnDocument.getClassCode()!=null){
document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
}
@@ -457,6 +464,10 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
if (asnDocument.getPlaces()!=null) {
document.setPlaces(convertPlaces(asnDocument.getPlaces()));
}
+
+ if (asnDocument.getAdditionalPlaces()!=null) {
+ document.setAdditionalPlaces(convertPlaces(asnDocument.getAdditionalPlaces()));
+ }
if (asnDocument.getBicyclePlaces()!=null) {
document.setBicyclePlaces(convertPlaces(asnDocument.getBicyclePlaces()));
@@ -518,7 +529,20 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
return document;
}
-
+ private IServiceType convert(ServiceType service) {
+
+ if (service == null) {
+ return null;
+ } else if (service.equals(ServiceType.seat)) {
+ return IServiceType.seat;
+ } else if (service.equals(ServiceType.couchette)) {
+ return IServiceType.couchette;
+ } else if (service.equals(ServiceType.berth)) {
+ return IServiceType.berth;
+ }
+
+ return null;
+ }
@@ -703,7 +727,9 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
details.setCompartmentTypeDescr(asnDetails.getCompartmentTypeDescr());
details.setSpecialAllocationDescr(asnDetails.getSpecialAllocationDescr());
- details.setPosition(ICompartmentPositionType.valueOf(asnDetails.getPosition().name()));
+ if (asnDetails.getPosition() != null) {
+ details.setPosition(ICompartmentPositionType.valueOf(asnDetails.getPosition().name()));
+ }
return details;
}
@@ -799,6 +825,10 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
document.setTicketReference(UicEncoderUtils.mapToString(asnDocument.getTicketReferenceNum(),asnDocument.getTicketReferenceIA5()));
+ if (asnDocument.getStationCodeTable()!=null){
+ document.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
+ }
+
document.setFromStation(UicEncoderUtils.mapToString(asnDocument.getFromStationNum(),asnDocument.getFromStationIA5()));
document.setToStation(UicEncoderUtils.mapToString(asnDocument.getToStationNum(),asnDocument.getToStationIA5()));
@@ -812,6 +842,29 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
}
}
+ if (asnDocument.getCarriersNum()!=null && !asnDocument.getCarriersNum().isEmpty()){
+ for(Long carrier :asnDocument.getCarriersNum()){
+ document.addIncludedCarrier(carrier.toString());
+ }
+ }
+ if (asnDocument.getCarriersIA5()!=null && !asnDocument.getCarriersIA5().isEmpty()){
+ for(String carrier :asnDocument.getCarriersIA5()){
+ document.addIncludedCarrier(carrier);
+ }
+ }
+
+ if (asnDocument.getIncludedServiceBrands()!=null && !asnDocument.getIncludedServiceBrands().isEmpty()){
+ for(Long number :asnDocument.getIncludedServiceBrands()){
+ document.addIncludedServiceBrand(number.intValue());
+ }
+ }
+
+ if (asnDocument.getExcludedServiceBrands()!=null && !asnDocument.getExcludedServiceBrands().isEmpty()){
+ for(Long number :asnDocument.getExcludedServiceBrands()){
+ document.addExcludedServiceBrand(number.intValue());
+ }
+ }
+
document.setReturnDescription(convertReturnDescription(asnDocument.getReturnDescription(), issuingDate));
@@ -934,6 +987,10 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
}
+ if (asnDocument.getServiceLevel()!=null && asnDocument.getServiceLevel().length() != 0) {
+ document.setServiceLevel(asnDocument.getServiceLevel());
+ }
+
document.setValidFrom(asnDocument.getValidFromDate(issuingDate));
document.setValidUntil(asnDocument.getValidUntilDate(issuingDate));
@@ -1074,6 +1131,10 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
document.setClassCode(classCode);
}
+ if (asnDocument.getServiceLevel() != null && asnDocument.getServiceLevel().length() > 0) {
+ document.setServiceLevel(asnDocument.getServiceLevel());
+ }
+
document.setValidFrom(asnDocument.getValidFromDate(issuingDate));
document.setValidUntil(asnDocument.getValidUntilDate(issuingDate));
@@ -1201,9 +1262,9 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
document.setProductName(asnDocument.getProductName());
document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
- if (asnDocument.getStationNameUTF8()!= null && asnDocument.getStationNameUTF8().isEmpty() ) {
+ if (asnDocument.getStationNameUTF8()!= null && !asnDocument.getStationNameUTF8().isEmpty() ) {
for (String name : asnDocument.getStationNameUTF8()) {
- document.addStation(name);
+ document.addStationName(name);
}
}
@@ -1364,11 +1425,16 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
via.addRouteStation(convertViaStation(routeVia));
}
}
+
if (asnDocument.getAlternativeRoutes()!= null && !asnDocument.getAlternativeRoutes().isEmpty()) {
for ( ViaStationType routeVia: asnDocument.getAlternativeRoutes()) {
- via.addRouteStation(convertViaStation(routeVia));
+ via.getAlternativeRoutes().add(convertViaStation(routeVia));
}
}
+
+ if (asnDocument.getSeriesId() != null) {
+ via.setSeriesId(asnDocument.getSeriesId().intValue());
+ }
return via;
@@ -1409,7 +1475,9 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
IZone zone = factory.createZone();
- zone.setBinaryZoneId(asnDocument.getBinaryZoneId());
+ if (asnDocument.getBinaryZoneId() != null && asnDocument.getBinaryZoneId().length > 0) {
+ zone.setBinaryZoneId(asnDocument.getBinaryZoneId());
+ }
zone.setCarrier(UicEncoderUtils.mapToString(asnDocument.getCarrierNum(),asnDocument.getCarrierIA5()));
if (asnDocument.getCity() != null) {
@@ -1423,6 +1491,13 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
zone.setNUTScode(asnDocument.getNutsCode());
+ if (asnDocument.getZoneId() != null && !asnDocument.getZoneId().isEmpty()) {
+ Iterator<Long> it = asnDocument.getZoneId().iterator();
+ while (it.hasNext()) {
+ zone.addZoneId(it.next().intValue());
+ }
+ }
+
return zone;
}
@@ -1440,8 +1515,10 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
IGeoCoordinate firstEdge = convertGeoCoordinate(asnPolygone.getFirstEdge());
+
if (firstEdge == null) return null;
-
+ polygone.addEdge(firstEdge);
+
if (asnPolygone.getEdges()!=null && !asnPolygone.getEdges().isEmpty()) {
for (DeltaCoordinates asnEdge :asnPolygone.getEdges()){
@@ -1470,7 +1547,10 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
ILine line = factory.createLine();
- line.setBinaryZoneId(asnDocument.getBinaryZoneId());
+ if (asnDocument.getBinaryZoneId() != null && asnDocument.getBinaryZoneId().length > 0) {
+ line.setBinaryZoneId(asnDocument.getBinaryZoneId());
+ }
+
line.setCarrier(UicEncoderUtils.mapToString(asnDocument.getCarrierNum(),asnDocument.getCarrierIA5()));
if (asnDocument.getCity()!=null) {
line.setCity(asnDocument.getCity().intValue());
@@ -1621,6 +1701,17 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+ if (asnDocument.getCarrierNum()!=null && !asnDocument.getCarrierNum().isEmpty()){
+ for(Long carrier :asnDocument.getCarrierNum()){
+ document.addCarrier(carrier.toString());
+ }
+ }
+ if (asnDocument.getCarrierIA5()!=null && !asnDocument.getCarrierIA5().isEmpty()){
+ for(String carrier :asnDocument.getCarrierIA5()){
+ document.addCarrier(carrier);
+ }
+ }
+
if (asnDocument.getActivatedDay() != null && !asnDocument.getActivatedDay().isEmpty()) {
document.getActivatedDays().addAll(asnDocument.getActivatedDays(issuingDate));
}
@@ -1673,6 +1764,9 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
if (asnDocument.getNumberOfDaysOfTravel() != null) {
document.setNumberOfDaysOfTravel(asnDocument.getNumberOfDaysOfTravel().intValue());
}
+ if (asnDocument.getNumberOfValidityDays() != null) {
+ document.setNumberOfValidityDays(asnDocument.getNumberOfValidityDays().intValue());
+ }
if (asnDocument.getNumberOfPossibleTrips() != null) {
document.setNumberOfPossibleTrips(asnDocument.getNumberOfPossibleTrips().intValue());
}
@@ -1884,6 +1978,9 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
card.addIncludedService(new Integer(service.intValue()));
}
}
+
+ card.setExtension(convertExtension(asnDocument.getExtension()));
+
return card;
}
@@ -2138,6 +2235,11 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
issuingDetail.setPointOfSale(convertGeoCoordinate(asnIssuingDetail.getPointOfSale()));
}
+ issuingDetail.setCurrency(asnIssuingDetail.getCurrency());
+
+ if (asnIssuingDetail.getCurrencyFract() != null) {
+ issuingDetail.setCurrencyFraction(asnIssuingDetail.getCurrencyFract().intValue());
+ }
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/UicEncoderUtils.java b/src/main/java/org/uic/barcode/ticket/api/utils/UicEncoderUtils.java
index f5eb15c..261b7ac 100644
--- a/src/main/java/org/uic/barcode/ticket/api/utils/UicEncoderUtils.java
+++ b/src/main/java/org/uic/barcode/ticket/api/utils/UicEncoderUtils.java
@@ -217,7 +217,7 @@ public class UicEncoderUtils {
}
/**
- * Gets the num list.
+ * Gets the list of all numeric strings.
*
* @param list the list
* @return the num list
@@ -244,9 +244,10 @@ public class UicEncoderUtils {
return numList;
}
+
/**
- * Gets the i a5 non num list.
+ * Gets the IA5 string list of all elements that are not nmeric.
*
* @param list the list
* @return the i a5 non num list
@@ -274,8 +275,7 @@ public class UicEncoderUtils {
return ia5List;
}
-
-
+
/**
* Gets the i a5.
@@ -443,34 +443,6 @@ public class UicEncoderUtils {
return list;
}
- /**
- * Gets the restricted int list.
- *
- * @param intList the int list
- * @param min the min
- * @param max the max
- * @return the restricted int list
- * @throws EncodingFormatException the encoding format exception
- */
- public static List<Integer> getRestrictedIntList( Collection<Integer> intList, int min, int max) throws EncodingFormatException {
- if (intList == null || intList.isEmpty()) return null;
-
- ArrayList<Integer> list = new ArrayList<Integer>();
-
- for (Integer i : intList){
- if (i != 0){
-
- if (i < min || i > max){
- throw new EncodingFormatException("Integer value exceeds boundaries");
- }
-
- list.add(i);
- }
- }
-
- if (list.isEmpty()) return null;
- return list;
- }
/**
* Encode restricted integer collection.
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/AllElementsTestV2.java b/src/test/java/org/uic/barcode/ticket/api/test/AllElementsTestV2.java
new file mode 100644
index 0000000..00590eb
--- /dev/null
+++ b/src/test/java/org/uic/barcode/ticket/api/test/AllElementsTestV2.java
@@ -0,0 +1,1094 @@
+package org.uic.barcode.ticket.api.test;
+
+import java.text.ParseException;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.TimeZone;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
+import org.uic.barcode.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.api.asn.omv2.ConfirmationTypeType;
+import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData;
+import org.uic.barcode.ticket.api.spec.IBerth;
+import org.uic.barcode.ticket.api.spec.IBerthTypeType;
+import org.uic.barcode.ticket.api.spec.ICarCarriageReservation;
+import org.uic.barcode.ticket.api.spec.ICardReference;
+import org.uic.barcode.ticket.api.spec.ICompartmentGenderType;
+import org.uic.barcode.ticket.api.spec.ICompartmentPositionType;
+import org.uic.barcode.ticket.api.spec.ICounterMark;
+import org.uic.barcode.ticket.api.spec.ICustomerCard;
+import org.uic.barcode.ticket.api.spec.ICustomerStatusDescription;
+import org.uic.barcode.ticket.api.spec.IDelayConfirmation;
+import org.uic.barcode.ticket.api.spec.IDocumentData;
+import org.uic.barcode.ticket.api.spec.IDocumentExtension;
+import org.uic.barcode.ticket.api.spec.IExtension;
+import org.uic.barcode.ticket.api.spec.IFipTicket;
+import org.uic.barcode.ticket.api.spec.IGenderType;
+import org.uic.barcode.ticket.api.spec.IGeoCoordinateSystemType;
+import org.uic.barcode.ticket.api.spec.IGeoUnitType;
+import org.uic.barcode.ticket.api.spec.IHemisphereLatitudeType;
+import org.uic.barcode.ticket.api.spec.IHemisphereLongitudeType;
+import org.uic.barcode.ticket.api.spec.IIncludedOpenTicket;
+import org.uic.barcode.ticket.api.spec.ILine;
+import org.uic.barcode.ticket.api.spec.ILinkMode;
+import org.uic.barcode.ticket.api.spec.ILoadingDeckType;
+import org.uic.barcode.ticket.api.spec.IOpenTicket;
+import org.uic.barcode.ticket.api.spec.IParkingGround;
+import org.uic.barcode.ticket.api.spec.IPass;
+import org.uic.barcode.ticket.api.spec.IPassengerType;
+import org.uic.barcode.ticket.api.spec.IPolygone;
+import org.uic.barcode.ticket.api.spec.IPriceTypeType;
+import org.uic.barcode.ticket.api.spec.IRegionalValidity;
+import org.uic.barcode.ticket.api.spec.IRegisteredLuggage;
+import org.uic.barcode.ticket.api.spec.IReservation;
+import org.uic.barcode.ticket.api.spec.IRoofRackType;
+import org.uic.barcode.ticket.api.spec.IServiceType;
+import org.uic.barcode.ticket.api.spec.IStationCodeTable;
+import org.uic.barcode.ticket.api.spec.IStationPassage;
+import org.uic.barcode.ticket.api.spec.ITariff;
+import org.uic.barcode.ticket.api.spec.ITicketLink;
+import org.uic.barcode.ticket.api.spec.ITicketType;
+import org.uic.barcode.ticket.api.spec.ITimeRange;
+import org.uic.barcode.ticket.api.spec.ITrainLink;
+import org.uic.barcode.ticket.api.spec.ITravelClassType;
+import org.uic.barcode.ticket.api.spec.ITraveler;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.api.spec.IValidityRange;
+import org.uic.barcode.ticket.api.spec.IVatDetail;
+import org.uic.barcode.ticket.api.spec.IViaStation;
+import org.uic.barcode.ticket.api.spec.IVoucher;
+import org.uic.barcode.ticket.api.spec.IZone;
+import org.uic.barcode.ticket.api.test.testtickets.AllElementsTestTicketV2;
+import org.uic.barcode.ticket.api.utils.Api2AsnEncoder;
+import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV2;
+import org.uic.barcode.ticket.api.utils.Asn2ApiDecoder;
+import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV2;
+
+
+/**
+ * The Class CarCarriageTestV1.
+ *
+ *
+ *
+ */
+public class AllElementsTestV2 {
+
+
+ /** The decoder. */
+ Asn2ApiDecoder decoder = new OpenAsn2ApiDecoderV2();
+
+ /** The encoder. */
+ Api2AsnEncoder encoder = new Api2OpenAsnEncoderV2();
+
+
+ TimeZone defaulttimeZone = null;
+
+ /**
+ * Prepare tickets.
+ */
+ @Before public void prepare() {
+
+ LoggerFactory.setActivateConsoleLog(true);
+
+ defaulttimeZone = TimeZone.getDefault();
+
+
+ }
+
+ /**
+ * clean up
+ */
+ @After public void resetTimeZone() {
+ TimeZone.setDefault(defaulttimeZone);
+ }
+
+
+ /**
+ * Test encode test tickets in UTC and decode in CET.
+ *
+ * @throws IllegalArgumentException the illegal argument exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ParseException
+ */
+ @Test public void testDelayConfirmation() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+
+ defaulttimeZone = TimeZone.getDefault();
+ //encode in UTC time zone
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+
+ IUicRailTicket ticketDecoded = null;
+ try {
+
+ UicRailTicketData rtd = AllElementsTestTicketV2.getUicTestTicket();
+ byte[] content = UperEncoder.encode(rtd);
+ ticketDecoded = decoder.decodeFromAsn(content);
+ } catch (Exception e) {
+ assert(false);
+ }
+
+
+
+
+ byte[] encoded = null;
+ try {
+ encoded = encoder.encode(ticketDecoded);
+ } catch (EncodingFormatException e) {
+ assert(false);
+ }
+
+ //decode ticket again
+ IUicRailTicket ticketDecoded2 = null;
+ try {
+ ticketDecoded2 = decoder.decodeFromAsn(encoded);
+ } catch (Exception e) {
+ assert(false);
+ }
+
+ assert (ticketDecoded2 != null);
+
+ //validate content
+ validateTicketContent(ticketDecoded2);
+
+
+
+
+ TimeZone.setDefault(defaulttimeZone);
+ }
+
+
+
+
+
+
+ private void validateTicketContent(IUicRailTicket ticket) {
+ assert (ticket != null);
+
+ assert(ticket.getControlDetails() != null);
+ assert(ticket.getControlDetails().isAgeCheckRequired() == false);
+ assert(ticket.getControlDetails().isIdentificationByPassportId() == false);
+ assert(ticket.getControlDetails().isIdentificationByIdCard() == false);
+ assert(ticket.getControlDetails().isOnlineValidationRequired() == false);
+ assert(ticket.getControlDetails().getIdentificationItem() == 12);
+ assert(ticket.getControlDetails().isPassportValidationRequired() == false);
+ assert(ticket.getControlDetails().getRandomDetailedValidationRequired() == 50);
+ assert(ticket.getControlDetails().getExtension() != null);
+ assert(ticket.getControlDetails().isReductionCardCheckRequired() == false);
+ assert(ticket.getControlDetails().getInfoText().equals("control"));
+ assert(ticket.getControlDetails().getIdentificationByCardReference() != null);
+
+ assert(ticket.getControlDetails().getIdentificationByCardReference().size() == 1);
+ ICardReference cr = ticket.getControlDetails().getIdentificationByCardReference().iterator().next();
+ assert(cr != null);
+ assert(cr.getCardId().equals("5678"));
+ assert(cr.getCardIssuer().equals("1234"));
+ assert(cr.getCardName().equals("testcard"));
+ assert(cr.getCardType() == 123);
+ assert(cr.getLeadingCardId().equals("3456"));
+ assert(cr.getTrailingCardId().equals("100"));
+
+
+ assert(ticket.getControlDetails().getLinkedTickets() != null);
+
+ ITicketLink tl = ticket.getControlDetails().getLinkedTickets().iterator().next();
+
+ assert(tl.getIssuer().equals("XYZ"));
+ assert(tl.getIssuerPNR().equals("LDWDUR45"));
+ assert(tl.getProductOwner().equals("IEFHU"));
+ assert(tl.getLinkMode().equals(ILinkMode.issuedTogether));
+ assert(tl.getReference().equals("KDJET"));
+ assert(tl.getTicketType().equals(ITicketType.openTicket));
+
+ assert(ticket.getExtensions() != null);
+ assert(ticket.getExtensions().size() == 2);
+ Iterator<IExtension> it = ticket.getExtensions().iterator();
+ IExtension e0 = it.next();
+ IExtension e1 = it.next();
+ assert(e0.getId().equals("1"));
+ assert(UperEncoder.hexStringFromBytes(e0.getBinarydata()).equals("82DA"));
+ assert(e1.getId().equals("2"));
+ assert(UperEncoder.hexStringFromBytes(e1.getBinarydata()).equals("83DA"));
+
+
+ assert(ticket.getIssuerDetails() != null);
+
+ assert(ticket.getIssuerDetails().isActivated() == true);
+ assert(ticket.getIssuerDetails().getCurrency().equals("SRF"));
+ assert(ticket.getIssuerDetails().getCurrencyFraction() == 3L);
+ assert(ticket.getIssuerDetails().getExtension() != null);
+ assert(ticket.getIssuerDetails().getIssuedOnLine() == 12);
+ assert(ticket.getIssuerDetails().getIssuedOnTrain().equals("123"));
+ assert(ticket.getIssuerDetails().getIssuerName().equals("name"));
+ assert(ticket.getIssuerDetails().getIssuer().equals("1"));
+ assert(ticket.getIssuerDetails().getIssuerPNR().equals("issuerTestPNR"));
+ assert(ticket.getIssuerDetails().getIssuingDate() != null);
+ assert(ticket.getIssuerDetails().isSecurePaperTicket() == false);
+ assert(ticket.getIssuerDetails().getSecurityProvider().equals("1"));
+ assert(ticket.getIssuerDetails().isSpecimen() == true);
+ assert(ticket.getIssuerDetails().getPointOfSale() != null);
+ assert(ticket.getIssuerDetails().getPointOfSale().getUnit().equals(IGeoUnitType.microDegree));
+ assert(ticket.getIssuerDetails().getPointOfSale().getSystem().equals(IGeoCoordinateSystemType.wgs84));
+ assert(ticket.getIssuerDetails().getPointOfSale().getAccuracy().equals(IGeoUnitType.microDegree));
+ assert(ticket.getIssuerDetails().getPointOfSale().getHemisphereLatitude().equals(IHemisphereLatitudeType.east));
+ assert(ticket.getIssuerDetails().getPointOfSale().getHemisphereLongitude().equals(IHemisphereLongitudeType.north));
+ assert(ticket.getIssuerDetails().getPointOfSale().getLatitude() == 269);
+ assert(ticket.getIssuerDetails().getPointOfSale().getLongitude() == 105);
+
+ assert(ticket.getDocumentData() != null);
+ assert(!ticket.getDocumentData().isEmpty());
+
+ Iterator<IDocumentData> i2 = ticket.getDocumentData().iterator();
+
+ int numberOfDocuments = 0;
+ while (i2.hasNext()) {
+ numberOfDocuments++;
+ IDocumentData d1 = i2.next();
+ if (d1 instanceof IReservation) {
+ validate((IReservation) d1);
+ } else if (d1 instanceof ICarCarriageReservation) {
+ validate((ICarCarriageReservation) d1);
+ } else if (d1 instanceof IPass) {
+ validate((IPass) d1);
+ } else if (d1 instanceof IOpenTicket) {
+ validate((IOpenTicket) d1);
+ } else if (d1 instanceof ICounterMark) {
+ validate((ICounterMark) d1);
+ } else if (d1 instanceof IStationPassage) {
+ validate((IStationPassage) d1);
+ } else if (d1 instanceof ICustomerCard) {
+ validate((ICustomerCard) d1);
+ } else if (d1 instanceof IDelayConfirmation) {
+ validate((IDelayConfirmation) d1);
+ } else if (d1 instanceof IParkingGround) {
+ validate((IParkingGround) d1);
+ } else if (d1 instanceof IFipTicket) {
+ validate((IFipTicket) d1);
+ } else if (d1 instanceof IVoucher) {
+ validate((IVoucher) d1);
+ } else if (d1 instanceof IDocumentExtension) {
+ assert(((IDocumentExtension) d1).getId() != null);
+ }
+ }
+ assert(numberOfDocuments == 11);
+
+
+ assert(ticket.getTravelerDetails() != null);
+ assert(ticket.getTravelerDetails().getGroupName().equals("myGroup"));
+ assert(ticket.getTravelerDetails().getPreferredLanguage().equals("EN"));
+ assert(ticket.getTravelerDetails().getTravelers() != null);
+ assert(ticket.getTravelerDetails().getTravelers().size() == 1);
+
+ ITraveler tr = ticket.getTravelerDetails().getTravelers().iterator().next();
+
+ assert(tr.getIDCardCountry() == 103);
+ assert(tr.getPassportCountry() == 102);
+ assert(tr.getCountryOfResidence() == 101);
+ assert(tr.getCustomerId().equals("DZE5gT"));
+ assert(tr.getDateOfBirth() != null);
+ assert(tr.getFirstName().equals("John"));
+ assert(tr.getGender().equals(IGenderType.male));
+ assert(tr.getIdCard().equals("12345"));
+ assert(tr.getLastName().equals("Dow"));
+ assert(tr.getPassengerType().equals(IPassengerType.senior));
+ assert(tr.isPassengerWithReducedMobility() == false);
+ assert(tr.getPassportId().equals("JDTS"));
+ assert(tr.getSecondName().equals("Little"));
+ assert(tr.getTitle().equals("PhD"));
+ assert(tr.isTicketHolder() == true);
+ assert(tr.getStatusCollection() != null);
+ assert(tr.getStatusCollection().size() == 1);
+ ICustomerStatusDescription csd = tr.getStatusCollection().iterator().next();
+ assert(csd.getStatus() == 1);
+ assert(csd.getDescription().equals("senior"));
+
+ }
+
+
+ private void validate(ICounterMark t) {
+
+ assert(t != null);
+
+ assert(t.getReference().equals("810123456789"));
+ assert(t.getProductOwner().equals( "23456"));
+ assert(t.getProductId().equals( "23456"));
+ assert(t.getTicketReference().equals( "810123456789"));
+ assert(t.getNumberOfCountermark() == 12L);
+ assert(t.getTotalOfCountermarks() == 24L);
+ assert(t.getGroupName().equals( "groupName"));
+ assert(t.isReturnIncluded() == false);
+
+ assert(t.getStationCodeTable().equals(IStationCodeTable.stationERA));
+ assert(t.getFromStation().equals("8100001"));
+ assert(t.getToStation().equals( "8100002"));
+ assert(t.getFromStationName().equals( "A-STATION"));
+ assert(t.getToStationName().equals( "B-STATION"));
+
+ assert(t.getValidRegionDesc().equals("From A to B via C"));
+
+ assert(t.getValidRegionList() != null);
+ assert(t.getValidRegionList().size() == 1);
+
+
+ assert(t.getReturnDescription() != null);
+ assert(t.getReturnDescription().getFromStation().equals("8100001"));
+ assert(t.getReturnDescription().getToStation().equals( "8100002"));
+ assert(t.getReturnDescription().getFromStationName().equals( "A-STATION"));
+ assert(t.getReturnDescription().getToStationName().equals( "B-STATION"));
+ assert(t.getReturnDescription().getValidRegionDesc().equals( "return"));
+ assert(t.getReturnDescription().getValidRegionList() != null);
+ assert(t.getReturnDescription().getValidRegionList().size() == 1);
+
+ assert(t.getValidFrom() != null);
+ assert(t.getValidUntil() != null);
+
+ assert(t.getClassCode().equals(ITravelClassType.first));
+
+ assert(t.getIncludedCarriers() != null);
+ assert(t.getIncludedCarriers().size() == 2);
+ assert(t.getIncludedCarriers().contains("1080"));
+ assert(t.getIncludedCarriers().contains("1181"));
+
+
+ assert(t.getIncludedServiceBrands() != null);
+ assert(t.getIncludedServiceBrands().size() == 2);
+ Iterator<Integer> i4 = t.getIncludedServiceBrands().iterator();
+ assert(i4.next() == 108);
+ assert(i4.next() == 118);
+
+ assert(t.getExcludedServiceBrands() != null);
+ assert(t.getExcludedServiceBrands().size() == 2);
+ i4 = t.getExcludedServiceBrands().iterator();
+ assert(i4.next() == 108);
+ assert(i4.next() == 118);
+
+
+ assert (t.getInfoText().equals("counterMark"));
+
+ assert(t.getExtension() != null);
+
+
+ }
+
+ private void validate(IDelayConfirmation t) {
+ assert(t != null);
+
+ assert(t.getTrain().equals("100"));
+ assert(t.getArrivalDate() != null);
+ assert(t.getReference().equals("ABDJ12345"));
+ assert(t.getStation().equals("DJE"));
+ assert(t.getDelay() == 31);
+ assert(t.isTrainCancelled() == false);
+ assert(t.getConfirmationType() == ConfirmationTypeType.travelerDelayConfirmation.ordinal());
+ assert(t.getLinkedTickets() != null);
+ assert(t.getLinkedTickets().size() == 1);
+ ITicketLink tl = t.getLinkedTickets().iterator().next();
+ assert(tl.getReference().equals("KDJET"));
+ assert(tl.getIssuer().equals( "XYZ"));
+ assert(tl.getIssuerPNR().equals( "LDWDUR45"));
+ assert(tl.getProductOwner().equals( "IEFHU"));
+ assert(tl.getTicketType().equals(ITicketType.openTicket));
+ assert(tl.getLinkMode().equals( ILinkMode.issuedTogether));
+
+ assert(t.getInfoText().equals( "delay confirmation"));
+ assert(t.getExtension() != null);
+
+ }
+
+ private void validate(ICustomerCard c) {
+ assert(c != null);
+ assert (c.getExtension() != null);
+ assert (c.getCustomer() != null);
+ assert (c.getCustomer() != null);
+
+ assert (c.getCardId().equals("2345"));
+ assert (c.getValidFrom() != null);
+ assert (c.getValidUntil() != null);
+ assert (c.getClassCode().equals(ITravelClassType.second));
+ assert (c.getCardType() == 15);
+ assert (c.getCardTypeDescr().equals( "RAILPLUS"));
+ assert (c.getCustomerStatus() == 1);
+ assert (c.getCustomerStatusDescr().equals( "gold"));
+ assert (c.getIncludedServices() != null);
+ assert (c.getIncludedServices().size() == 2);
+ Iterator<Integer> i3 = c.getIncludedServices().iterator();
+ assert(i3.next() == 1);
+ assert(i3.next() == 2);
+
+ }
+
+ private void validate(IVoucher v) {
+ assert(v != null);
+ assert (v.getExtension() != null);
+
+ assert(v.getReference().equals("810123456789"));
+ assert(v.getProductOwner().equals("COFFEEMACHINE"));
+ assert(v.getProductId().equals("23456"));
+
+ assert(v.getValidFrom() != null);
+ assert(v.getValidUntil() != null);
+ assert(v.getAmount() == 500);
+ assert(v.getType() == 123);
+ assert(v.getInfoText().equals("coffee voucher"));
+
+ }
+
+ private void validate(IStationPassage t) {
+ assert(t != null);
+ assert(t.getExtension() != null);
+
+ assert(t.getReference().equals("810123456789"));
+ assert(t.getProductOwner().equals("23456"));
+ assert(t.getProductId().equals("23456"));
+
+ assert(t.getProductName().equals("passage"));
+ assert(t.getStationCodeTable().equals(IStationCodeTable.stationUIC));
+ assert(t.getStations() != null);
+ assert(t.getStations().size() == 2);
+ assert(t.getStations().contains("8200001"));
+ assert(t.getStations().contains("AMS"));
+ assert(t.getStationNames() != null);
+ assert(t.getStationNames().size() == 1);
+ assert(t.getStationNames().iterator().next().equals("Amsterdam"));
+ assert(t.getAreaCodes() != null);
+ assert(t.getAreaCodes().size() == 2);
+ assert(t.getAreaCodes().contains("AMS"));
+ assert(t.getAreaCodes().contains("8200001"));
+ assert(t.getAreaNames() != null);
+ assert(t.getAreaNames().size() == 1);
+ assert(t.getAreaNames().contains("Amsterdam"));
+ assert(t.getValidFrom() != null);
+ assert(t.getValidUntil() != null);
+ assert(t.getNumberOfdaysAllowed() == 5);
+
+ }
+
+ private void validate(IParkingGround t) {
+ assert(t != null);
+ assert(t.getExtension() != null);
+
+ assert(t.getReference().equals("810123456789"));
+ assert(t.getProductOwner().equals("23456"));
+ assert(t.getProductId().equals("23456"));
+
+
+ assert(t.getParkingGroundId().equals( "IA5"));
+ assert(t.getFromParkingDate() != null);
+ assert(t.getToParkingDate() != null);
+
+
+ assert(t.getAccessCode().equals( "4ga"));
+ assert(t.getLocation().equals( "Parking Frankfurt Main West"));
+ assert(t.getStationCodeTable().equals(IStationCodeTable.stationUIC));
+ assert(t.getStation().equals( "8000001"));
+ assert(t.getSpecialInformation().equals( "outdoor parking"));
+ assert(t.getEntryTrack().equals( "left"));
+ assert(t.getNumberPlate().equals( "AA-DE-12345"));
+ assert(t.getPrice() == 500);
+ assert(t.getVatDetails() != null);
+ assert(t.getVatDetails().size() == 1);
+
+
+ }
+
+ private void validate(IFipTicket t) {
+ assert(t != null);
+ assert(t.getExtension() != null);
+
+ assert(t.getReference().equals("810123456789"));
+ assert(t.getProductOwner().equals("23456"));
+ assert(t.getProductId().equals("23456"));
+
+
+ assert(t.getValidFrom() != null);
+ assert(t.getValidUntil() != null);
+ assert(t.getActivatedDays() != null);
+ assert(t.getActivatedDays().size() == 4);
+ Iterator<Date> i5 = t.getActivatedDays().iterator();
+ assert(i5.next() != null);
+ assert(i5.next() != null);
+ assert(i5.next() != null);
+ assert(i5.next() != null);
+
+
+
+ assert(t.getCarriers()!= null);
+ assert(t.getCarriers().size() == 2);
+ assert(t.getCarriers().contains("1080"));
+ assert(t.getCarriers().contains("1181"));
+
+
+ assert(t.getNumberOfTravelDates() == 8);
+ assert(t.isIncludesSupplements() == true);
+ assert(t.getClassCode().equals(ITravelClassType.first));
+
+ }
+
+ private void validate(IOpenTicket t) {
+
+ assert (t != null);
+
+ assert(t.getReference().equals("810123456789"));
+ assert(t.getProductOwner().equals( "23456"));
+ assert(t.getProductId().equals( "23456"));
+ assert(t.getExternalIssuer() == 12);
+ assert(t.getAuthorizationCode() == 13);
+ assert(t.isReturnIncluded() == false);
+
+ assert(t.getStationCodeTable().equals(IStationCodeTable.stationERA));
+ assert(t.getFromStation().equals("8100001"));
+ assert(t.getToStation().equals( "8100002"));
+ assert(t.getFromStationName().equals( "A-STATION"));
+ assert(t.getToStationName().equals( "B-STATION"));
+
+ assert(t.getValidRegionDesc().equals("From A to B via C"));
+
+ assert (t.getValidRegionList() != null);
+ assert(t.getValidRegionList().size() == 5);
+ Iterator<IRegionalValidity> irv = t.getValidRegionList().iterator();
+ int checks = 0;
+ while (irv.hasNext()) {
+ IRegionalValidity v = irv.next();
+ if (v instanceof IZone) {
+ validateRegion((IZone) v);
+ checks++;
+ } else if (v instanceof IViaStation) {
+ validateRegion((IViaStation) v);
+ checks++;
+ } else if (v instanceof ITrainLink) {
+ validateRegion((ITrainLink) v);
+ checks++;
+ } else if (v instanceof IPolygone) {
+ validateRegion((IPolygone) v);
+ checks++;
+ } else if (v instanceof ILine) {
+ validateRegion((ILine) v);
+ checks++;
+ }
+ }
+ assert(checks == 5);
+
+ assert(t.getReturnDescription() != null);
+
+ assert(t.getReturnDescription().getFromStation().equals("8100001"));
+ assert(t.getReturnDescription().getToStation().equals( "8100002"));
+ assert(t.getReturnDescription().getFromStationName().equals( "A-STATION"));
+ assert(t.getReturnDescription().getToStationName().equals( "B-STATION"));
+ assert(t.getReturnDescription().getValidRegionDesc().equals( "return"));
+ assert(t.getReturnDescription().getValidRegionList() != null);
+ assert(t.getReturnDescription().getValidRegionList().size() == 1);
+
+ assert(t.getValidFrom() != null);
+ assert(t.getValidUntil() != null);
+
+ assert(t.getActivatedDays() != null);
+ assert(t.getActivatedDays().size() == 2);
+
+ assert(t.getClassCode().equals(ITravelClassType.first));
+ assert(t.getServiceLevel().equals("A"));
+
+ assert(t.getIncludedCarriers() != null);
+ assert(t.getIncludedCarriers().size() == 2);
+ assert(t.getIncludedCarriers().contains("1080"));
+ assert(t.getIncludedCarriers().contains("1181"));
+
+
+ assert(t.getIncludedServiceBrands() != null);
+ assert(t.getIncludedServiceBrands().size() == 2);
+ Iterator<Integer> i4 = t.getIncludedServiceBrands().iterator();
+ assert(i4.next() == 108);
+ assert(i4.next() == 118);
+
+ assert(t.getExcludedServiceBrands() != null);
+ assert(t.getExcludedServiceBrands().size() == 2);
+ i4 = t.getExcludedServiceBrands().iterator();
+ assert(i4.next() == 108);
+ assert(i4.next() == 118);
+
+
+ assert(t.getTariffs() != null);
+ assert(t.getTariffs().size() == 1);
+
+ assert (t.getPrice() == 12345);
+ assert (t.getVatDetails() != null);
+ assert (t.getVatDetails().size() == 1);
+
+ assert (t.getInfoText().equals("openTicketInfo"));
+
+ assert (t.getIncludedAddOns() != null);
+ assert (t.getIncludedAddOns().size() == 1);
+ validate(t.getIncludedAddOns().iterator().next());
+
+ assert(t.getLuggageRestriction() != null);
+
+
+ assert(t.getExtension() != null);
+
+ }
+
+ private void validateRegion(ITrainLink t) {
+
+ assert (t != null);
+
+ assert(t.getTrain().equals("12345"));
+ assert(t.getDepartureDateTime() != null);
+ assert(t.getFromStation().equals("8100001"));
+
+ assert(t.getToStation().equals( "8100002"));
+ assert(t.getFromStationName().equals( "A-STATION"));
+ assert(t.getToStationName().equals( "B-STATION"));
+
+ }
+
+ private void validateRegion(IPolygone p) {
+
+ assert(p.getEdges() != null);
+ assert(p.getEdges().size() == 3);
+
+ }
+
+ private void validateRegion(IZone z) {
+
+ assert(z != null);
+
+ assert(z.getCarrier().equals("1080"));
+ assert(z.getStationCodeTable().equals(IStationCodeTable.stationERA));
+ assert(z.getEntryStation().equals( "1234"));
+ assert(z.getTerminatingStation().equals( "2345"));
+ assert(z.getCity() == 123456);
+ assert(z.getZoneIds() != null);
+ assert(z.getZoneIds().size() == 2);
+ Iterator<Integer> iz = z.getZoneIds().iterator();
+ assert(iz.next() == 100);
+ assert(iz.next() == 200);
+
+ assert(UperEncoder.hexStringFromBytes(z.getBinaryZoneId()).equals("82DA"));
+ assert(z.getNUTScode().equals("DE4711"));
+
+ }
+
+ private void validateRegion(ILine z) {
+
+
+ assert(z.getCarrier().equals("1080"));
+ assert(z.getStationCodeTable().equals(IStationCodeTable.stationERA));
+
+ assert(z.getEntryStation().equals( "1234"));
+
+ assert(z.getTerminatingStation().equals( "2345"));
+ assert(z.getCity() == 123456);
+ assert(z.getLineIds() != null);
+ assert(z.getLineIds().size() == 2);
+ Iterator<Integer> iz = z.getLineIds().iterator();
+ assert(iz.next() == 100);
+ assert(iz.next() == 200);
+
+
+ }
+
+ private void validateRegion(IViaStation t) {
+
+ assert( t != null);
+
+ assert(t.getRoute() != null);
+
+ assert(t.getRoute().size() == 4);
+
+ Iterator<IViaStation> iv = t.getRoute().iterator();
+ IViaStation v1 = iv.next();
+ IViaStation v2 = iv.next();
+ IViaStation v3 = iv.next();
+ IViaStation v4 = iv.next();
+
+ assert(v1.getStation().equals("123455"));
+ assert(v1.isBorder() == false);
+
+ assert(v2.getStation().equals("123456"));
+ assert(v2.isBorder() == false);
+
+ assert(v3.getAlternativeRoutes() != null);
+ assert(v3.getAlternativeRoutes().size() == 2);
+ Iterator<IViaStation> ari = v3.getAlternativeRoutes().iterator();
+ IViaStation ar1 = ari.next();
+ IViaStation ar2 = ari.next();
+ assert(ar1.getRoute().size() == 2);
+ assert(ar1.getRoute().iterator().next().getStation().equals("23455"));
+ assert(ar2.getRoute() != null);
+ assert(ar2.getRoute().size() == 2);
+ assert(ar2.getRoute().iterator().next().getStation().equals("3455"));
+
+ assert(v4.getStation().equals("123457"));
+
+ assert(t.isBorder() == false);
+
+ assert(t.getSeriesId() == 999);
+ assert(t.getRouteId() == 21);
+
+
+ }
+
+ private void validate(IIncludedOpenTicket d1) {
+
+ assert(d1.getProductOwner().equals("23456"));
+ assert(d1.getProductId().equals("23456"));
+ assert(d1.getExternalIssuer() == 12);
+ assert(d1.getAuthorizationCode() == 13);
+ assert(d1.getStationCodeTable().equals(IStationCodeTable.stationERA));
+ assert(d1.getValidRegionList() != null);
+ assert(d1.getValidRegionList().size() == 1);
+ assert(d1.getValidFrom() != null);
+ assert(d1.getValidUntil() != null);
+ assert(d1.getClassCode().equals(ITravelClassType.second));
+ assert(d1.getServiceLevel().equals("A"));
+
+ assert(d1.getIncludedCarriers() != null);
+ assert(d1.getIncludedCarriers().size() == 2);
+ assert(d1.getIncludedCarriers().contains("1080"));
+ assert(d1.getIncludedCarriers().contains("1181"));
+
+ assert(d1.getIncludedServiceBrands() != null);
+ assert(d1.getIncludedServiceBrands().size() == 2);
+ assert(d1.getIncludedServiceBrands().contains(108));
+ assert(d1.getIncludedServiceBrands().contains(118));
+
+
+ assert(d1.getExcludedServiceBrands() != null);
+ assert(d1.getExcludedServiceBrands().size() == 2);
+ assert(d1.getExcludedServiceBrands().contains(108));
+ assert(d1.getExcludedServiceBrands().contains(118));
+
+
+ assert(d1.getTariffs() != null);
+ assert(d1.getTariffs().size() == 1);
+
+ assert(d1.getInfoText().equals("included ticket"));
+
+ assert(d1.getExtension() != null);
+
+
+
+ }
+
+ private void validate(IPass p) {
+
+
+ assert(p.getReference().equals("810123456789"));
+ assert(p.getProductOwner().equals( "23456"));
+ assert(p.getProductId().equals( "23456"));
+ assert(p.getPassType() == 2);
+ assert(p.getPassDescription().equals( "Eurail FlexPass"));
+ assert(p.getClassCode().equals(ITravelClassType.first));
+ assert(p.getValidFrom() != null);
+ assert(p.getValidUntil() != null);
+ assert(p.getValidityDetails() != null);
+
+ assert(p.getValidityDetails() != null);
+ assert(p.getValidityDetails().getValidityRanges().size() == 1);
+ IValidityRange vr = p.getValidityDetails().getValidityRanges().iterator().next();
+ assert(vr.getFromDate() != null);
+ assert(vr.getUntilDate() != null);
+
+ assert(p.getValidityDetails().getTimeRanges() != null);
+ ITimeRange tr = p.getValidityDetails().getTimeRanges().iterator().next();
+ assert(tr.getFromTime() == 6);
+ assert(tr.getUntilTime() == 9);
+
+ assert(p.getNumberOfValidityDays() == 5);
+
+ assert(p.getNumberOfPossibleTrips() == 3);
+ assert(p.getNumberOfDaysOfTravel() == 10);
+ assert(p.getActivatedDays() != null);
+ assert(p.getActivatedDays().size() == 2);
+
+
+ assert(p.getCountries() != null);
+ assert(p.getCountries().size() == 2);
+ Iterator<Integer> i6 = p.getCountries().iterator();
+ assert(i6.next() == 10);
+ assert(i6.next() == 20);
+
+ assert(p.getIncludedCarriers() != null);
+ assert(p.getIncludedCarriers().size() == 2);
+ assert(p.getIncludedCarriers().contains("1080"));
+ assert(p.getIncludedCarriers().contains("1181"));
+
+ assert(p.getIncludedServiceBrands() != null);
+ assert(p.getIncludedServiceBrands().size() == 2);
+ assert(p.getIncludedServiceBrands().contains(108));
+ assert(p.getIncludedServiceBrands().contains(118));
+
+
+ assert(p.getExcludedServiceBrands() != null);
+ assert(p.getExcludedServiceBrands().size() == 2);
+ assert(p.getExcludedServiceBrands().contains(108));
+ assert(p.getExcludedServiceBrands().contains(118));
+
+
+
+ assert(p.getExcludedCarriers() != null);
+ assert(p.getExcludedCarriers().size() == 2);
+ assert(p.getExcludedCarriers().contains("1080"));
+ assert(p.getExcludedCarriers().contains("1181"));
+
+
+
+
+
+ assert(p.getValidRegionList() != null);
+ assert(p.getValidRegionList().size() == 1);
+ assert(p.getTariffs() != null);
+ assert(p.getTariffs().size() == 1);
+ assert(p.getPrice() == 10000);
+ assert(p.getVatDetails() != null);
+ assert(p.getVatDetails().size() == 1);
+ assert(p.getInfoText().equals("pass info"));
+ assert (p.getExtension() != null);
+
+
+ }
+
+ private void validate(IReservation r) {
+
+ assert(r.getTrain().equals("12345"));
+ assert(r.getDepartureDate() != null);
+ assert(r.getReference().equals("810123456789"));
+ assert(r.getProductOwner().equals("23456"));
+
+ assert(r.getProductId().equals("23456"));
+ assert(r.getServiceBrand().getServiceBrand() == 12);
+ assert(r.getServiceBrand().getServiceBrandAbbreviation().equals("TGV"));
+ assert(r.getServiceBrand().getServiceBrandDescription().equals("Lyria"));
+ assert(r.getService().equals(IServiceType.couchette));
+
+ assert(r.getStationCodeTable().equals(IStationCodeTable.stationUIC));
+ assert(r.getFromStation().equals("8100001"));
+ assert(r.getToStation().equals( "8100002"));
+ assert(r.getFromStationName().equals( "A-STATION"));
+ assert(r.getToStationName().equals( "B-STATION"));
+ assert(r.getDepartureDate() != null);
+ assert(r.getArrivalDate() != null);
+ assert(r.getCarriers()!= null);
+ assert(r.getCarriers().size() == 2);
+ Iterator<String> i8 = r.getCarriers().iterator();
+ assert(i8.next().equals("1080"));
+ assert(i8.next().equals("1181"));
+
+
+ assert(r.getClassCode().equals(ITravelClassType.first));
+ assert(r.getServiceLevel().equals("A"));
+
+ assert(r.getPlaces() != null);
+ assert(r.getPlaces().getCoach().equals("31A"));
+ assert(r.getPlaces().getPlaceString().equals("31-47"));
+ assert(r.getPlaces().getPlaceDescription().equals("Window"));
+ assert(r.getPlaces().getPlaces() != null);
+ assert(r.getPlaces().getPlaces().size() == 4);
+ Iterator<String> is = r.getPlaces().getPlaces().iterator();
+ assert(is.next().equals("31"));
+ assert(is.next().equals("32"));
+
+
+ assert(r.getAdditionalPlaces() != null);
+ assert(r.getBicyclePlaces() != null);
+
+
+ assert(r.getCompartmentDetails() != null);
+ assert(r.getCompartmentDetails().getCoachType() == 1);
+ assert(r.getCompartmentDetails().getCompartmentType() == 99);
+ assert(r.getCompartmentDetails().getSpecialAllocation() == 50);
+ assert(r.getCompartmentDetails().getCoachTypeDescr().equals("xwz"));
+ assert(r.getCompartmentDetails().getCompartmentTypeDescr().equals( "xwz"));
+ assert(r.getCompartmentDetails().getSpecialAllocationDescr().equals( "xwz"));
+ assert(r.getCompartmentDetails().getPosition().equals(ICompartmentPositionType.upperLevel));
+
+ assert(r.getNumberOfOverbooked() == 200);
+ assert(r.getBerths() != null);
+ assert(r.getBerths().size() == 1);
+ IBerth b = r.getBerths().iterator().next();
+
+ assert(b.getType().equals(IBerthTypeType.single));
+ assert(b.getGender().equals(ICompartmentGenderType.female));
+ assert(b.getNumberOfBerths() == 999);
+
+
+ assert(r.getTariffs() != null);
+ assert(r.getTariffs().size() == 1);
+ ITariff t = r.getTariffs().iterator().next();
+ assert(t.getNumberOfPassengers() == 1);
+
+
+ assert(t.getPassengerType().equals(IPassengerType.senior) );
+ assert(t.getAgeBelow() == 40);
+ assert(t.getAgeAbove() == 60);
+ assert(t.getTravelerIds() != null);
+ assert(t.getTravelerIds().size() == 1);
+ assert(t.getTravelerIds().iterator().next() == 1);
+
+ assert(t.isRestrictedToCountryOfResidence() == false);
+ assert(t.getRestrictedToRouteSection() != null);
+ assert(t.getRestrictedToRouteSection().getStationCodeTable().equals(IStationCodeTable.stationERA));
+ assert(t.getRestrictedToRouteSection().getFromStation().equals( "123"));
+ assert(t.getRestrictedToRouteSection().getToStation().equals( "234"));
+ assert(t.getRestrictedToRouteSection().getFromStationName().equals( "A"));
+ assert(t.getRestrictedToRouteSection().getToStationName().equals( "B"));
+
+ assert(t.getSeriesDataDetails() != null);
+ assert(t.getSeriesDataDetails().getSupplyingCarrier() == 2345);
+ assert(t.getSeriesDataDetails().getOfferIdentification() == 99);
+ assert(t.getSeriesDataDetails().getSeries() == 23456);
+
+
+ assert(t.getTariffId().equals( "72"));
+ assert(t.getTariffDescription().equals( "Leasure Fare"));
+ assert(t.getReductionCards() != null);
+ assert(t.getReductionCards().size() == 1);
+ ICardReference rc = t.getReductionCards().iterator().next();
+
+ assert(rc.getCardIssuer().equals( "1234"));
+ assert(rc.getCardId().equals( "5678"));
+ assert(rc.getCardName().equals( "testcard"));
+ assert(rc.getCardType() == 123);
+ assert(rc.getLeadingCardId().equals("3456"));
+ assert(rc.getTrailingCardId().equals("100"));
+
+
+ assert(r.getPriceType().equals(IPriceTypeType.travelPrice));
+ assert(r.getPrice() == 12345);
+ assert(r.getVatDetails() != null);
+ IVatDetail v = r.getVatDetails().iterator().next();
+ assert(r.getVatDetails().size() == 1);
+ assert(v.getCountry() == 80);
+ assert(v.getPercentage() == 70);
+ assert(v.getAmount() == 10);
+ assert(v.getVatId().equals("IUDGTE"));
+
+ assert(r.getTypeOfSupplement() == 9);
+ assert(r.getNumberOfSupplements() == 2);
+ assert(r.getLuggageRestriction() != null);
+
+ assert(r.getLuggageRestriction().getMaxHandLuggagePieces() == 2);
+ assert(r.getLuggageRestriction().getMaxNonHandLuggagePieces() == 1);
+ assert(r.getLuggageRestriction().getRegisteredLuggage() != null);
+ assert(r.getLuggageRestriction().getRegisteredLuggage().size() == 2);
+
+
+ Iterator<IRegisteredLuggage> il = r.getLuggageRestriction().getRegisteredLuggage().iterator();
+ IRegisteredLuggage rl1 = null;
+ IRegisteredLuggage rl2 = null;
+ while (il.hasNext()) {
+ IRegisteredLuggage l = il.next();
+ if (l.getRegistrationId().equals("IODHUV")) {
+ rl1 = l;
+ } else {
+ rl2 = l;
+ }
+ }
+ assert(rl1.getRegistrationId().equals("IODHUV"));
+ assert(rl1.getMaxWeight() == 20);
+ assert(rl1.getMaxSize() == 100);
+ assert(rl2.getRegistrationId().equals("XXDHUV"));
+ assert(rl2.getMaxWeight() == 21);
+ assert(rl2.getMaxSize() == 101);
+ assert(r.getInfoText().equals("reservation"));
+ assert(r.getExtension() != null);
+
+ }
+
+
+ private void validate(ICarCarriageReservation r) {
+
+
+ assert(r.getToken() != null);
+ assert(UperEncoder.hexStringFromBytes(r.getToken().getToken()).equals("82DA"));
+ assert(r.getToken().getTokenProvider().equals("VDV"));
+ assert(r.getToken().getTokenSpecification().equals("TEST"));
+
+
+ assert(r.getTrain().equals("123"));
+ assert(r.getReference().equals("810123456789"));
+ assert(r.getProductOwner().equals("23456"));
+ assert(r.getProductId().equals("23456"));
+ assert(r.getServiceBrand().getServiceBrand() == 100);
+ assert(r.getServiceBrand().getServiceBrandAbbreviation().equals("AZ"));
+ assert(r.getServiceBrand().getServiceBrandDescription().equals("special train"));
+
+ assert(r.getBeginLoading() != null);
+ assert(r.getEndLoading() != null);
+
+ assert(r.getStationCodeTable().equals(IStationCodeTable.stationERA));
+ assert(r.getFromStation().equals("8100001"));
+ assert(r.getToStation().equals( "8100002"));
+ assert(r.getFromStationName().equals( "A-STATION"));
+ assert(r.getToStationName().equals( "B-STATION"));
+
+ assert(r.getCoach().equals("21"));
+ assert(r.getPlace().equals("41"));
+ assert(r.getCompartmentDetails() != null);
+
+ assert(r.getCompartmentDetails().getCoachType() == 1L);
+ assert(r.getCompartmentDetails().getCompartmentType() == 99L);
+ assert(r.getCompartmentDetails().getSpecialAllocation() == 50L);
+ assert(r.getCompartmentDetails().getCoachTypeDescr().equals("xwz"));
+ assert(r.getCompartmentDetails().getCompartmentTypeDescr().equals("xwz"));
+ assert(r.getCompartmentDetails().getSpecialAllocationDescr().equals("xwz"));
+ assert(r.getCompartmentDetails().getPosition().equals(ICompartmentPositionType.upperLevel));
+
+ assert(r.getNumberPlate().equals( "AD-DE-123"));
+ assert(r.getTrailerPlate().equals( "DX-AB-123"));
+ assert(r.getCarCategory() == 3L);
+ assert(r.getBoatCategory() == 5L);
+ assert(r.isTextileRoof() == false);
+ assert(r.getRoofRackType().equals(IRoofRackType.bicycleRack));
+ assert(r.getRoofRackHeight() == 20L);
+ assert(r.getAttachedBoats() == 2L);
+ assert(r.getAttachedBicycles() == 1L);
+ assert(r.getAttachedSurfboards() == 2L);
+ assert(r.getLoadingListEntry() == 421L);
+ assert(r.getLoadingDeck().equals(ILoadingDeckType.upper));
+
+ assert(r.getCarriers()!= null);
+ assert(r.getCarriers().size() == 2);
+ Iterator<String> i9 = r.getCarriers().iterator();
+ assert(i9.next().equals("1080"));
+ assert(i9.next().equals("1181"));
+
+ assert(r.getTariff() != null);
+ assert(r.getPriceType().equals(IPriceTypeType.travelPrice));
+ assert(r.getPrice() == 12345L);
+
+ assert(r.getVatDetails() != null);
+
+ assert(r.getInfoText().equals("car carriage"));
+ assert(r.getExtension() != null);
+
+ }
+
+ public static int getIndexOfDifference(String s1, String s2) {
+
+ if (s1 == null || s2 == null) return -1;
+
+ char[] ca1 = null;
+ char[] ca2 = null;
+
+ if (s1.length() > s2.length()) {
+ ca1 = s1.toCharArray();
+ ca2 = s2.toCharArray();
+ } else {
+ ca1 = s2.toCharArray();
+ ca2 = s1.toCharArray();
+ }
+
+ int i = 0;
+ for (char c : ca2) {
+ if (c != ca1[i]) return i;
+ i++;
+ }
+ return 0;
+ }
+
+
+
+}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java
index 5f44950..8965ae2 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java
@@ -1,6 +1,5 @@
package org.uic.barcode.ticket.api.test;
-import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV3.java
index f9d4f43..f11c418 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV3.java
@@ -1,6 +1,5 @@
package org.uic.barcode.ticket.api.test;
-import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/DelayConfirmationTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/DelayConfirmationTestV3.java
index 81f8f9e..9630d25 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/DelayConfirmationTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/DelayConfirmationTestV3.java
@@ -1,6 +1,5 @@
package org.uic.barcode.ticket.api.test;
-import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV1.java
index d471eff..eb13902 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV1.java
@@ -1,6 +1,5 @@
package org.uic.barcode.ticket.api.test;
-import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV3.java
index ed54b72..b39e969 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV3.java
@@ -1,6 +1,5 @@
package org.uic.barcode.ticket.api.test;
-import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV1.java
index af5eb71..630a957 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV1.java
@@ -1,6 +1,5 @@
package org.uic.barcode.ticket.api.test;
-import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV3.java
index 5752c46..c1e3292 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV3.java
@@ -1,6 +1,5 @@
package org.uic.barcode.ticket.api.test;
-import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV1.java
index 2ac8da6..89d3de8 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV1.java
@@ -1,6 +1,5 @@
package org.uic.barcode.ticket.api.test;
-import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV3.java
index cc06303..c095185 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV3.java
@@ -1,6 +1,5 @@
package org.uic.barcode.ticket.api.test;
-import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV1.java
index d9c7d61..9ef0cd9 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV1.java
@@ -1,6 +1,5 @@
package org.uic.barcode.ticket.api.test;
-import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV3.java
index a838f3f..c2a66f4 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV3.java
@@ -1,6 +1,5 @@
package org.uic.barcode.ticket.api.test;
-import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV1.java
index 3fb9460..a79a753 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV1.java
@@ -1,6 +1,5 @@
package org.uic.barcode.ticket.api.test;
-import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV3.java
index e46402a..014b172 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV3.java
@@ -1,6 +1,5 @@
package org.uic.barcode.ticket.api.test;
-import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV1.java
index ac899eb..e6c100a 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV1.java
@@ -1,6 +1,5 @@
package org.uic.barcode.ticket.api.test;
-import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/AllElementsTestTicketV2.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/AllElementsTestTicketV2.java
new file mode 100644
index 0000000..0597746
--- /dev/null
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/AllElementsTestTicketV2.java
@@ -0,0 +1,1410 @@
+package org.uic.barcode.ticket.api.test.testtickets;
+
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfUnrestrictedLong;
+import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfDeltaCoordinates;
+import org.uic.barcode.ticket.api.asn.omv2.TravelerType;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfRegionalValidityType;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfRegisteredLuggageType;
+import org.uic.barcode.ticket.api.asn.omv2.DeltaCoordinates;
+import org.uic.barcode.ticket.api.asn.omv2.BerthDetailData;
+import org.uic.barcode.ticket.api.asn.omv2.BerthTypeType;
+import org.uic.barcode.ticket.api.asn.omv2.CarCarriageReservationData;
+import org.uic.barcode.ticket.api.asn.omv2.CardReferenceType;
+import org.uic.barcode.ticket.api.asn.omv2.CodeTableType;
+import org.uic.barcode.ticket.api.asn.omv2.CompartmentDetailsType;
+import org.uic.barcode.ticket.api.asn.omv2.CompartmentGenderType;
+import org.uic.barcode.ticket.api.asn.omv2.CompartmentPositionType;
+import org.uic.barcode.ticket.api.asn.omv2.ConfirmationTypeType;
+import org.uic.barcode.ticket.api.asn.omv2.ControlData;
+import org.uic.barcode.ticket.api.asn.omv2.CountermarkData;
+import org.uic.barcode.ticket.api.asn.omv2.CustomerCardData;
+import org.uic.barcode.ticket.api.asn.omv2.CustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv2.DelayConfirmation;
+import org.uic.barcode.ticket.api.asn.omv2.DocumentData;
+import org.uic.barcode.ticket.api.asn.omv2.ExtensionData;
+import org.uic.barcode.ticket.api.asn.omv2.FIPTicketData;
+import org.uic.barcode.ticket.api.asn.omv2.GenderType;
+import org.uic.barcode.ticket.api.asn.omv2.GeoCoordinateSystemType;
+import org.uic.barcode.ticket.api.asn.omv2.GeoCoordinateType;
+import org.uic.barcode.ticket.api.asn.omv2.GeoUnitType;
+import org.uic.barcode.ticket.api.asn.omv2.HemisphereLatitudeType;
+import org.uic.barcode.ticket.api.asn.omv2.HemisphereLongitudeType;
+import org.uic.barcode.ticket.api.asn.omv2.IncludedOpenTicketType;
+import org.uic.barcode.ticket.api.asn.omv2.IssuingData;
+import org.uic.barcode.ticket.api.asn.omv2.LineType;
+import org.uic.barcode.ticket.api.asn.omv2.LinkMode;
+import org.uic.barcode.ticket.api.asn.omv2.LoadingDeckType;
+import org.uic.barcode.ticket.api.asn.omv2.LuggageRestrictionType;
+import org.uic.barcode.ticket.api.asn.omv2.OpenTicketData;
+import org.uic.barcode.ticket.api.asn.omv2.ParkingGroundData;
+import org.uic.barcode.ticket.api.asn.omv2.PassData;
+import org.uic.barcode.ticket.api.asn.omv2.PassengerType;
+import org.uic.barcode.ticket.api.asn.omv2.PlacesType;
+import org.uic.barcode.ticket.api.asn.omv2.PolygoneType;
+import org.uic.barcode.ticket.api.asn.omv2.PriceTypeType;
+import org.uic.barcode.ticket.api.asn.omv2.RegionalValidityType;
+import org.uic.barcode.ticket.api.asn.omv2.RegisteredLuggageType;
+import org.uic.barcode.ticket.api.asn.omv2.ReservationData;
+import org.uic.barcode.ticket.api.asn.omv2.ReturnRouteDescriptionType;
+import org.uic.barcode.ticket.api.asn.omv2.RoofRackType;
+import org.uic.barcode.ticket.api.asn.omv2.RouteSectionType;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfActivatedDays;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfBerthDetailData;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCardReferenceType;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCarrierNum;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCountries;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfDocumentData;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfExtensionData;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfIncludedOpenTicketType;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfPlaceNum;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfServiceBrands;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTariffType;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTicketLinkType;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTimeRangeType;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTravelerId;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTravelerType;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfValidityPeriodType;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfVatDetail;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfViaStationType;
+import org.uic.barcode.ticket.api.asn.omv2.SeriesDetailType;
+import org.uic.barcode.ticket.api.asn.omv2.ServiceType;
+import org.uic.barcode.ticket.api.asn.omv2.StationPassageData;
+import org.uic.barcode.ticket.api.asn.omv2.TariffType;
+import org.uic.barcode.ticket.api.asn.omv2.TicketDetailData;
+import org.uic.barcode.ticket.api.asn.omv2.TicketLinkType;
+import org.uic.barcode.ticket.api.asn.omv2.TicketType;
+import org.uic.barcode.ticket.api.asn.omv2.TimeRangeType;
+import org.uic.barcode.ticket.api.asn.omv2.TokenType;
+import org.uic.barcode.ticket.api.asn.omv2.TrainLinkType;
+import org.uic.barcode.ticket.api.asn.omv2.TravelClassType;
+import org.uic.barcode.ticket.api.asn.omv2.TravelerData;
+import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData;
+import org.uic.barcode.ticket.api.asn.omv2.ValidityPeriodDetailType;
+import org.uic.barcode.ticket.api.asn.omv2.ValidityPeriodType;
+import org.uic.barcode.ticket.api.asn.omv2.VatDetailType;
+import org.uic.barcode.ticket.api.asn.omv2.ViaStationType;
+import org.uic.barcode.ticket.api.asn.omv2.VoucherData;
+import org.uic.barcode.ticket.api.asn.omv2.ZoneType;
+
+public class AllElementsTestTicketV2 {
+
+
+
+
+
+
+
+ public static UicRailTicketData getUicTestTicket() {
+ UicRailTicketData ticket = new UicRailTicketData();
+ populateTicket(ticket);
+ return ticket;
+ }
+
+
+ private static void populateTicket(UicRailTicketData ticket) {
+
+ ticket.setControlDetail(new ControlData());
+ populateControlDetail(ticket.getControlDetail());
+
+ ticket.setExtension(new SequenceOfExtensionData());
+ populateExtension(ticket.getExtension());
+
+ ticket.setIssuingDetail(new IssuingData());
+ populateIssuingData(ticket.getIssuingDetail());
+
+ ticket.setTravelerDetail(new TravelerData());
+ populateTravelerData(ticket.getTravelerDetail());
+
+ ticket.setTransportDocument(new SequenceOfDocumentData());
+
+ DocumentData d1 = new DocumentData();
+ populateReservation(d1);
+ ticket.getTransportDocument().add(d1);
+
+ DocumentData d2 = new DocumentData();
+ populateCarCarriage(d2);
+ ticket.getTransportDocument().add(d2);
+
+ DocumentData d3 = new DocumentData();
+ populateOpenTicket(d3);
+ ticket.getTransportDocument().add(d3);
+
+ DocumentData d4 = new DocumentData();
+ populatePass(d4);
+ ticket.getTransportDocument().add(d4);
+
+ DocumentData d5 = new DocumentData();
+ populateVoucher(d5);
+ ticket.getTransportDocument().add(d5);
+
+ DocumentData d6 = new DocumentData();
+ populateCustomerCard(d6);
+ ticket.getTransportDocument().add(d6);
+
+ DocumentData d7 = new DocumentData();
+ populateCounterMark(d7);
+ ticket.getTransportDocument().add(d7);
+
+ DocumentData d8 = new DocumentData();
+ populateParking(d8);
+ ticket.getTransportDocument().add(d8);
+
+ DocumentData d9 = new DocumentData();
+ populateFip(d9);
+ ticket.getTransportDocument().add(d9);
+
+ DocumentData d10 = new DocumentData();
+ populateStationPassage(d10);
+ ticket.getTransportDocument().add(d10);
+
+ DocumentData d11 = new DocumentData();
+ populateExtensionDocument(d11);
+ ticket.getTransportDocument().add(d11);
+
+ DocumentData d12 = new DocumentData();
+ populateDelay(d12);
+ ticket.getTransportDocument().add(d12);
+
+ }
+
+ private static void populateDelay(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ DelayConfirmation dc = new DelayConfirmation();
+ d.getTicket().setDelayConfirmation(dc);
+
+ dc.setTrainNum(Asn1BigInteger.toAsn1(100L));
+ dc.setTrainIA5("100");
+ dc.setPlannedArrivalYear(2022L);
+ dc.setPlannedArrivalDay(12L);
+ dc.setPlannedArrivalTime(1000L);
+ dc.setDepartureUTCOffset(30L);
+ dc.setReferenceIA5("ABDJ12345");
+ dc.setReferenceNum(12345L);
+
+ dc.setStationCodeTable(CodeTableType.stationUIC);
+ dc.setStationNum(8000001L);
+ dc.setStationIA5("DJE");
+ dc.setDelay(31L);
+ dc.setTrainCancelled(false);
+ dc.setConfirmationType(ConfirmationTypeType.travelerDelayConfirmation);
+
+ dc.setAffectedTickets(new SequenceOfTicketLinkType());
+ TicketLinkType tl = new TicketLinkType();
+ dc.getAffectedTickets().add(tl);
+
+ tl.setReferenceIA5("KDJET");
+ tl.setReferenceNum(801234567890L);
+ tl.setIssuerName("XYZ");
+ tl.setIssuerPNR("LDWDUR45");
+ tl.setProductOwnerNum(1080L);
+ tl.setProductOwnerIA5("IEFHU");
+ tl.setTicketType(TicketType.openTicket);
+ tl.setLinkMode(LinkMode.issuedTogether);
+
+ dc.setInfoText("delay confirmation");
+ dc.setExtension(new ExtensionData());
+ dc.getExtension().setExtensionId("1");
+ dc.getExtension().setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+
+ }
+
+
+ private static void populateExtensionDocument(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ d.getTicket().setExtension(new ExtensionData());
+ d.getTicket().getExtension().setExtensionId("1");
+ d.getTicket().getExtension().setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+
+ }
+
+
+ private static void populateStationPassage(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ StationPassageData s = new StationPassageData();
+ d.getTicket().setStationPassage(s);
+
+ s.setExtension(new ExtensionData());
+ s.getExtension().setExtensionId("1");
+ s.getExtension().setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+
+ s.setReferenceIA5("810123456789");
+ s.setReferenceNum(Asn1BigInteger.toAsn1(810123456789L));
+ s.setProductOwnerNum(23456L);
+ s.setProductOwnerIA5("23456");
+ s.setProductIdNum(15535L);
+ s.setProductIdIA5("23456");
+
+ s.setProductName("passage");
+ s.setStationCodeTable(CodeTableType.stationUIC);
+ s.setStationNum(new SequenceOfUnrestrictedLong());
+ s.getStationNum().add(8200001L);
+ s.setStationIA5(new SequenceOfStringIA5());
+ s.getStationIA5().add("AMS");
+ s.setStationNameUTF8(new SequenceOfStringUTF8());
+ s.getStationNameUTF8().add("Amsterdam");
+ s.setAreaCodeNum(new SequenceOfUnrestrictedLong());
+ s.getAreaCodeNum().add(8200001L);
+ s.setAreaCodeIA5(new SequenceOfStringIA5());
+ s.getAreaCodeIA5().add("AMS");
+ s.setAreaNameUTF8(new SequenceOfStringUTF8());
+ s.getAreaNameUTF8().add("Amsterdam");
+ s.setValidFromDay(5L);
+ s.setValidFromTime(0L);
+ s.setValidFromUTCOffset(1L);
+ s.setValidUntilDay(5L);
+ s.setValidUntilTime(1000L);
+ s.setValidUntilUTCOffset(1L);
+ s.setNumberOfDaysValid(5L);
+
+ }
+
+
+ private static void populateFip(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ FIPTicketData f = new FIPTicketData();
+ d.getTicket().setFipTicket(f);
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ f.setExtension(e1);
+
+ f.setReferenceIA5("810123456789");
+ f.setReferenceNum(Asn1BigInteger.toAsn1(810123456789L));
+ f.setProductOwnerNum(23456L);
+ f.setProductOwnerIA5("23456");
+ f.setProductIdNum(15535L);
+ f.setProductIdIA5("23456");
+
+
+ f.setValidFromDay( 2L);
+ f.setValidUntilDay(5L);
+ f.setActivatedDay(new SequenceOfActivatedDays());
+ f.getActivatedDay().add(1L);
+ f.getActivatedDay().add(13L);
+ f.getActivatedDay().add(14L);
+ f.getActivatedDay().add(15L);
+
+ f.setCarrierNum(new SequenceOfCarrierNum());
+ f.getCarrierNum().add(1080L);
+ f.getCarrierNum().add(1181L);
+
+ f.setCarrierIA5(new SequenceOfStringIA5());
+ f.getCarrierIA5().add("1080");
+ f.getCarrierIA5().add("1181");
+
+ f.setNumberOfTravelDays(8L);
+ f.setIncludesSupplements(true);
+ f.setClassCode(TravelClassType.first);
+
+ }
+
+
+ private static void populateParking(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ ParkingGroundData p = new ParkingGroundData();
+ d.getTicket().setParkingGround(p);
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ p.setExtension(e1);
+
+
+ p.setReferenceIA5("810123456789");
+ p.setReferenceNum(Asn1BigInteger.toAsn1(810123456789L));
+ p.setProductOwnerNum(23456L);
+ p.setProductOwnerIA5("23456");
+ p.setProductIdNum(15535L);
+ p.setProductIdIA5("23456");
+
+ p.setParkingGroundId("IA5");
+ p.setFromParkingDate(370L);
+ p.setToParkingDate(370L);
+
+ p.setAccessCode("4ga");
+ p.setLocation("Parking Frankfurt Main West");
+ p.setStationCodeTable(CodeTableType.stationUIC);
+ p.setStationNum(8000001L);
+ p.setStationIA5("8000001");
+ p.setSpecialInformation("outdoor parking");
+ p.setEntryTrack("left");
+ p.setNumberPlate("AA-DE-12345");
+ p.setPrice(500L);
+ p.setVatDetails(new SequenceOfVatDetail());
+ VatDetailType v = new VatDetailType();
+ p.getVatDetails().add(v);
+ v.setAmount(10L);
+ v.setCountry(80L);
+ v.setPercentage(70L);
+ v.setVatId("IUDGTE");
+
+ }
+
+
+ private static void populateCounterMark(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ CountermarkData t = new CountermarkData();
+ d.getTicket().setCounterMark(t);
+
+ t.setTicketReferenceIA5("810123456789");
+ t.setTicketReferenceNum(810123456789L);
+ t.setNumberOfCountermark(12L);
+ t.setTotalOfCountermarks(24L);
+ t.setGroupName("groupName");
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ t.setExtension(e1);
+
+ t.setReferenceIA5("810123456789");
+ t.setReferenceNum(810123456789L);
+ t.setProductOwnerNum( 23456L);
+ t.setProductOwnerIA5("23456");
+ t.setProductIdNum( 15535L);
+ t.setProductIdIA5("23456");
+
+ t.setReturnIncluded( false);
+
+ t.setStationCodeTable(CodeTableType.stationERA);
+ t.setFromStationNum( 8100001L);
+ t.setFromStationIA5("8100001");
+ t.setToStationNum( 8000002L);
+ t.setToStationIA5( "8100002");
+ t.setFromStationNameUTF8( "A-STATION");
+ t.setToStationNameUTF8( "B-STATION");
+
+ t.setValidRegionDesc("From A to B via C");
+
+ t.setValidRegion(new SequenceOfRegionalValidityType());
+ t.getValidRegion().add(new RegionalValidityType());
+ t.getValidRegion().get(0).setViaStations(new ViaStationType());
+ populateCounterMarkRoute(t.getValidRegion().get(0).getViaStations());
+
+ t.setReturnDescription(new ReturnRouteDescriptionType());
+ t.getReturnDescription().setFromStationNum( 8100001L);
+ t.getReturnDescription().setFromStationIA5("8100001");
+ t.getReturnDescription().setToStationNum( 8000002L);
+ t.getReturnDescription().setToStationIA5( "8100002");
+ t.getReturnDescription().setFromStationNameUTF8( "A-STATION");
+ t.getReturnDescription().setToStationNameUTF8( "B-STATION");
+ t.getReturnDescription().setValidReturnRegionDesc( "return");
+ t.getReturnDescription().setValidReturnRegion(new SequenceOfRegionalValidityType());
+ t.getReturnDescription().getValidReturnRegion().add(new RegionalValidityType());
+
+ t.getReturnDescription().getValidReturnRegion().get(0).setZones(new ZoneType());
+ t.getReturnDescription().getValidReturnRegion().get(0).getZones().setZoneId(new SequenceOfUnrestrictedLong());
+ t.getReturnDescription().getValidReturnRegion().get(0).getZones().getZoneId().add(100L);
+ t.getReturnDescription().getValidReturnRegion().get(0).getZones().getZoneId().add(200L);
+ t.getReturnDescription().getValidReturnRegion().get(0).getZones().setCarrierNum(1080L);
+ t.getReturnDescription().getValidReturnRegion().get(0).getZones().setCarrierIA5("1181");
+ t.getReturnDescription().getValidReturnRegion().get(0).getZones().setStationCodeTable(CodeTableType.stationERA);
+
+ t.setValidFromDay( 700L);
+ t.setValidFromTime( 0L);
+ t.setValidFromUTCOffset( 60L);
+ t.setValidUntilDay( 370L);
+ t.setValidUntilTime( 1439L);
+ t.setValidUntilUTCOffset( 10L);
+
+ t.setClassCode(TravelClassType.first);
+
+ t.setCarriersNum(new SequenceOfCarrierNum());
+ t.getCarriersNum().add(1080L);
+ t.getCarriersNum().add(1181L);
+
+ t.setCarriersIA5(new SequenceOfStringIA5());
+ t.getCarriersIA5().add("1080");
+ t.getCarriersIA5().add("1181");
+
+ t.setIncludedServiceBrands(new SequenceOfServiceBrands());
+ t.getIncludedServiceBrands().add(108L);
+ t.getIncludedServiceBrands().add(118L);
+
+ t.setExcludedServiceBrands(new SequenceOfServiceBrands());
+ t.getExcludedServiceBrands().add(108L);
+ t.getExcludedServiceBrands().add(118L);
+
+
+ t.setInfoText("counterMark");
+
+ }
+
+
+ private static void populateCustomerCard(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ CustomerCardData c = new CustomerCardData();
+ d.getTicket().setCustomerCard(c);
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ c.setExtension(e1);
+
+ TravelerType t = new TravelerType();
+ c.setCustomer(t);
+ t.setCustomerIdIA5("1234");
+ t.setTicketHolder(false);
+ t.setPassengerType(PassengerType.senior);
+
+ c.setCardIdIA5("2345");
+ c.setCardIdNum(123456L);
+ c.setValidFromYear(2269L);
+ c.setValidFromDay(2L);
+ c.setValidUntilYear(1L);
+ c.setValidUntilDay(5L);
+ c.setClassCode(TravelClassType.second);
+ c.setCardType(15L);
+ c.setCardTypeDescr("RAILPLUS");
+ c.setCustomerStatus(1L);
+
+ c.setCustomerStatusDescr("gold");
+ c.setIncludedServices(new SequenceOfUnrestrictedLong());
+ c.getIncludedServices().add(1L);
+ c.getIncludedServices().add(2L);
+
+ }
+
+
+ private static void populateVoucher(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ VoucherData v = new VoucherData();
+ d.getTicket().setVoucher(v);
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ v.setExtension(e1);
+
+ v.setReferenceIA5("810123456789");
+ v.setReferenceNum(Asn1BigInteger.toAsn1(810123456789L));
+ v.setProductOwnerNum(23456L);
+ v.setProductOwnerIA5("COFFEEMACHINE");
+ v.setProductIdNum(15535L);
+ v.setProductIdIA5("23456");
+
+ v.setValidFromYear(2022L);
+ v.setValidFromDay(1L);
+ v.setValidUntilYear(2022L);
+ v.setValidUntilDay(1L);
+ v.setValue(500L);
+ v.setType(123L);
+ v.setInfoText("coffee voucher");
+ }
+
+
+ private static void populatePass(DocumentData d) {
+
+
+ d.setTicket(new TicketDetailData());
+ PassData p = new PassData();
+ d.getTicket().setPass(p);
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ p.setExtension(e1);
+
+ p.setReferenceIA5("810123456789");
+ p.setReferenceNum(Asn1BigInteger.toAsn1(810123456789L));
+ p.setProductOwnerNum(23456L);
+ p.setProductOwnerIA5("23456");
+ p.setProductIdNum(15535L);
+ p.setProductIdIA5("23456");
+
+ p.setPassType(2L);
+ p.setPassDescription("Eurail FlexPass");
+ p.setClassCode(TravelClassType.first);
+ p.setValidFromDay( 0L);
+ p.setValidFromTime( 1000L);
+ p.setValidFromUTCOffset( 1L);
+ p.setValidUntilDay( 1L);
+ p.setValidUntilTime( 1000L);
+ p.setValidUntilUTCOffset(1L);
+
+ ValidityPeriodDetailType v = new ValidityPeriodDetailType();
+ p.setValidityPeriodDetails(v);
+ v.setValidityPeriod(new SequenceOfValidityPeriodType());
+ v.setExcludedTimeRange(new SequenceOfTimeRangeType());
+
+ ValidityPeriodType vp = new ValidityPeriodType();
+ p.getValidityPeriodDetails().getValidityPeriod().add(vp);
+ vp.setValidFromDay(0L);
+ vp.setValidFromTime( 1000L);
+ vp.setValidFromUTCOffset( 1L);
+ vp.setValidUntilDay( 1L);
+ vp.setValidUntilTime( 1000L);
+ vp.setValidUntilUTCOffset(1L);
+
+ TimeRangeType tr = new TimeRangeType();
+ p.getValidityPeriodDetails().getExcludedTimeRange().add(tr);
+
+ tr.setFromTime(6L);
+ tr.setUntilTime(9L);
+
+ p.setNumberOfValidityDays(5L);
+
+
+ p.setNumberOfPossibleTrips( 3L);
+ p.setNumberOfDaysOfTravel( 10L);
+
+ p.setActivatedDay(new SequenceOfActivatedDays());
+ p.getActivatedDay().add(200L);
+ p.getActivatedDay().add(201L);
+
+
+ p.setCountries(new SequenceOfCountries());
+ p.getCountries().add(10L);
+ p.getCountries().add(20L);
+
+ p.setIncludedCarriersNum(new SequenceOfCarrierNum());
+ p.getIncludedCarriersNum().add(1080L);
+ p.getIncludedCarriersNum().add(1181L);
+
+ p.setIncludedCarriersIA5(new SequenceOfStringIA5());
+ p.getIncludedCarriersIA5().add("1080");
+ p.getIncludedCarriersIA5().add("1181");
+
+ p.setExcludedCarriersNum(new SequenceOfCarrierNum());
+ p.getExcludedCarriersNum().add(1080L);
+ p.getExcludedCarriersNum().add(1181L);
+
+ p.setExcludedCarriersIA5(new SequenceOfStringIA5());
+ p.getExcludedCarriersIA5().add("1080");
+ p.getExcludedCarriersIA5().add("1181");
+
+ p.setIncludedServiceBrands(new SequenceOfServiceBrands());
+ p.getIncludedServiceBrands().add(108L);
+ p.getIncludedServiceBrands().add(118L);
+
+ p.setExcludedServiceBrands(new SequenceOfServiceBrands());
+ p.getExcludedServiceBrands().add(108L);
+ p.getExcludedServiceBrands().add(118L);
+
+ p.setValidRegion(new SequenceOfRegionalValidityType());
+
+ RegionalValidityType rv = new RegionalValidityType();
+ p.getValidRegion().add(rv);
+ rv.setZones(new ZoneType());
+ rv.getZones().setZoneId(new SequenceOfUnrestrictedLong());
+ rv.getZones().getZoneId().add(100L);
+
+ p.setTariffs(new SequenceOfTariffType());
+ TariffType ta = new TariffType();
+ p.getTariffs().add(ta);
+ ta.setNumberOfPassengers(1L);
+ ta.setRestrictedToCountryOfResidence(false);
+ ta.setTariffIdNum(72L);
+ ta.setTariffDesc("Large Car Full Fare");
+
+ p.setVatDetails(new SequenceOfVatDetail());
+ VatDetailType v1 = new VatDetailType();
+ p.getVatDetails().add(v1);
+ v1.setAmount(10L);
+ v1.setCountry(80L);
+ v1.setPercentage(70L);
+ v1.setVatId("IUDGTE");
+
+ p.setPrice(10000L);
+ p.setInfoText("pass info");
+
+ }
+
+
+ private static void populateOpenTicket(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ OpenTicketData o = new OpenTicketData();
+ d.getTicket().setOpenTicket(o);
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ o.setExtension(e1);
+
+ o.setReferenceIA5("810123456789");
+ o.setReferenceNum(810123456789L);
+ o.setProductOwnerNum( 23456L);
+ o.setProductOwnerIA5("23456");
+ o.setProductIdNum( 15535L);
+ o.setProductIdIA5("23456");
+
+
+ o.setExtIssuerId( 12L);
+ o.setIssuerAutorizationId( 13L);
+ o.setReturnIncluded( false);
+
+ o.setStationCodeTable(CodeTableType.stationERA);
+ o.setFromStationNum( 8100001L);
+ o.setFromStationIA5("8100001");
+ o.setToStationNum( 8000002L);
+ o.setToStationIA5( "8100002");
+ o.setFromStationNameUTF8( "A-STATION");
+ o.setToStationNameUTF8( "B-STATION");
+
+ o.setValidRegionDesc("From A to B via C");
+
+ o.setValidRegion(new SequenceOfRegionalValidityType());
+ o.getValidRegion().add(new RegionalValidityType());
+ o.getValidRegion().get(0).setViaStations(new ViaStationType());
+ o.getValidRegion().add(new RegionalValidityType());
+ o.getValidRegion().get(1).setZones(new ZoneType());
+ o.getValidRegion().add(new RegionalValidityType());
+ o.getValidRegion().get(2).setLines(new LineType());
+ o.getValidRegion().add(new RegionalValidityType());
+ o.getValidRegion().get(3).setTrainLink(new TrainLinkType());
+ o.getValidRegion().add(new RegionalValidityType());
+ o.getValidRegion().get(4).setPolygone(new PolygoneType());
+ populateRoute(o.getValidRegion().get(0).getViaStations());
+ populateZone(o.getValidRegion().get(1).getZones());
+ populateLine(o.getValidRegion().get(2).getLines());
+ populateTrainLink(o.getValidRegion().get(3).getTrainLink());
+ populatePolygon(o.getValidRegion().get(4).getPolygone());
+
+ o.setReturnDescription(new ReturnRouteDescriptionType());
+ o.getReturnDescription().setFromStationNum( 8100001L);
+ o.getReturnDescription().setFromStationIA5("8100001");
+ o.getReturnDescription().setToStationNum( 8000002L);
+ o.getReturnDescription().setToStationIA5( "8100002");
+ o.getReturnDescription().setFromStationNameUTF8( "A-STATION");
+ o.getReturnDescription().setToStationNameUTF8( "B-STATION");
+ o.getReturnDescription().setValidReturnRegionDesc( "return");
+ o.getReturnDescription().setValidReturnRegion(new SequenceOfRegionalValidityType());
+ o.getReturnDescription().getValidReturnRegion().add(new RegionalValidityType());
+
+ o.getReturnDescription().getValidReturnRegion().get(0).setZones(new ZoneType());
+ o.getReturnDescription().getValidReturnRegion().get(0).getZones().setZoneId(new SequenceOfUnrestrictedLong());
+ o.getReturnDescription().getValidReturnRegion().get(0).getZones().getZoneId().add(100L);
+ o.getReturnDescription().getValidReturnRegion().get(0).getZones().getZoneId().add(200L);
+ o.getReturnDescription().getValidReturnRegion().get(0).getZones().setCarrierIA5("1080");
+ o.getReturnDescription().getValidReturnRegion().get(0).getZones().setCarrierNum(1080L);
+ o.getReturnDescription().getValidReturnRegion().get(0).getZones().setStationCodeTable(CodeTableType.stationERA);
+
+ o.setValidFromDay( 700L);
+ o.setValidFromTime( 0L);
+ o.setValidFromUTCOffset( 60L);
+ o.setValidUntilDay( 370L);
+ o.setValidUntilTime( 1439L);
+ o.setValidUntilUTCOffset( 10L);
+
+ o.setActivatedDay(new SequenceOfActivatedDays());
+ o.getActivatedDay().add(1L);
+ o.getActivatedDay().add(2L);
+
+
+ o.setClassCode(TravelClassType.first);
+ o.setServiceLevel("A");
+
+ o.setCarriersNum(new SequenceOfCarrierNum());
+ o.getCarriersNum().add(1080L);
+ o.getCarriersNum().add(1181L);
+
+ o.setCarriersIA5(new SequenceOfStringIA5());
+ o.getCarriersIA5().add("1080");
+ o.getCarriersIA5().add("1181");
+
+ o.setIncludedServiceBrands(new SequenceOfServiceBrands());
+ o.getIncludedServiceBrands().add(108L);
+ o.getIncludedServiceBrands().add(118L);
+
+ o.setExcludedServiceBrands(new SequenceOfServiceBrands());
+ o.getExcludedServiceBrands().add(108L);
+ o.getExcludedServiceBrands().add(118L);
+
+ o.setTariffs(new SequenceOfTariffType());
+ TariffType ta = new TariffType();
+ o.getTariffs().add(ta);
+ ta.setNumberOfPassengers(1L);
+ ta.setRestrictedToCountryOfResidence(false);
+ ta.setTariffIdNum(72L);
+ ta.setTariffDesc("Large Car Full Fare");
+
+ o.setVatDetails(new SequenceOfVatDetail());
+ VatDetailType v1 = new VatDetailType();
+ o.getVatDetails().add(v1);
+ v1.setCountry(80L);
+ v1.setPercentage(70L);
+
+ o.setPrice( 12345L);
+
+
+ o.setInfoText("openTicketInfo");
+
+ o.setIncludedAddOns(new SequenceOfIncludedOpenTicketType());
+ o.getIncludedAddOns().add(new IncludedOpenTicketType());
+ populateIncludedTicket(o.getIncludedAddOns().get(0));
+
+ o.setLuggage(new LuggageRestrictionType());
+ o.getLuggage().setMaxHandLuggagePieces(2L);
+ o.getLuggage().setMaxNonHandLuggagePieces(1L);
+
+
+
+ }
+
+
+
+
+ private static void populateTrainLink(TrainLinkType t) {
+
+
+ t.setTrainNum( 12345L);
+ t.setTrainIA5("12345");
+ t.setTravelDate( 2L);
+ t.setDepartureTime( 1439L);
+
+
+ t.setFromStationNum( 8100001L);
+ t.setFromStationIA5("8100001");
+ t.setToStationNum( 8000002L);
+ t.setToStationIA5( "8100002");
+ t.setFromStationName( "A-STATION");
+ t.setToStationName( "B-STATION");
+
+ }
+
+ private static void populatePolygon(PolygoneType p) {
+
+ p.setFirstEdge(new GeoCoordinateType());
+ p.getFirstEdge().setLongitude( 12345L);
+ p.getFirstEdge().setLatitude( 56789L);
+ p.setEdges(new SequenceOfDeltaCoordinates());
+ p.getEdges().add(new DeltaCoordinates());
+ p.getEdges().add(new DeltaCoordinates());
+ p.getEdges().get(0).setLongitude( Asn1BigInteger.toAsn1(12345L));
+ p.getEdges().get(0).setLatitude(Asn1BigInteger.toAsn1(56789L));
+ p.getEdges().get(1).setLongitude(Asn1BigInteger.toAsn1(12345L));
+ p.getEdges().get(1).setLatitude(Asn1BigInteger.toAsn1(56789L));
+
+ }
+
+ private static void populateZone(ZoneType z) {
+
+ z.setCarrierNum( 1080L);
+ z.setCarrierIA5("1080");
+ z.setStationCodeTable(CodeTableType.stationERA);
+ z.setEntryStationNum( 1234L);
+ z.setEntryStationIA5( "1234");
+ z.setTerminatingStationNum( 2345L);
+ z.setTerminatingStationIA5( "2345");
+ z.setCity(Asn1BigInteger.toAsn1(123456L));
+ z.setZoneId(new SequenceOfUnrestrictedLong());
+ z.getZoneId().add(100L);
+ z.getZoneId().add(200L);
+ z.setNutsCode("DE4711");
+ z.setBinaryZoneId(UperEncoder.bytesFromHexString("82DA"));
+
+ }
+
+ private static void populateLine(LineType z) {
+
+ z.setCarrierNum( 1080L);
+ z.setCarrierIA5("1080");
+ z.setStationCodeTable(CodeTableType.stationERA);
+ z.setEntryStationNum( 1234L);
+ z.setEntryStationIA5( "1234");
+ z.setTerminatingStationNum( 2345L);
+ z.setTerminatingStationIA5( "2345");
+ z.setCity(123456L);
+ z.setLineId(new SequenceOfUnrestrictedLong());
+ z.getLineId().add(100L);
+ z.getLineId().add(200L);
+
+ }
+
+ private static void populateRoute(ViaStationType t) {
+
+
+ t.setRoute(new SequenceOfViaStationType());
+ t.getRoute().add(new ViaStationType());
+ t.getRoute().add(new ViaStationType());
+ t.getRoute().add(new ViaStationType());
+ t.getRoute().add(new ViaStationType());
+
+ t.getRoute().get(0).setStationNum( 123455L);
+ t.getRoute().get(0).setStationIA5("123455");
+ t.getRoute().get(0).setBorder( false);
+
+ t.getRoute().get(1).setStationNum( 123456L);
+ t.getRoute().get(1).setBorder( false);
+
+
+ t.getRoute().get(2).setAlternativeRoutes(new SequenceOfViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().add(new ViaStationType());
+ t.getRoute().get(2).setBorder( false);
+
+ t.getRoute().get(2).getAlternativeRoutes().get(0).setRoute(new SequenceOfViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(0).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(0).setStationNum( 23455L);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(0).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(1).setStationNum( 23456L);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(1).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(1).setRoute(new SequenceOfViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(1).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().get(0).setStationNum( 3455L);
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().get(0).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().get(1).setStationNum( 3456L);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(1).setBorder(false);
+
+ t.getRoute().get(3).setStationNum( 123457L);
+ t.getRoute().get(3).setBorder(false);
+
+ t.setBorder( false);
+
+ t.setSeriesId( 999L);
+ t.setRouteId( 21L);
+
+ }
+
+ private static void populateCounterMarkRoute(ViaStationType t) {
+
+
+ t.setRoute(new SequenceOfViaStationType());
+ t.getRoute().add(new ViaStationType());
+ t.getRoute().add(new ViaStationType());
+ t.getRoute().add(new ViaStationType());
+ t.getRoute().add(new ViaStationType());
+
+ t.getRoute().get(0).setStationNum( 123455L);
+ t.getRoute().get(0).setStationIA5("123455");
+ t.getRoute().get(0).setBorder( false);
+
+ t.getRoute().get(1).setStationNum( 123456L);
+ t.getRoute().get(1).setBorder( false);
+
+
+ t.getRoute().get(2).setAlternativeRoutes(new SequenceOfViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().add(new ViaStationType());
+ t.getRoute().get(2).setBorder( false);
+
+ t.getRoute().get(2).getAlternativeRoutes().get(0).setRoute(new SequenceOfViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(0).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(0).setStationNum( 23455L);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(0).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(1).setStationNum( 23456L);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(1).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(1).setRoute(new SequenceOfViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(1).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().get(0).setStationNum( 3455L);
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().get(0).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().get(1).setStationNum( 3456L);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(1).setBorder(false);
+
+ t.getRoute().get(3).setStationNum( 123457L);
+ t.getRoute().get(3).setBorder(false);
+
+ t.setCarriersIA5(new SequenceOfStringIA5());
+ t.getCarriersIA5().add("1080");
+ t.getCarriersIA5().add("1181");
+
+ t.setCarriersNum(new SequenceOfCarrierNum());
+ t.getCarriersNum().add(1080L);
+ t.getCarriersNum().add(1181L);
+
+
+ t.setBorder( false);
+
+ t.setSeriesId( 999L);
+ t.setRouteId( 21L);
+
+ }
+
+ private static void populateIncludedTicket(IncludedOpenTicketType t) {
+
+
+ t.setProductOwnerNum( 23456L);
+ t.setProductOwnerIA5("23456");
+ t.setProductIdNum( 15535L);
+ t.setProductIdIA5("23456");
+
+
+ t.setExternalIssuerId(12L);
+ t.setIssuerAutorizationId(13L);
+ t.setStationCodeTable(CodeTableType.stationERA);
+
+ t.setValidRegion(new SequenceOfRegionalValidityType());
+ RegionalValidityType rv = new RegionalValidityType();
+ t.getValidRegion().add(rv);
+ rv.setZones(new ZoneType());
+ rv.getZones().setZoneId(new SequenceOfUnrestrictedLong());
+ rv.getZones().getZoneId().add(100L);
+
+ t.setValidFromDay( 0L);
+ t.setValidFromTime(1000L);
+ t.setValidUntilDay(1L);
+ t.setValidUntilTime(1000L);
+ t.setClassCode(TravelClassType.second);
+ t.setServiceLevel("A");
+
+ t.setIncludedCarriersNum(new SequenceOfCarrierNum());
+ t.getIncludedCarriersNum().add(1080L);
+ t.getIncludedCarriersNum().add(1181L);
+
+ t.setIncludedCarriersIA5(new SequenceOfStringIA5());
+ t.getIncludedCarriersIA5().add("1080");
+ t.getIncludedCarriersIA5().add("1181");
+
+
+ t.setIncludedServiceBrands(new SequenceOfServiceBrands());
+ t.getIncludedServiceBrands().add(108L);
+ t.getIncludedServiceBrands().add(118L);
+
+ t.setExcludedServiceBrands(new SequenceOfServiceBrands());
+ t.getExcludedServiceBrands().add(108L);
+ t.getExcludedServiceBrands().add(118L);
+
+ t.setTariffs(new SequenceOfTariffType());
+ TariffType ta = new TariffType();
+ t.getTariffs().add(ta);
+ ta.setNumberOfPassengers(1L);
+ ta.setRestrictedToCountryOfResidence(false);
+ ta.setTariffIdNum(72L);
+ ta.setTariffDesc("Large Car Full Fare");
+
+ t.setInfoText("included ticket");
+
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ t.setExtension(e1);
+
+ }
+
+
+ private static void populateCarCarriage(DocumentData d2) {
+
+ d2.setTicket(new TicketDetailData());
+ d2.setToken(new TokenType());
+
+
+ assert(d2.getToken() != null);
+ d2.getToken().setToken(UperEncoder.bytesFromHexString("82DA"));
+ d2.getToken().setTokenProviderIA5("VDV");
+ d2.getToken().setTokenProviderNum(123L);
+ d2.getToken().setTokenSpecification("TEST");
+
+ CarCarriageReservationData r = new CarCarriageReservationData();
+ d2.getTicket().setCarCarriageReservation(r);
+
+ r.setTrainNum( 123L);
+ r.setTrainIA5("123");
+ r.setReferenceIA5("810123456789");
+ r.setReferenceNum( 810123456789L);
+ r.setProductOwnerNum( 23456L);
+ r.setProductOwnerIA5("23456");
+ r.setProductIdNum( 15535L);
+ r.setProductIdIA5("23456");
+ r.setServiceBrand( 100L);
+ r.setServiceBrandAbrUTF8("AZ");
+ r.setServiceBrandNameUTF8("special train");
+
+ r.setBeginLoadingDate( 10L);
+ r.setBeginLoadingTime( 0L);
+ r.setEndLoadingTime( 500L);
+ r.setLoadingUTCOffset( 30L);
+
+ r.setStationCodeTable(CodeTableType.stationERA);
+ r.setFromStationNum( 8100001L);
+ r.setFromStationIA5("8100001");
+ r.setToStationNum( 8000002L);
+ r.setToStationIA5( "8100002");
+ r.setFromStationNameUTF8( "A-STATION");
+ r.setToStationNameUTF8( "B-STATION");
+
+ r.setCoach("21");
+ r.setPlace("41");
+ r.setCompartmentDetails(new CompartmentDetailsType());
+
+ r.getCompartmentDetails().setCoachType( 1L);
+ r.getCompartmentDetails().setCompartmentType( 99L);
+ r.getCompartmentDetails().setSpecialAllocation( 50L);
+ r.getCompartmentDetails().setCoachTypeDescr("xwz");
+ r.getCompartmentDetails().setCompartmentTypeDescr("xwz");
+ r.getCompartmentDetails().setSpecialAllocationDescr("xwz");
+ r.getCompartmentDetails().setPosition(CompartmentPositionType.upperLevel);
+
+ r.setNumberPlate( "AD-DE-123");
+ r.setTrailerPlate( "DX-AB-123");
+ r.setCarCategory( 3L);
+ r.setBoatCategory( 5L);
+ r.setTextileRoof( false);
+ r.setRoofRackType(RoofRackType.bicycleRack);
+ r.setRoofRackHeight( 20L);
+ r.setAttachedBoats( 2L);
+ r.setAttachedBicycles( 1L);
+ r.setAttachedSurfboards( 2L);
+ r.setLoadingListEntry( 421L);
+ r.setLoadingDeck(LoadingDeckType.upper);
+
+ r.setCarrierNum(new SequenceOfCarrierNum());
+ r.getCarrierNum().add(1080L);
+ r.getCarrierNum().add(1181L);
+
+ r.setCarrierIA5(new SequenceOfStringIA5());
+ r.getCarrierIA5().add("1080");
+ r.getCarrierIA5().add("1181");
+
+
+ r.setPriceType(PriceTypeType.travelPrice);
+ r.setPrice(12345L);
+
+ r.setInfoText("car carriage");
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ r.setExtension(e1);
+
+ TariffType ta = new TariffType();
+ r.setTariff(ta);
+ ta.setNumberOfPassengers(1L);
+ ta.setRestrictedToCountryOfResidence(false);
+ ta.setTariffIdNum(72L);
+ ta.setTariffDesc("Large Car Full Fare");
+
+ r.setVatDetails(new SequenceOfVatDetail());
+ VatDetailType v1 = new VatDetailType();
+ r.getVatDetails().add(v1);
+ v1.setAmount(10L);
+ v1.setCountry(80L);
+ v1.setPercentage(70L);
+ v1.setVatId("IUDGTE");
+
+ }
+
+
+ private static void populateReservation(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ ReservationData r = new ReservationData();
+ d.getTicket().setReservation(r);
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ r.setExtension(e1);
+
+ r.setTrainNum( 12345L);
+ r.setTrainIA5("12345");
+ r.setDepartureDate( 2L);
+ r.setReferenceIA5("810123456789");
+ r.setReferenceNum(80123456789L);
+ r.setProductOwnerNum( 23456L);
+ r.setProductOwnerIA5("23456");
+ r.setProductIdNum( 15535L);
+ r.setProductIdIA5("23456");
+ r.setServiceBrand( 12L);
+ r.setServiceBrandAbrUTF8("TGV");
+ r.setServiceBrandNameUTF8("Lyria");
+ r.setService(ServiceType.couchette);
+
+ r.setStationCodeTable(CodeTableType.stationUIC);
+ r.setFromStationNum( 8100001L);
+ r.setFromStationIA5("8100001");
+ r.setToStationNum( 8000002L);
+ r.setToStationIA5( "8100002");
+ r.setFromStationNameUTF8( "A-STATION");
+ r.setToStationNameUTF8( "B-STATION");
+ r.setDepartureTime( 1439L);
+ r.setDepartureUTCOffset( -60L);
+ r.setArrivalDate( 20L);
+ r.setArrivalTime( 0L);
+ r.setArrivalUTCOffset( 10L);
+ r.setCarrierNum(new SequenceOfCarrierNum());
+ r.getCarrierNum().add(1080L);
+ r.getCarrierNum().add(1181L);
+
+ r.setCarrierIA5(new SequenceOfStringIA5());
+ r.getCarrierIA5().add("1080");
+ r.getCarrierIA5().add("1181");
+ r.setClassCode(TravelClassType.first);
+ r.setServiceLevel("A");
+
+ r.setPlaces(new PlacesType());
+ r.getPlaces().setCoach("31A");
+ r.getPlaces().setPlaceString("31-47");
+ r.getPlaces().setPlaceDescription("Window");
+ r.getPlaces().setPlaceIA5(new SequenceOfStringIA5());
+ r.getPlaces().getPlaceIA5().add("31A");
+ r.getPlaces().getPlaceIA5().add("31B");
+ r.getPlaces().setPlaceNum(new SequenceOfPlaceNum());
+ r.getPlaces().getPlaceNum().add(31L);
+ r.getPlaces().getPlaceNum().add(32L);
+
+ r.setAdditionalPlaces(new PlacesType());
+ r.getAdditionalPlaces().setCoach("31A");
+ r.getAdditionalPlaces().setPlaceString("31-47");
+ r.getAdditionalPlaces().setPlaceDescription("Window");
+ r.getAdditionalPlaces().setPlaceIA5(new SequenceOfStringIA5());
+ r.getAdditionalPlaces().getPlaceIA5().add("31A");
+ r.getAdditionalPlaces().getPlaceIA5().add("31B");
+ r.getAdditionalPlaces().setPlaceNum(new SequenceOfPlaceNum());
+ r.getAdditionalPlaces().getPlaceNum().add(31L);
+ r.getAdditionalPlaces().getPlaceNum().add(32L);
+
+ r.setBicyclePlaces(new PlacesType());
+ r.getBicyclePlaces().setCoach("31A");
+ r.getBicyclePlaces().setPlaceString("31-47");
+ r.getBicyclePlaces().setPlaceDescription("Window");
+ r.getBicyclePlaces().setPlaceIA5(new SequenceOfStringIA5());
+ r.getBicyclePlaces().getPlaceIA5().add("31A");
+ r.getBicyclePlaces().getPlaceIA5().add("31B");
+ r.getBicyclePlaces().setPlaceNum(new SequenceOfPlaceNum());
+ r.getBicyclePlaces().getPlaceNum().add(31L);
+ r.getBicyclePlaces().getPlaceNum().add(32L);
+
+
+ r.setCompartmentDetails(new CompartmentDetailsType());
+ r.getCompartmentDetails().setCoachType( 1L);
+ r.getCompartmentDetails().setCompartmentType( 99L);
+ r.getCompartmentDetails().setSpecialAllocation( 50L);
+ r.getCompartmentDetails().setCoachTypeDescr("xwz");
+ r.getCompartmentDetails().setCompartmentTypeDescr( "xwz");
+ r.getCompartmentDetails().setSpecialAllocationDescr( "xwz");
+ r.getCompartmentDetails().setPosition(CompartmentPositionType.upperLevel);
+
+ r.setNumberOfOverbooked( 200L);
+ r.setBerth(new SequenceOfBerthDetailData());
+ BerthDetailData b = new BerthDetailData();
+ r.getBerth().add(b);
+ b.setBerthType(BerthTypeType.single);
+ b.setGender(CompartmentGenderType.female);
+ b.setNumberOfBerths( 999L);
+
+
+ r.setTariff(new SequenceOfTariffType());
+ TariffType ta = new TariffType();
+ r.getTariff().add(ta);
+ ta.setNumberOfPassengers(1L);
+
+ ta.setPassengerType(PassengerType.senior);
+ ta.setAgeBelow( 40L);
+ ta.setAgeAbove( 60L);
+ ta.setTraverlerid(new SequenceOfTravelerId());
+ ta.getTraverlerid().add(1L);
+
+ ta.setRestrictedToCountryOfResidence( false);
+ ta.setRestrictedToRouteSection(new RouteSectionType());
+ ta.getRestrictedToRouteSection().setStationCodeTable(CodeTableType.stationERA);
+ ta.getRestrictedToRouteSection().setFromStationNum( 123L);
+ ta.getRestrictedToRouteSection().setFromStationIA5( "123");
+ ta.getRestrictedToRouteSection().setToStationNum( 234L);
+ ta.getRestrictedToRouteSection().setToStationIA5( "234");
+ ta.getRestrictedToRouteSection().setFromStationNameUTF8( "A");
+ ta.getRestrictedToRouteSection().setToStationNameUTF8( "B");
+
+ ta.setSeriesDataDetails(new SeriesDetailType());
+ ta.getSeriesDataDetails().setSupplyingCarrier(2345L);
+ ta.getSeriesDataDetails().setOfferIdentification( 99L);
+ ta.getSeriesDataDetails().setSeries( 23456L);
+
+ ta.setTariffIdNum( 72L);
+ ta.setTariffIdIA5( "72");
+ ta.setTariffDesc( "Leasure Fare");
+ ta.setReductionCard(new SequenceOfCardReferenceType());
+ ta.getReductionCard().add(new CardReferenceType());
+
+ ta.getReductionCard().get(0).setCardIssuerNum(1234L);
+ ta.getReductionCard().get(0).setCardIssuerIA5( "1234");
+ ta.getReductionCard().get(0).setCardIdNum(5678L);
+ ta.getReductionCard().get(0).setCardIdIA5( "5678");
+ ta.getReductionCard().get(0).setCardName( "testcard");
+ ta.getReductionCard().get(0).setCardType(123L);
+ ta.getReductionCard().get(0).setLeadingCardIdNum(3456L);
+ ta.getReductionCard().get(0).setLeadingCardIdIA5("3456");
+ ta.getReductionCard().get(0).setTrailingCardIdNum(100L);
+ ta.getReductionCard().get(0).setTrailingCardIdIA5("100");
+
+
+ r.setPriceType(PriceTypeType.travelPrice);
+ r.setPrice( 12345L);
+
+ r.setVatDetails(new SequenceOfVatDetail());
+ VatDetailType v1 = new VatDetailType();
+ r.getVatDetails().add(v1);
+ v1.setAmount(10L);
+ v1.setCountry(80L);
+ v1.setPercentage(70L);
+ v1.setVatId("IUDGTE");
+
+ r.setTypeOfSupplement( 9L);
+ r.setNumberOfSupplements( 2L);
+
+ r.setLuggage(new LuggageRestrictionType());
+
+ r.getLuggage().setMaxHandLuggagePieces( 2L);
+ r.getLuggage().setMaxNonHandLuggagePieces( 1L);
+ r.getLuggage().setRegisteredLuggage(new SequenceOfRegisteredLuggageType());
+ r.getLuggage().getRegisteredLuggage().add(new RegisteredLuggageType());
+ r.getLuggage().getRegisteredLuggage().add(new RegisteredLuggageType());
+ r.getLuggage().getRegisteredLuggage().get(0).setRegistrationId("IODHUV");
+ r.getLuggage().getRegisteredLuggage().get(0).setMaxWeight( 20L);
+ r.getLuggage().getRegisteredLuggage().get(0).setMaxSize( 100L);
+ r.getLuggage().getRegisteredLuggage().get(1).setRegistrationId("XXDHUV");
+ r.getLuggage().getRegisteredLuggage().get(1).setMaxWeight( 21L);
+ r.getLuggage().getRegisteredLuggage().get(1).setMaxSize( 101L);
+
+ r.setInfoText("reservation");
+
+
+ }
+
+
+ private static void populateTravelerData(TravelerData td) {
+
+ td.setGroupName("myGroup");
+ td.setPreferedLanguage("EN");
+ td.setTraveler(new SequenceOfTravelerType());
+ TravelerType t = new TravelerType();
+ td.getTraveler().add(t);
+
+ t.setCountryOfIdCard(103L);
+ t.setCountryOfPassport(102L);
+ t.setCountryOfResidence(101L);
+ t.setCustomerIdIA5("DZE5gT");
+ t.setCustomerIdNum(12345L);
+ t.setYearOfBirth(1901L);
+ t.setMonthOfBirth(11L);
+ t.setDayOfBirth(31L);
+ t.setFirstName("John");
+ t.setGender(GenderType.male);
+ t.setIdCard("12345");
+ t.setLastName("Dow");
+ t.setPassengerType(PassengerType.senior);
+ t.setPassengerWithReducedMobility(false);
+ t.setPassportId("JDTS");
+ t.setSecondName("Little");
+ t.setTitle("PhD");
+ t.setTicketHolder(true);
+ t.setStatus(new SequenceOfCustomerStatusType());
+ CustomerStatusType cs = new CustomerStatusType();
+ t.getStatus().add(cs);
+ cs.setCustomerStatus(1L);
+ cs.setCustomerStatusDescr("senior");
+ }
+
+
+ private static void populateIssuingData(IssuingData id) {
+
+ id.setActivated(true);
+ id.setCurrency("SRF");
+ id.setCurrencyFract(3L);
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ id.setExtension(e1);
+
+ id.setIssuedOnLine(12L);
+ id.setIssuedOnTrainIA5("123");
+ id.setIssuedOnTrainNum(123L);
+ id.setIssuerName("name");
+ id.setIssuerIA5("1");
+ id.setIssuerNum(15000L);
+ id.setIssuerPNR("issuerTestPNR");
+ id.setIssuingDay(1L);
+ id.setIssuingTime(600L);
+ id.setIssuingYear(2018L);
+ id.setSecurePaperTicket(false);
+ id.setSecurityProviderIA5("1");
+ id.setSecurityProviderNum(1L);
+ id.setSpecimen(true);
+ id.setPointOfSale(new GeoCoordinateType());
+ id.getPointOfSale().setGeoUnit(GeoUnitType.microDegree);
+ id.getPointOfSale().setCoordinateSystem(GeoCoordinateSystemType.wgs84);
+ id.getPointOfSale().setAccuracy(GeoUnitType.microDegree);
+ id.getPointOfSale().setHemisphereLatitude(HemisphereLatitudeType.east);
+ id.getPointOfSale().setHemisphereLongitude(HemisphereLongitudeType.north);
+ id.getPointOfSale().setLatitude(56789L);
+ id.getPointOfSale().setLongitude(12345L);
+
+ }
+
+
+ private static void populateExtension(List<ExtensionData> extensions) {
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ extensions.add(e1);
+
+ ExtensionData e2 = new ExtensionData();
+ e2.setExtensionId("2");
+ e2.setExtensionData(UperEncoder.bytesFromHexString("83DA"));
+ extensions.add(e2);
+
+ }
+
+
+ private static void populateControlDetail(ControlData controlDetail) {
+
+ controlDetail.setAgeCheckRequired(false);
+ controlDetail.setIdentificationByPassportId(false);
+ controlDetail.setIdentificationByIdCard(false);
+ controlDetail.setOnlineValidationRequired(false);
+ controlDetail.setIdentificationItem(12L);
+ controlDetail.setPassportValidationRequired(false);
+ controlDetail.setRandomDetailedValidationRequired(50L);
+ controlDetail.setExtension(new ExtensionData());
+ controlDetail.getExtension().setExtensionId("1");
+ controlDetail.getExtension().setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+
+ controlDetail.setReductionCardCheckRequired(false);
+ controlDetail.setInfoText("control");
+ controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
+
+ CardReferenceType cr = new CardReferenceType();
+ controlDetail.getIdentificationByCardReference().add(cr);
+ cr.setCardIdIA5("5678");
+ cr.setCardIdNum(5678L);
+ cr.setCardIssuerIA5("1234");
+ cr.setCardIssuerNum(1234L);
+ cr.setCardName("testcard");
+ cr.setCardType(123L);
+ cr.setLeadingCardIdIA5("3456");
+ cr.setLeadingCardIdNum(3456L);
+ cr.setTrailingCardIdIA5("100");
+ cr.setTrailingCardIdNum(100L);
+
+ controlDetail.setIncludedTickets(new SequenceOfTicketLinkType());
+ TicketLinkType tl = new TicketLinkType();
+ controlDetail.getIncludedTickets().add(tl);
+ tl.setIssuerName("XYZ");
+ tl.setIssuerPNR("LDWDUR45");
+ tl.setProductOwnerIA5("IEFHU");
+ tl.setProductOwnerNum(1080L);
+ tl.setLinkMode(LinkMode.issuedTogether);
+ tl.setReferenceIA5("KDJET");
+ tl.setReferenceNum(801234567890L);
+ tl.setTicketType(TicketType.openTicket);
+
+ }
+
+ }