summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/uic/barcode/ticket
diff options
context:
space:
mode:
authorCGantert345 <57003061+CGantert345@users.noreply.github.com>2021-06-29 14:59:45 +0200
committerCGantert345 <57003061+CGantert345@users.noreply.github.com>2021-06-29 14:59:45 +0200
commit67bd1413dc47ec37a9ba042949973eff0a5045fd (patch)
tree3e9718717fb9219aa02ac826dc2495c3941ac373 /src/main/java/org/uic/barcode/ticket
parent- option to use a dedicated security provider implementation (diff)
downloadUIC-barcode-67bd1413dc47ec37a9ba042949973eff0a5045fd.tar
UIC-barcode-67bd1413dc47ec37a9ba042949973eff0a5045fd.tar.gz
UIC-barcode-67bd1413dc47ec37a9ba042949973eff0a5045fd.tar.bz2
UIC-barcode-67bd1413dc47ec37a9ba042949973eff0a5045fd.tar.lz
UIC-barcode-67bd1413dc47ec37a9ba042949973eff0a5045fd.tar.xz
UIC-barcode-67bd1413dc47ec37a9ba042949973eff0a5045fd.tar.zst
UIC-barcode-67bd1413dc47ec37a9ba042949973eff0a5045fd.zip
Diffstat (limited to 'src/main/java/org/uic/barcode/ticket')
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv3/OpenTicketData.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv3/PassData.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv3/TrainValidityType.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/Api2AsnEncoder.java13
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java10
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV3.java13
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/Asn2ApiDecoder.java13
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoder.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV3.java2
11 files changed, 49 insertions, 14 deletions
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/OpenTicketData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/OpenTicketData.java
index 87e3f36..fa4208c 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/OpenTicketData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/OpenTicketData.java
@@ -35,7 +35,7 @@ import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypes.SizeRange;
import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfActivatedDays;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfActivatedDays;
import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@Sequence
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/PassData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/PassData.java
index 5334761..e4c42a6 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/PassData.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/PassData.java
@@ -34,7 +34,7 @@ import org.uic.barcode.asn1.datatypes.IntRange;
import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfActivatedDays;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfActivatedDays;
import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@Sequence
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TrainValidityType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TrainValidityType.java
index 8f75dc9..88e5614 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TrainValidityType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TrainValidityType.java
@@ -25,12 +25,14 @@ import java.util.List;
import org.uic.barcode.asn1.datatypes.Asn1Default;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
import org.uic.barcode.asn1.datatypes.IntRange;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@Sequence
+@HasExtensionMarker
public class TrainValidityType extends Object {
public TrainValidityType() {
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/Api2AsnEncoder.java b/src/main/java/org/uic/barcode/ticket/api/utils/Api2AsnEncoder.java
new file mode 100644
index 0000000..11052b0
--- /dev/null
+++ b/src/main/java/org/uic/barcode/ticket/api/utils/Api2AsnEncoder.java
@@ -0,0 +1,13 @@
+package org.uic.barcode.ticket.api.utils;
+
+import org.uic.barcode.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
+
+public abstract interface Api2AsnEncoder {
+
+
+ public byte[] encode(IUicRailTicket uicTicket) throws EncodingFormatException;
+
+
+}
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 3f781ef..cab9b53 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
@@ -151,7 +151,7 @@ import org.uic.barcode.ticket.api.spec.IZone;
/**
* The Class Api2OpenAsnEncoder.
*/
-public class Api2OpenAsnEncoder {
+public class Api2OpenAsnEncoder implements Api2AsnEncoder {
/**
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 61bdba1..184dfd7 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
@@ -152,7 +152,7 @@ import org.uic.barcode.ticket.api.spec.IZone;
/**
* The Class Api2OpenAsnEncoder.
*/
-public class Api2OpenAsnEncoderV2 {
+public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
/**
* encode to asn1 model.
@@ -1512,9 +1512,13 @@ public class Api2OpenAsnEncoderV2 {
asnData.setValidity(document.getValidFrom(), document.getValidUntil());
- asnData.setType(UicEncoderUtils.getRestrictedInt(document.getType(), 1,9999));
+ if (document.getType() != null) {
+ asnData.setType(UicEncoderUtils.getRestrictedInt(document.getType(), 1,32000));
+ }
- asnData.setValue(UicEncoderUtils.getRestrictedInt(document.getAmount(),1,9999999));
+ if (document.getAmount() != null) {
+ asnData.setValue(UicEncoderUtils.getRestrictedInt(document.getAmount(),1,9999999));
+ }
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 83406e8..9084d7a 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
@@ -155,7 +155,7 @@ import org.uic.barcode.ticket.api.spec.IZone;
/**
* The Class Api2OpenAsnEncoder.
*/
-public class Api2OpenAsnEncoderV3 {
+public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
/**
* encode to asn1 model.
@@ -1500,8 +1500,7 @@ public class Api2OpenAsnEncoderV3 {
DocumentData asnDocument = new DocumentData();
TicketDetailData asnTicket = new TicketDetailData();
asnDocument.setTicket(asnTicket);
-
-
+
VoucherData asnData = new VoucherData();
asnDocument.getTicket().setVoucher(asnData);
@@ -1518,9 +1517,13 @@ public class Api2OpenAsnEncoderV3 {
asnData.setValidity(document.getValidFrom(), document.getValidUntil());
- asnData.setType(UicEncoderUtils.getRestrictedInt(document.getType(), 1,9999));
+ if (document.getType() != null) {
+ asnData.setType(UicEncoderUtils.getRestrictedInt(document.getType(), 1,32000));
+ }
- asnData.setValue(UicEncoderUtils.getRestrictedInt(document.getAmount(),1,9999999));
+ if (document.getAmount() != null) {
+ asnData.setValue(UicEncoderUtils.getRestrictedInt(document.getAmount(),1,9999999));
+ }
return asnDocument;
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/Asn2ApiDecoder.java b/src/main/java/org/uic/barcode/ticket/api/utils/Asn2ApiDecoder.java
new file mode 100644
index 0000000..e751f48
--- /dev/null
+++ b/src/main/java/org/uic/barcode/ticket/api/utils/Asn2ApiDecoder.java
@@ -0,0 +1,13 @@
+package org.uic.barcode.ticket.api.utils;
+
+import java.io.IOException;
+
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
+
+public interface Asn2ApiDecoder {
+
+
+ public IUicRailTicket decodeFromAsn (byte[] data) throws IOException;
+
+
+}
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 d203487..bf3918c 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
@@ -118,7 +118,7 @@ import org.uic.barcode.ticket.api.spec.IZone;
/**
* The Class OpenAsn2ApiDecoder.
*/
-public class OpenAsn2ApiDecoder {
+public class OpenAsn2ApiDecoder implements Asn2ApiDecoder {
IUicTicketObjectFactory factory = SimpleUicTicketObjectFactory.getInstance();
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 b8ee363..fc68f91 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
@@ -118,7 +118,7 @@ import org.uic.barcode.ticket.api.spec.IZone;
/**
* The Class OpenAsn2ApiDecoder.
*/
-public class OpenAsn2ApiDecoderV2 {
+public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
IUicTicketObjectFactory factory = SimpleUicTicketObjectFactory.getInstance();
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 36622fc..56efcb1 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
@@ -121,7 +121,7 @@ import org.uic.barcode.ticket.api.spec.IZone;
/**
* The Class OpenAsn2ApiDecoder.
*/
-public class OpenAsn2ApiDecoderV3 {
+public class OpenAsn2ApiDecoderV3 implements Asn2ApiDecoder {
IUicTicketObjectFactory factory = SimpleUicTicketObjectFactory.getInstance();