summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/uic/barcode
diff options
context:
space:
mode:
authorCGantert345 <57003061+CGantert345@users.noreply.github.com>2021-11-29 17:10:55 +0100
committerGitHub <noreply@github.com>2021-11-29 17:10:55 +0100
commitd7fbd40aad2080adf7033e8f668e5218ab12bace (patch)
tree0b7c8e4f0a8427a6eccdeb19882ce90ccbdd852c /src/main/java/org/uic/barcode
parentMerge pull request #35 from UnionInternationalCheminsdeFer/1.2.8 (diff)
parentadditional tests (diff)
downloadUIC-barcode-d7fbd40aad2080adf7033e8f668e5218ab12bace.tar
UIC-barcode-d7fbd40aad2080adf7033e8f668e5218ab12bace.tar.gz
UIC-barcode-d7fbd40aad2080adf7033e8f668e5218ab12bace.tar.bz2
UIC-barcode-d7fbd40aad2080adf7033e8f668e5218ab12bace.tar.lz
UIC-barcode-d7fbd40aad2080adf7033e8f668e5218ab12bace.tar.xz
UIC-barcode-d7fbd40aad2080adf7033e8f668e5218ab12bace.tar.zst
UIC-barcode-d7fbd40aad2080adf7033e8f668e5218ab12bace.zip
Diffstat (limited to '')
-rw-r--r--src/main/java/org/uic/barcode/asn1/uper/SequenceCoder.java12
-rw-r--r--src/main/java/org/uic/barcode/asn1/uper/UperEncoder.java9
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/DelayConfirmation.java27
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/ParkingGroundData.java6
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/TicketDetailData.java8
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/ZoneType.java4
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/DelayConfirmation.java26
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/ParkingGroundData.java5
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/TicketDetailData.java7
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/ZoneType.java4
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv3/DelayConfirmation.java27
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv3/ParkingGroundData.java6
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv3/TicketDetailData.java6
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv3/ZoneType.java3
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/test/testtickets/OpenLuggageRestrictionTestTicketV3.java518
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java8
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java6
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV3.java4
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoder.java4
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java4
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV3.java4
21 files changed, 603 insertions, 95 deletions
diff --git a/src/main/java/org/uic/barcode/asn1/uper/SequenceCoder.java b/src/main/java/org/uic/barcode/asn1/uper/SequenceCoder.java
index 5e8386e..ce89a3e 100644
--- a/src/main/java/org/uic/barcode/asn1/uper/SequenceCoder.java
+++ b/src/main/java/org/uic/barcode/asn1/uper/SequenceCoder.java
@@ -13,6 +13,11 @@ import org.uic.barcode.asn1.uper.UperEncoder.Asn1ContainerFieldSorter;
class SequenceCoder implements Decoder, Encoder {
@Override public <T> boolean canEncode(T obj, Annotation[] extraAnnotations) {
+
+ if (obj == null || obj.getClass() == null) {
+ return false;
+ }
+
Class<?> type = obj.getClass();
AnnotationStore annotations = new AnnotationStore(type.getAnnotations(), extraAnnotations);
@@ -53,7 +58,12 @@ class SequenceCoder implements Decoder, Encoder {
pos = String.format("Position: %d.%d", bitbuffer.position()/8 , bitbuffer.position() % 8);
UperEncoder.logger.debug(String.format("%s: Field %s", pos, f.getName()));
try {
- UperEncoder.encode2(bitbuffer, f.get(obj), f.getAnnotations());
+ Object o = f.get(obj);
+ if (o != null) {
+ UperEncoder.encode2(bitbuffer, f.get(obj), f.getAnnotations());
+ } else {
+ throw new Asn1EncodingException("missing object " + f.getName());
+ }
} catch (Asn1EncodingException e) {
throw new Asn1EncodingException("." + f.getName(), e);
} catch (IllegalArgumentException e) {
diff --git a/src/main/java/org/uic/barcode/asn1/uper/UperEncoder.java b/src/main/java/org/uic/barcode/asn1/uper/UperEncoder.java
index bba64e2..d5c5d1e 100644
--- a/src/main/java/org/uic/barcode/asn1/uper/UperEncoder.java
+++ b/src/main/java/org/uic/barcode/asn1/uper/UperEncoder.java
@@ -89,7 +89,14 @@ public final class UperEncoder {
static <T> void encode2(BitBuffer bitbuffer, T obj, Annotation[] extraAnnotations) throws Asn1EncodingException {
- for (Encoder e : encoders) {
+
+ if (obj == null) {
+ logger.debug(String.format("Object missing"));
+ return;
+ }
+
+
+ for (Encoder e : encoders) {
if (e.canEncode(obj, extraAnnotations)) {
e.encode(bitbuffer, obj, extraAnnotations);
return;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/DelayConfirmation.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/DelayConfirmation.java
index 4f61ff3..a3df48b 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/DelayConfirmation.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/DelayConfirmation.java
@@ -84,28 +84,24 @@ public class DelayConfirmation extends Object {
@Asn1Optional public String stationIA5;
@FieldOrder(order = 11)
- @RestrictedString(CharacterRestriction.UTF8String)
- @Asn1Optional public String stationNameUTF8;
+ @IntRange(minValue=1, maxValue=999)
+ public Long delay;
@FieldOrder(order = 12)
- @IntRange(minValue=0, maxValue=999, hasExtensionMarker=false)
- @Asn1Optional public Long delay;
+ public Boolean trainCancelled = false;
@FieldOrder(order = 13)
- @Asn1Optional public Boolean trainCancelled = false;
-
- @FieldOrder(order = 14)
@Asn1Default(value="travelerDelayConfirmation")
@Asn1Optional public ConfirmationTypeType confirmationType;
- @FieldOrder(order = 15)
+ @FieldOrder(order = 14)
@Asn1Optional public SequenceOfTicketLinkType affectedTickets;
- @FieldOrder(order = 16)
+ @FieldOrder(order = 15)
@RestrictedString(CharacterRestriction.UTF8String)
@Asn1Optional public String infoText;
- @FieldOrder(order = 17)
+ @FieldOrder(order = 16)
@Asn1Optional public ExtensionData extension;
@@ -163,11 +159,7 @@ public class DelayConfirmation extends Object {
return this.stationIA5;
}
- public String getStationNameUTF8() {
-
- return this.stationNameUTF8;
- }
-
+
public Long getDelay() {
return this.delay;
@@ -255,11 +247,6 @@ public class DelayConfirmation extends Object {
this.stationIA5 = stationIA5;
}
- public void setStationNameUTF8(String stationNameUTF8) {
-
- this.stationNameUTF8 = stationNameUTF8;
- }
-
public void setDelay(Long delay) {
this.delay = delay;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ParkingGroundData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ParkingGroundData.java
index d88d4dd..53cb4c0 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ParkingGroundData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ParkingGroundData.java
@@ -51,10 +51,11 @@ public class ParkingGroundData extends Object {
@FieldOrder(order = 3)
@IntRange(minValue=0,maxValue=370)
- @Asn1Optional public Long fromParkingDate;
+ public Long fromParkingDate;
@FieldOrder(order = 4)
@IntRange(minValue=-1,maxValue=370)
+ @Asn1Default(value = "0")
@Asn1Optional public Long toParkingDate;
@FieldOrder(order = 5)
@@ -86,11 +87,10 @@ public class ParkingGroundData extends Object {
@Asn1Optional public CodeTableType stationCodeTable;
@FieldOrder(order = 12)
- @IntRange(minValue=1,maxValue=9999999)
@Asn1Optional public Long stationNum;
@FieldOrder(order = 13)
- @RestrictedString(CharacterRestriction.IA5String)
+ @RestrictedString(CharacterRestriction.UTF8String)
@Asn1Optional public String stationIA5;
@FieldOrder(order = 14)
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TicketDetailData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TicketDetailData.java
index e32bb98..7a86d56 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TicketDetailData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TicketDetailData.java
@@ -24,6 +24,8 @@ package org.uic.barcode.ticket.api.asn.omv1;
import org.uic.barcode.asn1.datatypes.Choice;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+import org.uic.barcode.ticket.api.asn.omv1.DelayConfirmation;
+import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
@Choice
@HasExtensionMarker
@@ -62,10 +64,10 @@ public class TicketDetailData extends Object {
public StationPassageData stationPassage;
@FieldOrder(order = 10)
- public DelayConfirmation delayConfirmation;
-
+ public ExtensionData extension;
+
@FieldOrder(order = 11)
- public ExtensionData extension;
+ public DelayConfirmation delayConfirmation;
public ReservationData getReservation() {
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ZoneType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ZoneType.java
index a22e002..efe55f7 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ZoneType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/ZoneType.java
@@ -124,6 +124,10 @@ public class ZoneType extends Object {
public byte[] getBinaryZoneId() {
+ if (binaryZoneId == null) {
+ return null;
+ }
+
return binaryZoneId.toByteArray();
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/DelayConfirmation.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/DelayConfirmation.java
index 72abeb0..acf99d5 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/DelayConfirmation.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/DelayConfirmation.java
@@ -84,28 +84,24 @@ public class DelayConfirmation extends Object {
@Asn1Optional public String stationIA5;
@FieldOrder(order = 11)
- @RestrictedString(CharacterRestriction.UTF8String)
- @Asn1Optional public String stationNameUTF8;
+ @IntRange(minValue=1, maxValue=999)
+ public Long delay;
@FieldOrder(order = 12)
- @IntRange(minValue=0, maxValue=999, hasExtensionMarker=false)
- @Asn1Optional public Long delay;
+ public Boolean trainCancelled = false;
@FieldOrder(order = 13)
- @Asn1Optional public Boolean trainCancelled = false;
-
- @FieldOrder(order = 14)
@Asn1Default(value="travelerDelayConfirmation")
@Asn1Optional public ConfirmationTypeType confirmationType;
- @FieldOrder(order = 15)
+ @FieldOrder(order = 14)
@Asn1Optional public SequenceOfTicketLinkType affectedTickets;
- @FieldOrder(order = 16)
+ @FieldOrder(order = 15)
@RestrictedString(CharacterRestriction.UTF8String)
@Asn1Optional public String infoText;
- @FieldOrder(order = 17)
+ @FieldOrder(order = 16)
@Asn1Optional public ExtensionData extension;
@@ -163,11 +159,6 @@ public class DelayConfirmation extends Object {
return this.stationIA5;
}
- public String getStationNameUTF8() {
-
- return this.stationNameUTF8;
- }
-
public Long getDelay() {
return this.delay;
@@ -255,11 +246,6 @@ public class DelayConfirmation extends Object {
this.stationIA5 = stationIA5;
}
- public void setStationNameUTF8(String stationNameUTF8) {
-
- this.stationNameUTF8 = stationNameUTF8;
- }
-
public void setDelay(Long delay) {
this.delay = delay;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ParkingGroundData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ParkingGroundData.java
index b917bf8..efffe52 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ParkingGroundData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ParkingGroundData.java
@@ -51,10 +51,11 @@ public class ParkingGroundData extends Object {
@FieldOrder(order = 3)
@IntRange(minValue=-1,maxValue=370)
- @Asn1Optional public Long fromParkingDate;
+ public Long fromParkingDate;
@FieldOrder(order = 4)
@IntRange(minValue=0,maxValue=370)
+ @Asn1Default(value = "0")
@Asn1Optional public Long toParkingDate;
@FieldOrder(order = 5)
@@ -90,7 +91,7 @@ public class ParkingGroundData extends Object {
@Asn1Optional public Long stationNum;
@FieldOrder(order = 13)
- @RestrictedString(CharacterRestriction.IA5String)
+ @RestrictedString(CharacterRestriction.UTF8String)
@Asn1Optional public String stationIA5;
@FieldOrder(order = 14)
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TicketDetailData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TicketDetailData.java
index 4cdac60..47c48da 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TicketDetailData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TicketDetailData.java
@@ -24,6 +24,8 @@ package org.uic.barcode.ticket.api.asn.omv2;
import org.uic.barcode.asn1.datatypes.Choice;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+import org.uic.barcode.ticket.api.asn.omv2.DelayConfirmation;
+import org.uic.barcode.ticket.api.asn.omv2.ExtensionData;
@Choice
@HasExtensionMarker
@@ -62,10 +64,11 @@ public class TicketDetailData extends Object {
public StationPassageData stationPassage;
@FieldOrder(order = 10)
+ public ExtensionData extension;
+
+ @FieldOrder(order = 11)
public DelayConfirmation delayConfirmation;
- @FieldOrder(order = 11)
- public ExtensionData extension;
public ReservationData getReservation() {
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ZoneType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ZoneType.java
index 3f269ee..db008e5 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ZoneType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ZoneType.java
@@ -124,6 +124,10 @@ public class ZoneType extends Object {
public byte[] getBinaryZoneId() {
+ if (binaryZoneId == null) {
+ return null;
+ }
+
return binaryZoneId.toByteArray();
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/DelayConfirmation.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/DelayConfirmation.java
index 8d8b4c6..daa9429 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/DelayConfirmation.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/DelayConfirmation.java
@@ -84,28 +84,24 @@ public class DelayConfirmation extends Object {
@Asn1Optional public String stationIA5;
@FieldOrder(order = 11)
- @RestrictedString(CharacterRestriction.UTF8String)
- @Asn1Optional public String stationNameUTF8;
+ @IntRange(minValue=1, maxValue=999, hasExtensionMarker=false)
+ public Long delay;
@FieldOrder(order = 12)
- @IntRange(minValue=0, maxValue=999, hasExtensionMarker=false)
- @Asn1Optional public Long delay;
+ public Boolean trainCancelled = false;
@FieldOrder(order = 13)
- @Asn1Optional public Boolean trainCancelled = false;
-
- @FieldOrder(order = 14)
@Asn1Default(value="travelerDelayConfirmation")
@Asn1Optional public ConfirmationTypeType confirmationType;
- @FieldOrder(order = 15)
+ @FieldOrder(order = 14)
@Asn1Optional public SequenceOfTicketLinkType affectedTickets;
- @FieldOrder(order = 16)
+ @FieldOrder(order = 15)
@RestrictedString(CharacterRestriction.UTF8String)
@Asn1Optional public String infoText;
- @FieldOrder(order = 17)
+ @FieldOrder(order = 16)
@Asn1Optional public ExtensionData extension;
@@ -163,11 +159,7 @@ public class DelayConfirmation extends Object {
return this.stationIA5;
}
- public String getStationNameUTF8() {
-
- return this.stationNameUTF8;
- }
-
+
public Long getDelay() {
return this.delay;
@@ -255,11 +247,6 @@ public class DelayConfirmation extends Object {
this.stationIA5 = stationIA5;
}
- public void setStationNameUTF8(String stationNameUTF8) {
-
- this.stationNameUTF8 = stationNameUTF8;
- }
-
public void setDelay(Long delay) {
this.delay = delay;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ParkingGroundData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ParkingGroundData.java
index 53f0bca..90a3568 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ParkingGroundData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ParkingGroundData.java
@@ -51,10 +51,11 @@ public class ParkingGroundData extends Object {
@FieldOrder(order = 3)
@IntRange(minValue=-367,maxValue=370)
- @Asn1Optional public Long fromParkingDate;
+ public Long fromParkingDate;
@FieldOrder(order = 4)
@IntRange(minValue=0,maxValue=370)
+ @Asn1Default(value="0")
@Asn1Optional public Long toParkingDate;
@FieldOrder(order = 5)
@@ -86,11 +87,10 @@ public class ParkingGroundData extends Object {
@Asn1Optional public CodeTableType stationCodeTable;
@FieldOrder(order = 12)
- @IntRange(minValue=1,maxValue=9999999)
@Asn1Optional public Long stationNum;
@FieldOrder(order = 13)
- @RestrictedString(CharacterRestriction.IA5String)
+ @RestrictedString(CharacterRestriction.UTF8String)
@Asn1Optional public String stationIA5;
@FieldOrder(order = 14)
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TicketDetailData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TicketDetailData.java
index a5e2e56..669241c 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TicketDetailData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TicketDetailData.java
@@ -62,10 +62,10 @@ public class TicketDetailData extends Object {
public StationPassageData stationPassage;
@FieldOrder(order = 10)
- public DelayConfirmation delayConfirmation;
-
+ public ExtensionData extension;
+
@FieldOrder(order = 11)
- public ExtensionData extension;
+ public DelayConfirmation delayConfirmation;
public ReservationData getReservation() {
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ZoneType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ZoneType.java
index 3e3f193..8fdd3af 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ZoneType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ZoneType.java
@@ -124,6 +124,9 @@ public class ZoneType extends Object {
public byte[] getBinaryZoneId() {
+ if (binaryZoneId == null) {
+ return null;
+ }
return binaryZoneId.toByteArray();
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/OpenLuggageRestrictionTestTicketV3.java b/src/main/java/org/uic/barcode/ticket/api/test/testtickets/OpenLuggageRestrictionTestTicketV3.java
new file mode 100644
index 0000000..f14acfa
--- /dev/null
+++ b/src/main/java/org/uic/barcode/ticket/api/test/testtickets/OpenLuggageRestrictionTestTicketV3.java
@@ -0,0 +1,518 @@
+/*
+ * This file was generated by openASN.1 - an open source ASN.1 toolkit for java
+ *
+ * openASN.1 is Copyright (C) 2007 Clayton Hoss, Marc Weyland
+ *
+ * openASN.1 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * openASN.1 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with openASN.1. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.uic.barcode.ticket.api.test.testtickets;
+
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfUnrestrictedLong;
+import org.uic.barcode.ticket.api.asn.omv3.CardReferenceType;
+import org.uic.barcode.ticket.api.asn.omv3.ControlData;
+import org.uic.barcode.ticket.api.asn.omv3.CustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv3.DocumentData;
+import org.uic.barcode.ticket.api.asn.omv3.ExtensionData;
+import org.uic.barcode.ticket.api.asn.omv3.IncludedOpenTicketType;
+import org.uic.barcode.ticket.api.asn.omv3.IssuingData;
+import org.uic.barcode.ticket.api.asn.omv3.LinkMode;
+import org.uic.barcode.ticket.api.asn.omv3.OpenTicketData;
+import org.uic.barcode.ticket.api.asn.omv3.PassengerType;
+import org.uic.barcode.ticket.api.asn.omv3.RegionalValidityType;
+import org.uic.barcode.ticket.api.asn.omv3.RegisteredLuggageType;
+import org.uic.barcode.ticket.api.asn.omv3.RouteSectionType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfCardReferenceType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfCustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfDocumentData;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfExtensionData;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfIncludedOpenTicketType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfRegionalValidityType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfRegisteredLuggageType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfTariffType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfTicketLinkType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfTravelerType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfVatDetail;
+import org.uic.barcode.ticket.api.asn.omv3.StationPassageData;
+import org.uic.barcode.ticket.api.asn.omv3.TariffType;
+import org.uic.barcode.ticket.api.asn.omv3.TicketDetailData;
+import org.uic.barcode.ticket.api.asn.omv3.TicketLinkType;
+import org.uic.barcode.ticket.api.asn.omv3.TicketType;
+import org.uic.barcode.ticket.api.asn.omv3.TokenType;
+import org.uic.barcode.ticket.api.asn.omv3.TravelClassType;
+import org.uic.barcode.ticket.api.asn.omv3.TravelerData;
+import org.uic.barcode.ticket.api.asn.omv3.TravelerType;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.asn.omv3.VatDetailType;
+import org.uic.barcode.ticket.api.asn.omv3.ZoneType;
+import org.uic.barcode.ticket.api.asn.omv3.LuggageRestrictionType;
+
+ public class OpenLuggageRestrictionTestTicketV3 {
+
+ public static UicRailTicketData getUicTestTicket() {
+ UicRailTicketData ticket = new UicRailTicketData();
+ populateTicket(ticket);
+ return ticket;
+ }
+
+ /*
+value UicRailTicketData ::= {
+ issuingDetail {
+ issuingYear 2018,
+ issuingDay 1,
+ issuingTime 600,
+ specimen TRUE,
+ securePaperTicket FALSE,
+ activated TRUE,
+ currency "EUR",
+ currencyFract 2,
+ issuerPNR "issuerTestPNR",
+ issuedOnLine 12
+ },
+ travelerDetail {
+ traveler {
+ {
+ firstName "John",
+ secondName "Dow",
+ idCard "12345",
+ ticketHolder TRUE,
+ status {
+ {
+ customerStatusDescr "senior"
+ }
+ }
+ }
+ },
+ groupName "myGroup"
+ },
+ transportDocument {
+ {
+ token {
+ tokenProviderIA5 "VDV",
+ token '82DA'H
+ },
+ ticket openTicket : {
+ returnIncluded FALSE,
+ stationCodeTable stationUIC,
+ validFromDay 0,
+ validUntilDay 0,
+ classCode first,
+ vatDetail {
+ {
+ country 80,
+ percentage 70,
+ amount 10,
+ vatId "IUDGTE"
+ }
+ },
+ infoText "openTicketInfo",
+ includedAddOns {
+ {
+ productOwnerNum 1080,
+ stationCodeTable stationUIC,
+ validRegion {
+ zones : {
+ stationCodeTable stationUIC,
+ zoneId {
+ 100
+ }
+ }
+ },
+ validFromDay 0,
+ validFromTime 1000,
+ validUntilDay 1,
+ validUntilTime 1000,
+ classCode second,
+ tariffs {
+ {
+ numberOfPassengers 2,
+ passengerType adult,
+ restrictedToCountryOfResidence FALSE,
+ restrictedToRouteSection {
+ stationCodeTable stationUIC,
+ fromStationNum 8000001,
+ toStationNum 8010000
+ }
+ }
+ },
+ infoText "included ticket"
+ }
+ },
+ luggage {
+ maxHandLuggagePieces 2,
+ maxNonHandLuggagePieces 1,
+ registeredLuggage {
+ {
+ registrationId "IODHUV",
+ maxWeight 20,
+ maxSize 100
+ },
+ {
+ registrationId "XXDHUV",
+ maxWeight 21,
+ maxSize 101
+ }
+ }
+ }
+ }
+ },
+ {
+ ticket stationPassage : {
+ productName "passage",
+ stationCodeTable stationUIC,
+ stationNameUTF8 {
+ "Amsterdam"
+ },
+ validFromDay 0,
+ validUntilDay 0,
+ numberOfDaysValid 123
+ }
+ }
+ },
+ controlDetail {
+ identificationByCardReference {
+ {
+ trailingCardIdNum 100
+ }
+ },
+ identificationByIdCard FALSE,
+ identificationByPassportId FALSE,
+ passportValidationRequired FALSE,
+ onlineValidationRequired FALSE,
+ ageCheckRequired FALSE,
+ reductionCardCheckRequired FALSE,
+ infoText "cd",
+ includedTickets {
+ {
+ referenceIA5 "UED12435867",
+ issuerName "OEBB",
+ issuerPNR "PNR",
+ productOwnerIA5 "test",
+ ticketType pass,
+ linkMode onlyValidInCombination
+ }
+ }
+ },
+ extension {
+ {
+ extensionId "1",
+ extensionData '82DA'H
+ },
+ {
+ extensionId "2",
+ extensionData '83DA'H
+ }
+ }
+}
+
+ */
+
+
+
+ public static String getEncodingHex() {
+ return
+ "7804404004B14374F3E7D72F2A9979F4A13A90086280B4001044A6F686"
+ + "E03446F770562C99B46B01106E797769DFC81DB5E51DC9BDD5C00940"
+ + "75A2560282DA1000000101E0101C4F11804281A4D5891EA450E6F706"
+ + "56E5469636B6574496E666F0140AD06021B8090020080B23E8013E81"
+ + "00B10008143D09003D1C8787B4B731B63AB232B2103A34B1B5B2BA28"
+ + "202706933E248AB58998DC1AC588922AD62864120220103B830B9B9B"
+ + "0B3B28084A0B6B9BA32B93230B696F017B4C0200805900026364015B"
+ + "85D58B118B268CDAB86CDC113D1509080E84EA409D32F3E850201620"
+ + "505B402C80A0F680";
+
+ }
+
+
+
+ private static void populateTicket(UicRailTicketData ticket) {
+
+ ticket.setControlDetail(new ControlData());
+ populate(ticket.getControlDetail());
+
+
+ ticket.setIssuingDetail(new IssuingData());
+ populateIssuingData(ticket.getIssuingDetail());
+
+ TravelerData td = new TravelerData();
+ populateTravelerData(td);
+ ticket.setTravelerDetail(td);
+
+ SequenceOfDocumentData ds = new SequenceOfDocumentData();
+
+
+ //OpenTicket
+ DocumentData do1 = new DocumentData();
+ addOpenTicketData(do1);
+ ds.add(do1);
+
+ //StationPassage
+ DocumentData do2 = new DocumentData();
+ addStationPassage(do2);
+ ds.add(do2);
+
+ ticket.setTransportDocument(ds);
+
+ SequenceOfExtensionData ed = new SequenceOfExtensionData();
+ populateExtensionSequence(ed);
+ ticket.setExtension(ed);
+
+ }
+
+ private static void addStationPassage(DocumentData dd) {
+ TicketDetailData tdd = new TicketDetailData();
+ StationPassageData sp = new StationPassageData();
+ sp.setProductName("passage");
+ sp.setValidFromDay(0L);
+ sp.setNumberOfDaysValid(123L);
+ SequenceOfStringUTF8 ss = new SequenceOfStringUTF8();
+ ss.add("Amsterdam");
+ sp.setStationNameUTF8(ss);
+ tdd.setStationPassage(sp);
+ dd.setTicket(tdd);
+ }
+
+ /*
+ *
+ * returnIncluded FALSE
+ ,classCode first
+ ,vatDetail {
+ { country 80
+ ,percentage 70
+ ,amount 10
+ ,vatId "IUDGTE"
+ }
+ }
+ ,infoText "openTicketInfo"
+ */
+ private static void addOpenTicketData(DocumentData dd) {
+ TokenType to = new TokenType();
+ to.setTokenProviderIA5("VDV");
+ byte[] ba = { (byte) 0x82, (byte) 0xDA };
+ to.setToken(ba);
+ dd.setToken(to);
+
+ TicketDetailData tdd = new TicketDetailData();
+ OpenTicketData otd = new OpenTicketData();
+ otd.setInfoText("openTicketInfo");
+ otd.setClassCode(TravelClassType.first);
+ otd.setReturnIncluded(false);
+
+ otd.setIncludedAddOns(new SequenceOfIncludedOpenTicketType());
+ otd.getIncludedAddOns().add(getIncludedOpenTicket());
+
+ otd.setVatDetails(new SequenceOfVatDetail());
+ otd.getVatDetails().add(getVatDetail());
+
+ otd.setLuggage(getLuggage());
+
+ tdd.setOpenTicket(otd);
+ dd.setTicket(tdd);
+
+ }
+
+ private static LuggageRestrictionType getLuggage() {
+ LuggageRestrictionType l = new LuggageRestrictionType();
+ l.setMaxHandLuggagePieces(2L);
+ l.setMaxNonHandLuggagePieces(1L);
+ l.setRegisteredLuggage(getRegisteredLuggage());
+ return l;
+ }
+
+ private static SequenceOfRegisteredLuggageType getRegisteredLuggage() {
+ SequenceOfRegisteredLuggageType sl = new SequenceOfRegisteredLuggageType();
+ sl.add(getRegisteredLuggage1());
+ sl.add(getRegisteredLuggage2());
+ return sl;
+ }
+
+ private static RegisteredLuggageType getRegisteredLuggage1() {
+ RegisteredLuggageType rl = new RegisteredLuggageType();
+ rl.setMaxSize(100L);
+ rl.setMaxWeight(20L);
+ rl.setRegistrationId("IODHUV");
+ return rl;
+ }
+
+ private static RegisteredLuggageType getRegisteredLuggage2() {
+ RegisteredLuggageType rl = new RegisteredLuggageType();
+ rl.setMaxSize(101L);
+ rl.setMaxWeight(21L);
+ rl.setRegistrationId("XXDHUV");
+ return rl;
+ }
+
+ private static VatDetailType getVatDetail() {
+ VatDetailType v = new VatDetailType();
+ v.setAmount(10L);
+ v.setCountry(80L);
+ v.setPercentage(70L);
+ v.setVatId("IUDGTE");
+ return v;
+ }
+
+ /*
+ { productOwnerNum 1080
+ ,validRegion { zones : { zoneId { 100 } } }
+ ,validFromDay 0
+ ,validFromTime 1000
+ ,validUntilDay 1
+ ,validUntilTime 1000
+ ,classCode second
+ ,tariffs {
+ { numberOfPassengers 2
+ ,passengerType adult
+ ,restrictedToCountryOfResidence FALSE
+ ,restrictedToRouteSection { fromStationNum 8000001 , toStationNum 8010000 }
+ }
+ }
+ ,infoText "included ticket"
+ }
+ */
+
+ private static IncludedOpenTicketType getIncludedOpenTicket() {
+ IncludedOpenTicketType t = new IncludedOpenTicketType();
+ t.setClassCode(TravelClassType.second);
+ t.setInfoText("included ticket");
+ t.setProductOwnerNum(1080L);
+ t.setValidRegion(new SequenceOfRegionalValidityType());
+ t.getValidRegion().add(getZone());
+ t.setValidFromDay(0L);
+ t.setValidFromTime(1000L);
+ t.setValidUntilDay(1L);
+ t.setValidUntilTime(1000L);
+ t.setTariffs(new SequenceOfTariffType());
+ t.getTariffs().add(getTariff());
+ return t;
+ }
+
+
+
+
+ private static RegionalValidityType getZone() {
+
+ RegionalValidityType r = new RegionalValidityType();
+ ZoneType z = new ZoneType();
+ z.setZoneId(new SequenceOfUnrestrictedLong());
+ z.getZoneId().add(100L);
+ r.setZones(z);
+ return r;
+ }
+
+ private static void populateTravelerData(TravelerData td) {
+ td.setGroupName("myGroup");
+ SequenceOfTravelerType trs = new SequenceOfTravelerType();
+ TravelerType tr = new TravelerType();
+ tr.setIdCard("12345");
+ tr.setFirstName("John");
+ tr.setSecondName("Dow");
+ tr.setTicketHolder(true);
+ SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
+ CustomerStatusType cst = new CustomerStatusType();
+ cst.setCustomerStatusDescr("senior");
+ ts.add(cst);
+ tr.setStatus(ts);
+ trs.add(tr);
+ td.setTraveler(trs);
+ }
+
+/*
+
+ */
+ private static void populateIssuingData(IssuingData issuingDetail) {
+ issuingDetail.setIssuingYear(2018L);
+ issuingDetail.setIssuingDay(1L);
+ issuingDetail.setIssuingTime(600L);
+ issuingDetail.setIssuerPNR("issuerTestPNR");
+ issuingDetail.setSpecimen(true);
+ issuingDetail.setSecurePaperTicket(false);
+ issuingDetail.setActivated(true);
+ issuingDetail.setIssuedOnLine(12L);
+ }
+
+
+ private static void populateExtensionSequence(SequenceOfExtensionData ed) {
+ ExtensionData ed1 = new ExtensionData();
+ ed1.setExtensionId("1");
+ byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
+ ed1.setExtensionData(ba1);
+ ExtensionData ed2 = new ExtensionData();
+ ed2.setExtensionId("2");
+ byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
+ ed2.setExtensionData(ba2);
+ ed.add(ed1);
+ ed.add(ed2);
+ }
+
+
+ private static void populate(ControlData controlDetail) {
+ controlDetail.infoText = "cd";
+ controlDetail.setAgeCheckRequired(false);
+ controlDetail.setIdentificationByIdCard(false);
+ controlDetail.setIdentificationByPassportId(false);
+ controlDetail.setOnlineValidationRequired(false);
+ controlDetail.setPassportValidationRequired(false);
+ controlDetail.setReductionCardCheckRequired(false);
+ controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
+ controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
+ SequenceOfTicketLinkType sit = new SequenceOfTicketLinkType();
+ populateLinkedTickets(sit);
+ controlDetail.setIncludedTickets(sit);
+ }
+
+
+ /*
+ *
+ */
+ private static void populateLinkedTickets(SequenceOfTicketLinkType sequenceOfTicketLinkType) {
+ TicketLinkType tlt = new TicketLinkType();
+ tlt.productOwnerIA5="test";
+ tlt.setTicketType(TicketType.pass);
+ tlt.setIssuerPNR("PNR");
+ tlt.setReferenceIA5("UED12435867");
+ tlt.setLinkMode(LinkMode.onlyValidInCombination);
+ tlt.setIssuerName("OEBB");
+ sequenceOfTicketLinkType.add(tlt);
+ }
+
+ /*
+ {
+ trailingCardIdNum 100
+ }
+ */
+ private static CardReferenceType populateCardRefrence() {
+ CardReferenceType cr = new CardReferenceType();
+ cr.setTrailingCardIdNum(100L);
+ return cr;
+ }
+
+ private static TariffType getTariff() {
+ TariffType t = new TariffType();
+ t.setNumberOfPassengers(2L);
+ t.setPassengerType(PassengerType.adult);
+ t.setRestrictedToRouteSection(getRouteSection());
+ t.setRestrictedToCountryOfResidence(false);
+ return t;
+ }
+
+ private static RouteSectionType getRouteSection() {
+ RouteSectionType r = new RouteSectionType();
+ r.setFromStationNum(8000001L);
+ r.setToStationNum(8010000L);
+
+ return r;
+ }
+
+ }
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 cab9b53..f4b9569 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
@@ -319,9 +319,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
asnData.setInfoText(document.getInfoText());
-
- asnData.setStationNameUTF8(document.getStationName());
-
+
asnData.setExtension(encodeExtension(document.getExtension()));
return asnDocument;
@@ -977,7 +975,9 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
}
}
-
+ asnData.setGroupName(document.getGroupName());
+ asnData.setNumberOfCountermark(new Long(document.getNumberOfCountermark()));
+ asnData.setTotalOfCountermarks(new Long(document.getTotalOfCountermarks()));
asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
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 184dfd7..6bffddc 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
@@ -317,8 +317,6 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setInfoText(document.getInfoText());
- asnData.setStationNameUTF8(document.getStationName());
-
asnData.setExtension(encodeExtension(document.getExtension()));
return asnDocument;
@@ -981,7 +979,9 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
}
}
-
+ asnData.setGroupName(document.getGroupName());
+ asnData.setNumberOfCountermark(new Long(document.getNumberOfCountermark()));
+ asnData.setTotalOfCountermarks(new Long(document.getTotalOfCountermarks()));
asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
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 9084d7a..6766f59 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
@@ -320,7 +320,6 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
asnData.setInfoText(document.getInfoText());
- asnData.setStationNameUTF8(document.getStationName());
asnData.setExtension(encodeExtension(document.getExtension()));
@@ -984,6 +983,9 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
}
}
+ asnData.setGroupName(document.getGroupName());
+ asnData.setNumberOfCountermark(new Long(document.getNumberOfCountermark()));
+ asnData.setTotalOfCountermarks(new Long(document.getTotalOfCountermarks()));
asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoder.java b/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoder.java
index bf3918c..031d5b3 100644
--- a/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoder.java
+++ b/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoder.java
@@ -366,9 +366,7 @@ public class OpenAsn2ApiDecoder implements Asn2ApiDecoder {
document.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
}
document.setStation(UicEncoderUtils.mapToString(asnDocument.getStationNum(),asnDocument.getStationIA5()));
-
- document.setStationName(asnDocument.getStationNameUTF8());
-
+
document.setArrivalDate(asnDocument.getPlannedArrivalDate());
document.setArrivalUTCoffset(asnDocument.getDepartureUTCOffset());
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 fc68f91..1d50cb8 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
@@ -368,9 +368,7 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
document.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().toString()));
}
document.setStation(UicEncoderUtils.mapToString(asnDocument.getStationNum(),asnDocument.getStationIA5()));
-
- document.setStationName(asnDocument.getStationNameUTF8());
-
+
document.setArrivalDate(asnDocument.getPlannedArrivalDate());
document.setArrivalUTCoffset(asnDocument.getDepartureUTCOffset());
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV3.java b/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV3.java
index 56efcb1..73971c9 100644
--- a/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV3.java
+++ b/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV3.java
@@ -371,9 +371,7 @@ public class OpenAsn2ApiDecoderV3 implements Asn2ApiDecoder {
document.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().toString()));
}
document.setStation(UicEncoderUtils.mapToString(asnDocument.getStationNum(),asnDocument.getStationIA5()));
-
- document.setStationName(asnDocument.getStationNameUTF8());
-
+
document.setArrivalDate(asnDocument.getPlannedArrivalDate());
document.setArrivalUTCoffset(asnDocument.getDepartureUTCOffset());