diff options
author | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2021-02-25 11:02:26 +0100 |
---|---|---|
committer | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2021-02-25 11:02:26 +0100 |
commit | 425bd35c736b7e1c0dbe5b3f9162e195b3be6018 (patch) | |
tree | bc4668aa125fb0a15518d464a1738c6b05e56d07 /src/org/uic/barcode | |
parent | issuerOnLine changed from int to Integer as it is optional (diff) | |
download | UIC-barcode-425bd35c736b7e1c0dbe5b3f9162e195b3be6018.tar UIC-barcode-425bd35c736b7e1c0dbe5b3f9162e195b3be6018.tar.gz UIC-barcode-425bd35c736b7e1c0dbe5b3f9162e195b3be6018.tar.bz2 UIC-barcode-425bd35c736b7e1c0dbe5b3f9162e195b3be6018.tar.lz UIC-barcode-425bd35c736b7e1c0dbe5b3f9162e195b3be6018.tar.xz UIC-barcode-425bd35c736b7e1c0dbe5b3f9162e195b3be6018.tar.zst UIC-barcode-425bd35c736b7e1c0dbe5b3f9162e195b3be6018.zip |
Diffstat (limited to '')
404 files changed, 61425 insertions, 91 deletions
diff --git a/src/org/uic/barcode/Decoder.java b/src/org/uic/barcode/Decoder.java index b7fec33..fe53ed0 100644 --- a/src/org/uic/barcode/Decoder.java +++ b/src/org/uic/barcode/Decoder.java @@ -17,9 +17,9 @@ import org.uic.barcode.staticFrame.StaticFrame; import org.uic.barcode.staticFrame.UFLEXDataRecord;
import org.uic.barcode.staticFrame.UTLAYDataRecord;
import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout;
-import org.uic.ticket.EncodingFormatException;
-import org.uic.ticket.UicRailTicketCoder;
-import org.uic.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.UicRailTicketCoder;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
/**
diff --git a/src/org/uic/barcode/Encoder.java b/src/org/uic/barcode/Encoder.java index cd6004e..aafe5cc 100644 --- a/src/org/uic/barcode/Encoder.java +++ b/src/org/uic/barcode/Encoder.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.security.PrivateKey;
import java.security.PublicKey;
+import org.uic.barcode.asn1.datatypesimpl.OctetString;
import org.uic.barcode.dynamicFrame.Constants;
import org.uic.barcode.dynamicFrame.DataType;
import org.uic.barcode.dynamicFrame.DynamicFrame;
@@ -15,11 +16,9 @@ import org.uic.barcode.staticFrame.UFLEXDataRecord; import org.uic.barcode.staticFrame.UHEADDataRecord;
import org.uic.barcode.staticFrame.UTLAYDataRecord;
import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout;
-import org.uic.ticket.EncodingFormatException;
-import org.uic.ticket.UicRailTicketCoder;
-import org.uic.ticket.api.spec.IUicRailTicket;
-
-import net.gcdc.asn1.datatypesimpl.OctetString;
+import org.uic.barcode.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.UicRailTicketCoder;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
/**
diff --git a/src/org/uic/barcode/asn1/datatypes/Alphabet.java b/src/org/uic/barcode/asn1/datatypes/Alphabet.java new file mode 100644 index 0000000..2b153ae --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/Alphabet.java @@ -0,0 +1,20 @@ +package org.uic.barcode.asn1.datatypes; + +/** + * Alphabet class for Restricted Strings. + * + * Use {@link AlphabetBuilder} for convenient construction of restriction alphabets. + */ +public abstract class Alphabet { + + private final String chars; + + protected Alphabet(String chars) { + this.chars = chars; + } + + public final String chars() { + return chars; + } + +} diff --git a/src/org/uic/barcode/asn1/datatypes/AlphabetBuilder.java b/src/org/uic/barcode/asn1/datatypes/AlphabetBuilder.java new file mode 100644 index 0000000..b768897 --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/AlphabetBuilder.java @@ -0,0 +1,32 @@ +package org.uic.barcode.asn1.datatypes; + + +public class AlphabetBuilder { + + private final StringBuilder sb = new StringBuilder(); + + public AlphabetBuilder() {} + + public String chars() { + return sb.toString(); + } + + public AlphabetBuilder withRange(char from, char to) { + for (char c = from; c <= to; c++) { + sb.append(c); + } + return this; + } + + public AlphabetBuilder withChars(String str) { + sb.append(str); + return this; + } + + public AlphabetBuilder withChars(Character... chars) { + for (char c : chars) { + sb.append(c); + } + return this; + } +} diff --git a/src/org/uic/barcode/asn1/datatypes/Asn1AnonymousType.java b/src/org/uic/barcode/asn1/datatypes/Asn1AnonymousType.java new file mode 100644 index 0000000..b1b0499 --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/Asn1AnonymousType.java @@ -0,0 +1,15 @@ +package org.uic.barcode.asn1.datatypes; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +/** + * This annotation indicates that the class is not present in the original ASN.1 declaration. + * This happens when SEQUENCE members have restrictions (ranges, alphabets etc). + * + * This annotation plays no role in the UPER encoding. + * + */ +@Target({ElementType.TYPE}) +public @interface Asn1AnonymousType { + +} diff --git a/src/org/uic/barcode/asn1/datatypes/Asn1BigInteger.java b/src/org/uic/barcode/asn1/datatypes/Asn1BigInteger.java new file mode 100644 index 0000000..4adca22 --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/Asn1BigInteger.java @@ -0,0 +1,72 @@ +package org.uic.barcode.asn1.datatypes; + +import java.math.BigInteger; + +//outdated: use BigInteger +public class Asn1BigInteger { + + private final BigInteger value; + + public Asn1BigInteger(final BigInteger value) { + this.value = value; + } + + @Override public String toString() { + return "" + value; + } + + public BigInteger value() { return value; } + + public Long longValue() { + return value.longValue(); + } + + public Integer intValue() { + return value.intValue(); + } + + public Asn1BigInteger(Long num) { + this.value = BigInteger.valueOf(num); + } + + public Asn1BigInteger(long num) { + this.value = BigInteger.valueOf(num); + } + + public Asn1BigInteger(Integer num) { + this.value = BigInteger.valueOf(num); + } + + public Asn1BigInteger(int num) { + this.value = BigInteger.valueOf(num); + } + + public static Long toLong(Asn1BigInteger object) { + if (object == null) return null; + return object.longValue(); + } + + public static Asn1BigInteger toAsn1(Long object) { + if (object == null) return null; + return new Asn1BigInteger(object); + } + + public static Asn1BigInteger toAsn1(Integer object) { + if (object == null) return null; + return new Asn1BigInteger(object); + } + + public Long toLong(){ + if (this.value != null) { + return this.value.longValue(); + } + return null; + } + + public BigInteger toBigInteger(){ + return value; + } + + + +} diff --git a/src/org/uic/barcode/asn1/datatypes/Asn1Default.java b/src/org/uic/barcode/asn1/datatypes/Asn1Default.java new file mode 100644 index 0000000..bf5cfff --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/Asn1Default.java @@ -0,0 +1,12 @@ +package org.uic.barcode.asn1.datatypes; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE, ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface Asn1Default { + String value(); +} diff --git a/src/org/uic/barcode/asn1/datatypes/Asn1Integer.java b/src/org/uic/barcode/asn1/datatypes/Asn1Integer.java new file mode 100644 index 0000000..e12f8ec --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/Asn1Integer.java @@ -0,0 +1,56 @@ +package org.uic.barcode.asn1.datatypes; + + + +//outdated: use BigInteger +public class Asn1Integer { + + public long value; + + public Asn1Integer() {} + public Asn1Integer(long value) { + this.value = value; + } + + public Long value() { return value; } + + @Override public String toString() { + return "" + value; + } + + public Long longObject () { + return new Long(value()); + } + + public Asn1Integer(Long num) { + this.value = num; + } + + + public Asn1Integer(Integer num) { + this.value = num; + } + + public Asn1Integer(int num) { + this.value = num; + } + + public static Long toLong(Asn1Integer object) { + if (object == null) return null; + return object.value(); + } + + + public static Asn1Integer toAsn1(Long object) { + if (object == null) return null; + return new Asn1Integer(object); + } + + + + + + + + +} diff --git a/src/org/uic/barcode/asn1/datatypes/Asn1Optional.java b/src/org/uic/barcode/asn1/datatypes/Asn1Optional.java new file mode 100644 index 0000000..71946ec --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/Asn1Optional.java @@ -0,0 +1,20 @@ +package org.uic.barcode.asn1.datatypes; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Indicates that the field is OPTIONAL in ASN.1. Implemented as null. Equivalent to @Nullable. + * + * Using Optional<T> would require Manifests to capture generics (like in Gson). + * + */ +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface Asn1Optional { + +} diff --git a/src/org/uic/barcode/asn1/datatypes/Asn1SequenceOf.java b/src/org/uic/barcode/asn1/datatypes/Asn1SequenceOf.java new file mode 100644 index 0000000..4924b50 --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/Asn1SequenceOf.java @@ -0,0 +1,70 @@ +package org.uic.barcode.asn1.datatypes; + +import java.lang.reflect.ParameterizedType; +import java.util.*; + +import org.uic.barcode.logger.Logger; +import org.uic.barcode.logger.LoggerFactory; + + +/** + * Class to represent ASN.1 construct "SEQUENCE OF". + * <p/> + * Extending classes should specify concrete types for T, generic collections can't be decoded (yet?). + * <p/> + * Usage example: + * <PRE> + * <code> + * {@literal @}Sequence + * public class Person { + * {@literal @}IntRange(minValue=0, maxValue=100, hasExtensionMarker=true) + * int age; + * Children children; + * } + * public class Children extends {@code Asn1SequenceOf<ChildInformation> } { + * public Children() { super(); } + * public Children({@code Collection<ChildInformation>} coll) { super(coll); } + * } + * </code> + * </PRE> + * + * <p/> + * Actually, UPER decoder and encoder consider anything that extends {@code List<T>} as a SEQUENCE OF. + * + * + * @param <T> type of elements contained. + */ +public abstract class Asn1SequenceOf<T> extends AbstractList<T> { + private final static Logger logger = LoggerFactory.getLogger("asnLogger"); + + private final List<T> bakingList; + + @Override public T get(int index) { return bakingList.get(index); } + @Override public int size() { return bakingList.size(); } + @Override public boolean add (T e){ return bakingList.add(e);} + + public Asn1SequenceOf() { this(new ArrayList<T>()); } + public Asn1SequenceOf(Collection<T> coll) { + logger.debug(String.format("Instantiating Sequence Of %s with %s", + ((ParameterizedType)getClass().getGenericSuperclass()).getActualTypeArguments()[0], + coll)); + bakingList = new ArrayList<>(coll); + } + + + + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + Asn1SequenceOf<?> that = (Asn1SequenceOf<?>) o; + return Objects.equals(bakingList, that.bakingList); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), bakingList); + } +} diff --git a/src/org/uic/barcode/asn1/datatypes/Asn1String.java b/src/org/uic/barcode/asn1/datatypes/Asn1String.java new file mode 100644 index 0000000..fb80b92 --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/Asn1String.java @@ -0,0 +1,17 @@ +package org.uic.barcode.asn1.datatypes; + +public class Asn1String { + + private String value; + + public Asn1String() { this(""); } + + public Asn1String(String value) { + this.value = value; + } + + @Override public String toString() { return value; } + + public String value() { return value; } + +} diff --git a/src/org/uic/barcode/asn1/datatypes/Asn1VarSizeBitstring.java b/src/org/uic/barcode/asn1/datatypes/Asn1VarSizeBitstring.java new file mode 100644 index 0000000..c07f7f0 --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/Asn1VarSizeBitstring.java @@ -0,0 +1,58 @@ +package org.uic.barcode.asn1.datatypes; + +import java.util.AbstractList; +import java.util.BitSet; +import java.util.Collection; +import java.util.Objects; + +/** + * Convenience class for Bitstrings of variable size. + * For UPER, {@code List<Boolean>} works just as well. + */ +public class Asn1VarSizeBitstring extends AbstractList<Boolean> { + + private final BitSet backing; + + @Override public Boolean get(int index) { + return backing.get(index); + } + + @Override public int size() { + return backing.length(); + } + + public Asn1VarSizeBitstring(Collection<Boolean> coll) { + backing = new BitSet(); + int bitIndex = 0; + for (Boolean b : coll) { + backing.set(bitIndex, b); + bitIndex++; + } + } + + public Asn1VarSizeBitstring(BitSet bitset) { + backing = (BitSet) bitset.clone(); + } + + protected void setBit(int bitIndex, boolean value) { + backing.set(bitIndex, value); + } + + public boolean getBit(int bitIndex) { + return backing.get(bitIndex); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + Asn1VarSizeBitstring booleen = (Asn1VarSizeBitstring) o; + return Objects.equals(backing, booleen.backing); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), backing); + } +} diff --git a/src/org/uic/barcode/asn1/datatypes/Bitstring.java b/src/org/uic/barcode/asn1/datatypes/Bitstring.java new file mode 100644 index 0000000..1543f64 --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/Bitstring.java @@ -0,0 +1,16 @@ +package org.uic.barcode.asn1.datatypes; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** This annotation is used for bitstrings. + * In UPER, a SEQUENCE OF Booleans would look exactly as bitstring, so this annotation can be + * omitted for {@code List<Boolean>}. + */ +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface Bitstring { + +} diff --git a/src/org/uic/barcode/asn1/datatypes/CharacterRestriction.java b/src/org/uic/barcode/asn1/datatypes/CharacterRestriction.java new file mode 100644 index 0000000..e74c436 --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/CharacterRestriction.java @@ -0,0 +1,13 @@ +package org.uic.barcode.asn1.datatypes; + +public enum CharacterRestriction { + NumericString, + PrintableString, + VisibleString, + ISO646String, + IA5String, + BMPString, + UniversalString, + UTF8String, + ObjectIdentifier; +} diff --git a/src/org/uic/barcode/asn1/datatypes/Choice.java b/src/org/uic/barcode/asn1/datatypes/Choice.java new file mode 100644 index 0000000..01a0034 --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/Choice.java @@ -0,0 +1,12 @@ +package org.uic.barcode.asn1.datatypes; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface Choice { + +} diff --git a/src/org/uic/barcode/asn1/datatypes/DefaultAlphabet.java b/src/org/uic/barcode/asn1/datatypes/DefaultAlphabet.java new file mode 100644 index 0000000..62d13f4 --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/DefaultAlphabet.java @@ -0,0 +1,8 @@ +package org.uic.barcode.asn1.datatypes; + +public class DefaultAlphabet extends Alphabet { + + public DefaultAlphabet() { + super(""); + } +} diff --git a/src/org/uic/barcode/asn1/datatypes/FieldOrder.java b/src/org/uic/barcode/asn1/datatypes/FieldOrder.java new file mode 100644 index 0000000..b8c378f --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/FieldOrder.java @@ -0,0 +1,13 @@ +package org.uic.barcode.asn1.datatypes;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface FieldOrder {
+ int order() default -1;
+}
+
diff --git a/src/org/uic/barcode/asn1/datatypes/FixedSize.java b/src/org/uic/barcode/asn1/datatypes/FixedSize.java new file mode 100644 index 0000000..4c17e60 --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/FixedSize.java @@ -0,0 +1,12 @@ +package org.uic.barcode.asn1.datatypes; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE, ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface FixedSize { + int value(); +} diff --git a/src/org/uic/barcode/asn1/datatypes/HasExtensionMarker.java b/src/org/uic/barcode/asn1/datatypes/HasExtensionMarker.java new file mode 100644 index 0000000..b8945fc --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/HasExtensionMarker.java @@ -0,0 +1,12 @@ +package org.uic.barcode.asn1.datatypes; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface HasExtensionMarker { + +} diff --git a/src/org/uic/barcode/asn1/datatypes/IntMinValue.java b/src/org/uic/barcode/asn1/datatypes/IntMinValue.java new file mode 100644 index 0000000..e045287 --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/IntMinValue.java @@ -0,0 +1,13 @@ +package org.uic.barcode.asn1.datatypes; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE, ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface IntMinValue { + long minValue(); + boolean hasExtensionMarker() default false; +} diff --git a/src/org/uic/barcode/asn1/datatypes/IntRange.java b/src/org/uic/barcode/asn1/datatypes/IntRange.java new file mode 100644 index 0000000..08fc1fb --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/IntRange.java @@ -0,0 +1,14 @@ +package org.uic.barcode.asn1.datatypes; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE, ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface IntRange { + long minValue(); + long maxValue(); + boolean hasExtensionMarker() default false; +} diff --git a/src/org/uic/barcode/asn1/datatypes/IsExtension.java b/src/org/uic/barcode/asn1/datatypes/IsExtension.java new file mode 100644 index 0000000..8aacd32 --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/IsExtension.java @@ -0,0 +1,12 @@ +package org.uic.barcode.asn1.datatypes; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface IsExtension { + +} diff --git a/src/org/uic/barcode/asn1/datatypes/NoAsn1Field.java b/src/org/uic/barcode/asn1/datatypes/NoAsn1Field.java new file mode 100644 index 0000000..0fb7d2c --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/NoAsn1Field.java @@ -0,0 +1,10 @@ +package org.uic.barcode.asn1.datatypes;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.TYPE, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface NoAsn1Field {}
\ No newline at end of file diff --git a/src/org/uic/barcode/asn1/datatypes/Optional.java b/src/org/uic/barcode/asn1/datatypes/Optional.java new file mode 100644 index 0000000..757ba29 --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/Optional.java @@ -0,0 +1,96 @@ +package org.uic.barcode.asn1.datatypes; + +import java.util.NoSuchElementException; +import java.util.Objects; + +/** Represents optional values. + * + * Should be replaced by java.util.Optional from Java 8, when project moves to Java 8. + * + * @param <T> type of contained elements */ +public class Optional<T> { + + private final T element; + private final boolean isPresent; + + private Optional(T element, boolean isPresent) { + this.element = element; + this.isPresent = isPresent; + } + + /** @return true if the Option contains a value */ + public boolean isPresent() { + return isPresent; + } + + /** @return the element if the option is not empty + * @throws java.util.NoSuchElementException if the option is empty */ + public T get() { + if (isPresent) { + return element; + } else { + throw new NoSuchElementException("None.get"); + } + } + + /** @return the value, if present, otherwise return {@code other} + * @param other the value to be returned if there is no value present */ + public T orElse(T other) { + return isPresent() ? get() : other; + } + + /** + * Indicates whether some other object is "equal to" this Optional. The + * other object is considered equal if: + * <ul> + * <li>it is also an {@code Optional} and; + * <li>both instances have no value present or; + * <li>the present values are "equal to" each other via {@code equals()}. + * </ul> + * + * @param obj an object to be tested for equality + * @return {code true} if the other object is "equal to" this object + * otherwise {@code false} + */ + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (!(obj instanceof Optional)) { + return false; + } + + Optional<?> other = (Optional<?>) obj; + return Objects.equals(element, other.element); + } + + /** + * Returns the hash code value of the present value, if any, or 0 (zero) if + * no value is present. + * + * @return hash code value of the present value or 0 if no value is present + */ + @Override + public int hashCode() { + return Objects.hashCode(element); + } + + /** Returns an Option containing the value. + * + * @param <A> the type of the value + * @param element contained value + * @return a new Option that contains the value */ + public static <A> Optional<A> of(final A element) { + return new Optional<A>(element, true); + } + + /** Returns an empty option. + * + * @param <A> + * @return an empty Option */ + public static <A> Optional<A> empty() { + return new Optional<A>(null, false); + } +} diff --git a/src/org/uic/barcode/asn1/datatypes/RestrictedString.java b/src/org/uic/barcode/asn1/datatypes/RestrictedString.java new file mode 100644 index 0000000..7539aed --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/RestrictedString.java @@ -0,0 +1,13 @@ +package org.uic.barcode.asn1.datatypes; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE, ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface RestrictedString { + CharacterRestriction value(); + Class<? extends Alphabet> alphabet() default DefaultAlphabet.class; +} diff --git a/src/org/uic/barcode/asn1/datatypes/Sequence.java b/src/org/uic/barcode/asn1/datatypes/Sequence.java new file mode 100644 index 0000000..31163d7 --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/Sequence.java @@ -0,0 +1,9 @@ +package org.uic.barcode.asn1.datatypes; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +//@Target({ElementType.ANNOTATION_TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface Sequence { + +} diff --git a/src/org/uic/barcode/asn1/datatypes/SizeRange.java b/src/org/uic/barcode/asn1/datatypes/SizeRange.java new file mode 100644 index 0000000..7005d47 --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/SizeRange.java @@ -0,0 +1,14 @@ +package org.uic.barcode.asn1.datatypes; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE, ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface SizeRange { + int minValue(); + int maxValue(); + boolean hasExtensionMarker() default false; +} diff --git a/src/org/uic/barcode/asn1/datatypes/package-info.java b/src/org/uic/barcode/asn1/datatypes/package-info.java new file mode 100644 index 0000000..aaa134e --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypes/package-info.java @@ -0,0 +1,7 @@ +/** Annotations to create Java classes that correspond to ASN.1 specifications. + * + * Some annotations (e.g. {@link SizeRange}, {@link FixedSize}, {@link IntRange},{@link IntMaxValue} + * {@link RestrictedString}) are Type-only annotations and sometime require creating extra classes, + * they can be extended to work as Field annotations too, but this will require modifications to the + * Encoder. */ +package org.uic.barcode.asn1.datatypes; diff --git a/src/org/uic/barcode/asn1/datatypesimpl/OctetString.java b/src/org/uic/barcode/asn1/datatypesimpl/OctetString.java new file mode 100644 index 0000000..69346a2 --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypesimpl/OctetString.java @@ -0,0 +1,46 @@ +package org.uic.barcode.asn1.datatypesimpl;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+/*
+ * Sequence of Asn1Integer for restricted integers
+ *
+ *
+ */
+public class OctetString extends Asn1SequenceOf<Byte> {
+ public OctetString() { super(); }
+ public OctetString(Collection<Byte> coll) { super(coll); }
+
+ public OctetString(List<Byte> numbers) {
+ super();
+ this.addAll(numbers);
+ }
+
+ public static OctetString getSequence(List<Byte> numList) {
+ if (numList == null || numList.isEmpty()) return null;
+ return new OctetString(numList);
+ }
+
+
+ public byte[] toByteArray () {
+
+ byte[] bytes= new byte[this.size()];
+
+ for (int i = 0; i < this.size(); i++){
+ bytes[i] = this.get(i);
+ }
+
+ return bytes;
+ }
+
+ public OctetString(byte[] bytes){
+ super();
+ for (int i= 0;i < bytes.length; i++){
+ this.add(bytes[i]);
+ }
+ }
+
+}
diff --git a/src/org/uic/barcode/asn1/datatypesimpl/SequenceOfLong.java b/src/org/uic/barcode/asn1/datatypesimpl/SequenceOfLong.java new file mode 100644 index 0000000..32ae07f --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypesimpl/SequenceOfLong.java @@ -0,0 +1,27 @@ +package org.uic.barcode.asn1.datatypesimpl;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+/*
+ * Sequence of Asn1Integer for restricted integers
+ *
+ *
+ */
+public class SequenceOfLong extends Asn1SequenceOf<Long> {
+ public SequenceOfLong() { super(); }
+ public SequenceOfLong(Collection<Long> coll) { super(coll); }
+
+ public SequenceOfLong(List<Long> numbers) {
+ super();
+ this.addAll(numbers);
+ }
+
+ public static SequenceOfLong getSequence(List<Long> numList) {
+ if (numList == null || numList.isEmpty()) return null;
+ return new SequenceOfLong(numList);
+ }
+
+}
diff --git a/src/org/uic/barcode/asn1/datatypesimpl/SequenceOfStringIA5.java b/src/org/uic/barcode/asn1/datatypesimpl/SequenceOfStringIA5.java new file mode 100644 index 0000000..1abcdcb --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypesimpl/SequenceOfStringIA5.java @@ -0,0 +1,13 @@ +package org.uic.barcode.asn1.datatypesimpl;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+
+@RestrictedString(CharacterRestriction.IA5String)
+public class SequenceOfStringIA5 extends Asn1SequenceOf<String> {
+ public SequenceOfStringIA5() { super(); }
+ public SequenceOfStringIA5(Collection<String> coll) { super(coll); }
+}
diff --git a/src/org/uic/barcode/asn1/datatypesimpl/SequenceOfStringUTF8.java b/src/org/uic/barcode/asn1/datatypesimpl/SequenceOfStringUTF8.java new file mode 100644 index 0000000..4e98cdd --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypesimpl/SequenceOfStringUTF8.java @@ -0,0 +1,13 @@ +package org.uic.barcode.asn1.datatypesimpl;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+
+@RestrictedString(CharacterRestriction.UTF8String)
+public class SequenceOfStringUTF8 extends Asn1SequenceOf<String> {
+ public SequenceOfStringUTF8() { super(); }
+ public SequenceOfStringUTF8(Collection<String> coll) { super(coll); }
+}
diff --git a/src/org/uic/barcode/asn1/datatypesimpl/SequenceOfUnrestrictedLong.java b/src/org/uic/barcode/asn1/datatypesimpl/SequenceOfUnrestrictedLong.java new file mode 100644 index 0000000..6af7352 --- /dev/null +++ b/src/org/uic/barcode/asn1/datatypesimpl/SequenceOfUnrestrictedLong.java @@ -0,0 +1,30 @@ +package org.uic.barcode.asn1.datatypesimpl;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+/*
+ * Sequence of Asn1Integer for restricted integers
+ *
+ */
+public class SequenceOfUnrestrictedLong extends Asn1SequenceOf<Long> {
+ public SequenceOfUnrestrictedLong() { super(); }
+ public SequenceOfUnrestrictedLong(Collection<Long> coll) { super(coll); }
+
+
+ public SequenceOfUnrestrictedLong(List<Long> numbers) {
+ super();
+ for (Long number: numbers){
+ this.add(new Long(number));
+ }
+ }
+
+
+ public static SequenceOfUnrestrictedLong getSequence(List<Long> numList) {
+ if (numList == null || numList.isEmpty()) return null;
+ return new SequenceOfUnrestrictedLong(numList);
+ }
+
+}
diff --git a/src/org/uic/barcode/asn1/test/TestSequenceOfLong.java b/src/org/uic/barcode/asn1/test/TestSequenceOfLong.java new file mode 100644 index 0000000..61af5fa --- /dev/null +++ b/src/org/uic/barcode/asn1/test/TestSequenceOfLong.java @@ -0,0 +1,24 @@ +package org.uic.barcode.asn1.test;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class TestSequenceOfLong extends Asn1SequenceOf<Long> {
+ public TestSequenceOfLong() { super(); }
+ public TestSequenceOfLong(Collection<Long> coll) { super(coll); }
+
+
+ public TestSequenceOfLong(List<Long> numbers) {
+ super();
+ for (Long number: numbers){
+ this.add(new Long(number));
+ }
+ }
+
+ public static TestSequenceOfLong getSequence(List<Long> numList) {
+ if (numList == null || numList.isEmpty()) return null;
+ return new TestSequenceOfLong(numList);
+ }
+}
diff --git a/src/org/uic/barcode/asn1/test/UperEncodeBooleanTest.java b/src/org/uic/barcode/asn1/test/UperEncodeBooleanTest.java new file mode 100644 index 0000000..b5e73b0 --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeBooleanTest.java @@ -0,0 +1,82 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.Asn1Optional; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeBooleanTest { + + /** + * Example from the Standard on UPER. + <pre> + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + value BOOLEAN OPTIONAL, +} + </pre> + */ + @Sequence + public static class TestRecord { + + @FieldOrder(order = 0) + @Asn1Optional() Boolean value; + + public TestRecord() { + this(false); + } + + public TestRecord(Boolean value) { + this.value = value; + } + } + + + @Test public void testTrue() throws IllegalArgumentException, IllegalAccessException { + TestRecord record = new TestRecord(new Boolean(true)); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("C0",hex); + } + + @Test public void testFalse() throws IllegalArgumentException, IllegalAccessException { + TestRecord record = new TestRecord(new Boolean(false)); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("80",hex); + } + + @Test public void testDecodeTrue() throws IllegalArgumentException, IllegalAccessException { + TestRecord record = new TestRecord(new Boolean(true)); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("C0",hex); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.value,record.value); + + } + + @Test public void testDecodeFalse() throws IllegalArgumentException, IllegalAccessException { + TestRecord record = new TestRecord(new Boolean(false)); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("80",hex); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.value,record.value); + } + + + + + + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeChoiceExtensionTest.java b/src/org/uic/barcode/asn1/test/UperEncodeChoiceExtensionTest.java new file mode 100644 index 0000000..3833ff2 --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeChoiceExtensionTest.java @@ -0,0 +1,92 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.Asn1Optional; +import org.uic.barcode.asn1.datatypes.CharacterRestriction; +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.asn1.datatypes.IsExtension; +import org.uic.barcode.asn1.datatypes.RestrictedString; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeChoiceExtensionTest { + + /** Example for extended sequence + TestRecord ::= [APPLICATION 0] CHOICE { + value1 IA5String + ,... + ,value2 IA5String + } + + value TestRecord ::= value2: "extension" + */ + @Choice + @HasExtensionMarker + public static class TestRecordExtended { + + @FieldOrder(order = 0) + @RestrictedString(CharacterRestriction.IA5String) + String value1 = null; + + @FieldOrder(order = 1) + @IsExtension + @RestrictedString(CharacterRestriction.IA5String) + String value2 = "extension"; + + public TestRecordExtended() { } + } + + /** Example for extended sequence + TestRecord ::= [APPLICATION 0] CHOICE { + value1 IA5String, + ,... + } + */ + @Choice + @HasExtensionMarker + public static class TestRecord { + + @RestrictedString(CharacterRestriction.IA5String) + @Asn1Optional() String value1 = "regular"; + + public TestRecord() { } + } + + + @Test public void testEncode() throws IllegalArgumentException, IllegalAccessException { + TestRecordExtended record = new TestRecordExtended(); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("800909CBE3A65DDCF4EFDC",hex); + } + + @Test public void testDecodeExtended() throws IllegalArgumentException, IllegalAccessException { + TestRecordExtended record = new TestRecordExtended(); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("800909CBE3A65DDCF4EFDC",hex); + TestRecordExtended result = UperEncoder.decode(encoded, TestRecordExtended.class); + assertEquals(result.value2,record.value2); + } + + @Test public void testDecode() throws IllegalArgumentException, IllegalAccessException { + TestRecordExtended record = new TestRecordExtended(); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("800909CBE3A65DDCF4EFDC",hex); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assert(result == null); + } + + + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeChoiceTest.java b/src/org/uic/barcode/asn1/test/UperEncodeChoiceTest.java new file mode 100644 index 0000000..69b92d1 --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeChoiceTest.java @@ -0,0 +1,74 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.CharacterRestriction; +import org.uic.barcode.asn1.datatypes.Choice; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.RestrictedString; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeChoiceTest { + + /** + * Example from the Standard on UPER. + <pre> + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + value EnumType DEFAULT value2, + } + + EnumType ::= ENUMERATED { + value1 (0), + value2 (1) + ,... + } + </pre> + */ + @Choice + public static class TestRecord { + + @FieldOrder(order = 0) + @RestrictedString(CharacterRestriction.UTF8String) + String valueUtf8; + + @FieldOrder(order = 1) + @RestrictedString(CharacterRestriction.IA5String) + String valueIA5; + + public TestRecord() { + } + + public TestRecord(String utf8, String ia5) { + this.valueUtf8 = utf8; + this.valueIA5 = ia5; + } + } + + @Test public void testEncode() throws IllegalArgumentException, IllegalAccessException { + TestRecord record = new TestRecord(null, "Meier"); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("82CDCBA72F20",hex); + } + + @Test public void testDecode() throws IllegalArgumentException, IllegalAccessException { + TestRecord record = new TestRecord(null, "Meier"); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("82CDCBA72F20",hex); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(null,record.valueUtf8); + assertEquals(result.valueIA5,record.valueIA5); + } + + + + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeEnumExtensionTest.java b/src/org/uic/barcode/asn1/test/UperEncodeEnumExtensionTest.java new file mode 100644 index 0000000..a2ecbe1 --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeEnumExtensionTest.java @@ -0,0 +1,146 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +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.IsExtension; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeEnumExtensionTest { + + /*** Example from the Standard on UPER. + <pre> + World-Schema DEFINITIONS AUTOMATIC TAGS ::= + BEGIN + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + value EnumType DEFAULT value2 + } + + EnumType ::= ENUMERATED { + value1 (0), + value2 (1) + ,... + } + END + </pre> + */ + @Sequence + public static class TestRecord { + + @FieldOrder(order = 0) + @Asn1Optional EnumType value = EnumType.value1; + public TestRecord() {} + public void setValue(EnumType value) { + this.value = value; + } + } + + + /*** Example from the Standard on UPER. + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + value EnumType DEFAULT value2, + } + + EnumType ::= ENUMERATED { + value1 (0), + value2 (1) + ,... + value3 (2) + } + */ + @Sequence + public static class TestRecordExtended { + + @Asn1Optional EnumTypeExtended value = EnumTypeExtended.value3; + + public TestRecordExtended() {} + + public void setValue(EnumTypeExtended value) { + this.value = value; + } + + + } + + @HasExtensionMarker + public enum EnumType { + value1("value1"), + value2("value2"); + + public String text; + + EnumType(String text) { + this.text = text; + } + + public String toString(){ + return text; + } + } + + + @HasExtensionMarker + public enum EnumTypeExtended { + value1("value1"), + value2("value2"), + + @IsExtension + value3("value3"); + + public String text; + + EnumTypeExtended(String text) { + this.text = text; + } + + public String toString(){ + return text; + } + } + + + + @Test public void testExtension() throws IllegalArgumentException, IllegalAccessException { + + TestRecordExtended record = new TestRecordExtended(); + record.setValue(EnumTypeExtended.value3); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("Enum value3: data hex: %s", hex)); + assertEquals("C000", hex); + } + + @Test public void testExtensionDecoding() throws IllegalArgumentException, IllegalAccessException { + + TestRecordExtended record = new TestRecordExtended(); + record.setValue(EnumTypeExtended.value3); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("Enum value3: data hex: %s", hex)); + assertEquals("C000", hex); + + TestRecordExtended result = UperEncoder.decode(encoded, TestRecordExtended.class); + assertEquals(result.value,EnumTypeExtended.value3); + } + + @Test public void testUnknownExtensionDecoding() throws IllegalArgumentException, IllegalAccessException { + + TestRecordExtended record = new TestRecordExtended(); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("Enum value3: data hex: %s", hex)); + assertEquals("C000", hex); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assert(result.value == null); + } + + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeEnumTest.java b/src/org/uic/barcode/asn1/test/UperEncodeEnumTest.java new file mode 100644 index 0000000..d1d2d82 --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeEnumTest.java @@ -0,0 +1,126 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +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.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeEnumTest { + + /** + * Example from the Standard on UPER. + <pre> + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + value EnumType DEFAULT value2, + } + + EnumType ::= ENUMERATED { + value1 (0), + value2 (1) + ,... + } + </pre> + */ + @Sequence + public static class TestRecord { + + @FieldOrder(order = 0) + @Asn1Default(value="value2") + @Asn1Optional EnumType value = EnumType.value2; + + + public TestRecord() {} + + public TestRecord(EnumType value) { + this.value = value; + } + } + + public enum EnumType { + value1("value1"), + value2("value2"), + value3("value3"), + value4("value4"), + value5("value5"), + value6("value6"), + value7("value7"), + value8("value8"), + value9("value9"), + value10("value10"), + value11("value11"), + value12("value12"), + value13("value13"), + value14("value14"), + value15("value15"), + value16("value16"), + value17("value17"), + value18("value18"), + value19("value19"), + value20("value20"), + value21("value21"), + value22("value22"); + + + public String text; + + EnumType(String text) { + this.text = text; + } + + public String toString(){ + return text; + } + } + + + + @Test public void testNonDefaultValue() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(EnumType.value4); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("Enum value4: data hex: %s", hex)); + assertEquals("8C", hex); + } + + @Test public void testDefaultValue() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(EnumType.value2); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("Enum value2: data hex: %s", hex)); + assertEquals("00", UperEncoder.hexStringFromBytes(encoded)); + } + + @Test public void testDecodeNonDefaultValue() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(EnumType.value4); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("Enum value4: data hex: %s", hex)); + assertEquals("8C", hex); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.value,EnumType.value4); + } + + @Test public void testDecodeDefaultValue() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(EnumType.value2); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("Enum value2: data hex: %s", hex)); + assertEquals("00", UperEncoder.hexStringFromBytes(encoded)); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.value,EnumType.value2); + } + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeExtensionFieldOrderTest.java b/src/org/uic/barcode/asn1/test/UperEncodeExtensionFieldOrderTest.java new file mode 100644 index 0000000..ff97c27 --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeExtensionFieldOrderTest.java @@ -0,0 +1,100 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.Asn1BigInteger; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.HasExtensionMarker; +import org.uic.barcode.asn1.datatypes.IsExtension; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeExtensionFieldOrderTest { + + /** + * Example from the Standard on UPER. + <pre> + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + number1 INTEGER, + ..., + number2 INTEGER, + number3 INTEGER + } + + value TestRecord ::= { + value1 12345678909999899, + value2 5555555555, + value3 32001 + } + +Encoding to the file 'data.uper' using PER UNALIGNED encoding rule... +TestRecord SEQUENCE [root fieldcount (not encoded) = 1] + value1 INTEGER [length = 7.0] + 12345678909999899 + value2 INTEGER [length = 5.0] + 5555555555 + value3 INTEGER [length = 2.0] + 32001 +Total encoded length = 20.2 +Encoded successfully in 21 bytes: +8395EE2A 2EF8858D 81C18140 52C8C338 C0C09F40 40 + + + </pre> + */ + @Sequence + @HasExtensionMarker + public static class TestRecord { + + @FieldOrder(order = 0) + Asn1BigInteger value1; + + @FieldOrder(order = 1) + @IsExtension + Asn1BigInteger value2; + + @FieldOrder(order = 2) + @IsExtension + Asn1BigInteger value3; + + public TestRecord() { + value1 = new Asn1BigInteger(12345678909999899L); + value2 = new Asn1BigInteger(5555555555L); + value3 = new Asn1BigInteger(32001L); + } + + + } + + + @Test public void test() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("8395EE2A2EF8858D81C1814052C8C338C0C09F4040",hex); + + + } + + @Test public void testDecode() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("8395EE2A2EF8858D81C1814052C8C338C0C09F4040",hex); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.value1.longValue(),record.value1.longValue()); + assertEquals(result.value2.longValue(),record.value2.longValue()); + assertEquals(result.value3.longValue(),record.value3.longValue()); + + } + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeFieldOrderTest.java b/src/org/uic/barcode/asn1/test/UperEncodeFieldOrderTest.java new file mode 100644 index 0000000..5a23f24 --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeFieldOrderTest.java @@ -0,0 +1,66 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.Asn1Optional; +import org.uic.barcode.asn1.datatypes.CharacterRestriction; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.RestrictedString; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeFieldOrderTest { + + /** + * Example from the Standard on UPER. + <pre> + World-Schema DEFINITIONS AUTOMATIC TAGS ::= + BEGIN + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + testString1 UTF8String OPTIONAL, + testString2 IA5String OPTIONAL + } + END + </pre> + */ + @Sequence + public static class TestRecord { + + @FieldOrder(order = 1) + @RestrictedString(CharacterRestriction.IA5String) + @Asn1Optional() String string2; + + @FieldOrder(order = 0) + @RestrictedString(CharacterRestriction.UTF8String) + @Asn1Optional() String string1; + + + public TestRecord() { + } + + public TestRecord(String utf8, String ia5) { + this.string1 = utf8; + this.string2 = ia5; + } + } + + + @Test public void test() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord("String1", "String2"); + byte[] encoded = UperEncoder.encode(record); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.string1,"String1"); + assertEquals(result.string2,"String2"); + } + + + + + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeIntegerConstrainedTest.java b/src/org/uic/barcode/asn1/test/UperEncodeIntegerConstrainedTest.java new file mode 100644 index 0000000..575597f --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeIntegerConstrainedTest.java @@ -0,0 +1,71 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.IntRange; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeIntegerConstrainedTest { + + /** + * Example from the Standard on UPER. + <pre> + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + number1 INTEGER (1..999), + number2 INTEGER (0..999), + number3 INTEGER (63..999) + } + </pre> + */ + @Sequence + public static class TestRecord { + + @FieldOrder(order = 0) + @IntRange(minValue=1, maxValue=999) + public Long value1; + + @FieldOrder(order = 1) + @IntRange(minValue=0, maxValue=999) + public Long value2; + + @FieldOrder(order = 2) + @IntRange(minValue=63, maxValue=999) + public Long value3; + + + public TestRecord() { + this(new Long(63L)); + } + + public TestRecord(Long num) { + value1 = num; + value2 = num; + value3 = num; + } + } + + + + @Test public void test() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(63L); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("0F83F000",hex); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.value1.longValue(),record.value1.longValue()); + assertEquals(result.value2.longValue(),record.value2.longValue()); + assertEquals(result.value3.longValue(),record.value3.longValue()); + + } + + + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeIntegerExtensionTest.java b/src/org/uic/barcode/asn1/test/UperEncodeIntegerExtensionTest.java new file mode 100644 index 0000000..d0acd20 --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeIntegerExtensionTest.java @@ -0,0 +1,89 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.Asn1BigInteger; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.HasExtensionMarker; +import org.uic.barcode.asn1.datatypes.IsExtension; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeIntegerExtensionTest { + + /** + * Example from the Standard on UPER. + <pre> + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + number1 INTEGER, + ..., + number2 INTEGER, + number3 INTEGER + } + + value TestRecord ::= { + value1 12345678909999899, + value2 5555555555, + value3 32001 + } + +Encoding to the file 'data.uper' using PER UNALIGNED encoding rule... +TestRecord SEQUENCE [root fieldcount (not encoded) = 1] + value1 INTEGER [length = 7.0] + 12345678909999899 + value2 INTEGER [length = 5.0] + 5555555555 + value3 INTEGER [length = 2.0] + 32001 +Total encoded length = 20.2 +Encoded successfully in 21 bytes: +8395EE2A 2EF8858D 81C18140 52C8C338 C0C09F40 40 + + + </pre> + */ + @Sequence + @HasExtensionMarker + public static class TestRecord { + + @FieldOrder(order = 0) + Asn1BigInteger value1; + + @FieldOrder(order = 2) + @IsExtension + Asn1BigInteger value3; + + @FieldOrder(order = 1) + @IsExtension + Asn1BigInteger value2; + + + public TestRecord() { + value1 = new Asn1BigInteger(12345678909999899L); + value2 = new Asn1BigInteger(5555555555L); + value3 = new Asn1BigInteger(32001L); + } + + + } + + + @Test public void test() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(); + byte[] encoded = UperEncoder.encode(record); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.value1.longValue(),record.value1.longValue()); + assertEquals(result.value2.longValue(),record.value2.longValue()); + assertEquals(result.value3.longValue(),record.value3.longValue()); + + + } + + + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeIntegerSmallTest.java b/src/org/uic/barcode/asn1/test/UperEncodeIntegerSmallTest.java new file mode 100644 index 0000000..5ada54d --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeIntegerSmallTest.java @@ -0,0 +1,130 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeIntegerSmallTest { + + /** + * Example from the Standard on UPER. + <pre> + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + number1 INTEGER, + number2 INTEGER + } + </pre> + */ + @Sequence + public static class TestRecord { + + @FieldOrder(order = 0) + public Long value1; + + @FieldOrder(order = 1) + public Integer value2; + + public TestRecord() { + this(new Long(12345678909999899L)); + } + + public TestRecord(Long num) { + value1 = num; + value2 = Integer.valueOf(num.intValue()); + } + } + + + + @Test public void test1() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(1L); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("01010101",hex); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.value1.longValue(),record.value1.longValue()); + assertEquals(result.value2.longValue(),record.value2.longValue()); + + } + + @Test public void test16() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(16L); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("01100110",hex); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.value1.longValue(),record.value1.longValue()); + assertEquals(result.value2.longValue(),record.value2.longValue()); + + } + + + @Test public void test63() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(63L); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("013F013F",hex); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.value1.longValue(),record.value1.longValue()); + assertEquals(result.value2.longValue(),record.value2.longValue()); + + } + + @Test public void test64() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(64L); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("01400140",hex); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.value1.longValue(),record.value1.longValue()); + assertEquals(result.value2.longValue(),record.value2.longValue()); + + } + + @Test public void test127() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(127L); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("017F017F",hex); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.value1.longValue(),record.value1.longValue()); + assertEquals(result.value2.longValue(),record.value2.longValue()); + + } + + @Test public void test128() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(128L); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("020080020080",hex); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.value1.longValue(),record.value1.longValue()); + assertEquals(result.value2.longValue(),record.value2.longValue()); + + } + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeIntegerTest.java b/src/org/uic/barcode/asn1/test/UperEncodeIntegerTest.java new file mode 100644 index 0000000..d57fd00 --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeIntegerTest.java @@ -0,0 +1,64 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.Asn1BigInteger; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeIntegerTest { + + /** + * Example from the Standard on UPER. + <pre> + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + number INTEGER, + } + </pre> + */ + @Sequence + public static class TestRecord { + + @FieldOrder(order = 0) + Asn1BigInteger value; + + public TestRecord() { + this(new Long(12345678909999899L)); + } + + public TestRecord(Long num) { + value = new Asn1BigInteger(num); + } + } + + + + @Test public void test() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(12345678909999899L); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("072BDC545DF10B1B",hex); + + } + + @Test public void testDecode() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(12345678909999899L); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("072BDC545DF10B1B",hex); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.value.longValue(),record.value.longValue()); + + } + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeObjectIdentifierTest.java b/src/org/uic/barcode/asn1/test/UperEncodeObjectIdentifierTest.java new file mode 100644 index 0000000..edf3348 --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeObjectIdentifierTest.java @@ -0,0 +1,76 @@ +package org.uic.barcode.asn1.test;
+
+import static org.junit.Assert.assertEquals;
+import java.util.logging.Level;
+
+import org.junit.jupiter.api.Test;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.uper.UperEncoder;
+
+class UperEncodeObjectIdentifierTest {
+
+
+ /**
+ * Example from the Standard on UPER.
+ <pre>
+ TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE {
+ value1 OBJECT IDENTIFIER,
+ value2 OBJECT IDENTIFIER,
+ value3 OBJECT IDENTIFIER
+ }
+
+ value TestRecord ::= {
+ value1 2.16.840.1.101.3.4.3.1,
+ value2 2.16.840.1.101.3.4.3.2,
+ value3 1.2.840.10045.3.1.7
+ }
+ </pre>
+ */
+
+ @Sequence
+ public static class TestRecord {
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.ObjectIdentifier)
+ String value1 = "2.16.840.1.101.3.4.3.1"; //DSA SHA224
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.ObjectIdentifier)
+ String value2 = "2.16.840.1.101.3.4.3.2"; //DSA SHA248
+
+ @FieldOrder(order = 2)
+ @RestrictedString(CharacterRestriction.ObjectIdentifier)
+ String value3 = "1.2.840.10045.3.1.7"; //ECC
+
+ public TestRecord() {}
+
+ }
+
+ @Test
+ public void testEncode() throws IllegalArgumentException, IllegalAccessException {
+ TestRecord record = new TestRecord();
+ byte[] encoded = UperEncoder.encode(record);
+ String hex = UperEncoder.hexStringFromBytes(encoded);
+ UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex));
+ assertEquals("0960864801650304030109608648016503040302082A8648CE3D030107",hex);
+ }
+
+ @Test
+ public void testDecode() throws IllegalArgumentException, IllegalAccessException {
+ TestRecord record = new TestRecord();
+ byte[] encoded = UperEncoder.encode(record);
+ String hex = UperEncoder.hexStringFromBytes(encoded);
+ UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex));
+ assertEquals("0960864801650304030109608648016503040302082A8648CE3D030107",hex);
+ TestRecord result = UperEncoder.decode(encoded, TestRecord.class);
+ assertEquals(result.value1,record.value1);
+ assertEquals(result.value2,record.value2);
+ assertEquals(result.value3,record.value3);
+ }
+
+
+}
diff --git a/src/org/uic/barcode/asn1/test/UperEncodeOctetStringTest.java b/src/org/uic/barcode/asn1/test/UperEncodeOctetStringTest.java new file mode 100644 index 0000000..af2a42e --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeOctetStringTest.java @@ -0,0 +1,80 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.datatypesimpl.OctetString; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeOctetStringTest { + + /** + * Example from the Standard on UPER. + <pre> + World-Schema DEFINITIONS AUTOMATIC TAGS ::= + BEGIN + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + value OCTET STRING + } + END + + value TestRecord ::= { value '83DA'H } + + Encoding to the file 'data.uper' using PER UNALIGNED encoding rule... + TestRecord SEQUENCE [fieldcount (not encoded) = 1] + value OCTET STRING [length = 2.0] + 0x83da + Total encoded length = 3.0 + Encoded successfully in 3 bytes: + 0283DA + + </pre> + */ + @Sequence + public static class TestRecord { + + @FieldOrder(order = 0) + OctetString value; + + public TestRecord() { + value = new OctetString(); + value.add(hexToByte("83")); + value.add(hexToByte("DA")); + } + } + + + @Test public void test() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("0283DA",hex); + + } + + @Test public void testDecode() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("0283DA",hex); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.value,record.value); + + } + + public static byte hexToByte(String s){ + return (byte) ((Character.digit(s.charAt(0), 16) << 4) + + Character.digit(s.charAt(1), 16)); + } + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeOptionalSequenceExtensionTest.java b/src/org/uic/barcode/asn1/test/UperEncodeOptionalSequenceExtensionTest.java new file mode 100644 index 0000000..55e6026 --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeOptionalSequenceExtensionTest.java @@ -0,0 +1,118 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.Asn1Optional; +import org.uic.barcode.asn1.datatypes.CharacterRestriction; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.HasExtensionMarker; +import org.uic.barcode.asn1.datatypes.IsExtension; +import org.uic.barcode.asn1.datatypes.RestrictedString; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeOptionalSequenceExtensionTest { + + /** Example for extended sequence including extension + World-Schema DEFINITIONS AUTOMATIC TAGS ::= + BEGIN + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + value1 IA5String, + ..., + value2 IA5String OPTIONAL + } + END + */ + @Sequence + @HasExtensionMarker + public static class TestRecordExtended { + + @FieldOrder(order = 0) + @RestrictedString(CharacterRestriction.IA5String) + String value1; + + @FieldOrder(order = 1) + @IsExtension + @RestrictedString(CharacterRestriction.IA5String) + @Asn1Optional() String value2; + + public TestRecordExtended() { } + + public void setValue1(String value1) { + this.value1 = value1; + } + + public void setValue2(String value2) { + this.value2 = value2; + } + + + + } + + /** Example for extended sequence + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + value1 IA5String, + ,... + } + */ + @Sequence + @HasExtensionMarker + public static class TestRecord { + + @RestrictedString(CharacterRestriction.IA5String) + String value1 = "regular"; + public TestRecord() { } + } + + + @Test public void testEncode() throws IllegalArgumentException, IllegalAccessException { + TestRecordExtended record = new TestRecordExtended(); + record.setValue1("regular"); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("03F2CB9FAECC3C80",hex); + } + + @Test public void testEncodeWithoutOptionalElement() throws IllegalArgumentException, IllegalAccessException { + TestRecordExtended record = new TestRecordExtended(); + record.setValue1("regular"); + record.setValue2("extension"); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("83F2CB9FAECC3C80424272F8E997773D3BF700",hex); + } + + @Test public void testDecodeExtended() throws IllegalArgumentException, IllegalAccessException { + TestRecordExtended record = new TestRecordExtended(); + record.setValue1("regular"); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("03F2CB9FAECC3C80",hex); + TestRecordExtended result = UperEncoder.decode(encoded, TestRecordExtended.class); + assertEquals(result.value1,record.value1); + } + + @Test public void testDecode() throws IllegalArgumentException, IllegalAccessException { + TestRecordExtended record = new TestRecordExtended(); + record.setValue1("regular"); + record.setValue2("extension"); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("83F2CB9FAECC3C80424272F8E997773D3BF700",hex); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.value1,record.value1); + } + + + + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeRestrictedIntegerTest.java b/src/org/uic/barcode/asn1/test/UperEncodeRestrictedIntegerTest.java new file mode 100644 index 0000000..bc82621 --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeRestrictedIntegerTest.java @@ -0,0 +1,62 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.IntRange; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeRestrictedIntegerTest { + + /** + * Example from the Standard on UPER. + <pre> +TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + number INTEGER(32000..63000), +} + </pre> + */ + @Sequence + public static class TestRecord { + + @FieldOrder(order = 0) + @IntRange(maxValue = 63000, minValue = 33000) + Long value; + + public TestRecord() { + this(new Long(33005)); + } + + public TestRecord(Long num) { + value = num; + } + } + + + @Test public void test() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(33005L); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("000A",hex); + } + + @Test public void testDecode() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(33005L); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("000A",hex); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.value,record.value); + } + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeSequenceExtensionTest.java b/src/org/uic/barcode/asn1/test/UperEncodeSequenceExtensionTest.java new file mode 100644 index 0000000..29d203b --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeSequenceExtensionTest.java @@ -0,0 +1,93 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.Asn1Optional; +import org.uic.barcode.asn1.datatypes.CharacterRestriction; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.HasExtensionMarker; +import org.uic.barcode.asn1.datatypes.IsExtension; +import org.uic.barcode.asn1.datatypes.RestrictedString; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeSequenceExtensionTest { + + /** Example for extended sequence including extension + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + value1 IA5String, + ,... + value2 IA5String + } + */ + @Sequence + @HasExtensionMarker + public static class TestRecordExtended { + + @FieldOrder(order = 0) + @RestrictedString(CharacterRestriction.IA5String) + @Asn1Optional() String value1 = "regular"; + + @FieldOrder(order = 1) + @IsExtension + @RestrictedString(CharacterRestriction.IA5String) + @Asn1Optional() String value2 = "extension"; + + + public TestRecordExtended() { } + } + + /** Example for extended sequence + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + value1 IA5String, + ,... + } + */ + @Sequence + @HasExtensionMarker + public static class TestRecord { + + @RestrictedString(CharacterRestriction.IA5String) + @Asn1Optional() String value1 = "regular"; + + public TestRecord() { } + } + + + @Test public void testEncode() throws IllegalArgumentException, IllegalAccessException { + TestRecordExtended record = new TestRecordExtended(); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("C1F965CFD7661E402121397C74CBBB9E9DFB80",hex); + } + + @Test public void testDecodeExtended() throws IllegalArgumentException, IllegalAccessException { + TestRecordExtended record = new TestRecordExtended(); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("C1F965CFD7661E402121397C74CBBB9E9DFB80",hex); + TestRecordExtended result = UperEncoder.decode(encoded, TestRecordExtended.class); + assertEquals(result.value1,record.value1); + assertEquals(result.value2,record.value2); + } + + @Test public void testDecode() throws IllegalArgumentException, IllegalAccessException { + TestRecordExtended record = new TestRecordExtended(); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("C1F965CFD7661E402121397C74CBBB9E9DFB80",hex); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.value1,record.value1); + } + + + + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeSequenceOfIntegerTest.java b/src/org/uic/barcode/asn1/test/UperEncodeSequenceOfIntegerTest.java new file mode 100644 index 0000000..9194dca --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeSequenceOfIntegerTest.java @@ -0,0 +1,72 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.datatypesimpl.SequenceOfUnrestrictedLong; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeSequenceOfIntegerTest { + + /** + * Example from the Standard on UPER. + <pre> +TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + number INTEGER, +} + </pre> + */ + @Sequence + public static class TestRecord { + + @FieldOrder(order = 0) + SequenceOfUnrestrictedLong numbers; + + public TestRecord() { + } + + public TestRecord(List<Long> nums) { + numbers = new SequenceOfUnrestrictedLong(nums); + } + } + + + @Test public void test() throws IllegalArgumentException, IllegalAccessException { + + ArrayList<Long> nums = new ArrayList<Long>(); + nums.add(new Long(12345678909999899L)); + nums.add(new Long(12345678909999899L)); + TestRecord record = new TestRecord(nums); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", UperEncoder.hexStringFromBytes(encoded))); + assertEquals("02072BDC545DF10B1B072BDC545DF10B1B",hex); + + } + + @Test public void testDecode() throws IllegalArgumentException, IllegalAccessException { + + ArrayList<Long> nums = new ArrayList<Long>(); + nums.add(new Long(12345678909999899L)); + nums.add(new Long(12345678909999899L)); + TestRecord record = new TestRecord(nums); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", UperEncoder.hexStringFromBytes(encoded))); + assertEquals("02072BDC545DF10B1B072BDC545DF10B1B",hex); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.numbers.get(0).longValue(),record.numbers.get(0).longValue()); + assertEquals(result.numbers.get(1).longValue(),record.numbers.get(1).longValue()); + + + } + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeSequenceOfRestrictedIntegerTest.java b/src/org/uic/barcode/asn1/test/UperEncodeSequenceOfRestrictedIntegerTest.java new file mode 100644 index 0000000..d1834d0 --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeSequenceOfRestrictedIntegerTest.java @@ -0,0 +1,77 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.IntRange; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeSequenceOfRestrictedIntegerTest { + + /** + * Example from the Standard on UPER. + <pre> +TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + numbers SEQUENCE OF INTEGER(0..9999999), +} + </pre> + */ + @Sequence + public static class TestRecord { + + @FieldOrder(order = 0) + @IntRange(minValue=9500000,maxValue=99900001) + TestSequenceOfLong numbers = null;; + + public TestRecord() { + } + + public void addNumber(Long longValue){ + if (numbers == null) { + numbers = new TestSequenceOfLong(); + } + numbers.add(longValue); + } + } + + + @Test public void test() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(); + + record.addNumber(new Long(9500001L)); + record.addNumber(new Long(9699999L)); + + + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", UperEncoder.hexStringFromBytes(encoded))); + assertEquals("02000000200C34FC",hex); + } + + @Test public void testDecode() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(); + + record.addNumber(new Long(9500001L)); + record.addNumber(new Long(9699999L)); + + + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", UperEncoder.hexStringFromBytes(encoded))); + assertEquals("02000000200C34FC",hex); + + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.numbers.get(0).longValue(),record.numbers.get(0).longValue()); + assertEquals(result.numbers.get(1).longValue(),record.numbers.get(1).longValue()); + } + + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeSequenceOfStringListTest.java b/src/org/uic/barcode/asn1/test/UperEncodeSequenceOfStringListTest.java new file mode 100644 index 0000000..49350cc --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeSequenceOfStringListTest.java @@ -0,0 +1,78 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.CharacterRestriction; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.RestrictedString; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeSequenceOfStringListTest { + + /** + * Example from the Standard on UPER. + <pre> + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + strings SEQUENCE OF IA5String, + } + </pre> + */ + @Sequence + public static class TestRecord { + + @FieldOrder(order = 0) + @RestrictedString(CharacterRestriction.IA5String) + ArrayList<String> strings = new ArrayList<String>(); + + public TestRecord() { + } + + public List<String> getStrings() { + return strings; + } + + + } + + + @Test public void test() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(); + record.getStrings().add("test1"); + record.getStrings().add("test2"); + record.getStrings().add("test3"); + + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", UperEncoder.hexStringFromBytes(encoded))); + assertEquals("0305E9979F4620BD32F3E8C817A65E7D1980",hex); + } + + @Test public void testDecode() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(); + record.getStrings().add("test1"); + record.getStrings().add("test2"); + record.getStrings().add("test3"); + + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", UperEncoder.hexStringFromBytes(encoded))); + assertEquals("0305E9979F4620BD32F3E8C817A65E7D1980",hex); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class, null); + assert(result.getStrings().contains("test1")); + assert(result.getStrings().contains("test2")); + assert(result.getStrings().contains("test3")); + + + } + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeSequenceOfStringTest.java b/src/org/uic/barcode/asn1/test/UperEncodeSequenceOfStringTest.java new file mode 100644 index 0000000..f8eccc6 --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeSequenceOfStringTest.java @@ -0,0 +1,76 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.CharacterRestriction; +import org.uic.barcode.asn1.datatypes.FieldOrder; +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.asn1.uper.UperEncoder; + + +public class UperEncodeSequenceOfStringTest { + + /** + * Example from the Standard on UPER. + <pre> + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + strings SEQUENCE OF IA5String, + } + </pre> + */ + @Sequence + public static class TestRecord { + + @FieldOrder(order = 0) + SequenceOfStringIA5 strings = new SequenceOfStringIA5(); + + public TestRecord() { + } + + public SequenceOfStringIA5 getStrings() { + return strings; + } + + + } + + + @Test public void test() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(); + record.getStrings().add("test1"); + record.getStrings().add("test2"); + record.getStrings().add("test3"); + + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", UperEncoder.hexStringFromBytes(encoded))); + assertEquals("0305E9979F4620BD32F3E8C817A65E7D1980",hex); + } + + @Test public void testDecode() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(); + record.getStrings().add("test1"); + record.getStrings().add("test2"); + record.getStrings().add("test3"); + + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", UperEncoder.hexStringFromBytes(encoded))); + assertEquals("0305E9979F4620BD32F3E8C817A65E7D1980",hex); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assert(result.getStrings().contains("test1")); + assert(result.getStrings().contains("test2")); + assert(result.getStrings().contains("test3")); + + + } + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeSequenceOfUtf8StringTest.java b/src/org/uic/barcode/asn1/test/UperEncodeSequenceOfUtf8StringTest.java new file mode 100644 index 0000000..ab8fa2a --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeSequenceOfUtf8StringTest.java @@ -0,0 +1,96 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeSequenceOfUtf8StringTest { + + /** + * Example from the Standard on UPER. + <pre> + World-Schema DEFINITIONS AUTOMATIC TAGS ::= + BEGIN + TestRecord ::= SEQUENCE { + strings SEQUENCE OF UTF8String + } + END + + value TestRecord ::= { + strings {"test1" , "test2" , "test3" } + } + + +Encoding to the file 'data.uper' using PER UNALIGNED encoding rule... +TestRecord SEQUENCE [fieldcount (not encoded) = 1] + strings SEQUENCE OF [count = 3] + UTF8String [length = 5.0] + 0x7465737431 + UTF8String [length = 5.0] + 0x7465737432 + UTF8String [length = 5.0] + 0x7465737433 +Total encoded length = 19.0 +Encoded successfully in 19 bytes: +03057465 73743105 74657374 32057465 737433 + + </pre> + */ + @Sequence + public static class TestRecord { + + @FieldOrder(order = 0) + SequenceOfStringUTF8 strings = new SequenceOfStringUTF8(); + + public TestRecord() { + } + + public SequenceOfStringUTF8 getStrings() { + return strings; + } + + + } + + + @Test public void test() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(); + record.getStrings().add("test1"); + record.getStrings().add("test2"); + record.getStrings().add("test3"); + + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", UperEncoder.hexStringFromBytes(encoded))); + assertEquals("03057465737431057465737432057465737433",hex); + } + + @Test public void testDecode() throws IllegalArgumentException, IllegalAccessException { + + TestRecord record = new TestRecord(); + record.getStrings().add("test1"); + record.getStrings().add("test2"); + record.getStrings().add("test3"); + + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", UperEncoder.hexStringFromBytes(encoded))); + assertEquals("03057465737431057465737432057465737433",hex); + + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assert(result.getStrings().contains("test1")); + assert(result.getStrings().contains("test2")); + assert(result.getStrings().contains("test3")); + + + } + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeStringDefaultTest.java b/src/org/uic/barcode/asn1/test/UperEncodeStringDefaultTest.java new file mode 100644 index 0000000..d8e5029 --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeStringDefaultTest.java @@ -0,0 +1,76 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.Asn1Default; +import org.uic.barcode.asn1.datatypes.Asn1Optional; +import org.uic.barcode.asn1.datatypes.CharacterRestriction; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.RestrictedString; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeStringDefaultTest { + + /** + * Example from the Standard on UPER. + <pre> + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + testString1 UTF8String OPTIONAL, + testString2 IA5String DEFAULT("TestString") + } + </pre> + */ + @Sequence + public static class TestRecord { + + @FieldOrder(order = 0) + @RestrictedString(CharacterRestriction.UTF8String) + @Asn1Optional() String valueUtf8; + + @FieldOrder(order = 1) + @RestrictedString(CharacterRestriction.IA5String) + @Asn1Default(value="testString") String valueIA5; + + public TestRecord() { + } + + public TestRecord(String utf8, String ia5) { + this.valueUtf8 = utf8; + this.valueIA5 = ia5; + } + } + + + @Test public void testEncode() throws IllegalArgumentException, IllegalAccessException { + TestRecord record = new TestRecord("Müller", "testString"); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("81D370EF1B1B195C80",hex); + } + + @Test public void testEncodeDefault() throws IllegalArgumentException, IllegalAccessException { + TestRecord record = new TestRecord("Müller", "testString"); + byte[] encoded = UperEncoder.encode(record); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals(result.valueIA5,"testString"); + } + + @Test public void testEncodeDefault2() throws IllegalArgumentException, IllegalAccessException { + TestRecord record = new TestRecord("Müller", null); + byte[] encoded = UperEncoder.encode(record); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals(result.valueIA5,"testString"); + } + + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeStringLengthTest.java b/src/org/uic/barcode/asn1/test/UperEncodeStringLengthTest.java new file mode 100644 index 0000000..9dd4389 --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeStringLengthTest.java @@ -0,0 +1,151 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.Asn1Optional; +import org.uic.barcode.asn1.datatypes.CharacterRestriction; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.RestrictedString; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeStringLengthTest { + + /** + * Example from the Standard on UPER. + <pre> + World-Schema DEFINITIONS AUTOMATIC TAGS ::= + BEGIN + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + testString1 UTF8String OPTIONAL + } + END + + value TestRecord ::= { + testString1 "A" + } + + </pre> + */ + + + + @Sequence + public static class TestRecord { + + @FieldOrder(order = 0) + @RestrictedString(CharacterRestriction.UTF8String) + @Asn1Optional() String valueUtf8; + + public TestRecord() { + } + + public TestRecord(String utf8) { + this.valueUtf8 = utf8; + } + } + + + @Test public void testEncode1() throws IllegalArgumentException, IllegalAccessException { + TestRecord record = new TestRecord("A"); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("80A080",hex); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(record.valueUtf8,result.valueUtf8); + } + + + @Test public void testEncode63() throws IllegalArgumentException, IllegalAccessException { + TestRecord record = new TestRecord("123456789012345678901234567890123456789012345678901234567890123"); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("9F9899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C9818991980",hex); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(record.valueUtf8,result.valueUtf8); + } + + @Test public void testEncode64() throws IllegalArgumentException, IllegalAccessException { + TestRecord record = new TestRecord("1234567890123456789012345678901234567890123456789012345678901234"); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("A01899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A00",hex); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(record.valueUtf8,result.valueUtf8); + } + + @Test public void testEncode65() throws IllegalArgumentException, IllegalAccessException { + TestRecord record = new TestRecord("12345678901234567890123456789012345678901234567890123456789012345"); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("A09899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A80",hex); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(record.valueUtf8,result.valueUtf8); + } + + @Test public void testEncode126() throws IllegalArgumentException, IllegalAccessException { + TestRecord record = new TestRecord("123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456"); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("BF1899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C9818" + + "99199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C98189919" + + "9A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A" + + "9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B00",hex); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(record.valueUtf8,result.valueUtf8); + } + + + @Test public void testEncode127() throws IllegalArgumentException, IllegalAccessException { + TestRecord record = new TestRecord("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567"); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("BF9899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C9818" + + "99199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C98189919" + + "9A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A" + + "9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B" + + "80",hex); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(record.valueUtf8,result.valueUtf8); + } + + @Test public void testEncode128() throws IllegalArgumentException, IllegalAccessException { + TestRecord record = new TestRecord("12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678"); + + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("C0401899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C98" + + "1899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899" + + "199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A" + + "1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B" + + "1B9C00",hex); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(record.valueUtf8,result.valueUtf8); + } + + @Test public void testEncode129() throws IllegalArgumentException, IllegalAccessException { + TestRecord record = new TestRecord("123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("C0409899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C98" + + "1899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899" + + "199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A" + + "1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B1B9C1C981899199A1A9B" + + "1B9C1C80",hex); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(record.valueUtf8,result.valueUtf8); + } + +} diff --git a/src/org/uic/barcode/asn1/test/UperEncodeStringTest.java b/src/org/uic/barcode/asn1/test/UperEncodeStringTest.java new file mode 100644 index 0000000..5f4edc8 --- /dev/null +++ b/src/org/uic/barcode/asn1/test/UperEncodeStringTest.java @@ -0,0 +1,110 @@ +package org.uic.barcode.asn1.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.Asn1Optional; +import org.uic.barcode.asn1.datatypes.CharacterRestriction; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.RestrictedString; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; + + +public class UperEncodeStringTest { + + /** + * Example from the Standard on UPER. + <pre> + World-Schema DEFINITIONS AUTOMATIC TAGS ::= + BEGIN + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + testString1 UTF8String OPTIONAL, + testString2 IA5String OPTIONAL + } + END + </pre> + */ + @Sequence + public static class TestRecord { + + @FieldOrder(order = 0) + @RestrictedString(CharacterRestriction.UTF8String) + @Asn1Optional() String valueUtf8; + + @FieldOrder(order = 1) + @RestrictedString(CharacterRestriction.IA5String) + @Asn1Optional() String valueIA5; + + public TestRecord() { + } + + public TestRecord(String utf8, String ia5) { + this.valueUtf8 = utf8; + this.valueIA5 = ia5; + } + } + + + @Test public void testEncode() throws IllegalArgumentException, IllegalAccessException { + + //Teststring: AêñüC + String original = new String("A" + "\u00ea" + "\u00f1" + "\u00fc" + "C"); + + TestRecord record = new TestRecord(original, "Meier"); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("C21070EAB0EC70EF10C166E5D39790",hex); + + } + + @Test public void testEncodeUtf8() throws IllegalArgumentException, IllegalAccessException { + + //"ä½ å¥½å?—" + String original = new String("\u00e4" + "\u00bd" + "\u00a0" + "\u00e5" + "\u00a5" + "\u00bd" + "\u00e5" + "\u0090" + "\u0097"); + TestRecord record = new TestRecord(original, "Meier"); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("C4B0E930AF70A830E970A970AF70E970A430A5C166E5D39790",hex); + } + + + + @Test public void testDecode() throws IllegalArgumentException, IllegalAccessException { + + //Teststring: AêñüC + String original = new String("A" + "\u00ea" + "\u00f1" + "\u00fc" + "C"); + + TestRecord record = new TestRecord(original, "Meier"); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("C21070EAB0EC70EF10C166E5D39790",hex); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.valueUtf8,record.valueUtf8); + assertEquals(result.valueIA5,record.valueIA5); + } + + + @Test public void testDecodeUtf8() throws IllegalArgumentException, IllegalAccessException { + //"ä½ å¥½å?—" + String original = new String("\u00e4" + "\u00bd" + "\u00a0" + "\u00e5" + "\u00a5" + "\u00bd" + "\u00e5" + "\u0090" + "\u0097"); + TestRecord record = new TestRecord(original, "Meier"); + byte[] encoded = UperEncoder.encode(record); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + assertEquals("C4B0E930AF70A830E970A970AF70E970A430A5C166E5D39790",hex); + TestRecord result = UperEncoder.decode(encoded, TestRecord.class); + assertEquals(result.valueUtf8,record.valueUtf8); + assertEquals(result.valueIA5,record.valueIA5); + } + + + + + +} diff --git a/src/org/uic/barcode/asn1/uper/AnnotationStore.java b/src/org/uic/barcode/asn1/uper/AnnotationStore.java new file mode 100644 index 0000000..6a23a75 --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/AnnotationStore.java @@ -0,0 +1,31 @@ +package org.uic.barcode.asn1.uper; + +import java.lang.annotation.Annotation; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +class AnnotationStore { + + private Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<>(); + + public AnnotationStore(Annotation[] classAnnot, Annotation[] fieldAnnot) { + for (Annotation a : classAnnot) { + annotations.put(a.annotationType(), a); + } + for (Annotation a : fieldAnnot) { + annotations.put(a.annotationType(), a); + } + } + + public <T extends Annotation> T getAnnotation(Class<T> classOfT) { + @SuppressWarnings("unchecked") + // Annotations were added with value T for key classOfT. + T result = (T) annotations.get(classOfT); + return result; + } + + public Collection<Annotation> getAnnotations() { + return annotations.values(); + } +}
\ No newline at end of file diff --git a/src/org/uic/barcode/asn1/uper/Asn1EncodingException.java b/src/org/uic/barcode/asn1/uper/Asn1EncodingException.java new file mode 100644 index 0000000..ae14cd0 --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/Asn1EncodingException.java @@ -0,0 +1,18 @@ +package org.uic.barcode.asn1.uper; + +public class Asn1EncodingException extends Exception { + + /** + * + */ + private static final long serialVersionUID = -8719453936776248228L; + + public Asn1EncodingException(String message) { + super(message); + } + + public Asn1EncodingException(String extraMessage, Asn1EncodingException cause) { + super(extraMessage + cause.getMessage(), cause); + } + +} diff --git a/src/org/uic/barcode/asn1/uper/BigIntCoder.java b/src/org/uic/barcode/asn1/uper/BigIntCoder.java new file mode 100644 index 0000000..94e4b05 --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/BigIntCoder.java @@ -0,0 +1,97 @@ +package org.uic.barcode.asn1.uper; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; +import java.math.BigInteger; + +import org.uic.barcode.asn1.datatypes.Asn1BigInteger; +import org.uic.barcode.asn1.datatypes.Asn1Default; +import org.uic.barcode.asn1.datatypes.IntRange; + +class BigIntCoder implements Encoder, Decoder { + + @Override public <T> boolean canDecode(Class<T> classOfT, Annotation[] extraAnnotations) { + return Asn1BigInteger.class.isAssignableFrom(classOfT); + } + + @Override public <T> T decode(BitBuffer bitbuffer, + Class<T> classOfT, Field f, + Annotation[] extraAnnotations) { + AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(), + extraAnnotations); + + String pos = String.format("%d.%d", bitbuffer.position()/8 , bitbuffer.position() % 8); + UperEncoder.logger.debug(String.format("Position %s BIG INT",pos)); + IntRange intRange = annotations.getAnnotation(IntRange.class); + if (intRange != null && intRange.maxValue() > 0) { + throw new UnsupportedOperationException("Big int with upper range is not supported yet"); + } + + int lengthInOctets = (int) UperEncoder.decodeLengthDeterminant(bitbuffer); + BitBuffer valueBits = ByteBitBuffer.allocate(lengthInOctets * 8); + for (int i = 0; i < lengthInOctets * 8; i++) { + valueBits.put(bitbuffer.get()); + } + valueBits.flip(); + BigInteger resultValue = new BigInteger(+1, valueBits.array()); + UperEncoder.logger.debug(String.format("big int Decoded as %s", resultValue)); + + + //CG support for int range + if (intRange != null){ + resultValue.add(BigInteger.valueOf(intRange.minValue())); + } + + + return UperEncoder.instantiate(classOfT, resultValue); + } + + @Override public <T> boolean canEncode(T obj, Annotation[] extraAnnotations) { + return obj instanceof Asn1BigInteger; + } + + @Override public <T> void encode(BitBuffer bitbuffer, T obj, Annotation[] extraAnnotations) throws Asn1EncodingException { + Class<?> type = obj.getClass(); + AnnotationStore annotations = new AnnotationStore(type.getAnnotations(), extraAnnotations); + IntRange range = annotations.getAnnotation(IntRange.class); + + //CG implementation with lower range limit added + BigInteger bint = ((Asn1BigInteger) obj).toBigInteger(); + if (range != null) { + throw new UnsupportedOperationException("Asn1 BigInteger with range is not supported"); + } + byte[] array = bint.toByteArray(); + int lengthInOctets = array.length; + int position1 = bitbuffer.position(); + try { + UperEncoder.encodeLengthDeterminant(bitbuffer, lengthInOctets); + } catch (Asn1EncodingException e) { + throw new Asn1EncodingException(" length determinant of " + type.getName(), e); + } + int position2 = bitbuffer.position(); + for (byte b : array) { + bitbuffer.putByte(b); + } + UperEncoder.logger.debug(String.format("Big Int(%s): len %s, val %s", obj, + bitbuffer.toBooleanString(position1, position2 - position1), + bitbuffer.toBooleanStringFromPosition(position2))); + return; + } + + @Override + public <T> T getDefault(Class<T> classOfT, Annotation[] extraAnnotations) { + AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(), extraAnnotations); + Asn1Default defaultAnnotation = annotations.getAnnotation(Asn1Default.class); + if (defaultAnnotation == null) return null; + //check whether the class has a constructor for numeric types + String valueString = defaultAnnotation.value(); + long value = Long.parseLong(valueString); + UperEncoder.logger.debug(String.format("Default INTEGER: %d",value )); + + @SuppressWarnings("unchecked") + T t = (T) new Asn1BigInteger(value); + return t; + + } + +}
\ No newline at end of file diff --git a/src/org/uic/barcode/asn1/uper/BitBuffer.java b/src/org/uic/barcode/asn1/uper/BitBuffer.java new file mode 100644 index 0000000..bba0de7 --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/BitBuffer.java @@ -0,0 +1,32 @@ +package org.uic.barcode.asn1.uper; + +/** + * An interface for convenient storage of bits, similar to Java's ByteBuffer. + * + * This interface and its implementation are very useful for UPER, since UPER operates on bits + * regardless of byte boundaries. + * + */ +public interface BitBuffer { + boolean get(); + boolean get(int index); + BitBuffer put(boolean element); + BitBuffer put(int index, boolean element); + int limit(); + int capacity(); + int position(); + int remaining(); + BitBuffer flip(); + String toBooleanString(int startIndex, int length); + String toBooleanStringFromPosition(int startIndex); + byte[] array(); + BitBuffer putByte(byte element); + byte getByte(); + void putInteger(int index, int length,int number); + void putChar6String(int index, int length, String s); + int getInteger(int index, int length); + String getChar6String(int position, int length); + void putChar5String(int index, int length, String s); + String getChar5String(int inxed, int length); + BitBuffer putByteArray(int index, byte[] data); +} diff --git a/src/org/uic/barcode/asn1/uper/BitStringCoder.java b/src/org/uic/barcode/asn1/uper/BitStringCoder.java new file mode 100644 index 0000000..ba1692c --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/BitStringCoder.java @@ -0,0 +1,165 @@ +package org.uic.barcode.asn1.uper; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import org.uic.barcode.asn1.datatypes.Asn1VarSizeBitstring; +import org.uic.barcode.asn1.datatypes.Bitstring; +import org.uic.barcode.asn1.datatypes.FixedSize; +import org.uic.barcode.asn1.datatypes.SizeRange; +import org.uic.barcode.asn1.uper.UperEncoder.Asn1ContainerFieldSorter; + +class BitStringCoder implements Decoder, Encoder { + + @Override public <T> boolean canEncode(T obj, Annotation[] extraAnnotations) { + Class<?> type = obj.getClass(); + AnnotationStore annotations = new AnnotationStore(type.getAnnotations(), + extraAnnotations); + return annotations.getAnnotation(Bitstring.class) != null; + } + + @Override public <T> void encode(BitBuffer bitbuffer, T obj, Annotation[] extraAnnotations) throws Asn1EncodingException { + Class<?> type = obj.getClass(); + AnnotationStore annotations = new AnnotationStore(type.getAnnotations(), + extraAnnotations); + if (!(obj instanceof Asn1VarSizeBitstring)) { + if (UperEncoder.hasExtensionMarker(annotations)) { + throw new UnsupportedOperationException( + "Bitstring with extensions is not implemented yet"); + } + FixedSize size = type.getAnnotation(FixedSize.class); + int position = bitbuffer.position(); + if (size != null) { + Asn1ContainerFieldSorter sorter = new Asn1ContainerFieldSorter(type); + if (sorter.ordinaryFields.size() != size.value()) { throw new AssertionError( + "Declared size (" + size.value() + + ") and number of fields (" + sorter.ordinaryFields.size() + + ") do not match!"); } + for (Field f : sorter.ordinaryFields) { + try { + bitbuffer.put(f.getBoolean(obj)); + } catch (IllegalArgumentException | IllegalAccessException e) { + throw new IllegalArgumentException("can't encode" + obj, e); + } + } + UperEncoder.logger.debug(String.format("BITSTRING %s, encoded as <%s>", obj.getClass().getName(), + bitbuffer.toBooleanStringFromPosition(position))); + return; + } else { + throw new UnsupportedOperationException( + "Bitstrings of variable size are not implemented yet"); + } + } else if (obj instanceof Asn1VarSizeBitstring) { + int position = bitbuffer.position(); + if (UperEncoder.hasExtensionMarker(annotations)) { throw new UnsupportedOperationException( + "Bitstring with extensions is not implemented yet"); } + Asn1VarSizeBitstring bitstring = (Asn1VarSizeBitstring) obj; + FixedSize fixedSize = annotations.getAnnotation(FixedSize.class); + SizeRange sizeRange = annotations.getAnnotation(SizeRange.class); + if (fixedSize != null) { + for (int i = 0; i < fixedSize.value(); i++) { + bitbuffer.put(bitstring.getBit(i)); + } + UperEncoder.logger.debug(String.format("BITSTRING %s: %s", obj.getClass().getName(), + bitbuffer.toBooleanStringFromPosition(position))); + return; + } else if (sizeRange != null) { + int position1 = bitbuffer.position(); + UperEncoder.encodeConstrainedInt(bitbuffer, bitstring.size(), sizeRange.minValue(), + sizeRange.maxValue()); + int position2 = bitbuffer.position(); + for (int i = 0; i < bitstring.size(); i++) { + bitbuffer.put(bitstring.getBit(i)); + } + UperEncoder.logger.debug(String.format("BITSTRING %s size %s: %S", obj.getClass().getName(), + bitbuffer.toBooleanString(position1, position2 - position1), + bitbuffer.toBooleanStringFromPosition(position2))); + return; + } else { + throw new IllegalArgumentException("Both SizeRange and FixedSize are null"); + } + } + } + + @Override public <T> boolean canDecode(Class<T> classOfT, Annotation[] extraAnnotations) { + AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(), + extraAnnotations); + return annotations.getAnnotation(Bitstring.class) != null; + } + + @Override public <T> T decode(BitBuffer bitbuffer, + Class<T> classOfT, Field field, + Annotation[] extraAnnotations) { + AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(), + extraAnnotations); + if (!Asn1VarSizeBitstring.class.isAssignableFrom(classOfT)) { + UperEncoder.logger.debug("Bitlist(fixed-size, all-named)"); + FixedSize fixedSize = annotations.getAnnotation(FixedSize.class); + if (fixedSize == null) { throw new UnsupportedOperationException( + "bitstrings of non-fixed size that do not extend Asn1VarSizeBitstring are not supported yet"); + } + Asn1ContainerFieldSorter sorter = new Asn1ContainerFieldSorter(classOfT); + if (fixedSize.value() != sorter.ordinaryFields.size()) { throw new IllegalArgumentException( + "Fixed size annotation " + fixedSize.value() + + " does not match the number of fields " + + sorter.ordinaryFields.size() + " in " + classOfT.getName()); } + if (UperEncoder.hasExtensionMarker(annotations)) { + boolean extensionPresent = bitbuffer.get(); + if (extensionPresent) { throw new UnsupportedOperationException( + "extensions in fixed-size bitlist are not supported yet"); } + } + T result = UperEncoder.instantiate(classOfT); + for (Field f : sorter.ordinaryFields) { + boolean value = bitbuffer.get(); + UperEncoder.logger.debug(String.format("Field %s set to %s", f.getName(), value)); + try { + f.set(result, value); + } catch (IllegalArgumentException | IllegalAccessException e) { + throw new IllegalArgumentException("can't decode " + classOfT, e); + } + } + return result; + } else { + UperEncoder.logger.debug("Bitlist(var-size)"); + FixedSize fixedSize = annotations.getAnnotation(FixedSize.class); + SizeRange sizeRange = annotations.getAnnotation(SizeRange.class); + // We use reflection here to access protected method of Asn1VarSizeBitstring. + // Alternative would be to mandate BitSet constructors for all subclasses of + // Asn1VarSizeBitstring. + Method setBitMethod; + try { + setBitMethod = Asn1VarSizeBitstring.class.getDeclaredMethod("setBit", int.class, + boolean.class); + setBitMethod.setAccessible(true); + } catch (SecurityException | NoSuchMethodException e) { + throw new AssertionError("Can't find/access setBit " + e); + } + Long size = (fixedSize != null) ? fixedSize.value() : + (sizeRange != null) ? UperEncoder.decodeConstrainedInt(bitbuffer, + UperEncoder.intRangeFromSizeRange(sizeRange)) : + badSize(classOfT); + T result = UperEncoder.instantiate(classOfT); + for (int i = 0; i < size; i++) { + try { + setBitMethod.invoke(result, i, bitbuffer.get()); + } catch (IllegalArgumentException | InvocationTargetException | IllegalAccessException e) { + throw new IllegalArgumentException("Can't invoke setBit", e); + } + } + return result; + } + } + + /** This function only throws an exception, to be used in ternary (a?b:c) expression. */ + static <T> Long badSize(Class<T> classOfT) { + throw new IllegalArgumentException("both size range and fixed size are null for " + + classOfT.getName()); + } + + @Override + public <T> T getDefault(Class<T> classOfT, Annotation[] extraAnnotations) { + throw new IllegalArgumentException("Default Sequence not yet implemented"); + } +}
\ No newline at end of file diff --git a/src/org/uic/barcode/asn1/uper/BooleanCoder.java b/src/org/uic/barcode/asn1/uper/BooleanCoder.java new file mode 100644 index 0000000..3bd7a38 --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/BooleanCoder.java @@ -0,0 +1,35 @@ +package org.uic.barcode.asn1.uper; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; + +class BooleanCoder implements Decoder, Encoder { + + @Override public <T> boolean canEncode(T obj, Annotation[] extraAnnotations) { + return obj instanceof Boolean; + } + + @Override public <T> void encode(BitBuffer bitbuffer, T obj, Annotation[] extraAnnotations) { + UperEncoder.logger.debug(String.format("BOOLEAN %s", obj)); + bitbuffer.put((Boolean) obj); + } + + @Override public <T> boolean canDecode(Class<T> classOfT, Annotation[] extraAnnotations) { + return Boolean.class.isAssignableFrom(classOfT) + || boolean.class.isAssignableFrom(classOfT); + } + + @SuppressWarnings("unchecked") + @Override public <T> T decode(BitBuffer bitbuffer, + Class<T> classOfT, Field field, + Annotation[] extraAnnotations) { + Boolean result = new Boolean(bitbuffer.get()); + UperEncoder.logger.debug(String.format("BOOL: decoded as %s",result)); + return (T) result; + } + + @Override + public <T> T getDefault(Class<T> classOfT, Annotation[] extraAnnotations) { + throw new IllegalArgumentException("Default Boolean not yet implemented"); + } +}
\ No newline at end of file diff --git a/src/org/uic/barcode/asn1/uper/ByteBitBuffer.java b/src/org/uic/barcode/asn1/uper/ByteBitBuffer.java new file mode 100644 index 0000000..3ed3eed --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/ByteBitBuffer.java @@ -0,0 +1,271 @@ +package org.uic.barcode.asn1.uper; + + + +public class ByteBitBuffer implements BitBuffer { + + byte[] bytes; + byte[] mask = new byte[] { + (byte) 0b1000_0000, + 0b0100_0000, + 0b0010_0000, + 0b0001_0000, + 0b0000_1000, + 0b0000_0100, + 0b0000_0010, + 0b0000_0001, + }; + + boolean isFinite; + + int mark; + int position; + int limit; + + + @Override public boolean get(int index) { + if (index < 0) { + throw new IndexOutOfBoundsException("Index " + index + " is less than 0"); + } else if (index >= limit) { + throw new IndexOutOfBoundsException("Index " + index + " violates the limit " + limit); + } + boolean result = (bytes[index / 8] & mask[index % 8]) != 0; + return result; + } + + @Override public boolean get() { + boolean result = get(position); + position++; + return result; + } + + private void grow() { + byte[] newbytes = new byte[2 * bytes.length]; + System.arraycopy(bytes, 0, newbytes, 0, bytes.length); + bytes = newbytes; + } + + @Override public BitBuffer put(int index, boolean element) { + if (bytes.length <= index / 8) { + if (isFinite) { throw new IndexOutOfBoundsException(); } + else { grow(); } + } + if (element) { + bytes[index / 8] |= mask[index % 8]; + } else { + bytes[index / 8] &= ~mask[index % 8]; + } + return this; + } + + @Override public BitBuffer put(boolean element) { + put(position, element); + position++; + limit = limit < position ? position : limit; // TODO: should it be here? + return this; + } + + @Override public BitBuffer putByte(byte element) { + for (int i = 0; i < 8; i++) { + put((element & mask[i]) != 0); + } + return this; + } + + @Override public BitBuffer putByteArray(int index, byte[] data) { + + for (int l = 0; l < data.length;l++) { + for (int i = 0; i < 8; i++) { + put((data[l] & mask[i]) != 0); + } + } + return this; + } + + + @Override public byte getByte() { + byte result = 0; + for (int i = 0; i < 8; i++) { + result |= (get() ? 1 : 0) << (7 - i); + } + return result; + } + + @Override public int limit() { + return limit; + } + + @Override public String toBooleanString(int startIndex, int length) { + StringBuilder sb = new StringBuilder(length); + for (int i = startIndex; i < startIndex + length; i++) { + sb.append(get(i) ? "1" : "0"); + } + return sb.toString(); + } + + @Override public int capacity() { + return isFinite ? bytes.length * 8 : Integer.MAX_VALUE; + } + + @Override public int position() { + return position; + } + + @Override public int remaining() { + return limit - position; + } + + public ByteBitBuffer(byte[] backingArray) { + this.bytes = backingArray; + this.isFinite = true; + } + + private ByteBitBuffer(int initialCapacity) { + this.bytes = new byte[initialCapacity]; + this.isFinite = false; + } + + public static ByteBitBuffer allocate(int lengthInBits) { + return new ByteBitBuffer(new byte[(lengthInBits + 7) / 8]); + } + + public static ByteBitBuffer createInfinite() { + return new ByteBitBuffer(64); + } + + @Override public BitBuffer flip() { + limit = position; + position = 0; + return this; + } + + @Override public String toBooleanStringFromPosition(int startIndex) { + return toBooleanString(startIndex, position-startIndex); + } + + @Override public byte[] array() { + return bytes; + } + + @Override + public void putInteger(int position, int length,int number) { + String s = Integer.toBinaryString(number); + if (s.length() > length) { + //value is to large + return; + } + + for (int i = 0;i < length;i++){ + int index = position + i; + this.put(index,false); + } + + + int startIndex = position + length - s.length(); + for (int i = 0;i < s.length();i++){ + /* + * i = max --> index = position + length - 1 + * i = 0 --> index = position + + */ + int index = startIndex + i; + if (s.charAt(i) == '1') { + this.put(index, true ); + } else { + this.put(index, false); + } + } + + } + + @Override + public void putChar5String(int position, int length, String s) { + + String upperCaseString = s.toUpperCase(); + int offset = 0; + for (int i = 0; i < s.length() ; i++) { + char character = upperCaseString.charAt(i); + int intValue = (int) character - 32; + if (intValue > -1 && intValue < 64) { + this.putInteger(position + offset,5, intValue); + offset = offset + 5; + } else { + this.putInteger(position + offset,5,0); + position = position + 5; + } + } + } + + @Override + public void putChar6String(int position, int length, String s) { + + String upperCaseString = s.toUpperCase(); + int offset = 0; + for (int i = 0; i < s.length() ; i++) { + char character = upperCaseString.charAt(i); + int intValue = (int) character - 32; + if (intValue > -1 && intValue < 64) { + this.putInteger(position + offset,6, intValue); + offset = offset + 6; + } else { + this.putInteger(position + offset,6,0); + position = position + 6; + } + } + } + + @Override + public int getInteger(int position, int length) { + StringBuffer sb = new StringBuffer(); + for (int i = 0;i < length;i++){ + if (this.get(position + i)) { + sb.append("1"); + } else { + sb.append("0"); + } + } + return Integer.parseInt(sb.toString(), 2); + } + + @Override + public String getChar6String(int position, int length) { + + StringBuilder stringBuilder = new StringBuilder(); + + int chars = length / 6; + + for (int i = 0; i < chars; i++) { + int newPosition = position + i * 6; + + int x = this.getInteger(newPosition, 6); + x = x + 32; + + char c = (char) x; + stringBuilder.append(c); + + } + + return stringBuilder.toString().trim(); + } + + @Override + public String getChar5String(int position, int length) { + + StringBuilder stringBuilder = new StringBuilder(); + + int chars = length / 5; + + for (int i = 0; i < chars; i++) { + int newPosition = position + i * 5; + + int x = getInteger(newPosition, 5); + x = x + 42; + + char c = (char) x; + stringBuilder.append(c); + + } + + return stringBuilder.toString().trim(); + } + +} diff --git a/src/org/uic/barcode/asn1/uper/ByteCoder.java b/src/org/uic/barcode/asn1/uper/ByteCoder.java new file mode 100644 index 0000000..f26a598 --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/ByteCoder.java @@ -0,0 +1,34 @@ +package org.uic.barcode.asn1.uper; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; + +class ByteCoder implements Decoder, Encoder { + + @Override public <T> boolean canEncode(T obj, Annotation[] extraAnnotations) { + return obj instanceof Byte; + } + + @Override public <T> void encode(BitBuffer bitbuffer, T obj, Annotation[] extraAnnotations) throws Asn1EncodingException { + UperEncoder.encodeConstrainedInt(bitbuffer, ((Byte) obj).byteValue() & 0xff, 0, 255); + UperEncoder.logger.debug(String.format("BYTE %s", ((Byte) obj).byteValue())); + } + + @Override public <T> boolean canDecode(Class<T> classOfT, Annotation[] extraAnnotations) { + return Byte.class.isAssignableFrom(classOfT) || byte.class.isAssignableFrom(classOfT); + } + + @SuppressWarnings("unchecked") + @Override public <T> T decode(BitBuffer bitbuffer, + Class<T> classOfT, Field field, + Annotation[] extraAnnotations) { + UperEncoder.logger.debug("BYTE"); + return (T) new Byte((byte) UperEncoder.decodeConstrainedInt(bitbuffer, UperEncoder.newRange(0, 255, false))); + } + + @Override + public <T> T getDefault(Class<T> classOfT, Annotation[] extraAnnotations) { + throw new IllegalArgumentException("Default Byte not yet implemented"); + } + +}
\ No newline at end of file diff --git a/src/org/uic/barcode/asn1/uper/ChoiceCoder.java b/src/org/uic/barcode/asn1/uper/ChoiceCoder.java new file mode 100644 index 0000000..d17a813 --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/ChoiceCoder.java @@ -0,0 +1,161 @@ +package org.uic.barcode.asn1.uper; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; + +import org.uic.barcode.asn1.datatypes.Choice; +import org.uic.barcode.asn1.uper.UperEncoder.Asn1ContainerFieldSorter; + +class ChoiceCoder implements Decoder, Encoder { + + @Override public <T> boolean canEncode(T obj, Annotation[] extraAnnotations) { + Class<?> type = obj.getClass(); + AnnotationStore annotations = new AnnotationStore(type.getAnnotations(), + extraAnnotations); + return annotations.getAnnotation(Choice.class) != null; + } + + @Override public <T> void encode(BitBuffer bitbuffer, T obj, Annotation[] extraAnnotations) throws Asn1EncodingException { + Class<?> type = obj.getClass(); + AnnotationStore annotations = new AnnotationStore(type.getAnnotations(),extraAnnotations); + UperEncoder.logger.debug("CHOICE"); + int nonNullIndex = 0; + Field nonNullField = null; + Object nonNullFieldValue = null; + int currentIndex = 0; + Asn1ContainerFieldSorter sorter = new Asn1ContainerFieldSorter(type); + try { + for (Field f : sorter.ordinaryFields) { + if (f.get(obj) != null) { + nonNullIndex = currentIndex; + nonNullFieldValue = f.get(obj); + nonNullField = f; + break; + } + currentIndex++; + } + if (nonNullFieldValue != null) { + if (UperEncoder.hasExtensionMarker(annotations)) { + boolean extensionBit = false; + UperEncoder.logger.debug(String.format("with extension marker, set to %s", extensionBit)); + bitbuffer.put(extensionBit); + } + if (sorter.ordinaryFields.size() > 1) { // Encode index only if more than one. + UperEncoder.logger.debug(String.format("with chosen element indexed %d", nonNullIndex)); + UperEncoder.encodeConstrainedInt(bitbuffer, nonNullIndex, 0, + sorter.ordinaryFields.size() - 1); + } + UperEncoder.encode2(bitbuffer, nonNullFieldValue, nonNullField.getAnnotations()); + return; + } else if (UperEncoder.hasExtensionMarker(annotations)) { + //CG encoding of extension fields + currentIndex = 0; + for (Field f : sorter.extensionFields) { + if (f.get(obj) != null) { + nonNullIndex = currentIndex; + nonNullFieldValue = f.get(obj); + nonNullField = f; + break; + } + currentIndex++; + } + if (nonNullField == null) { + UperEncoder.logger.debug(String.format("without choice of extension")); + return; + } + boolean extensionBit = true; + UperEncoder.logger.debug(String.format("with extension marker, set to <%s>", extensionBit)); + bitbuffer.put(extensionBit); + + //CG encode extension values + //Always encode index of the element + UperEncoder.logger.debug(String.format("with chosen extension element indexed %d", nonNullIndex)); + + //encode small integer even with value 0 + UperEncoder.encodeSmallInt(bitbuffer, nonNullIndex); + + //Encode as open field + UperEncoder.encodeAsOpenType(bitbuffer, nonNullFieldValue, nonNullField.getAnnotations()); + return; + } else { + throw new IllegalArgumentException("Not Extension and All ordinary fields of Choice are null"); + } + } catch (IllegalArgumentException | IllegalAccessException e) { + throw new IllegalArgumentException("can't encode " + obj, e); + } catch (Asn1EncodingException e) { + throw new Asn1EncodingException("." + type.getName(), e); + } + } + + @Override public <T> boolean canDecode(Class<T> classOfT, Annotation[] extraAnnotations) { + AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(), + extraAnnotations); + return annotations.getAnnotation(Choice.class) != null; + } + + @Override public <T> T decode(BitBuffer bitbuffer, + Class<T> classOfT, Field field1, + Annotation[] extraAnnotations) { + AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(),extraAnnotations); + UperEncoder.logger.debug(String.format("CHOICE: %s", classOfT.getName())); + T result = UperEncoder.instantiate(classOfT); + Asn1ContainerFieldSorter sorter = new Asn1ContainerFieldSorter(classOfT); + + // Reset all fields, since default constructor initializes one. + for (Field f : sorter.allFields) { + try { + f.set(result, null); + } catch (IllegalArgumentException | IllegalAccessException e) { + throw new IllegalArgumentException("can't decode " + classOfT, e); + } + } + if (UperEncoder.hasExtensionMarker(annotations)) { + UperEncoder.logger.debug("with extension marker"); + boolean extensionPresent = bitbuffer.get(); + if (extensionPresent) { + //CG extension support added + int i = (int) UperEncoder.decodeSmallInt(bitbuffer); + UperEncoder.logger.debug(String.format("extension with index %d is present",i)); + Field field = sorter.extensionFields.size() > i ? sorter.extensionFields.get(i) : null; + Class<?> classOfElement = field != null ? field.getType() : null; + if (field != null) { + try { + Object decodedValue = UperEncoder.decodeAsOpenType(bitbuffer, classOfElement,field, field.getAnnotations()); + if (field != null) { + field.set(result, decodedValue); + } + return result; + } catch (IllegalArgumentException | IllegalAccessException e) { + throw new IllegalArgumentException("can't decode " + classOfT, e); + } + } else { + //CG skip the unknown extension element + UperEncoder.decodeSkipUnknownElement(bitbuffer, classOfT.getSimpleName()); + return null; + } + //throw new UnsupportedOperationException("choice extension is not implemented yet"); + } else { + UperEncoder.logger.debug(String.format("no extension present")); + //no extension is present + //We already consumed the bit, keep processing as if there were no extension. + } + } + int index = (int) UperEncoder.decodeConstrainedInt(bitbuffer, + UperEncoder.newRange(0, sorter.ordinaryFields.size() - 1, false)); + Field f = sorter.ordinaryFields.get(index); + UperEncoder.logger.debug(String.format("CHOICE: selected %s", f.getName())); + Object fieldValue = UperEncoder.decodeAny(bitbuffer, f.getType(),f, f.getAnnotations()); + try { + f.set(result, fieldValue); + } catch (IllegalArgumentException | IllegalAccessException e) { + throw new IllegalArgumentException("can't decode " + classOfT, e); + } + return result; + } + + @Override + public <T> T getDefault(Class<T> classOfT, Annotation[] extraAnnotations) { + throw new IllegalArgumentException("Default Choice not yet implemented"); + } + +}
\ No newline at end of file diff --git a/src/org/uic/barcode/asn1/uper/Decoder.java b/src/org/uic/barcode/asn1/uper/Decoder.java new file mode 100644 index 0000000..947a752 --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/Decoder.java @@ -0,0 +1,10 @@ +package org.uic.barcode.asn1.uper; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; + +public interface Decoder { + <T> boolean canDecode(Class<T> classOfT, Annotation[] extraAnnotations); + <T> T decode(BitBuffer bitbuffer, Class<T> classOfT,Field f, Annotation[] extraAnnotations); + <T> T getDefault(Class<T> classOfT, Annotation[] extraAnnotations); +} diff --git a/src/net/gcdc/asn1/uper/Document2.txt b/src/org/uic/barcode/asn1/uper/Document2.txt index 176ec23..176ec23 100644 --- a/src/net/gcdc/asn1/uper/Document2.txt +++ b/src/org/uic/barcode/asn1/uper/Document2.txt diff --git a/src/org/uic/barcode/asn1/uper/Encoder.java b/src/org/uic/barcode/asn1/uper/Encoder.java new file mode 100644 index 0000000..1b3688f --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/Encoder.java @@ -0,0 +1,8 @@ +package org.uic.barcode.asn1.uper; + +import java.lang.annotation.Annotation; + +public interface Encoder { + <T> boolean canEncode(T obj, Annotation[] extraAnnotations); + <T> void encode(BitBuffer bitbuffer, T obj, Annotation[] extraAnnotations) throws Asn1EncodingException; +} diff --git a/src/org/uic/barcode/asn1/uper/EnumCoder.java b/src/org/uic/barcode/asn1/uper/EnumCoder.java new file mode 100644 index 0000000..5d78bc7 --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/EnumCoder.java @@ -0,0 +1,156 @@ +package org.uic.barcode.asn1.uper; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.uic.barcode.asn1.datatypes.Asn1Default; +import org.uic.barcode.asn1.datatypes.IsExtension; + +class EnumCoder implements Decoder, Encoder { + + @Override public <T> boolean canEncode(T obj, Annotation[] extraAnnotations) { + Class<?> type = obj.getClass(); + return type.isEnum(); + } + + @Override public <T> void encode(BitBuffer bitbuffer, T obj, Annotation[] extraAnnotations) throws Asn1EncodingException { + Class<?> type = obj.getClass(); + AnnotationStore annotations = new AnnotationStore(type.getAnnotations(), extraAnnotations); + String pos = String.format("%d.%d", bitbuffer.position()/8 , bitbuffer.position() % 8); + UperEncoder.logger.debug(String.format("Position %s ENUM",pos)); + try { + int position = bitbuffer.position(); + + List<?> values = Arrays.asList(type.getEnumConstants()); + int enumIndex = values.indexOf(obj); + + if (!UperEncoder.hasExtensionMarker(annotations)) { + UperEncoder.logger.debug(String.format("enum without extension: index %d value %s, encoding index...", enumIndex,obj.toString())); + UperEncoder.encodeConstrainedInt(bitbuffer, enumIndex, 0, values.size() - 1); + return; + } else { + List<Object> valuesWithinExtensionRoot = new ArrayList<>(); + List<Object> valuesOutsideExtensionRoot = new ArrayList<>(); + for (Object c : type.getEnumConstants()) { + String field = c.toString(); + boolean isExtension = false; + try { + isExtension = type.getField(field).isAnnotationPresent(IsExtension.class); + } catch (NoSuchFieldException e) { + throw new IllegalArgumentException("Illegal value for enum field " , e); + } catch (SecurityException e) { + throw new IllegalArgumentException("Illegal access restriction for enum field " , e); + } + + if (!isExtension) { + valuesWithinExtensionRoot.add(c); + } else { + valuesOutsideExtensionRoot.add(c); + } + } + + if (valuesWithinExtensionRoot.contains(obj)) { + UperEncoder.logger.debug(String.format("Extension indicator set to false")); + bitbuffer.put(false); + int index = valuesWithinExtensionRoot.indexOf(obj); + UperEncoder.encodeConstrainedInt(bitbuffer, index, 0, valuesWithinExtensionRoot.size() - 1); + UperEncoder.logger.debug(String.format("ENUM with extension: index %d value %s, encoded as root value <%s>", index, obj.toString(), + bitbuffer.toBooleanStringFromPosition(position))); + return; + } else { + //CG encode the index in the extension list as small integer + UperEncoder.logger.debug(String.format("Extension indicator set to true")); + bitbuffer.put(true); + int index = valuesOutsideExtensionRoot.indexOf(obj); + + UperEncoder.encodeSmallInt(bitbuffer, index); + UperEncoder.logger.debug(String.format("ENUM with extension: index %d value %s, encoded as extension <%s>", index, obj.toString(), + bitbuffer.toBooleanStringFromPosition(position))); + } + } + } catch (Asn1EncodingException e) { + throw new Asn1EncodingException(type.getName(), e); + } + } + + @Override public <T> boolean canDecode(Class<T> classOfT, Annotation[] extraAnnotations) { + return classOfT.isEnum(); + } + + @Override public <T> T decode(BitBuffer bitbuffer, + Class<T> classOfT, Field field, + Annotation[] extraAnnotations) { + AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(), extraAnnotations); + UperEncoder.logger.debug("ENUM"); + boolean extensionPresent = false; + if (UperEncoder.hasExtensionMarker(annotations)) { + extensionPresent = bitbuffer.get(); + UperEncoder.logger.debug(String.format("with extension marker, %s" , extensionPresent ? "present" : "absent")); + } + T[] enumValues = classOfT.getEnumConstants(); + + int rootValues = 0; + + boolean isExtension = false; + for (Object c : enumValues) { + String value = c.toString(); + try { + isExtension = classOfT.getField(value).isAnnotationPresent(IsExtension.class); + } catch (NoSuchFieldException e) { + throw new IllegalArgumentException("Illegal value for extension field " , e); + } catch (SecurityException e) { + throw new IllegalArgumentException("Illegal value for extension field " , e); + } + + if (!isExtension) rootValues++; + } + + // + int index = 0; + if (!extensionPresent){ + //root element + index = (int) UperEncoder.decodeConstrainedInt(bitbuffer, + UperEncoder.newRange(0, rootValues - 1, false)); + } else { + //extension element, decode as small int without restriction + index = (int) UperEncoder.decodeSmallInt(bitbuffer); + //the encoded index is an index within the extensions list only + index = index + rootValues; + } + + if (index > enumValues.length - 1 && extensionPresent) { + //this is an unknown extension + UperEncoder.logger.debug(String.format("Enum contains unknown extendion index %d" , index)); + return null; + } + if (index > enumValues.length - 1 && !extensionPresent) { + //this should not happen + throw new IllegalArgumentException( + "decoded enum index " + index + " is larger then number of elements (0.." + + enumValues.length + ") in " + classOfT.getName()); + } + T value = enumValues[index]; + UperEncoder.logger.debug(String.format("Enum decoded as %s" , value.toString())); + return value; + } + + @SuppressWarnings("unchecked") + @Override + public <T> T getDefault(Class<T> classOfT, Annotation[] extraAnnotations) { + AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(), extraAnnotations); + Asn1Default defaultAnnotation = annotations.getAnnotation(Asn1Default.class); + if (defaultAnnotation == null) return null; + + for (Object c : classOfT.getEnumConstants()) { + if (c.toString().equals(defaultAnnotation.value())) { + return (T) c; + } + } + + return null; + } + +}
\ No newline at end of file diff --git a/src/org/uic/barcode/asn1/uper/IntCoder.java b/src/org/uic/barcode/asn1/uper/IntCoder.java new file mode 100644 index 0000000..87b561b --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/IntCoder.java @@ -0,0 +1,267 @@ +package org.uic.barcode.asn1.uper; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; +import java.math.BigInteger; + +import org.uic.barcode.asn1.datatypes.Asn1BigInteger; +import org.uic.barcode.asn1.datatypes.Asn1Default; +import org.uic.barcode.asn1.datatypes.Asn1Integer; +import org.uic.barcode.asn1.datatypes.IntMinValue; +import org.uic.barcode.asn1.datatypes.IntRange; + + +class IntCoder implements Encoder, Decoder { + + + + @Override public <T> boolean canDecode(Class<T> classOfT, Annotation[] extraAnnotations) { + return classOfT == Asn1Integer.class || + classOfT == Asn1BigInteger.class|| + classOfT == BigInteger.class || + classOfT == Long.class || + classOfT == Integer.class || + classOfT == Short.class ; + } + + + @Override public <T> T decode(BitBuffer bitbuffer, + Class<T> classOfT, Field field, + Annotation[] extraAnnotations) { + AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(),extraAnnotations); + String pos = String.format("Position: %d.%d", bitbuffer.position()/8 , bitbuffer.position() % 8); + UperEncoder.logger.debug(String.format("%s: INTEGER",pos)); + IntRange intRange = annotations.getAnnotation(IntRange.class); + IntMinValue minValue = annotations.getAnnotation(IntMinValue.class); + + + if (intRange == null) { + return decodeUnconstrainedInteger(bitbuffer, classOfT, extraAnnotations, minValue); + } + UperEncoder.logger.debug(String.format("Integer, range %d..%d", intRange.minValue(), intRange.maxValue())); + return decodeConstrainedInteger(bitbuffer, classOfT, intRange, extraAnnotations); + } + + @SuppressWarnings("unchecked") + private <T> T decodeConstrainedInteger(BitBuffer bitbuffer, Class<T> classOfT, IntRange intRange, Annotation[] extraAnnotations) { + + long value = UperEncoder.decodeConstrainedInt(bitbuffer, intRange); + UperEncoder.logger.debug(String.format("decoded as %d", value)); + + try { + if (classOfT == Asn1BigInteger.class) { + return ((T) new Asn1BigInteger(value)); + } else if (classOfT == Asn1Integer.class) { + return (T) new Asn1Integer(value); + } else if (classOfT == BigInteger.class) { + return (T) BigInteger.valueOf(value); + } else if (classOfT == Long.class) { + return (T) Long.valueOf(value); + } else if (classOfT == Integer.class) { + return (T) Integer.valueOf(Long.valueOf(value).intValue()); + } else if (classOfT == Short.class) { + return (T) Short.valueOf(Long.valueOf(value).shortValue()); + } + } catch (Exception e) { + throw new IllegalArgumentException("size too small " + classOfT.getName() + ": " + e); + } + + return null; + + + } + + @Override public <T> boolean canEncode(T obj, Annotation[] extraAnnotations) { + return obj instanceof Asn1Integer || + obj instanceof Asn1BigInteger || + obj instanceof BigInteger || + obj instanceof Long || + obj instanceof Integer || + obj instanceof Short; + } + + @Override public <T> void encode(BitBuffer bitbuffer, T obj, Annotation[] extraAnnotations) throws Asn1EncodingException { + Class<?> type = obj.getClass(); + AnnotationStore annotations = new AnnotationStore(type.getAnnotations(), extraAnnotations); + IntRange range = annotations.getAnnotation(IntRange.class); + IntMinValue minValue = annotations.getAnnotation(IntMinValue.class); + int position = bitbuffer.position(); + + //get value + if (range == null) { + + try { + encodeUnconstrainedInteger(bitbuffer, obj, extraAnnotations,minValue); + } catch (Asn1EncodingException e) { + throw new Asn1EncodingException(" " + type.getSimpleName(), e); + } catch (Exception e1){ + throw new Asn1EncodingException(" " + type.getSimpleName() + " - " + e1.getLocalizedMessage()); + } + UperEncoder.logger.debug(String.format("INT(%s): %s", obj, bitbuffer.toBooleanStringFromPosition(position))); + + + } else { + + try { + + long value = 0; + if (obj instanceof BigInteger) { + try { + value = ((BigInteger) obj).longValue(); + } catch (Exception e) { + + UperEncoder.logger.debug("constrained BigInteger is too big for constrained int"); + throw new Asn1EncodingException("constrained BigInteger is too big for constrained int" + type.getSimpleName()); + } + } if (obj instanceof Asn1BigInteger) { + try { + value = ((Asn1BigInteger) obj).longValue(); + } catch (Exception e) { + + UperEncoder.logger.debug("constrained Asn1BigInteger is too big for constrained int"); + throw new Asn1EncodingException("constrained Asn1BigInteger is too big for constrained int" + type.getSimpleName()); + } + } if (obj instanceof Asn1Integer) { + try { + value = Asn1Integer.toLong((Asn1Integer) obj); + } catch (Exception e) { + + UperEncoder.logger.debug("constrained BigInteger is too big for constrained int"); + throw new Asn1EncodingException("constrained BigInteger is too big for constrained int" + type.getSimpleName()); + } + } else if (obj instanceof Long) { + value = ((Long) obj).longValue(); + } else if (obj instanceof Integer) { + value = ((Integer) obj).longValue(); + } else if (obj instanceof Short) { + value = ((Short) obj).longValue(); + } + + UperEncoder.encodeConstrainedInt(bitbuffer, value, range.minValue(), range.maxValue(), range.hasExtensionMarker()); + } catch (Asn1EncodingException e) { + throw new Asn1EncodingException(" " + type.getSimpleName(), e); + } catch (Exception e1){ + throw new Asn1EncodingException(" " + type.getSimpleName() + " - " + e1.getLocalizedMessage()); + } + UperEncoder.logger.debug(String.format("INT(%s): %s", obj, bitbuffer.toBooleanStringFromPosition(position))); + } + return; + } + + private <T> void encodeUnconstrainedInteger(BitBuffer bitbuffer, Object obj, Annotation[] annotations, IntMinValue minValue) throws Asn1EncodingException { + + + BigInteger bint = null; + try { + if (obj instanceof BigInteger) { + bint = (BigInteger) obj; + } else if (obj instanceof Asn1BigInteger) { + bint = BigInteger.valueOf(((Asn1BigInteger) obj).longValue()); + } else if (obj instanceof Asn1Integer) { + bint = BigInteger.valueOf(((Asn1Integer) obj).value()); + } else if (obj instanceof Long) { + bint = BigInteger.valueOf(((Long) obj).longValue()); + } else if (obj instanceof Integer) { + bint = BigInteger.valueOf(((Integer) obj).longValue()); + } else if (obj instanceof Short) { + bint = BigInteger.valueOf(((Short) obj).longValue()); + } + } catch (Exception e1){ + throw new Asn1EncodingException(" " + obj.getClass().getSimpleName() + " - " + e1.getLocalizedMessage()); + } + + + if (minValue != null) { + bint.subtract(BigInteger.valueOf(minValue.minValue())); + } + + byte[] array = bint.toByteArray(); + int lengthInOctets = array.length; + int position1 = bitbuffer.position(); + try { + UperEncoder.encodeLengthDeterminant(bitbuffer, lengthInOctets); + } catch (Asn1EncodingException e) { + throw new Asn1EncodingException(" length determinant of INTEGER", e); + } + int position2 = bitbuffer.position(); + for (byte b : array) { + bitbuffer.putByte(b); + } + UperEncoder.logger.debug(String.format("INTEGER Int(%s): len %s, val %s", bint.toString(), + bitbuffer.toBooleanString(position1, position2 - position1), + bitbuffer.toBooleanStringFromPosition(position2))); + return; + } + + @SuppressWarnings("unchecked") + public <T> T decodeUnconstrainedInteger(BitBuffer bitbuffer, Class<T> classOfT, Annotation[] extraAnnotations,IntMinValue minValue) { + AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(), extraAnnotations); + + String pos = String.format("%d.%d", bitbuffer.position()/8 , bitbuffer.position() % 8); + UperEncoder.logger.debug(String.format("Position %s BIG INT",pos)); + IntRange intRange = annotations.getAnnotation(IntRange.class); + if (intRange != null && intRange.maxValue() > 0) { + throw new UnsupportedOperationException("Big int with upper range is not supported yet"); + } + + int lengthInOctets = (int) UperEncoder.decodeLengthDeterminant(bitbuffer); + BitBuffer valueBits = ByteBitBuffer.allocate(lengthInOctets * 8); + for (int i = 0; i < lengthInOctets * 8; i++) { + valueBits.put(bitbuffer.get()); + } + valueBits.flip(); + BigInteger resultValue = new BigInteger(+1, valueBits.array()); + if (minValue != null) { + resultValue.add(BigInteger.valueOf(minValue.minValue())); + } + + UperEncoder.logger.debug(String.format("INTEGER Decoded as %s", resultValue)); + + try { + if (classOfT == Asn1BigInteger.class) { + return (T) new Asn1BigInteger(resultValue); + } else if (classOfT == BigInteger.class) { + return (T) resultValue; + } else if (classOfT == Long.class) { + return (T) Long.valueOf(resultValue.longValueExact()); + } else if (classOfT == Integer.class) { + return (T) Integer.valueOf(resultValue.intValueExact()); + } else if (classOfT == Short.class) { + return (T) Short.valueOf(resultValue.shortValueExact()); + } + } catch (Exception e){ + UperEncoder.logger.debug(String.format("INTEGER Decoded as %s is too big for data type", resultValue)); + } + return null; + } + + @SuppressWarnings("unchecked") + @Override + public <T> T getDefault(Class<T> classOfT, Annotation[] extraAnnotations) { + AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(), extraAnnotations); + Asn1Default defaultAnnotation = annotations.getAnnotation(Asn1Default.class); + if (defaultAnnotation == null) return null; + //check whether the class has a constructor for numeric types + String valueString = defaultAnnotation.value(); + long value = Long.parseLong(valueString); + + try { + if (classOfT == Asn1BigInteger.class) { + return ((T) new Asn1BigInteger(value)); + } else if (classOfT == BigInteger.class) { + return (T) BigInteger.valueOf(value); + } else if (classOfT == Long.class) { + return (T) Long.valueOf(value); + } else if (classOfT == Integer.class) { + return (T) Integer.valueOf(Long.valueOf(value).intValue()); + } else if (classOfT == Short.class) { + return (T) Short.valueOf(Long.valueOf(value).shortValue()); + } + } catch (Exception e) { + throw new IllegalArgumentException("size too small " + classOfT.getName() + ": " + e); + } + + return null; + } + +}
\ No newline at end of file diff --git a/src/org/uic/barcode/asn1/uper/ObjectIdentifierCoder.java b/src/org/uic/barcode/asn1/uper/ObjectIdentifierCoder.java new file mode 100644 index 0000000..2835e10 --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/ObjectIdentifierCoder.java @@ -0,0 +1,175 @@ +package org.uic.barcode.asn1.uper;
+
+import java.io.ByteArrayOutputStream;
+import java.math.BigInteger;
+
+public class ObjectIdentifierCoder {
+
+
+/*
+ OID encoding for dummies :) :
+
+ each OID component is encoded to one or more bytes (octets)
+
+ OID encoding is just a concatenation of these OID component encodings
+
+ first two components are encoded in a special way (see below)
+
+ if OID component binary value has less than 7 bits, the encoding is just a single octet,
+ holding the component value (note, most significant bit, leftmost, will always be 0)
+ otherwise, if it has 8 and more bits, the value is "spread" into multiple octets - split the
+ binary representation into 7 bit chunks (from right), left-pad the first one with zeroes if needed,
+ and form octets from these septets by adding most significant (left) bit 1, except from the last
+ chunk, which will have bit 0 there.
+
+ first two components (X.Y) are encoded like it is a single component with a value 40*X + Y
+
+ This is a rewording of ITU-T recommendation X.690, chapter 8.19
+
+*/
+
+ /*
+ *
+The first octet has value 40 * value1 + value2. (This is unambiguous, since value1 is limited to values 0, 1, and 2; value2 is limited to the range 0 to 39 when value1 is 0 or 1; and, according to X.208, n is always at least 2.)
+
+The following octets, if any, encode value3, ..., valuen.
+Each value is encoded base 128, most significant digit first, with as few digits as possible, and the most significant bit of each octet except the last in the value's encoding set to "1."
+
+Example: The first octet of the BER encoding of RSA Data Security, Inc.'s object identifier is 40 * 1 + 2 = 42 = 2a16. The encoding of 840 = 6 * 128 + 4816 is 86 48 and the encoding of 113549 = 6 * 1282 + 7716 * 128 + d16 is 86 f7 0d. This leads to the following BER encoding:
+
+06 06 2a 86 48 86 f7 0d
+ */
+
+ private static final Long LONG_LIMIT = (Long.MAX_VALUE >> 7) - 0x7f;
+
+
+ /*
+ * adaptation of the bouncy castle implementation available at bouncy castle under APACHE 2.0 license
+ */
+ public static String decodeObjectId(byte[] bytes) {
+
+ StringBuffer objId = new StringBuffer();
+ long value = 0;
+ BigInteger bigValue = null;
+ boolean first = true;
+
+ for (int i = 0; i != bytes.length; i++) {
+
+ int b = bytes[i] & 0xff;
+
+ if (value <= LONG_LIMIT) {
+ value += (b & 0x7f);
+ if ((b & 0x80) == 0) { // end of number reached
+
+ if (first) {
+ if (value < 40) {
+ objId.append('0');
+ } else if (value < 80) {
+ objId.append('1');
+ value -= 40;
+ } else {
+ objId.append('2');
+ value -= 80;
+ }
+ first = false;
+ }
+
+ objId.append('.');
+ objId.append(value);
+ value = 0;
+ } else {
+ value <<= 7;
+ }
+ } else {
+ if (bigValue == null) {
+ bigValue = BigInteger.valueOf(value);
+ }
+ bigValue = bigValue.or(BigInteger.valueOf(b & 0x7f));
+ if ((b & 0x80) == 0) {
+ if (first) {
+ objId.append('2');
+ bigValue = bigValue.subtract(BigInteger.valueOf(80));
+ first = false;
+ }
+ objId.append('.');
+ objId.append(bigValue);
+ bigValue = null;
+ value = 0;
+ } else {
+ bigValue = bigValue.shiftLeft(7);
+ }
+ }
+ }
+
+ return objId.toString();
+
+ }
+
+
+ public static byte[] encodeObjectId(String oids) {
+
+ String[] components = oids.split("\\.");
+
+ if (components.length < 2) throw new AssertionError("Object Identifier Format error (" + oids + ")");
+
+ try {
+ int first = Integer.parseInt(components[0]) * 40;
+
+ ByteArrayOutputStream aOut = new ByteArrayOutputStream();
+
+
+ if (components[1].length() <= 18) {
+ writeField(aOut, first + Long.parseLong(components[1]));
+ } else {
+ writeField(aOut, new BigInteger(components[1]).add(BigInteger.valueOf(first)));
+ }
+
+ for (int i = 2; i < components.length; i++) {
+
+ if (components[i].length() <= 18) {
+ writeField(aOut, Long.parseLong(components[i]));
+ } else {
+ writeField(aOut, new BigInteger(components[i]));
+ }
+ }
+
+ return aOut.toByteArray();
+
+ } catch (NumberFormatException e) {
+ throw new AssertionError("Object Identifier Format error (" + oids + ")");
+ }
+ }
+
+
+ private static void writeField(ByteArrayOutputStream out, long fieldValue)
+ {
+ byte[] result = new byte[9];
+ int pos = 8;
+ result[pos] = (byte)((int)fieldValue & 0x7f);
+ while (fieldValue >= (1L << 7)) {
+ fieldValue >>= 7;
+ result[--pos] = (byte)((int)fieldValue & 0x7f | 0x80);
+ }
+ out.write(result, pos, 9 - pos);
+ }
+
+ private static void writeField(ByteArrayOutputStream out, BigInteger fieldValue)
+ {
+ int byteCount = (fieldValue.bitLength() + 6) / 7;
+ if (byteCount == 0) {
+ out.write(0);
+ } else {
+ BigInteger tmpValue = fieldValue;
+ byte[] tmp = new byte[byteCount];
+ for (int i = byteCount - 1; i >= 0; i--) {
+ tmp[i] = (byte)((tmpValue.intValue() & 0x7f) | 0x80);
+ tmpValue = tmpValue.shiftRight(7);
+ }
+ tmp[byteCount - 1] &= 0x7f;
+ out.write(tmp, 0, tmp.length);
+ }
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/asn1/uper/SeqOfCoder.java b/src/org/uic/barcode/asn1/uper/SeqOfCoder.java new file mode 100644 index 0000000..a7ae7ba --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/SeqOfCoder.java @@ -0,0 +1,156 @@ +package org.uic.barcode.asn1.uper; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; +import java.lang.reflect.ParameterizedType; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import org.uic.barcode.asn1.datatypes.FixedSize; +import org.uic.barcode.asn1.datatypes.SizeRange; +import org.uic.barcode.asn1.uper.SimpleTypeResolver.Unknown; + + +class SeqOfCoder implements Decoder, Encoder { + + @Override public <T> boolean canEncode(T obj, Annotation[] extraAnnotations) { + return obj instanceof List<?>; + } + + @Override public <T> void encode(BitBuffer bitbuffer, T obj, Annotation[] extraAnnotations) throws Asn1EncodingException { + Class<?> type = obj.getClass(); + UperEncoder.logger.debug(String.format("SEQUENCE OF %s",obj.getClass().getName())); + AnnotationStore annotations = new AnnotationStore(type.getAnnotations(), extraAnnotations); + List<?> list = (List<?>) obj; + + final FixedSize fixedSize = annotations.getAnnotation(FixedSize.class); + + //CG pass annotations too each field encoding + Annotation[] annotationArray = new Annotation[] {}; + if (annotations != null & annotations.getAnnotations() != null && !annotations.getAnnotations().isEmpty()) { + ArrayList<Annotation> fieldAnnotations = new ArrayList<Annotation>(); + fieldAnnotations.addAll(annotations.getAnnotations()); + annotationArray = new Annotation[fieldAnnotations.size()]; + for (int i = 0; i< fieldAnnotations.size();i++){ + annotationArray[i] = fieldAnnotations.get(i); + } + } + + SizeRange sizeRange = annotations.getAnnotation(SizeRange.class); + if (fixedSize != null) + sizeRange = new SizeRange() { + @Override public Class<? extends Annotation> annotationType() { return SizeRange.class; } + @Override public int minValue() { return fixedSize.value(); } + @Override public int maxValue() { return fixedSize.value(); } + @Override public boolean hasExtensionMarker() { return false; } + }; + if (sizeRange == null) { + int position1 = bitbuffer.position(); + try { + UperEncoder.encodeLengthDeterminant(bitbuffer, list.size()); + } catch (Asn1EncodingException e) { + throw new Asn1EncodingException(" number of elements ", e); + } + UperEncoder.logger.debug(String.format("unbound size %d, encoded as %s", list.size(), + bitbuffer.toBooleanStringFromPosition(position1))); + UperEncoder.logger.debug(String.format(" all elems of Seq Of: %s", list )); + for (Object elem : list) { + try { + UperEncoder.encode2(bitbuffer, elem, annotationArray); + } catch (Asn1EncodingException e) { + throw new Asn1EncodingException(" element " + elem.toString(), e); + } + } + return; + } + boolean outsideOfRange = list.size() < sizeRange.minValue() + || sizeRange.maxValue() < list.size(); + if (outsideOfRange && !sizeRange.hasExtensionMarker()) { throw new IllegalArgumentException( + "Out-of-range size for " + obj.getClass() + ", expected " + + sizeRange.minValue() + ".." + sizeRange.maxValue() + ", got " + + list.size()); } + if (sizeRange.hasExtensionMarker()) { + bitbuffer.put(outsideOfRange); + UperEncoder.logger.debug(String.format("With Extension Marker, %s of range (%d <= %d <= %d)", + (outsideOfRange ? "outside" : "inside"), sizeRange.minValue(), list.size(), + sizeRange.maxValue())); + if (outsideOfRange) { throw new UnsupportedOperationException( + "Sequence-of size range extensions are not implemented yet, range " + + sizeRange.minValue() + ".." + sizeRange.maxValue() + + ", requested size " + list.size()); } + } + UperEncoder.logger.debug(String.format("seq-of of constrained size %d, encoding size...", list.size())); + UperEncoder.encodeConstrainedInt(bitbuffer, list.size(), sizeRange.minValue(), sizeRange.maxValue()); + UperEncoder.logger.debug(String.format(" all elems of Seq Of: %s", list)); + for (Object elem : list) { + UperEncoder.encode2(bitbuffer, elem, new Annotation[] {}); + } + } + + @Override public <T> boolean canDecode(Class<T> classOfT, Annotation[] extraAnnotations) { + return List.class.isAssignableFrom(classOfT); + } + + @SuppressWarnings("unchecked") + @Override public <T> T decode(BitBuffer bitbuffer, + Class<T> classOfT,Field field, + Annotation[] extraAnnotations) { + AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(), + extraAnnotations); + UperEncoder.logger.debug(String.format("SEQUENCE OF for %s", classOfT)); + FixedSize fixedSize = annotations.getAnnotation(FixedSize.class); + SizeRange sizeRange = annotations.getAnnotation(SizeRange.class); + + //CG pass annotations from the sequence to each element encoding + Annotation[] annotationArray = new Annotation[] {}; + + if (annotations != null && annotations.getAnnotations() != null && !annotations.getAnnotations().isEmpty()){ + annotationArray = new Annotation[annotations.getAnnotations().size()]; + Iterator<Annotation> it = annotations.getAnnotations().iterator(); + int i = 0; + while (it.hasNext()) { + annotationArray[i] = it.next(); + i++; + } + } + + + long size = + (fixedSize != null) ? fixedSize.value() : + (sizeRange != null) ? UperEncoder.decodeConstrainedInt(bitbuffer, UperEncoder.intRangeFromSizeRange(sizeRange)) : + UperEncoder.decodeLengthDeterminant(bitbuffer); + Collection<Object> coll = new ArrayList<Object>((int) size); + + Class<?> classOfElements; + Class<?>[] typeArgs = SimpleTypeResolver.resolveRawArguments(List.class, classOfT); + classOfElements = typeArgs[0]; + if (classOfElements == null || classOfElements == Unknown.class) { + try { + ParameterizedType elementType = (ParameterizedType) field.getGenericType(); + classOfElements = (Class<?>) elementType.getActualTypeArguments()[0]; + } catch (SecurityException e) { + throw new IllegalArgumentException("Can't resolve type of elements for " + classOfT.getName()); + } + } + for (int i = 0; i < size; i++) { + coll.add(UperEncoder.decodeAny(bitbuffer, classOfElements,field, annotationArray)); + } + + T result = null; + try { + result = UperEncoder.instantiate(classOfT, coll); + } catch (Exception e) { + result = (T) coll; + } + return result; + + } + + + @Override + public <T> T getDefault(Class<T> classOfT, Annotation[] extraAnnotations) { + throw new IllegalArgumentException("Default Sequence not yet implemented"); + } +}
\ No newline at end of file diff --git a/src/org/uic/barcode/asn1/uper/SeqOfFixedSize.java b/src/org/uic/barcode/asn1/uper/SeqOfFixedSize.java new file mode 100644 index 0000000..5d75e72 --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/SeqOfFixedSize.java @@ -0,0 +1,18 @@ +package org.uic.barcode.asn1.uper; + +import java.util.Arrays; +import java.util.Collection; + +import org.uic.barcode.asn1.datatypes.Asn1SequenceOf; +import org.uic.barcode.asn1.datatypes.FixedSize; + + +public class SeqOfFixedSize { + @FixedSize(3) + public static class Bar extends Asn1SequenceOf<Byte> { + public Bar(Byte... coll) { this(Arrays.asList(coll)); } + public Bar(Collection<Byte> coll) { super(coll); } + } + + +} diff --git a/src/org/uic/barcode/asn1/uper/SequenceCoder.java b/src/org/uic/barcode/asn1/uper/SequenceCoder.java new file mode 100644 index 0000000..5e8386e --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/SequenceCoder.java @@ -0,0 +1,269 @@ +package org.uic.barcode.asn1.uper; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; +import java.util.ArrayDeque; +import java.util.Deque; + +import org.uic.barcode.asn1.datatypes.Asn1Default; +import org.uic.barcode.asn1.datatypes.Asn1SequenceOf; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder.Asn1ContainerFieldSorter; + +class SequenceCoder implements Decoder, Encoder { + + @Override public <T> boolean canEncode(T obj, Annotation[] extraAnnotations) { + Class<?> type = obj.getClass(); + AnnotationStore annotations = new AnnotationStore(type.getAnnotations(), extraAnnotations); + + return annotations.getAnnotation(Sequence.class) != null; + } + + @Override public <T> void encode(BitBuffer bitbuffer, T obj, Annotation[] extraAnnotations) throws Asn1EncodingException { + Class<?> type = obj.getClass(); + AnnotationStore annotations = new AnnotationStore(type.getAnnotations(), extraAnnotations); + String pos = String.format("%d.%d", bitbuffer.position()/8 , bitbuffer.position() % 8); + UperEncoder.logger.debug(String.format("Position %s: SEQUENCE %s", pos, type.getSimpleName())); + + Asn1ContainerFieldSorter sorter = new Asn1ContainerFieldSorter(type); + try { + if (UperEncoder.hasExtensionMarker(annotations)) { + boolean extensionsPresent = !sorter.extensionFields.isEmpty() + && UperEncoder.hasNonNullExtensions(obj, sorter); + UperEncoder.logger.debug(String.format("with extension marker, %s extensions, extensionBit: <%s>", + extensionsPresent ? "with" : "without", extensionsPresent)); + bitbuffer.put(extensionsPresent); + } + // Bitmask for optional fields. + for (Field f : sorter.optionalOrdinaryFields) { + + boolean fieldPresent = isPresent(f, f.get(obj)); + + UperEncoder.logger.debug(String.format("with optional field %s %s, presence encoded as bit <%s>", + f.getName(), fieldPresent ? "present" : "absent", fieldPresent)); + + bitbuffer.put(fieldPresent); // null means the field is absent. + } + + // All ordinary fields (fields within extension root). + for (Field f : sorter.ordinaryFields) { + //CG do not include default values + if (UperEncoder.isMandatory(f) || isPresent(f,f.get(obj))) { + + 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()); + } catch (Asn1EncodingException e) { + throw new Asn1EncodingException("." + f.getName(), e); + } catch (IllegalArgumentException e) { + throw new IllegalArgumentException("Illegal value for field " + f.getName(), e); + } + } + } + // Extension fields. + if (UperEncoder.hasExtensionMarker(annotations) + && !sorter.extensionFields.isEmpty() + && UperEncoder.hasNonNullExtensions(obj, sorter)) { + // Total extensions count. + int numExtensions = sorter.extensionFields.size(); + UperEncoder.logger.debug(String.format("continuing sequence : %d extension(s) are present, encoding length determinant for them...", numExtensions)); + UperEncoder.encodeLengthOfBitmask(bitbuffer, numExtensions); + // Bitmask for present extensions. + for (Field f : sorter.extensionFields) { + boolean fieldIsPresent = isPresent(f,f.get(obj)); + + UperEncoder.logger.debug(String.format("Extension %s is %s, presence encoded as <%s>", f.getName(), + fieldIsPresent ? "present" : "absent", fieldIsPresent ? "1" : "0")); + + bitbuffer.put(fieldIsPresent); + } + // Values of extensions themselves. + for (Field f : sorter.extensionFields) { + //CG do not encode default values + if (UperEncoder.isMandatory(f) || isPresent(f,f.get(obj))) { + UperEncoder.logger.debug(String.format("Encoding extension field %s", f.getName())); + try { + UperEncoder.encodeAsOpenType(bitbuffer, f.get(obj), f.getAnnotations()); + } catch (IllegalArgumentException e) { + throw new IllegalArgumentException("Illegal value for extension field " + f.getName(), e); + } + } + } + } + } catch (IllegalArgumentException | IllegalAccessException e) { + throw new IllegalArgumentException("can't encode " + obj, e); + } + sorter.revertAccess(); + } + + @SuppressWarnings("unchecked") + protected <T> boolean isPresent(Field f, Object fieldObject){ + + if (fieldObject == null) return false; + + boolean fieldPresent = fieldObject != null; + + if (fieldObject instanceof Asn1SequenceOf) { + if (((Asn1SequenceOf<T>)fieldObject).size() == 0){ + //CG do not encode optional empty sequences + fieldPresent = false; + } + } + + if (fieldObject instanceof String) { + if (((String)fieldObject).length() == 0){ + //CG do not encode optional empty sequences + fieldPresent = false; + } + } + + //CG DEFAULT VALUES + if (fieldPresent && UperEncoder.isDefault(f,fieldObject)) { + UperEncoder.logger.debug(String.format("Field %s has default value", f.getName())); + fieldPresent = false; + } + //CG No ASN1 + if (UperEncoder.isNotAsn1(f)) { + fieldPresent = false; + } + + return fieldPresent; + + } + + @Override public <T> boolean canDecode(Class<T> classOfT, Annotation[] extraAnnotations) { + AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(), + extraAnnotations); + return annotations.getAnnotation(Sequence.class) != null; + } + + @Override public <T> T decode(BitBuffer bitbuffer, + Class<T> classOfT,Field f1, + Annotation[] extraAnnotations) { + UperEncoder.logger.debug(String.format("decode SEQUENCE %s",classOfT.getSimpleName())); + AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(),extraAnnotations); + T result = UperEncoder.instantiate(classOfT); + Asn1ContainerFieldSorter sorter = new Asn1ContainerFieldSorter(classOfT); + boolean hasExtensionMarker = UperEncoder.hasExtensionMarker(annotations); + boolean extensionPresent = false; + if (hasExtensionMarker) { + extensionPresent = bitbuffer.get(); + UperEncoder.logger.debug(String.format("with extension marker, extension %s", extensionPresent ? "present!" : "absent")); + } + // Bitmask for optional fields. + Deque<Boolean> optionalFieldsMask = new ArrayDeque<>(sorter.optionalOrdinaryFields.size()); + for (Field f : sorter.optionalOrdinaryFields) { + optionalFieldsMask.add(bitbuffer.get()); + UperEncoder.logger.debug(String.format("with optional field %s %s" , f.getName() , optionalFieldsMask.getLast() ? "present" : "absent")); + } + // All ordinary fields (fields within extension root). + + for (Field f : sorter.ordinaryFields) { + if (!UperEncoder.isTestInstrumentation(f) && (UperEncoder.isMandatory(f) + || + (UperEncoder.isOptional(f) && optionalFieldsMask.pop()))) { + UperEncoder.logger.debug(String.format("Field : %s", f.getName())); + try { + f.set(result, UperEncoder.decodeAny(bitbuffer,f.getType(),f, f.getAnnotations())); + } catch (IllegalAccessException e) { + throw new IllegalArgumentException("can't access 'set method' for field " + f + " of class " + classOfT + " " + e, e); + } + } else { + //CG might have a default value + if (f.getAnnotation(Asn1Default.class) != null) { + try { + UperEncoder.logger.debug(String.format(String.format("Retrieve default for element : %s",f.getName()))); + f.set(result,UperEncoder.getDefault(f.getType(),f.getAnnotations())); + } catch (IllegalArgumentException e) { + throw new IllegalArgumentException("can't decode " + classOfT, e); + } catch (IllegalAccessException e) { + throw new IllegalArgumentException("can't decode " + classOfT, e); + } + } + } + } + if (!hasExtensionMarker) { + //done + sorter.revertAccess(); + return result; + } + + // Possible extensions + int numExtensions = 0; + if (UperEncoder.hasExtensionMarker(annotations)){ + if (extensionPresent) { + // Number of extensions. + numExtensions = (int) UperEncoder.decodeLengthOfBitmask(bitbuffer); + UperEncoder.logger.debug(String.format("sequence has %d extension(s)", numExtensions)); + // Bitmask for extensions. + boolean[] bitmaskValueIsPresent = new boolean[numExtensions]; + for (int i = 0; i < numExtensions; i++) { + bitmaskValueIsPresent[i] = bitbuffer.get(); + UperEncoder.logger.debug(String.format("extension %s is %s", i, bitmaskValueIsPresent[i] ? "present" : "absent")); + } + // Values. + UperEncoder.logger.debug("decoding extensions values..."); + for (int i = 0; i < numExtensions; i++) { + UperEncoder.logger.debug(String.format("sequence extension %s %s", i, bitmaskValueIsPresent[i] ? "present" : "absent")); + if (bitmaskValueIsPresent[i]) { + UperEncoder.logger.debug(String.format("decoding extension %d...", i)); + Field field = sorter.extensionFields.size() > i ? sorter.extensionFields.get(i) : null; + Class<?> classOfElement = field != null ? field.getType() : null; + if (field != null) { + try { + Object decodedValue = UperEncoder.decodeAsOpenType(bitbuffer, classOfElement,field, field.getAnnotations()); + if (field != null) { + field.set(result, decodedValue); + } + } catch (IllegalArgumentException | IllegalAccessException e) { + throw new IllegalArgumentException("can't decode " + classOfT, e); + } + } else { + //CG skip the unknown extension element + UperEncoder.decodeSkipUnknownElement(bitbuffer, classOfT.getSimpleName()); + } + } else { + //CG the absent extension filed might have a default value + Field field = sorter.extensionFields.size() > i ? sorter.extensionFields.get(i) : null; + Class<?> classOfElement = field != null ? field.getType() : null; + if (field != null && field.getAnnotation(Asn1Default.class) != null) { + try { + field.set(result,UperEncoder.getDefault(classOfElement,field.getAnnotations())); + } catch (IllegalArgumentException e) { + throw new IllegalArgumentException("can't decode " + classOfElement.getSimpleName(), e); + } catch (IllegalAccessException e) { + throw new IllegalArgumentException("can't decode " + classOfElement.getSimpleName(), e); + } + UperEncoder.logger.debug(String.format("Default set for %s", field.getName())); + } + } + }//end of loop on present extension fields + } else { + //CG there is an extension marker but the extension is not present + // then there sill might be an element with a default value + for (Field field : sorter.extensionFields) { + if ( numExtensions <= sorter.extensionFields.indexOf(field)) { + if (field.getAnnotation(Asn1Default.class) != null) { + Class<?> classOfElement = field != null ? field.getType() : null; + try { + field.set(result,UperEncoder.getDefault(classOfElement, field.getAnnotations())); + } catch (IllegalArgumentException e) { + throw new IllegalArgumentException("can't decode default" + classOfElement.getSimpleName(), e); + } catch (IllegalAccessException e) { + throw new IllegalArgumentException("can't decode default" + classOfElement.getSimpleName(), e); + } + } + } + } + } // end of extension handling + } + sorter.revertAccess(); + return result; + } + + @Override + public <T> T getDefault(Class<T> classOfT, Annotation[] annotations) { + throw new IllegalArgumentException("Default Sequence not yet implemented"); + } +}
\ No newline at end of file diff --git a/src/org/uic/barcode/asn1/uper/SimpleTypeResolver.java b/src/org/uic/barcode/asn1/uper/SimpleTypeResolver.java new file mode 100644 index 0000000..9444e44 --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/SimpleTypeResolver.java @@ -0,0 +1,515 @@ +package org.uic.barcode.asn1.uper;
+
+/*
+ * Copyright 2002-2017 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+import java.lang.ref.Reference;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+
+/**
+ * Enhanced type resolution utilities.
+ *
+ * @author Jonathan Halterman
+ */
+public final class SimpleTypeResolver {
+ /** Cache of type variable/argument pairs */
+ private static final Map<Class<?>, Reference<Map<TypeVariable<?>, Type>>> TYPE_VARIABLE_CACHE = Collections
+ .synchronizedMap(new WeakHashMap<Class<?>, Reference<Map<TypeVariable<?>, Type>>>());
+ private static volatile boolean CACHE_ENABLED = true;
+ private static boolean RESOLVES_LAMBDAS;
+ private static Method GET_CONSTANT_POOL;
+ private static Method GET_CONSTANT_POOL_SIZE;
+ private static Method GET_CONSTANT_POOL_METHOD_AT;
+ private static final Map<String, Method> OBJECT_METHODS = new HashMap<String, Method>();
+ private static final Map<Class<?>, Class<?>> PRIMITIVE_WRAPPERS;
+ private static final Double JAVA_VERSION;
+
+ static {
+ JAVA_VERSION = Double.parseDouble(System.getProperty("java.specification.version", "0"));
+
+ try {
+
+ GET_CONSTANT_POOL = Class.class.getDeclaredMethod("getConstantPool");
+ String constantPoolName = JAVA_VERSION < 9 ? "sun.reflect.ConstantPool" : "jdk.internal.reflect.ConstantPool";
+ Class<?> constantPoolClass = Class.forName(constantPoolName);
+ GET_CONSTANT_POOL_SIZE = constantPoolClass.getDeclaredMethod("getSize");
+ GET_CONSTANT_POOL_METHOD_AT = constantPoolClass.getDeclaredMethod("getMethodAt", int.class);
+
+ // setting the methods as accessible
+ // additional checks - make sure we get a result when invoking the Class::getConstantPool and
+ // ConstantPool::getSize on a class
+ Object constantPool = GET_CONSTANT_POOL.invoke(Object.class);
+ GET_CONSTANT_POOL_SIZE.invoke(constantPool);
+
+ for (Method method : Object.class.getDeclaredMethods())
+ OBJECT_METHODS.put(method.getName(), method);
+
+ RESOLVES_LAMBDAS = true;
+ } catch (Exception ignore) {
+ }
+
+ Map<Class<?>, Class<?>> types = new HashMap<Class<?>, Class<?>>();
+ types.put(boolean.class, Boolean.class);
+ types.put(byte.class, Byte.class);
+ types.put(char.class, Character.class);
+ types.put(double.class, Double.class);
+ types.put(float.class, Float.class);
+ types.put(int.class, Integer.class);
+ types.put(long.class, Long.class);
+ types.put(short.class, Short.class);
+ types.put(void.class, Void.class);
+ PRIMITIVE_WRAPPERS = Collections.unmodifiableMap(types);
+ }
+
+ /** An unknown type. */
+ public static final class Unknown {
+ private Unknown() {
+ }
+ }
+
+ /**
+ * Enables the internal caching of resolved TypeVariables.
+ */
+ public static void enableCache() {
+ CACHE_ENABLED = true;
+ }
+
+ /**
+ * Disables the internal caching of resolved TypeVariables.
+ */
+ public static void disableCache() {
+ TYPE_VARIABLE_CACHE.clear();
+ CACHE_ENABLED = false;
+ }
+
+ /**
+ * Returns the raw class representing the argument for the {@code type} using type variable information from the
+ * {@code subType}. If no arguments can be resolved then {@code Unknown.class} is returned.
+ *
+ * @param type to resolve argument for
+ * @param subType to extract type variable information from
+ * @return argument for {@code type} else {@link Unknown}.class if no type arguments are declared
+ * @throws IllegalArgumentException if more or less than one argument is resolved for the {@code type}
+ */
+ public static <T, S extends T> Class<?> resolveRawArgument(Class<T> type, Class<S> subType) {
+ return resolveRawArgument(resolveGenericType(type, subType), subType);
+ }
+
+ /**
+ * Returns the raw class representing the argument for the {@code genericType} using type variable information from
+ * the {@code subType}. If {@code genericType} is an instance of class, then {@code genericType} is returned. If no
+ * arguments can be resolved then {@code Unknown.class} is returned.
+ *
+ * @param genericType to resolve argument for
+ * @param subType to extract type variable information from
+ * @return argument for {@code genericType} else {@link Unknown}.class if no type arguments are declared
+ * @throws IllegalArgumentException if more or less than one argument is resolved for the {@code genericType}
+ */
+ public static Class<?> resolveRawArgument(Type genericType, Class<?> subType) {
+ Class<?>[] arguments = resolveRawArguments(genericType, subType);
+ if (arguments == null)
+ return Unknown.class;
+
+ if (arguments.length != 1)
+ throw new IllegalArgumentException(
+ "Expected 1 argument for generic type " + genericType + " but found " + arguments.length);
+
+ return arguments[0];
+ }
+
+ /**
+ * Returns an array of raw classes representing arguments for the {@code type} using type variable information from
+ * the {@code subType}. Arguments for {@code type} that cannot be resolved are returned as {@code Unknown.class}. If
+ * no arguments can be resolved then {@code null} is returned.
+ *
+ * @param type to resolve arguments for
+ * @param subType to extract type variable information from
+ * @return array of raw classes representing arguments for the {@code type} else {@code null} if no type arguments are
+ * declared
+ */
+ public static <T, S extends T> Class<?>[] resolveRawArguments(Class<T> type, Class<S> subType) {
+ return resolveRawArguments(resolveGenericType(type, subType), subType);
+ }
+
+ /**
+ * Returns an array of raw classes representing arguments for the {@code genericType} using type variable information
+ * from the {@code subType}. Arguments for {@code genericType} that cannot be resolved are returned as
+ * {@code Unknown.class}. If no arguments can be resolved then {@code null} is returned.
+ *
+ * @param genericType to resolve arguments for
+ * @param subType to extract type variable information from
+ * @return array of raw classes representing arguments for the {@code genericType} else {@code null} if no type
+ * arguments are declared
+ */
+ public static Class<?>[] resolveRawArguments(Type genericType, Class<?> subType) {
+ Class<?>[] result = null;
+ Class<?> functionalInterface = null;
+
+ // Handle lambdas
+ if (RESOLVES_LAMBDAS && subType.isSynthetic()) {
+ Class<?> fi = genericType instanceof ParameterizedType
+ && ((ParameterizedType) genericType).getRawType() instanceof Class
+ ? (Class<?>) ((ParameterizedType) genericType).getRawType()
+ : genericType instanceof Class ? (Class<?>) genericType : null;
+ if (fi != null && fi.isInterface())
+ functionalInterface = fi;
+ }
+
+ if (genericType instanceof ParameterizedType) {
+ ParameterizedType paramType = (ParameterizedType) genericType;
+ Type[] arguments = paramType.getActualTypeArguments();
+ result = new Class[arguments.length];
+ for (int i = 0; i < arguments.length; i++)
+ result[i] = resolveRawClass(arguments[i], subType, functionalInterface);
+ } else if (genericType instanceof TypeVariable) {
+ result = new Class[1];
+ result[0] = resolveRawClass(genericType, subType, functionalInterface);
+ } else if (genericType instanceof Class) {
+ TypeVariable<?>[] typeParams = ((Class<?>) genericType).getTypeParameters();
+ result = new Class[typeParams.length];
+ for (int i = 0; i < typeParams.length; i++)
+ result[i] = resolveRawClass(typeParams[i], subType, functionalInterface);
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns the generic {@code type} using type variable information from the {@code subType} else {@code null} if the
+ * generic type cannot be resolved.
+ *
+ * @param type to resolve generic type for
+ * @param subType to extract type variable information from
+ * @return generic {@code type} else {@code null} if it cannot be resolved
+ */
+ public static Type resolveGenericType(Class<?> type, Type subType) {
+ Class<?> rawType;
+ if (subType instanceof ParameterizedType)
+ rawType = (Class<?>) ((ParameterizedType) subType).getRawType();
+ else
+ rawType = (Class<?>) subType;
+
+ if (type.equals(rawType))
+ return subType;
+
+ Type result;
+ if (type.isInterface()) {
+ for (Type superInterface : rawType.getGenericInterfaces())
+ if (superInterface != null && !superInterface.equals(Object.class))
+ if ((result = resolveGenericType(type, superInterface)) != null)
+ return result;
+ }
+
+ Type superClass = rawType.getGenericSuperclass();
+ if (superClass != null && !superClass.equals(Object.class))
+ if ((result = resolveGenericType(type, superClass)) != null)
+ return result;
+
+ return null;
+ }
+
+ /**
+ * Resolves the raw class for the {@code genericType}, using the type variable information from the {@code subType}
+ * else {@link Unknown} if the raw class cannot be resolved.
+ *
+ * @param genericType to resolve raw class for
+ * @param subType to extract type variable information from
+ * @return raw class for the {@code genericType} else {@link Unknown} if it cannot be resolved
+ */
+ public static Class<?> resolveRawClass(Type genericType, Class<?> subType) {
+ return resolveRawClass(genericType, subType, null);
+ }
+
+ private static Class<?> resolveRawClass(Type genericType, Class<?> subType, Class<?> functionalInterface) {
+ if (genericType instanceof Class) {
+ return (Class<?>) genericType;
+ } else if (genericType instanceof ParameterizedType) {
+ return resolveRawClass(((ParameterizedType) genericType).getRawType(), subType, functionalInterface);
+ } else if (genericType instanceof GenericArrayType) {
+ GenericArrayType arrayType = (GenericArrayType) genericType;
+ Class<?> component = resolveRawClass(arrayType.getGenericComponentType(), subType, functionalInterface);
+ return Array.newInstance(component, 0).getClass();
+ } else if (genericType instanceof TypeVariable) {
+ TypeVariable<?> variable = (TypeVariable<?>) genericType;
+ genericType = getTypeVariableMap(subType, functionalInterface).get(variable);
+ genericType = genericType == null ? resolveBound(variable)
+ : resolveRawClass(genericType, subType, functionalInterface);
+ }
+
+ return genericType instanceof Class ? (Class<?>) genericType : Unknown.class;
+ }
+
+ private static Map<TypeVariable<?>, Type> getTypeVariableMap(final Class<?> targetType,
+ Class<?> functionalInterface) {
+ Reference<Map<TypeVariable<?>, Type>> ref = TYPE_VARIABLE_CACHE.get(targetType);
+ Map<TypeVariable<?>, Type> map = ref != null ? ref.get() : null;
+
+ if (map == null) {
+ map = new HashMap<TypeVariable<?>, Type>();
+
+ // Populate lambdas
+ if (functionalInterface != null)
+ populateLambdaArgs(functionalInterface, targetType, map);
+
+ // Populate interfaces
+ populateSuperTypeArgs(targetType.getGenericInterfaces(), map, functionalInterface != null);
+
+ // Populate super classes and interfaces
+ Type genericType = targetType.getGenericSuperclass();
+ Class<?> type = targetType.getSuperclass();
+ while (type != null && !Object.class.equals(type)) {
+ if (genericType instanceof ParameterizedType)
+ populateTypeArgs((ParameterizedType) genericType, map, false);
+ populateSuperTypeArgs(type.getGenericInterfaces(), map, false);
+
+ genericType = type.getGenericSuperclass();
+ type = type.getSuperclass();
+ }
+
+ // Populate enclosing classes
+ type = targetType;
+ while (type.isMemberClass()) {
+ genericType = type.getGenericSuperclass();
+ if (genericType instanceof ParameterizedType)
+ populateTypeArgs((ParameterizedType) genericType, map, functionalInterface != null);
+
+ type = type.getEnclosingClass();
+ }
+
+ if (CACHE_ENABLED)
+ TYPE_VARIABLE_CACHE.put(targetType, new WeakReference<Map<TypeVariable<?>, Type>>(map));
+ }
+
+ return map;
+ }
+
+ /**
+ * Populates the {@code map} with with variable/argument pairs for the given {@code types}.
+ */
+ private static void populateSuperTypeArgs(final Type[] types, final Map<TypeVariable<?>, Type> map,
+ boolean depthFirst) {
+ for (Type type : types) {
+ if (type instanceof ParameterizedType) {
+ ParameterizedType parameterizedType = (ParameterizedType) type;
+ if (!depthFirst)
+ populateTypeArgs(parameterizedType, map, depthFirst);
+ Type rawType = parameterizedType.getRawType();
+ if (rawType instanceof Class)
+ populateSuperTypeArgs(((Class<?>) rawType).getGenericInterfaces(), map, depthFirst);
+ if (depthFirst)
+ populateTypeArgs(parameterizedType, map, depthFirst);
+ } else if (type instanceof Class) {
+ populateSuperTypeArgs(((Class<?>) type).getGenericInterfaces(), map, depthFirst);
+ }
+ }
+ }
+
+ /**
+ * Populates the {@code map} with variable/argument pairs for the given {@code type}.
+ */
+ private static void populateTypeArgs(ParameterizedType type, Map<TypeVariable<?>, Type> map, boolean depthFirst) {
+ if (type.getRawType() instanceof Class) {
+ TypeVariable<?>[] typeVariables = ((Class<?>) type.getRawType()).getTypeParameters();
+ Type[] typeArguments = type.getActualTypeArguments();
+
+ if (type.getOwnerType() != null) {
+ Type owner = type.getOwnerType();
+ if (owner instanceof ParameterizedType)
+ populateTypeArgs((ParameterizedType) owner, map, depthFirst);
+ }
+
+ for (int i = 0; i < typeArguments.length; i++) {
+ TypeVariable<?> variable = typeVariables[i];
+ Type typeArgument = typeArguments[i];
+
+ if (typeArgument instanceof Class) {
+ map.put(variable, typeArgument);
+ } else if (typeArgument instanceof GenericArrayType) {
+ map.put(variable, typeArgument);
+ } else if (typeArgument instanceof ParameterizedType) {
+ map.put(variable, typeArgument);
+ } else if (typeArgument instanceof TypeVariable) {
+ TypeVariable<?> typeVariableArgument = (TypeVariable<?>) typeArgument;
+ if (depthFirst) {
+ Type existingType = map.get(variable);
+ if (existingType != null) {
+ map.put(typeVariableArgument, existingType);
+ continue;
+ }
+ }
+
+ Type resolvedType = map.get(typeVariableArgument);
+ if (resolvedType == null)
+ resolvedType = resolveBound(typeVariableArgument);
+ map.put(variable, resolvedType);
+ }
+ }
+ }
+ }
+
+ /**
+ * Resolves the first bound for the {@code typeVariable}, returning {@code Unknown.class} if none can be resolved.
+ */
+ public static Type resolveBound(TypeVariable<?> typeVariable) {
+ Type[] bounds = typeVariable.getBounds();
+ if (bounds.length == 0)
+ return Unknown.class;
+
+ Type bound = bounds[0];
+ if (bound instanceof TypeVariable)
+ bound = resolveBound((TypeVariable<?>) bound);
+
+ return bound == Object.class ? Unknown.class : bound;
+ }
+
+ /**
+ * Populates the {@code map} with variable/argument pairs for the {@code functionalInterface}.
+ */
+ private static void populateLambdaArgs(Class<?> functionalInterface, final Class<?> lambdaType,
+ Map<TypeVariable<?>, Type> map) {
+ if (RESOLVES_LAMBDAS) {
+ // Find SAM
+ for (Method m : functionalInterface.getMethods()) {
+ if (!isDefaultMethod(m) && !Modifier.isStatic(m.getModifiers()) && !m.isBridge()) {
+ // Skip methods that override Object.class
+ Method objectMethod = OBJECT_METHODS.get(m.getName());
+ if (objectMethod != null && Arrays.equals(m.getTypeParameters(), objectMethod.getTypeParameters()))
+ continue;
+
+ // Get functional interface's type params
+ Type returnTypeVar = m.getGenericReturnType();
+ Type[] paramTypeVars = m.getGenericParameterTypes();
+
+ Member member = getMemberRef(lambdaType);
+ if (member == null)
+ return;
+
+ // Populate return type argument
+ if (returnTypeVar instanceof TypeVariable) {
+ Class<?> returnType = member instanceof Method ? ((Method) member).getReturnType()
+ : ((Constructor<?>) member).getDeclaringClass();
+ returnType = wrapPrimitives(returnType);
+ if (!returnType.equals(Void.class))
+ map.put((TypeVariable<?>) returnTypeVar, returnType);
+ }
+
+ Class<?>[] arguments = member instanceof Method ? ((Method) member).getParameterTypes()
+ : ((Constructor<?>) member).getParameterTypes();
+
+ // Populate object type from arbitrary object method reference
+ int paramOffset = 0;
+ if (paramTypeVars.length > 0 && paramTypeVars[0] instanceof TypeVariable
+ && paramTypeVars.length == arguments.length + 1) {
+ Class<?> instanceType = member.getDeclaringClass();
+ map.put((TypeVariable<?>) paramTypeVars[0], instanceType);
+ paramOffset = 1;
+ }
+
+ // Handle additional arguments that are captured from the lambda's enclosing scope
+ int argOffset = 0;
+ if (paramTypeVars.length < arguments.length) {
+ argOffset = arguments.length - paramTypeVars.length;
+ }
+
+ // Populate type arguments
+ for (int i = 0; i + argOffset < arguments.length; i++) {
+ if (paramTypeVars[i] instanceof TypeVariable)
+ map.put((TypeVariable<?>) paramTypeVars[i + paramOffset], wrapPrimitives(arguments[i + argOffset]));
+ }
+
+ return;
+ }
+ }
+ }
+ }
+
+ private static boolean isDefaultMethod(Method m) {
+ //CG
+ return false;
+ //return JAVA_VERSION >= 1.8 && m.isDefault();
+ }
+
+ private static Member getMemberRef(Class<?> type) {
+ Object constantPool;
+ try {
+ constantPool = GET_CONSTANT_POOL.invoke(type);
+ } catch (Exception ignore) {
+ return null;
+ }
+
+ Member result = null;
+ for (int i = getConstantPoolSize(constantPool) - 1; i >= 0; i--) {
+ Member member = getConstantPoolMethodAt(constantPool, i);
+ // Skip SerializedLambda constructors and members of the "type" class
+ if (member == null
+ || (member instanceof Constructor
+ && member.getDeclaringClass().getName().equals("java.lang.invoke.SerializedLambda"))
+ || member.getDeclaringClass().isAssignableFrom(type))
+ continue;
+
+ result = member;
+
+ // Return if not valueOf method
+ if (!(member instanceof Method) || !isAutoBoxingMethod((Method) member))
+ break;
+ }
+
+ return result;
+ }
+
+ private static boolean isAutoBoxingMethod(Method method) {
+ Class<?>[] parameters = method.getParameterTypes();
+ return method.getName().equals("valueOf") && parameters.length == 1 && parameters[0].isPrimitive()
+ && wrapPrimitives(parameters[0]).equals(method.getDeclaringClass());
+ }
+
+ private static Class<?> wrapPrimitives(Class<?> clazz) {
+ return clazz.isPrimitive() ? PRIMITIVE_WRAPPERS.get(clazz) : clazz;
+ }
+
+ private static int getConstantPoolSize(Object constantPool) {
+ try {
+ return (Integer) GET_CONSTANT_POOL_SIZE.invoke(constantPool);
+ } catch (Exception ignore) {
+ return 0;
+ }
+ }
+
+ private static Member getConstantPoolMethodAt(Object constantPool, int i) {
+ try {
+ return (Member) GET_CONSTANT_POOL_METHOD_AT.invoke(constantPool, i);
+ } catch (Exception ignore) {
+ return null;
+ }
+ }
+}
+
diff --git a/src/org/uic/barcode/asn1/uper/StringCoder.java b/src/org/uic/barcode/asn1/uper/StringCoder.java new file mode 100644 index 0000000..fe06e3d --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/StringCoder.java @@ -0,0 +1,341 @@ +package org.uic.barcode.asn1.uper; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; +import java.math.BigInteger; +import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.uic.barcode.asn1.datatypes.Asn1Default; +import org.uic.barcode.asn1.datatypes.Asn1String; +import org.uic.barcode.asn1.datatypes.CharacterRestriction; +import org.uic.barcode.asn1.datatypes.DefaultAlphabet; +import org.uic.barcode.asn1.datatypes.FixedSize; +import org.uic.barcode.asn1.datatypes.RestrictedString; +import org.uic.barcode.asn1.datatypes.SizeRange; +import org.uic.barcode.logger.Logger; +import org.uic.barcode.logger.LoggerFactory; + + +class StringCoder implements Decoder, Encoder { + + private static final Logger LOGGER = LoggerFactory.getLogger("asnLogger"); + + @Override public <T> boolean canEncode(T obj, Annotation[] extraAnnotations) { + return obj instanceof String || obj instanceof Asn1String; + } + + @Override public <T> void encode(BitBuffer bitbuffer, T obj, Annotation[] extraAnnotations) throws Asn1EncodingException { + String pos = String.format("Position: %d.%d", bitbuffer.position()/8 , bitbuffer.position() % 8); + UperEncoder.logger.debug(String.format("%s: encode STRING %s of type %s", pos, obj, obj.getClass().getName())); + Class<?> type = obj.getClass(); + AnnotationStore annotations = new AnnotationStore(type.getAnnotations(), extraAnnotations); + String string = (obj instanceof String) ? ((String) obj) : ((Asn1String) obj).value(); + RestrictedString restrictionAnnotation = annotations.getAnnotation(RestrictedString.class); + if (restrictionAnnotation == null) { + throw new UnsupportedOperationException("Unrestricted character strings are not supported yet. All annotations: " + Arrays.asList(type.getAnnotations())); + } + + FixedSize fixedSize = annotations.getAnnotation(FixedSize.class); + SizeRange sizeRange = annotations.getAnnotation(SizeRange.class); + if (fixedSize != null && fixedSize.value() != string.length()) { + throw new IllegalArgumentException( + "Bad string length, expected " + fixedSize.value() + ", got " + string.length()); + } + if (sizeRange != null + && !sizeRange.hasExtensionMarker() + && (string.length() < sizeRange.minValue() || sizeRange.maxValue() < string + .length())) { throw new IllegalArgumentException( + "Bad string length, expected " + sizeRange.minValue() + ".." + + sizeRange.maxValue() + ", got " + string.length()); } + + if (restrictionAnnotation.value() == CharacterRestriction.ObjectIdentifier) { + + byte[] oidb = ObjectIdentifierCoder.encodeObjectId(string); + + BitBuffer stringbuffer = ByteBitBuffer.createInfinite(); + + for (byte b: oidb){ + UperEncoder.encodeConstrainedInt(stringbuffer, b & 0xff, 0, 255); + } + //-for (char c : string.toCharArray()) { + //- encodeChar(stringbuffer, c, restrictionAnnotation); + //-} + //char array replaced - end + + stringbuffer.flip(); + if (stringbuffer.limit() % 8 != 0) { + throw new AssertionError("encoding resulted not in multiple of 8 bits"); + } + int numOctets = (stringbuffer.limit() + 7) / 8; // Actually +7 is not needed here, + // since we already checked with %8. + int position1 = bitbuffer.position(); + UperEncoder.encodeLengthDeterminant(bitbuffer, numOctets); + UperEncoder.logger.debug(String.format("ObjectIdentifier %s, length %d octets, encoded as %s", string, numOctets, bitbuffer.toBooleanStringFromPosition(position1))); + int position2 = bitbuffer.position(); + for (int i = 0; i < stringbuffer.limit(); i++) { + bitbuffer.put(stringbuffer.get()); + } + UperEncoder.logger.debug(String.format("UTF8String %s, encoded length %d octets, value bits: %s", string, numOctets, bitbuffer.toBooleanStringFromPosition(position2))); + return; + } else if (restrictionAnnotation.value() == CharacterRestriction.UTF8String) { + // UTF8 length + BitBuffer stringbuffer = ByteBitBuffer.createInfinite(); + + //char array replaced - begin + byte[] stringasbytearray = string.getBytes(StandardCharsets.UTF_8); + + for (byte b: stringasbytearray){ + UperEncoder.encodeConstrainedInt(stringbuffer, b & 0xff, 0, 255); + } + //-for (char c : string.toCharArray()) { + //- encodeChar(stringbuffer, c, restrictionAnnotation); + //-} + //char array replaced - end + + stringbuffer.flip(); + if (stringbuffer.limit() % 8 != 0) { + throw new AssertionError("utf8 encoding resulted not in multiple of 8 bits"); + } + int numOctets = (stringbuffer.limit() + 7) / 8; // Actually +7 is not needed here, + // since we already checked with %8. + int position1 = bitbuffer.position(); + UperEncoder.encodeLengthDeterminant(bitbuffer, numOctets); + UperEncoder.logger.debug(String.format("UTF8String %s, length %d octets, encoded as %s", string, numOctets, bitbuffer.toBooleanStringFromPosition(position1))); + int position2 = bitbuffer.position(); + for (int i = 0; i < stringbuffer.limit(); i++) { + bitbuffer.put(stringbuffer.get()); + } + UperEncoder.logger.debug(String.format("UTF8String %s, encoded length %d octets, value bits: %s", string, numOctets, bitbuffer.toBooleanStringFromPosition(position2))); + return; + } else if (fixedSize != null) { + if (fixedSize.value() != string.length()) { throw new IllegalArgumentException( + "String length does not match constraints"); } + int position = bitbuffer.position(); + for (int i = 0; i < fixedSize.value(); i++) { + encodeChar(bitbuffer, string.charAt(i), restrictionAnnotation); + } + UperEncoder.logger.debug(String.format("string encoded as <%s>", bitbuffer.toBooleanStringFromPosition(position))); + return; + } else if (sizeRange != null) { + UperEncoder.logger.debug("string length"); + int position1 = bitbuffer.position(); + UperEncoder.encodeConstrainedInt(bitbuffer, string.length(), sizeRange.minValue(),sizeRange.maxValue(), sizeRange.hasExtensionMarker()); + int position2 = bitbuffer.position(); + UperEncoder.logger.debug("string content"); + for (int i = 0; i < string.length(); i++) { + encodeChar(bitbuffer, string.charAt(i), restrictionAnnotation); + } + UperEncoder.logger.debug(String.format("STRING %s size %d: %s", obj.getClass().getName(), bitbuffer.toBooleanString(position1, position2 - position1),bitbuffer.toBooleanStringFromPosition(position2))); + return; + } else { + int position1 = bitbuffer.position(); + UperEncoder.encodeLengthDeterminant(bitbuffer, string.length()); + int position2 = bitbuffer.position(); + for (int i = 0; i < string.length(); i++) { + encodeChar(bitbuffer, string.charAt(i), restrictionAnnotation); + } + UperEncoder.logger.debug(String.format("STRING %s size %s: %s", obj.getClass().getName(), bitbuffer.toBooleanString(position1, position2 - position1),bitbuffer.toBooleanStringFromPosition(position2))); + return; + } + } + + @Override public <T> boolean canDecode(Class<T> classOfT, Annotation[] extraAnnotations) { + return String.class.isAssignableFrom(classOfT) || Asn1String.class.isAssignableFrom(classOfT); + } + + @Override public <T> T decode(BitBuffer bitbuffer, + Class<T> classOfT, Field field, + Annotation[] extraAnnotations) { + UperEncoder.logger.debug("decode String"); + AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(), extraAnnotations); + RestrictedString restrictionAnnotation = annotations.getAnnotation(RestrictedString.class); + if (restrictionAnnotation == null) { + throw new UnsupportedOperationException( + "Unrestricted character strings are not supported yet. All annotations: " + Arrays.asList(classOfT.getAnnotations())); + } + if (restrictionAnnotation.value() == CharacterRestriction.ObjectIdentifier) { + //decode object identifier + Long numOctets = UperEncoder.decodeLengthDeterminant(bitbuffer); + List<Boolean> content = new ArrayList<Boolean>(); + for (int i = 0; i < numOctets * 8; i++) { + content.add(bitbuffer.get()); + } + byte[] contentBytes = UperEncoder.bytesFromCollection(content); + UperEncoder.logger.debug(String.format("Content bytes (hex): %s", UperEncoder.hexStringFromBytes(contentBytes))); + String resultStr = ObjectIdentifierCoder.decodeObjectId(contentBytes); + UperEncoder.logger.debug(String.format("Object Identifier: %s", resultStr)); + T result = UperEncoder.instantiate(classOfT, resultStr); + return result; + } else if (restrictionAnnotation.value() == CharacterRestriction.UTF8String) { + Long numOctets = UperEncoder.decodeLengthDeterminant(bitbuffer); + List<Boolean> content = new ArrayList<Boolean>(); + for (int i = 0; i < numOctets * 8; i++) { + content.add(bitbuffer.get()); + } + byte[] contentBytes = UperEncoder.bytesFromCollection(content); + UperEncoder.logger.debug(String.format("Content bytes (hex): %s", UperEncoder.hexStringFromBytes(contentBytes))); + String resultStr = StandardCharsets.UTF_8.decode(ByteBuffer.wrap(contentBytes)).toString(); + UperEncoder.logger.debug(String.format("Decoded as %s", resultStr)); + T result = UperEncoder.instantiate(classOfT, resultStr); + return result; + } else { + FixedSize fixedSize = annotations.getAnnotation(FixedSize.class); + SizeRange sizeRange = annotations.getAnnotation(SizeRange.class); + long numChars = (fixedSize != null) ? fixedSize.value() : + (sizeRange != null) ? UperEncoder.decodeConstrainedInt(bitbuffer, + UperEncoder.intRangeFromSizeRange(sizeRange)) : + UperEncoder.decodeLengthDeterminant(bitbuffer); + UperEncoder.logger.debug(String.format("known-multiplier string, numchars: %d", numChars)); + StringBuilder stringBuilder = new StringBuilder((int) numChars); + for (int c = 0; c < numChars; c++) { + stringBuilder.append(decodeRestrictedChar(bitbuffer, restrictionAnnotation)); + } + String resultStr = stringBuilder.toString(); + UperEncoder.logger.debug(String.format("Decoded as %s", resultStr)); + T result = UperEncoder.instantiate(classOfT, resultStr); + return result; + } + } + + private static void encodeChar(BitBuffer bitbuffer, char c, RestrictedString restriction) throws Asn1EncodingException { + UperEncoder.logger.debug(String.format("char %s", c)); + switch (restriction.value()) { + case IA5String: + if (restriction.alphabet() != DefaultAlphabet.class) { + throw new UnsupportedOperationException("alphabet for IA5String is not supported yet."); + } + UperEncoder.encodeConstrainedInt( + bitbuffer, + StandardCharsets.US_ASCII.encode(CharBuffer.wrap(new char[] { c })).get() & 0xff, + 0, + 127); + return; + case UTF8String: + if (restriction.alphabet() != DefaultAlphabet.class) { + throw new UnsupportedOperationException("alphabet for UTF8 is not supported yet."); + } + ByteBuffer buffer = StandardCharsets.UTF_8.encode(CharBuffer.wrap(new char[] { c })); + for (int i = 0; i < buffer.limit(); i++) { + UperEncoder.encodeConstrainedInt(bitbuffer, buffer.get() & 0xff, 0, 255); + } + return; + case VisibleString: + case ISO646String: + if (restriction.alphabet() != DefaultAlphabet.class) { + char[] chars; + try { + chars = UperEncoder.instantiate(restriction.alphabet()).chars().toCharArray(); + } catch (IllegalArgumentException e) { + LOGGER.info("Uninstantinatable alphabet ", e); + throw new IllegalArgumentException("Uninstantinatable alphabet" + restriction.alphabet().getName()); + } + if (BigInteger.valueOf(chars.length - 1).bitLength() < BigInteger.valueOf(126) + .bitLength()) { + Arrays.sort(chars); + String strAlphabet = new String(chars); + int index = strAlphabet.indexOf(c); + if (index < 0) { throw new IllegalArgumentException("can't find character " + c + " in alphabet " + strAlphabet); } + UperEncoder.encodeConstrainedInt( + bitbuffer, + index, + 0, + chars.length - 1); + return; + } else { + UperEncoder.encodeConstrainedInt( + bitbuffer, + StandardCharsets.US_ASCII.encode(CharBuffer.wrap(new char[] { c })) + .get() & 0xff, + 0, + 126); + return; + } + } else { + UperEncoder.encodeConstrainedInt( + bitbuffer, + StandardCharsets.US_ASCII.encode(CharBuffer.wrap(new char[] { c })) + .get() & 0xff, + 0, + 126); + return; + } + default: + throw new UnsupportedOperationException("String type " + restriction + + " is not supported yet"); + } + } + + private static String decodeRestrictedChar(BitBuffer bitqueue, + RestrictedString restrictionAnnotation) { + switch (restrictionAnnotation.value()) { + case IA5String: { + if (restrictionAnnotation.alphabet() != DefaultAlphabet.class) { + throw new UnsupportedOperationException( + "alphabet for IA5String is not supported yet."); + } + byte charByte = (byte) UperEncoder.decodeConstrainedInt(bitqueue, UperEncoder.newRange(0, 127, false)); + byte[] bytes = new byte[] { charByte }; + String result = StandardCharsets.US_ASCII.decode(ByteBuffer.wrap(bytes)).toString(); + if (result.length() != 1) { + throw new AssertionError("decoded more than one char (" + result + ")"); + } + return result; + } + case VisibleString: + case ISO646String: { + if (restrictionAnnotation.alphabet() != DefaultAlphabet.class) { + char[] chars; + try { + chars = UperEncoder.instantiate(restrictionAnnotation.alphabet()).chars().toCharArray(); + } catch (IllegalArgumentException e) { + LOGGER.info("Uninstantinatable alphabet ", e); + throw new IllegalArgumentException("Uninstantinatable alphabet " + restrictionAnnotation.alphabet().getName()); + } + if (BigInteger.valueOf(chars.length - 1).bitLength() < BigInteger.valueOf(126) + .bitLength()) { + Arrays.sort(chars); + int index = (byte) UperEncoder.decodeConstrainedInt(bitqueue, UperEncoder.newRange(0, chars.length - 1, false)); + String strAlphabet = new String(chars); + char c = strAlphabet.charAt(index); + String result = new String("" + c); + return result; + } else { // Encode normally + byte charByte = (byte) UperEncoder.decodeConstrainedInt(bitqueue, UperEncoder.newRange(0, 126, false)); + byte[] bytes = new byte[] { charByte }; + String result = StandardCharsets.US_ASCII.decode(ByteBuffer.wrap(bytes)).toString(); + if (result.length() != 1) { throw new AssertionError( + "decoded more than one char (" + result + ")"); + } + return result; + } + } else { // Encode normally + byte charByte = (byte) UperEncoder.decodeConstrainedInt(bitqueue, UperEncoder.newRange(0, 126, false)); + byte[] bytes = new byte[] { charByte }; + String result = StandardCharsets.US_ASCII.decode(ByteBuffer.wrap(bytes)).toString(); + if (result.length() != 1) { + throw new AssertionError("decoded more than one char (" + result + ")"); + } + return result; + } + } + default: + throw new UnsupportedOperationException("String type " + restrictionAnnotation + " is not supported yet"); + + } + } + + @Override + public <T> T getDefault(Class<T> classOfT, Annotation[] extraAnnotations) { + AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(), extraAnnotations); + Asn1Default defaultAnnotation = annotations.getAnnotation(Asn1Default.class); + if (defaultAnnotation == null) return null; + T result = UperEncoder.instantiate(classOfT, defaultAnnotation.value()); + return result; + } + +}
\ No newline at end of file diff --git a/src/org/uic/barcode/asn1/uper/UperEncoder.java b/src/org/uic/barcode/asn1/uper/UperEncoder.java new file mode 100644 index 0000000..a5ef5c5 --- /dev/null +++ b/src/org/uic/barcode/asn1/uper/UperEncoder.java @@ -0,0 +1,720 @@ +package org.uic.barcode.asn1.uper; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +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.IsExtension; +import org.uic.barcode.asn1.datatypes.NoAsn1Field; +import org.uic.barcode.asn1.datatypes.SizeRange; +import org.uic.barcode.logger.Logger; +import org.uic.barcode.logger.LoggerFactory; + + + +/** A "quick-and-dirty" implementation of ASN.1 encoder for UPER (Unaligned Packed Encoding Rules). + * + * @see ITU-T Recommendation <a + * href="http://www.itu.int/ITU-T/recommendations/rec.aspx?rec=x.691">X.691</a> + * + * TODO: Cover the rest of (useful) ASN.1 datatypes and PER-visible constraints, + * write unit tests for them. Clean-up, do more refactoring. + **/ +public final class UperEncoder { + public final static Logger logger = LoggerFactory.getLogger("asnLogger"); + + private final static int NUM_16K = 16384; + @SuppressWarnings("unused") + private final static int NUM_32K = 32768; + @SuppressWarnings("unused") + private final static int NUM_48K = 49152; + @SuppressWarnings("unused") + private final static int NUM_64K = 65536; + + private UperEncoder(){} + + public static <T> byte[] encode(T obj) + throws IllegalArgumentException, UnsupportedOperationException { + try { + BitBuffer bitbuffer = ByteBitBuffer.createInfinite(); + encode2(bitbuffer, obj, new Annotation[] {}); + bitbuffer.flip(); + byte[] result = Arrays.copyOf(bitbuffer.array(), (bitbuffer.limit() + 7) / 8); + return result; + } catch (IllegalArgumentException e) { + throw new IllegalArgumentException("Can't encode " + obj.getClass().getName() + ": " + e, e); + } catch (Asn1EncodingException e) { + throw new IllegalArgumentException("Can't encode " + obj.getClass().getName() + ":" + e.getMessage(), e); + } + } + + public static <T> T decode(byte[] bytes, Class<T> classOfT) throws IllegalArgumentException, + UnsupportedOperationException { + BitBuffer bitQueue = bitBufferFromBinaryString(binaryStringFromBytes(bytes)); + T result = decodeAny(bitQueue, classOfT,null, new Annotation[] {}); + if (bitQueue.remaining() > 7) { + throw new IllegalArgumentException("Can't fully decode " + + classOfT.getName() + ", got (" + result.getClass().getName() + "): " + result + + "; remaining " + bitQueue.remaining() + " bits: " + bitQueue); + } + return result; + } + + public static <T> T decode(byte[] bytes, Class<T> classOfT, Field f) throws IllegalArgumentException, + UnsupportedOperationException { + BitBuffer bitQueue = bitBufferFromBinaryString(binaryStringFromBytes(bytes)); + T result = decodeAny(bitQueue, classOfT, f, new Annotation[] {}); + if (bitQueue.remaining() > 7) { + throw new IllegalArgumentException("Can't fully decode " + + classOfT.getName() + ", got (" + result.getClass().getName() + "): " + result + + "; remaining " + bitQueue.remaining() + " bits: " + bitQueue); + } + return result; + } + + + static <T> void encode2(BitBuffer bitbuffer, T obj, Annotation[] extraAnnotations) throws Asn1EncodingException { + for (Encoder e : encoders) { + if (e.canEncode(obj, extraAnnotations)) { + e.encode(bitbuffer, obj, extraAnnotations); + return; + } + } + logger.debug(String.format("Can't find encoder for %s",obj.getClass().getSimpleName())); + + throw new IllegalArgumentException("Can't find encoder for " + obj.getClass().getName() + + " with extra annotations " + Arrays.asList(extraAnnotations)); + } + + static <T> T decodeAny(BitBuffer bitbuffer,Class<T> classOfT, Field f, Annotation[] extraAnnotations) { + + logger.debug(String.format(String.format("Decoding classOfT : %s",classOfT.getCanonicalName()))); + + for (Decoder e : decoders) { + if (e.canDecode(classOfT, extraAnnotations)) { + return e.decode(bitbuffer, classOfT,f, extraAnnotations); + } + } + + logger.debug(String.format("Can't find decoder for %s",classOfT.getSimpleName())); + + throw new IllegalArgumentException("Can't find decoder for " + classOfT.getName() + + " with extra annotations " + Arrays.asList(extraAnnotations)); + } + + static <T> T getDefault(Class<T> classOfT, Annotation[] annotations) { + AnnotationStore annots = new AnnotationStore(classOfT.getAnnotations(), annotations); + Asn1Default defaultAnnotation = annots.getAnnotation(Asn1Default.class); + + if (defaultAnnotation == null){ + return null; + } + + Annotation[] defaultAnnots = new Annotation[] {defaultAnnotation}; + + for (Decoder e : decoders) { + if (e.canDecode(classOfT, defaultAnnots)) { + return e.getDefault(classOfT, defaultAnnots); + } + } + logger.debug(String.format("Can't find decoder for %s",classOfT.getSimpleName())); + + throw new IllegalArgumentException("Can't find default for " + classOfT.getName() + + " with extra annotations " + defaultAnnotation.toString()); + } + + static IntRange newRange( + final long minValue, + final long maxValue, + final boolean hasExtensionMarker) { + + return new IntRange() { + @Override public Class<? extends Annotation> annotationType() { + return IntRange.class; + } + @Override public long minValue() { return minValue; } + @Override public long maxValue() { return maxValue; } + @Override public boolean hasExtensionMarker() { return hasExtensionMarker; } + }; + } + + static IntRange intRangeFromSizeRange(SizeRange sizeRange) { + return newRange(sizeRange.minValue(), sizeRange.maxValue(), sizeRange.hasExtensionMarker()); + } + + private static List<Encoder> encoders = new ArrayList<>(); + private static List<Decoder> decoders = new ArrayList<>(); + + static { + encoders.add(new IntCoder()); + //encoders.add(new BigIntCoder()); + encoders.add(new ByteCoder()); + encoders.add(new BooleanCoder()); + encoders.add(new SequenceCoder()); + encoders.add(new ChoiceCoder()); + encoders.add(new EnumCoder()); + encoders.add(new BitStringCoder()); + encoders.add(new SeqOfCoder()); + encoders.add(new StringCoder()); + + decoders.add(new IntCoder()); + //decoders.add(new BigIntCoder()); + decoders.add(new ByteCoder()); + decoders.add(new BooleanCoder()); + decoders.add(new SequenceCoder()); + decoders.add(new ChoiceCoder()); + decoders.add(new EnumCoder()); + decoders.add(new BitStringCoder()); + decoders.add(new SeqOfCoder()); + decoders.add(new StringCoder()); + + } + + + static <T> void encodeAsOpenType( + BitBuffer bitbuffer, T obj, Annotation[] extraAnnotations) + throws IllegalArgumentException, IllegalAccessException, Asn1EncodingException { + logger.debug(String.format("OPEN TYPE for {%s}. Encoding preceedes length determinant" ,obj != null ? obj.getClass().getSimpleName() : "null")); + BitBuffer tmpbuffer = ByteBitBuffer.createInfinite(); + encode2(tmpbuffer, obj, extraAnnotations); + int numBytes = (tmpbuffer.position() + 7) / 8; + logger.debug(String.format("Encoding open type length determinant (%d) for %s (will be inserted before the open type content)", numBytes, obj != null ? obj.getClass().getName() : "null" )); + try { + encodeLengthDeterminant(bitbuffer, numBytes); + } catch (Asn1EncodingException e) { + throw new Asn1EncodingException(" length of open type ", e); + } + tmpbuffer.flip(); + for (int i = 0; i < tmpbuffer.limit(); i++) { + bitbuffer.put(tmpbuffer.get()); + } + //CG padding bits to fill the byte: Open Types are wrapped in an OCTET STRING + int paddingBits = numBytes*8 - tmpbuffer.limit(); + for (int i = 0; i < paddingBits; i++) { + bitbuffer.put(false); + } + + } + + static <T> T decodeAsOpenType(BitBuffer bitbuffer, Class<T> classOfT,Field f, Annotation[] extraAnnotations) { + logger.debug(String.format("OPEN TYPE for %s. Encoding preceedes length determinant", classOfT != null ? classOfT.getName() : "null")); + long numBytes = decodeLengthDeterminant(bitbuffer); + BitBuffer openTypeBitBuffer = ByteBitBuffer.allocate((int)numBytes * 8); + for (int i = 0; i < numBytes * 8; i++) { + openTypeBitBuffer.put(bitbuffer.get()); + } + openTypeBitBuffer.flip(); + if (classOfT != null) { + T result = decodeAny(openTypeBitBuffer, classOfT, f, extraAnnotations); + // Assert that padding bits are all 0. + logger.debug(String.format("open type had padding bits")); + for (int i = 0; i < openTypeBitBuffer.remaining(); i++) { + boolean paddingBit = openTypeBitBuffer.get(); + logger.debug(String.format("padding bit %d was <%s>", i, paddingBit ? "1" : "0")); + if (paddingBit) { + throw new IllegalArgumentException("non-zero padding bit " + i + " for open type " + classOfT.getSimpleName()); } + } + return result; + } else { + return null; + } + } + + /* + * skip an unknown extension element + * - decode length + * - skip the bytes according to the length + */ + static void decodeSkipUnknownElement(BitBuffer bitbuffer, String name) { + logger.debug(String.format("Skip unknown extension in %s. Encoding preceedes length determinant", name)); + long numBytes = decodeLengthDeterminant(bitbuffer); + for (int i = 0; i < numBytes * 8; i++) { + bitbuffer.get(); + } + logger.debug(String.format(String.format("Skiped %d bytes", numBytes))); + } + + static <T> boolean hasNonNullExtensions( + T obj, Asn1ContainerFieldSorter sorter) + throws IllegalArgumentException, IllegalAccessException { + for (Field f : sorter.extensionFields) { + //CG elements with default value will not be not included + if (f.get(obj) != null && !isDefault(f,f.get(obj)) ) { + return true; + } + } + return false; + } + + private static <T> Constructor<T> findConsturctor(Class<T> classOfT, Object... parameters) { + @SuppressWarnings("unchecked") + Constructor<T>[] declaredConstructors = (Constructor<T>[]) classOfT + .getDeclaredConstructors(); + for (Constructor<T> c : declaredConstructors) { + Class<?>[] parameterTypes = c.getParameterTypes(); + if (parameterTypes.length == parameters.length) { + boolean constructorIsOk = true; + for (int i = 0; i < parameters.length; i++) { + if (!parameterTypes[i].isAssignableFrom(parameters[i].getClass())) { + constructorIsOk = false; + break; + } + } + if (constructorIsOk) { return c; } + } + } + Class<?>[] parameterTypes = new Class<?>[parameters.length]; + for (int i = 0; i < parameters.length; i++) { + parameterTypes[i] = parameters[i].getClass(); + } + throw new IllegalArgumentException("Can't get the " + parameters.length + + "-argument constructor for parameter(s) " + + Arrays.asList(parameters) + + " of type(s) " + Arrays.asList(parameterTypes) + " for class " + + classOfT.getName() + " (" + classOfT.getClass().getName() + " or " + Arrays.asList(classOfT.getClasses()) + ")" + + ", all constructors: " + Arrays.asList(classOfT.getDeclaredConstructors())); + } + + /** Instantiate a given class T using given parameters. */ + static <T> T instantiate(Class<T> classOfT, Object... parameters) { + Class<?>[] parameterTypes = new Class<?>[parameters.length]; + for (int i = 0; i < parameters.length; i++) { + parameterTypes[i] = parameters[i].getClass(); + } + Constructor<T> constructor = findConsturctor(classOfT, parameters); + boolean constructorIsAccessible = constructor.isAccessible(); + constructor.setAccessible(true); + T result; + try { + result = constructor.newInstance(parameters); + } catch (IllegalArgumentException | InvocationTargetException | InstantiationException | IllegalAccessException e) { + throw new IllegalArgumentException("Can't instantiate " + classOfT.getName(), e); + } + constructor.setAccessible(constructorIsAccessible); + return result; + } + + static long decodeConstrainedInt(BitBuffer bitqueue, IntRange intRange) { + long lowerBound = intRange.minValue(); + long upperBound = intRange.maxValue(); + boolean hasExtensionMarker = intRange.hasExtensionMarker(); + if (upperBound < lowerBound) { + throw new IllegalArgumentException("Lower bound " + lowerBound + " is larger that upper bound " + upperBound); + } + if (hasExtensionMarker) { + boolean extensionIsActive = bitqueue.get(); + if (extensionIsActive) { + //in extensions are encoded as uncontraint integers, thius an Asn1BigInteger type should be used(a lower range bound might be applied). + throw new UnsupportedOperationException("int extension are not supported yet"); + } + } + final Long range = upperBound - lowerBound + 1; + if (range == 1) { + return lowerBound; + } + int bitlength = BigInteger.valueOf(range - 1).bitLength(); + logger.debug(String.format("This int will require %d bits, available %d" , bitlength, bitqueue.remaining())); + BitBuffer relevantBits = ByteBitBuffer.allocate( ((bitlength + 7) / 8) * 8); // Full bytes. + int numPaddingBits = (8 - (bitlength % 8)) % 8; // Leading padding 0-bits. + for (int i = 0; i < numPaddingBits; i++) { + relevantBits.put(false); + } + for (int i = 0; i < bitlength; i++) { + relevantBits.put(bitqueue.get()); + } + relevantBits.flip(); + final BigInteger big = new BigInteger(+1, relevantBits.array()); + final Long result = lowerBound + big.longValue(); + logger.debug(String.format("bits %s decoded as %d plus lower bound %d give %d", + relevantBits.toBooleanStringFromPosition(0), big.longValue(), lowerBound, result)); + if ((result < intRange.minValue() || intRange.maxValue() < result) + && !intRange.hasExtensionMarker()) { + throw new AssertionError("Decoded value " + + result + " is outside of range (" + intRange.minValue() + ".." + + intRange.maxValue() + ")"); + } + return result; + } + + + //CG Begin + static boolean isDefault(Field f, Object obj) { + + if (f.getAnnotation(Asn1Default.class) != null) { + String value = f.getAnnotation(Asn1Default.class).value(); + if (obj.toString().equals(value)){ + return true; + } + } + return false; + + } + + + public static boolean isNotAsn1(Field f) { + return (f.getAnnotation(NoAsn1Field.class) != null); + } + //CG End + + + static boolean hasExtensionMarker(AnnotationStore annotations) { + return annotations.getAnnotation(HasExtensionMarker.class) != null; + } + + private static boolean isExtension(Field f) { + return f.getAnnotation(IsExtension.class) != null; + } + + static boolean isMandatory(Field f) { + return !isOptional(f); + } + + static boolean isOptional(Field f) { + //CG elements with default value are treated as optional as they are not encoded in case of the default value + if (f.getAnnotation(Asn1Optional.class) != null || + f.getAnnotation(Asn1Default.class) != null) { + return true; + } + return false; + } + + static class Asn1ContainerFieldSorter { + /** "Outside extension root" */ + List<Field> extensionFields = new ArrayList<>(); + List<Field> optionalExtensionFields = new ArrayList<>(); + List<Field> mandatoryExtensionField = new ArrayList<>(); + /** "Within extension root" */ + List<Field> ordinaryFields = new ArrayList<>(); + List<Field> mandatoryOrdinaryFields = new ArrayList<>(); + List<Field> optionalOrdinaryFields = new ArrayList<>(); + List<Field> allFields = new ArrayList<>(); // Excluding test instrumentation. + + Map<Field, Boolean> originalAccess = new HashMap<>(); + + Asn1ContainerFieldSorter(Class<?> type) { + + /* + * + * sorting of the fields added to compensate the error + * in the java SDK on android where getDeclaredFields does + * not return the fields in the order of the class definition + * + */ + List<Field> fields = Arrays.asList(type.getDeclaredFields()); + Collections.sort(fields, new Comparator<Field>() { + @Override + public int compare(Field o1, Field o2) { + FieldOrder ao1 = o1.getAnnotation(FieldOrder.class); + FieldOrder ao2 = o2.getAnnotation(FieldOrder.class); + int order1 = ao1 == null ? Integer.MAX_VALUE : ao1.order(); + int order2 = ao2 == null ? Integer.MAX_VALUE : ao2.order(); + if (order1 == Integer.MAX_VALUE || order2 == Integer.MAX_VALUE || order1 < 0 || order2 < 0 || order1 == order2) { + logger.debug(String.format("field order error for %s",type.getSimpleName())); + } + return Integer.compare(order1, order2); + } + }); + + + for (Field f : fields) { + if (isTestInstrumentation(f) || isNonAsn1Field(f) ) { + continue; + } + originalAccess.put(f, f.isAccessible()); + f.setAccessible(true); + if (isExtension(f)) { + extensionFields.add(f); + if (isOptional(f)) { + optionalExtensionFields.add(f); + } else { + mandatoryExtensionField.add(f); + } + } + else { + ordinaryFields.add(f); + } + allFields.add(f); + } + for (Field f : ordinaryFields) { + if (isMandatory(f)) { + mandatoryOrdinaryFields.add(f); + } else { + optionalOrdinaryFields.add(f); + } + } + } + + public void revertAccess() { + for (Entry<Field, Boolean> entry : originalAccess.entrySet()) { + entry.getKey().setAccessible(entry.getValue()); + } + } + } + + static boolean isTestInstrumentation(Field f) { + return f.getName().startsWith("$"); + } + + static boolean isNonAsn1Field(Field f) { + if (f.getAnnotation(NoAsn1Field.class) != null) { + return true; + } + return false; + } + + static void encodeLengthOfBitmask(BitBuffer bitbuffer, int n) throws Asn1EncodingException { + try { + if (n <= 63) { + logger.debug(String.format("normally small length of bitmask, length %d <= 63 indicated as bit <0>", n)); + bitbuffer.put(false); + encodeConstrainedInt(bitbuffer, n, 1, 63); + return; + } else { + logger.debug(String.format("normally small length of bitmask, length %s > 63 indicated as bit <1>", n)); + bitbuffer.put(true); + encodeLengthDeterminant(bitbuffer, n); + return; + } + } catch (Asn1EncodingException e) { + throw new Asn1EncodingException(" length of bitmask ", e); + } + } + + static void encodeSmallInt(BitBuffer bitbuffer, int n) throws Asn1EncodingException { + try { + if (n <= 63) { + logger.debug(String.format("normally small length of bitmask, length %d <= 63 indicated as bit <0>", n)); + bitbuffer.put(false); + encodeConstrainedInt(bitbuffer, n, 0, 63); + return; + } else { + logger.debug(String.format("normally small length of bitmask, length %s > 63 indicated as bit <1>", n)); + bitbuffer.put(true); + encodeLengthDeterminant(bitbuffer, n); + return; + } + } catch (Asn1EncodingException e) { + throw new Asn1EncodingException(" length of bitmask ", e); + } + } + + static void encodeLengthDeterminant(BitBuffer bitbuffer, int n) throws Asn1EncodingException { + try { + int position = bitbuffer.position(); + if (n < 128) { + bitbuffer.put(false); + encodeConstrainedInt(bitbuffer, n, 0, 127); + logger.debug(String.format("Length determinant %d, encoded as <%s>", n, bitbuffer.toBooleanStringFromPosition(position))); + if (bitbuffer.position() - position != 8) { + throw new AssertionError("length determinant encoded not as 8 bits"); + } + return; + } else if (n < NUM_16K) { + bitbuffer.put(true); + bitbuffer.put(false); + encodeConstrainedInt(bitbuffer, n, 0, NUM_16K - 1); + logger.debug(String.format("Length determinant %d, encoded as 2bits+14bits: <%s>", n,bitbuffer.toBooleanStringFromPosition(position))); + if (bitbuffer.position() - position != 16) { + throw new AssertionError("length determinant encoded not as 16 bits"); + } + return; + } else { + throw new UnsupportedOperationException("Length greater than 16K is not supported yet."); + } + } catch (Asn1EncodingException e) { + throw new Asn1EncodingException(" length determinant ", e); + } + + } + + static long decodeLengthOfBitmask(BitBuffer bitbuffer) { + logger.debug("decoding length of bitmask"); + boolean isGreaterThan63 = bitbuffer.get(); + logger.debug(String.format("length determinant extension preamble size flag: preamble size > 63 is %s", isGreaterThan63)); + if (!isGreaterThan63) { + Long result = decodeConstrainedInt(bitbuffer, newRange(1, 63, false)); + logger.debug(String.format("normally small length of bitmask, length <= 63, decoded as %d", result)); + return result; + } else { + logger.debug(String.format("normally small length of bitmask, length > 63, decoding as ordinary length determinant...")); + return decodeLengthDeterminant(bitbuffer); + } + } + + static long decodeSmallInt(BitBuffer bitbuffer) { + logger.debug("decoding small int"); + boolean isGreaterThan63 = bitbuffer.get(); + logger.debug(String.format("length determinant extension preamble size flag: preamble size > 63 is %s", isGreaterThan63)); + if (!isGreaterThan63) { + Long result = decodeConstrainedInt(bitbuffer, newRange(0, 63, false)); + logger.debug(String.format("normally small length of bitmask, length <= 63, decoded as %d", result)); + return result; + } else { + logger.debug(String.format("normally small length of bitmask, length > 63, decoding as ordinary length determinant...")); + return decodeLengthDeterminant(bitbuffer); + } + } + + static long decodeLengthDeterminant(BitBuffer bitbuffer) { + boolean bit8 = bitbuffer.get(); + if (!bit8) { // then value is less than 128 + Long result = decodeConstrainedInt(bitbuffer, newRange(0, 127, false)); + logger.debug(String.format("length determinant, decoded as %d", result)); + return result; + } else { + boolean bit7 = bitbuffer.get(); + if (!bit7) { // then value is less than 16K + Long result = decodeConstrainedInt(bitbuffer, newRange(0, NUM_16K - 1, false)); + logger.debug(String.format("length determinant, decoded as %d", result)); + return result; + } else { // "Large" n + logger.debug("lengthes longer than 16K are not supported yet."); + throw new UnsupportedOperationException("lengthes longer than 16K are not supported yet."); + } + } + + } + + static void encodeConstrainedInt( + final BitBuffer bitbuffer, + final long value, + final long lowerBound, + final long upperBound) throws Asn1EncodingException { + encodeConstrainedInt(bitbuffer, value, lowerBound, upperBound, false); + } + + static void encodeConstrainedInt( + final BitBuffer bitbuffer, + final long value, + final long lowerBound, + final long upperBound, + final boolean hasExtensionMarker + ) throws Asn1EncodingException { + if (upperBound < lowerBound) { + throw new IllegalArgumentException("Lower bound " + + lowerBound + " is larger than upper bound " + upperBound); + } + if (!hasExtensionMarker && (value < lowerBound || value > upperBound)) { + throw new Asn1EncodingException( + " Value " + value + " is outside of fixed range " + + lowerBound + ".." + upperBound); + } + final Long range = upperBound - lowerBound + 1; + final int position = bitbuffer.position(); + if (hasExtensionMarker) { + boolean outsideOfRange = value < lowerBound || value > upperBound; + logger.debug(String.format("constrained int with extension marker, %s extension range",outsideOfRange ? "outside" : "within", outsideOfRange ? "1" : "0")); + bitbuffer.put(outsideOfRange); + if (outsideOfRange) { + throw new UnsupportedOperationException( + "INT extensions are not supported yet"); + } + } + if (range == 1) { + logger.debug("constrained int of empty range, resulting in empty encoding <>"); + return; + } + final BigInteger big = BigInteger.valueOf(value - lowerBound); + final int numPaddingBits = BigInteger.valueOf(range - 1).bitLength() - big.bitLength(); + for (int i = 0; i < numPaddingBits; i++) { + bitbuffer.put(false); + } + for (int i = big.bitLength() - 1; i >= 0; i--) { + bitbuffer.put(big.testBit(i)); + } + logger.debug(String.format("constrained int %d encoded as <%s>", value, bitbuffer.toBooleanStringFromPosition(position))); + return; + } + + public static byte[] bytesFromCollection(List<Boolean> bitlist) { + int sizeBytes = (bitlist.size() + 7) / 8; + byte[] result = new byte[sizeBytes]; + int byteId = 0; + byte bitId = 7; + logger.debug(String.format("byte: < %s >", bitlist)); + for (Boolean b : bitlist) { + //logger.debug(String.format("bitId: %s, byteId: %s, value: %s", bitId, byteId, b)); + result[byteId] |= (b ? 1 : 0) << bitId; + bitId--; + if (bitId < 0) { + bitId = 7; + byteId++; + } + } + int nZeros = sizeBytes * 8 - bitlist.size(); + String zeros = nZeros > 0 ? String.format("%0" + nZeros + "d", 0) : ""; + logger.debug(String.format("Padding bits (%d): <%s>", nZeros, zeros)); + return result; + } + + final protected static char[] hexArray = "0123456789ABCDEF".toCharArray(); + + public static String hexStringFromBytes(byte[] bytes) { + char[] hexChars = new char[bytes.length * 2]; + for (int j = 0; j < bytes.length; j++) { + int v = bytes[j] & 0xFF; + hexChars[j * 2] = hexArray[v >>> 4]; + hexChars[j * 2 + 1] = hexArray[v & 0x0F]; + } + return new String(hexChars); + } + + public static byte[] bytesFromHexString(String s) { + int len = s.length(); + byte[] data = new byte[len / 2]; + for (int i = 0; i < len; i += 2) { + data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + + Character.digit(s.charAt(i + 1), 16)); + } + return data; + } + + public static String binaryStringFromBytes(byte[] bytes) { + StringBuilder sb = new StringBuilder(bytes.length * Byte.SIZE); + for (int i = 0; i < Byte.SIZE * bytes.length; i++) + sb.append((bytes[i / Byte.SIZE] << i % Byte.SIZE & 0x80) == 0 ? '0' : '1'); + return sb.toString(); + } + + public static byte[] bytesFromBinaryString(String s) { + int len = s.length(); + byte[] result = new byte[(len + Byte.SIZE - 1) / Byte.SIZE]; + char c; + for (int i = 0; i < len; i++) + if ((c = s.charAt(i)) == '1') result[i / Byte.SIZE] = (byte) (result[i / Byte.SIZE] | (0x80 >>> (i % Byte.SIZE))); + else if (c != '0') + throw new IllegalArgumentException(); + return result; + } + + private static BitBuffer bitBufferFromBinaryString(String s) { + ByteBitBuffer result = ByteBitBuffer.allocate(s.length()); + for (int i = 0; i < s.length(); i++) { + if (s.charAt(i) != '1' && s.charAt(i) != '0') { + throw new IllegalArgumentException("bad character in 'binary' string " + s.charAt(i)); + } + result.put(s.charAt(i) == '1'); + } + result.flip(); + return result; + } + + + + +} diff --git a/src/org/uic/barcode/dynamicFrame/DataType.java b/src/org/uic/barcode/dynamicFrame/DataType.java index fb84db6..2d6d984 100644 --- a/src/org/uic/barcode/dynamicFrame/DataType.java +++ b/src/org/uic/barcode/dynamicFrame/DataType.java @@ -1,11 +1,11 @@ package org.uic.barcode.dynamicFrame;
-import net.gcdc.asn1.datatypes.Asn1Default;
-import net.gcdc.asn1.datatypes.CharacterRestriction;
-import net.gcdc.asn1.datatypes.RestrictedString;
-import net.gcdc.asn1.datatypes.Sequence;
-import net.gcdc.asn1.datatypesimpl.OctetString;
-import net.gcdc.asn1.uper.UperEncoder;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.OctetString;
+import org.uic.barcode.asn1.uper.UperEncoder;
/**
* The Class DataType.
diff --git a/src/org/uic/barcode/dynamicFrame/DynamicFrame.java b/src/org/uic/barcode/dynamicFrame/DynamicFrame.java index 69a67b2..9605a0d 100644 --- a/src/org/uic/barcode/dynamicFrame/DynamicFrame.java +++ b/src/org/uic/barcode/dynamicFrame/DynamicFrame.java @@ -10,17 +10,16 @@ import java.security.SignatureException; import java.security.spec.InvalidKeySpecException;
import java.security.spec.X509EncodedKeySpec;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.OctetString;
+import org.uic.barcode.asn1.uper.UperEncoder;
import org.uic.barcode.utils.AlgorithmNameResolver;
-import net.gcdc.asn1.datatypes.Asn1Optional;
-import net.gcdc.asn1.datatypes.CharacterRestriction;
-import net.gcdc.asn1.datatypes.FieldOrder;
-import net.gcdc.asn1.datatypes.HasExtensionMarker;
-import net.gcdc.asn1.datatypes.RestrictedString;
-import net.gcdc.asn1.datatypes.Sequence;
-import net.gcdc.asn1.datatypesimpl.OctetString;
-import net.gcdc.asn1.uper.UperEncoder;
-
/**
* The DynamicHeader for bar codes
diff --git a/src/org/uic/barcode/dynamicFrame/Level1DataType.java b/src/org/uic/barcode/dynamicFrame/Level1DataType.java index 796c44f..1f4d476 100644 --- a/src/org/uic/barcode/dynamicFrame/Level1DataType.java +++ b/src/org/uic/barcode/dynamicFrame/Level1DataType.java @@ -1,16 +1,15 @@ package org.uic.barcode.dynamicFrame;
-import org.uic.ticket.EncodingFormatException;
-import org.uic.ticket.api.utils.UicEncoderUtils;
-
-import net.gcdc.asn1.datatypes.Asn1Optional;
-import net.gcdc.asn1.datatypes.CharacterRestriction;
-import net.gcdc.asn1.datatypes.FieldOrder;
-import net.gcdc.asn1.datatypes.IntRange;
-import net.gcdc.asn1.datatypes.RestrictedString;
-import net.gcdc.asn1.datatypes.Sequence;
-import net.gcdc.asn1.datatypesimpl.OctetString;
-import net.gcdc.asn1.uper.UperEncoder;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+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.OctetString;
+import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.api.utils.UicEncoderUtils;
/**
* The Class SignedDataType.
diff --git a/src/org/uic/barcode/dynamicFrame/Level2DataType.java b/src/org/uic/barcode/dynamicFrame/Level2DataType.java index b2aceab..dbd25ce 100644 --- a/src/org/uic/barcode/dynamicFrame/Level2DataType.java +++ b/src/org/uic/barcode/dynamicFrame/Level2DataType.java @@ -3,14 +3,13 @@ package org.uic.barcode.dynamicFrame; import java.security.PrivateKey;
import java.security.Signature;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.OctetString;
+import org.uic.barcode.asn1.uper.UperEncoder;
import org.uic.barcode.utils.AlgorithmNameResolver;
-import net.gcdc.asn1.datatypes.Asn1Optional;
-import net.gcdc.asn1.datatypes.FieldOrder;
-import net.gcdc.asn1.datatypes.Sequence;
-import net.gcdc.asn1.datatypesimpl.OctetString;
-import net.gcdc.asn1.uper.UperEncoder;
-
/**
* The Class DataType.
*/
diff --git a/src/org/uic/barcode/dynamicFrame/SequenceOfDataType.java b/src/org/uic/barcode/dynamicFrame/SequenceOfDataType.java index 93b9d78..b5c130e 100644 --- a/src/org/uic/barcode/dynamicFrame/SequenceOfDataType.java +++ b/src/org/uic/barcode/dynamicFrame/SequenceOfDataType.java @@ -3,7 +3,7 @@ package org.uic.barcode.dynamicFrame; import java.util.Collection;
-import net.gcdc.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
/**
* The Class SequenceOfDataType.
diff --git a/src/org/uic/barcode/logger/Logger.java b/src/org/uic/barcode/logger/Logger.java new file mode 100644 index 0000000..b536154 --- /dev/null +++ b/src/org/uic/barcode/logger/Logger.java @@ -0,0 +1,24 @@ +package org.uic.barcode.logger;
+
+import java.util.logging.Level;
+
+
+public class Logger {
+
+ public void debug(String text){
+ java.util.logging.Logger.getGlobal().log(Level.FINEST,text);
+ System.out.println(text);
+ }
+
+ public void log(Level level,String text){
+ java.util.logging.Logger.getGlobal().log(level,text);
+ }
+
+ public void info(String text, IllegalArgumentException e) {
+ java.util.logging.Logger.getGlobal().log(Level.INFO,text);
+ }
+
+
+}
+
+
diff --git a/src/org/uic/barcode/logger/LoggerFactory.java b/src/org/uic/barcode/logger/LoggerFactory.java new file mode 100644 index 0000000..0a1a83c --- /dev/null +++ b/src/org/uic/barcode/logger/LoggerFactory.java @@ -0,0 +1,9 @@ +package org.uic.barcode.logger;
+
+public class LoggerFactory {
+
+ public static Logger getLogger(String name) {
+ return new Logger();
+ }
+
+}
diff --git a/src/org/uic/barcode/staticFrame/DataRecord.java b/src/org/uic/barcode/staticFrame/DataRecord.java index 27e128f..16d3811 100644 --- a/src/org/uic/barcode/staticFrame/DataRecord.java +++ b/src/org/uic/barcode/staticFrame/DataRecord.java @@ -4,7 +4,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException;
import java.util.Arrays;
-import org.uic.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.EncodingFormatException;
/**
* The Class DataRecord implements the basic decoding and encoding
diff --git a/src/org/uic/barcode/staticFrame/GENERICDataRecord.java b/src/org/uic/barcode/staticFrame/GENERICDataRecord.java index 2477af9..4769670 100644 --- a/src/org/uic/barcode/staticFrame/GENERICDataRecord.java +++ b/src/org/uic/barcode/staticFrame/GENERICDataRecord.java @@ -2,7 +2,7 @@ package org.uic.barcode.staticFrame; import java.io.IOException;
-import org.uic.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.EncodingFormatException;
/**
diff --git a/src/org/uic/barcode/staticFrame/StaticFrame.java b/src/org/uic/barcode/staticFrame/StaticFrame.java index 6df104b..5246ac7 100644 --- a/src/org/uic/barcode/staticFrame/StaticFrame.java +++ b/src/org/uic/barcode/staticFrame/StaticFrame.java @@ -19,7 +19,7 @@ import java.util.zip.DataFormatException; import java.util.zip.Deflater;
import java.util.zip.Inflater;
-import org.uic.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.EncodingFormatException;
/**
diff --git a/src/org/uic/barcode/staticFrame/UFLEXDataRecord.java b/src/org/uic/barcode/staticFrame/UFLEXDataRecord.java index 9731198..fad2be8 100644 --- a/src/org/uic/barcode/staticFrame/UFLEXDataRecord.java +++ b/src/org/uic/barcode/staticFrame/UFLEXDataRecord.java @@ -2,9 +2,9 @@ package org.uic.barcode.staticFrame; import java.io.IOException;
-import org.uic.ticket.EncodingFormatException;
-import org.uic.ticket.UicRailTicketCoder;
-import org.uic.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.UicRailTicketCoder;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
/**
* The Class UFLEXDataRecord implements the dara record to hold the data of an ASN.1 PER encoded UIC ticket.
diff --git a/src/org/uic/barcode/staticFrame/UHEADDataRecord.java b/src/org/uic/barcode/staticFrame/UHEADDataRecord.java index e2ec301..855c9d5 100644 --- a/src/org/uic/barcode/staticFrame/UHEADDataRecord.java +++ b/src/org/uic/barcode/staticFrame/UHEADDataRecord.java @@ -7,7 +7,7 @@ import java.text.SimpleDateFormat; import java.util.Calendar;
import java.util.Date;
-import org.uic.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.EncodingFormatException;
/**
* The Class UHEADDataRecord implements the additional header record of a statis UIC bar code
diff --git a/src/org/uic/barcode/staticFrame/UTLAYDataRecord.java b/src/org/uic/barcode/staticFrame/UTLAYDataRecord.java index 68211ad..549a2e7 100644 --- a/src/org/uic/barcode/staticFrame/UTLAYDataRecord.java +++ b/src/org/uic/barcode/staticFrame/UTLAYDataRecord.java @@ -12,7 +12,7 @@ import java.nio.charset.StandardCharsets; import org.uic.barcode.staticFrame.ticketLayoutBarcode.FormatType;
import org.uic.barcode.staticFrame.ticketLayoutBarcode.LayoutElement;
import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout;
-import org.uic.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.EncodingFormatException;
/**
* The Class UTLAYDataRecord implements a bar code data record containing the ticket layout.
diff --git a/src/org/uic/barcode/test/DynamicFrameDoubleSignatureTest.java b/src/org/uic/barcode/test/DynamicFrameDoubleSignatureTest.java index e072a2a..aa377e8 100644 --- a/src/org/uic/barcode/test/DynamicFrameDoubleSignatureTest.java +++ b/src/org/uic/barcode/test/DynamicFrameDoubleSignatureTest.java @@ -24,9 +24,9 @@ import org.uic.barcode.dynamicFrame.Constants; import org.uic.barcode.dynamicFrame.DataType;
import org.uic.barcode.test.utils.Level2TestDataFactory;
import org.uic.barcode.test.utils.SimpleUICTestTicket;
+import org.uic.barcode.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
import org.uic.barcode.utils.AlgorithmNameResolver;
-import org.uic.ticket.EncodingFormatException;
-import org.uic.ticket.api.spec.IUicRailTicket;
public class DynamicFrameDoubleSignatureTest {
diff --git a/src/org/uic/barcode/test/DynamicFrameLOwLevelTest.java b/src/org/uic/barcode/test/DynamicFrameLOwLevelTest.java index d3148b2..5dd9668 100644 --- a/src/org/uic/barcode/test/DynamicFrameLOwLevelTest.java +++ b/src/org/uic/barcode/test/DynamicFrameLOwLevelTest.java @@ -19,12 +19,11 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.jce.spec.ECParameterSpec;
import org.junit.Before;
import org.junit.Test;
+import org.uic.barcode.asn1.uper.UperEncoder;
import org.uic.barcode.dynamicFrame.Constants;
import org.uic.barcode.dynamicFrame.DynamicFrame;
import org.uic.barcode.test.utils.SimpleDynamicFrameTestBarcode;
-import net.gcdc.asn1.uper.UperEncoder;
-
public class DynamicFrameLOwLevelTest {
public String algorithmOID = Constants.ECDSA_SHA256;
diff --git a/src/org/uic/barcode/test/DynamicFrameSimpleTest.java b/src/org/uic/barcode/test/DynamicFrameSimpleTest.java index 4c131cc..a3a1b0e 100644 --- a/src/org/uic/barcode/test/DynamicFrameSimpleTest.java +++ b/src/org/uic/barcode/test/DynamicFrameSimpleTest.java @@ -21,9 +21,9 @@ import org.uic.barcode.Decoder; import org.uic.barcode.Encoder;
import org.uic.barcode.dynamicFrame.Constants;
import org.uic.barcode.test.utils.SimpleUICTestTicket;
+import org.uic.barcode.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
import org.uic.barcode.utils.AlgorithmNameResolver;
-import org.uic.ticket.EncodingFormatException;
-import org.uic.ticket.api.spec.IUicRailTicket;
public class DynamicFrameSimpleTest {
diff --git a/src/org/uic/barcode/test/SignatureSplitTest.java b/src/org/uic/barcode/test/SignatureSplitTest.java index 2e51525..08fe3ad 100644 --- a/src/org/uic/barcode/test/SignatureSplitTest.java +++ b/src/org/uic/barcode/test/SignatureSplitTest.java @@ -8,7 +8,7 @@ import java.math.BigInteger; import org.junit.Test;
import org.uic.barcode.staticFrame.StaticFrame;
import org.uic.barcode.test.utils.TestUtils;
-import org.uic.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.EncodingFormatException;
public class SignatureSplitTest {
diff --git a/src/org/uic/barcode/test/StaticFrameBarcodeTest.java b/src/org/uic/barcode/test/StaticFrameBarcodeTest.java index de1f5b0..9600191 100644 --- a/src/org/uic/barcode/test/StaticFrameBarcodeTest.java +++ b/src/org/uic/barcode/test/StaticFrameBarcodeTest.java @@ -21,8 +21,8 @@ import org.uic.barcode.dynamicFrame.Constants; import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout;
import org.uic.barcode.test.utils.SimpleTestTicketLayout;
import org.uic.barcode.test.utils.SimpleUICTestTicket;
-import org.uic.ticket.EncodingFormatException;
-import org.uic.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
/**
* The Class StaticFrameBarcodeTest.
diff --git a/src/org/uic/barcode/test/StaticFrameBarcodeTestFCB2.java b/src/org/uic/barcode/test/StaticFrameBarcodeTestFCB2.java index 22f7937..048d684 100644 --- a/src/org/uic/barcode/test/StaticFrameBarcodeTestFCB2.java +++ b/src/org/uic/barcode/test/StaticFrameBarcodeTestFCB2.java @@ -21,8 +21,8 @@ import org.uic.barcode.dynamicFrame.Constants; import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout;
import org.uic.barcode.test.utils.SimpleTestTicketLayout;
import org.uic.barcode.test.utils.SimpleUICTestTicket;
-import org.uic.ticket.EncodingFormatException;
-import org.uic.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
/**
* The Class StaticFrameBarcodeTest.
diff --git a/src/org/uic/barcode/test/TicketLayoutTest.java b/src/org/uic/barcode/test/TicketLayoutTest.java index 3cf143e..089c87d 100644 --- a/src/org/uic/barcode/test/TicketLayoutTest.java +++ b/src/org/uic/barcode/test/TicketLayoutTest.java @@ -9,7 +9,7 @@ import org.uic.barcode.staticFrame.UTLAYDataRecord; import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout;
import org.uic.barcode.test.utils.SimpleTestTicketLayout;
import org.uic.barcode.test.utils.TestUtils;
-import org.uic.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.EncodingFormatException;
public class TicketLayoutTest {
diff --git a/src/org/uic/barcode/test/utils/Level2TestDataFactory.java b/src/org/uic/barcode/test/utils/Level2TestDataFactory.java index a361561..b1eb0f5 100644 --- a/src/org/uic/barcode/test/utils/Level2TestDataFactory.java +++ b/src/org/uic/barcode/test/utils/Level2TestDataFactory.java @@ -1,9 +1,8 @@ package org.uic.barcode.test.utils;
+import org.uic.barcode.asn1.datatypesimpl.OctetString;
import org.uic.barcode.dynamicFrame.DataType;
-import net.gcdc.asn1.datatypesimpl.OctetString;
-
public class Level2TestDataFactory {
public static DataType getLevel2SimpleTestData() {
diff --git a/src/org/uic/barcode/test/utils/SimpleDynamicFrameTestBarcode.java b/src/org/uic/barcode/test/utils/SimpleDynamicFrameTestBarcode.java index 1782ca6..af7dcd0 100644 --- a/src/org/uic/barcode/test/utils/SimpleDynamicFrameTestBarcode.java +++ b/src/org/uic/barcode/test/utils/SimpleDynamicFrameTestBarcode.java @@ -8,9 +8,9 @@ import org.uic.barcode.dynamicFrame.DynamicFrame; import org.uic.barcode.dynamicFrame.Level1DataType;
import org.uic.barcode.dynamicFrame.Level2DataType;
import org.uic.barcode.dynamicFrame.SequenceOfDataType;
-import org.uic.ticket.EncodingFormatException;
-import org.uic.ticket.api.asn.omv1.UicRailTicketData;
-import org.uic.ticket.api.test.SimpleUicTestTicket;
+import org.uic.barcode.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
+import org.uic.barcode.ticket.api.test.SimpleUicTestTicket;
public class SimpleDynamicFrameTestBarcode {
diff --git a/src/org/uic/barcode/test/utils/SimpleTestTicketLayout.java b/src/org/uic/barcode/test/utils/SimpleTestTicketLayout.java index ca888e7..b1b6422 100644 --- a/src/org/uic/barcode/test/utils/SimpleTestTicketLayout.java +++ b/src/org/uic/barcode/test/utils/SimpleTestTicketLayout.java @@ -17,7 +17,7 @@ public class SimpleTestTicketLayout { element.setLine(1);
element.setHeight(1);
element.setWidth(20);
- element.setText("Müller");
+ element.setText("Müller");
layout.addLayoutElement(element);
return layout;
diff --git a/src/org/uic/barcode/test/utils/SimpleUICTestTicket.java b/src/org/uic/barcode/test/utils/SimpleUICTestTicket.java index 3f38515..be34535 100644 --- a/src/org/uic/barcode/test/utils/SimpleUICTestTicket.java +++ b/src/org/uic/barcode/test/utils/SimpleUICTestTicket.java @@ -4,30 +4,30 @@ import java.text.ParseException; import java.text.SimpleDateFormat;
import java.util.Date;
-import org.uic.ticket.api.impl.SimpleCardReference;
-import org.uic.ticket.api.impl.SimpleControlDetail;
-import org.uic.ticket.api.impl.SimpleCustomerStatusDescription;
-import org.uic.ticket.api.impl.SimpleExtension;
-import org.uic.ticket.api.impl.SimpleIssuingDetail;
-import org.uic.ticket.api.impl.SimpleOpenTicket;
-import org.uic.ticket.api.impl.SimpleStationPassage;
-import org.uic.ticket.api.impl.SimpleTicketLink;
-import org.uic.ticket.api.impl.SimpleToken;
-import org.uic.ticket.api.impl.SimpleTraveler;
-import org.uic.ticket.api.impl.SimpleTravelerDetail;
-import org.uic.ticket.api.impl.SimpleUicRailTicket;
-import org.uic.ticket.api.spec.ICardReference;
-import org.uic.ticket.api.spec.IControlDetail;
-import org.uic.ticket.api.spec.ICustomerStatusDescription;
-import org.uic.ticket.api.spec.IExtension;
-import org.uic.ticket.api.spec.IIssuingDetail;
-import org.uic.ticket.api.spec.ILinkMode;
-import org.uic.ticket.api.spec.IOpenTicket;
-import org.uic.ticket.api.spec.IStationPassage;
-import org.uic.ticket.api.spec.ITicketLink;
-import org.uic.ticket.api.spec.IToken;
-import org.uic.ticket.api.spec.ITraveler;
-import org.uic.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.api.impl.SimpleCardReference;
+import org.uic.barcode.ticket.api.impl.SimpleControlDetail;
+import org.uic.barcode.ticket.api.impl.SimpleCustomerStatusDescription;
+import org.uic.barcode.ticket.api.impl.SimpleExtension;
+import org.uic.barcode.ticket.api.impl.SimpleIssuingDetail;
+import org.uic.barcode.ticket.api.impl.SimpleOpenTicket;
+import org.uic.barcode.ticket.api.impl.SimpleStationPassage;
+import org.uic.barcode.ticket.api.impl.SimpleTicketLink;
+import org.uic.barcode.ticket.api.impl.SimpleToken;
+import org.uic.barcode.ticket.api.impl.SimpleTraveler;
+import org.uic.barcode.ticket.api.impl.SimpleTravelerDetail;
+import org.uic.barcode.ticket.api.impl.SimpleUicRailTicket;
+import org.uic.barcode.ticket.api.spec.ICardReference;
+import org.uic.barcode.ticket.api.spec.IControlDetail;
+import org.uic.barcode.ticket.api.spec.ICustomerStatusDescription;
+import org.uic.barcode.ticket.api.spec.IExtension;
+import org.uic.barcode.ticket.api.spec.IIssuingDetail;
+import org.uic.barcode.ticket.api.spec.ILinkMode;
+import org.uic.barcode.ticket.api.spec.IOpenTicket;
+import org.uic.barcode.ticket.api.spec.IStationPassage;
+import org.uic.barcode.ticket.api.spec.ITicketLink;
+import org.uic.barcode.ticket.api.spec.IToken;
+import org.uic.barcode.ticket.api.spec.ITraveler;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
public class SimpleUICTestTicket {
diff --git a/src/org/uic/barcode/ticket/EncodingFormatException.java b/src/org/uic/barcode/ticket/EncodingFormatException.java new file mode 100644 index 0000000..1014184 --- /dev/null +++ b/src/org/uic/barcode/ticket/EncodingFormatException.java @@ -0,0 +1,26 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket;
+
+
+/**
+ * The Class EncodingFormatException.
+ */
+public class EncodingFormatException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6949233719793346110L;
+
+ /**
+ * Instantiates a new encoding format exception. The exception indicates a violation of the asn.1 ticket format specification
+ *
+ * @param message the message
+ */
+ public EncodingFormatException(String message) {
+ super(message);
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/UicRailTicketCoder.java b/src/org/uic/barcode/ticket/UicRailTicketCoder.java new file mode 100644 index 0000000..62fda2d --- /dev/null +++ b/src/org/uic/barcode/ticket/UicRailTicketCoder.java @@ -0,0 +1,163 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoder;
+import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV2;
+import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoder;
+import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV2;
+
+
+/**
+ * The Class UicRailTicketCoder.
+ */
+public class UicRailTicketCoder {
+
+ /**
+ * encode an UicRailTicket to asn.1 format using PER unaligned encoding
+ *
+ * @param outputStream the output stream for the encoded data
+ * @param uicRailTicket the uic rail ticket to be encoded
+ * @param version of the asn1 specification
+ * @throws IOException signals that an I/O exception has occurred.
+ * @throws EncodingFormatException signals that a format rule of the asn.1 specification was violated.
+ */
+ public byte[] encode (IUicRailTicket uicRailTicket, int version) throws IOException, EncodingFormatException{
+
+
+ if (version == 13) {
+
+ Api2OpenAsnEncoder uicEncoder = new Api2OpenAsnEncoder();
+
+ return uicEncoder.encode(uicRailTicket);
+
+
+ } else if (version == 2) {
+
+ Api2OpenAsnEncoderV2 uicEncoder = new Api2OpenAsnEncoderV2();
+
+ return uicEncoder.encode(uicRailTicket);
+
+ }
+
+ throw new EncodingFormatException(String.format("Encoding version %d not supported", version));
+
+
+ }
+
+
+ /**
+ * encode an UicRailTicket to asn.1 format using PER unaligned encoding
+ *
+ * @param outputStream the output stream for the encoded data
+ * @param uicRailTicket the uic rail ticket to be encoded
+ * @param version of the asn1 specification
+ * @throws IOException signals that an I/O exception has occurred.
+ * @throws EncodingFormatException signals that a format rule of the asn.1 specification was violated.
+ */
+ public void encode ( ByteArrayOutputStream outputStream, IUicRailTicket uicRailTicket, int version) throws IOException, EncodingFormatException{
+
+
+
+ if (version == 13) {
+
+ Api2OpenAsnEncoder uicEncoder = new Api2OpenAsnEncoder();
+
+ org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData asnUicRailTicketData = uicEncoder.populateToAsn1Model(uicRailTicket);
+
+ outputStream.write(asnUicRailTicketData.encode());
+
+ return;
+
+
+ } else if (version == 2) {
+
+ Api2OpenAsnEncoderV2 uicEncoder = new Api2OpenAsnEncoderV2();
+
+ org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData asnUicRailTicketData = uicEncoder.populateToAsn1Model(uicRailTicket);
+
+ outputStream.write(asnUicRailTicketData.encode());
+
+ return;
+
+ }
+
+ throw new EncodingFormatException(String.format("Encoding version %d not supported", version));
+
+ }
+
+ /**
+ * Decode a rail ticket from asn.1 unaligned PER encoded data.
+ *
+ * @param byteData the asn.1 PER encoded byte data
+ * @return the decoded uic rail ticket
+ * @throws IOException signals that an I/O exception has occurred.
+ * @throws EncodingFormatException
+ */
+ public IUicRailTicket decodeFromAsn (byte[] byteData, int version) throws IOException, EncodingFormatException{
+
+ if (version == 1 || version == 13) {
+
+ OpenAsn2ApiDecoder uicDecoder = new OpenAsn2ApiDecoder();
+
+ IUicRailTicket uicRailTicket = uicDecoder.decodeFromAsn(byteData);
+
+ return uicRailTicket;
+
+ } else if (version == 2) {
+
+ OpenAsn2ApiDecoderV2 uicDecoder = new OpenAsn2ApiDecoderV2();
+
+ IUicRailTicket uicRailTicket = uicDecoder.decodeFromAsn(byteData);
+
+ return uicRailTicket;
+
+ }
+
+ throw new EncodingFormatException(String.format("Encoding version %d not supported", version));
+
+ }
+
+
+ /**
+ * Decode a rail ticket from asn.1 unaligned PER encoded data.
+ * @param version of the asn1 specification
+ * @param input stream of the asn.1 PER encoded data
+ * @return the decoded uic rail ticket
+ * @throws IOException signals that an I/O exception has occurred.
+ * @throws EncodingFormatException
+ */
+ public IUicRailTicket decodeFromAsn (InputStream input, int version) throws IOException, EncodingFormatException{
+
+ if (version != 1 && version != 2 && version != 13) {
+ throw new EncodingFormatException(String.format("Encoding version %d not supported", version));
+ }
+
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+
+ int nRead;
+ byte[] data = new byte[16384];
+
+ while ((nRead = input.read(data, 0, data.length)) != -1) {
+ buffer.write(data, 0, nRead);
+ }
+
+ buffer.flush();
+
+ byte[] byteData = buffer.toByteArray();
+
+ return decodeFromAsn (byteData, version);
+
+
+ }
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/UnsuportedFeatureException.java b/src/org/uic/barcode/ticket/UnsuportedFeatureException.java new file mode 100644 index 0000000..c1f7686 --- /dev/null +++ b/src/org/uic/barcode/ticket/UnsuportedFeatureException.java @@ -0,0 +1,30 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket;
+
+/**
+ * The Class EncodingFormatException.
+ */
+public class UnsuportedFeatureException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3156877999150353704L;
+
+ /**
+ *
+ */
+
+
+ /**
+ * Instantiates a new encoding format exception. The exception indicates a violation of the asn.1 ticket format specification
+ *
+ * @param message the message
+ */
+ public UnsuportedFeatureException(String message) {
+ super(message);
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/BerthDetailData.java b/src/org/uic/barcode/ticket/api/asn/omv1/BerthDetailData.java new file mode 100644 index 0000000..94feb61 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/BerthDetailData.java @@ -0,0 +1,78 @@ +/*
+ * 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.asn.omv1;
+
+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;
+
+
+@Sequence
+@HasExtensionMarker
+public class BerthDetailData extends Object {
+ public BerthDetailData() {}
+
+ @FieldOrder(order = 0)
+ public BerthTypeType berthType;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue=1, maxValue=999)
+ public Long numberOfBerths;
+
+ @FieldOrder(order = 2)
+ @Asn1Default(value="family")
+ @Asn1Optional public CompartmentGenderType gender;
+
+
+ public BerthTypeType getBerthType() {
+ return this.berthType;
+ }
+
+ public Long getNumberOfBerths() {
+ return this.numberOfBerths;
+ }
+
+ public CompartmentGenderType getGender() {
+
+ if (gender == null){
+ return CompartmentGenderType.family;
+ } else {
+ return this.gender;
+ }
+ }
+
+ public void setBerthType(BerthTypeType berthType) {
+
+ this.berthType = berthType;
+ }
+
+ public void setNumberOfBerths(Long numberOfBerths) {
+ this.numberOfBerths = numberOfBerths;
+ }
+
+ public void setGender(CompartmentGenderType gender) {
+ this.gender = gender;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/BerthTypeType.java b/src/org/uic/barcode/ticket/api/asn/omv1/BerthTypeType.java new file mode 100644 index 0000000..14470a6 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/BerthTypeType.java @@ -0,0 +1,41 @@ +/*
+ * 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.asn.omv1;
+
+public enum BerthTypeType {
+ single("single"),
+ special("special"),
+ double_("double_"),
+ t2("t2"),
+ t3("t3"),
+ t4("t4");
+
+
+ public String text;
+
+ BerthTypeType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/CarCarriageReservationData.java b/src/org/uic/barcode/ticket/api/asn/omv1/CarCarriageReservationData.java new file mode 100644 index 0000000..97ac3d5 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/CarCarriageReservationData.java @@ -0,0 +1,734 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCarrierNum;
+
+
+
+@Sequence
+@HasExtensionMarker
+public class CarCarriageReservationData extends Object {
+ public CarCarriageReservationData() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public Asn1BigInteger trainNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String trainIA5;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=-1,maxValue=370)
+ @Asn1Default(value="0")
+ @Asn1Optional public Long beginLoadingDate;
+
+ @FieldOrder(order = 3)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long beginLoadingTime;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long endLoadingTime;
+
+ @FieldOrder(order = 5)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long loadingUTCOffset;
+
+ @FieldOrder(order = 6)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 7)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 8)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 9)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 10)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 11)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 12)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long serviceBrand;
+
+ @FieldOrder(order = 13)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String serviceBrandAbrUTF8;
+
+ @FieldOrder(order = 14)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String serviceBrandNameUTF8;
+
+ @FieldOrder(order = 15)
+ @Asn1Default("stationUICReservation")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 16)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long fromStationNum;
+
+ @FieldOrder(order = 17)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String fromStationIA5;
+
+ @FieldOrder(order = 18)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long toStationNum;
+
+ @FieldOrder(order = 19)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String toStationIA5;
+
+ @FieldOrder(order = 20)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String fromStationNameUTF8;
+
+ @FieldOrder(order = 21)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String toStationNameUTF8;
+
+ @FieldOrder(order = 22)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String coach;
+
+ @FieldOrder(order = 23)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String place;
+
+ @FieldOrder(order = 24)
+ @Asn1Optional public CompartmentDetailsType compartmentDetails;
+
+ @FieldOrder(order = 25)
+ @RestrictedString(CharacterRestriction.IA5String)
+ public String numberPlate;
+
+ @FieldOrder(order = 26)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String trailerPlate;
+
+ @FieldOrder(order = 27)
+ @IntRange(minValue=0,maxValue=9)
+ public Long carCategory;
+
+ @FieldOrder(order = 28)
+ @IntRange(minValue=0,maxValue=6)
+ @Asn1Optional public Long boatCategory;
+
+ @FieldOrder(order = 29)
+ public Boolean textileRoof = false;
+
+ @FieldOrder(order = 30)
+ @Asn1Default(value ="norack")
+ @Asn1Optional public RoofRackType roofRackType;
+
+ @FieldOrder(order = 31)
+ @IntRange(minValue=0,maxValue=99)
+ @Asn1Optional public Long roofRackHeight;
+
+ @FieldOrder(order = 32)
+ @IntRange(minValue=0,maxValue=2)
+ @Asn1Optional public Long attachedBoats;
+
+ @FieldOrder(order = 33)
+ @IntRange(minValue=0,maxValue=4)
+ @Asn1Optional public Long attachedBicycles;
+
+ @FieldOrder(order = 34)
+ @IntRange(minValue=0,maxValue=5)
+ @Asn1Optional public Long attachedSurfboards;
+
+ @FieldOrder(order = 35)
+ @IntRange(minValue=0,maxValue=999)
+ @Asn1Optional public Long loadingListEntry;
+
+ @FieldOrder(order = 36)
+ @Asn1Default(value="upper")
+ @Asn1Optional public LoadingDeckType loadingDeck;
+
+ @FieldOrder(order = 37)
+ @Asn1Optional public SequenceOfCarrierNum carrierNum;
+
+ @FieldOrder(order = 38)
+ @Asn1Optional public SequenceOfStringIA5 carrierIA5;
+
+ @FieldOrder(order = 39)
+ public TariffType tariff;
+
+ @FieldOrder(order = 40)
+ @Asn1Default(value="travelPrice")
+ @Asn1Optional public PriceTypeType priceType;
+
+ @FieldOrder(order = 41)
+ @Asn1Optional Asn1BigInteger price;
+
+ @FieldOrder(order = 42)
+ @Asn1Optional SequenceOfVatDetail vatDetails;
+
+ @FieldOrder(order = 43)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String infoText;
+
+ @FieldOrder(order = 44)
+ @Asn1Optional public ExtensionData extension;
+
+ public Long getTrainNum() {
+ if (this.trainNum == null) return null;
+ return Asn1BigInteger.toLong(this.trainNum);
+ }
+
+ public String getTrainIA5() {
+
+ return this.trainIA5;
+ }
+
+ public Long getBeginLoadingDate() {
+
+ return this.beginLoadingDate;
+ }
+
+ public Long getBeginLoadingTime() {
+
+ if (beginLoadingTime == null) return new Long(0);
+ return beginLoadingTime;
+ }
+
+ public Long getEndLoadingTime() {
+
+ return this.endLoadingTime;
+ }
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Long getReferenceNum() {
+ return Asn1BigInteger.toLong(this.referenceNum);
+ }
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+
+ return this.productIdIA5;
+ }
+
+ public Long getServiceBrand() {
+
+ return this.serviceBrand;
+ }
+
+ public String getServiceBrandAbrUTF8() {
+
+ return this.serviceBrandAbrUTF8;
+ }
+
+ public String getServiceBrandNameUTF8() {
+
+ return this.serviceBrandNameUTF8;
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUICReservation;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public Long getFromStationNum() {
+
+ return this.fromStationNum;
+ }
+
+ public String getFromStationIA5() {
+
+ return this.fromStationIA5;
+ }
+
+ public Long getToStationNum() {
+
+ return this.toStationNum;
+ }
+
+ public String getToStationIA5() {
+
+ return this.toStationIA5;
+ }
+
+ public String getFromStationNameUTF8() {
+
+ return this.fromStationNameUTF8;
+ }
+
+ public String getToStationNameUTF8() {
+
+ return this.toStationNameUTF8;
+ }
+
+ public String getCoach() {
+
+ return this.coach;
+ }
+
+ public String getPlace() {
+
+ return this.place;
+ }
+
+ public CompartmentDetailsType getCompartmentDetails() {
+
+ return this.compartmentDetails;
+ }
+
+ public String getNumberPlate() {
+
+ return this.numberPlate;
+ }
+
+ public String getTrailerPlate() {
+
+ return this.trailerPlate;
+ }
+
+ public Long getCarCategory() {
+
+ return this.carCategory;
+ }
+
+ public Long getBoatCategory() {
+
+ return this.boatCategory;
+ }
+
+ public Boolean getTextileRoof() {
+
+ return this.textileRoof;
+ }
+
+ public RoofRackType getRoofRackType() {
+
+ if (this.roofRackType == null) return RoofRackType.norack;
+ return this.roofRackType;
+ }
+
+ public Long getRoofRackHeight() {
+
+ return this.roofRackHeight;
+ }
+
+ public Long getAttachedBoats() {
+
+ return this.attachedBoats;
+ }
+
+ public Long getAttachedBicycles() {
+
+ return this.attachedBicycles;
+ }
+
+ public Long getAttachedSurfboards() {
+
+ return this.attachedSurfboards;
+ }
+
+ public Long getLoadingListEntry() {
+
+ return this.loadingListEntry;
+ }
+
+ public LoadingDeckType getLoadingDeck() {
+
+ if (this.loadingDeck == null) return LoadingDeckType.upper;
+ return this.loadingDeck;
+ }
+
+ public SequenceOfCarrierNum getCarrierNum() {
+
+ return this.carrierNum;
+ }
+
+ public SequenceOfStringIA5 getCarrierIA5() {
+
+ return this.carrierIA5;
+ }
+
+ public TariffType getTariff() {
+
+ return this.tariff;
+ }
+
+ public PriceTypeType getPriceType() {
+ if (this.priceType == null) return PriceTypeType.travelPrice;
+ return this.priceType;
+ }
+
+ public String getInfoText() {
+
+ return this.infoText;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setTrainNum(Long trainNum) {
+
+ this.trainNum = new Asn1BigInteger(trainNum);
+ }
+
+ public void setTrainIA5(String trainIA5) {
+
+ this.trainIA5 = trainIA5;
+ }
+
+ public void setBeginLoadingDate(Long beginLoadingDate) {
+
+ this.beginLoadingDate = beginLoadingDate;
+ }
+
+ public void setBeginLoadingTime(Long beginLoadingTime) {
+
+ this.beginLoadingTime = beginLoadingTime;
+ }
+
+ public void setEndLoadingTime(Long endLoadingTime) {
+ this.endLoadingTime = endLoadingTime;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setReferenceNum(Long referenceNum) {
+
+ this.referenceNum = Asn1BigInteger.toAsn1(referenceNum);
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setServiceBrand(Long serviceBrand) {
+
+ this.serviceBrand = serviceBrand;
+ }
+
+ public void setServiceBrandAbrUTF8(String serviceBrandAbrUTF8) {
+
+ this.serviceBrandAbrUTF8 = serviceBrandAbrUTF8;
+ }
+
+ public void setServiceBrandNameUTF8(String serviceBrandNameUTF8) {
+
+ this.serviceBrandNameUTF8 = serviceBrandNameUTF8;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setFromStationNum(Long fromStationNum) {
+
+ this.fromStationNum = fromStationNum;
+ }
+
+ public void setFromStationIA5(String fromStationIA5) {
+
+ this.fromStationIA5 = fromStationIA5;
+ }
+
+ public void setToStationNum(Long toStationNum) {
+
+ this.toStationNum = toStationNum;
+ }
+
+ public void setToStationIA5(String toStationIA5) {
+
+ this.toStationIA5 = toStationIA5;
+ }
+
+ public void setFromStationNameUTF8(String fromStationNameUTF8) {
+
+ this.fromStationNameUTF8 = fromStationNameUTF8;
+ }
+
+ public void setToStationNameUTF8(String toStationNameUTF8) {
+
+ this.toStationNameUTF8 = toStationNameUTF8;
+ }
+
+ public void setCoach(String coach) {
+
+ this.coach = coach;
+ }
+
+ public void setPlace(String place) {
+
+ this.place = place;
+ }
+
+ public void setCompartmentDetails(CompartmentDetailsType compartmentDetails) {
+
+ this.compartmentDetails = compartmentDetails;
+ }
+
+ public void setNumberPlate(String numberPlate) {
+
+ this.numberPlate = numberPlate;
+ }
+
+ public void setTrailerPlate(String trailerPlate) {
+
+ this.trailerPlate = trailerPlate;
+ }
+
+ public void setCarCategory(Long carCategory) {
+
+ this.carCategory = carCategory;
+ }
+
+ public void setBoatCategory(Long boatCategory) {
+
+ this.boatCategory = boatCategory;
+ }
+
+ public void setTextileRoof(Boolean textileRoof) {
+
+ this.textileRoof = textileRoof;
+ }
+
+ public void setRoofRackType(RoofRackType roofRackType) {
+
+ this.roofRackType = roofRackType;
+ }
+
+ public void setRoofRackHeight(Long roofRackHeight) {
+
+ this.roofRackHeight = roofRackHeight;
+ }
+
+ public void setAttachedBoats(Long attachedBoats) {
+
+ this.attachedBoats = attachedBoats;
+ }
+
+ public void setAttachedBicycles(Long attachedBicycles) {
+
+ this.attachedBicycles = attachedBicycles;
+ }
+
+ public void setAttachedSurfboards(Long attachedSurfboards) {
+
+ this.attachedSurfboards = attachedSurfboards;
+ }
+
+ public void setLoadingListEntry(Long loadingListEntry) {
+
+ this.loadingListEntry = loadingListEntry;
+ }
+
+ public void setLoadingDeck(LoadingDeckType loadingDeck) {
+
+ this.loadingDeck = loadingDeck;
+ }
+
+ public void setCarrierNum(SequenceOfCarrierNum carrierNum) {
+
+ this.carrierNum = carrierNum;
+ }
+
+ public void setCarrierNum(List<Long> longs) {
+ if (longs == null || longs.isEmpty()) return;
+ this.carrierNum = new SequenceOfCarrierNum(longs);
+ }
+
+
+ public void setCarrierIA5(SequenceOfStringIA5 carrierIA5) {
+
+ this.carrierIA5 = carrierIA5;
+ }
+
+ public void setTariff(TariffType tariff) {
+
+ this.tariff = tariff;
+ }
+
+ public void setPriceType(PriceTypeType priceType) {
+
+ this.priceType = priceType;
+ }
+
+ public void setInfoText(String infoText) {
+
+ this.infoText = infoText;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public Long getPrice() {
+ return Asn1BigInteger.toLong(price);
+ }
+
+ public void setPrice(Long price) {
+ this.price = Asn1BigInteger.toAsn1(price);
+ }
+
+ public SequenceOfVatDetail getVatDetails() {
+ return vatDetails;
+ }
+
+ public void setVatDetails(SequenceOfVatDetail vatDetails) {
+ this.vatDetails = vatDetails;
+ }
+
+ public void addVatDetail(VatDetailType vatDetail) {
+ if (this.vatDetails == null) {
+ this.vatDetails = new SequenceOfVatDetail();
+ }
+ this.vatDetails.add(vatDetail);
+ }
+
+ public void setLoadingDates (Date beginLoading, Date endLoading, Date issuingDate){
+
+ if (issuingDate == null || beginLoading == null) return;
+
+ this.beginLoadingDate = DateTimeUtils.getDateDifference(issuingDate,beginLoading);
+ this.beginLoadingTime = DateTimeUtils.getTime(beginLoading);
+
+ if (endLoading != null) {
+ this.endLoadingTime = DateTimeUtils.getTime(endLoading);
+ }
+ }
+
+ public Date getBeginLoadingDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.beginLoadingDate == null) {
+ this.beginLoadingDate = 0L;
+ }
+
+ return DateTimeUtils.getDate(issuingDate, this.beginLoadingDate, this.beginLoadingTime);
+
+ }
+
+ public Date getEndLoadingDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.beginLoadingDate == null) {
+ this.beginLoadingDate = 0L;
+ }
+
+ if (this.endLoadingTime == null) {
+ return null;
+ }
+
+ Date begin = DateTimeUtils.getDate(issuingDate, this.beginLoadingDate, this.beginLoadingTime);
+ Date end = DateTimeUtils.getDate(issuingDate, this.beginLoadingDate, this.endLoadingTime);
+
+ //max one day difference assumed
+ if (end.before(begin)) {
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTime(end);
+ cal.add(Calendar.DAY_OF_YEAR,1);
+ return cal.getTime();
+ } else {
+ return end;
+ }
+
+ }
+
+ public Long getLoadingUTCOffset() {
+ return loadingUTCOffset;
+ }
+
+ public void setLoadingUTCOffset(Long loadingUTCOffset) {
+ this.loadingUTCOffset = loadingUTCOffset;
+ }
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/CardReferenceType.java b/src/org/uic/barcode/ticket/api/asn/omv1/CardReferenceType.java new file mode 100644 index 0000000..a5a327c --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/CardReferenceType.java @@ -0,0 +1,183 @@ +/*
+ * 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.asn.omv1;
+
+import java.math.BigInteger;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+
+@Sequence
+@HasExtensionMarker
+public class CardReferenceType extends Object {
+ public CardReferenceType() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public Asn1BigInteger cardIssuerNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String cardIssuerIA5;
+
+ @FieldOrder(order = 2)
+ @Asn1Optional public Asn1BigInteger cardIdNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String cardIdIA5;
+
+ @FieldOrder(order = 4)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String cardName;
+
+ @FieldOrder(order = 5)
+ @Asn1Optional public Asn1BigInteger cardType;
+
+ @FieldOrder(order = 6)
+ @Asn1Optional public Asn1BigInteger leadingCardIdNum;
+
+ @FieldOrder(order = 7)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String leadingCardIdIA5;
+
+ @FieldOrder(order = 8)
+ @Asn1Optional public Asn1BigInteger trailingCardIdNum;
+
+ @FieldOrder(order = 9)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String trailingCardIdIA5;
+
+
+ public Asn1BigInteger getCardIssuerNum() {
+
+ return this.cardIssuerNum;
+ }
+
+ public String getCardIssuerIA5() {
+
+ return this.cardIssuerIA5;
+ }
+
+ public Asn1BigInteger getCardIdNum() {
+
+ return this.cardIdNum;
+ }
+
+ public String getCardIdIA5() {
+
+ return this.cardIdIA5;
+ }
+
+ public String getCardName() {
+
+ return this.cardName;
+ }
+
+ public Asn1BigInteger getCardType() {
+ return this.cardType;
+ }
+
+ public BigInteger getLeadingCardIdNum() {
+ if (leadingCardIdNum != null) {
+ return leadingCardIdNum.toBigInteger();
+ }
+ return null;
+ }
+
+ public String getLeadingCardIdIA5() {
+
+ return this.leadingCardIdIA5;
+ }
+
+ public Long getTrailingCardIdNum() {
+
+ return Asn1BigInteger.toLong(this.trailingCardIdNum);
+ }
+
+ public String getTrailingCardIdIA5() {
+
+ return this.trailingCardIdIA5;
+ }
+
+ public void setCardIssuerNum(Long cardIssuerNum) {
+
+ this.cardIssuerNum = Asn1BigInteger.toAsn1(cardIssuerNum);
+ }
+
+ public void setCardIssuerIA5(String cardIssuerIA5) {
+
+ this.cardIssuerIA5 = cardIssuerIA5;
+ }
+
+ public void setCardIdNum(Asn1BigInteger asn1BigInteger) {
+
+ this.cardIdNum = asn1BigInteger;
+ }
+
+ public void setCardIdNum(Long cardIdNum) {
+
+ this.cardIdNum = new Asn1BigInteger(cardIdNum);
+ }
+
+ public void setCardIdIA5(String cardIdIA5) {
+
+ this.cardIdIA5 = cardIdIA5;
+ }
+
+ public void setCardName(String cardName) {
+
+ this.cardName = cardName;
+ }
+
+ public void setCardType(Long cardType) {
+
+ this.cardType = Asn1BigInteger.toAsn1(cardType);
+ }
+
+ public void setLeadingCardIdNum(Long leadingCardIdNum) {
+
+ this.leadingCardIdNum = Asn1BigInteger.toAsn1(leadingCardIdNum);
+ }
+
+ public void setLeadingCardIdIA5(String leadingCardIdIA5) {
+
+ this.leadingCardIdIA5 = leadingCardIdIA5;
+ }
+
+ public void setTrailingCardIdNum(Long trailingCardIdNum) {
+
+ this.trailingCardIdNum = Asn1BigInteger.toAsn1(trailingCardIdNum);
+ }
+
+ public void setTrailingCardIdIA5(String trailingCardIdIA5) {
+
+ this.trailingCardIdIA5 = trailingCardIdIA5;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/CodeTableType.java b/src/org/uic/barcode/ticket/api/asn/omv1/CodeTableType.java new file mode 100644 index 0000000..61f7a75 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/CodeTableType.java @@ -0,0 +1,40 @@ +/*
+ * 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.asn.omv1;
+
+
+public enum CodeTableType {
+ stationUIC("stationUIC"),
+ stationUICReservation("stationUICReservation"),
+ stationERA("stationERA"),
+ localCarrierStationCodeTable("localCarrierStationCodeTable"),
+ proprietaryIssuerStationCodeTable("proprietaryIssuerStationCodeTable");
+
+ public String text;
+
+ CodeTableType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/CompartmentDetailsType.java b/src/org/uic/barcode/ticket/api/asn/omv1/CompartmentDetailsType.java new file mode 100644 index 0000000..cdec42b --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/CompartmentDetailsType.java @@ -0,0 +1,136 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+
+@Sequence
+@HasExtensionMarker
+public class CompartmentDetailsType extends Object {
+ public CompartmentDetailsType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=1,maxValue=99)
+ @Asn1Optional public Long coachType;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue=1,maxValue=99)
+ @Asn1Optional public Long compartmentType;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=99)
+ @Asn1Optional public Long specialAllocation;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String coachTypeDescr;
+
+ @FieldOrder(order = 4)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String compartmentTypeDescr;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String specialAllocationDescr;
+
+ @FieldOrder(order = 6)
+ @Asn1Default(value="unspecified")
+ public CompartmentPositionType position;
+
+ public Long getCoachType() {
+
+ return this.coachType;
+ }
+
+ public Long getCompartmentType() {
+
+ return this.compartmentType;
+ }
+
+ public Long getSpecialAllocation() {
+
+ return this.specialAllocation;
+ }
+
+ public String getCoachTypeDescr() {
+
+ return this.coachTypeDescr;
+ }
+
+ public String getCompartmentTypeDescr() {
+
+ return this.compartmentTypeDescr;
+ }
+
+ public String getSpecialAllocationDescr() {
+
+ return this.specialAllocationDescr;
+ }
+
+ public CompartmentPositionType getPosition() {
+ if (position == null) return CompartmentPositionType.unspecified;
+ return this.position;
+ }
+
+ public void setCoachType(Long coachType) {
+ this.coachType = coachType;
+ }
+
+ public void setCompartmentType(Long compartmentType) {
+
+ this.compartmentType = compartmentType;
+ }
+
+ public void setSpecialAllocation(Long specialAllocation) {
+
+ this.specialAllocation = specialAllocation;
+ }
+
+ public void setCoachTypeDescr(String coachTypeDescr) {
+
+ this.coachTypeDescr = coachTypeDescr;
+ }
+
+ public void setCompartmentTypeDescr(String compartmentTypeDescr) {
+
+ this.compartmentTypeDescr = compartmentTypeDescr;
+ }
+
+ public void setSpecialAllocationDescr(String specialAllocationDescr) {
+
+ this.specialAllocationDescr = specialAllocationDescr;
+ }
+
+ public void setPosition(CompartmentPositionType position) {
+
+ this.position = position;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/CompartmentGenderType.java b/src/org/uic/barcode/ticket/api/asn/omv1/CompartmentGenderType.java new file mode 100644 index 0000000..8499b6b --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/CompartmentGenderType.java @@ -0,0 +1,42 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum CompartmentGenderType {
+ unspecified("unspecified"),
+ family("family"),
+ female("female"),
+ male("male"),
+ mixed("mixed");
+
+ public String text;
+
+ CompartmentGenderType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/CompartmentPositionType.java b/src/org/uic/barcode/ticket/api/asn/omv1/CompartmentPositionType.java new file mode 100644 index 0000000..c071dbb --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/CompartmentPositionType.java @@ -0,0 +1,38 @@ +/*
+ * 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.asn.omv1;
+
+
+public enum CompartmentPositionType {
+ unspecified("unspecified"),
+ upperLevel("upperLevel"),
+ lowerLevel("lowerLevel");
+
+ public String text;
+
+ CompartmentPositionType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/ConfirmationTypeType.java b/src/org/uic/barcode/ticket/api/asn/omv1/ConfirmationTypeType.java new file mode 100644 index 0000000..f77f784 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/ConfirmationTypeType.java @@ -0,0 +1,42 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum ConfirmationTypeType {
+ trainDelayConfirmation ("trainDelayConfirmation"),
+ travelerDelayConfirmation ("travelerDelayConfirmation"),
+ trainLinkedTicketDelay ("trainLinkedTicketDelay");
+
+
+
+ public String text;
+
+ ConfirmationTypeType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/ControlData.java b/src/org/uic/barcode/ticket/api/asn/omv1/ControlData.java new file mode 100644 index 0000000..d7dab8c --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/ControlData.java @@ -0,0 +1,200 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+
+
+@Sequence
+@HasExtensionMarker
+public class ControlData extends Object {
+ public ControlData() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public SequenceOfCardReferenceType identificationByCardReference;
+
+ @FieldOrder(order = 1)
+ public Boolean identificationByIdCard = false;
+
+ @FieldOrder(order = 2)
+ public Boolean identificationByPassportId = false;
+
+ @FieldOrder(order = 3)
+ @Asn1Optional public Asn1BigInteger identificationItem;
+
+ @FieldOrder(order = 4)
+ public Boolean passportValidationRequired = false;
+
+ @FieldOrder(order = 5)
+ public Boolean onlineValidationRequired = false;
+
+ @FieldOrder(order = 6)
+ @IntRange(minValue=0,maxValue=99)
+ @Asn1Optional public Long randomDetailedValidationRequired;
+
+ @FieldOrder(order = 7)
+ public Boolean ageCheckRequired = false;
+
+ @FieldOrder(order = 8)
+ public Boolean reductionCardCheckRequired = false;
+
+ @FieldOrder(order = 9)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String infoText;
+
+ @FieldOrder(order = 10)
+ @Asn1Optional public SequenceOfTicketLinkType includedTickets;
+
+ @FieldOrder(order = 11)
+ @Asn1Optional public ExtensionData extension;
+
+
+
+
+ public SequenceOfCardReferenceType getIdentificationByCardReference() {
+
+ return this.identificationByCardReference;
+ }
+
+ public Boolean getIdentificationByIdCard() {
+
+ return this.identificationByIdCard;
+ }
+
+ public Boolean getIdentificationByPassportId() {
+
+ return this.identificationByPassportId;
+ }
+
+ public Long getIdentificationItem() {
+
+ return Asn1BigInteger.toLong(this.identificationItem);
+ }
+
+ public Boolean getPassportValidationRequired() {
+
+ return this.passportValidationRequired;
+ }
+
+ public Boolean getOnlineValidationRequired() {
+
+ return this.onlineValidationRequired;
+ }
+
+ public Long getRandomDetailedValidationRequired() {
+
+ return this.randomDetailedValidationRequired;
+ }
+
+ public Boolean getAgeCheckRequired() {
+
+ return this.ageCheckRequired;
+ }
+
+ public Boolean getReductionCardCheckRequired() {
+
+ return this.reductionCardCheckRequired;
+ }
+
+ public String getInfoText() {
+
+ return this.infoText;
+ }
+
+ public SequenceOfTicketLinkType getIncludedTickets() {
+
+ return this.includedTickets;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setIdentificationByCardReference(SequenceOfCardReferenceType identificationByCardReference) {
+
+ this.identificationByCardReference = identificationByCardReference;
+ }
+
+ public void setIdentificationByIdCard(Boolean identificationByIdCard) {
+
+ this.identificationByIdCard = identificationByIdCard;
+ }
+
+ public void setIdentificationByPassportId(Boolean identificationByPassportId) {
+
+ this.identificationByPassportId = identificationByPassportId;
+ }
+
+ public void setIdentificationItem(Long identificationItem) {
+
+ this.identificationItem = Asn1BigInteger.toAsn1(identificationItem);
+ }
+
+ public void setPassportValidationRequired(Boolean passportValidationRequired) {
+
+ this.passportValidationRequired = passportValidationRequired;
+ }
+
+ public void setOnlineValidationRequired(Boolean onlineValidationRequired) {
+
+ this.onlineValidationRequired = onlineValidationRequired;
+ }
+
+ public void setRandomDetailedValidationRequired(Long randomDetailedValidationRequired) {
+ this.randomDetailedValidationRequired = randomDetailedValidationRequired;
+ }
+
+ public void setAgeCheckRequired(Boolean ageCheckRequired) {
+ this.ageCheckRequired = ageCheckRequired;
+ }
+
+ public void setReductionCardCheckRequired(Boolean reductionCardCheckRequired) {
+
+ this.reductionCardCheckRequired = reductionCardCheckRequired;
+ }
+
+ public void setInfoText(String infoText) {
+
+ this.infoText = infoText;
+ }
+
+ public void setIncludedTickets(SequenceOfTicketLinkType includedTickets) {
+
+ this.includedTickets = includedTickets;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/CountermarkData.java b/src/org/uic/barcode/ticket/api/asn/omv1/CountermarkData.java new file mode 100644 index 0000000..c223900 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/CountermarkData.java @@ -0,0 +1,573 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.Date;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+
+@Sequence
+@HasExtensionMarker
+public class CountermarkData extends Object {
+ public CountermarkData() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 6)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String ticketReferenceIA5;
+
+ @FieldOrder(order = 7)
+ @Asn1Optional public Asn1BigInteger ticketReferenceNum;
+
+ @FieldOrder(order = 8)
+ @IntRange(minValue=1,maxValue=200)
+ @Asn1Optional public Long numberOfCountermark;
+
+ @FieldOrder(order = 9)
+ @IntRange(minValue=1,maxValue=200)
+ @Asn1Optional public Long totalOfCountermarks;
+
+ @FieldOrder(order = 10)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String groupName;
+
+ @FieldOrder(order = 11)
+ @Asn1Default("stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 12)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long fromStationNum;
+
+ @FieldOrder(order = 13)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String fromStationIA5;
+
+ @FieldOrder(order = 14)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long toStationNum;
+
+ @FieldOrder(order = 15)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String toStationIA5;
+
+ @FieldOrder(order = 16)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String fromStationNameUTF8;
+
+ @FieldOrder(order = 17)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String toStationNameUTF8;
+
+ @FieldOrder(order = 18)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String validRegionDesc;
+
+ @FieldOrder(order = 19)
+ @Asn1Optional public SequenceOfRegionalValidityType validRegion;
+
+ @FieldOrder(order = 20)
+ public Boolean returnIncluded = false;
+
+ @FieldOrder(order = 21)
+ @Asn1Optional public ReturnRouteDescriptionType returnDescription;
+
+ @FieldOrder(order = 22)
+ @IntRange(minValue=-1,maxValue=700)
+ @Asn1Optional public Long validFromDay;
+
+ @FieldOrder(order = 22)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long validFromTime;
+
+ @FieldOrder(order = 23)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validFromUTCOffset;
+
+ @FieldOrder(order = 24)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long validUntilDay;
+
+ @FieldOrder(order = 25)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long validUntilTime;
+
+ @FieldOrder(order = 26)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validUntilUTCOffset;
+
+ @FieldOrder(order = 27)
+ @Asn1Default(value="second")
+ @Asn1Optional public TravelClassType classCode;
+
+ @FieldOrder(order = 28)
+ @Asn1Optional public SequenceOfCarrierNum carrierNum;
+
+ @FieldOrder(order = 29)
+ @Asn1Optional public SequenceOfStringIA5 carrierIA5;
+
+ @FieldOrder(order = 30)
+ @Asn1Optional public SequenceOfServiceBrands includedServiceBrands;
+
+ @FieldOrder(order = 31)
+ @Asn1Optional public SequenceOfServiceBrands excludedServiceBrands;
+
+ @FieldOrder(order = 32)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String infoText;
+
+ @FieldOrder(order = 33)
+ @Asn1Optional public ExtensionData extension;
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Long getReferenceNum() {
+
+ return Asn1BigInteger.toLong(this.referenceNum);
+ }
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+
+ return this.productIdIA5;
+ }
+
+ public String getTicketReferenceIA5() {
+
+ return this.ticketReferenceIA5;
+ }
+
+ public Long getTicketReferenceNum() {
+
+ return Asn1BigInteger.toLong(this.ticketReferenceNum);
+ }
+
+ public Long getNumberOfCountermark() {
+
+ return this.numberOfCountermark;
+ }
+
+ public Long getTotalOfCountermarks() {
+
+ return this.totalOfCountermarks;
+ }
+
+ public String getGroupName() {
+
+ return this.groupName;
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUIC;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public Long getFromStationNum() {
+
+ return this.fromStationNum;
+ }
+
+ public String getFromStationIA5() {
+
+ return this.fromStationIA5;
+ }
+
+ public Long getToStationNum() {
+
+ return this.toStationNum;
+ }
+
+ public String getToStationIA5() {
+
+ return this.toStationIA5;
+ }
+
+ public String getFromStationNameUTF8() {
+
+ return this.fromStationNameUTF8;
+ }
+
+ public String getToStationNameUTF8() {
+
+ return this.toStationNameUTF8;
+ }
+
+ public String getValidRegionDesc() {
+
+ return this.validRegionDesc;
+ }
+
+ public SequenceOfRegionalValidityType getValidRegion() {
+
+ return this.validRegion;
+ }
+
+ public Boolean getReturnIncluded() {
+
+ return this.returnIncluded;
+ }
+
+ public ReturnRouteDescriptionType getReturnDescription() {
+
+ return this.returnDescription;
+ }
+
+ public Long getValidFromDay() {
+
+ return this.validFromDay;
+ }
+
+ public Long getValidFromTime() {
+
+ return this.validFromTime;
+ }
+
+ public Long getValidUntilDay() {
+
+ return this.validUntilDay;
+ }
+
+ public Long getValidUntilTime() {
+
+ return this.validUntilTime;
+ }
+
+ public TravelClassType getClassCode() {
+
+ if (classCode == null){
+ return TravelClassType.second;
+ }
+
+ return this.classCode;
+ }
+
+ public SequenceOfCarrierNum getCarriersNum() {
+
+ return this.carrierNum;
+ }
+
+ public SequenceOfStringIA5 getCarriersIA5() {
+
+ return this.carrierIA5;
+ }
+
+ public SequenceOfServiceBrands getIncludedServiceBrands() {
+
+ return this.includedServiceBrands;
+ }
+
+ public SequenceOfServiceBrands getExcludedServiceBrands() {
+
+ return this.excludedServiceBrands;
+ }
+
+ public String getInfoText() {
+
+ return this.infoText;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setReferenceNum(Long referenceNum) {
+
+ this.referenceNum = Asn1BigInteger.toAsn1(referenceNum);
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setTicketReferenceIA5(String ticketReferenceIA5) {
+
+ this.ticketReferenceIA5 = ticketReferenceIA5;
+ }
+
+ public void setTicketReferenceNum(Long ticketReferenceNum) {
+
+ this.ticketReferenceNum = Asn1BigInteger.toAsn1(ticketReferenceNum);
+ }
+
+ public void setNumberOfCountermark(Long numberOfCountermark) {
+
+ this.numberOfCountermark = numberOfCountermark;
+ }
+
+ public void setTotalOfCountermarks(Long totalOfCountermarks) {
+
+ this.totalOfCountermarks = totalOfCountermarks;
+ }
+
+ public void setGroupName(String groupName) {
+
+ this.groupName = groupName;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setFromStationNum(Long fromStationNum) {
+
+ this.fromStationNum = fromStationNum;
+ }
+
+ public void setFromStationIA5(String fromStationIA5) {
+
+ this.fromStationIA5 = fromStationIA5;
+ }
+
+ public void setToStationNum(Long toStationNum) {
+
+ this.toStationNum = toStationNum;
+ }
+
+ public void setToStationIA5(String toStationIA5) {
+
+ this.toStationIA5 = toStationIA5;
+ }
+
+ public void setFromStationNameUTF8(String fromStationNameUTF8) {
+
+ this.fromStationNameUTF8 = fromStationNameUTF8;
+ }
+
+ public void setToStationNameUTF8(String toStationNameUTF8) {
+
+ this.toStationNameUTF8 = toStationNameUTF8;
+ }
+
+ public void setValidRegionDesc(String validRegionDesc) {
+
+ this.validRegionDesc = validRegionDesc;
+ }
+
+ public void setValidRegion(SequenceOfRegionalValidityType validRegion) {
+
+ this.validRegion = validRegion;
+ }
+
+ public void setReturnIncluded(Boolean returnIncluded) {
+
+ this.returnIncluded = returnIncluded;
+ }
+
+ public void setReturnDescription(ReturnRouteDescriptionType returnDescription) {
+
+ this.returnDescription = returnDescription;
+ }
+
+ public void setValidFromDay(Long validFromDay) {
+
+ this.validFromDay = validFromDay;
+ }
+
+ public void setValidFromTime(Long validFromTime) {
+
+ this.validFromTime = validFromTime;
+ }
+
+ public void setValidUntilDay(Long validUntilDay) {
+
+ this.validUntilDay = validUntilDay;
+ }
+
+ public void setValidUntilTime(Long validUntilTime) {
+
+ this.validUntilTime = validUntilTime;
+ }
+
+ public void setClassCode(TravelClassType classCode) {
+
+ this.classCode = classCode;
+ }
+
+ public void setCarriersNum(SequenceOfCarrierNum carrierNum) {
+
+ this.carrierNum = carrierNum;
+ }
+
+ public void setCarriersNum(List<Long> longs) {
+ if (longs == null) return;
+
+ this.carrierNum = new SequenceOfCarrierNum();
+ this.carrierNum.addAll(longs);
+ }
+
+ public void setCarriersIA5(SequenceOfStringIA5 carrierIA5) {
+
+ this.carrierIA5 = carrierIA5;
+ }
+
+ public void setIncludedServiceBrands(SequenceOfServiceBrands includedServiceBrands) {
+
+ this.includedServiceBrands = includedServiceBrands;
+ }
+
+ public void setExcludedServiceBrands(SequenceOfServiceBrands excludedServiceBrands) {
+
+ this.excludedServiceBrands = excludedServiceBrands;
+ }
+
+ public void setInfoText(String infoText) {
+
+ this.infoText = infoText;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+
+ public void setValidityDates (Date fromDate, Date untilDate, Date issuingDate){
+
+ if (issuingDate == null || fromDate == null) return;
+
+ this.validFromDay = DateTimeUtils.getDateDifference(issuingDate,fromDate);
+ this.validFromTime = DateTimeUtils.getTime(fromDate);
+
+ if (untilDate != null){
+ this.validUntilDay = DateTimeUtils.getDateDifference(fromDate, untilDate);
+ this.validUntilTime = DateTimeUtils.getTime(untilDate);
+ }
+
+ }
+
+ public Date getValidFromDate(Date issuingDate){
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay, this.validFromTime);
+
+ }
+
+ public Date getValidUntilDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validUntilDay == null) {
+ return null;
+ }
+
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime);
+
+ }
+
+ public Long getValidFromUTCOffset() {
+ return validFromUTCOffset;
+ }
+
+ public void setValidFromUTCOffset(Long validFromUTCOffset) {
+ this.validFromUTCOffset = validFromUTCOffset;
+ }
+
+ public Long getValidUntilUTCOffset() {
+ return validUntilUTCOffset;
+ }
+
+ public void setValidUntilUTCOffset(Long validUntilUTCOffset) {
+ this.validUntilUTCOffset = validUntilUTCOffset;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/CustomerCardData.java b/src/org/uic/barcode/ticket/api/asn/omv1/CustomerCardData.java new file mode 100644 index 0000000..d0c5710 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/CustomerCardData.java @@ -0,0 +1,296 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfUnrestrictedLong;
+
+@Sequence
+@HasExtensionMarker
+public class CustomerCardData extends Object {
+ public CustomerCardData() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public TravelerType customer;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String cardIdIA5;
+
+ @FieldOrder(order = 2)
+ @Asn1Optional public Asn1BigInteger cardIdNum;
+
+ @FieldOrder(order = 3)
+ @IntRange(minValue=2016,maxValue=2269)
+ @Asn1Optional public Long validFromYear;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=0,maxValue=700)
+ @Asn1Optional public Long validFromDay;
+
+ @FieldOrder(order = 5)
+ @IntRange(minValue=0,maxValue=250)
+ @Asn1Optional public Long validUntilYear;
+
+ @FieldOrder(order = 6)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long validUntilDay;
+
+ @FieldOrder(order = 7)
+ @Asn1Optional public TravelClassType classCode;
+
+ @FieldOrder(order = 8)
+ @IntRange(minValue=0,maxValue=1000)
+ @Asn1Optional public Long cardType;
+
+ @FieldOrder(order = 9)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String cardTypeDescr;
+
+ @FieldOrder(order = 10)
+ @Asn1Optional public Asn1BigInteger customerStatus;
+
+ @FieldOrder(order = 11)
+ @Asn1Optional public String customerStatusDescr;
+
+ @FieldOrder(order = 12)
+ @Asn1Optional public SequenceOfUnrestrictedLong includedServices;
+
+ @FieldOrder(order = 13)
+ @Asn1Optional public ExtensionData extension;
+
+
+
+
+ public TravelerType getCustomer() {
+
+ return this.customer;
+ }
+
+ public String getCardIdIA5() {
+
+ return this.cardIdIA5;
+ }
+
+ public Asn1BigInteger getCardIdNum() {
+
+ return this.cardIdNum;
+ }
+
+ public Long getValidFromYear() {
+
+ return this.validFromYear;
+ }
+
+ public Long getValidFromDay() {
+
+ return this.validFromDay;
+ }
+
+ public Long getValidUntilYear() {
+
+ return this.validUntilYear;
+ }
+
+ public Long getValidUntilDay() {
+
+ return this.validUntilDay;
+ }
+
+ public TravelClassType getClassCode() {
+
+ return this.classCode;
+ }
+
+ public Long getCardType() {
+
+ return this.cardType;
+ }
+
+ public String getCardTypeDescr() {
+
+ return this.cardTypeDescr;
+ }
+
+ public Long getCustomerStatus() {
+
+ return Asn1BigInteger.toLong(this.customerStatus);
+ }
+
+ public String getCustomerStatusDescr() {
+
+ return this.customerStatusDescr;
+ }
+
+ public SequenceOfUnrestrictedLong getIncludedServices() {
+
+ return this.includedServices;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setCustomer(TravelerType customer) {
+
+ this.customer = customer;
+ }
+
+ public void setCardIdIA5(String cardIdIA5) {
+
+ this.cardIdIA5 = cardIdIA5;
+ }
+
+ public void setCardIdNum(Asn1BigInteger cardIdNum) {
+
+ this.cardIdNum = cardIdNum;
+ }
+
+ public void setCardIdNum(Long cardIdNum) {
+
+ this.cardIdNum = new Asn1BigInteger(cardIdNum);
+ }
+
+ public void setValidFromYear(Long validFromYear) {
+
+ this.validFromYear = validFromYear;
+ }
+
+ public void setValidFromDay(Long validFromDay) {
+
+ this.validFromDay = validFromDay;
+ }
+
+ public void setValidUntilYear(Long validUntilYear) {
+
+ this.validUntilYear = validUntilYear;
+ }
+
+ public void setValidUntilDay(Long validUntilDay) {
+
+ this.validUntilDay = validUntilDay;
+ }
+
+ public void setClassCode(TravelClassType classCode) {
+
+ this.classCode = classCode;
+ }
+
+ public void setCardType(Long cardType) {
+
+ this.cardType = cardType;
+ }
+
+ public void setCardTypeDescr(String cardTypeDescr) {
+
+ this.cardTypeDescr = cardTypeDescr;
+ }
+
+ public void setCustomerStatus(Long customerStatus) {
+
+ this.customerStatus = Asn1BigInteger.toAsn1(customerStatus);
+ }
+
+ public void setCustomerStatusDescr(String customerStatusDescr) {
+
+ this.customerStatusDescr = customerStatusDescr;
+ }
+
+ public void setIncludedServices(SequenceOfUnrestrictedLong includedServices) {
+
+ this.includedServices = includedServices;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public void setValidity (Date fromDate , Date untilDate){
+
+ Calendar fromCal = Calendar.getInstance();
+ fromCal.clear();
+ fromCal.setTime(fromDate);
+
+ this.validFromYear = new Long( fromCal.get(Calendar.YEAR));
+ this.validFromDay = new Long (fromCal.get(Calendar.DAY_OF_YEAR));
+
+ if (untilDate == null) return;
+
+ Calendar untilCal = Calendar.getInstance();
+ untilCal.clear();
+ untilCal.setTime(untilDate);
+
+ int untildays = untilCal.get(Calendar.DAY_OF_YEAR);
+
+ int yearDiff = untilCal.get(Calendar.YEAR) - fromCal.get(Calendar.YEAR);
+
+ this.validUntilYear = new Long( yearDiff);
+ this.validUntilDay = new Long (untildays);
+
+ }
+
+ public Date getValidFromDate (){
+
+ if (this.validFromYear == null || this.validFromYear == 0) return null;
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ cal.set(Calendar.YEAR, this.validFromYear.intValue());
+ cal.set(Calendar.DAY_OF_YEAR, this.validFromDay.intValue());
+
+ return cal.getTime();
+
+ }
+
+
+ public Date getValidUntilDate (){
+
+ if (this.validUntilYear == null || this.validUntilYear == 0) return null;
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ cal.set(Calendar.YEAR, this.validFromYear.intValue());
+ if (this.validUntilYear != null) {
+ cal.add(Calendar.YEAR, this.validUntilYear.intValue());
+ }
+ cal.set(Calendar.DAY_OF_YEAR, this.validUntilDay.intValue());
+
+ return cal.getTime();
+
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/CustomerStatusType.java b/src/org/uic/barcode/ticket/api/asn/omv1/CustomerStatusType.java new file mode 100644 index 0000000..48a5116 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/CustomerStatusType.java @@ -0,0 +1,93 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.IntRange;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+
+
+@Sequence
+public class CustomerStatusType extends Object {
+ public CustomerStatusType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long statusProviderNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String statusProviderIA5;
+
+ @FieldOrder(order = 2)
+ @Asn1Optional public Asn1BigInteger customerStatus;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String customerStatusDescr;
+
+ public Long getStatusProviderNum() {
+
+ return this.statusProviderNum;
+ }
+
+ public String getStatusProviderIA5() {
+
+ return this.statusProviderIA5;
+ }
+
+ public Long getCustomerStatus() {
+
+ return Asn1BigInteger.toLong(this.customerStatus);
+ }
+
+ public String getCustomerStatusDescr() {
+
+ return this.customerStatusDescr;
+ }
+
+ public void setStatusProviderNum(Long statusProviderNum) {
+
+ this.statusProviderNum = statusProviderNum;
+ }
+
+ public void setStatusProviderIA5(String statusProviderIA5) {
+
+ this.statusProviderIA5 = statusProviderIA5;
+ }
+
+ public void setCustomerStatus(Long customerStatus) {
+
+ this.customerStatus = Asn1BigInteger.toAsn1(customerStatus);
+ }
+
+ public void setCustomerStatusDescr(String customerStatusDescr) {
+
+ this.customerStatusDescr = customerStatusDescr;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/DateTimeUtils.java b/src/org/uic/barcode/ticket/api/asn/omv1/DateTimeUtils.java new file mode 100644 index 0000000..6e62a4a --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/DateTimeUtils.java @@ -0,0 +1,198 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+import java.util.concurrent.TimeUnit;
+
+public class DateTimeUtils {
+
+ public static Long getDateDifference(Date issuingDate, Date localDate) {
+
+ if (issuingDate == null || localDate == null) return null;
+
+ Calendar issuingCal = Calendar.getInstance();
+ issuingCal.clear();
+ issuingCal.setTime(issuingDate);
+ issuingCal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ issuingCal.set(Calendar.HOUR_OF_DAY, 0);
+ issuingCal.set(Calendar.MINUTE, 0);
+ issuingCal.set(Calendar.SECOND, 0);
+ issuingCal.set(Calendar.MILLISECOND, 0);
+
+ Calendar fromCal = Calendar.getInstance();
+ fromCal.clear();
+ fromCal.setTime(localDate);
+ fromCal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ fromCal.set(Calendar.HOUR_OF_DAY, 0);
+ fromCal.set(Calendar.MINUTE, 0);
+ fromCal.set(Calendar.SECOND, 0);
+ fromCal.set(Calendar.MILLISECOND, 0);
+
+ long diff = localDate.getTime() - issuingDate.getTime();
+ long dayDiff = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
+
+ return new Long(dayDiff);
+
+ }
+
+ public static Date getLocalDateFromDifference(Date issuingDate, int diff , Long time ) {
+
+ if (issuingDate == null) return null;
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTime(issuingDate);
+ cal.add(Calendar.DAY_OF_YEAR, diff);
+
+ if (time != null) {
+ int hours = time.intValue() / 60;
+ int minutes = time.intValue() - hours * 60;
+ cal.set(Calendar.HOUR_OF_DAY, hours);
+ cal.set(Calendar.MINUTE,minutes);
+ }
+
+ return cal.getTime();
+
+ }
+
+
+ public static void setTime(Calendar cal, Long time){
+
+ if (time != null) {
+ int hours = time.intValue() / 60;
+ int minutes = time.intValue() - hours * 60;
+ cal.set(Calendar.HOUR_OF_DAY, hours);
+ cal.set(Calendar.MINUTE,minutes);
+ }
+
+
+ }
+
+ public static Long getTime (Calendar cal) {
+
+ if (cal == null ||
+ !cal.isSet(Calendar.HOUR_OF_DAY) ||
+ !cal.isSet(Calendar.MINUTE) ) {
+ return null;
+ }
+
+ int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE);
+ if (time > 0) {
+ return new Long (time );
+ }
+ return null;
+ }
+
+ public static Long getTime (Date date) {
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTime(date);
+
+ if (cal == null ||
+ !cal.isSet(Calendar.HOUR_OF_DAY) ||
+ !cal.isSet(Calendar.MINUTE) ) {
+ return null;
+ }
+
+ int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE);
+ if (time > 0) {
+ return new Long (time );
+ }
+ return null;
+ }
+
+ public static Date getDate(Date issuingDate, Long date, Long time){
+
+ if (issuingDate == null) return null;
+
+ if (date == null) {
+ date = 0L;
+ }
+
+ Calendar issuingCal = Calendar.getInstance();
+ issuingCal.clear();
+ issuingCal.setTime(issuingDate);
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.set(Calendar.YEAR,issuingCal.get(Calendar.YEAR) );
+ cal.set(Calendar.DAY_OF_YEAR,issuingCal.get(Calendar.DAY_OF_YEAR) );
+
+ cal.add(Calendar.DAY_OF_YEAR, date.intValue());
+
+ DateTimeUtils.setTime(cal,time);
+
+ return cal.getTime();
+
+ }
+
+
+
+ /**
+ * Gets the UTC offset.
+ *
+ * @param date and time of the issuing date
+ * @param date and time of the departure
+ * @return the UTC offset in multiples of 15 minutes
+ * the offset needs to be added to local time to get the UTC time (UTC = local + offset)
+ */
+ public static Long getUTCoffset(Date local) {
+
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTime(local);
+
+ /*
+ * Returns the amount of time in milliseconds to add to UTC to get standard time in this
+ * time zone. Because this value is not affected by daylight saving time, it is called raw offset.
+ * If an underlying TimeZone implementation subclass supports historical GMT offset changes, the method
+ * returns the raw offset value of the current date. In Honolulu, for example, its raw offset
+ * changed from GMT-10:30 to GMT-10:00 in 1947, and this method
+ * always returns -36000000 milliseconds (i.e., -10 hours).
+ */
+ int minuteOffset = - cal.getTimeZone().getRawOffset()/ ( 1000 * 60 * 15 );
+
+ return new Long (minuteOffset);
+
+ }
+
+ public static Date getUTCDate(Date issuingDate, Long date, Long time, Long UTCOffset) {
+
+ if (issuingDate == null) return null;
+
+ if (UTCOffset == null) return null;
+
+ if (time == null) return null;
+
+ if (date == null) {
+ date = 0L;
+ }
+
+ Calendar issuingCal = Calendar.getInstance();
+ issuingCal.clear();
+ issuingCal.setTime(issuingDate);
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.set(Calendar.YEAR,issuingCal.get(Calendar.YEAR) );
+ cal.set(Calendar.DAY_OF_YEAR,issuingCal.get(Calendar.DAY_OF_YEAR) );
+ cal.add(Calendar.DAY_OF_YEAR, date.intValue());
+
+ int hours = time.intValue() / 60;
+ int minutes = time.intValue() - hours * 60;
+ cal.set(Calendar.HOUR_OF_DAY, hours);
+ cal.set(Calendar.MINUTE,minutes);
+
+ cal.add(Calendar.MINUTE, (int) (UTCOffset * 15) );
+
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+
+ return cal.getTime();
+
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/DelayConfirmation.java b/src/org/uic/barcode/ticket/api/asn/omv1/DelayConfirmation.java new file mode 100644 index 0000000..4f61ff3 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/DelayConfirmation.java @@ -0,0 +1,339 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.TimeZone;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+
+@Sequence
+@HasExtensionMarker
+public class DelayConfirmation extends Object {
+ public DelayConfirmation() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 2)
+ @Asn1Optional public Asn1BigInteger trainNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String trainIA5;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=2016, maxValue=2269)
+ @Asn1Optional public Long plannedArrivalYear;
+
+ @FieldOrder(order = 5)
+ @IntRange(minValue=1, maxValue=366)
+ @Asn1Optional public Long plannedArrivalDay;
+
+ @FieldOrder(order = 6)
+ @IntRange(minValue=0, maxValue=1440)
+ @Asn1Optional public Long plannedArrivalTime;
+
+ @FieldOrder(order = 7)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long departureUTCOffset;
+
+ @FieldOrder(order = 8)
+ @Asn1Default(value="stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 9)
+ @IntRange(minValue=1, maxValue=9999999)
+ @Asn1Optional public Long stationNum;
+
+ @FieldOrder(order = 10)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String stationIA5;
+
+ @FieldOrder(order = 11)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String stationNameUTF8;
+
+ @FieldOrder(order = 12)
+ @IntRange(minValue=0, maxValue=999, hasExtensionMarker=false)
+ @Asn1Optional public Long delay;
+
+ @FieldOrder(order = 13)
+ @Asn1Optional public Boolean trainCancelled = false;
+
+ @FieldOrder(order = 14)
+ @Asn1Default(value="travelerDelayConfirmation")
+ @Asn1Optional public ConfirmationTypeType confirmationType;
+
+ @FieldOrder(order = 15)
+ @Asn1Optional public SequenceOfTicketLinkType affectedTickets;
+
+ @FieldOrder(order = 16)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String infoText;
+
+ @FieldOrder(order = 17)
+ @Asn1Optional public ExtensionData extension;
+
+
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Asn1BigInteger getReferenceNum() {
+
+ return this.referenceNum;
+ }
+
+ public Long getTrainNum() {
+
+ return Asn1BigInteger.toLong(this.trainNum);
+ }
+
+ public String getTrainIA5() {
+
+ return this.trainIA5;
+ }
+
+ public Long getPlannedArrivalYear() {
+
+ return this.plannedArrivalYear;
+ }
+
+ public Long getPlannedArrivalDay() {
+
+ return this.plannedArrivalDay;
+ }
+
+ public Long getPlannedArrivalTime() {
+
+ return this.plannedArrivalTime;
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null){
+ return CodeTableType.stationUIC;
+ }
+ return this.stationCodeTable;
+ }
+
+ public Long getStationNum() {
+
+ return this.stationNum;
+ }
+
+ public String getStationIA5() {
+
+ return this.stationIA5;
+ }
+
+ public String getStationNameUTF8() {
+
+ return this.stationNameUTF8;
+ }
+
+ public Long getDelay() {
+
+ return this.delay;
+ }
+
+ public Boolean getTrainCancelled() {
+
+ return this.trainCancelled;
+ }
+
+ public ConfirmationTypeType getConfirmationType() {
+
+ if (confirmationType == null){
+ return ConfirmationTypeType.trainDelayConfirmation;
+ }
+
+ return this.confirmationType;
+ }
+
+ public List<TicketLinkType> getAffectedTickets() {
+
+ return this.affectedTickets;
+ }
+
+ public String getInfoText() {
+
+ return this.infoText;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setReferenceNum(Asn1BigInteger referenceNum) {
+ this.referenceNum = referenceNum;
+ }
+
+ public void setReferenceNum(Long referenceNum) {
+ this.referenceNum = Asn1BigInteger.toAsn1(referenceNum);
+ }
+
+ public void setTrainNum(Asn1BigInteger trainNum) {
+
+ this.trainNum = trainNum;
+ }
+
+ public void setTrainIA5(String trainIA5) {
+
+ this.trainIA5 = trainIA5;
+ }
+
+ public void setPlannedArrivalYear(Long plannedArrivalYear) {
+
+ this.plannedArrivalYear = plannedArrivalYear;
+ }
+
+ public void setPlannedArrivalDay(Long plannedArrivalDay) {
+
+ this.plannedArrivalDay = plannedArrivalDay;
+ }
+
+ public void setPlannedArrivalTime(Long plannedArrivalTime) {
+
+ this.plannedArrivalTime = plannedArrivalTime;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setStationNum(Long stationNum) {
+
+ this.stationNum = stationNum;
+ }
+
+ public void setStationIA5(String stationIA5) {
+
+ this.stationIA5 = stationIA5;
+ }
+
+ public void setStationNameUTF8(String stationNameUTF8) {
+
+ this.stationNameUTF8 = stationNameUTF8;
+ }
+
+ public void setDelay(Long delay) {
+
+ this.delay = delay;
+ }
+
+ public void setTrainCancelled(Boolean trainCancelled) {
+
+ this.trainCancelled = trainCancelled;
+ }
+
+ public void setConfirmationType(ConfirmationTypeType confirmationType) {
+
+ this.confirmationType = confirmationType;
+ }
+
+ public void setAffectedTickets(SequenceOfTicketLinkType affectedTickets) {
+
+ this.affectedTickets = affectedTickets;
+ }
+
+ public void setInfoText(String infoText) {
+
+ this.infoText = infoText;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public void setPlannedArrivalDate(Date date){
+
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+
+ this.plannedArrivalYear = new Long( cal.get(Calendar.YEAR));
+ this.plannedArrivalDay = new Long (cal.get(Calendar.DAY_OF_YEAR));
+ int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE);
+ if (time > 0) {
+ this.plannedArrivalTime = new Long (time );
+ }
+
+ }
+
+ public Date getPlannedArrivalDate() {
+
+ if (this.plannedArrivalYear == null || this.plannedArrivalDay == null) return null;
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ cal.set(Calendar.YEAR, this.plannedArrivalYear.intValue());
+ cal.set(Calendar.DAY_OF_YEAR, this.plannedArrivalDay.intValue());
+
+ if (this.plannedArrivalTime != null) {
+
+ int hours = this.plannedArrivalTime.intValue() / 60;
+ int minutes = this.plannedArrivalTime.intValue() % 60;
+ cal.set(Calendar.HOUR_OF_DAY, hours);
+ cal.set(Calendar.MINUTE,minutes);
+
+ }
+
+ return cal.getTime();
+ }
+
+ public Long getDepartureUTCOffset() {
+ return departureUTCOffset;
+ }
+
+ public void setDepartureUTCOffset(Long departureUTCOffset) {
+ this.departureUTCOffset = departureUTCOffset;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/DeltaCoordinates.java b/src/org/uic/barcode/ticket/api/asn/omv1/DeltaCoordinates.java new file mode 100644 index 0000000..96ec0ff --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/DeltaCoordinates.java @@ -0,0 +1,58 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+public class DeltaCoordinates extends Object {
+ public DeltaCoordinates() {
+ }
+
+ @FieldOrder(order = 0)
+ public Asn1BigInteger longitude;
+
+ @FieldOrder(order = 1)
+ public Asn1BigInteger latitude;
+
+
+ public Asn1BigInteger getLongitude() {
+ return this.longitude;
+ }
+
+ public Asn1BigInteger getLatitude() {
+
+ return this.latitude;
+ }
+
+ public void setLongitude(Asn1BigInteger longitude) {
+
+ this.longitude = longitude;
+ }
+
+ public void setLatitude(Asn1BigInteger latitude) {
+
+ this.latitude = latitude;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/DocumentData.java b/src/org/uic/barcode/ticket/api/asn/omv1/DocumentData.java new file mode 100644 index 0000000..cc81d25 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/DocumentData.java @@ -0,0 +1,57 @@ +/*
+ * 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.asn.omv1;
+
+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.Sequence;
+
+@Sequence
+@HasExtensionMarker
+public class DocumentData extends Object {
+ public DocumentData() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public TokenType token;
+
+ @FieldOrder(order = 1)
+ public TicketDetailData ticket;
+
+ public TokenType getToken() {
+ return this.token;
+ }
+
+ public TicketDetailData getTicket() {
+ return this.ticket;
+ }
+
+ public void setToken(TokenType token) {
+ this.token = token;
+ }
+
+ public void setTicket(TicketDetailData ticket) {
+ this.ticket = ticket;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/ExtensionData.java b/src/org/uic/barcode/ticket/api/asn/omv1/ExtensionData.java new file mode 100644 index 0000000..6d2ca87 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/ExtensionData.java @@ -0,0 +1,59 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.OctetString;
+
+
+@Sequence
+public class ExtensionData extends Object {
+ public ExtensionData() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ public String extensionId;
+
+ @FieldOrder(order = 1)
+ public OctetString extensionData;
+
+ public String getExtensionId() {
+ return this.extensionId;
+ }
+
+ public byte[] getExtensionData() {
+ return extensionData.toByteArray();
+ }
+
+ public void setExtensionId(String extensionId) {
+ this.extensionId = extensionId;
+ }
+
+ public void setExtensionData(byte[] extensionData) {
+ this.extensionData = new OctetString(extensionData);
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/FIPTicketData.java b/src/org/uic/barcode/ticket/api/asn/omv1/FIPTicketData.java new file mode 100644 index 0000000..47e4959 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/FIPTicketData.java @@ -0,0 +1,331 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.IntRange;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+
+public class FIPTicketData extends Object {
+ public FIPTicketData() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 6)
+ @IntRange(minValue=-1,maxValue=700)
+ @Asn1Optional public Long validFromDay;
+
+ @FieldOrder(order = 7)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long validUntilDay;
+
+ @FieldOrder(order = 8)
+ @Asn1Optional public SequenceOfActivatedDays activatedDay;
+
+ @FieldOrder(order = 9)
+ @Asn1Optional public SequenceOfCarrierNum carrierNum;
+
+ @FieldOrder(order = 10)
+ @Asn1Optional public SequenceOfStringIA5 carrierIA5;
+
+ @FieldOrder(order = 11)
+ @IntRange(minValue=1,maxValue=200)
+ public Long numberOfTravelDays;
+
+ @FieldOrder(order = 12)
+ public Boolean includesSupplements = false;
+
+ @FieldOrder(order = 13)
+ @Asn1Default(value="second")
+ @Asn1Optional public TravelClassType classCode;
+
+ @FieldOrder(order = 14)
+ @Asn1Optional public ExtensionData extension;
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Asn1BigInteger getReferenceNum() {
+
+ return this.referenceNum;
+ }
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+
+ return this.productIdIA5;
+ }
+
+ public Long getValidFromDay() {
+
+ return this.validFromDay;
+ }
+
+ public Long getValidUntilDay() {
+
+ return this.validUntilDay;
+ }
+
+ public List<Long> getActivatedDay() {
+
+ return this.activatedDay;
+ }
+
+ public List<Long> getCarrierNum() {
+
+ return this.carrierNum;
+ }
+
+ public List<String> getCarrierIA5() {
+
+ return this.carrierIA5;
+ }
+
+ public Long getNumberOfTravelDays() {
+
+ return this.numberOfTravelDays;
+ }
+
+ public Boolean getIncludesSupplements() {
+
+ return this.includesSupplements;
+ }
+
+ public TravelClassType getClassCode() {
+ if (classCode == null) return TravelClassType.second;
+ return this.classCode;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setReferenceNum(Asn1BigInteger referenceNum) {
+
+ this.referenceNum = referenceNum;
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setValidFromDay(Long validFromDay) {
+
+ this.validFromDay = validFromDay;
+ }
+
+ public void setValidUntilDay(Long validUntilDay) {
+
+ this.validUntilDay = validUntilDay;
+ }
+
+ public void setActivatedDay(SequenceOfActivatedDays activatedDay) {
+
+ this.activatedDay = activatedDay;
+ }
+
+ public void setCarrierNum(SequenceOfCarrierNum carrierNum) {
+
+ this.carrierNum = carrierNum;
+ }
+
+ public void setCarrierIA5(SequenceOfStringIA5 carrierIA5) {
+
+ this.carrierIA5 = carrierIA5;
+ }
+
+ public void setNumberOfTravelDays(Long numberOfTravelDays) {
+
+ this.numberOfTravelDays = numberOfTravelDays;
+ }
+
+ public void setIncludesSupplements(Boolean includesSupplements) {
+
+ this.includesSupplements = includesSupplements;
+ }
+
+ public void setClassCode(TravelClassType classCode) {
+ this.classCode = classCode;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public void setValidityDates (Date fromDate, Date untilDate, Date issuingDate){
+
+ if (issuingDate == null || fromDate == null) return;
+
+ this.validFromDay = DateTimeUtils.getDateDifference(issuingDate,fromDate);
+
+ if (untilDate != null){
+ this.validUntilDay = DateTimeUtils.getDateDifference(fromDate, untilDate);
+ }
+
+ }
+
+ public Date getValidFromDate(Date issuingDate){
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay,null);
+
+ }
+
+ public Date getValidUntilDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validUntilDay == null) {
+ return null;
+ }
+
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, null);
+
+ }
+
+ public void setActivatedDays(Collection<Date> dates, Date issuingDate){
+
+ if (this.activatedDay != null) {
+ this.activatedDay.clear();
+ } else {
+ this.activatedDay= new SequenceOfActivatedDays();
+ }
+
+ if (dates != null && !dates.isEmpty()) {
+
+ for (Date day : dates) {
+ this.addActivatedDay(issuingDate, day);
+ }
+
+ }
+
+ }
+
+ public void addActivatedDay(Date issuingDate, Date day){
+
+ Long dayDiff = DateTimeUtils.getDateDifference(issuingDate, day);
+
+ if (this.activatedDay == null) {
+ this.activatedDay = new SequenceOfActivatedDays();
+ }
+
+ if (dayDiff != null) {
+ this.activatedDay.add(dayDiff);
+ }
+
+ }
+
+ public Collection<Date> getActivatedDays(Date issuingDate) {
+
+ if (this.activatedDay == null) return null;
+
+ ArrayList<Date> dates = new ArrayList<Date>();
+
+ for (Long diff: this.getActivatedDay()) {
+
+ Date day = DateTimeUtils.getDate(issuingDate, diff, null);
+
+ if (day != null) {
+ dates.add(day);
+ }
+
+ }
+
+ return dates;
+
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/GenderType.java b/src/org/uic/barcode/ticket/api/asn/omv1/GenderType.java new file mode 100644 index 0000000..f1e58ed --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/GenderType.java @@ -0,0 +1,42 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum GenderType {
+ unspecified("unspecified"),
+ female("female"),
+ male("male"),
+ other("other");
+
+
+ public String text;
+
+ GenderType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/GeoCoordinateSystemType.java b/src/org/uic/barcode/ticket/api/asn/omv1/GeoCoordinateSystemType.java new file mode 100644 index 0000000..804c038 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/GeoCoordinateSystemType.java @@ -0,0 +1,38 @@ +/*
+ * 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.asn.omv1;
+
+
+public enum GeoCoordinateSystemType {
+ wgs84("wgs84"),
+ grs80("grs80");
+
+
+ public String text;
+
+ GeoCoordinateSystemType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/GeoCoordinateType.java b/src/org/uic/barcode/ticket/api/asn/omv1/GeoCoordinateType.java new file mode 100644 index 0000000..931d486 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/GeoCoordinateType.java @@ -0,0 +1,144 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+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.Sequence;
+
+@Sequence
+public class GeoCoordinateType extends Object {
+ public GeoCoordinateType() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Default(value="milliDegree")
+ @Asn1Optional public GeoUnitType geoUnit;
+
+ @FieldOrder(order = 1)
+ @Asn1Default(value="wgs84")
+ @Asn1Optional public GeoCoordinateSystemType coordinateSystem;
+
+ @FieldOrder(order = 2)
+ @Asn1Default(value="north")
+ @Asn1Optional public HemisphereLongitudeType hemisphereLongitude;
+
+ @FieldOrder(order = 3)
+ @Asn1Default(value="east")
+ @Asn1Optional public HemisphereLatitudeType hemisphereLatitude;
+
+ @FieldOrder(order = 4)
+ public Asn1BigInteger longitude;
+
+ @FieldOrder(order = 5)
+ public Asn1BigInteger latitude;
+
+ @FieldOrder(order = 6)
+ @Asn1Optional public GeoUnitType accuracy;
+
+ public GeoUnitType getGeoUnit() {
+
+ if (geoUnit == null){
+ return GeoUnitType.milliDegree;
+ }
+ return this.geoUnit;
+ }
+
+ public GeoCoordinateSystemType getCoordinateSystem() {
+
+ if (coordinateSystem == null) {
+ return GeoCoordinateSystemType.wgs84;
+ }
+
+ return this.coordinateSystem;
+ }
+
+ public HemisphereLongitudeType getHemisphereLongitude() {
+
+ if (hemisphereLongitude == null){
+ return HemisphereLongitudeType.north;
+ }
+
+ return this.hemisphereLongitude;
+ }
+
+ public HemisphereLatitudeType getHemisphereLatitude() {
+
+ if (hemisphereLatitude == null) {
+ return HemisphereLatitudeType.east;
+ }
+
+ return this.hemisphereLatitude;
+ }
+
+ public Long getLongitude() {
+
+ return Asn1BigInteger.toLong(this.longitude);
+ }
+
+ public Long getLatitude() {
+
+ return Asn1BigInteger.toLong(this.latitude);
+ }
+
+ public GeoUnitType getAccuracy() {
+
+ return this.accuracy;
+ }
+
+ public void setGeoUnit(GeoUnitType geoUnit) {
+
+ this.geoUnit = geoUnit;
+ }
+
+ public void setCoordinateSystem(GeoCoordinateSystemType coordinateSystem) {
+
+ this.coordinateSystem = coordinateSystem;
+ }
+
+ public void setHemisphereLongitude(HemisphereLongitudeType hemisphereLongitude) {
+
+ this.hemisphereLongitude = hemisphereLongitude;
+ }
+
+ public void setHemisphereLatitude(HemisphereLatitudeType hemisphereLatitude) {
+
+ this.hemisphereLatitude = hemisphereLatitude;
+ }
+
+ public void setLongitude(Long longitude) {
+
+ this.longitude = Asn1BigInteger.toAsn1(longitude);
+ }
+
+ public void setLatitude(Long latitude) {
+
+ this.latitude = Asn1BigInteger.toAsn1(latitude);
+ }
+
+ public void setAccuracy(GeoUnitType accuracy) {
+
+ this.accuracy = accuracy;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/GeoUnitType.java b/src/org/uic/barcode/ticket/api/asn/omv1/GeoUnitType.java new file mode 100644 index 0000000..e864a70 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/GeoUnitType.java @@ -0,0 +1,40 @@ +/*
+ * 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.asn.omv1;
+
+public enum GeoUnitType {
+ microDegree("microDegree"),
+ tenthmilliDegree("tenthmilliDegree"),
+ milliDegree("milliDegree"),
+ centiDegree("centiDegree"),
+ deciDegree("deciDegree");
+
+
+ public String text;
+
+ GeoUnitType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/HemisphereLatitudeType.java b/src/org/uic/barcode/ticket/api/asn/omv1/HemisphereLatitudeType.java new file mode 100644 index 0000000..9bb3d7b --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/HemisphereLatitudeType.java @@ -0,0 +1,37 @@ +/*
+ * 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.asn.omv1;
+
+public enum HemisphereLatitudeType {
+ east("east"),
+ west("west");
+
+
+ public String text;
+
+ HemisphereLatitudeType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/HemisphereLongitudeType.java b/src/org/uic/barcode/ticket/api/asn/omv1/HemisphereLongitudeType.java new file mode 100644 index 0000000..1c5b310 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/HemisphereLongitudeType.java @@ -0,0 +1,36 @@ +/*
+ * 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.asn.omv1;
+
+public enum HemisphereLongitudeType {
+ north("north"),
+ south("south");
+
+ public String text;
+
+ HemisphereLongitudeType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java b/src/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java new file mode 100644 index 0000000..6b6c538 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java @@ -0,0 +1,424 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.Date;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.IntRange;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.SizeRange;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+
+public class IncludedOpenTicketType extends Object {
+ public IncludedOpenTicketType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 4)
+ @Asn1Optional public Asn1BigInteger externalIssuerId;
+
+ @FieldOrder(order = 5)
+ @Asn1Optional public Asn1BigInteger issuerAutorizationId;
+
+ @FieldOrder(order = 6)
+ @Asn1Default("stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 7)
+ @Asn1Optional public SequenceOfRegionalValidityType validRegion;
+
+ @FieldOrder(order = 8)
+ @IntRange(minValue=-1,maxValue=700)
+ @Asn1Optional public Long validFromDay;
+
+ @FieldOrder(order = 9)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long validFromTime;
+
+ @FieldOrder(order = 10)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validFromUTCOffset;
+
+ @FieldOrder(order = 11)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long validUntilDay;
+
+ @FieldOrder(order = 12)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long validUntilTime;
+
+ @FieldOrder(order = 13)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validUntilUTCOffset;
+
+ @FieldOrder(order = 14)
+ @Asn1Default(value="second")
+ @Asn1Optional public TravelClassType classCode;
+
+ @FieldOrder(order = 15)
+ @SizeRange(minValue = 1, maxValue = 2)
+ @Asn1Optional public String serviceLevel;
+
+ @FieldOrder(order = 16)
+ @Asn1Optional public SequenceOfCarrierNum includedCarriersNum;
+
+ @FieldOrder(order = 17)
+ @Asn1Optional public SequenceOfStringIA5 includedCarriersIA5;
+
+ @FieldOrder(order = 18)
+ @Asn1Optional public SequenceOfServiceBrands includedServiceBrands;
+
+ @FieldOrder(order = 19)
+ @Asn1Optional public SequenceOfServiceBrands excludedServiceBrands;
+
+ @FieldOrder(order = 20)
+ @Asn1Optional public SequenceOfTariffType tariffs;
+
+ @FieldOrder(order = 21)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String infoText;
+
+ @FieldOrder(order = 22)
+ @Asn1Optional public ExtensionData extension;
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+
+ return this.productIdIA5;
+ }
+
+ public Long getExternalIssuerId() {
+
+ return Asn1BigInteger.toLong(this.externalIssuerId);
+ }
+
+ public Long getIssuerAutorizationId() {
+
+ return Asn1BigInteger.toLong(this.issuerAutorizationId);
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUIC;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public List<RegionalValidityType> getValidRegion() {
+
+ return this.validRegion;
+ }
+
+ public Long getValidFromDay() {
+
+ return this.validFromDay;
+ }
+
+ public Long getValidFromTime() {
+
+ return this.validFromTime;
+ }
+
+ public Long getValidUntilDay() {
+
+ return this.validUntilDay;
+ }
+
+ public Long getValidUntilTime() {
+
+ return this.validUntilTime;
+ }
+
+ public TravelClassType getClassCode() {
+
+ if (classCode == null) {
+ return TravelClassType.second;
+ }
+
+ return this.classCode;
+ }
+
+ public String getServiceLevel() {
+
+ return this.serviceLevel;
+ }
+
+ public List<Long> getIncludedCarriersNum() {
+
+ return this.includedCarriersNum;
+ }
+
+ public List<String> getIncludedCarriersIA5() {
+
+ return this.includedCarriersIA5;
+ }
+
+ public List<Long> getIncludedServiceBrands() {
+
+ return this.includedServiceBrands;
+ }
+
+ public List<Long> getExcludedServiceBrands() {
+
+ return this.excludedServiceBrands;
+ }
+
+ public List<TariffType> getTariffs() {
+
+ return this.tariffs;
+ }
+
+ public String getInfoText() {
+
+ return this.infoText;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setExternalIssuerId(Long externalIssuerId) {
+
+ this.externalIssuerId = Asn1BigInteger.toAsn1(externalIssuerId);
+ }
+
+ public void setIssuerAutorizationId(Long issuerAutorizationId) {
+
+ this.issuerAutorizationId = Asn1BigInteger.toAsn1(issuerAutorizationId);
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setValidRegion(SequenceOfRegionalValidityType validRegion) {
+
+ this.validRegion = validRegion;
+ }
+
+ public void setValidFromDay(Long validFromDay) {
+
+ this.validFromDay = validFromDay;
+ }
+
+ public void setValidFromTime(Long validFromTime) {
+
+ this.validFromTime = validFromTime;
+ }
+
+ public void setValidUntilDay(Long validUntilDay) {
+
+ this.validUntilDay = validUntilDay;
+ }
+
+ public void setValidUntilTime(Long validUntilTime) {
+
+ this.validUntilTime = validUntilTime;
+ }
+
+ public void setClassCode(TravelClassType classCode) {
+
+ this.classCode = classCode;
+ }
+
+ public void setServiceLevel(String serviceLevel) {
+
+ this.serviceLevel = serviceLevel;
+ }
+
+ public void setIncludedCarriersNum(SequenceOfCarrierNum includedCarriersNum) {
+
+ this.includedCarriersNum = includedCarriersNum;
+ }
+
+ public void setIncludedCarriersIA5(SequenceOfStringIA5 includedCarriersIA5) {
+
+ this.includedCarriersIA5 = includedCarriersIA5;
+ }
+
+ public void setIncludedServiceBrands(SequenceOfServiceBrands includedServiceBrands) {
+
+ this.includedServiceBrands = includedServiceBrands;
+ }
+
+ public void setExcludedServiceBrands(SequenceOfServiceBrands excludedServiceBrands) {
+
+ this.excludedServiceBrands = excludedServiceBrands;
+ }
+
+ public void setTariffs(SequenceOfTariffType tariffs) {
+
+ this.tariffs = tariffs;
+ }
+
+ public void setInfoText(String infoText) {
+
+ this.infoText = infoText;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public void setValidityDates (Date fromDate, Date untilDate, Date issuingDate){
+
+ if (issuingDate == null || fromDate == null) return;
+
+ this.validFromDay = DateTimeUtils.getDateDifference(issuingDate,fromDate);
+ this.validFromTime = DateTimeUtils.getTime(fromDate);
+
+
+ if (untilDate != null){
+ this.validUntilDay = DateTimeUtils.getDateDifference(fromDate, untilDate);
+ this.validUntilTime = DateTimeUtils.getTime(untilDate);
+ }
+
+ }
+
+ public void setValidFromTimeZone(Date dateLocal, Date dateUTC ) {
+ // -- (UTC = local + offset * 15 Minutes)
+ this.validFromUTCOffset = new Long(dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15);
+ }
+
+ public void setValidUntilTimeZone(Date dateLocal, Date dateUTC ) {
+ // -- (UTC = local + offset * 15 Minutes)
+ this.validUntilUTCOffset = new Long(dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15);
+
+ if (this.validFromUTCOffset.longValue() == this.validUntilUTCOffset.longValue()) {
+ this.validUntilUTCOffset = null;
+ }
+ }
+
+
+
+ public Date getValidFromDate(Date issuingDate){
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay, this.validFromTime);
+
+ }
+
+ public Date getValidUntilDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validUntilDay == null) {
+ return null;
+ }
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime);
+
+ }
+
+ public Date getUTCValidFromDate(Date issuingDate){
+ return DateTimeUtils.getUTCDate(issuingDate, this.validFromDay, this.validFromTime, this.validFromUTCOffset);
+ }
+
+ public Date getUTCValidUntilDate(Date issuingDate){
+ if (this.validUntilUTCOffset == null) {
+ return DateTimeUtils.getUTCDate(issuingDate, this.validFromDay, this.validFromTime, this.validFromUTCOffset);
+ } else {
+ return DateTimeUtils.getUTCDate(issuingDate, this.validFromDay, this.validUntilTime, this.validFromUTCOffset);
+ }
+ }
+
+ public Long getValidFromUTCOffset() {
+ return validFromUTCOffset;
+ }
+
+ public void setValidFromUTCOffset(Long validFromUTCOffset) {
+ this.validFromUTCOffset = validFromUTCOffset;
+ }
+
+ public Long getValidUntilUTCOffset() {
+ return validUntilUTCOffset;
+ }
+
+ public void setValidUntilUTCOffset(Long validUntilUTCOffset) {
+ this.validUntilUTCOffset = validUntilUTCOffset;
+ }
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/IssuingData.java b/src/org/uic/barcode/ticket/api/asn/omv1/IssuingData.java new file mode 100644 index 0000000..cb2d126 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/IssuingData.java @@ -0,0 +1,360 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.FixedSize;
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+import org.uic.barcode.asn1.datatypes.IntRange;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+@HasExtensionMarker
+public class IssuingData extends Object {
+ public IssuingData() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long securityProviderNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String securityProviderIA5;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long issuerNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String issuerIA5;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=2016,maxValue=2269)
+ public Long issuingYear;
+
+ @FieldOrder(order = 5)
+ @IntRange(minValue=1,maxValue=366)
+ public Long issuingDay;
+
+ @FieldOrder(order = 6)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long issuingTime;
+
+ @FieldOrder(order = 7)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String issuerName;
+
+ @FieldOrder(order = 8)
+ public Boolean specimen = false;
+
+ @FieldOrder(order = 9)
+ public Boolean securePaperTicket = false;
+
+ @FieldOrder(order = 10)
+ public Boolean activated = true;
+
+ @FieldOrder(order = 11)
+ @FixedSize(3)
+ @Asn1Default(value="EUR")
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String currency;
+
+ @FieldOrder(order = 12)
+ @IntRange(minValue=1,maxValue=3)
+ @Asn1Default(value="2")
+ @Asn1Optional public Long currencyFract;
+
+ @FieldOrder(order = 13)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String issuerPNR;
+
+ @FieldOrder(order = 14)
+ @Asn1Optional public ExtensionData extension;
+
+ @FieldOrder(order = 15)
+ @Asn1Optional public Asn1BigInteger issuedOnTrainNum;
+
+ @FieldOrder(order = 16)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String issuedOnTrainIA5;
+
+ @FieldOrder(order = 17)
+ @Asn1Optional public Asn1BigInteger issuedOnLine;
+
+ @FieldOrder(order = 18)
+ @Asn1Optional public GeoCoordinateType pointOfSale;
+
+
+
+
+
+
+ public Long getSecurityProviderNum() {
+
+ return this.securityProviderNum;
+ }
+
+ public String getSecurityProviderIA5() {
+
+ return this.securityProviderIA5;
+ }
+
+ public Long getIssuerNum() {
+
+ return this.issuerNum;
+ }
+
+ public String getIssuerIA5() {
+
+ return this.issuerIA5;
+ }
+
+ public Long getIssuingYear() {
+
+ return this.issuingYear;
+ }
+
+ public Long getIssuingDay() {
+
+ return this.issuingDay;
+ }
+
+ public Long getIssuingTime() {
+
+ return this.issuingTime;
+ }
+
+ public String getIssuerName() {
+
+ return this.issuerName;
+ }
+
+ public Boolean getSpecimen() {
+
+ return this.specimen;
+ }
+
+ public Boolean getSecurePaperTicket() {
+
+ return this.securePaperTicket;
+ }
+
+ public Boolean getActivated() {
+
+ return this.activated;
+ }
+
+ public String getCurrency() {
+
+ if (currency == null || currency.length() == 0){
+ return "EUR";
+ }
+
+ return this.currency;
+ }
+
+ public Long getCurrencyFract() {
+
+ if (currencyFract == null) {
+ return new Long(2);
+ }
+ return this.currencyFract;
+ }
+
+ public String getIssuerPNR() {
+
+ return this.issuerPNR;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public Long getIssuedOnTrainNum() {
+
+ return Asn1BigInteger.toLong(issuedOnTrainNum);
+ }
+
+ public String getIssuedOnTrainIA5() {
+
+ return this.issuedOnTrainIA5;
+ }
+
+ public Long getIssuedOnLine() {
+
+ return Asn1BigInteger.toLong(issuedOnLine);
+ }
+
+ public GeoCoordinateType getPointOfSale() {
+
+ return this.pointOfSale;
+ }
+
+ public void setSecurityProviderNum(Long securityProviderNum) {
+
+ this.securityProviderNum = securityProviderNum;
+ }
+
+ public void setSecurityProviderIA5(String securityProviderIA5) {
+
+ this.securityProviderIA5 = securityProviderIA5;
+ }
+
+ public void setIssuerNum(Long issuerNum) {
+
+ this.issuerNum = issuerNum;
+ }
+
+ public void setIssuerIA5(String issuerIA5) {
+
+ this.issuerIA5 = issuerIA5;
+ }
+
+ public void setIssuingYear(Long issuingYear) {
+
+ this.issuingYear = issuingYear;
+ }
+
+ public void setIssuingDay(Long issuingDay) {
+
+ this.issuingDay = issuingDay;
+ }
+
+ public void setIssuingTime(Long issuingTime) {
+
+ this.issuingTime = issuingTime;
+ }
+
+ public void setIssuerName(String issuerName) {
+
+ this.issuerName = issuerName;
+ }
+
+ public void setSpecimen(Boolean specimen) {
+
+ this.specimen = specimen;
+ }
+
+ public void setSecurePaperTicket(Boolean securePaperTicket) {
+
+ this.securePaperTicket = securePaperTicket;
+ }
+
+ public void setActivated(Boolean activated) {
+
+ this.activated = activated;
+ }
+
+ public void setCurrency(String currency) {
+
+ this.currency = currency;
+ }
+
+ public void setCurrencyFract(Long currencyFract) {
+
+ this.currencyFract = currencyFract;
+ }
+
+ public void setIssuerPNR(String issuerPNR) {
+
+ this.issuerPNR = issuerPNR;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public void setIssuedOnTrainNum(Long issuedOnTrainNum) {
+
+ this.issuedOnTrainNum = Asn1BigInteger.toAsn1(issuedOnTrainNum);
+ }
+
+ public void setIssuedOnTrainIA5(String issuedOnTrainIA5) {
+
+ this.issuedOnTrainIA5 = issuedOnTrainIA5;
+ }
+
+ public void setIssuedOnLine(Long issuedOnLine) {
+
+ this.issuedOnLine = Asn1BigInteger.toAsn1(issuedOnLine);
+ }
+
+ public void setPointOfSale(GeoCoordinateType pointOfSale) {
+
+ this.pointOfSale = pointOfSale;
+ }
+
+ public void setIssuingDate(Date date){
+
+ if (date == null) {
+ date = Calendar.getInstance().getTime();
+ }
+
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+
+ this.issuingYear = new Long( cal.get(Calendar.YEAR));
+ this.issuingDay = new Long (cal.get(Calendar.DAY_OF_YEAR));
+ int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE);
+ if (time > 0) {
+ this.issuingTime = new Long (time );
+ }
+
+ }
+
+ public Date getIssuingDate() {
+
+ if (this.issuingYear == null || this.issuingDay == null) return null;
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ cal.set(Calendar.YEAR, this.issuingYear.intValue());
+ cal.set(Calendar.DAY_OF_YEAR, this.issuingDay.intValue());
+
+ if (this.issuingTime != null) {
+
+ int hours = this.issuingTime.intValue() / 60;
+ int minutes = this.issuingTime.intValue() % 60;
+ cal.set(Calendar.HOUR_OF_DAY, hours);
+ cal.set(Calendar.MINUTE,minutes);
+
+ }
+
+ return cal.getTime();
+ }
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/LineType.java b/src/org/uic/barcode/ticket/api/asn/omv1/LineType.java new file mode 100644 index 0000000..290f0e6 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/LineType.java @@ -0,0 +1,185 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.OctetString;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfUnrestrictedLong;
+
+@Sequence
+@HasExtensionMarker
+
+public class LineType extends Object {
+ public LineType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long carrierNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String carrierIA5;
+
+ @FieldOrder(order = 2)
+ @Asn1Optional public SequenceOfUnrestrictedLong lineId;
+
+ @FieldOrder(order = 3)
+ @Asn1Default("stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=0,maxValue=9999999)
+ @Asn1Optional public Long entryStationNum;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String entryStationIA5;
+
+ @FieldOrder(order = 6)
+ @IntRange(minValue=0,maxValue=9999999)
+ @Asn1Optional public Long terminatingStationNum;
+
+ @FieldOrder(order = 7)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String terminatingStationIA5;
+
+ @FieldOrder(order = 8)
+ @Asn1Optional public Asn1BigInteger city;
+
+ @FieldOrder(order = 9)
+ @Asn1Optional public OctetString binaryZoneId;
+
+
+
+ public Long getCarrierNum() {
+
+ return this.carrierNum;
+ }
+
+ public String getCarrierIA5() {
+
+ return this.carrierIA5;
+ }
+
+ public SequenceOfUnrestrictedLong getLineId() {
+
+ return this.lineId;
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUIC;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public Long getEntryStationNum() {
+
+ return this.entryStationNum;
+ }
+
+ public String getEntryStationIA5() {
+
+ return this.entryStationIA5;
+ }
+
+ public Long getTerminatingStationNum() {
+
+ return this.terminatingStationNum;
+ }
+
+ public String getTerminatingStationIA5() {
+
+ return this.terminatingStationIA5;
+ }
+
+ public Long getCity() {
+
+ return Asn1BigInteger.toLong(this.city);
+ }
+
+ public byte[] getBinaryZoneId() {
+
+ return binaryZoneId.toByteArray();
+ }
+
+ public void setCarrierNum(Long carrierNum) {
+
+ this.carrierNum = carrierNum;
+ }
+
+ public void setCarrierIA5(String carrierIA5) {
+
+ this.carrierIA5 = carrierIA5;
+ }
+
+ public void setLineId(SequenceOfUnrestrictedLong lineId) {
+
+ this.lineId = lineId;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setEntryStationNum(Long entryStationNum) {
+
+ this.entryStationNum = entryStationNum;
+ }
+
+ public void setEntryStationIA5(String entryStationIA5) {
+
+ this.entryStationIA5 = entryStationIA5;
+ }
+
+ public void setTerminatingStationNum(Long terminatingStationNum) {
+
+ this.terminatingStationNum = terminatingStationNum;
+ }
+
+ public void setTerminatingStationIA5(String terminatingStationIA5) {
+
+ this.terminatingStationIA5 = terminatingStationIA5;
+ }
+
+ public void setCity(Long city) {
+
+ this.city = Asn1BigInteger.toAsn1(city);
+ }
+
+ public void setBinaryZoneId(byte[] binaryZoneId) {
+
+ this.binaryZoneId = new OctetString(binaryZoneId);
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/LinkMode.java b/src/org/uic/barcode/ticket/api/asn/omv1/LinkMode.java new file mode 100644 index 0000000..00d30b5 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/LinkMode.java @@ -0,0 +1,39 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum LinkMode {
+ issuedTogether("issuedTogether"),
+ onlyValidInCombination("onlyValidInCombination");
+
+ public String text;
+
+ LinkMode(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/LoadingDeckType.java b/src/org/uic/barcode/ticket/api/asn/omv1/LoadingDeckType.java new file mode 100644 index 0000000..60a285e --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/LoadingDeckType.java @@ -0,0 +1,38 @@ +/*
+ * 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.asn.omv1;
+
+
+public enum LoadingDeckType {
+ unspecified("unspecified"),
+ upper("upper"),
+ lower("lower");
+
+ public String text;
+
+ LoadingDeckType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/LuggageRestrictionType.java b/src/org/uic/barcode/ticket/api/asn/omv1/LuggageRestrictionType.java new file mode 100644 index 0000000..04f4309 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/LuggageRestrictionType.java @@ -0,0 +1,88 @@ +/*
+ * 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.asn.omv1;
+
+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;
+
+@Sequence
+@HasExtensionMarker
+public class LuggageRestrictionType extends Object {
+ public LuggageRestrictionType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=0,maxValue=99)
+ @Asn1Default(value="3")
+ @Asn1Optional public Long maxHandLuggagePieces;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue=0,maxValue=99)
+ @Asn1Default(value="1")
+ @Asn1Optional public Long maxNonHandLuggagePieces;
+
+ @FieldOrder(order = 2)
+ @Asn1Optional public SequenceOfRegisteredLuggageType registeredLuggage;
+
+
+ public void setRegisteredLuggage(
+ SequenceOfRegisteredLuggageType registeredLuggage) {
+ this.registeredLuggage = registeredLuggage;
+ }
+
+ public Long getMaxHandLuggagePieces() {
+
+ if (maxHandLuggagePieces == null) {
+ return new Long(3);
+ }
+
+ return this.maxHandLuggagePieces;
+ }
+
+ public Long getMaxNonHandLuggagePieces() {
+
+ if (maxNonHandLuggagePieces == null) {
+ return new Long(1);
+ }
+
+ return this.maxNonHandLuggagePieces;
+ }
+
+ public SequenceOfRegisteredLuggageType getRegisteredLuggage() {
+
+ return this.registeredLuggage;
+ }
+
+ public void setMaxHandLuggagePieces(Long maxHandLuggagePieces) {
+
+ this.maxHandLuggagePieces = maxHandLuggagePieces;
+ }
+
+ public void setMaxNonHandLuggagePieces(Long maxNonHandLuggagePieces) {
+
+ this.maxNonHandLuggagePieces = maxNonHandLuggagePieces;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/OpenTicketData.java b/src/org/uic/barcode/ticket/api/asn/omv1/OpenTicketData.java new file mode 100644 index 0000000..13ceb84 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/OpenTicketData.java @@ -0,0 +1,678 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypes.SizeRange;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+
+@Sequence
+@HasExtensionMarker
+public class OpenTicketData extends Object {
+ public OpenTicketData() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 6)
+ @Asn1Optional public Asn1BigInteger externalIssuerId;
+
+ @FieldOrder(order = 7)
+ @Asn1Optional public Asn1BigInteger issuerAutorizationId;
+
+ @FieldOrder(order = 8)
+ public Boolean returnIncluded = false;
+
+ @FieldOrder(order = 9)
+ @Asn1Default("stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 10)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long fromStationNum;
+
+ @FieldOrder(order = 11)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String fromStationIA5;
+
+ @FieldOrder(order = 12)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long toStationNum;
+
+ @FieldOrder(order = 13)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String toStationIA5;
+
+ @FieldOrder(order = 14)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String fromStationNameUTF8;
+
+ @FieldOrder(order = 15)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String toStationNameUTF8;
+
+ @FieldOrder(order = 16)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String validRegionDesc;
+
+ @FieldOrder(order = 17)
+ @Asn1Optional public SequenceOfRegionalValidityType validRegion;
+
+ @FieldOrder(order = 18)
+ @Asn1Optional public ReturnRouteDescriptionType returnDescription;
+
+ @FieldOrder(order = 19)
+ @Asn1Default(value = "0")
+ @IntRange(minValue=-1,maxValue=700)
+ @Asn1Optional public Long validFromDay;
+
+ @FieldOrder(order = 20)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long validFromTime;
+
+ @FieldOrder(order = 21)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validFromUTCOffset;
+
+ @FieldOrder(order = 22)
+ @Asn1Default(value = "0")
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long validUntilDay;
+
+ @FieldOrder(order = 23)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long validUntilTime;
+
+ @FieldOrder(order = 24)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validUntilUTCOffset;
+
+ @FieldOrder(order = 25)
+ @Asn1Optional public SequenceOfActivatedDays activatedDay;
+
+ @FieldOrder(order = 26)
+ @Asn1Default(value="second")
+ @Asn1Optional public TravelClassType classCode;
+
+ @FieldOrder(order = 27)
+ @SizeRange(minValue = 1, maxValue = 2)
+ @Asn1Optional public String serviceLevel;
+
+ @FieldOrder(order = 28)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public SequenceOfCarrierNum carrierNum;
+
+ @FieldOrder(order = 29)
+ @Asn1Optional public SequenceOfStringIA5 carrierIA5;
+
+ @FieldOrder(order = 30)
+ @Asn1Optional public SequenceOfServiceBrands includedServiceBrands;
+
+ @FieldOrder(order = 31)
+ @Asn1Optional public SequenceOfServiceBrands excludedServiceBrands;
+
+ @FieldOrder(order = 32)
+ @Asn1Optional public SequenceOfTariffType tariffs;
+
+ @FieldOrder(order = 33)
+ @Asn1Optional Asn1BigInteger price;
+
+ @FieldOrder(order = 34)
+ @Asn1Optional SequenceOfVatDetail vatDetails;
+
+ @FieldOrder(order = 35)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String infoText;
+
+ @FieldOrder(order = 36)
+ @Asn1Optional public SequenceOfIncludedOpenTicketType includedAddOns;
+
+ @FieldOrder(order = 37)
+ @Asn1Optional public LuggageRestrictionType luggage;
+
+ @FieldOrder(order = 38)
+ @Asn1Optional public ExtensionData extension;
+
+
+
+
+ public Long getReferenceNum() {
+ return Asn1BigInteger.toLong(this.referenceNum);
+ }
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+
+ return this.productIdIA5;
+ }
+
+ public Long getExtIssuerId() {
+
+ return Asn1BigInteger.toLong(externalIssuerId);
+ }
+
+ public Long getIssuerAutorizationId() {
+
+ return Asn1BigInteger.toLong(issuerAutorizationId);
+ }
+
+ public Boolean getReturnIncluded() {
+
+ return this.returnIncluded;
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUIC;
+ }
+
+
+ return this.stationCodeTable;
+ }
+
+ public Long getFromStationNum() {
+
+ return this.fromStationNum;
+ }
+
+ public String getFromStationIA5() {
+
+ return this.fromStationIA5;
+ }
+
+ public Long getToStationNum() {
+
+ return this.toStationNum;
+ }
+
+ public String getToStationIA5() {
+
+ return this.toStationIA5;
+ }
+
+ public String getFromStationNameUTF8() {
+
+ return this.fromStationNameUTF8;
+ }
+
+ public String getToStationNameUTF8() {
+
+ return this.toStationNameUTF8;
+ }
+
+ public String getValidRegionDesc() {
+
+ return this.validRegionDesc;
+ }
+
+ public List<RegionalValidityType> getValidRegion() {
+
+ return this.validRegion;
+ }
+
+ public ReturnRouteDescriptionType getReturnDescription() {
+
+ return this.returnDescription;
+ }
+
+ public Long getValidFromDay() {
+
+ return this.validFromDay;
+ }
+
+ public Long getValidFromTime() {
+
+ return this.validFromTime;
+ }
+
+ public Long getValidUntilDay() {
+
+ return this.validUntilDay;
+ }
+
+ public Long getValidUntilTime() {
+
+ return this.validUntilTime;
+ }
+
+ public List<Long> getActivatedDay() {
+
+ return this.activatedDay;
+ }
+
+ public TravelClassType getClassCode() {
+
+ if (classCode == null) {
+ return TravelClassType.second;
+ }
+
+ return this.classCode;
+ }
+
+ public String getServiceLevel() {
+
+ return this.serviceLevel;
+ }
+
+ public List<Long> getCarriersNum() {
+
+ return this.carrierNum;
+ }
+
+ public List<String> getCarriersIA5() {
+
+ return this.carrierIA5;
+ }
+
+ public List<Long> getIncludedServiceBrands() {
+
+ return this.includedServiceBrands;
+ }
+
+ public List<Long> getExcludedServiceBrands() {
+
+ return this.excludedServiceBrands;
+ }
+
+ public List<TariffType> getTariffs() {
+
+ return this.tariffs;
+ }
+
+ public String getInfoText() {
+
+ return this.infoText;
+ }
+
+ public List<IncludedOpenTicketType> getIncludedAddOns() {
+
+ return this.includedAddOns;
+ }
+
+ public LuggageRestrictionType getLuggage() {
+
+ return this.luggage;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setReferenceNum(Long referenceNum) {
+ this.referenceNum = Asn1BigInteger.toAsn1(referenceNum);
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setExtIssuerId(Long extIssuerId) {
+
+ this.externalIssuerId = Asn1BigInteger.toAsn1(extIssuerId);
+ }
+
+ public void setIssuerAutorizationId(Long issuerAutorizationId) {
+
+ this.issuerAutorizationId = Asn1BigInteger.toAsn1(issuerAutorizationId);
+ }
+
+ public void setReturnIncluded(Boolean returnIncluded) {
+
+ this.returnIncluded = returnIncluded;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setFromStationNum(Long fromStationNum) {
+
+ this.fromStationNum = fromStationNum;
+ }
+
+ public void setFromStationIA5(String fromStationIA5) {
+
+ this.fromStationIA5 = fromStationIA5;
+ }
+
+ public void setToStationNum(Long toStationNum) {
+
+ this.toStationNum = toStationNum;
+ }
+
+ public void setToStationIA5(String toStationIA5) {
+
+ this.toStationIA5 = toStationIA5;
+ }
+
+ public void setFromStationNameUTF8(String fromStationNameUTF8) {
+
+ this.fromStationNameUTF8 = fromStationNameUTF8;
+ }
+
+ public void setToStationNameUTF8(String toStationNameUTF8) {
+
+ this.toStationNameUTF8 = toStationNameUTF8;
+ }
+
+ public void setValidRegionDesc(String validRegionDesc) {
+
+ this.validRegionDesc = validRegionDesc;
+ }
+
+ public void setValidRegion(SequenceOfRegionalValidityType validRegion) {
+
+ this.validRegion = validRegion;
+ }
+
+ public void setReturnDescription(ReturnRouteDescriptionType returnDescription) {
+
+ this.returnDescription = returnDescription;
+ }
+
+ public void setValidFromDay(Long validFromDay) {
+
+ this.validFromDay = validFromDay;
+ }
+
+ public void setValidFromTime(Long validFromTime) {
+
+ this.validFromTime = validFromTime;
+ }
+
+ public void setValidUntilDay(Long validUntilDay) {
+
+ this.validUntilDay = validUntilDay;
+ }
+
+ public void setValidUntilTime(Long validUntilTime) {
+
+ this.validUntilTime = validUntilTime;
+ }
+
+ public void setActivatedDay(SequenceOfActivatedDays activatedDay) {
+
+ this.activatedDay = activatedDay;
+ }
+
+ public void setClassCode(TravelClassType classCode) {
+
+ this.classCode = classCode;
+ }
+
+ public void setServiceLevel(String serviceLevel) {
+
+ this.serviceLevel = serviceLevel;
+ }
+
+ public void setCarriersNum(SequenceOfCarrierNum carriersNum) {
+
+ this.carrierNum = carriersNum;
+ }
+
+ public void setCarriersIA5(SequenceOfStringIA5 carriersIA5) {
+
+ this.carrierIA5 = carriersIA5;
+ }
+
+ public void setIncludedServiceBrands(SequenceOfServiceBrands includedServiceBrands) {
+
+ this.includedServiceBrands = includedServiceBrands;
+ }
+
+ public void setExcludedServiceBrands(SequenceOfServiceBrands excludedServiceBrands) {
+
+ this.excludedServiceBrands = excludedServiceBrands;
+ }
+
+ public void setTariffs(SequenceOfTariffType tariffs) {
+
+ this.tariffs = tariffs;
+ }
+
+ public void setInfoText(String infoText) {
+
+ this.infoText = infoText;
+ }
+
+ public void setIncludedAddOns(SequenceOfIncludedOpenTicketType includedAddOns) {
+
+ this.includedAddOns = includedAddOns;
+ }
+
+ public void setLuggage(LuggageRestrictionType luggage) {
+
+ this.luggage = luggage;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public Long getPrice() {
+ return Asn1BigInteger.toLong(price);
+ }
+
+ public void setPrice(Long price) {
+ this.price = Asn1BigInteger.toAsn1(price);
+ }
+
+ public SequenceOfVatDetail getVatDetails() {
+ return vatDetails;
+ }
+
+ public void setVatDetails(SequenceOfVatDetail vatDetails) {
+ this.vatDetails = vatDetails;
+ }
+
+ public void addVatDetail(VatDetailType vatDetail) {
+ if (this.vatDetails == null) {
+ this.vatDetails = new SequenceOfVatDetail();
+ }
+ this.vatDetails.add(vatDetail);
+ }
+
+ public void setValidityDates (Date fromDate, Date untilDate, Date issuingDate){
+
+ if (issuingDate == null || fromDate == null) return;
+
+ this.validFromDay = DateTimeUtils.getDateDifference(issuingDate,fromDate);
+ this.validFromTime = DateTimeUtils.getTime(fromDate);
+
+ if (untilDate != null){
+ this.validUntilDay = DateTimeUtils.getDateDifference(fromDate, untilDate);
+ this.validUntilTime = DateTimeUtils.getTime(untilDate);
+ }
+
+ }
+
+ public Date getValidFromDate(Date issuingDate){
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay, this.validFromTime);
+
+ }
+
+ public Date getValidUntilDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validUntilDay == null) {
+ return null;
+ }
+
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime);
+
+ }
+
+
+
+ public void setActivatedDays(Collection<Date> dates, Date issuingDate){
+
+ if (this.activatedDay != null) {
+ this.activatedDay.clear();
+ } else {
+ this.activatedDay= new SequenceOfActivatedDays();
+ }
+
+ if (dates != null && !dates.isEmpty()) {
+
+ for (Date day : dates) {
+ this.addActivatedDay(issuingDate, day);
+ }
+
+ }
+
+ }
+
+ public void addActivatedDay(Date issuingDate, Date day){
+
+ Long dayDiff = DateTimeUtils.getDateDifference(issuingDate, day);
+
+ if (this.activatedDay == null) {
+ this.activatedDay = new SequenceOfActivatedDays();
+ }
+
+ if (dayDiff != null) {
+ this.activatedDay.add(dayDiff);
+ }
+
+ }
+
+ public Collection<Date> getActivatedDays(Date issuingDate) {
+
+ if (this.activatedDay == null) return null;
+
+ ArrayList<Date> dates = new ArrayList<Date>();
+
+ for (Long diff: this.getActivatedDay()) {
+
+ Date day = DateTimeUtils.getDate(issuingDate, diff, null);
+
+ if (day != null) {
+ dates.add(day);
+ }
+
+ }
+
+ return dates;
+
+ }
+ public Long getValidFromUTCOffset() {
+ return validFromUTCOffset;
+ }
+
+ public void setValidFromUTCOffset(Long validFromUTCOffset) {
+ this.validFromUTCOffset = validFromUTCOffset;
+ }
+
+ public Long getValidUntilUTCOffset() {
+ return validUntilUTCOffset;
+ }
+
+ public void setValidUntilUTCOffset(Long validUntilUTCOffset) {
+ this.validUntilUTCOffset = validUntilUTCOffset;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/ParkingGroundData.java b/src/org/uic/barcode/ticket/api/asn/omv1/ParkingGroundData.java new file mode 100644 index 0000000..b6be1a4 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/ParkingGroundData.java @@ -0,0 +1,363 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.Date;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+@HasExtensionMarker
+public class ParkingGroundData extends Object {
+ public ParkingGroundData() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 2)
+ @RestrictedString(CharacterRestriction.IA5String)
+ public String parkingGroundId;
+
+ @FieldOrder(order = 3)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long fromParkingDate;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long toParkingDate;
+
+ @FieldOrder(order = 5)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 6)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 7)
+ @IntRange(minValue=0,maxValue=32000)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 8)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 9)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String accessCode;
+
+ @FieldOrder(order = 10)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ public String location;
+
+ @FieldOrder(order = 11)
+ @Asn1Default("stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 12)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long stationNum;
+
+ @FieldOrder(order = 13)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String stationIA5;
+
+ @FieldOrder(order = 14)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String specialInformation;
+
+ @FieldOrder(order = 15)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String entryTrack;
+
+ @FieldOrder(order = 16)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String numberPlate;
+
+ @FieldOrder(order = 17)
+ @Asn1Optional Asn1BigInteger price;
+
+ @FieldOrder(order = 18)
+ @Asn1Optional SequenceOfVatDetail vatDetails;
+
+ @FieldOrder(order = 19)
+ @Asn1Optional public ExtensionData extension;
+
+
+
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Asn1BigInteger getReferenceNum() {
+
+ return this.referenceNum;
+ }
+
+ public String getParkingGroundId() {
+
+ return this.parkingGroundId;
+ }
+
+ public Long getFromParkingDate() {
+
+ return this.fromParkingDate;
+ }
+
+ public Long getToParkingDate() {
+
+ return this.toParkingDate;
+ }
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+
+ return this.productIdIA5;
+ }
+
+ public String getAccessCode() {
+
+ return this.accessCode;
+ }
+
+ public String getLocation() {
+
+ return this.location;
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUIC;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public Long getStationNum() {
+
+ return this.stationNum;
+ }
+
+ public String getStationIA5() {
+
+ return this.stationIA5;
+ }
+
+ public String getSpecialInformation() {
+
+ return this.specialInformation;
+ }
+
+ public String getEntryTrack() {
+
+ return this.entryTrack;
+ }
+
+ public String getNumberPlate() {
+
+ return this.numberPlate;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setReferenceNum(Asn1BigInteger referenceNum) {
+
+ this.referenceNum = referenceNum;
+ }
+
+ public void setParkingGroundId(String parkingGroundId) {
+
+ this.parkingGroundId = parkingGroundId;
+ }
+
+ public void setFromParkingDate(Long fromParkingDate) {
+
+ this.fromParkingDate = fromParkingDate;
+ }
+
+ public void setToParkingDate(Long toParkingDate) {
+
+ this.toParkingDate = toParkingDate;
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setAccessCode(String accessCode) {
+
+ this.accessCode = accessCode;
+ }
+
+ public void setLocation(String location) {
+
+ this.location = location;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setStationNum(Long stationNum) {
+
+ this.stationNum = stationNum;
+ }
+
+ public void setStationIA5(String stationIA5) {
+
+ this.stationIA5 = stationIA5;
+ }
+
+ public void setSpecialInformation(String specialInformation) {
+
+ this.specialInformation = specialInformation;
+ }
+
+ public void setEntryTrack(String entryTrack) {
+
+ this.entryTrack = entryTrack;
+ }
+
+ public void setNumberPlate(String numberPlate) {
+
+ this.numberPlate = numberPlate;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public Long getPrice() {
+ return Asn1BigInteger.toLong(price);
+ }
+
+ public void setPrice(Long price) {
+ this.price = Asn1BigInteger.toAsn1(price);
+ }
+
+ public SequenceOfVatDetail getVatDetails() {
+ return vatDetails;
+ }
+
+ public void setVatDetails(SequenceOfVatDetail vatDetails) {
+ this.vatDetails = vatDetails;
+ }
+
+ public void addVatDetail(VatDetailType vatDetail) {
+ if (this.vatDetails == null) {
+ this.vatDetails = new SequenceOfVatDetail();
+ }
+ this.vatDetails.add(vatDetail);
+ }
+
+
+ public void setParkingDate (Date fromDate, Date issuingDate){
+
+ if (issuingDate == null || fromDate == null) return;
+
+ this.fromParkingDate = DateTimeUtils.getDateDifference(issuingDate,fromDate);
+
+ }
+
+ public Date getFromParkingDate(Date issuingDate){
+
+ return DateTimeUtils.getDate(issuingDate, this.fromParkingDate, null);
+
+ }
+
+ public Date getToParkingDate(Date issuingDate) {
+
+ if ( this.toParkingDate == null) return null;
+
+ return DateTimeUtils.getDate(issuingDate, this.fromParkingDate + this.toParkingDate, null);
+
+ }
+
+ public void setParkingDates(Date fromDate, Date toDate, Date issuingDate) {
+
+ if (issuingDate == null || fromDate == null) return;
+
+ this.fromParkingDate = DateTimeUtils.getDateDifference(issuingDate,fromDate);
+
+
+ if (toDate != null) {
+ this.toParkingDate = DateTimeUtils.getDateDifference(fromDate,toDate);
+
+ }
+
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/PassData.java b/src/org/uic/barcode/ticket/api/asn/omv1/PassData.java new file mode 100644 index 0000000..6a56a40 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/PassData.java @@ -0,0 +1,590 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+
+@Sequence
+@HasExtensionMarker
+public class PassData extends Object {
+ public PassData() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 6)
+ @IntRange(minValue=1,maxValue=250)
+ @Asn1Optional public Long passType;
+
+ @FieldOrder(order = 7)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String passDescription;
+
+ @FieldOrder(order = 8)
+ @Asn1Default (value="second")
+ @Asn1Optional public TravelClassType classCode;
+
+ @FieldOrder(order = 9)
+ @IntRange(minValue=-1,maxValue=700)
+ @Asn1Optional public Long validFromDay;
+
+ @FieldOrder(order = 10)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long validFromTime;
+
+ @FieldOrder(order = 11)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validFromUTCOffset;
+
+ @FieldOrder(order = 12)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long validUntilDay;
+
+ @FieldOrder(order = 13)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long validUntilTime;
+
+ @FieldOrder(order = 14)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validUntilUTCOffset;
+
+ @FieldOrder(order = 15)
+ @Asn1Optional public ValidityPeriodDetailType validityPeriodDetails;
+
+ @FieldOrder(order = 16)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long numberOfValidityDays;
+
+ @FieldOrder(order = 17)
+ @IntRange(minValue=1,maxValue=250)
+ @Asn1Optional public Long numberOfPossibleTrips;
+
+ @FieldOrder(order = 18)
+ @IntRange(minValue=1,maxValue=250)
+ @Asn1Optional public Long numberOfDaysOfTravel;
+
+ @FieldOrder(order = 19)
+ @Asn1Optional public SequenceOfActivatedDays activatedDay;
+
+ @FieldOrder(order = 20)
+ @Asn1Optional public SequenceOfCountries countries;
+
+ @FieldOrder(order = 21)
+ @Asn1Optional public SequenceOfCarrierNum includedCarriersNum;
+
+ @FieldOrder(order = 22)
+ @Asn1Optional public SequenceOfStringIA5 includedCarriersIA5;
+
+ @FieldOrder(order = 23)
+ @Asn1Optional public SequenceOfCarrierNum excludedCarriersNum;
+
+ @FieldOrder(order = 24)
+ @Asn1Optional public SequenceOfStringIA5 excludedCarriersIA5;
+
+ @FieldOrder(order = 25)
+ @Asn1Optional public SequenceOfServiceBrands includedServiceBrands;
+
+ @FieldOrder(order = 26)
+ @Asn1Optional public SequenceOfServiceBrands excludedServiceBrands;
+
+ @FieldOrder(order = 27)
+ @Asn1Optional public SequenceOfRegionalValidityType validRegion;
+
+ @FieldOrder(order = 28)
+ @Asn1Optional public SequenceOfTariffType tariffs;
+
+ @FieldOrder(order = 29)
+ @Asn1Optional Asn1BigInteger price;
+
+ @FieldOrder(order = 30)
+ @Asn1Optional SequenceOfVatDetail vatDetails;
+
+ @FieldOrder(order = 31)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String infoText;
+
+ @FieldOrder(order = 32)
+ @Asn1Optional public ExtensionData extension;
+
+
+
+
+
+ public Asn1BigInteger getReferenceNum() {
+
+ return this.referenceNum;
+ }
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+
+ return this.productIdIA5;
+ }
+
+ public Long getPassType() {
+
+ return this.passType;
+ }
+
+ public String getPassDescription() {
+
+ return this.passDescription;
+ }
+
+ public TravelClassType getClassCode() {
+
+ if (classCode == null){
+ return TravelClassType.second;
+ }
+
+ return this.classCode;
+ }
+
+ public Long getValidFromDay() {
+
+ return this.validFromDay;
+ }
+
+ public Long getValidFromTime() {
+
+ return this.validFromTime;
+ }
+
+ public Long getValidUntilDay() {
+
+ return this.validUntilDay;
+ }
+
+ public Long getValidUntilTime() {
+
+ return this.validUntilTime;
+ }
+
+ public ValidityPeriodDetailType getValidityPeriodDetails() {
+
+ return this.validityPeriodDetails;
+ }
+
+ public Long getNumberOfValidityDays() {
+
+ return this.numberOfValidityDays;
+ }
+
+ public Long getNumberOfPossibleTrips() {
+
+ return this.numberOfPossibleTrips;
+ }
+
+ public Long getNumberOfDaysOfTravel() {
+
+ return this.numberOfDaysOfTravel;
+ }
+
+ public List<Long> getActivatedDay() {
+
+ return this.activatedDay;
+ }
+
+ public List<Long> getCountries() {
+
+ return this.countries;
+ }
+
+ public List<Long> getIncludedCarriersNum() {
+
+ return this.includedCarriersNum;
+ }
+
+ public List<String> getIncludedCarriersIA5() {
+
+ return this.includedCarriersIA5;
+ }
+
+ public List<Long> getExcludedCarriersNum() {
+
+ return this.excludedCarriersNum;
+ }
+
+ public SequenceOfStringIA5 getExcludedCarriersIA5() {
+
+ return this.excludedCarriersIA5;
+ }
+
+ public SequenceOfServiceBrands getIncludedServiceBrands() {
+
+ return this.includedServiceBrands;
+ }
+
+ public SequenceOfServiceBrands getExcludedServiceBrands() {
+
+ return this.excludedServiceBrands;
+ }
+
+ public List<RegionalValidityType> getValidRegion() {
+
+ return this.validRegion;
+ }
+
+ public List<TariffType> getTariffs() {
+
+ return this.tariffs;
+ }
+
+ public String getInfoText() {
+
+ return this.infoText;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setReferenceNum(Asn1BigInteger referenceNum) {
+
+ this.referenceNum = referenceNum;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setPassType(Long passType) {
+
+ this.passType = passType;
+ }
+
+ public void setPassDescription(String passDescription) {
+
+ this.passDescription = passDescription;
+ }
+
+ public void setClassCode(TravelClassType classCode) {
+
+ this.classCode = classCode;
+ }
+
+ public void setValidFromDay(Long validFromDay) {
+
+ this.validFromDay = validFromDay;
+ }
+
+ public void setValidFromTime(Long validFromTime) {
+
+ this.validFromTime = validFromTime;
+ }
+
+ public void setValidUntilDay(Long validUntilDay) {
+
+ this.validUntilDay = validUntilDay;
+ }
+
+ public void setValidUntilTime(Long validUntilTime) {
+
+ this.validUntilTime = validUntilTime;
+ }
+
+ public void setValidityPeriodDetails(ValidityPeriodDetailType validityPeriodDetails) {
+
+ this.validityPeriodDetails = validityPeriodDetails;
+ }
+
+ public void setNumberOfValidityDays(Long numberOfValidityDays) {
+
+ this.numberOfValidityDays = numberOfValidityDays;
+ }
+
+ public void setNumberOfPossibleTrips(Long numberOfPossibleTrips) {
+
+ this.numberOfPossibleTrips = numberOfPossibleTrips;
+ }
+
+ public void setNumberOfDaysOfTravel(Long numberOfDaysOfTravel) {
+
+ this.numberOfDaysOfTravel = numberOfDaysOfTravel;
+ }
+
+ public void setActivatedDay(SequenceOfActivatedDays activatedDay) {
+
+ this.activatedDay = activatedDay;
+ }
+
+ public void setCountries(SequenceOfCountries countries) {
+
+ this.countries = countries;
+ }
+
+ public void setIncludedCarriersNum(SequenceOfCarrierNum includedCarriersNum) {
+
+ this.includedCarriersNum = includedCarriersNum;
+ }
+
+ public void setIncludedCarriersIA5(SequenceOfStringIA5 includedCarriersIA5) {
+
+ this.includedCarriersIA5 = includedCarriersIA5;
+ }
+
+ public void setExcludedCarriersNum(SequenceOfCarrierNum excludedCarriersNum) {
+
+ this.excludedCarriersNum = excludedCarriersNum;
+ }
+
+ public void setExcludedCarriersIA5(SequenceOfStringIA5 excludedCarriersIA5) {
+
+ this.excludedCarriersIA5 = excludedCarriersIA5;
+ }
+
+ public void setIncludedServiceBrands(SequenceOfServiceBrands includedServiceBrands) {
+
+ this.includedServiceBrands = includedServiceBrands;
+ }
+
+ public void setExcludedServiceBrands(SequenceOfServiceBrands excludedServiceBrands) {
+
+ this.excludedServiceBrands = excludedServiceBrands;
+ }
+
+ public void setValidRegion(SequenceOfRegionalValidityType validRegion) {
+
+ this.validRegion = validRegion;
+ }
+
+ public void setTariffs(SequenceOfTariffType tariffs) {
+
+ this.tariffs = tariffs;
+ }
+
+ public void setInfoText(String infoText) {
+
+ this.infoText = infoText;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public Long getPrice() {
+ return Asn1BigInteger.toLong(price);
+ }
+
+ public void setPrice(Long price) {
+ this.price = Asn1BigInteger.toAsn1(price);
+ }
+
+ public SequenceOfVatDetail getVatDetails() {
+ return vatDetails;
+ }
+
+ public void setVatDetails(SequenceOfVatDetail vatDetails) {
+ this.vatDetails = vatDetails;
+ }
+
+ public void addVatDetail(VatDetailType vatDetail) {
+ if (this.vatDetails == null) {
+ this.vatDetails = new SequenceOfVatDetail();
+ }
+ this.vatDetails.add(vatDetail);
+ }
+
+ public void setValidityDates (Date fromDate, Date untilDate, Date issuingDate){
+
+ if (issuingDate == null || fromDate == null) return;
+
+ this.validFromDay = DateTimeUtils.getDateDifference(issuingDate,fromDate);
+ this.validFromTime = DateTimeUtils.getTime(fromDate);
+
+ if (untilDate != null){
+ this.validUntilDay = DateTimeUtils.getDateDifference(fromDate, untilDate);
+ this.validUntilTime = DateTimeUtils.getTime(untilDate);
+ }
+
+ }
+
+ public Date getValidFromDate(Date issuingDate){
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay, this.validFromTime);
+
+ }
+
+ public Date getValidUntilDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validUntilDay == null) {
+ return null;
+ }
+
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime);
+
+ }
+
+ public void setActivatedDays(Collection<Date> dates, Date issuingDate){
+
+ if (this.activatedDay != null) {
+ this.activatedDay.clear();
+ } else {
+ this.activatedDay= new SequenceOfActivatedDays();
+ }
+
+ if (dates != null && !dates.isEmpty()) {
+
+ for (Date day : dates) {
+ this.addActivatedDay(issuingDate, day);
+ }
+
+ }
+
+ }
+
+ public void addActivatedDay(Date issuingDate, Date day){
+
+ Long dayDiff = DateTimeUtils.getDateDifference(issuingDate, day);
+
+ if (this.activatedDay == null) {
+ this.activatedDay = new SequenceOfActivatedDays();
+ }
+
+ if (dayDiff != null) {
+ this.activatedDay.add(dayDiff);
+ }
+
+ }
+
+ public Collection<Date> getActivatedDays(Date issuingDate) {
+
+ if (this.activatedDay == null) return null;
+
+ ArrayList<Date> dates = new ArrayList<Date>();
+
+ for (Long diff: this.getActivatedDay()) {
+
+ Date day = DateTimeUtils.getDate(issuingDate, diff, null);
+
+ if (day != null) {
+ dates.add(day);
+ }
+
+ }
+
+ return dates;
+
+ }
+
+ public Long getValidFromUTCOffset() {
+ return validFromUTCOffset;
+ }
+
+ public void setValidFromUTCOffset(Long validFromUTCOffset) {
+ this.validFromUTCOffset = validFromUTCOffset;
+ }
+
+ public Long getValidUntilUTCOffset() {
+ return validUntilUTCOffset;
+ }
+
+ public void setValidUntilUTCOffset(Long validUntilUTCOffset) {
+ this.validUntilUTCOffset = validUntilUTCOffset;
+ }
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/PassengerType.java b/src/org/uic/barcode/ticket/api/asn/omv1/PassengerType.java new file mode 100644 index 0000000..bb683bf --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/PassengerType.java @@ -0,0 +1,46 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum PassengerType {
+ adult("adult"),
+ senior("senior"),
+ child("child"),
+ youth("youth"),
+ dog("dog"),
+ bicycle("bicycle"),
+ freeAddonPassenger("freeAddonPassenger"),
+ freeAddonChild("freeAddonChild");
+
+ public String text;
+
+ PassengerType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/PlacesType.java b/src/org/uic/barcode/ticket/api/asn/omv1/PlacesType.java new file mode 100644 index 0000000..6b1567c --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/PlacesType.java @@ -0,0 +1,131 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+
+@Sequence
+public class PlacesType extends Object {
+ public PlacesType() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String coach;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String placeString;
+
+ @FieldOrder(order = 2)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String placeDescription;
+
+ @FieldOrder(order = 3)
+ @Asn1Optional public SequenceOfStringIA5 placeIA5;
+
+ @FieldOrder(order = 4)
+ @Asn1Optional public SequenceOfPlaceNum placeNum;
+
+
+
+ public String getCoach() {
+
+ return this.coach;
+ }
+
+ public String getPlaceString() {
+
+ return this.placeString;
+ }
+
+ public String getPlaceDescription() {
+
+ return this.placeDescription;
+ }
+
+ public SequenceOfStringIA5 getPlaceIA5() {
+
+ return this.placeIA5;
+ }
+
+ public SequenceOfPlaceNum getPlaceNum() {
+
+ return this.placeNum;
+ }
+
+ public void setCoach(String coach) {
+
+ this.coach = coach;
+ }
+
+ public void setPlaceString(String placeString) {
+
+ this.placeString = placeString;
+ }
+
+ public void setPlaceDescription(String placeDescription) {
+
+ this.placeDescription = placeDescription;
+ }
+
+ public void setPlaceIA5(SequenceOfStringIA5 placeIA5) {
+
+ this.placeIA5 = placeIA5;
+ }
+
+ public void setPlaceNum(SequenceOfPlaceNum placeNum) {
+
+ this.placeNum = placeNum;
+ }
+
+ @Override
+ public boolean equals(Object anObject) {
+ if (this == anObject) return true;
+ if ((anObject == null) || (anObject.getClass() != this.getClass())) return false;
+
+ PlacesType comparator = (PlacesType)anObject;
+
+ if ((this.getCoach() != comparator.getCoach()) && ((this.getCoach() == null) || (! this.getCoach().equals(comparator.getCoach())))) return false;
+ if ((this.getPlaceString() != comparator.getPlaceString()) && ((this.getPlaceString() == null) || (! this.getPlaceString().equals(comparator.getPlaceString())))) return false;
+ if ((this.getPlaceDescription() != comparator.getPlaceDescription()) && ((this.getPlaceDescription() == null) || (! this.getPlaceDescription().equals(comparator.getPlaceDescription())))) return false;
+ if ((this.getPlaceIA5() != comparator.getPlaceIA5()) && ((this.getPlaceIA5() == null) || (! this.getPlaceIA5().equals(comparator.getPlaceIA5())))) return false;
+ if ((this.getPlaceNum() != comparator.getPlaceNum()) && ((this.getPlaceNum() == null) || (! this.getPlaceNum().equals(comparator.getPlaceNum())))) return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 5477;
+
+ hash = 3547 * hash + (null == this.getCoach() ? 0 : this.getCoach().hashCode());
+ hash = 7321 * hash + (null == this.getPlaceString() ? 0 : this.getPlaceString().hashCode());
+ hash = 2083 * hash + (null == this.getPlaceDescription() ? 0 : this.getPlaceDescription().hashCode());
+ hash = 881 * hash + (null == this.getPlaceIA5() ? 0 : this.getPlaceIA5().hashCode());
+ hash = 6679 * hash + (null == this.getPlaceNum() ? 0 : this.getPlaceNum().hashCode());
+ return hash;
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/PolygoneType.java b/src/org/uic/barcode/ticket/api/asn/omv1/PolygoneType.java new file mode 100644 index 0000000..24b05cf --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/PolygoneType.java @@ -0,0 +1,58 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+public class PolygoneType extends Object {
+ public PolygoneType() {
+ }
+
+ @FieldOrder(order = 0)
+ public GeoCoordinateType firstEdge;
+
+ @FieldOrder(order = 1)
+ public SequenceOfDeltaCoordinates edges;
+
+
+ public GeoCoordinateType getFirstEdge() {
+
+ return this.firstEdge;
+ }
+
+ public SequenceOfDeltaCoordinates getEdges() {
+
+ return this.edges;
+ }
+
+ public void setFirstEdge(GeoCoordinateType firstEdge) {
+
+ this.firstEdge = firstEdge;
+ }
+
+ public void setEdges(SequenceOfDeltaCoordinates edges) {
+
+ this.edges = edges;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/PriceTypeType.java b/src/org/uic/barcode/ticket/api/asn/omv1/PriceTypeType.java new file mode 100644 index 0000000..b75f3c7 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/PriceTypeType.java @@ -0,0 +1,39 @@ +/*
+ * 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.asn.omv1;
+
+public enum PriceTypeType {
+ noPrice("noPrice"),
+ reservationFee("reservationFee"),
+ supplement("supplement"),
+ travelPrice("travelPrice");
+
+
+ public String text;
+
+ PriceTypeType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/RegionalValidityType.java b/src/org/uic/barcode/ticket/api/asn/omv1/RegionalValidityType.java new file mode 100644 index 0000000..f35de07 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/RegionalValidityType.java @@ -0,0 +1,100 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.Choice;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+
+@Choice
+@HasExtensionMarker
+public class RegionalValidityType extends Object {
+ public RegionalValidityType() {
+ }
+
+ @FieldOrder(order = 0)
+ public TrainLinkType trainLink;
+
+ @FieldOrder(order = 1)
+ public ViaStationType viaStations;
+
+ @FieldOrder(order = 2)
+ public ZoneType zones;
+
+ @FieldOrder(order = 3)
+ public LineType lines;
+
+ @FieldOrder(order = 4)
+ public PolygoneType polygone;
+
+
+ public TrainLinkType getTrainLink() {
+
+ return this.trainLink;
+ }
+
+ public ViaStationType getViaStations() {
+
+ return this.viaStations;
+ }
+
+ public ZoneType getZones() {
+
+ return this.zones;
+ }
+
+ public LineType getLines() {
+
+ return this.lines;
+ }
+
+ public PolygoneType getPolygone() {
+
+ return this.polygone;
+ }
+
+ public void setTrainLink(TrainLinkType trainLink) {
+
+ this.trainLink = trainLink;
+ }
+
+ public void setViaStations(ViaStationType viaStations) {
+
+ this.viaStations = viaStations;
+ }
+
+ public void setZones(ZoneType zones) {
+
+ this.zones = zones;
+ }
+
+ public void setLines(LineType lines) {
+
+ this.lines = lines;
+ }
+
+ public void setPolygone(PolygoneType polygone) {
+
+ this.polygone = polygone;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/RegisteredLuggageType.java b/src/org/uic/barcode/ticket/api/asn/omv1/RegisteredLuggageType.java new file mode 100644 index 0000000..442de07 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/RegisteredLuggageType.java @@ -0,0 +1,80 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+
+@Sequence
+@HasExtensionMarker
+public class RegisteredLuggageType extends Object {
+ public RegisteredLuggageType() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String registrationId;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue=1,maxValue=99)
+ @Asn1Optional public Long maxWeight;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=300)
+ @Asn1Optional public Long maxSize;
+
+ public String getRegistrationId() {
+
+ return this.registrationId;
+ }
+
+ public Long getMaxWeight() {
+
+ return this.maxWeight;
+ }
+
+ public Long getMaxSize() {
+
+ return this.maxSize;
+ }
+
+ public void setRegistrationId(String registrationId) {
+
+ this.registrationId = registrationId;
+ }
+
+ public void setMaxWeight(Long maxWeight) {
+
+ this.maxWeight = maxWeight;
+ }
+
+ public void setMaxSize(Long maxSize) {
+
+ this.maxSize = maxSize;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/ReservationData.java b/src/org/uic/barcode/ticket/api/asn/omv1/ReservationData.java new file mode 100644 index 0000000..73fa5aa --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/ReservationData.java @@ -0,0 +1,710 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.Date;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypes.SizeRange;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+
+@Sequence
+@HasExtensionMarker
+public class ReservationData extends Object {
+ public ReservationData() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public Asn1BigInteger trainNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String trainIA5;
+
+ @FieldOrder(order = 2)
+ @Asn1Default(value="0")
+ @IntRange(minValue=-1,maxValue=370)
+ @Asn1Optional public Long departureDate;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 4)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 5)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 6)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 7)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 8)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 9)
+ @IntRange(minValue=0,maxValue=32000)
+ @Asn1Optional public Long serviceBrand;
+
+ @FieldOrder(order = 10)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String serviceBrandAbrUTF8;
+
+ @FieldOrder(order = 11)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String serviceBrandNameUTF8;
+
+ @FieldOrder(order = 12)
+ @Asn1Default("seat")
+ @Asn1Optional public ServiceType service;
+
+ @FieldOrder(order = 13)
+ @Asn1Default("stationUICReservation")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 14)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long fromStationNum;
+
+ @FieldOrder(order = 15)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String fromStationIA5;
+
+ @FieldOrder(order = 16)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long toStationNum;
+
+ @FieldOrder(order = 17)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String toStationIA5;
+
+ @FieldOrder(order = 18)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String fromStationNameUTF8;
+
+ @FieldOrder(order = 19)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String toStationNameUTF8;
+
+ @FieldOrder(order = 20)
+ @IntRange(minValue=0,maxValue=1440)
+ public Long departureTime;
+
+ @FieldOrder(order = 21)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long departureUTCOffset;
+
+ @FieldOrder(order = 22)
+ @IntRange(minValue=-1,maxValue=20)
+ @Asn1Default(value="0")
+ @Asn1Optional public Long arrivalDate;
+
+ @FieldOrder(order = 23)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long arrivalTime;
+
+ @FieldOrder(order = 24)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long arrivalUTCOffset;
+
+ @FieldOrder(order = 25)
+ @Asn1Optional public SequenceOfCarrierNum carrierNum;
+
+ @FieldOrder(order = 26)
+ @Asn1Optional public SequenceOfStringIA5 carrierIA5;
+
+ @FieldOrder(order = 27)
+ @Asn1Default("second")
+ @Asn1Optional public TravelClassType classCode;
+
+ @FieldOrder(order = 28)
+ @SizeRange(minValue = 1, maxValue = 2)
+ @Asn1Optional public String serviceLevel;
+
+ @FieldOrder(order = 29)
+ @Asn1Optional public PlacesType places;
+
+ @FieldOrder(order = 30)
+ @Asn1Optional public PlacesType additionalPlaces;
+
+ @FieldOrder(order = 31)
+ @Asn1Optional public PlacesType bicyclePlaces;
+
+ @FieldOrder(order = 32)
+ @Asn1Optional public CompartmentDetailsType compartmentDetails;
+
+ @FieldOrder(order = 33)
+ @IntRange(minValue=0,maxValue=200)
+ @Asn1Default(value="0")
+ @Asn1Optional public Long numberOfOverbooked;
+
+ @FieldOrder(order = 34)
+ @Asn1Optional public SequenceOfBerthDetailData berth;
+
+ @FieldOrder(order = 35)
+ @Asn1Optional public SequenceOfTariffType tariff;
+
+ @FieldOrder(order = 36)
+ @Asn1Default("travelPrice")
+ @Asn1Optional public PriceTypeType priceType;
+
+ @FieldOrder(order = 37)
+ @Asn1Optional Asn1BigInteger price;
+
+ @FieldOrder(order = 38)
+ @Asn1Optional SequenceOfVatDetail vatDetails;
+
+ @FieldOrder(order = 39)
+ @IntRange(minValue=0,maxValue=9)
+ @Asn1Default("0")
+ @Asn1Optional public Long typeOfSupplement;
+
+ @FieldOrder(order = 40)
+ @IntRange(minValue=0,maxValue=200)
+ @Asn1Default("0")
+ @Asn1Optional public Long numberOfSupplements;
+
+ @FieldOrder(order = 41)
+ @Asn1Optional public LuggageRestrictionType luggage;
+
+ @FieldOrder(order = 42)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String infoText;
+
+ @FieldOrder(order = 43)
+ @Asn1Optional public ExtensionData extension;
+
+ public Long getTrainNum() {
+
+ return Asn1BigInteger.toLong(this.trainNum);
+ }
+
+ public String getTrainIA5() {
+ return this.trainIA5;
+ }
+
+ public Long getDepartureDate() {
+ return this.departureDate;
+ }
+
+ public String getReferenceIA5() {
+ return this.referenceIA5;
+ }
+
+ public Long getReferenceNum() {
+ return Asn1BigInteger.toLong(this.referenceNum);
+ }
+
+ public Long getProductOwnerNum() {
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+ return this.productIdIA5;
+ }
+
+ public Long getServiceBrand() {
+ return this.serviceBrand;
+ }
+
+ public String getServiceBrandAbrUTF8() {
+ return this.serviceBrandAbrUTF8;
+ }
+
+ public String getServiceBrandNameUTF8() {
+ return this.serviceBrandNameUTF8;
+ }
+
+ public ServiceType getService() {
+
+ if (service == null){
+ return ServiceType.seat;
+ }
+
+ return this.service;
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUICReservation;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public Long getFromStationNum() {
+
+ return this.fromStationNum;
+ }
+
+ public String getFromStationIA5() {
+
+ return this.fromStationIA5;
+ }
+
+ public Long getToStationNum() {
+
+ return this.toStationNum;
+ }
+
+ public String getToStationIA5() {
+
+ return this.toStationIA5;
+ }
+
+ public String getFromStationNameUTF8() {
+
+ return this.fromStationNameUTF8;
+ }
+
+ public String getToStationNameUTF8() {
+
+ return this.toStationNameUTF8;
+ }
+
+ public Long getDepartureTime() {
+
+ return this.departureTime;
+ }
+
+ public Long getArrivalDate() {
+
+ if (arrivalDate == null) {
+ return new Long(0);
+ }
+
+ return this.arrivalDate;
+ }
+
+ public Long getArrivalTime() {
+
+ return this.arrivalTime;
+ }
+
+ public List<Long> getCarrierNum() {
+
+ return this.carrierNum;
+ }
+
+ public List<String> getCarrierIA5() {
+
+ return this.carrierIA5;
+ }
+
+ public TravelClassType getClassCode() {
+
+
+ if (classCode == null) {
+ return TravelClassType.second;
+ }
+
+ return this.classCode;
+ }
+
+ public String getServiceLevel() {
+
+ return this.serviceLevel;
+ }
+
+ public PlacesType getPlaces() {
+
+ return this.places;
+ }
+
+ public PlacesType getAdditionalPlaces() {
+
+ return this.additionalPlaces;
+ }
+
+ public PlacesType getBicyclePlaces() {
+
+ return this.bicyclePlaces;
+ }
+
+ public CompartmentDetailsType getCompartmentDetails() {
+
+ return this.compartmentDetails;
+ }
+
+ public Long getNumberOfOverbooked() {
+
+ return this.numberOfOverbooked;
+ }
+
+ public List<BerthDetailData> getBerth() {
+
+ return this.berth;
+ }
+
+ public List<TariffType> getTariff() {
+
+ return this.tariff;
+ }
+
+ public PriceTypeType getPriceType() {
+
+ if (priceType == null) {
+ return PriceTypeType.travelPrice;
+ }
+
+ return this.priceType;
+ }
+
+ public Long getTypeOfSupplement() {
+
+ if (typeOfSupplement == null){
+ return new Long(0);
+ }
+
+
+ return this.typeOfSupplement;
+ }
+
+ public Long getNumberOfSupplements() {
+
+ if (numberOfSupplements == null) {
+ return new Long(0);
+ }
+
+ return this.numberOfSupplements;
+ }
+
+ public LuggageRestrictionType getLuggage() {
+
+ return this.luggage;
+ }
+
+ public String getInfoText() {
+
+ return this.infoText;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setTrainNum(Long trainNum) {
+
+ this.trainNum = Asn1BigInteger.toAsn1(trainNum);
+ }
+
+ public void setTrainIA5(String trainIA5) {
+
+ this.trainIA5 = trainIA5;
+ }
+
+ public void setDepartureDate(Long departureDate) {
+
+ this.departureDate = departureDate;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setReferenceNum(Long referenceNum) {
+ this.referenceNum = Asn1BigInteger.toAsn1(referenceNum);
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setServiceBrand(Long serviceBrand) {
+
+ this.serviceBrand = serviceBrand;
+ }
+
+ public void setServiceBrandAbrUTF8(String serviceBrandAbrUTF8) {
+
+ this.serviceBrandAbrUTF8 = serviceBrandAbrUTF8;
+ }
+
+ public void setServiceBrandNameUTF8(String serviceBrandNameUTF8) {
+
+ this.serviceBrandNameUTF8 = serviceBrandNameUTF8;
+ }
+
+ public void setService(ServiceType service) {
+
+ this.service = service;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setFromStationNum(Long fromStationNum) {
+
+ this.fromStationNum = fromStationNum;
+ }
+
+ public void setFromStationIA5(String fromStationIA5) {
+
+ this.fromStationIA5 = fromStationIA5;
+ }
+
+ public void setToStationNum(Long toStationNum) {
+
+ this.toStationNum = toStationNum;
+ }
+
+ public void setToStationIA5(String toStationIA5) {
+
+ this.toStationIA5 = toStationIA5;
+ }
+
+ public void setFromStationNameUTF8(String fromStationNameUTF8) {
+
+ this.fromStationNameUTF8 = fromStationNameUTF8;
+ }
+
+ public void setToStationNameUTF8(String toStationNameUTF8) {
+
+ this.toStationNameUTF8 = toStationNameUTF8;
+ }
+
+ public void setDepartureTime(Long departureTime) {
+
+ this.departureTime = departureTime;
+ }
+
+ public void setArrivalDate(Long arrivalDate) {
+
+ this.arrivalDate = arrivalDate;
+ }
+
+ public void setArrivalTime(Long arrivalTime) {
+
+ this.arrivalTime = arrivalTime;
+ }
+
+ public void setCarrierNum(SequenceOfCarrierNum carrierNum) {
+
+ this.carrierNum = carrierNum;
+ }
+
+ public void setCarriersNum(List<Long> longs) {
+ if (longs == null) return;
+
+ this.carrierNum = new SequenceOfCarrierNum();
+ this.carrierNum.addAll(longs);
+ }
+
+ public void setCarrierIA5(SequenceOfStringIA5 carrierIA5) {
+
+ this.carrierIA5 = carrierIA5;
+ }
+
+ public void setClassCode(TravelClassType classCode) {
+
+ this.classCode = classCode;
+ }
+
+ public void setServiceLevel(String serviceLevel) {
+
+ this.serviceLevel = serviceLevel;
+ }
+
+ public void setPlaces(PlacesType places) {
+
+ this.places = places;
+ }
+
+ public void setAdditionalPlaces(PlacesType additionalPlaces) {
+
+ this.additionalPlaces = additionalPlaces;
+ }
+
+ public void setBicyclePlaces(PlacesType bicyclePlaces) {
+
+ this.bicyclePlaces = bicyclePlaces;
+ }
+
+ public void setCompartmentDetails(CompartmentDetailsType compartmentDetails) {
+
+ this.compartmentDetails = compartmentDetails;
+ }
+
+ public void setNumberOfOverbooked(Long numberOfOverbooked) {
+
+ this.numberOfOverbooked = numberOfOverbooked;
+ }
+
+ public void setBerth(SequenceOfBerthDetailData berth) {
+
+ this.berth = berth;
+ }
+
+ public void setTariff(SequenceOfTariffType tariff) {
+
+ this.tariff = tariff;
+ }
+
+ public void setPriceType(PriceTypeType priceType) {
+
+ this.priceType = priceType;
+ }
+
+ public void setTypeOfSupplement(Long typeOfSupplement) {
+
+ this.typeOfSupplement = typeOfSupplement;
+ }
+
+ public void setNumberOfSupplements(Long numberOfSupplements) {
+
+ this.numberOfSupplements = numberOfSupplements;
+ }
+
+ public void setLuggage(LuggageRestrictionType luggage) {
+
+ this.luggage = luggage;
+ }
+
+ public void setInfoText(String infoText) {
+
+ this.infoText = infoText;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public Long getPrice() {
+ return Asn1BigInteger.toLong(price);
+ }
+
+ public void setPrice(Long price) {
+ this.price = Asn1BigInteger.toAsn1(price);
+ }
+
+ public SequenceOfVatDetail getVatDetails() {
+ return vatDetails;
+ }
+
+ public void setVatDetails(SequenceOfVatDetail vatDetails) {
+ this.vatDetails = vatDetails;
+ }
+
+ public void addVatDetail(VatDetailType vatDetail) {
+ if (this.vatDetails == null) {
+ this.vatDetails = new SequenceOfVatDetail();
+ }
+ this.vatDetails.add(vatDetail);
+ }
+
+ public void setDepartureArrivalDates (Date departure, Date arrival, Date issuingDate){
+
+ if (issuingDate == null || departure == null) return;
+
+ this.departureDate = DateTimeUtils.getDateDifference(issuingDate,departure);
+ this.departureTime = DateTimeUtils.getTime(departure);
+
+ if (arrival != null){
+ this.arrivalDate = DateTimeUtils.getDateDifference(departure, arrival);
+ this.arrivalTime = DateTimeUtils.getTime(arrival);
+ }
+
+ }
+
+ public Date getDepartureDate(Date issuingDate){
+
+ return DateTimeUtils.getDate(issuingDate, this.departureDate, this.departureTime);
+
+ }
+
+ public Date getArrivalDate(Date issuingDate){
+
+ if (this.departureDate == null) {
+ this.departureDate = 0L;
+ }
+
+ if (this.arrivalDate == null) {
+ return null;
+ }
+
+ return DateTimeUtils.getDate(issuingDate, this.departureDate + this.arrivalDate, this.arrivalTime);
+ }
+
+ public Long getDepartureUTCOffset() {
+ return departureUTCOffset;
+ }
+
+ public void setDepartureUTCOffset(Long departureUTCOffset) {
+ this.departureUTCOffset = departureUTCOffset;
+ }
+
+ public Long getArrivalUTCOffset() {
+ return arrivalUTCOffset;
+ }
+
+ public void setArrivalUTCOffset(Long arrivalUTCOffset) {
+ this.arrivalUTCOffset = arrivalUTCOffset;
+ }
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/ReturnRouteDescriptionType.java b/src/org/uic/barcode/ticket/api/asn/omv1/ReturnRouteDescriptionType.java new file mode 100644 index 0000000..438c1fb --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/ReturnRouteDescriptionType.java @@ -0,0 +1,150 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+@HasExtensionMarker
+public class ReturnRouteDescriptionType extends Object {
+ public ReturnRouteDescriptionType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long fromStationNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String fromStationIA5;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long toStationNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String toStationIA5;
+
+ @FieldOrder(order = 4)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String fromStationNameUTF8;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String toStationNameUTF8;
+
+ @FieldOrder(order = 6)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String validReturnRegionDesc;
+
+ @FieldOrder(order = 7)
+ @Asn1Optional public SequenceOfRegionalValidityType validReturnRegion;
+
+ public Long getFromStationNum() {
+
+ return this.fromStationNum;
+ }
+
+ public String getFromStationIA5() {
+
+ return this.fromStationIA5;
+ }
+
+ public Long getToStationNum() {
+
+ return this.toStationNum;
+ }
+
+ public String getToStationIA5() {
+
+ return this.toStationIA5;
+ }
+
+ public String getFromStationNameUTF8() {
+
+ return this.fromStationNameUTF8;
+ }
+
+ public String getToStationNameUTF8() {
+
+ return this.toStationNameUTF8;
+ }
+
+ public String getValidReturnRegionDesc() {
+
+ return this.validReturnRegionDesc;
+ }
+
+ public List<RegionalValidityType> getValidReturnRegion() {
+
+ return this.validReturnRegion;
+ }
+
+ public void setFromStationNum(Long fromStationNum) {
+
+ this.fromStationNum = fromStationNum;
+ }
+
+ public void setFromStationIA5(String fromStationIA5) {
+
+ this.fromStationIA5 = fromStationIA5;
+ }
+
+ public void setToStationNum(Long toStationNum) {
+
+ this.toStationNum = toStationNum;
+ }
+
+ public void setToStationIA5(String toStationIA5) {
+
+ this.toStationIA5 = toStationIA5;
+ }
+
+ public void setFromStationNameUTF8(String fromStationNameUTF8) {
+
+ this.fromStationNameUTF8 = fromStationNameUTF8;
+ }
+
+ public void setToStationNameUTF8(String toStationNameUTF8) {
+
+ this.toStationNameUTF8 = toStationNameUTF8;
+ }
+
+ public void setValidReturnRegionDesc(String validReturnRegionDesc) {
+
+ this.validReturnRegionDesc = validReturnRegionDesc;
+ }
+
+ public void setValidReturnRegion(SequenceOfRegionalValidityType validReturnRegion) {
+
+ this.validReturnRegion = validReturnRegion;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/RoofRackType.java b/src/org/uic/barcode/ticket/api/asn/omv1/RoofRackType.java new file mode 100644 index 0000000..e25b0c5 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/RoofRackType.java @@ -0,0 +1,46 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum RoofRackType {
+ norack("norack"),
+ roofRailing("roofRailing"),
+ luggageRack("luggageRack"),
+ skiRack("skiRack"),
+ boxRack("boxRack"),
+ rackWithOneBox("rackWithOneBox"),
+ rackWithTwoBoxes("rackWithTwoBoxes"),
+ bicycleRack("bicycleRack"),
+ otherRack("otherRack");
+
+ public String text;
+
+ RoofRackType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/RouteSectionType.java b/src/org/uic/barcode/ticket/api/asn/omv1/RouteSectionType.java new file mode 100644 index 0000000..ead3098 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/RouteSectionType.java @@ -0,0 +1,136 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.IntRange;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+
+public class RouteSectionType extends Object {
+ public RouteSectionType() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Default("stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long fromStationNum;
+
+ @FieldOrder(order = 2)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String fromStationIA5;
+
+ @FieldOrder(order = 3)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long toStationNum;
+
+ @FieldOrder(order = 4)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String toStationIA5;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String fromStationNameUTF8;
+
+ @FieldOrder(order = 6)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String toStationNameUTF8;
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUIC;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public Long getFromStationNum() {
+
+ return this.fromStationNum;
+ }
+
+ public String getFromStationIA5() {
+
+ return this.fromStationIA5;
+ }
+
+ public Long getToStationNum() {
+
+ return this.toStationNum;
+ }
+
+ public String getToStationIA5() {
+
+ return this.toStationIA5;
+ }
+
+ public String getFromStationNameUTF8() {
+
+ return this.fromStationNameUTF8;
+ }
+
+ public String getToStationNameUTF8() {
+
+ return this.toStationNameUTF8;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setFromStationNum(Long fromStationNum) {
+
+ this.fromStationNum = fromStationNum;
+ }
+
+ public void setFromStationIA5(String fromStationIA5) {
+
+ this.fromStationIA5 = fromStationIA5;
+ }
+
+ public void setToStationNum(Long toStationNum) {
+
+ this.toStationNum = toStationNum;
+ }
+
+ public void setToStationIA5(String toStationIA5) {
+
+ this.toStationIA5 = toStationIA5;
+ }
+
+ public void setFromStationNameUTF8(String fromStationNameUTF8) {
+
+ this.fromStationNameUTF8 = fromStationNameUTF8;
+ }
+
+ public void setToStationNameUTF8(String toStationNameUTF8) {
+
+ this.toStationNameUTF8 = toStationNameUTF8;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfActivatedDays.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfActivatedDays.java new file mode 100644 index 0000000..2d1eebd --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfActivatedDays.java @@ -0,0 +1,26 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.IntRange;
+
+@IntRange(minValue=0,maxValue=370)
+public class SequenceOfActivatedDays extends Asn1SequenceOf<Long> {
+ public SequenceOfActivatedDays() { super(); }
+ public SequenceOfActivatedDays(Collection<Long> coll) { super(coll); }
+
+ public SequenceOfActivatedDays(List<Long> numbers) {
+ super();
+ for (Long number: numbers){
+ this.add(new Long(number));
+ }
+ }
+
+ public static SequenceOfActivatedDays getSequence(List<Long> numList) {
+ if (numList == null || numList.isEmpty()) return null;
+ return new SequenceOfActivatedDays(numList);
+ }
+
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfBerthDetailData.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfBerthDetailData.java new file mode 100644 index 0000000..b552482 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfBerthDetailData.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfBerthDetailData extends Asn1SequenceOf<BerthDetailData> {
+ public SequenceOfBerthDetailData() { super(); }
+ public SequenceOfBerthDetailData(Collection<BerthDetailData> coll) { super(coll); }
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCardReferenceType.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCardReferenceType.java new file mode 100644 index 0000000..a454960 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCardReferenceType.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfCardReferenceType extends Asn1SequenceOf<CardReferenceType> {
+ public SequenceOfCardReferenceType() { super(); }
+ public SequenceOfCardReferenceType(Collection<CardReferenceType> coll) { super(coll); }
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCarrierIA5.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCarrierIA5.java new file mode 100644 index 0000000..f3f09cf --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCarrierIA5.java @@ -0,0 +1,13 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+
+@RestrictedString(CharacterRestriction.IA5String)
+public class SequenceOfCarrierIA5 extends Asn1SequenceOf<String> {
+ public SequenceOfCarrierIA5() { super(); }
+ public SequenceOfCarrierIA5(Collection<String> coll) { super(coll); }
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCarrierNum.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCarrierNum.java new file mode 100644 index 0000000..9d75e83 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCarrierNum.java @@ -0,0 +1,28 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.IntRange;
+
+@IntRange(minValue=1,maxValue=32000)
+public class SequenceOfCarrierNum extends Asn1SequenceOf<Long> {
+ public SequenceOfCarrierNum() { super(); }
+ public SequenceOfCarrierNum(Collection<Long> coll) { super(coll); }
+
+
+ public SequenceOfCarrierNum(List<Long> numbers) {
+ super();
+ for (Long number: numbers){
+ this.add(new Long(number));
+ }
+ }
+ public static SequenceOfCarrierNum getSequence(List<Long> numList) {
+ if (numList == null || numList.isEmpty()) return null;
+ return new SequenceOfCarrierNum(numList);
+ }
+
+
+
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCountries.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCountries.java new file mode 100644 index 0000000..e6dd46b --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCountries.java @@ -0,0 +1,27 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.IntRange;
+
+@IntRange(minValue=1,maxValue=250)
+public class SequenceOfCountries extends Asn1SequenceOf<Long> {
+ public SequenceOfCountries() { super(); }
+ public SequenceOfCountries(Collection<Long> coll) { super(coll); }
+
+
+ public SequenceOfCountries(List<Long> numbers) {
+ super();
+ for (Long number: numbers){
+ this.add(new Long(number));
+ }
+ }
+
+ public static SequenceOfCountries getSequence(List<Long> numList) {
+ if (numList == null || numList.isEmpty()) return null;
+ return new SequenceOfCountries(numList);
+ }
+
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCustomerStatusType.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCustomerStatusType.java new file mode 100644 index 0000000..6506409 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfCustomerStatusType.java @@ -0,0 +1,11 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfCustomerStatusType extends Asn1SequenceOf<CustomerStatusType> {
+ public SequenceOfCustomerStatusType() { super(); }
+ public SequenceOfCustomerStatusType(Collection<CustomerStatusType> coll) { super(coll); }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfDeltaCoordinates.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfDeltaCoordinates.java new file mode 100644 index 0000000..b8ce30a --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfDeltaCoordinates.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfDeltaCoordinates extends Asn1SequenceOf<DeltaCoordinates> {
+ public SequenceOfDeltaCoordinates() { super(); }
+ public SequenceOfDeltaCoordinates(Collection<DeltaCoordinates> coll) { super(coll); }
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfDocumentData.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfDocumentData.java new file mode 100644 index 0000000..94a50ac --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfDocumentData.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfDocumentData extends Asn1SequenceOf<DocumentData> {
+ public SequenceOfDocumentData() { super(); }
+ public SequenceOfDocumentData(Collection<DocumentData> coll) { super(coll); }
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfExtensionData.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfExtensionData.java new file mode 100644 index 0000000..f6bcf22 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfExtensionData.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfExtensionData extends Asn1SequenceOf<ExtensionData> {
+ public SequenceOfExtensionData() { super(); }
+ public SequenceOfExtensionData(Collection<ExtensionData> coll) { super(coll); }
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfIncludedOpenTicketType.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfIncludedOpenTicketType.java new file mode 100644 index 0000000..a76647f --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfIncludedOpenTicketType.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfIncludedOpenTicketType extends Asn1SequenceOf<IncludedOpenTicketType> {
+ public SequenceOfIncludedOpenTicketType() { super(); }
+ public SequenceOfIncludedOpenTicketType(Collection<IncludedOpenTicketType> coll) { super(coll); }
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfPlaceNum.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfPlaceNum.java new file mode 100644 index 0000000..c8ec7ce --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfPlaceNum.java @@ -0,0 +1,28 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.IntRange;
+
+@IntRange(minValue=1,maxValue=254)
+public class SequenceOfPlaceNum extends Asn1SequenceOf<Long> {
+ public SequenceOfPlaceNum() { super(); }
+ public SequenceOfPlaceNum(Collection<Long> coll) { super(coll); }
+
+
+
+ public SequenceOfPlaceNum(List<Long> numbers) {
+ super();
+ for (Long number: numbers){
+ this.add(new Long(number));
+ }
+ }
+
+ public static SequenceOfPlaceNum getSequence(List<Long> numList) {
+ if (numList == null || numList.isEmpty()) return null;
+ return new SequenceOfPlaceNum(numList);
+ }
+
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfRegionalValidityType.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfRegionalValidityType.java new file mode 100644 index 0000000..1dee609 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfRegionalValidityType.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfRegionalValidityType extends Asn1SequenceOf<RegionalValidityType> {
+ public SequenceOfRegionalValidityType() { super(); }
+ public SequenceOfRegionalValidityType(Collection<RegionalValidityType> coll) { super(coll); }
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfRegisteredLuggageType.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfRegisteredLuggageType.java new file mode 100644 index 0000000..6670df9 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfRegisteredLuggageType.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfRegisteredLuggageType extends Asn1SequenceOf<RegisteredLuggageType> {
+ public SequenceOfRegisteredLuggageType() { super(); }
+ public SequenceOfRegisteredLuggageType(Collection<RegisteredLuggageType> coll) { super(coll); }
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfServiceBrands.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfServiceBrands.java new file mode 100644 index 0000000..3edd7fb --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfServiceBrands.java @@ -0,0 +1,26 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.IntRange;
+
+@IntRange(minValue=0,maxValue=32000)
+public class SequenceOfServiceBrands extends Asn1SequenceOf<Long> {
+ public SequenceOfServiceBrands() { super(); }
+ public SequenceOfServiceBrands(Collection<Long> coll) { super(coll); }
+
+
+ public SequenceOfServiceBrands(List<Long> numbers) {
+ super();
+ for (Long number: numbers){
+ this.add(new Long(number));
+ }
+ }
+
+ public static SequenceOfServiceBrands getSequence(List<Long> numList) {
+ if (numList == null || numList.isEmpty()) return null;
+ return new SequenceOfServiceBrands(numList);
+ }
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfTariffType.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfTariffType.java new file mode 100644 index 0000000..51110ae --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfTariffType.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfTariffType extends Asn1SequenceOf<TariffType> {
+ public SequenceOfTariffType() { super(); }
+ public SequenceOfTariffType(Collection<TariffType> coll) { super(coll); }
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfTicketLinkType.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfTicketLinkType.java new file mode 100644 index 0000000..33b0331 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfTicketLinkType.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfTicketLinkType extends Asn1SequenceOf<TicketLinkType> {
+ public SequenceOfTicketLinkType() { super(); }
+ public SequenceOfTicketLinkType(Collection<TicketLinkType> coll) { super(coll); }
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfTravelerId.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfTravelerId.java new file mode 100644 index 0000000..3a1b1ec --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfTravelerId.java @@ -0,0 +1,26 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.IntRange;
+
+@IntRange(minValue=0,maxValue=254)
+public class SequenceOfTravelerId extends Asn1SequenceOf<Long> {
+ public SequenceOfTravelerId() { super(); }
+ public SequenceOfTravelerId(Collection<Long> coll) { super(coll); }
+
+ public SequenceOfTravelerId(List<Long> numbers) {
+ super();
+ for (Long number: numbers){
+ this.add(new Long(number));
+ }
+ }
+
+ public static SequenceOfTravelerId getSequence(List<Long> numList) {
+ if (numList == null || numList.isEmpty()) return null;
+ return new SequenceOfTravelerId(numList);
+ }
+
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfTravelerType.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfTravelerType.java new file mode 100644 index 0000000..cbf7f99 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfTravelerType.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfTravelerType extends Asn1SequenceOf<TravelerType> {
+ public SequenceOfTravelerType() { super(); }
+ public SequenceOfTravelerType(Collection<TravelerType> coll) { super(coll); }
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfVatDetail.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfVatDetail.java new file mode 100644 index 0000000..52e0bbf --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfVatDetail.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfVatDetail extends Asn1SequenceOf<VatDetailType> {
+ public SequenceOfVatDetail() { super(); }
+ public SequenceOfVatDetail(Collection<VatDetailType> coll) { super(coll); }
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfViaStationType.java b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfViaStationType.java new file mode 100644 index 0000000..1bd4427 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SequenceOfViaStationType.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv1;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfViaStationType extends Asn1SequenceOf<ViaStationType> {
+ public SequenceOfViaStationType() { super(); }
+ public SequenceOfViaStationType(Collection<ViaStationType> coll) { super(coll); }
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/SeriesDetailType.java b/src/org/uic/barcode/ticket/api/asn/omv1/SeriesDetailType.java new file mode 100644 index 0000000..d2b7d96 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/SeriesDetailType.java @@ -0,0 +1,75 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.IntRange;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+public class SeriesDetailType extends Object {
+ public SeriesDetailType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long supplyingCarrier;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue=1,maxValue=99)
+ @Asn1Optional public Long offerIdentification;
+
+ @FieldOrder(order = 2)
+ @Asn1Optional public Asn1BigInteger series;
+
+
+ public Long getSupplyingCarrier() {
+
+ return this.supplyingCarrier;
+ }
+
+ public Long getOfferIdentification() {
+
+ return this.offerIdentification;
+ }
+
+ public Long getSeries() {
+
+ return Asn1BigInteger.toLong(this.series);
+ }
+
+ public void setSupplyingCarrier(Long supplyingCarrier) {
+
+ this.supplyingCarrier = supplyingCarrier;
+ }
+
+ public void setOfferIdentification(Long offerIdentification) {
+
+ this.offerIdentification = offerIdentification;
+ }
+
+ public void setSeries(Long series) {
+
+ this.series = Asn1BigInteger.toAsn1(series);
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/ServiceType.java b/src/org/uic/barcode/ticket/api/asn/omv1/ServiceType.java new file mode 100644 index 0000000..6812779 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/ServiceType.java @@ -0,0 +1,38 @@ +/*
+ * 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.asn.omv1;
+
+public enum ServiceType {
+ seat("seat"),
+ couchette("couchette"),
+ berth("berth"),
+ carcarriage("carcarriage");
+
+ public String text;
+
+ ServiceType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/StationPassageData.java b/src/org/uic/barcode/ticket/api/asn/omv1/StationPassageData.java new file mode 100644 index 0000000..a8718d7 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/StationPassageData.java @@ -0,0 +1,386 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.Date;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfUnrestrictedLong;
+
+@Sequence
+@HasExtensionMarker
+public class StationPassageData extends Object {
+ public StationPassageData() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 6)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String productName;
+
+ @FieldOrder(order = 7)
+ @Asn1Default("stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 8)
+ @Asn1Optional public SequenceOfUnrestrictedLong stationNum;
+
+ @FieldOrder(order = 9)
+ @Asn1Optional public SequenceOfStringIA5 stationIA5;
+
+ @FieldOrder(order = 10)
+ @Asn1Optional public SequenceOfStringUTF8 stationNameUTF8;
+
+ @FieldOrder(order = 11)
+ @Asn1Optional public SequenceOfUnrestrictedLong areaCodeNum;
+
+ @FieldOrder(order = 12)
+ @Asn1Optional public SequenceOfStringIA5 areaCodeIA5;
+
+ @FieldOrder(order = 13)
+ @Asn1Optional public SequenceOfStringUTF8 areaNameUTF8;
+
+ @FieldOrder(order = 14)
+ @IntRange(minValue=-1,maxValue=700)
+ public Long validFromDay;
+
+ @FieldOrder(order = 15)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long validFromTime;
+
+ @FieldOrder(order = 16)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validFromUTCOffset;
+
+ @FieldOrder(order = 17)
+ @Asn1Default(value="0")
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long validUntilDay;
+
+ @FieldOrder(order = 18)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long validUntilTime;
+
+ @FieldOrder(order = 19)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validUntilUTCOffset;
+
+ @FieldOrder(order = 20)
+ @Asn1Optional public Asn1BigInteger numberOfDaysValid;
+
+ @FieldOrder(order = 21)
+ @Asn1Optional public ExtensionData extension;
+
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Asn1BigInteger getReferenceNum() {
+
+ return this.referenceNum;
+ }
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+
+ return this.productIdIA5;
+ }
+
+ public String getProductName() {
+
+ return this.productName;
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUIC;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public SequenceOfUnrestrictedLong getStationNum() {
+
+ return this.stationNum;
+ }
+
+ public List<String> getStationIA5() {
+
+ return this.stationIA5;
+ }
+
+ public SequenceOfStringUTF8 getStationNameUTF8() {
+
+ return this.stationNameUTF8;
+ }
+
+ public SequenceOfUnrestrictedLong getAreaCodeNum() {
+
+ return this.areaCodeNum;
+ }
+
+ public List<String> getAreaCodeIA5() {
+
+ return this.areaCodeIA5;
+ }
+
+ public List<String> getAreaNameUTF8() {
+
+ return this.areaNameUTF8;
+ }
+
+ public Long getValidFromDay() {
+
+ return this.validFromDay;
+ }
+
+ public Long getValidFromTime() {
+
+ return this.validFromTime;
+ }
+
+ public Long getValidUntilDay() {
+
+ return this.validUntilDay;
+ }
+
+ public Long getValidUntilTime() {
+
+ return this.validUntilTime;
+ }
+
+ public Long getNumberOfDaysValid() {
+
+ return Asn1BigInteger.toLong(numberOfDaysValid);
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setReferenceNum(Asn1BigInteger referenceNum) {
+
+ this.referenceNum = referenceNum;
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setProductName(String productName) {
+
+ this.productName = productName;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setStationNum(SequenceOfUnrestrictedLong stationNum) {
+
+ this.stationNum = stationNum;
+ }
+
+ public void setStationIA5(SequenceOfStringIA5 stationIA5) {
+
+ this.stationIA5 = stationIA5;
+ }
+
+ public void setStationNameUTF8(SequenceOfStringUTF8 stationNameUTF8) {
+
+ this.stationNameUTF8 = stationNameUTF8;
+ }
+
+ public void setAreaCodeNum(SequenceOfUnrestrictedLong sequenceOfUnrestrictedLong) {
+
+ this.areaCodeNum = sequenceOfUnrestrictedLong;
+ }
+
+ public void setAreaCodeIA5(SequenceOfStringIA5 areaCodeIA5) {
+
+ this.areaCodeIA5 = areaCodeIA5;
+ }
+
+ public void setAreaNameUTF8(SequenceOfStringUTF8 areaNameUTF8) {
+
+ this.areaNameUTF8 = areaNameUTF8;
+ }
+
+ public void setValidFromDay(Long validFromDay) {
+
+ this.validFromDay = validFromDay;
+ }
+
+ public void setValidFromTime(Long validFromTime) {
+
+ this.validFromTime = validFromTime;
+ }
+
+ public void setValidUntilDay(Long validUntilDay) {
+
+ this.validUntilDay = validUntilDay;
+ }
+
+ public void setValidUntilTime(Long validUntilTime) {
+
+ this.validUntilTime = validUntilTime;
+ }
+
+ public void setNumberOfDaysValid(Long numberOfDaysValid) {
+
+ this.numberOfDaysValid = Asn1BigInteger.toAsn1(numberOfDaysValid);
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public void setValidityDates (Date fromDate, Date untilDate, Date issuingDate){
+
+ if (issuingDate == null || fromDate == null) return;
+
+ this.validFromDay = DateTimeUtils.getDateDifference(issuingDate,fromDate);
+ this.validFromTime = DateTimeUtils.getTime(fromDate);
+
+ if (untilDate != null){
+ this.validUntilDay = DateTimeUtils.getDateDifference(fromDate, untilDate);
+ this.validUntilTime = DateTimeUtils.getTime(untilDate);
+ }
+
+ }
+
+ public Date getValidFromDate(Date issuingDate){
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay, this.validFromTime);
+
+ }
+
+ public Date getValidUntilDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validUntilDay == null) {
+ return null;
+ }
+
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime);
+
+ }
+
+ public Long getValidFromUTCOffset() {
+ return validFromUTCOffset;
+ }
+
+ public void setValidFromUTCOffset(Long validFromUTCOffset) {
+ this.validFromUTCOffset = validFromUTCOffset;
+ }
+
+ public Long getValidUntilUTCOffset() {
+ return validUntilUTCOffset;
+ }
+
+ public void setValidUntilUTCOffset(Long validUntilUTCOffset) {
+ this.validUntilUTCOffset = validUntilUTCOffset;
+ }
+
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/TariffType.java b/src/org/uic/barcode/ticket/api/asn/omv1/TariffType.java new file mode 100644 index 0000000..66cb399 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/TariffType.java @@ -0,0 +1,207 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+@HasExtensionMarker
+public class TariffType extends Object {
+ public TariffType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=1,maxValue=200)
+ @Asn1Default(value = "1")
+ @Asn1Optional public Long numberOfPassengers;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public PassengerType passengerType;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=64)
+ @Asn1Optional public Long ageBelow;
+
+ @FieldOrder(order = 3)
+ @IntRange(minValue=1,maxValue=128)
+ @Asn1Optional public Long ageAbove;
+
+ @FieldOrder(order = 4)
+ @Asn1Optional public SequenceOfTravelerId traverlerid;
+
+ @FieldOrder(order = 5)
+ public Boolean restrictedToCountryOfResidence;
+
+ @FieldOrder(order = 6)
+ @Asn1Optional public RouteSectionType restrictedToRouteSection;
+
+ @FieldOrder(order = 7)
+ @Asn1Optional public SeriesDetailType seriesDataDetails;
+
+ @FieldOrder(order = 8)
+ @Asn1Optional public Asn1BigInteger tariffIdNum;
+
+ @FieldOrder(order = 9)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String tariffIdIA5;
+
+ @FieldOrder(order = 10)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String tariffDesc;
+
+ @FieldOrder(order = 11)
+ @Asn1Optional public SequenceOfCardReferenceType reductionCard;
+
+
+
+ public Long getNumberOfPassengers() {
+
+ if (numberOfPassengers == null) {
+ return new Long(1);
+ }
+
+ return this.numberOfPassengers;
+ }
+
+ public PassengerType getPassengerType() {
+
+ return this.passengerType;
+ }
+
+ public Long getAgeBelow() {
+
+ return this.ageBelow;
+ }
+
+ public Long getAgeAbove() {
+
+ return this.ageAbove;
+ }
+
+ public SequenceOfTravelerId getTraverlerid() {
+
+ return this.traverlerid;
+ }
+
+ public Boolean getRestrictedToCountryOfResidence() {
+
+ return this.restrictedToCountryOfResidence;
+ }
+
+ public RouteSectionType getRestrictedToRouteSection() {
+
+ return this.restrictedToRouteSection;
+ }
+
+ public SeriesDetailType getSeriesDataDetails() {
+
+ return this.seriesDataDetails;
+ }
+
+ public Long getTariffIdNum() {
+
+ return Asn1BigInteger.toLong(this.tariffIdNum);
+ }
+
+ public String getTariffIdIA5() {
+
+ return this.tariffIdIA5;
+ }
+
+ public String getTariffDesc() {
+
+ return this.tariffDesc;
+ }
+
+ public SequenceOfCardReferenceType getReductionCard() {
+
+ return this.reductionCard;
+ }
+
+ public void setNumberOfPassengers(Long numberOfPassengers) {
+
+ this.numberOfPassengers = numberOfPassengers;
+ }
+
+ public void setPassengerType(PassengerType passengerType) {
+
+ this.passengerType = passengerType;
+ }
+
+ public void setAgeBelow(Long ageBelow) {
+
+ this.ageBelow = ageBelow;
+ }
+
+ public void setAgeAbove(Long ageAbove) {
+
+ this.ageAbove = ageAbove;
+ }
+
+ public void setTraverlerid(SequenceOfTravelerId traverlerid) {
+
+ this.traverlerid = traverlerid;
+ }
+
+ public void setRestrictedToCountryOfResidence(Boolean restrictedToCountryOfResidence) {
+
+ this.restrictedToCountryOfResidence = restrictedToCountryOfResidence;
+ }
+
+ public void setRestrictedToRouteSection(RouteSectionType restrictedToRouteSection) {
+
+ this.restrictedToRouteSection = restrictedToRouteSection;
+ }
+
+ public void setSeriesDataDetails(SeriesDetailType seriesDataDetails) {
+
+ this.seriesDataDetails = seriesDataDetails;
+ }
+
+ public void setTariffIdNum(Long tariffIdNum) {
+
+ this.tariffIdNum = Asn1BigInteger.toAsn1(tariffIdNum);
+ }
+
+ public void setTariffIdIA5(String tariffIdIA5) {
+
+ this.tariffIdIA5 = tariffIdIA5;
+ }
+
+ public void setTariffDesc(String tariffDesc) {
+
+ this.tariffDesc = tariffDesc;
+ }
+
+ public void setReductionCard(SequenceOfCardReferenceType reductionCard) {
+
+ this.reductionCard = reductionCard;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/TicketDetailData.java b/src/org/uic/barcode/ticket/api/asn/omv1/TicketDetailData.java new file mode 100644 index 0000000..e32bb98 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/TicketDetailData.java @@ -0,0 +1,190 @@ +/*
+ * 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.asn.omv1;
+
+
+
+import org.uic.barcode.asn1.datatypes.Choice;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@Choice
+@HasExtensionMarker
+public class TicketDetailData extends Object {
+ public TicketDetailData() {
+ }
+
+ @FieldOrder(order = 0)
+ public ReservationData reservation;
+
+ @FieldOrder(order = 1)
+ public CarCarriageReservationData carCarriageReservation;
+
+ @FieldOrder(order = 2)
+ public OpenTicketData openTicket;
+
+ @FieldOrder(order = 3)
+ public PassData pass;
+
+ @FieldOrder(order = 4)
+ public VoucherData voucher;
+
+ @FieldOrder(order = 5)
+ public CustomerCardData customerCard;
+
+ @FieldOrder(order = 6)
+ public CountermarkData counterMark;
+
+ @FieldOrder(order = 7)
+ public ParkingGroundData parkingGround;
+
+ @FieldOrder(order = 8)
+ public FIPTicketData fipTicket;
+
+ @FieldOrder(order = 9)
+ public StationPassageData stationPassage;
+
+ @FieldOrder(order = 10)
+ public DelayConfirmation delayConfirmation;
+
+ @FieldOrder(order = 11)
+ public ExtensionData extension;
+
+ public ReservationData getReservation() {
+
+ return this.reservation;
+ }
+
+ public CarCarriageReservationData getCarCarriageReservation() {
+
+ return this.carCarriageReservation;
+ }
+
+ public OpenTicketData getOpenTicket() {
+
+ return this.openTicket;
+ }
+
+ public PassData getPass() {
+
+ return this.pass;
+ }
+
+ public VoucherData getVoucher() {
+
+ return this.voucher;
+ }
+
+ public CustomerCardData getCustomerCard() {
+
+ return this.customerCard;
+ }
+
+ public CountermarkData getCounterMark() {
+
+ return this.counterMark;
+ }
+
+ public ParkingGroundData getParkingGround() {
+
+ return this.parkingGround;
+ }
+
+ public FIPTicketData getFipTicket() {
+
+ return this.fipTicket;
+ }
+
+ public StationPassageData getStationPassage() {
+
+ return this.stationPassage;
+ }
+
+ public DelayConfirmation getDelayConfirmation() {
+
+ return this.delayConfirmation;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setReservation(ReservationData reservation) {
+
+ this.reservation = reservation;
+ }
+
+ public void setCarCarriageReservation(CarCarriageReservationData carCarriageReservation) {
+
+ this.carCarriageReservation = carCarriageReservation;
+ }
+
+ public void setOpenTicket(OpenTicketData openTicket) {
+
+ this.openTicket = openTicket;
+ }
+
+ public void setPass(PassData pass) {
+
+ this.pass = pass;
+ }
+
+ public void setVoucher(VoucherData voucher) {
+
+ this.voucher = voucher;
+ }
+
+ public void setCustomerCard(CustomerCardData customerCard) {
+
+ this.customerCard = customerCard;
+ }
+
+ public void setCounterMark(CountermarkData counterMark) {
+
+ this.counterMark = counterMark;
+ }
+
+ public void setParkingGround(ParkingGroundData parkingGround) {
+
+ this.parkingGround = parkingGround;
+ }
+
+ public void setFipTicket(FIPTicketData fipTicket) {
+
+ this.fipTicket = fipTicket;
+ }
+
+ public void setStationPassage(StationPassageData stationPassage) {
+
+ this.stationPassage = stationPassage;
+ }
+
+ public void setDelayConfirmation(DelayConfirmation delayConfirmation) {
+
+ this.delayConfirmation = delayConfirmation;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/TicketLinkType.java b/src/org/uic/barcode/ticket/api/asn/omv1/TicketLinkType.java new file mode 100644 index 0000000..2a15f8b --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/TicketLinkType.java @@ -0,0 +1,156 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+@HasExtensionMarker
+public class TicketLinkType extends Object {
+ public TicketLinkType() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 2)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String issuerName;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String issuerPNR;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 6)
+ @Asn1Default(value="openTicket")
+ @Asn1Optional public TicketType ticketType;
+
+ @FieldOrder(order = 7)
+ @Asn1Default(value="issuedTogether")
+ @Asn1Optional public LinkMode linkMode;
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Long getReferenceNum() {
+ return Asn1BigInteger.toLong(this.referenceNum);
+ }
+
+ public String getIssuerName() {
+
+ return this.issuerName;
+ }
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public TicketType getTicketType() {
+
+ if (ticketType == null) {
+ return TicketType.openTicket;
+ }
+
+ return this.ticketType;
+ }
+
+ public LinkMode getLinkMode() {
+
+ if (linkMode == null){
+ return LinkMode.issuedTogether;
+ }
+
+ return this.linkMode;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setReferenceNum(Long referenceNum) {
+ this.referenceNum = Asn1BigInteger.toAsn1(referenceNum);
+ }
+
+ public void setIssuerName(String issuerName) {
+
+ this.issuerName = issuerName;
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setTicketType(TicketType ticketType) {
+
+ this.ticketType = ticketType;
+ }
+
+ public void setLinkMode(LinkMode linkMode) {
+
+ this.linkMode = linkMode;
+ }
+
+ public String getIssuerPNR() {
+ return issuerPNR;
+ }
+
+ public void setIssuerPNR(String issuerPNR) {
+ this.issuerPNR = issuerPNR;
+ }
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/TicketType.java b/src/org/uic/barcode/ticket/api/asn/omv1/TicketType.java new file mode 100644 index 0000000..09f3cfb --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/TicketType.java @@ -0,0 +1,41 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum TicketType {
+ openTicket("openTicket"),
+ pass("pass"),
+ reservation("reservation"),
+ carCarriageReservation("carCarriageReservation");
+
+ public String text;
+
+ TicketType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/TimeRangeType.java b/src/org/uic/barcode/ticket/api/asn/omv1/TimeRangeType.java new file mode 100644 index 0000000..ac8a51d --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/TimeRangeType.java @@ -0,0 +1,59 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.IntRange;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+public class TimeRangeType extends Object {
+ public TimeRangeType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=0,maxValue=1440)
+ public Long fromTime;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue=0,maxValue=1440)
+ public Long untilTime;
+
+ public Long getFromTime() {
+
+ return this.fromTime;
+ }
+
+ public Long getUntilTime() {
+
+ return this.untilTime;
+ }
+
+ public void setFromTime(Long fromTime) {
+
+ this.fromTime = fromTime;
+ }
+
+ public void setUntilTime(Long untilTime) {
+
+ this.untilTime = untilTime;
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/TokenType.java b/src/org/uic/barcode/ticket/api/asn/omv1/TokenType.java new file mode 100644 index 0000000..80eb42c --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/TokenType.java @@ -0,0 +1,92 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.OctetString;
+
+@Sequence
+public class TokenType extends Object {
+ public TokenType() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public Long tokenProviderNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String tokenProviderIA5;
+
+ @FieldOrder(order = 2)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String tokenSpecification;
+
+ @FieldOrder(order = 3)
+ public OctetString token;
+
+ public Long getTokenProviderNum() {
+
+ return this.tokenProviderNum;
+ }
+
+ public String getTokenProviderIA5() {
+
+ return this.tokenProviderIA5;
+ }
+
+ public String getTokenSpecification() {
+
+ return this.tokenSpecification;
+ }
+
+ public byte[] getToken() {
+
+ return token.toByteArray();
+
+ }
+
+ public void setTokenProviderNum(Long tokenProviderNum) {
+
+ this.tokenProviderNum = tokenProviderNum;
+ }
+
+ public void setTokenProviderIA5(String tokenProviderIA5) {
+
+ this.tokenProviderIA5 = tokenProviderIA5;
+ }
+
+ public void setTokenSpecification(String tokenSpecification) {
+
+ this.tokenSpecification = tokenSpecification;
+ }
+
+ public void setToken(byte[] token) {
+
+ this.token = new OctetString(token);
+
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/TrainLinkType.java b/src/org/uic/barcode/ticket/api/asn/omv1/TrainLinkType.java new file mode 100644 index 0000000..3eb0871 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/TrainLinkType.java @@ -0,0 +1,184 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.Date;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.IntRange;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+public class TrainLinkType extends Object {
+ public TrainLinkType() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public Asn1BigInteger trainNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String trainIA5;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long travelDate;
+
+ @FieldOrder(order = 3)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long departureTime;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long departureUTCOffset;
+
+ @FieldOrder(order = 5)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long fromStationNum;
+
+ @FieldOrder(order = 6)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String fromStationIA5;
+
+ @FieldOrder(order = 7)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long toStationNum;
+
+ @FieldOrder(order = 8)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String toStationIA5;
+
+ @FieldOrder(order = 9)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String fromStationName;
+
+ @FieldOrder(order = 10)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String toStationName;
+
+ public Long getTrainNum() {
+ return Asn1BigInteger.toLong(this.trainNum);
+ }
+
+ public String getTrainIA5() {
+ return this.trainIA5;
+ }
+
+ public Long getTravelDate() {
+ return this.travelDate;
+ }
+
+ public Long getDepartureTime() {
+ return this.departureTime;
+ }
+
+ public Long getFromStationNum() {
+ return this.fromStationNum;
+ }
+
+ public String getFromStationIA5() {
+ return this.fromStationIA5;
+ }
+
+ public Long getToStationNum() {
+ return this.toStationNum;
+ }
+
+ public String getToStationIA5() {
+ return this.toStationIA5;
+ }
+
+ public String getFromStationName() {
+ return this.fromStationName;
+ }
+
+ public String getToStationName() {
+ return this.toStationName;
+ }
+
+ public void setTrainNum(Long trainNum) {
+ this.trainNum = Asn1BigInteger.toAsn1(trainNum);
+ }
+
+ public void setTrainIA5(String trainIA5) {
+ this.trainIA5 = trainIA5;
+ }
+
+ public void setTravelDate(Long travelDate) {
+ this.travelDate = travelDate;
+ }
+
+ public void setDepartureTime(Long departureTime) {
+ this.departureTime = departureTime;
+ }
+
+ public void setFromStationNum(Long fromStationNum) {
+ this.fromStationNum = fromStationNum;
+ }
+
+ public void setFromStationIA5(String fromStationIA5) {
+ this.fromStationIA5 = fromStationIA5;
+ }
+
+ public void setToStationNum(Long toStationNum) {
+ this.toStationNum = toStationNum;
+ }
+
+ public void setToStationIA5(String toStationIA5) {
+ this.toStationIA5 = toStationIA5;
+ }
+
+ public void setFromStationName(String fromStationName) {
+ this.fromStationName = fromStationName;
+ }
+
+ public void setToStationName(String toStationName) {
+ this.toStationName = toStationName;
+ }
+
+ public void setDepartureDate(Date departure, Date issuingDate){
+
+ if (issuingDate == null || departure == null) return;
+
+ this.travelDate = DateTimeUtils.getDateDifference(issuingDate,departure);
+ this.departureTime = DateTimeUtils.getTime(departure);
+ }
+
+ public void setDepartureTimeZone(Date dateLocal, Date dateUTC ) {
+ // -- (UTC = local + offset * 15 Minutes)
+ this.departureUTCOffset = new Long(dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15);
+ }
+
+ public Date getDepartureDate(Date issuingDate){
+ return DateTimeUtils.getDate(issuingDate, this.travelDate, this.departureTime);
+ }
+
+ public Date getUTCDepartureDate(Date issuingDate){
+ return DateTimeUtils.getUTCDate(issuingDate, this.travelDate, this.departureTime, this.departureUTCOffset);
+ }
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/TravelClassType.java b/src/org/uic/barcode/ticket/api/asn/omv1/TravelClassType.java new file mode 100644 index 0000000..4826e83 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/TravelClassType.java @@ -0,0 +1,45 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum TravelClassType {
+ notApplicabel("notApplicabel"),
+ first("first"),
+ second("second"),
+ tourist("tourist"),
+ comfort("comfort"),
+ premium("premium"),
+ business("business"),
+ all("all");
+
+ public String text;
+
+ TravelClassType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/TravelerData.java b/src/org/uic/barcode/ticket/api/asn/omv1/TravelerData.java new file mode 100644 index 0000000..efb88ea --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/TravelerData.java @@ -0,0 +1,83 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.FixedSize;
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+@HasExtensionMarker
+public class TravelerData extends Object {
+ public TravelerData() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public SequenceOfTravelerType traveler;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @FixedSize(2)
+ @Asn1Optional public String preferedLanguage;
+
+ @FieldOrder(order = 2)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String groupName;
+
+
+ public List<TravelerType> getTraveler() {
+
+ return this.traveler;
+ }
+
+ public String getPreferedLanguage() {
+
+ return this.preferedLanguage;
+ }
+
+ public String getGroupName() {
+
+ return this.groupName;
+ }
+
+ public void setTraveler(SequenceOfTravelerType traveler) {
+
+ this.traveler = traveler;
+ }
+
+ public void setPreferedLanguage(String preferedLanguage) {
+
+ this.preferedLanguage = preferedLanguage;
+ }
+
+ public void setGroupName(String groupName) {
+
+ this.groupName = groupName;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/TravelerType.java b/src/org/uic/barcode/ticket/api/asn/omv1/TravelerType.java new file mode 100644 index 0000000..7f512fc --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/TravelerType.java @@ -0,0 +1,322 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypes.SizeRange;
+
+@Sequence
+@HasExtensionMarker
+public class TravelerType extends Object {
+ public TravelerType() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String firstName;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String secondName;
+
+ @FieldOrder(order = 2)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String lastName;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String idCard;
+
+ @FieldOrder(order = 4)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String passportId;
+
+ @FieldOrder(order = 5)
+ @SizeRange(minValue = 1, maxValue = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String title;
+
+ @FieldOrder(order = 6)
+ @Asn1Optional public GenderType gender;
+
+ @FieldOrder(order = 7)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String customerIdIA5;
+
+ @FieldOrder(order = 8)
+ @Asn1Optional public Long customerIdNum;
+
+ @FieldOrder(order = 9)
+ @IntRange(minValue=1901,maxValue=2155)
+ @Asn1Optional public Long yearOfBirth;
+
+ @FieldOrder(order = 10)
+ @IntRange(minValue=0,maxValue=366)
+ @Asn1Optional public Long dayOfBirth;
+
+ @FieldOrder(order = 11)
+ public Boolean ticketHolder = true;
+
+ @FieldOrder(order = 12)
+ @Asn1Optional public PassengerType passengerType;
+
+ @FieldOrder(order = 13)
+ @Asn1Optional public Boolean passengerWithReducedMobility;
+
+ @FieldOrder(order = 14)
+ @IntRange(minValue=1,maxValue=999)
+ @Asn1Optional public Long countryOfResidence;
+
+ @FieldOrder(order = 15)
+ @IntRange(minValue=1,maxValue=999)
+ @Asn1Optional public Long countryOfPassport;
+
+ @FieldOrder(order = 16)
+ @IntRange(minValue=1,maxValue=999)
+ @Asn1Optional public Long countryOfIdCard;
+
+ @FieldOrder(order = 17)
+ @Asn1Optional public SequenceOfCustomerStatusType status;
+
+
+
+ public String getFirstName() {
+
+ return this.firstName;
+ }
+
+ public String getSecondName() {
+
+ return this.secondName;
+ }
+
+ public String getLastName() {
+
+ return this.lastName;
+ }
+
+ public String getIdCard() {
+
+ return this.idCard;
+ }
+
+ public String getPassportId() {
+
+ return this.passportId;
+ }
+
+ public String getTitle() {
+
+ return this.title;
+ }
+
+ public GenderType getGender() {
+
+ return this.gender;
+ }
+
+ public String getCustomerIdIA5() {
+
+ return this.customerIdIA5;
+ }
+
+ public Long getCustomerIdNum() {
+
+ return this.customerIdNum;
+ }
+
+ public Long getYearOfBirth() {
+
+ return this.yearOfBirth;
+ }
+
+ public Long getDayOfBirth() {
+
+ return this.dayOfBirth;
+ }
+
+ public Boolean getTicketHolder() {
+
+ return this.ticketHolder;
+ }
+
+ public PassengerType getPassengerType() {
+
+ return this.passengerType;
+ }
+
+ public Boolean getPassengerWithReducedMobility() {
+ return this.passengerWithReducedMobility;
+ }
+
+ public Long getCountryOfResidence() {
+
+ return this.countryOfResidence;
+ }
+
+ public Long getCountryOfPassport() {
+
+ return this.countryOfPassport;
+ }
+
+ public Long getCountryOfIdCard() {
+
+ return this.countryOfIdCard;
+ }
+
+ public SequenceOfCustomerStatusType getStatus() {
+
+ return this.status;
+ }
+
+ public void setFirstName(String firstName) {
+
+ this.firstName = firstName;
+ }
+
+ public void setSecondName(String secondName) {
+
+ this.secondName = secondName;
+ }
+
+ public void setLastName(String lastName) {
+
+ this.lastName = lastName;
+ }
+
+ public void setIdCard(String idCard) {
+
+ this.idCard = idCard;
+ }
+
+ public void setPassportId(String passportId) {
+
+ this.passportId = passportId;
+ }
+
+ public void setTitle(String title) {
+
+ this.title = title;
+ }
+
+ public void setGender(GenderType gender) {
+
+ this.gender = gender;
+ }
+
+ public void setCustomerIdIA5(String customerIdIA5) {
+
+ this.customerIdIA5 = customerIdIA5;
+ }
+
+ public void setCustomerIdNum(Long customerIdNum) {
+
+ this.customerIdNum = customerIdNum;
+ }
+
+ public void setYearOfBirth(Long yearOfBirth) {
+
+ this.yearOfBirth = yearOfBirth;
+ }
+
+ public void setDayOfBirth(Long dayOfBirth) {
+
+ this.dayOfBirth = dayOfBirth;
+ }
+
+ public void setTicketHolder(Boolean ticketHolder) {
+
+ this.ticketHolder = ticketHolder;
+ }
+
+ public void setPassengerType(PassengerType passengerType) {
+
+ this.passengerType = passengerType;
+ }
+
+ public void setPassengerWithReducedMobility(Boolean passengerWithReducedMobility) {
+
+ this.passengerWithReducedMobility = passengerWithReducedMobility;
+ }
+
+ public void setCountryOfResidence(Long countryOfResidence) {
+
+ this.countryOfResidence = countryOfResidence;
+ }
+
+ public void setCountryOfPassport(Long countryOfPassport) {
+
+ this.countryOfPassport = countryOfPassport;
+ }
+
+ public void setCountryOfIdCard(Long countryOfIdCard) {
+
+ this.countryOfIdCard = countryOfIdCard;
+ }
+
+ public void setStatus(SequenceOfCustomerStatusType status) {
+
+ this.status = status;
+ }
+
+
+
+ public void setDateOfBirth(Date date){
+
+ if (date == null) return;
+
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+
+ this.yearOfBirth = new Long( cal.get(Calendar.YEAR));
+ this.dayOfBirth = new Long (cal.get(Calendar.DAY_OF_YEAR));
+
+
+ }
+
+ public Date getDateOfBirth() {
+
+ if (this.yearOfBirth == null) return null;
+ if (this.dayOfBirth == null) return null;
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ cal.set(Calendar.YEAR, this.yearOfBirth.intValue());
+ cal.set(Calendar.DAY_OF_YEAR, this.dayOfBirth.intValue());
+ cal.set(Calendar.HOUR_OF_DAY,0);
+ cal.set(Calendar.MINUTE,0);
+
+ return cal.getTime();
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/UicRailTicketData.java b/src/org/uic/barcode/ticket/api/asn/omv1/UicRailTicketData.java new file mode 100644 index 0000000..dfa79a0 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/UicRailTicketData.java @@ -0,0 +1,115 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.List;
+
+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.Sequence;
+import org.uic.barcode.asn1.uper.UperEncoder;
+
+@Sequence
+@HasExtensionMarker
+public class UicRailTicketData extends Object {
+ public UicRailTicketData() {
+ }
+
+ @FieldOrder(order = 0)
+ public IssuingData issuingDetail;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public TravelerData travelerDetail;
+
+ @FieldOrder(order = 2)
+ @Asn1Optional public SequenceOfDocumentData transportDocument;
+
+ @FieldOrder(order = 3)
+ @Asn1Optional public ControlData controlDetail;
+
+ @FieldOrder(order = 4)
+ @Asn1Optional public SequenceOfExtensionData extension;
+
+ public IssuingData getIssuingDetail() {
+
+ return this.issuingDetail;
+ }
+
+ public TravelerData getTravelerDetail() {
+
+ return this.travelerDetail;
+ }
+
+ public List<DocumentData> getTransportDocument() {
+
+ return this.transportDocument;
+ }
+
+ public ControlData getControlDetail() {
+
+ return this.controlDetail;
+ }
+
+ public List<ExtensionData> getExtension() {
+
+ return this.extension;
+ }
+
+ public void setIssuingDetail(IssuingData issuingDetail) {
+
+ this.issuingDetail = issuingDetail;
+ }
+
+ public void setTravelerDetail(TravelerData travelerDetail) {
+
+ this.travelerDetail = travelerDetail;
+ }
+
+ public void setTransportDocument(SequenceOfDocumentData transportDocument) {
+
+ this.transportDocument = transportDocument;
+ }
+
+ public void setControlDetail(ControlData controlDetail) {
+
+ this.controlDetail = controlDetail;
+ }
+
+ public void setExtension(SequenceOfExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+
+ public byte[] encode(){
+ return UperEncoder.encode(this);
+ }
+
+ public String encodeToHex(){
+ return UperEncoder.hexStringFromBytes(UperEncoder.encode(this));
+ }
+
+
+ public static UicRailTicketData decode(byte[] bytes) {
+ return UperEncoder.decode(bytes, UicRailTicketData.class);
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodDetailType.java b/src/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodDetailType.java new file mode 100644 index 0000000..1717ea2 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodDetailType.java @@ -0,0 +1,73 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+public class ValidityPeriodDetailType extends Object {
+ public ValidityPeriodDetailType() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public SequenceOfValidityPeriodType validityPeriod;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public SequenceOfTimeRangeType excludedTimeRange;
+
+
+ public class SequenceOfTimeRangeType extends Asn1SequenceOf<TimeRangeType> {
+ public SequenceOfTimeRangeType() { super(); }
+ public SequenceOfTimeRangeType(Collection<TimeRangeType> coll) { super(coll); }
+ }
+
+
+ public class SequenceOfValidityPeriodType extends Asn1SequenceOf<ValidityPeriodType> {
+ public SequenceOfValidityPeriodType() { super(); }
+ public SequenceOfValidityPeriodType(Collection<ValidityPeriodType> coll) { super(coll); }
+ }
+
+ public SequenceOfValidityPeriodType getValidityPeriod() {
+
+ return this.validityPeriod;
+ }
+
+ public SequenceOfTimeRangeType getExcludedTimeRange() {
+
+ return this.excludedTimeRange;
+ }
+
+ public void setValidityPeriod(SequenceOfValidityPeriodType validityPeriod) {
+
+ this.validityPeriod = validityPeriod;
+ }
+
+ public void setExcludedTimeRange(SequenceOfTimeRangeType excludedTimeRange) {
+
+ this.excludedTimeRange = excludedTimeRange;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodType.java b/src/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodType.java new file mode 100644 index 0000000..a41fa03 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodType.java @@ -0,0 +1,164 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.Date;
+
+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.IntRange;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+public class ValidityPeriodType extends Object {
+ public ValidityPeriodType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=0,maxValue=700)
+ @Asn1Default(value="0")
+ @Asn1Optional public Long validFromDay;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long validFromTime;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validFromUTCOffset;
+
+ @FieldOrder(order = 3)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Default(value="0")
+ @Asn1Optional public Long validUntilDay;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long validUntilTime;
+
+ @FieldOrder(order = 5)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validUntilUTCOffset;
+
+ public Long getValidFromDay() {
+
+ if (validFromDay == null) {
+ return new Long(0);
+ }
+
+ return this.validFromDay;
+ }
+
+ public Long getValidFromTime() {
+
+ return this.validFromTime;
+ }
+
+ public Long getValidUntilDay() {
+
+ if (validUntilDay == null) {
+ return new Long(0);
+ }
+
+ return this.validUntilDay;
+ }
+
+ public Long getValidUntilTime() {
+
+ return this.validUntilTime;
+ }
+
+ public void setValidFromDay(Long validFromDay) {
+
+ this.validFromDay = validFromDay;
+ }
+
+ public void setValidFromTime(Long validFromTime) {
+
+ this.validFromTime = validFromTime;
+ }
+
+ public void setValidUntilDay(Long validUntilDay) {
+
+ this.validUntilDay = validUntilDay;
+ }
+
+ public void setValidUntilTime(Long validUntilTime) {
+
+ this.validUntilTime = validUntilTime;
+ }
+
+ public void setValidityDates (Date fromDate, Date untilDate, Date issuingDate){
+
+ if (issuingDate == null || fromDate == null) return;
+
+ this.validFromDay = DateTimeUtils.getDateDifference(issuingDate,fromDate);
+ this.validFromTime = DateTimeUtils.getTime(fromDate);
+
+ if (untilDate != null){
+ this.validUntilDay = DateTimeUtils.getDateDifference(fromDate, untilDate);
+ this.validUntilTime = DateTimeUtils.getTime(untilDate);
+ }
+
+ }
+
+ public Date getValidFromDate(Date issuingDate){
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay, this.validFromTime);
+
+ }
+
+ public Date getValidUntilDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validUntilDay == null) {
+ return null;
+ }
+
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime);
+
+ }
+
+ public Long getValidFromUTCOffset() {
+ return validFromUTCOffset;
+ }
+
+ public void setValidFromUTCOffset(Long validFromUTCOffset) {
+ this.validFromUTCOffset = validFromUTCOffset;
+ }
+
+ public Long getValidUntilUTCOffset() {
+ return validUntilUTCOffset;
+ }
+
+ public void setValidUntilUTCOffset(Long validUntilUTCOffset) {
+ this.validUntilUTCOffset = validUntilUTCOffset;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/VatDetailType.java b/src/org/uic/barcode/ticket/api/asn/omv1/VatDetailType.java new file mode 100644 index 0000000..9ebb869 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/VatDetailType.java @@ -0,0 +1,87 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.IntRange;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+
+@Sequence
+public class VatDetailType extends Object {
+ public VatDetailType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue = 1, maxValue = 999)
+ public Long country;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue = 0, maxValue = 999)
+ public Long percentage;
+
+ @FieldOrder(order = 2)
+ @Asn1Optional public Asn1BigInteger amount;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String vatId;
+
+ public Long getCountry() {
+ return country;
+ }
+
+ public void setCountry(Long country) {
+ this.country = country;
+ }
+
+ public Long getPercentage() {
+ return percentage;
+ }
+
+ public void setPercentage(Long percentage) {
+ this.percentage = percentage;
+ }
+
+ public Long getAmount() {
+ return Asn1BigInteger.toLong(amount);
+ }
+
+ public void setAmount(Long amount) {
+ this.amount = Asn1BigInteger.toAsn1(amount);
+ }
+
+ public String getVatId() {
+ return vatId;
+ }
+
+ public void setVatId(String vatId) {
+ this.vatId = vatId;
+ }
+
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/ViaStationType.java b/src/org/uic/barcode/ticket/api/asn/omv1/ViaStationType.java new file mode 100644 index 0000000..dfc1e56 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/ViaStationType.java @@ -0,0 +1,181 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+
+@Sequence
+@HasExtensionMarker
+public class ViaStationType extends Object {
+ public ViaStationType() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Default("stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long stationNum;
+
+ @FieldOrder(order = 2)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String stationIA5;
+
+ @FieldOrder(order = 3)
+ @Asn1Optional public SequenceOfViaStationType alternativeRoutes;
+
+ @FieldOrder(order = 4)
+ @Asn1Optional public SequenceOfViaStationType route;
+
+ @FieldOrder(order = 5)
+ @Asn1Optional public Boolean border = false;
+
+ @FieldOrder(order = 6)
+ @Asn1Optional public SequenceOfCarrierNum carriersNum;
+
+ @FieldOrder(order = 7)
+ @Asn1Optional public SequenceOfStringIA5 carriersIA5;
+
+ @FieldOrder(order = 8)
+ @Asn1Optional public Asn1BigInteger seriesId;
+
+ @FieldOrder(order = 9)
+ @Asn1Optional public Asn1BigInteger routeId;
+
+
+
+
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUIC;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public Long getStationNum() {
+
+ return this.stationNum;
+ }
+
+ public String getStationIA5() {
+
+ return this.stationIA5;
+ }
+
+ public SequenceOfViaStationType getAlternativeRoutes() {
+
+ return this.alternativeRoutes;
+ }
+
+ public SequenceOfViaStationType getRoute() {
+
+ return this.route;
+ }
+
+ public Boolean getBorder() {
+
+ return this.border;
+ }
+
+ public SequenceOfCarrierNum getCarriersNum() {
+
+ return this.carriersNum;
+ }
+
+ public SequenceOfStringIA5 getCarriersIA5() {
+
+ return this.carriersIA5;
+ }
+
+ public Long getSeriesId() {
+
+ return Asn1BigInteger.toLong(this.seriesId);
+ }
+
+ public Long getRouteId() {
+
+ return Asn1BigInteger.toLong(this.routeId);
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setStationNum(Long stationNum) {
+
+ this.stationNum = stationNum;
+ }
+
+ public void setStationIA5(String stationIA5) {
+
+ this.stationIA5 = stationIA5;
+ }
+
+ public void setAlternativeRoutes(SequenceOfViaStationType alternativeRoutes) {
+
+ this.alternativeRoutes = alternativeRoutes;
+ }
+
+ public void setRoute(SequenceOfViaStationType route) {
+
+ this.route = route;
+ }
+
+ public void setBorder(Boolean border) {
+
+ this.border = border;
+ }
+
+ public void setCarriersNum(SequenceOfCarrierNum carriersNum) {
+
+ this.carriersNum = carriersNum;
+ }
+
+ public void setCarriersIA5(SequenceOfStringIA5 carriersIA5) {
+
+ this.carriersIA5 = carriersIA5;
+ }
+
+ public void setSeriesId(Long seriesId) {
+
+ this.seriesId = Asn1BigInteger.toAsn1(seriesId);
+ }
+
+ public void setRouteId(Long routeId) {
+
+ this.routeId = Asn1BigInteger.toAsn1(routeId);
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/VoucherData.java b/src/org/uic/barcode/ticket/api/asn/omv1/VoucherData.java new file mode 100644 index 0000000..f721201 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/VoucherData.java @@ -0,0 +1,313 @@ +/*
+ * 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.asn.omv1;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+
+@Sequence
+@HasExtensionMarker
+public class VoucherData extends Object {
+ public VoucherData() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 6)
+ @IntRange(minValue=2016,maxValue=2269)
+ public Long validFromYear;
+
+ @FieldOrder(order = 7)
+ @IntRange(minValue=0,maxValue=370)
+ public Long validFromDay;
+
+ @FieldOrder(order = 8)
+ @IntRange(minValue=2016,maxValue=2269)
+ public Long validUntilYear;
+
+ @FieldOrder(order = 9)
+ @IntRange(minValue=0,maxValue=370)
+ public Long validUntilDay;
+
+ @FieldOrder(order = 10)
+ @Asn1Optional public Long value;
+
+ @FieldOrder(order = 11)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long type;
+
+ @FieldOrder(order = 12)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String infoText;
+
+ @FieldOrder(order = 13)
+ @Asn1Optional public ExtensionData extension;
+
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Asn1BigInteger getReferenceNum() {
+
+ return this.referenceNum;
+ }
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+
+ return this.productIdIA5;
+ }
+
+ public Long getValidFromYear() {
+
+ return this.validFromYear;
+ }
+
+ public Long getValidFromDay() {
+
+ return this.validFromDay;
+ }
+
+ public Long getValidUntilYear() {
+
+ return this.validUntilYear;
+ }
+
+ public Long getValidUntilDay() {
+
+ return this.validUntilDay;
+ }
+
+ public Long getValue() {
+
+ return this.value;
+ }
+
+ public Long getType() {
+
+ return this.type;
+ }
+
+ public String getInfoText() {
+
+ return this.infoText;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setReferenceNum(Asn1BigInteger referenceNum) {
+
+ this.referenceNum = referenceNum;
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setValidFromYear(Long validFromYear) {
+
+ this.validFromYear = validFromYear;
+ }
+
+ public void setValidFromDay(Long validFromDay) {
+
+ this.validFromDay = validFromDay;
+ }
+
+ public void setValidUntilYear(Long validUntilYear) {
+
+ this.validUntilYear = validUntilYear;
+ }
+
+ public void setValidUntilDay(Long validUntilDay) {
+
+ this.validUntilDay = validUntilDay;
+ }
+
+ public void setValue(Long value) {
+
+ this.value = value;
+ }
+
+ public void setType(Long type) {
+
+ this.type = type;
+ }
+
+ public void setInfoText(String infoText) {
+
+ this.infoText = infoText;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+
+ public void setValidity (Date fromDate , Date untilDate){
+
+ Calendar fromCal = Calendar.getInstance();
+ fromCal.clear();
+ fromCal.setTime(fromDate);
+
+ this.validFromYear = new Long( fromCal.get(Calendar.YEAR));
+ this.validFromDay = new Long (fromCal.get(Calendar.DAY_OF_YEAR));
+
+ if (untilDate == null) return;
+
+ Calendar untilCal = Calendar.getInstance();
+ untilCal.clear();
+ untilCal.setTime(untilDate);
+
+ this.validUntilYear = new Long( untilCal.get(Calendar.YEAR));
+ this.validUntilDay = new Long (untilCal.get(Calendar.DAY_OF_YEAR));
+
+ }
+
+
+ public void setValidFrom (Date fromDate){
+
+ if (fromDate == null) return;
+
+ Calendar fromCal = Calendar.getInstance();
+ fromCal.clear();
+ fromCal.setTime(fromDate);
+
+ this.validFromYear = new Long( fromCal.get(Calendar.YEAR));
+ this.validFromDay = new Long (fromCal.get(Calendar.DAY_OF_YEAR));
+
+ }
+
+ public void setValidUntil (Date untilDate){
+
+ if (untilDate == null) return;
+
+ Calendar untilCal = Calendar.getInstance();
+ untilCal.clear();
+ untilCal.setTime(untilDate);
+
+ this.validUntilYear = new Long( untilCal.get(Calendar.YEAR));
+ this.validUntilDay = new Long (untilCal.get(Calendar.DAY_OF_YEAR));
+
+ }
+
+ public Date getValidFrom(){
+
+ if (this.validFromYear == null || this.validFromYear == 0) return null;
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ cal.set(Calendar.YEAR, this.validFromYear.intValue());
+ cal.set(Calendar.DAY_OF_YEAR, this.validFromDay.intValue());
+
+ return cal.getTime();
+
+ }
+
+ public Date getValidUntil(){
+
+ if (this.validUntilYear == null || this.validUntilYear == 0) return null;
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ cal.set(Calendar.YEAR, this.validUntilYear.intValue());
+ cal.set(Calendar.DAY_OF_YEAR, this.validUntilDay.intValue());
+
+ return cal.getTime();
+
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/ZoneType.java b/src/org/uic/barcode/ticket/api/asn/omv1/ZoneType.java new file mode 100644 index 0000000..a22e002 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/ZoneType.java @@ -0,0 +1,182 @@ +/*
+ * 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.asn.omv1;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.OctetString;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfUnrestrictedLong;
+
+@Sequence
+@HasExtensionMarker
+
+public class ZoneType extends Object {
+ public ZoneType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long carrierNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String carrierIA5;
+
+ @FieldOrder(order = 2)
+ @Asn1Default("stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 3)
+ @IntRange(minValue=0,maxValue=9999999)
+ @Asn1Optional public Long entryStationNum;
+
+ @FieldOrder(order = 4)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String entryStationIA5;
+
+ @FieldOrder(order = 5)
+ @IntRange(minValue=0,maxValue=9999999)
+ @Asn1Optional public Long terminatingStationNum;
+
+ @FieldOrder(order = 6)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String terminatingStationIA5;
+
+ @FieldOrder(order = 7)
+ @Asn1Optional public Asn1BigInteger city;
+
+ @FieldOrder(order = 8)
+ @Asn1Optional public SequenceOfUnrestrictedLong zoneId;
+
+ @FieldOrder(order = 9)
+ @Asn1Optional public OctetString binaryZoneId;
+
+ @FieldOrder(order = 10)
+ @Asn1Optional public String nutsCode;
+
+
+ public Long getCarrierNum() {
+
+ return this.carrierNum;
+ }
+
+ public String getCarrierIA5() {
+
+ return this.carrierIA5;
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUIC;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public Long getEntryStationNum() {
+ return this.entryStationNum;
+ }
+
+ public String getEntryStationIA5() {
+ return this.entryStationIA5;
+ }
+
+ public Long getTerminatingStationNum() {
+ return this.terminatingStationNum;
+ }
+
+ public String getTerminatingStationIA5() {
+ return this.terminatingStationIA5;
+ }
+
+ public Asn1BigInteger getCity() {
+ return this.city;
+ }
+
+ public SequenceOfUnrestrictedLong getZoneId() {
+ return this.zoneId;
+ }
+
+ public byte[] getBinaryZoneId() {
+
+ return binaryZoneId.toByteArray();
+
+ }
+
+ public String getNutsCode() {
+ return this.nutsCode;
+ }
+
+ public void setCarrierNum(Long carrierNum) {
+ this.carrierNum = carrierNum;
+ }
+
+ public void setCarrierIA5(String carrierIA5) {
+ this.carrierIA5 = carrierIA5;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setEntryStationNum(Long entryStationNum) {
+ this.entryStationNum = entryStationNum;
+ }
+
+ public void setEntryStationIA5(String entryStationIA5) {
+ this.entryStationIA5 = entryStationIA5;
+ }
+
+ public void setTerminatingStationNum(Long terminatingStationNum) {
+ this.terminatingStationNum = terminatingStationNum;
+ }
+
+ public void setTerminatingStationIA5(String terminatingStationIA5) {
+ this.terminatingStationIA5 = terminatingStationIA5;
+ }
+
+ public void setCity(Asn1BigInteger city) {
+ this.city = city;
+ }
+
+ public void setZoneId(SequenceOfUnrestrictedLong zoneId) {
+ this.zoneId = zoneId;
+ }
+
+ public void setBinaryZoneId(byte[] binaryZoneId) {
+
+ this.binaryZoneId = new OctetString(binaryZoneId);
+
+ }
+
+ public void setNutsCode(String nutsCode) {
+ this.nutsCode = nutsCode;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/uicBarcodeV1finalDelayConfirmation1.3.asn b/src/org/uic/barcode/ticket/api/asn/omv1/uicBarcodeV1finalDelayConfirmation1.3.asn new file mode 100644 index 0000000..24df140 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv1/uicBarcodeV1finalDelayConfirmation1.3.asn @@ -0,0 +1,2046 @@ +-- Creator: ASN.1 Editor (http://asneditor.sourceforge.net) +-- Author: ClemensGantert +-- Created: Tue Aug 11 11:40:28 CEST 2015 +ASN-Module DEFINITIONS AUTOMATIC TAGS ::= BEGIN + +-- imports and exports +-- EXPORTS ALL; + + +-- ############################################################################################## +-- # +-- # Final version 1.3 - value 13 in the UIC bar code version element +-- # (see element 2 in U_FLEX record definition in leaflet 918.9) +-- # +-- ############################################################################################## + + +-- ############################################################################################## +-- # +-- # Naming and encoding conventions +-- # +-- # Elements included as String and as Numeric values: +-- # Some elements are included in different formats to reduce the data size. +-- # These elements must be included only once. +-- # These elements are named with the same name and appendix +-- # Num (numeric values) +-- # IA5 (String values according to ASN IA5String (7Bit)) +-- # Example: +-- # trainNum - in case of a numeric train number +-- # trainIA5 - in case of a alphanumeric train Id +-- # +-- # +-- # RICS codes must be used to encode companies (issuer, product owner, ...) where available +-- # other codes are possible based on bilateral agreements +-- # the format is kept more flexible to cover upcoming extensions of the RICS code by ERA +-- # +-- # Stations can be coded using the UIC and upcoming ERA code lists. Proprietary codes are +-- # possible based on bilateral agreements. Format: 1..9999999 or alphanumeric without +-- # special character (IA5String) +-- # +-- # +-- # ! INTEGERS must not exceed the value of 9,223,372,036,854,775,807 (64 bit) even in case +-- # ! they are unrestricted!!! +-- # ! +-- # ! Some elements like ReferenceNum or cardIdNum are defined as an unrestricted integer. +-- # ! Unlike other numerical values the cardIdNum and referenceNum can be larger than a usual 32 bit Integer +-- # ! Some ASN.1 implementation tools are limited to 32 bit integers which is too small. +-- # ! Please ensure to use a tool capable of dealing with larger numbers. +-- # +-- # BOOLEAN is always non optional +-- # +-- # Encoding of time: +-- # time is encoded as the number of minutes of the day 0 = 00:00, 1440 = 24:00, +-- # time data elements end with "time" in their name +-- # +-- # Encoding of date: +-- # ......................................................................................................... +-- # The issuing date is given in UTC, but some other date values are given in local time where the exact time zone is not known. +-- # +-- # For local dates the date is associated with the corresponding location: +-- # e.g.: +-- # valid from date -> location where the journey starts +-- # valid until date -> location where the journey covered by the ticket ends +-- # +-- # there could be rare cases where this is does not rovide a unique interpretation: +-- # e.g. open ticket or pass without start and end location for a collection of zones or countries with different time zones. +-- # in these cases the fare conditions must clarify the rules for these cases (e.g. by allowing to use the +-- # ticket a few hours after the end of validity). +-- # +-- # If these date values are given as the number of days from the issuing date the following rule applies: +-- # +-- # The difference in days is calculated by ignoring the time zone information in the case no time zone offset is provided. +-- # +-- # example 1: (31.12.2017 23:05 UTC == 01.01.2018 00:05 CET) : +-- # issuing date (UTC): 31.12.2017 23:05 +-- # local date (CET): 01.01.2018 00:05 +-- # -> difference in days = 1 +-- # +-- # example 1: (1.1.2018 22:05 UTC == 01.01.2018 23:05 CET) : +-- # issuing date (UTC): 31.12.2017 22:05 +-- # local date (CET): 01.01.2018 23:05 +-- # -> difference in days = 0 +-- # +-- # the day difference could become -1 although this can happen for localtions in America or New Zeeland only. +-- # +-- # implementation example: +-- # +-- # public static Long getDateDifference(Date issuingDate, Date localDate) { +-- # +-- # if (issuingDate == null || localDate == null) return null; +-- # +-- # Calendar issuingCal = Calendar.getInstance(); +-- # issuingCal.clear(); +-- # issuingCal.setTime(issuingDate); +-- # issuingCal.setTimeZone(TimeZone.getTimeZone("UTC")); +-- # issuingCal.set(Calendar.HOUR_OF_DAY, 0); +-- # issuingCal.set(Calendar.MINUTE, 0); +-- # issuingCal.set(Calendar.SECOND, 0); +-- # issuingCal.set(Calendar.MILLISECOND, 0); +-- # +-- # Calendar fromCal = Calendar.getInstance(); +-- # fromCal.clear(); +-- # fromCal.setTime(localDate); +-- # fromCal.setTimeZone(TimeZone.getTimeZone("UTC")); +-- # fromCal.set(Calendar.HOUR_OF_DAY, 0); +-- # fromCal.set(Calendar.MINUTE, 0); +-- # fromCal.set(Calendar.SECOND, 0); +-- # fromCal.set(Calendar.MILLISECOND, 0); +-- # +-- # long diff = localDate.getTime() - issuingDate.getTime(); +-- # long dayDiff = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS); +-- # +-- # return new Long(dayDiff); +-- # +-- # } +-- # +-- # public static Date getLocalDateFromDifference(Date issuingDate, int diff , Long time ) { +-- # +-- # if (issuingDate == null) return null; +-- # +-- # Calendar cal = Calendar.getInstance(); +-- # cal.clear(); +-- # cal.setTime(issuingDate); +-- # cal.add(Calendar.DAY_OF_YEAR, diff); +-- # +-- # if (time != null) { +-- # int hours = time.intValue() / 60; +-- # int minutes = time.intValue() - hours * 60; +-- # cal.set(Calendar.HOUR_OF_DAY, hours); +-- # cal.set(Calendar.MINUTE,minutes); +-- # } +-- # +-- # return cal.getTime(); +-- # +-- # } +-- # +-- # +-- # ASN.1 Extensions: +-- # +-- # The specification makes use of extension (",..."). +-- # These extesions might be defined in future versions of the UIC specification +-- # Implementations must support the extension feature of ASN.1, at least they must be able to ignore extensions while decoding the data +-- # ASN.1 extensions will be defined by UIC. It is not allowed to define bilateral extensions. +-- # +-- # Bilateral Extensions: +-- # Bilateral extensions can be included in the data element "ExtensionData". +-- # +-- # +-- # +-- ######################################################################################### + + +-- ############################################################################################ + + +-- type assignments + + -- ######################################################################################### + -- the basic entry point of the data structure + -- the data include: + -- -issuer informations + -- -the details of the transport document + -- -informations required for the control process + -- -informations on the travelers independent from the transport document + -- -proprietary extensions + -- + -- ########################################################################################## + UicRailTicketData ::= SEQUENCE { + -- data specific to the issuer + issuingDetail IssuingData, + + -- data on the travelers + travelerDetail TravelerData OPTIONAL, + + -- data of the transport document + --!!! proposal: replace this by a comment in the lealet on the total size of the barcode: more than one document to be used on bilateral agreement only + transportDocument SEQUENCE OF DocumentData OPTIONAL, + + -- data specific to support the ticket control process + controlDetail ControlData OPTIONAL, + + -- proprietary data defined bilaterally + extension SEQUENCE OF ExtensionData OPTIONAL + ,... + } + + + + -- ########################################################################################### + -- the choice on the different transport documents that can be included in the bar code data: + -- - reservation of seat / couchette or berths (IRT, RES, BOA) + -- - reservation of car carriage (VET) + -- - open ticket (NRT including NRT group ticket) (NRT, GRT, SUP, UPD, COI) + -- - Rail passes (including Eurail, Interail and local passes) (RPT) + -- - Voucher (TRV) + -- - Customer Cards (including bonus cards and reduction cards) + -- - counter marks issued for group tickets + -- - parking ground tickets + -- - FIP tickets + -- - station access / station passage tickets + -- - proprietary documents as an extension + -- ############################################################################################ + DocumentData ::= SEQUENCE { + + -- token + -- specific id to be exchanged with the ticket (e.g. id of the phone in case of tickets linked to a phone) + token TokenType OPTIONAL, + + -- choice of the ticket + ticket CHOICE + { + + -- Reservation (without car carriage) (IRT and RES) + reservation ReservationData, + + -- Reservation of car carriage + carCarriageReservation CarCarriageReservationData, + + -- open ticket specification (NRT) + openTicket OpenTicketData, + + -- pass specification (RPT) including Eurail and Interrail + pass PassData, + + -- voucher + voucher VoucherData, + + -- customer card either to identify a customer and / or to provide reductions + customerCard CustomerCardData, + + -- countermark to accompagny a group ticket + counterMark CountermarkData, + + -- car parking slot + parkingGround ParkingGroundData, + + -- FIP duty ticket + fipTicket FIPTicketData, + + -- ticket to pass the gates at a station + stationPassage StationPassageData, + + -- proprietary data defined bilaterally + extension ExtensionData, + + -- delay confirmation + delayConfirmation DelayConfirmation + + ,... + } + ,... + } + + -- ######################################################################################## + -- confirmation of the delay of a train + -- + -- ######################################################################################## + DelayConfirmation ::= SEQUENCE { + + -- reference of the delay confirmation + referenceIA5 IA5String OPTIONAL, + referenceNum INTEGER OPTIONAL, + + -- train number of the delayed train - numeric or alphanumeric + trainNum INTEGER OPTIONAL, + trainIA5 IA5String OPTIONAL, + + -- departure date of the delayed train in local time + -- number of year + departureYear INTEGER (2016..2269) OPTIONAL, + -- number of the day in the year (1.1. = 1) + departureDay INTEGER (1..366) OPTIONAL, + departureTime INTEGER (0..1440) OPTIONAL, + departureUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC + -- (UTC = local + offset * 15 Minutes) + + + -- station where the delay became relevant + stationCodeTable CodeTableType DEFAULT stationUIC, + stationNum INTEGER (1..9999999) OPTIONAL, + stationIA5 IA5String OPTIONAL, + + -- delay in minutes at the mentioned station + delay INTEGER (1..999), + + -- indication that the train was cancelled + trainCancelled BOOLEAN, + + -- type of confirmation provided + confirmationType ConfirmationType DEFAULT travelerDelayConfirmation, + + -- affected original ticket(s) + affectedTickets SEQUENCE OF TicketLinkType OPTIONAL, + + -- info text + infoText UTF8String OPTIONAL, + + -- proprietary data defined bilaterally + extension ExtensionData OPTIONAL + ,... + } + + ConfirmationType ::= ENUMERATED { + trainDelayConfirmation (0), -- confirmation of train delay, whether the traveler was on board in unconfirmed + travelerDelayConfirmation (1), -- confirmation that the traveler was on board of the delayed train + trainLinkedTicketDelay (2) -- confirmation that a ticket linked to the delayed train was issued + ,... + } + + + -- ######################################################################################## + -- Details of the issuer and the issue of the ticket + -- - details on the issuer + -- - indication of test tickets (specimen) + -- - payment details: method of payment, currency + -- - proprietary PNR of the issuer to be used to identify the sale within + -- the issuers ecosystem + -- - web link to display more information for the customer + -- - proprietary extension data + -- ######################################################################################## + IssuingData ::= SEQUENCE { + + -- provider of the signature (RICS code) + securityProviderNum INTEGER (1..32000) OPTIONAL, + securityProviderIA5 IA5String OPTIONAL, + + -- issuer of the transport document if the issuer is different from the security provider + -- (RICS code) + issuerNum INTEGER (1..32000) OPTIONAL, + issuerIA5 IA5String OPTIONAL, + + -- issuing time stamp in UTC + -- number of year + issuingYear INTEGER (2016..2269), + -- number of the day in the year (1.1. = 1) + issuingDay INTEGER (1..366), + -- The number of the minutes of issue might be used in case of account + -- based ticketing whith a delay of n minutes for the replication of central + -- booking data to the control devices (e.g. at SBB) + -- The time can be compared with the last synchronization time of + -- the control device + issuingTime INTEGER (0..1440) OPTIONAL, + + -- name of the issuer (E.g. short name mentioned in RICS code table) + issuerName UTF8String OPTIONAL, + + -- specimen indicates a test specimen not valid for travelling + specimen BOOLEAN, + + -- secure paper indicates that this barcode is issued with a secure paper ticket + -- to ensure the uniqueness of the ticket. This allows to use the same control + -- procedure as for e-tickets also for anonymous tickets + -- the double use of the ticket is in this case excluded by the secure paper + securePaperTicket BOOLEAN, + + -- indicates that the ticket is valid for traveling or still needs activation + activated BOOLEAN, + + -- currency of the price: ISO4217 currency codes + currency IA5String (SIZE(3)) DEFAULT "EUR", + + -- fraction of the prices included + currencyFract INTEGER (1..3) DEFAULT 2, + + -- PNR used by the issuer to identify the document + issuerPNR IA5String OPTIONAL, + + -- proprietary data defined bilaterally + extension ExtensionData OPTIONAL, + + -- location of sale in case of a sale on board of a train + -- numeric train number or aphanumeric id of the train where the ticket was sold + issuedOnTrainNum INTEGER OPTIONAL, + issuedOnTrainIA5 IA5String OPTIONAL, + -- line number + issuedOnLine INTEGER OPTIONAL, + + -- point of sale + pointOfSale GeoCoordinateType OPTIONAL + ,... + } + + -- ################################################################################### + -- data supporting the control process + -- - list of items which the travelder can use to identify himself or the unique + -- usage of the ticket + -- (card ids, parts or identity card numbers, credit card numbers,..) + -- - hints on the validation to be made on board + -- + -- ################################################################################### + ControlData ::= SEQUENCE { + + -- cards that can be used to identify the ticket holder + identificationByCardReference SEQUENCE OF CardReferenceType OPTIONAL, + + -- idcard id must be checked to identify the traveler + identificationByIdCard BOOLEAN, + + -- passport id must be checked to identify the traveler + identificationByPassportId BOOLEAN, + + -- other items which could be used to identify the ticket holder + -- (for future use, code list to be defined) + identificationItem INTEGER OPTIONAL, + + -- validation of the passport is required (e.g. in case of Eurail) + passportValidationRequired BOOLEAN, + + -- online validation of the ticket required + onlineValidationRequired BOOLEAN, + + -- percentage of the tickets to be validated in more detail + -- (i.e. via online check or detailed checks lateron) + randomDetailedValidationRequired INTEGER (0..99) OPTIONAL, + + -- manual validation of the traveler age required (in case of reductions) + ageCheckRequired BOOLEAN, + + -- manual validation of the travelers reduction card required (in case of reductions) + reductionCardCheckRequired BOOLEAN, + + -- controler info text + infoText UTF8String OPTIONAL, + + -- additional tickets that should be controlled + includedTickets SEQUENCE OF TicketLinkType OPTIONAL, + + -- proprietary data defined bilaterally + extension ExtensionData OPTIONAL + ,... + } + + -- ################################################################################ + -- Traveler data + -- these data do not include tariff details of the booked tariffs, + -- tariff data are included in the transport document details and might + -- have a reference to the traveler defined here. + -- - personal data of the travellers + -- - the index of the list can be used to identify the + -- traveler within other contexts (e.g. in assigned tariffs) + -- ################################################################################ + TravelerData ::= SEQUENCE { + -- traveler list + traveler SEQUENCE OF TravelerType OPTIONAL, + + -- ISO 639-1 coding of the language preferred for the traveler / ticket holder + preferredLanguage IA5String (SIZE(2)) OPTIONAL, + + -- name of the group in case of a group ticket + groupName UTF8String OPTIONAL + ,... + } + + -- #################################################################################### + -- the following part contains the different transport document specifications + -- #################################################################################### + + + -- #################################################################################### + -- reservations of seats , couchettes and berths + -- included are the data defined in: + -- - leaflet 918.1 for reservation data exchange + -- - a few additional data currently used by some railways via different interfaces + -- - information on trach an dplafoorm where the coach stops + -- - additional second coach for large groups + -- #################################################################################### + ReservationData ::= SEQUENCE { + + -- train number - numeric or alphanumeric + trainNum INTEGER OPTIONAL, + trainIA5 IA5String OPTIONAL, + + -- departure date in local time + -- number of the days calculated from the issuing date + departureDate INTEGER (-1..370) DEFAULT 0, + + + -- reservation reference according ton 918.1 in case ade via Hermes + referenceIA5 IA5String OPTIONAL, + referenceNum INTEGER OPTIONAL, + + -- organization responsible for the product definition + -- (RICS Code to be used as standard) + productOwnerNum INTEGER (1..32000) OPTIONAL, + productOwnerIA5 IA5String OPTIONAL, + + -- product id to identify the issued product codelist defined by the product owner + productIdNum INTEGER (0..32000) OPTIONAL, + productIdIA5 IA5String OPTIONAL, + + -- service brand: code list https://uic.org/service-brand-code-list + serviceBrand INTEGER (0..32000) OPTIONAL, + serviceBrandAbrUTF8 UTF8String OPTIONAL, + serviceBrandNameUTF8 UTF8String OPTIONAL, + + -- service code list from 918.1 (seat couchette,..) + service ServiceType DEFAULT seat, + + -- code table used to encode stations + stationCodeTable CodeTableType DEFAULT stationUICReservation, + + -- origin station code + fromStationNum INTEGER (1..9999999) OPTIONAL, + fromStationIA5 IA5String OPTIONAL, + + -- destination station code + toStationNum INTEGER (1..9999999) OPTIONAL, + toStationIA5 IA5String OPTIONAL, + + -- origin station name + fromStationNameUTF8 UTF8String OPTIONAL, + + -- destination station name + toStationNameUTF8 UTF8String OPTIONAL, + + -- departure time + departureTime INTEGER (0..1440), + departureUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC + -- (UTC = local + offset * 15 Minutes) + + -- arrival date and time in local time + -- number of days counted from the departure date + -- !!! proposal for change: arrivalDate INTEGER (-1..20) DEFAULT 0, + arrivalDate INTEGER (0..20) DEFAULT 0, + arrivalTime INTEGER (0..1440) OPTIONAL, + arrivalUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC + -- (UTC = local + offset * 15 Minutes) + -- should be omitted in case it is the same as for depature + + -- responsible carriers on the route + carrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL, + carrierIA5 SEQUENCE OF IA5String OPTIONAL, + + -- travel class + classCode TravelClassType DEFAULT second, + + -- service level code list from 918.1 + serviceLevel IA5String (SIZE(1..2)) OPTIONAL, + + -- places + places PlacesType OPTIONAL, + + -- additional places in a second coach + additionalPlaces PlacesType OPTIONAL, + + --bicycle places + bicyclePlaces PlacesType OPTIONAL, + + -- compartment details (open space, wheelchair,..) + compartmentDetails CompartmentDetailsType OPTIONAL, + + -- number of persons on the ticket without place numbers (on IRT) + numberOfOverbooked INTEGER (0..200) DEFAULT 0, + + -- description of berths + berth SEQUENCE OF BerthDetailData OPTIONAL, + + -- tariffs included (Adult, Children,... ) + tariff SEQUENCE OF TariffType OPTIONAL, + + -- type of the price (supplement,... ) + priceType PriceTypeType DEFAULT travelPrice, + + price INTEGER OPTIONAL, + + vatDetail SEQUENCE OF VatDetailType OPTIONAL, + + -- type of supplement - code list from 018.1 + typeOfSupplement INTEGER (0..9) DEFAULT 0, + + numberOfSupplements INTEGER (0..200) DEFAULT 0, + + -- luggage restrictions and registered luggage + -- in case the luggage restrictions are general and do not depend on the + -- ticket type they should not be included + luggage LuggageRestrictionType OPTIONAL, + + infoText UTF8String OPTIONAL, + + + -- bilaterally agreed proprietary extension + extension ExtensionData OPTIONAL + ,... + } + + -- ################################################################################# + -- details on the VAT included to be used in after sale processes + -- ################################################################################# + VatDetailType ::= SEQUENCE { + + -- ISO 3166 numeric country code + country INTEGER (1..999), + + -- 1/10th of a percent + percentage INTEGER (0..999), + + -- amount of VAT, the currency and the currency fraction is included in the issuing data + amount INTEGER OPTIONAL, + + -- european tax id of the company paying VAT + vatId IA5String OPTIONAL + + } + + + -- ################################################################################# + -- reservations of car carriage + -- included are the data defined in: + -- - leaflet 918.1 for reservation data exchange + -- - a few additional data currently used by some railways via different interfaces + -- ################################################################################# + CarCarriageReservationData ::= SEQUENCE { + + trainNum INTEGER OPTIONAL, + trainIA5 IA5String OPTIONAL, + + + -- loading / unloading of the car in local date and time + -- number of the days calculated from the issuing date + beginLoadingDate INTEGER (-1..370) DEFAULT 0, + beginLoadingTime INTEGER (0..1440) OPTIONAL, + endLoadingTime INTEGER (0..1440) OPTIONAL, + loadingUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC + -- (UTC = local + offset * 15 Minutes) + + + -- reservation reference according on 918.1 in case ade via Hermes + referenceIA5 IA5String OPTIONAL, + referenceNum INTEGER OPTIONAL, + + -- organization responsible for the product definition + -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique) + productOwnerNum INTEGER (1..32000) OPTIONAL, + productOwnerIA5 IA5String OPTIONAL, + + -- product id to identify the issued product codelist defined by the product owner + productIdNum INTEGER (0..32000) OPTIONAL, + productIdIA5 IA5String OPTIONAL, + + -- service brand: code list https://uic.org/service-brand-code-list + serviceBrand INTEGER (1..32000) OPTIONAL, + serviceBrandAbrUTF8 UTF8String OPTIONAL, + serviceBrandNameUTF8 UTF8String OPTIONAL, + + stationCodeTable CodeTableType DEFAULT stationUICReservation, + + fromStationNum INTEGER (1..9999999) OPTIONAL, + fromStationIA5 IA5String OPTIONAL, + + toStationNum INTEGER (1..9999999) OPTIONAL, + toStationIA5 IA5String OPTIONAL, + + fromStationNameUTF8 UTF8String OPTIONAL, + toStationNameUTF8 UTF8String OPTIONAL, + + coach IA5String OPTIONAL, + place IA5String OPTIONAL, + + compartmentDetails CompartmentDetailsType OPTIONAL, + + -- description of the car + numberPlate IA5String, + trailerPlate IA5String OPTIONAL, + carCategory INTEGER (0..9), + boatCategory INTEGER (0..6) OPTIONAL, + textileRoof BOOLEAN, + roofRackType RoofRackType DEFAULT norack, + + -- heigth of a roof rack in cm + roofRackHeight INTEGER (0..99) OPTIONAL, + + -- number of boats on a rack + attachedBoats INTEGER (0..2) OPTIONAL, + + -- number of biycles on a rack + attachedBicycles INTEGER (0..4) OPTIONAL, + + -- number of surf boards on a rack + attachedSurfboards INTEGER (0..5) OPTIONAL, + + -- reference to an entry on the loading list + loadingListEntry INTEGER (0..999) OPTIONAL, + loadingDeck LoadingDeckType DEFAULT upper, + + -- responsible carriers on the route (RICS codes) + carrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL, + carrierIA5 SEQUENCE OF IA5String OPTIONAL, + + tariff TariffType, + priceType PriceTypeType DEFAULT travelPrice, + + price INTEGER OPTIONAL, + + vatDetail SEQUENCE OF VatDetailType OPTIONAL, + + infoText UTF8String OPTIONAL, + extension ExtensionData OPTIONAL + ,... + } + + + -- ##################################################################################### + -- data for open tickets (NRT and group tickets) + -- included are the data defined in: + -- - the ticket layout (leaflet 918.8) + -- - the ticket bar code version 3 (leaflet 918.9) + -- - additional data based on 108.1 with some extensions as 108.1 + -- does not provide well structured data, + -- especially concerning regional validity + -- + -- ##################################################################################### + + OpenTicketData ::= SEQUENCE { + + -- reference must be given either in numeric or alphanumeric format + referenceNum INTEGER OPTIONAL, + referenceIA5 IA5String OPTIONAL, + + -- organization responsible for the product definition + -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique) + productOwnerNum INTEGER (1..32000) OPTIONAL, + productOwnerIA5 IA5String OPTIONAL, + + -- product id to identify the issued product codelist defined by the product owner + productIdNum INTEGER (0..32000) OPTIONAL, + productIdIA5 IA5String OPTIONAL, + + -- to support other ticket content (e.g. VDV, UTPF, V�V, CALYPSO) + -- issuer code using the default code table of the product owner + extIssuerId INTEGER OPTIONAL, + -- authorization id provided to the issuer by the product owner + issuerAutorizationId INTEGER OPTIONAL, + + -- ticket includes the return trip + returnIncluded BOOLEAN, + + -- for tickets valid in regions without from or to stations no station is provided + stationCodeTable CodeTableType DEFAULT stationUIC, + fromStationNum INTEGER (1..9999999) OPTIONAL, + fromStationIA5 IA5String OPTIONAL, + + -- for tickets valid in regions without from or to stations no station is provided + toStationNum INTEGER (1..9999999) OPTIONAL, + toStationIA5 IA5String OPTIONAL, + + fromStationNameUTF8 UTF8String OPTIONAL, + toStationNameUTF8 UTF8String OPTIONAL, + + -- description for manual evaluation in case structured data are not available + validRegionDesc UTF8String OPTIONAL, + -- specification of the ordered sequence of valid regions + validRegion SEQUENCE OF RegionalValidityType OPTIONAL, + + -- return route description + -- the return route description can be omitted if it is identical to the + -- inversed outbound validRegion sequence + returnDescription ReturnRouteDescriptionType OPTIONAL, + + -- temporal validity data in local time of the location where the jouney starts + -- number of days from issuing date + validFromDay INTEGER (-1..700) DEFAULT 0, + validFromTime INTEGER (0..1440) OPTIONAL, + validFromUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC + -- (UTC = local + offset * 15 Minutes) + + -- number of days from valid-from date, 0 = first day of validity + validUntilDay INTEGER (0..370) DEFAULT 0, + validUntilTime INTEGER (0..1440) OPTIONAL, + validUntilUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC + -- (UTC = local + offset * 15 Minutes) + -- should be omtted in case it is the same as for depature + + -- list of activated days in case the entire ticket is not activated + -- the day is given by the number of days from the first day of validity + -- 1 = first day of validity + activatedDay SEQUENCE OF INTEGER (0..370) OPTIONAL, + + classCode TravelClassType DEFAULT second, + + -- servicelevel code according to leaflet 918.1 to encode other products + -- (e.g. PREMIUM, ...) + serviceLevel IA5String (SIZE(1..2)) OPTIONAL, + + -- carriers involved in the transport (RICS codes) + -- the indication of carriers is mandatory on international routes, + -- they can be listed here but can also be included in viaDetails + carrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL, + carrierIA5 SEQUENCE OF IA5String OPTIONAL, + + + -- list of service brands for which the ticket is valid + -- in case the included service brands are listed all other brands are excluded + -- service brand: code list https://uic.org/service-brand-code-list + includedServiceBrands SEQUENCE OF INTEGER (1..32000) OPTIONAL, + + -- list of service brands for which the ticket is not valid + -- service brand: code list https://uic.org/service-brand-code-list + excludedServiceBrands SEQUENCE OF INTEGER (1..32000) OPTIONAL, + + tariffs SEQUENCE OF TariffType OPTIONAL, + + price INTEGER OPTIONAL, + + vatDetail SEQUENCE OF VatDetailType OPTIONAL, + + infoText UTF8String OPTIONAL, + + -- additional included open tickets + -- e.g. to include local city traffic on parts of a the route + includedAddOns SEQUENCE OF IncludedOpenTicketType OPTIONAL, + + -- in case the luggage restrictions are general and do not depend + -- on the ticket type they should not be included + luggage LuggageRestrictionType OPTIONAL, + + + + extension ExtensionData OPTIONAL + ,... + } + + + + -- #################################################################################### + -- data for passes + -- included are the data defined in: + -- - the ticket layout (leaflet 918.8) + -- - the ticket bar code version 3 (leaflet 918.8) + -- #################################################################################### + PassData ::= SEQUENCE { + + -- reference must be given in numeric or alphanumeric format + referenceNum INTEGER OPTIONAL, + referenceIA5 IA5String OPTIONAL, + + -- organization responsible for the product definition + -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique) + productOwnerNum INTEGER (1..32000) OPTIONAL, + productOwnerIA5 IA5String OPTIONAL, + + -- product id to identify the issued product codelist defined by the product owner + productIdNum INTEGER (0..32000) OPTIONAL, + productIdIA5 IA5String OPTIONAL, + + -- type of the pass, code list provided by the product owner + -- in case of Eurail: + -- 1 = Interrail + -- 2 = Eurail + -- 3 = Eurail Global (all countries) + passType INTEGER (1..250) OPTIONAL, + + -- literal name of the pass + passDescription UTF8String OPTIONAL, + + classCode TravelClassType DEFAULT second, + + -- begin of validity (local time) + -- number of days from issuing date + validFromDay INTEGER (-1..700) DEFAULT 0, + validFromTime INTEGER (0..1440) OPTIONAL, + validFromUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC + -- (UTC = local + offset * 15 Minutes) + + -- end of validity (local time) + -- number of days from valid from day, 0 = valid on valid-from-date + validUntilDay INTEGER (0..370) DEFAULT 0, + validUntilTime INTEGER (0..1440) OPTIONAL, + validUntilUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC + -- (UTC = local + offset * 15 Minutes) + -- should be omtted in case it is the same as for depature + + + + -- additional validity periods and excluded time ranges + validityPeriodDetails ValidityPeriodDetailType OPTIONAL, + + -- max number of days of validity in case the valid from day is open + numberOfValidityDays INTEGER (0..370) OPTIONAL, + + -- max number of possible trips to be activated + numberOfPossibleTrips INTEGER (1..250) OPTIONAL, + numberOfDaysOfTravel INTEGER (1..250) OPTIONAL, + + -- list of activated days in case the entire ticket is not activated + -- the day is given by the number of days from the first day of validity + -- 0 = first day of validity + activatedDay SEQUENCE OF INTEGER (0..370) OPTIONAL, + + -- included countries, code table according to UIC leaflet 918.9 + countries SEQUENCE OF INTEGER (1..250) OPTIONAL, + + -- included carriers (RICS codes) + includedCarrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL, + includedCarrierIA5 SEQUENCE OF IA5String OPTIONAL, + + -- excluded carriers (RICS codes) + excludedCarrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL, + excludedCarrierIA5 SEQUENCE OF IA5String OPTIONAL, + + -- service brand: code list https://uic.org/service-brand-code-list + includedServiceBrands SEQUENCE OF INTEGER (1..32000) OPTIONAL, + excludedServiceBrands SEQUENCE OF INTEGER (1..32000) OPTIONAL, + + -- region description to cover local zones + validRegion SEQUENCE OF RegionalValidityType OPTIONAL, + + tariffs SEQUENCE OF TariffType OPTIONAL, + + price INTEGER OPTIONAL, + + vatDetail SEQUENCE OF VatDetailType OPTIONAL, + + infoText UTF8String OPTIONAL, + extension ExtensionData OPTIONAL + ,... + } + + ValidityPeriodDetailType ::= SEQUENCE { + validityPeriod SEQUENCE OF ValidityPeriodType OPTIONAL, + excludedTimeRange SEQUENCE OF TimeRangeType OPTIONAL + } + + ValidityPeriodType ::= SEQUENCE { + -- number of days from issuing date (local date) + validFromDay INTEGER (-1..700) DEFAULT 0, + validFromTime INTEGER (0..1440) OPTIONAL, + validFromUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC + -- (UTC = local + offset * 15 Minutes) + + -- number of days from valid from day, 0 = valid on valid from date + validUntilDay INTEGER (0..370) DEFAULT 0, + validUntilTime INTEGER (0..1440) OPTIONAL, + validUntilUTCOffset INTEGER (-60..60) OPTIONAL -- offset in units of 15 minutes from local time to UTC + -- (UTC = local + offset * 15 Minutes) + -- should be omtted in case it is the same as for depature + + } + + TimeRangeType ::= SEQUENCE { + fromTime INTEGER (0..1440), + untilTime INTEGER (0..1440) + } + + -- ###################################################################################### + -- data for vouchers + -- included are quite basic further study is required + -- ###################################################################################### + VoucherData ::= SEQUENCE { + + -- reference must be given in numeric or alphanumeric format + referenceIA5 IA5String OPTIONAL, + referenceNum INTEGER OPTIONAL, + + -- organization responsible for the product definition + -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique) + productOwnerNum INTEGER (1..32000) OPTIONAL, + productOwnerIA5 IA5String OPTIONAL, + + -- product id to identify the issued product codelist defined by the product owner + productIdNum INTEGER (0..32000) OPTIONAL, + productIdIA5 IA5String OPTIONAL, + + -- begin of validity in UTC + -- number of year + validFromYear INTEGER (2016..2269), + -- number of the day in the year (1.1. = 1) + validFromDay INTEGER (0..370), + -- end of validity + -- number of year + validUntilYear INTEGER (2016..2269), + -- number of the day in the year (1.1. = 1) + validUntilDay INTEGER (0..370), + + value INTEGER DEFAULT 0, + + -- type of the voucher, code list defined by the product owner + type INTEGER (1..32000) OPTIONAL, + + infoText UTF8String OPTIONAL, + extension ExtensionData OPTIONAL + ,... + } + -- ################################################################################### + -- data for FIP tickets + -- included are data from the FIP ticket layout, + -- ################################################################################### + FIPTicketData ::= SEQUENCE { + + -- reference must be given in numeric or alphanumeric format + referenceIA5 IA5String OPTIONAL, + referenceNum INTEGER OPTIONAL, + + -- organization responsible for the product definition + -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique) + productOwnerNum INTEGER (1..32000) OPTIONAL, + productOwnerIA5 IA5String OPTIONAL, + + -- product id to identify the issued product codelist defined by the product owner + productIdNum INTEGER (0..32000) OPTIONAL, + productIdIA5 IA5String OPTIONAL, + + -- first day of validity in UTC + --- number of days from issuing date + validFromDay INTEGER (-1..700) DEFAULT 0, + -- last day of validity + -- number of days from valid from day, 0 = first day of validity + validUntilDay INTEGER (0..370) DEFAULT 0, + + -- activated days: list of days for which the ticket is valid + -- the day is given by the number of days from the first day of validity + -- 0 = first day of validity + activatedDay SEQUENCE OF INTEGER (0..370) OPTIONAL, + + -- included carriers + carrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL, + carrierIA5 SEQUENCE OF IA5String OPTIONAL, + + -- number of travel days allowed + numberOfTravelDays INTEGER (1..200), + includesSupplements BOOLEAN, + + -- travel class + classCode TravelClassType DEFAULT second, + extension ExtensionData OPTIONAL + ,... + } + + -- ##################################################################################### + -- data station passage and access + -- ticket used to enter, exit or pass a station without travelling by train. + -- E.g. for staff working in a station. + -- ##################################################################################### + StationPassageData ::= SEQUENCE { + + -- reference must be given in numeric or alphanumeric format + referenceIA5 IA5String OPTIONAL, + referenceNum INTEGER OPTIONAL, + + -- organization responsible for the product definition + -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique) + productOwnerNum INTEGER (1..32000) OPTIONAL, + productOwnerIA5 IA5String OPTIONAL, + + -- product id to identify the issued product codelist defined by the product owner + productIdNum INTEGER (0..32000) OPTIONAL, + productIdIA5 IA5String OPTIONAL, + + productName UTF8String OPTIONAL, + + -- code table used to encode he stations + stationCodeTable CodeTableType DEFAULT stationUIC, + -- list of station where the passage is allowed + stationNum SEQUENCE OF INTEGER OPTIONAL, + stationIA5 SEQUENCE OF IA5String OPTIONAL, + -- station names + stationNameUTF8 SEQUENCE OF UTF8String OPTIONAL, + + -- list of areas in a station where the access is allowed + areaCodeNum SEQUENCE OF INTEGER OPTIONAL, + areaCodeIA5 SEQUENCE OF IA5String OPTIONAL, + -- area names + areaNameUTF8 SEQUENCE OF UTF8String OPTIONAL, + + -- begin of validity in local date and time + -- number of days from issuing date + validFromDay INTEGER (-1..700), + validFromTime INTEGER (0..1440) OPTIONAL, + validFromUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC + -- (UTC = local + offset * 15 Minutes) + + -- end of validity + -- number of days from valid from day, 0 = first day of validity + validUntilDay INTEGER (0..370) DEFAULT 0, + validUntilTime INTEGER (0..1440) OPTIONAL, + validUntilUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC + -- (UTC = local + offset * 15 Minutes) + -- should be omtted in case it is the same as for depature + + + -- number of days for station passage in case the number of days + -- is limited and less that the validity period + numberOfDaysValid INTEGER OPTIONAL, + + extension ExtensionData OPTIONAL + ,... + } + + -- ###################################################################################### + -- data for customer cards + -- included are data from: + -- - �BB requirements on card data + -- - DB Bahncard as HandyTicket + -- note: customer data are included in the traveler data structure + -- ###################################################################################### + CustomerCardData ::= SEQUENCE { + + -- customer details + -- optional, as there might be an anonymous cards + customer TravelerType OPTIONAL, + + -- card id might be numerical or alphanumerical + cardIdIA5 IA5String OPTIONAL, + cardIdNum INTEGER OPTIONAL, + + -- valid from date in UTC + -- number of year + validFromYear INTEGER (2016..2269), + --- number of the day in the year (1.1. = 1) + validFromDay INTEGER (0..370) OPTIONAL, + + --- number of year from valid from year onwards + validUntilYear INTEGER (0..250) DEFAULT 0, + --- number of the day in the year (1.1. = 1) + validUntilDay INTEGER (0..370) OPTIONAL, + + classCode TravelClassType OPTIONAL, + + -- code of the card type code list defined by the issuer + cardType INTEGER (1..1000) OPTIONAL, + + -- readable description of the card type + cardTypeDescr UTF8String OPTIONAL, + + -- customer status code + -- 1 = basic + -- 2 = premium + -- 3 = silver + -- 4 = gold + -- 5 = platinum + -- 6 = senator + -- > 50 - code table of the card issuer + customerStatus INTEGER OPTIONAL, + + -- readable customer status "e.g. gold", + customerStatusDescr IA5String OPTIONAL, + + -- list of included services, + -- 1 = Rail Plus + -- 2 = access to launch + -- > 50 code list of the issuer + includedServices SEQUENCE OF INTEGER OPTIONAL, + + extension ExtensionData OPTIONAL + ,... + } + + -- ###################################################################################### + -- data for customer cards + -- included are data from: + -- - DB parking ground reservation + -- ####################################################################################### + ParkingGroundData ::= SEQUENCE { + + -- booking reference + referenceIA5 IA5String OPTIONAL, + referenceNum INTEGER OPTIONAL, + + parkingGroundId IA5String, + + -- parking date in local date time + -- number of days from the issuing date + fromParkingDate INTEGER (-1..370), + -- number of days from the from parking date in case it is different from that date + untilParkingDate INTEGER (0..370) DEFAULT 0, + + -- organization responsible for the product definition + -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique) + productOwnerNum INTEGER (1..32000) OPTIONAL, + productOwnerIA5 IA5String OPTIONAL, + + -- product id to identify the issued product codelist defined by the product owner + productIdNum INTEGER (0..32000) OPTIONAL, + productIdIA5 IA5String OPTIONAL, + + -- code needed to access the parking lot + accessCode IA5String OPTIONAL, + + location UTF8String, + + stationCodeTable CodeTableType DEFAULT stationUIC, + -- in case the parking ground is associated with a station + stationNum INTEGER OPTIONAL, + stationIA5 UTF8String OPTIONAL, + + specialInformation UTF8String OPTIONAL, + entryTrack UTF8String OPTIONAL, + numberPlate IA5String OPTIONAL, + + price INTEGER OPTIONAL, + vatDetail SEQUENCE OF VatDetailType OPTIONAL, + + + extension ExtensionData OPTIONAL + ,... + } + + -- ####################################################################### + -- data for countermarks issued with group tickets + -- included are data from: + -- - version 3 bar code (leaflet 918.9) + -- - printed layout (leaflet 918.8) + -- ######################################################################## + CountermarkData ::= SEQUENCE { + + referenceIA5 IA5String OPTIONAL, + referenceNum INTEGER OPTIONAL, + + -- organization responsible for the product definition + -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique) + productOwnerNum INTEGER (1..32000) OPTIONAL, + productOwnerIA5 IA5String OPTIONAL, + + -- product id to identify the issued product codelist defined by the product owner + productIdNum INTEGER (0..32000) OPTIONAL, + productIdIA5 IA5String OPTIONAL, + + -- reference of the group ticket + ticketReferenceIA5 IA5String OPTIONAL, + ticketReferenceNum INTEGER OPTIONAL, + + -- sequential number of the countermark + numberOfCountermark INTEGER (1..200), + -- total number of countermarks + totalOfCountermarks INTEGER (1..200), + -- name of the group + groupName UTF8String, + + + stationCodeTable CodeTableType DEFAULT stationUIC, + + fromStationNum INTEGER (1..9999999) OPTIONAL, + fromStationIA5 IA5String OPTIONAL, + + toStationNum INTEGER (1..9999999) OPTIONAL, + toStationIA5 IA5String OPTIONAL, + + fromStationNameUTF8 UTF8String OPTIONAL, + toStationNameUTF8 UTF8String OPTIONAL, + + -- description for manual evaluation in case structured data are not available + validRegionDesc UTF8String OPTIONAL, + -- specification of the ordered sequence of valid regions + validRegion SEQUENCE OF RegionalValidityType OPTIONAL, + + + -- ticket includes the return trip + returnIncluded BOOLEAN, + -- retrurn route description + -- can be omitted if it is identical to the inversed outbound validRegion sequence + returnDescription ReturnRouteDescriptionType OPTIONAL, + + -- local date + -- number of days from issuing date + validFromDay INTEGER (-1..700) DEFAULT 0, + validFromTime INTEGER (0..1440) OPTIONAL, + validFromUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC + -- (UTC = local + offset * 15 Minutes) + + + + -- number of days from valid from day, 0 = first day of validity + validUntilDay INTEGER (0..370) DEFAULT 0, + validUntilTime INTEGER (0..1440) OPTIONAL, + validUntilUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC + -- (UTC = local + offset * 15 Minutes) + -- should be omtted in case it is the same as for depature + + + classCode TravelClassType DEFAULT second, + + -- valid carriers + carrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL, + carrierIA5 SEQUENCE OF IA5String OPTIONAL, + + -- service brands where the ticket is valid + -- in case this list is provided the ticket is invalid on all other service brands + -- service brand: code list https://uic.org/service-brand-code-list + includedServiceBrands SEQUENCE OF INTEGER (1..32000) OPTIONAL, + + -- service brands where the ticket is not valid + -- in case this list is provided the ticket is valid on all other service brands + excludedServiceBrands SEQUENCE OF INTEGER (1..32000) OPTIONAL, + + infoText UTF8String OPTIONAL, + + extension ExtensionData OPTIONAL + ,... + } + + + -- ########################################################################################### + -- generic non standard extension element + -- the generic non - standard element contains: + -- - an extension id to distinguish different extensions + -- - the extension data as binary data + -- proprietary extensions are by definition proprietary. This standard provides + -- the means to identify these extensions + -- within the data and to skip these data. + -- the evaluation of these data and the unique identification of the extensions + -- via the extension id is in the + -- responsibility of the railways which use these extensions. + -- ########################################################################################### + ExtensionData ::= SEQUENCE { + extensionId IA5String, + extensionData OCTET STRING + } + + -- ############################################################################################ + -- type definitions + -- ############################################################################################ + + -- ############################################################################################# + -- included open ticke for a part of the travel (e.g. local city trafic) + -- - data identically already included in the covering open ticket do not need to be + -- repeated here + -- - main source are the data required for included regional and city traffic tickets + -- ############################################################################################# + IncludedOpenTicketType ::= SEQUENCE { + + -- organization responsible for the product definition + -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique) + productOwnerNum INTEGER (1..32000) OPTIONAL, + productOwnerIA5 IA5String OPTIONAL, + + -- product id to identify the issued product codelist defined by the product owner + productIdNum INTEGER (0..32000) OPTIONAL, + productIdIA5 IA5String OPTIONAL, + + -- issuer code using the default code table of the product owner (today used e.g. by VDV) + externalIssuerId INTEGER OPTIONAL, + -- authorization id provided to the issuer by the poroduct owner (today used e.g. by VDV) + issuerAutorizationId INTEGER OPTIONAL, + + -- regional validity data + stationCodeTable CodeTableType DEFAULT stationUIC, + -- specification of the ordered sequence of valid regions, ordered in the direction of travel + validRegion SEQUENCE OF RegionalValidityType OPTIONAL, + + -- temporal validity data in local date and time + -- number of days from issuing date + validFromDay INTEGER (-1..700) DEFAULT 0, + validFromTime INTEGER (0..1440) OPTIONAL, + validFromUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC + -- (UTC = local + offset * 15 Minutes) + + + -- number of days from valid-from date, 0 = first day of validity + validUntilDay INTEGER (0..370) DEFAULT 0, + validUntilTime INTEGER (0..1440) OPTIONAL, + validUntilUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC + -- (UTC = local + offset * 15 Minutes) + -- should be omtted in case it is the same as for depature + + + -- travel class to be given in case it differs from the class of the main ticket + classCode TravelClassType OPTIONAL, + -- servicelevel code according to leaflet 918.1 to encode other products (e.g. PREMIUM, ...) + -- to be provided in case it differs from the main ticket + serviceLevel IA5String (SIZE(1..2)) OPTIONAL, + + -- valid carriers (RICS codes) + carrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL, + carrierIA5 SEQUENCE OF IA5String OPTIONAL, + + -- service brands where the ticket is valid + -- in case this list is provided the ticket is invalid on all other service brands + -- service brand: code list https://uic.org/service-brand-code-list + includedServiceBrands SEQUENCE OF INTEGER (1..32000) OPTIONAL, + + -- service brands where the ticket is not valid + -- in case this list is provided the ticket is valid on all other service brands + excludedServiceBrands SEQUENCE OF INTEGER (1..32000) OPTIONAL, + + tariffs SEQUENCE OF TariffType OPTIONAL, + infoText UTF8String OPTIONAL, + extension ExtensionData OPTIONAL + ,... + } + + -- ###################################################################################### + -- tariff data for open tickets + -- information included are: + -- - number of passengers + -- - optionally a link to the traveler data + -- ####################################################################################### + TariffType ::= SEQUENCE { + + -- number of passengers using the tariff + numberOfPassengers INTEGER (1..200) DEFAULT 1, + + -- type indication youth, adult, senior,.. + passengerType PassengerType OPTIONAL, + + -- age restrictions of the tariff + ageBelow INTEGER (1..64) OPTIONAL, + ageAbove INTEGER (1..128) OPTIONAL, + + + -- named traveler list + -- link to the traveler in case the travelers have to be named (e.g. Eurail passes) + -- the number indicates the position in the traveler list starting from 1 + travelerid SEQUENCE OF INTEGER (0..254) OPTIONAL, + + -- restriction on country of residence + -- this tariff is restricted by the country of residence given in the traveler data + -- (e.g. Eurail tickets are not valid in the contry of residence) + restrictedToCountryOfResidence BOOLEAN, + + -- section in case the tariff applies to a part of the route only + restrictedToRouteSection RouteSectionType OPTIONAL, + + -- details on series according to lesaflet 108.1 + seriesDataDetails SeriesDetailType OPTIONAL, + + -- tariff code + tariffIdNum INTEGER OPTIONAL, + tariffIdIA5 IA5String OPTIONAL, + + -- tariff description + tariffDesc UTF8String OPTIONAL, + + -- reduction cards applied (incl. dicount cards, loaylty cards relevant for the tariff) + reductionCard SEQUENCE OF CardReferenceType OPTIONAL + ,... + } + + SeriesDetailType ::= SEQUENCE { + + -- data related to tariffs based on series according UIC leaflet 108.1 + -- supplying carrier according to UIC leaflet 108.1 (RICS code) + supplyingCarrier INTEGER (1..32000) OPTIONAL, + + -- offer identifier of the carrier according to UIC leaflet 108.1 + offerIdentification INTEGER (1..99) OPTIONAL, + + -- series of the carrier according to UIC leaflet 108.1 + series INTEGER OPTIONAL + } + + + RouteSectionType ::= SEQUENCE { + + stationCodeTable CodeTableType DEFAULT stationUIC, + fromStationNum INTEGER (1..9999999) OPTIONAL, + fromStationIA5 IA5String OPTIONAL, -- IA5 or Num not both + + toStationNum INTEGER (1..9999999) OPTIONAL, + toStationIA5 IA5String OPTIONAL, -- IA5 or Num not both + + fromStationNameUTF8 UTF8String OPTIONAL, + toStationNameUTF8 UTF8String OPTIONAL + } + + + -- ####################################################################################### + -- customer card reference + -- ####################################################################################### + CardReferenceType ::= SEQUENCE { + + -- issuer of the card + -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique) + cardIssuerNum INTEGER (1..32000) OPTIONAL, + cardIssuerIA5 IA5String OPTIONAL, + + cardIdNum INTEGER OPTIONAL, + cardIdIA5 IA5String OPTIONAL, + + -- Name of the card e.g. "VISA-CARD" + cardName UTF8String OPTIONAL, + + -- type of the card, code list defined by the issuer + cardType INTEGER OPTIONAL, + + -- in case only the leading part of the card number is provided + leadingCardIdNum INTEGER OPTIONAL, + leadingCardIdIA5 IA5String OPTIONAL, + + + -- in case only the trailing part of the card number is provided + trailingCardIdNum INTEGER OPTIONAL, + trailingCardIdIA5 IA5String OPTIONAL + + ,... + } + + -- ####################################################################################### + -- traveler data + -- - traveler data might contain all traveler details which are independent + -- from the type of travel document + -- e.g. it can include the date of birth as this is part of the traveler + -- but not the indication "Senior" as this is tariff dependent + -- + -- ####################################################################################### + TravelerType ::= SEQUENCE { + + firstName UTF8String OPTIONAL, + secondName UTF8String OPTIONAL, + lastName UTF8String OPTIONAL, + idCard IA5String OPTIONAL, + passportId IA5String OPTIONAL, + title IA5String (SIZE(1..3)) OPTIONAL, + gender GenderType OPTIONAL, + + -- customer id might be numerical or alphanumerical + customerIdIA5 IA5String OPTIONAL, + customerIdNum INTEGER OPTIONAL, + + -- date of birth + -- number of year + yearOfBirth INTEGER (1901..2155) OPTIONAL, + -- number of the day in the year (1.1. = 1) + dayOfBirth INTEGER (0..370) OPTIONAL, + + -- indicates the ticket holder/group leader in case of groups + ticketHolder BOOLEAN, + + passengerType PassengerType OPTIONAL, + + passengerWithReducedMobility BOOLEAN OPTIONAL, + + -- country of residence (numeric ISO country code) + -- to be used in case there product restrictions on the country of residence (e.g. Eurail passes) + countryOfResidence INTEGER (1..999) OPTIONAL, + + countryOfPassport INTEGER (1..999) OPTIONAL, + countryOfIdCard INTEGER (1..999) OPTIONAL, + + status SEQUENCE OF CustomerStatusType OPTIONAL + ,... + } + + CustomerStatusType ::= SEQUENCE { + + -- compagny providing the status, default is the issuer + -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique) + statusProviderNum INTEGER (1..32000) OPTIONAL, + statusProviderIA5 IA5String OPTIONAL, + + -- customer status code + -- 1 = basic + -- 2 = premium + -- 3 = silver + -- 4 = gold + -- 5 = platinum + -- 6 = senator + -- > 50 - code table of the card issuer + customerStatus INTEGER OPTIONAL, + + -- customer status "gold" + customerStatusDescr IA5String OPTIONAL + } + + + ReturnRouteDescriptionType ::= SEQUENCE { + + fromStationNum INTEGER (1..9999999) OPTIONAL, + fromStationIA5 IA5String OPTIONAL, + + toStationNum INTEGER (1..9999999) OPTIONAL, + toStationIA5 IA5String OPTIONAL, + + fromStationNameUTF8 UTF8String OPTIONAL, + toStationNameUTF8 UTF8String OPTIONAL, + + -- description for manual evaluation in case structured data are not available + validReturnRegionDesc UTF8String OPTIONAL, + + -- specification of the ordered sequence of valid regions for the return trip + validReturnRegion SEQUENCE OF RegionalValidityType OPTIONAL + ,... + + } + + -- ###################################################################################### + -- regional validity of an open ticket + -- specification of the regional validity. + -- ###################################################################################### + + RegionalValidityType ::= CHOICE { + trainLink TrainLinkType, + viaStations ViaStationType, + zones ZoneType, + lines LineType, + polygone PolygoneType + ,... + } + + + + -- ####################################################################################### + -- train link data + -- includes a restriction of an open ticket valid only on a specific train + -- and date on a part of the route + -- ####################################################################################### + TrainLinkType ::= SEQUENCE { + + trainNum INTEGER OPTIONAL, + trainIA5 IA5String OPTIONAL, + + -- local date at the station where the train link starts + -- days from the issuing date onwards + travelDate INTEGER (-1..370), + departureTime INTEGER (0..1440), -- time in minutes + departureUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC + -- (UTC = local + offset * 15 Minutes) + + fromStationNum INTEGER (1..9999999) OPTIONAL, + fromStationIA5 IA5String OPTIONAL, + + toStationNum INTEGER (1..9999999) OPTIONAL, + toStationIA5 IA5String OPTIONAL, + + fromStationNameUTF8 UTF8String OPTIONAL, + toStationNameUTF8 UTF8String OPTIONAL + + } + + + + -- ###################################################################################### + -- regional validity using a set of lines + -- - based on data used in regional city trafic enviromnemnts + -- ###################################################################################### + LineType ::= SEQUENCE { + + -- local service provider / carrier within the zone + -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique) + carrierNum INTEGER (1..32000) OPTIONAL, + carrierIA5 IA5String OPTIONAL, + + -- ids of the valid lines known by the local carriers in that zone + lineId SEQUENCE OF INTEGER OPTIONAL, + + stationCodeTable CodeTableType DEFAULT stationUIC, + + -- in case the zone must be entered via a specific station + -- (e.g. local city trafic at the end of a journey + -- starting from the main train station) + entryStationNum INTEGER (1..9999999) OPTIONAL, + entryStationIA5 IA5String OPTIONAL, + + -- in case the zone must be left via a specific station + -- (e.g. local city trafic at the beginning of a journey + -- terminating at the main train station) + terminatingStationNum INTEGER (1..9999999) OPTIONAL, + terminatingStationIA5 IA5String OPTIONAL, + + -- code of the local city in case the zone is part of regional city transport + -- code list of the local carrier + city INTEGER (1..9999999) OPTIONAL, + + -- binary encoding of zones, encoding speciofication provided by + -- the local service provider + binaryZoneId OCTET STRING OPTIONAL + ,... + } + + + -- ################################################################################# + -- regional validity in a zone + -- - based on data used in regional city trafic enviromnemnts + -- ################################################################################# + ZoneType ::= SEQUENCE { + + -- local service provider / carrier within the zone + -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique) + carrierNum INTEGER (1..32000) OPTIONAL, + carrierIA5 IA5String OPTIONAL, + + stationCodeTable CodeTableType DEFAULT stationUIC, + -- in case the zone must be entered via a specific station + -- (e.g. local city trafic at the end of a journey starting + -- from the main train station) + entryStationNum INTEGER (1..9999999) OPTIONAL, + entryStationIA5 IA5String OPTIONAL, + + -- in case the zone must be left via a specific station + -- (e.g. local city trafic at the beginning of a journey + -- terminating at the main train station) + terminatingStationNum INTEGER (1..9999999) OPTIONAL, + terminatingStationIA5 IA5String OPTIONAL, + + -- code of the local city in case the zone is part of regional + -- city transport code list of the local carrier + city INTEGER OPTIONAL, + + -- ids of the valid zones known by the local carriers in that zone + zoneId SEQUENCE OF INTEGER OPTIONAL, + + -- binary encoding of zones, encoding specification provided by + -- the local service provider + binaryZoneId OCTET STRING OPTIONAL, + + -- EU NUTS code for a region + nutsCode IA5String OPTIONAL + ,... + } + + + -- ################################################################################## + -- via station + -- includes a description of of the route by via stations. + -- Via stations follow the description in leaflet 108.1: + -- via stations can e mandatory to pass (but there does not need to be a + -- train stop at this stations): visible route description: "*station*" + -- there can be a list of alternative routes: + -- visible route description: "*(station1/station2)*" + -- there can also be alternative routes: + -- "*(station1*station2/station3*station4)*" although the + -- definition in 108.2 is not very precice on this option + -- ################################################################################### + ViaStationType ::= SEQUENCE { + + stationCodeTable CodeTableType DEFAULT stationUIC, + -- mandatory via station + stationNum INTEGER (1..9999999) OPTIONAL, + stationIA5 IA5String OPTIONAL, + + -- list of alternative routes, one of these has to be taken + alternativeRoutes SEQUENCE OF ViaStationType OPTIONAL, + + -- list of stations along the route + route SEQUENCE OF ViaStationType OPTIONAL, + border BOOLEAN, + + -- carrier responsible for the transport starting at this station (RICS-Code) + -- in case the carrier is included here it might be omitted + -- in the carrier list of the region data + carrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL, + carrierIA5 SEQUENCE OF IA5String OPTIONAL, + + -- the route id as series number as defined in 108.1 data + seriesId INTEGER OPTIONAL, + + -- route id of the route code list defined by the carrier on that route + routeId INTEGER OPTIONAL + ,... + } + + + PolygoneType ::= SEQUENCE { + firstEdge GeoCoordinateType, + edges SEQUENCE OF DeltaCoordinates + } + + + -- ########################################################################################### + -- TokenType provides an additional identifier + -- known use cases + -- - identified of the mobile phone for tickets linked with a specific phone (e.g. VDV standard) + -- ########################################################################################### + TokenType ::= SEQUENCE { + -- provider of the token + tokenProviderNum INTEGER OPTIONAL, + tokenProviderIA5 IA5String OPTIONAL, + + -- in case the provider has multiple tokens + tokenSpecification IA5String OPTIONAL, + token OCTET STRING + } + + -- ########################################################################################### + -- TicketLinkType is used to define a link from the ticket in the bar code to another ticket + -- (requirement from Eurail) + -- use cases + -- - DB Alleo (open ticket + reservation) + -- - reservation of trailer and car carriage and traveller reservation + -- - link between open ticket and bicycle reservations or pass + -- - open ticket and vouchers for meals + -- ########################################################################################### + TicketLinkType ::= SEQUENCE { + + -- data to reference the external ticket + -- reference must be given in numeric or alphanumeric format + referenceIA5 IA5String OPTIONAL, + referenceNum INTEGER OPTIONAL, + + issuerName UTF8String OPTIONAL, -- name of the issuer + + issuerPNR IA5String OPTIONAL, -- in case the ticket can also be identified via + -- the issuer PNR + + -- organization responsible for the product definition + -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique) + productOwnerNum INTEGER (1..32000) OPTIONAL, + productOwnerIA5 IA5String OPTIONAL, + + -- type of linked ticket + ticketType TicketType DEFAULT openTicket, + + -- type of link + linkMode LinkMode DEFAULT issuedTogether + ,... + } + + -- ############################################################################################ + -- code table used fort station codes + -- defines the code table used e.g. to define station code + -- - stationUIC = station codes as used in UIC leaflet 108.1 for open tickets + -- - stationUICReservation = station codes as used in Reservation leaflets 918.1 and 108.2 + -- ############################################################################################ + + CodeTableType ::= ENUMERATED { + -- standard UIC station code from MERITS (UIC country code + 5 digit local code) + stationUIC (0), + -- standard UIC station code for reservation + stationUICReservation (1), + -- future standard ERA station code + stationERA (2), + -- local carrier code list + -- e.g. in case of stations / stops of non-railways stops (city trafic) + localCarrierStationCodeTable (3), + + -- non standard code to be used within the issuer eco system only + -- not applicable for multi carrier travel documents + -- or in case issuer and carrier are different + proprietaryIssuerStationCodeTable (4) + + } + + + ServiceType ::= ENUMERATED { + seat (0), + couchette (1), + berth (2), + carcarriage (3) + } + + + PassengerType ::= ENUMERATED { + adult (0), + senior (1), + child (2), + youth (3), + dog (4), + bicycle (5), + freeAddonPassenger (6), + freeAddonChild (7) + ,... + } + + TicketType ::= ENUMERATED { + openTicket (0), + pass (1), + reservation (2), + carCarriageReservation (3) + ,... + } + + LinkMode ::= ENUMERATED { + issuedTogether (0), + onlyValidInCombination (1) + ,... + } + + + -- #################################################################################### + -- place data corresponding to leaflet 918.1 + -- placeString = place number ranges in case of groups + -- #################################################################################### + PlacesType ::= SEQUENCE { + coach IA5String OPTIONAL, + + -- printable place string ("15-18, 21, 22" ) + placeString IA5String OPTIONAL, + + -- printable place description + placeDescription UTF8String OPTIONAL, + + -- individual places + placeIA5 SEQUENCE OF IA5String OPTIONAL, + placeNum SEQUENCE OF INTEGER (1..254) OPTIONAL + } + + PriceTypeType ::= ENUMERATED { + noPrice (0), + reservationFee (1), + supplement (2), + travelPrice (3) + } + + BerthTypeType ::= ENUMERATED { + single (0), + special (1), + double (2), + t2 (3), + t3 (4), + t4 (5) + } + + CompartmentGenderType ::= ENUMERATED { + unspecified (0), + family (1), + female (2), + male (3), + mixed (4) + ,... + } + + GenderType ::= ENUMERATED { + unspecified (0), + female (1), + male (2), + other (3) + ,... + } + + TravelClassType ::= ENUMERATED { + notApplicable (0), + first (1), + second (2), + tourist (3), + comfort (4), + premium (5), + business (6), + all (7) + ,... + } + + -- ######################################################################################## + -- sleeper compartment types corresponding to leaflet 918.1 + -- ######################################################################################## + BerthDetailData ::= SEQUENCE { + berthType BerthTypeType, + numberOfBerths INTEGER (1..999), + gender CompartmentGenderType DEFAULT family + ,... + } + + -- #################################################################################### + -- compartment details corresponding to leaflet 918.1 + -- #################################################################################### + CompartmentDetailsType ::= SEQUENCE { + coachType INTEGER (1..99) OPTIONAL, + compartmentType INTEGER (1..99) OPTIONAL, + specialAllocation INTEGER (1..99) OPTIONAL, + coachTypeDescr UTF8String OPTIONAL, + compartmentTypeDescr UTF8String OPTIONAL, + specialAllocationDescr UTF8String OPTIONAL, + position CompartmentPositionType DEFAULT unspecified + ,... + } + + + -- ##################################################################################### + -- luggage restrictions + -- the basis for these data is week: + -- SCIC mentions a maximum of three pieces of hand luggage but does not includes + -- a definition of hand luggaage + -- SCIC referes to special conditions on registered lluggage, but SCIC NRT does + -- not contain definitions on that and UIC 108.1 does not + -- contain data structures for luggage + -- - current THALYS luggage resrictions + -- ##################################################################################### + LuggageRestrictionType ::= SEQUENCE { + -- allowed hand luggage pieces on this ticket (3 = default in current NRT tariff) + maxHandLuggagePieces INTEGER(0..99) DEFAULT 3, + -- allowed hand luggage pieces on this ticket (3 = default in current NRT tariff) + maxNonHandLuggagePieces INTEGER(0..99) DEFAULT 1, + registeredLuggage SEQUENCE OF RegisteredLuggageType OPTIONAL + ,... + + } + + RegisteredLuggageType ::= SEQUENCE { + -- id of the additional registered luggage + registrationId IA5String OPTIONAL, + -- maximum weight in kg + maxWeight INTEGER (1..99) OPTIONAL, + -- sum of length with and height in cm + maxSize INTEGER (1..300) OPTIONAL + ,... + + } + + -- ########################################################################################## + -- generic type for geo coordinates + -- ########################################################################################## + GeoCoordinateType ::= SEQUENCE { + geoUnit GeoUnitType DEFAULT milliDegree, + coordinateSystem GeoCoordinateSystemType DEFAULT wgs84, + -- separate hemishpere flag reduces the data size + hemisphereLongitude HemisphereLongitudeType DEFAULT north, + -- separate hemishpere flag reduces the data size + hemisphereLatitude HemisphereLatitudeType DEFAULT east, + longitude INTEGER, + latitude INTEGER, + accuracy GeoUnitType OPTIONAL + } + + DeltaCoordinates ::= SEQUENCE { + -- logitude difference to a reference point + longitude INTEGER, + -- latitude difference to a reference point + latitude INTEGER + } + + GeoCoordinateSystemType ::= ENUMERATED { + wgs84 (0), -- WGS 84 standard system + grs80 (1) -- (outdated) GRS 80 coordinate system + } + + GeoUnitType ::= ENUMERATED { + microDegree (0), -- approx. 11 cm on earth surface + tenthmilliDegree (1), -- 1 / 100000 degree is approx. 1.1 meter on earth surface + milliDegree (2), -- approx 110 meter on earth surface + centiDegree (3), + deciDegree (4) + } + + HemisphereLongitudeType ::= ENUMERATED { + north (0), + south (1) + } + + HemisphereLatitudeType ::= ENUMERATED { + east (0), + west (1) + } + + LoadingDeckType ::= ENUMERATED { + unspecified (0), + upper (1), + lower (2) + } + + CompartmentPositionType ::= ENUMERATED { + unspecified (0), + upperLevel (1), + lowerLevel (2) + } + + RoofRackType ::= ENUMERATED { + norack (0), + roofRailing (1), + luggageRack (2), + skiRack (3), + boxRack (4), + rackWithOneBox (5), + rackWithTwoBoxes (6), + bicycleRack (7), + otherRack (8) + ,... + } + +END
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/BerthDetailData.java b/src/org/uic/barcode/ticket/api/asn/omv2/BerthDetailData.java new file mode 100644 index 0000000..f4d2677 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/BerthDetailData.java @@ -0,0 +1,79 @@ +/*
+ * 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.asn.omv2;
+
+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;
+
+
+@Sequence
+@HasExtensionMarker
+public class BerthDetailData extends Object {
+ public BerthDetailData() {
+ }
+
+ @FieldOrder(order = 0)
+ public BerthTypeType berthType;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue=1, maxValue=999)
+ public Long numberOfBerths;
+
+ @FieldOrder(order = 2)
+ @Asn1Default(value="family")
+ @Asn1Optional public CompartmentGenderType gender;
+
+
+ public BerthTypeType getBerthType() {
+ return this.berthType;
+ }
+
+ public Long getNumberOfBerths() {
+ return this.numberOfBerths;
+ }
+
+ public CompartmentGenderType getGender() {
+
+ if (gender == null){
+ return CompartmentGenderType.family;
+ } else {
+ return this.gender;
+ }
+ }
+
+ public void setBerthType(BerthTypeType berthType) {
+
+ this.berthType = berthType;
+ }
+
+ public void setNumberOfBerths(Long numberOfBerths) {
+ this.numberOfBerths = numberOfBerths;
+ }
+
+ public void setGender(CompartmentGenderType gender) {
+ this.gender = gender;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/BerthTypeType.java b/src/org/uic/barcode/ticket/api/asn/omv2/BerthTypeType.java new file mode 100644 index 0000000..074ca4c --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/BerthTypeType.java @@ -0,0 +1,41 @@ +/*
+ * 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.asn.omv2;
+
+public enum BerthTypeType {
+ single("single"),
+ special("special"),
+ double_("double_"),
+ t2("t2"),
+ t3("t3"),
+ t4("t4");
+
+
+ public String text;
+
+ BerthTypeType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/CarCarriageReservationData.java b/src/org/uic/barcode/ticket/api/asn/omv2/CarCarriageReservationData.java new file mode 100644 index 0000000..9bab332 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/CarCarriageReservationData.java @@ -0,0 +1,734 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCarrierNum;
+
+
+
+@Sequence
+@HasExtensionMarker
+public class CarCarriageReservationData extends Object {
+ public CarCarriageReservationData() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public Asn1BigInteger trainNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String trainIA5;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=-1,maxValue=370)
+ @Asn1Default(value="0")
+ @Asn1Optional public Long beginLoadingDate;
+
+ @FieldOrder(order = 3)
+ @IntRange(minValue=0,maxValue=1439)
+ @Asn1Optional public Long beginLoadingTime;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=0,maxValue=1439)
+ @Asn1Optional public Long endLoadingTime;
+
+ @FieldOrder(order = 5)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long loadingUTCOffset;
+
+ @FieldOrder(order = 6)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 7)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 8)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 9)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 10)
+ @IntRange(minValue=0,maxValue=65535)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 11)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 12)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long serviceBrand;
+
+ @FieldOrder(order = 13)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String serviceBrandAbrUTF8;
+
+ @FieldOrder(order = 14)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String serviceBrandNameUTF8;
+
+ @FieldOrder(order = 15)
+ @Asn1Default("stationUICReservation")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 16)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long fromStationNum;
+
+ @FieldOrder(order = 17)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String fromStationIA5;
+
+ @FieldOrder(order = 18)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long toStationNum;
+
+ @FieldOrder(order = 19)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String toStationIA5;
+
+ @FieldOrder(order = 20)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String fromStationNameUTF8;
+
+ @FieldOrder(order = 21)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String toStationNameUTF8;
+
+ @FieldOrder(order = 22)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String coach;
+
+ @FieldOrder(order = 23)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String place;
+
+ @FieldOrder(order = 24)
+ @Asn1Optional public CompartmentDetailsType compartmentDetails;
+
+ @FieldOrder(order = 25)
+ @RestrictedString(CharacterRestriction.IA5String)
+ public String numberPlate;
+
+ @FieldOrder(order = 26)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String trailerPlate;
+
+ @FieldOrder(order = 27)
+ @IntRange(minValue=0,maxValue=9)
+ public Long carCategory;
+
+ @FieldOrder(order = 28)
+ @IntRange(minValue=0,maxValue=6)
+ @Asn1Optional public Long boatCategory;
+
+ @FieldOrder(order = 29)
+ public Boolean textileRoof = false;
+
+ @FieldOrder(order = 30)
+ @Asn1Default(value ="norack")
+ @Asn1Optional public RoofRackType roofRackType;
+
+ @FieldOrder(order = 31)
+ @IntRange(minValue=0,maxValue=99)
+ @Asn1Optional public Long roofRackHeight;
+
+ @FieldOrder(order = 32)
+ @IntRange(minValue=0,maxValue=2)
+ @Asn1Optional public Long attachedBoats;
+
+ @FieldOrder(order = 33)
+ @IntRange(minValue=0,maxValue=4)
+ @Asn1Optional public Long attachedBicycles;
+
+ @FieldOrder(order = 34)
+ @IntRange(minValue=0,maxValue=5)
+ @Asn1Optional public Long attachedSurfboards;
+
+ @FieldOrder(order = 35)
+ @IntRange(minValue=0,maxValue=999)
+ @Asn1Optional public Long loadingListEntry;
+
+ @FieldOrder(order = 36)
+ @Asn1Default(value="upper")
+ @Asn1Optional public LoadingDeckType loadingDeck;
+
+ @FieldOrder(order = 37)
+ @Asn1Optional public SequenceOfCarrierNum carrierNum;
+
+ @FieldOrder(order = 38)
+ @Asn1Optional public SequenceOfStringIA5 carrierIA5;
+
+ @FieldOrder(order = 39)
+ public TariffType tariff;
+
+ @FieldOrder(order = 40)
+ @Asn1Default(value="travelPrice")
+ @Asn1Optional public PriceTypeType priceType;
+
+ @FieldOrder(order = 41)
+ @Asn1Optional Asn1BigInteger price;
+
+ @FieldOrder(order = 42)
+ @Asn1Optional SequenceOfVatDetail vatDetails;
+
+ @FieldOrder(order = 43)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String infoText;
+
+ @FieldOrder(order = 44)
+ @Asn1Optional public ExtensionData extension;
+
+ public Long getTrainNum() {
+ if (this.trainNum == null) return null;
+ return Asn1BigInteger.toLong(this.trainNum);
+ }
+
+ public String getTrainIA5() {
+
+ return this.trainIA5;
+ }
+
+ public Long getBeginLoadingDate() {
+
+ return this.beginLoadingDate;
+ }
+
+ public Long getBeginLoadingTime() {
+
+ if (beginLoadingTime == null) return new Long(0);
+ return beginLoadingTime;
+ }
+
+ public Long getEndLoadingTime() {
+
+ return this.endLoadingTime;
+ }
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Long getReferenceNum() {
+ return Asn1BigInteger.toLong(this.referenceNum);
+ }
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+
+ return this.productIdIA5;
+ }
+
+ public Long getServiceBrand() {
+
+ return this.serviceBrand;
+ }
+
+ public String getServiceBrandAbrUTF8() {
+
+ return this.serviceBrandAbrUTF8;
+ }
+
+ public String getServiceBrandNameUTF8() {
+
+ return this.serviceBrandNameUTF8;
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUICReservation;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public Long getFromStationNum() {
+
+ return this.fromStationNum;
+ }
+
+ public String getFromStationIA5() {
+
+ return this.fromStationIA5;
+ }
+
+ public Long getToStationNum() {
+
+ return this.toStationNum;
+ }
+
+ public String getToStationIA5() {
+
+ return this.toStationIA5;
+ }
+
+ public String getFromStationNameUTF8() {
+
+ return this.fromStationNameUTF8;
+ }
+
+ public String getToStationNameUTF8() {
+
+ return this.toStationNameUTF8;
+ }
+
+ public String getCoach() {
+
+ return this.coach;
+ }
+
+ public String getPlace() {
+
+ return this.place;
+ }
+
+ public CompartmentDetailsType getCompartmentDetails() {
+
+ return this.compartmentDetails;
+ }
+
+ public String getNumberPlate() {
+
+ return this.numberPlate;
+ }
+
+ public String getTrailerPlate() {
+
+ return this.trailerPlate;
+ }
+
+ public Long getCarCategory() {
+
+ return this.carCategory;
+ }
+
+ public Long getBoatCategory() {
+
+ return this.boatCategory;
+ }
+
+ public Boolean getTextileRoof() {
+
+ return this.textileRoof;
+ }
+
+ public RoofRackType getRoofRackType() {
+
+ if (this.roofRackType == null) return RoofRackType.norack;
+ return this.roofRackType;
+ }
+
+ public Long getRoofRackHeight() {
+
+ return this.roofRackHeight;
+ }
+
+ public Long getAttachedBoats() {
+
+ return this.attachedBoats;
+ }
+
+ public Long getAttachedBicycles() {
+
+ return this.attachedBicycles;
+ }
+
+ public Long getAttachedSurfboards() {
+
+ return this.attachedSurfboards;
+ }
+
+ public Long getLoadingListEntry() {
+
+ return this.loadingListEntry;
+ }
+
+ public LoadingDeckType getLoadingDeck() {
+
+ if (this.loadingDeck == null) return LoadingDeckType.upper;
+ return this.loadingDeck;
+ }
+
+ public SequenceOfCarrierNum getCarrierNum() {
+
+ return this.carrierNum;
+ }
+
+ public SequenceOfStringIA5 getCarrierIA5() {
+
+ return this.carrierIA5;
+ }
+
+ public TariffType getTariff() {
+
+ return this.tariff;
+ }
+
+ public PriceTypeType getPriceType() {
+ if (this.priceType == null) return PriceTypeType.travelPrice;
+ return this.priceType;
+ }
+
+ public String getInfoText() {
+
+ return this.infoText;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setTrainNum(Long trainNum) {
+
+ this.trainNum = new Asn1BigInteger(trainNum);
+ }
+
+ public void setTrainIA5(String trainIA5) {
+
+ this.trainIA5 = trainIA5;
+ }
+
+ public void setBeginLoadingDate(Long beginLoadingDate) {
+
+ this.beginLoadingDate = beginLoadingDate;
+ }
+
+ public void setBeginLoadingTime(Long beginLoadingTime) {
+
+ this.beginLoadingTime = beginLoadingTime;
+ }
+
+ public void setEndLoadingTime(Long endLoadingTime) {
+ this.endLoadingTime = endLoadingTime;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setReferenceNum(Long referenceNum) {
+
+ this.referenceNum = Asn1BigInteger.toAsn1(referenceNum);
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setServiceBrand(Long serviceBrand) {
+
+ this.serviceBrand = serviceBrand;
+ }
+
+ public void setServiceBrandAbrUTF8(String serviceBrandAbrUTF8) {
+
+ this.serviceBrandAbrUTF8 = serviceBrandAbrUTF8;
+ }
+
+ public void setServiceBrandNameUTF8(String serviceBrandNameUTF8) {
+
+ this.serviceBrandNameUTF8 = serviceBrandNameUTF8;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setFromStationNum(Long fromStationNum) {
+
+ this.fromStationNum = fromStationNum;
+ }
+
+ public void setFromStationIA5(String fromStationIA5) {
+
+ this.fromStationIA5 = fromStationIA5;
+ }
+
+ public void setToStationNum(Long toStationNum) {
+
+ this.toStationNum = toStationNum;
+ }
+
+ public void setToStationIA5(String toStationIA5) {
+
+ this.toStationIA5 = toStationIA5;
+ }
+
+ public void setFromStationNameUTF8(String fromStationNameUTF8) {
+
+ this.fromStationNameUTF8 = fromStationNameUTF8;
+ }
+
+ public void setToStationNameUTF8(String toStationNameUTF8) {
+
+ this.toStationNameUTF8 = toStationNameUTF8;
+ }
+
+ public void setCoach(String coach) {
+
+ this.coach = coach;
+ }
+
+ public void setPlace(String place) {
+
+ this.place = place;
+ }
+
+ public void setCompartmentDetails(CompartmentDetailsType compartmentDetails) {
+
+ this.compartmentDetails = compartmentDetails;
+ }
+
+ public void setNumberPlate(String numberPlate) {
+
+ this.numberPlate = numberPlate;
+ }
+
+ public void setTrailerPlate(String trailerPlate) {
+
+ this.trailerPlate = trailerPlate;
+ }
+
+ public void setCarCategory(Long carCategory) {
+
+ this.carCategory = carCategory;
+ }
+
+ public void setBoatCategory(Long boatCategory) {
+
+ this.boatCategory = boatCategory;
+ }
+
+ public void setTextileRoof(Boolean textileRoof) {
+
+ this.textileRoof = textileRoof;
+ }
+
+ public void setRoofRackType(RoofRackType roofRackType) {
+
+ this.roofRackType = roofRackType;
+ }
+
+ public void setRoofRackHeight(Long roofRackHeight) {
+
+ this.roofRackHeight = roofRackHeight;
+ }
+
+ public void setAttachedBoats(Long attachedBoats) {
+
+ this.attachedBoats = attachedBoats;
+ }
+
+ public void setAttachedBicycles(Long attachedBicycles) {
+
+ this.attachedBicycles = attachedBicycles;
+ }
+
+ public void setAttachedSurfboards(Long attachedSurfboards) {
+
+ this.attachedSurfboards = attachedSurfboards;
+ }
+
+ public void setLoadingListEntry(Long loadingListEntry) {
+
+ this.loadingListEntry = loadingListEntry;
+ }
+
+ public void setLoadingDeck(LoadingDeckType loadingDeck) {
+
+ this.loadingDeck = loadingDeck;
+ }
+
+ public void setCarrierNum(SequenceOfCarrierNum carrierNum) {
+
+ this.carrierNum = carrierNum;
+ }
+
+ public void setCarrierNum(List<Long> longs) {
+ if (longs == null || longs.isEmpty()) return;
+ this.carrierNum = new SequenceOfCarrierNum(longs);
+ }
+
+
+ public void setCarrierIA5(SequenceOfStringIA5 carrierIA5) {
+
+ this.carrierIA5 = carrierIA5;
+ }
+
+ public void setTariff(TariffType tariff) {
+
+ this.tariff = tariff;
+ }
+
+ public void setPriceType(PriceTypeType priceType) {
+
+ this.priceType = priceType;
+ }
+
+ public void setInfoText(String infoText) {
+
+ this.infoText = infoText;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public Long getPrice() {
+ return Asn1BigInteger.toLong(price);
+ }
+
+ public void setPrice(Long price) {
+ this.price = Asn1BigInteger.toAsn1(price);
+ }
+
+ public SequenceOfVatDetail getVatDetails() {
+ return vatDetails;
+ }
+
+ public void setVatDetails(SequenceOfVatDetail vatDetails) {
+ this.vatDetails = vatDetails;
+ }
+
+ public void addVatDetail(VatDetailType vatDetail) {
+ if (this.vatDetails == null) {
+ this.vatDetails = new SequenceOfVatDetail();
+ }
+ this.vatDetails.add(vatDetail);
+ }
+
+ public void setLoadingDates (Date beginLoading, Date endLoading, Date issuingDate){
+
+ if (issuingDate == null || beginLoading == null) return;
+
+ this.beginLoadingDate = DateTimeUtils.getDateDifference(issuingDate,beginLoading);
+ this.beginLoadingTime = DateTimeUtils.getTime(beginLoading);
+
+ if (endLoading != null) {
+ this.endLoadingTime = DateTimeUtils.getTime(endLoading);
+ }
+ }
+
+ public Date getBeginLoadingDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.beginLoadingDate == null) {
+ this.beginLoadingDate = 0L;
+ }
+
+ return DateTimeUtils.getDate(issuingDate, this.beginLoadingDate, this.beginLoadingTime);
+
+ }
+
+ public Date getEndLoadingDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.beginLoadingDate == null) {
+ this.beginLoadingDate = 0L;
+ }
+
+ if (this.endLoadingTime == null) {
+ return null;
+ }
+
+ Date begin = DateTimeUtils.getDate(issuingDate, this.beginLoadingDate, this.beginLoadingTime);
+ Date end = DateTimeUtils.getDate(issuingDate, this.beginLoadingDate, this.endLoadingTime);
+
+ //max one day difference assumed
+ if (end.before(begin)) {
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTime(end);
+ cal.add(Calendar.DAY_OF_YEAR,1);
+ return cal.getTime();
+ } else {
+ return end;
+ }
+
+ }
+
+ public Long getLoadingUTCOffset() {
+ return loadingUTCOffset;
+ }
+
+ public void setLoadingUTCOffset(Long loadingUTCOffset) {
+ this.loadingUTCOffset = loadingUTCOffset;
+ }
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/CardReferenceType.java b/src/org/uic/barcode/ticket/api/asn/omv2/CardReferenceType.java new file mode 100644 index 0000000..3c7d3e2 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/CardReferenceType.java @@ -0,0 +1,182 @@ +/*
+ * 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.asn.omv2;
+
+import java.math.BigInteger;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+
+@Sequence
+@HasExtensionMarker
+public class CardReferenceType extends Object {
+ public CardReferenceType() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public Asn1BigInteger cardIssuerNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String cardIssuerIA5;
+
+ @FieldOrder(order = 2)
+ @Asn1Optional public Asn1BigInteger cardIdNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String cardIdIA5;
+
+ @FieldOrder(order = 4)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String cardName;
+
+ @FieldOrder(order = 5)
+ @Asn1Optional public Asn1BigInteger cardType;
+
+ @FieldOrder(order = 6)
+ @Asn1Optional public Asn1BigInteger leadingCardIdNum;
+
+ @FieldOrder(order = 7)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String leadingCardIdIA5;
+
+ @FieldOrder(order = 8)
+ @Asn1Optional public Asn1BigInteger trailingCardIdNum;
+
+ @FieldOrder(order = 9)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String trailingCardIdIA5;
+
+ public Asn1BigInteger getCardIssuerNum() {
+
+ return this.cardIssuerNum;
+ }
+
+ public String getCardIssuerIA5() {
+
+ return this.cardIssuerIA5;
+ }
+
+ public Asn1BigInteger getCardIdNum() {
+
+ return this.cardIdNum;
+ }
+
+ public String getCardIdIA5() {
+
+ return this.cardIdIA5;
+ }
+
+ public String getCardName() {
+
+ return this.cardName;
+ }
+
+ public Asn1BigInteger getCardType() {
+ return this.cardType;
+ }
+
+ public BigInteger getLeadingCardIdNum() {
+ if (leadingCardIdNum != null) {
+ return leadingCardIdNum.toBigInteger();
+ }
+ return null;
+ }
+
+ public String getLeadingCardIdIA5() {
+
+ return this.leadingCardIdIA5;
+ }
+
+ public Long getTrailingCardIdNum() {
+
+ return Asn1BigInteger.toLong(this.trailingCardIdNum);
+ }
+
+ public String getTrailingCardIdIA5() {
+
+ return this.trailingCardIdIA5;
+ }
+
+ public void setCardIssuerNum(Long cardIssuerNum) {
+
+ this.cardIssuerNum = Asn1BigInteger.toAsn1(cardIssuerNum);
+ }
+
+ public void setCardIssuerIA5(String cardIssuerIA5) {
+
+ this.cardIssuerIA5 = cardIssuerIA5;
+ }
+
+ public void setCardIdNum(Asn1BigInteger asn1BigInteger) {
+
+ this.cardIdNum = asn1BigInteger;
+ }
+
+ public void setCardIdNum(Long cardIdNum) {
+
+ this.cardIdNum = new Asn1BigInteger(cardIdNum);
+ }
+
+ public void setCardIdIA5(String cardIdIA5) {
+
+ this.cardIdIA5 = cardIdIA5;
+ }
+
+ public void setCardName(String cardName) {
+
+ this.cardName = cardName;
+ }
+
+ public void setCardType(Long cardType) {
+
+ this.cardType = Asn1BigInteger.toAsn1(cardType);
+ }
+
+ public void setLeadingCardIdNum(Long leadingCardIdNum) {
+
+ this.leadingCardIdNum = Asn1BigInteger.toAsn1(leadingCardIdNum);
+ }
+
+ public void setLeadingCardIdIA5(String leadingCardIdIA5) {
+
+ this.leadingCardIdIA5 = leadingCardIdIA5;
+ }
+
+ public void setTrailingCardIdNum(Long trailingCardIdNum) {
+
+ this.trailingCardIdNum = Asn1BigInteger.toAsn1(trailingCardIdNum);
+ }
+
+ public void setTrailingCardIdIA5(String trailingCardIdIA5) {
+
+ this.trailingCardIdIA5 = trailingCardIdIA5;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/CodeTableType.java b/src/org/uic/barcode/ticket/api/asn/omv2/CodeTableType.java new file mode 100644 index 0000000..e9c5e01 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/CodeTableType.java @@ -0,0 +1,40 @@ +/*
+ * 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.asn.omv2;
+
+
+public enum CodeTableType {
+ stationUIC("stationUIC"),
+ stationUICReservation("stationUICReservation"),
+ stationERA("stationERA"),
+ localCarrierStationCodeTable("localCarrierStationCodeTable"),
+ proprietaryIssuerStationCodeTable("proprietaryIssuerStationCodeTable");
+
+ public String text;
+
+ CodeTableType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/CompartmentDetailsType.java b/src/org/uic/barcode/ticket/api/asn/omv2/CompartmentDetailsType.java new file mode 100644 index 0000000..ce1832e --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/CompartmentDetailsType.java @@ -0,0 +1,136 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+
+@Sequence
+@HasExtensionMarker
+public class CompartmentDetailsType extends Object {
+ public CompartmentDetailsType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=1,maxValue=99)
+ @Asn1Optional public Long coachType;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue=1,maxValue=99)
+ @Asn1Optional public Long compartmentType;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=99)
+ @Asn1Optional public Long specialAllocation;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String coachTypeDescr;
+
+ @FieldOrder(order = 4)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String compartmentTypeDescr;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String specialAllocationDescr;
+
+ @FieldOrder(order = 6)
+ @Asn1Default(value="unspecified")
+ public CompartmentPositionType position;
+
+ public Long getCoachType() {
+
+ return this.coachType;
+ }
+
+ public Long getCompartmentType() {
+
+ return this.compartmentType;
+ }
+
+ public Long getSpecialAllocation() {
+
+ return this.specialAllocation;
+ }
+
+ public String getCoachTypeDescr() {
+
+ return this.coachTypeDescr;
+ }
+
+ public String getCompartmentTypeDescr() {
+
+ return this.compartmentTypeDescr;
+ }
+
+ public String getSpecialAllocationDescr() {
+
+ return this.specialAllocationDescr;
+ }
+
+ public CompartmentPositionType getPosition() {
+ if (position == null) return CompartmentPositionType.unspecified;
+ return this.position;
+ }
+
+ public void setCoachType(Long coachType) {
+ this.coachType = coachType;
+ }
+
+ public void setCompartmentType(Long compartmentType) {
+
+ this.compartmentType = compartmentType;
+ }
+
+ public void setSpecialAllocation(Long specialAllocation) {
+
+ this.specialAllocation = specialAllocation;
+ }
+
+ public void setCoachTypeDescr(String coachTypeDescr) {
+
+ this.coachTypeDescr = coachTypeDescr;
+ }
+
+ public void setCompartmentTypeDescr(String compartmentTypeDescr) {
+
+ this.compartmentTypeDescr = compartmentTypeDescr;
+ }
+
+ public void setSpecialAllocationDescr(String specialAllocationDescr) {
+
+ this.specialAllocationDescr = specialAllocationDescr;
+ }
+
+ public void setPosition(CompartmentPositionType position) {
+
+ this.position = position;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/CompartmentGenderType.java b/src/org/uic/barcode/ticket/api/asn/omv2/CompartmentGenderType.java new file mode 100644 index 0000000..f960234 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/CompartmentGenderType.java @@ -0,0 +1,42 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum CompartmentGenderType {
+ unspecified("unspecified"),
+ family("family"),
+ female("female"),
+ male("male"),
+ mixed("mixed");
+
+ public String text;
+
+ CompartmentGenderType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/CompartmentPositionType.java b/src/org/uic/barcode/ticket/api/asn/omv2/CompartmentPositionType.java new file mode 100644 index 0000000..cb43f24 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/CompartmentPositionType.java @@ -0,0 +1,38 @@ +/*
+ * 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.asn.omv2;
+
+
+public enum CompartmentPositionType {
+ unspecified("unspecified"),
+ upperLevel("upperLevel"),
+ lowerLevel("lowerLevel");
+
+ public String text;
+
+ CompartmentPositionType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/ConfirmationTypeType.java b/src/org/uic/barcode/ticket/api/asn/omv2/ConfirmationTypeType.java new file mode 100644 index 0000000..bf84f91 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/ConfirmationTypeType.java @@ -0,0 +1,42 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum ConfirmationTypeType {
+ trainDelayConfirmation ("trainDelayConfirmation"),
+ travelerDelayConfirmation ("travelerDelayConfirmation"),
+ trainLinkedTicketDelay ("trainLinkedTicketDelay");
+
+
+
+ public String text;
+
+ ConfirmationTypeType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/ControlData.java b/src/org/uic/barcode/ticket/api/asn/omv2/ControlData.java new file mode 100644 index 0000000..fb73e24 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/ControlData.java @@ -0,0 +1,200 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+
+
+@Sequence
+@HasExtensionMarker
+public class ControlData extends Object {
+ public ControlData() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public SequenceOfCardReferenceType identificationByCardReference;
+
+ @FieldOrder(order = 1)
+ public Boolean identificationByIdCard = false;
+
+ @FieldOrder(order = 2)
+ public Boolean identificationByPassportId = false;
+
+ @FieldOrder(order = 3)
+ @Asn1Optional public Asn1BigInteger identificationItem;
+
+ @FieldOrder(order = 4)
+ public Boolean passportValidationRequired = false;
+
+ @FieldOrder(order = 5)
+ public Boolean onlineValidationRequired = false;
+
+ @FieldOrder(order = 6)
+ @IntRange(minValue=0,maxValue=99)
+ @Asn1Optional public Long randomDetailedValidationRequired;
+
+ @FieldOrder(order = 7)
+ public Boolean ageCheckRequired = false;
+
+ @FieldOrder(order = 8)
+ public Boolean reductionCardCheckRequired = false;
+
+ @FieldOrder(order = 9)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String infoText;
+
+ @FieldOrder(order = 10)
+ @Asn1Optional public SequenceOfTicketLinkType includedTickets;
+
+ @FieldOrder(order = 11)
+ @Asn1Optional public ExtensionData extension;
+
+
+
+
+ public SequenceOfCardReferenceType getIdentificationByCardReference() {
+
+ return this.identificationByCardReference;
+ }
+
+ public Boolean getIdentificationByIdCard() {
+
+ return this.identificationByIdCard;
+ }
+
+ public Boolean getIdentificationByPassportId() {
+
+ return this.identificationByPassportId;
+ }
+
+ public Long getIdentificationItem() {
+
+ return Asn1BigInteger.toLong(this.identificationItem);
+ }
+
+ public Boolean getPassportValidationRequired() {
+
+ return this.passportValidationRequired;
+ }
+
+ public Boolean getOnlineValidationRequired() {
+
+ return this.onlineValidationRequired;
+ }
+
+ public Long getRandomDetailedValidationRequired() {
+
+ return this.randomDetailedValidationRequired;
+ }
+
+ public Boolean getAgeCheckRequired() {
+
+ return this.ageCheckRequired;
+ }
+
+ public Boolean getReductionCardCheckRequired() {
+
+ return this.reductionCardCheckRequired;
+ }
+
+ public String getInfoText() {
+
+ return this.infoText;
+ }
+
+ public SequenceOfTicketLinkType getIncludedTickets() {
+
+ return this.includedTickets;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setIdentificationByCardReference(SequenceOfCardReferenceType identificationByCardReference) {
+
+ this.identificationByCardReference = identificationByCardReference;
+ }
+
+ public void setIdentificationByIdCard(Boolean identificationByIdCard) {
+
+ this.identificationByIdCard = identificationByIdCard;
+ }
+
+ public void setIdentificationByPassportId(Boolean identificationByPassportId) {
+
+ this.identificationByPassportId = identificationByPassportId;
+ }
+
+ public void setIdentificationItem(Long identificationItem) {
+
+ this.identificationItem = Asn1BigInteger.toAsn1(identificationItem);
+ }
+
+ public void setPassportValidationRequired(Boolean passportValidationRequired) {
+
+ this.passportValidationRequired = passportValidationRequired;
+ }
+
+ public void setOnlineValidationRequired(Boolean onlineValidationRequired) {
+
+ this.onlineValidationRequired = onlineValidationRequired;
+ }
+
+ public void setRandomDetailedValidationRequired(Long randomDetailedValidationRequired) {
+ this.randomDetailedValidationRequired = randomDetailedValidationRequired;
+ }
+
+ public void setAgeCheckRequired(Boolean ageCheckRequired) {
+ this.ageCheckRequired = ageCheckRequired;
+ }
+
+ public void setReductionCardCheckRequired(Boolean reductionCardCheckRequired) {
+
+ this.reductionCardCheckRequired = reductionCardCheckRequired;
+ }
+
+ public void setInfoText(String infoText) {
+
+ this.infoText = infoText;
+ }
+
+ public void setIncludedTickets(SequenceOfTicketLinkType includedTickets) {
+
+ this.includedTickets = includedTickets;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/CountermarkData.java b/src/org/uic/barcode/ticket/api/asn/omv2/CountermarkData.java new file mode 100644 index 0000000..41c73b5 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/CountermarkData.java @@ -0,0 +1,577 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.Date;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+
+@Sequence
+@HasExtensionMarker
+public class CountermarkData extends Object {
+ public CountermarkData() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=0,maxValue=65535)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 6)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String ticketReferenceIA5;
+
+ @FieldOrder(order = 7)
+ @Asn1Optional public Asn1BigInteger ticketReferenceNum;
+
+ @FieldOrder(order = 8)
+ @IntRange(minValue=1,maxValue=200)
+ @Asn1Optional public Long numberOfCountermark;
+
+ @FieldOrder(order = 9)
+ @IntRange(minValue=1,maxValue=200)
+ @Asn1Optional public Long totalOfCountermarks;
+
+ @FieldOrder(order = 10)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String groupName;
+
+ @FieldOrder(order = 11)
+ @Asn1Default("stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 12)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long fromStationNum;
+
+ @FieldOrder(order = 13)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String fromStationIA5;
+
+ @FieldOrder(order = 14)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long toStationNum;
+
+ @FieldOrder(order = 15)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String toStationIA5;
+
+ @FieldOrder(order = 16)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String fromStationNameUTF8;
+
+ @FieldOrder(order = 17)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String toStationNameUTF8;
+
+ @FieldOrder(order = 18)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String validRegionDesc;
+
+ @FieldOrder(order = 19)
+ @Asn1Optional public SequenceOfRegionalValidityType validRegion;
+
+ @FieldOrder(order = 20)
+ public Boolean returnIncluded = false;
+
+ @FieldOrder(order = 21)
+ @Asn1Optional public ReturnRouteDescriptionType returnDescription;
+
+ @FieldOrder(order = 22)
+ @IntRange(minValue=-1,maxValue=700)
+ @Asn1Optional public Long validFromDay;
+
+ @FieldOrder(order = 23)
+ @IntRange(minValue=0,maxValue=1439)
+ @Asn1Optional public Long validFromTime;
+
+ @FieldOrder(order = 24)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validFromUTCOffset;
+
+ @FieldOrder(order = 25)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long validUntilDay;
+
+ @FieldOrder(order = 26)
+ @IntRange(minValue=0,maxValue=1439)
+ @Asn1Optional public Long validUntilTime;
+
+ @FieldOrder(order = 27)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validUntilUTCOffset;
+
+ @FieldOrder(order = 28)
+ @Asn1Default(value="second")
+ @Asn1Optional public TravelClassType classCode;
+
+ @FieldOrder(order = 29)
+ @Asn1Optional public SequenceOfCarrierNum carrierNum;
+
+ @FieldOrder(order = 30)
+ @Asn1Optional public SequenceOfStringIA5 carrierIA5;
+
+ @FieldOrder(order = 31)
+ @Asn1Optional public SequenceOfServiceBrands includedServiceBrands;
+
+ @FieldOrder(order = 32)
+ @Asn1Optional public SequenceOfServiceBrands excludedServiceBrands;
+
+ @FieldOrder(order = 33)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String infoText;
+
+ @FieldOrder(order = 34)
+ @Asn1Optional public ExtensionData extension;
+
+
+
+
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Long getReferenceNum() {
+
+ return Asn1BigInteger.toLong(this.referenceNum);
+ }
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+
+ return this.productIdIA5;
+ }
+
+ public String getTicketReferenceIA5() {
+
+ return this.ticketReferenceIA5;
+ }
+
+ public Long getTicketReferenceNum() {
+
+ return Asn1BigInteger.toLong(this.ticketReferenceNum);
+ }
+
+ public Long getNumberOfCountermark() {
+
+ return this.numberOfCountermark;
+ }
+
+ public Long getTotalOfCountermarks() {
+
+ return this.totalOfCountermarks;
+ }
+
+ public String getGroupName() {
+
+ return this.groupName;
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUIC;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public Long getFromStationNum() {
+
+ return this.fromStationNum;
+ }
+
+ public String getFromStationIA5() {
+
+ return this.fromStationIA5;
+ }
+
+ public Long getToStationNum() {
+
+ return this.toStationNum;
+ }
+
+ public String getToStationIA5() {
+
+ return this.toStationIA5;
+ }
+
+ public String getFromStationNameUTF8() {
+
+ return this.fromStationNameUTF8;
+ }
+
+ public String getToStationNameUTF8() {
+
+ return this.toStationNameUTF8;
+ }
+
+ public String getValidRegionDesc() {
+
+ return this.validRegionDesc;
+ }
+
+ public SequenceOfRegionalValidityType getValidRegion() {
+
+ return this.validRegion;
+ }
+
+ public Boolean getReturnIncluded() {
+
+ return this.returnIncluded;
+ }
+
+ public ReturnRouteDescriptionType getReturnDescription() {
+
+ return this.returnDescription;
+ }
+
+ public Long getValidFromDay() {
+
+ return this.validFromDay;
+ }
+
+ public Long getValidFromTime() {
+
+ return this.validFromTime;
+ }
+
+ public Long getValidUntilDay() {
+
+ return this.validUntilDay;
+ }
+
+ public Long getValidUntilTime() {
+
+ return this.validUntilTime;
+ }
+
+ public TravelClassType getClassCode() {
+
+ if (classCode == null){
+ return TravelClassType.second;
+ }
+
+ return this.classCode;
+ }
+
+ public SequenceOfCarrierNum getCarriersNum() {
+
+ return this.carrierNum;
+ }
+
+ public SequenceOfStringIA5 getCarriersIA5() {
+
+ return this.carrierIA5;
+ }
+
+ public SequenceOfServiceBrands getIncludedServiceBrands() {
+
+ return this.includedServiceBrands;
+ }
+
+ public SequenceOfServiceBrands getExcludedServiceBrands() {
+
+ return this.excludedServiceBrands;
+ }
+
+ public String getInfoText() {
+
+ return this.infoText;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setReferenceNum(Long referenceNum) {
+
+ this.referenceNum = Asn1BigInteger.toAsn1(referenceNum);
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setTicketReferenceIA5(String ticketReferenceIA5) {
+
+ this.ticketReferenceIA5 = ticketReferenceIA5;
+ }
+
+ public void setTicketReferenceNum(Long ticketReferenceNum) {
+
+ this.ticketReferenceNum = Asn1BigInteger.toAsn1(ticketReferenceNum);
+ }
+
+ public void setNumberOfCountermark(Long numberOfCountermark) {
+
+ this.numberOfCountermark = numberOfCountermark;
+ }
+
+ public void setTotalOfCountermarks(Long totalOfCountermarks) {
+
+ this.totalOfCountermarks = totalOfCountermarks;
+ }
+
+ public void setGroupName(String groupName) {
+
+ this.groupName = groupName;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setFromStationNum(Long fromStationNum) {
+
+ this.fromStationNum = fromStationNum;
+ }
+
+ public void setFromStationIA5(String fromStationIA5) {
+
+ this.fromStationIA5 = fromStationIA5;
+ }
+
+ public void setToStationNum(Long toStationNum) {
+
+ this.toStationNum = toStationNum;
+ }
+
+ public void setToStationIA5(String toStationIA5) {
+
+ this.toStationIA5 = toStationIA5;
+ }
+
+ public void setFromStationNameUTF8(String fromStationNameUTF8) {
+
+ this.fromStationNameUTF8 = fromStationNameUTF8;
+ }
+
+ public void setToStationNameUTF8(String toStationNameUTF8) {
+
+ this.toStationNameUTF8 = toStationNameUTF8;
+ }
+
+ public void setValidRegionDesc(String validRegionDesc) {
+
+ this.validRegionDesc = validRegionDesc;
+ }
+
+ public void setValidRegion(SequenceOfRegionalValidityType validRegion) {
+
+ this.validRegion = validRegion;
+ }
+
+ public void setReturnIncluded(Boolean returnIncluded) {
+
+ this.returnIncluded = returnIncluded;
+ }
+
+ public void setReturnDescription(ReturnRouteDescriptionType returnDescription) {
+
+ this.returnDescription = returnDescription;
+ }
+
+ public void setValidFromDay(Long validFromDay) {
+
+ this.validFromDay = validFromDay;
+ }
+
+ public void setValidFromTime(Long validFromTime) {
+
+ this.validFromTime = validFromTime;
+ }
+
+ public void setValidUntilDay(Long validUntilDay) {
+
+ this.validUntilDay = validUntilDay;
+ }
+
+ public void setValidUntilTime(Long validUntilTime) {
+
+ this.validUntilTime = validUntilTime;
+ }
+
+ public void setClassCode(TravelClassType classCode) {
+
+ this.classCode = classCode;
+ }
+
+ public void setCarriersNum(SequenceOfCarrierNum carrierNum) {
+
+ this.carrierNum = carrierNum;
+ }
+
+ public void setCarriersNum(List<Long> longs) {
+ if (longs == null) return;
+
+ this.carrierNum = new SequenceOfCarrierNum();
+ this.carrierNum.addAll(longs);
+ }
+
+ public void setCarriersIA5(SequenceOfStringIA5 carrierIA5) {
+
+ this.carrierIA5 = carrierIA5;
+ }
+
+ public void setIncludedServiceBrands(SequenceOfServiceBrands includedServiceBrands) {
+
+ this.includedServiceBrands = includedServiceBrands;
+ }
+
+ public void setExcludedServiceBrands(SequenceOfServiceBrands excludedServiceBrands) {
+
+ this.excludedServiceBrands = excludedServiceBrands;
+ }
+
+ public void setInfoText(String infoText) {
+
+ this.infoText = infoText;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+
+ public void setValidityDates (Date fromDate, Date untilDate, Date issuingDate){
+
+ if (issuingDate == null || fromDate == null) return;
+
+ this.validFromDay = DateTimeUtils.getDateDifference(issuingDate,fromDate);
+ this.validFromTime = DateTimeUtils.getTime(fromDate);
+
+ if (untilDate != null){
+ this.validUntilDay = DateTimeUtils.getDateDifference(fromDate, untilDate);
+ this.validUntilTime = DateTimeUtils.getTime(untilDate);
+ }
+
+ }
+
+ public Date getValidFromDate(Date issuingDate){
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay, this.validFromTime);
+
+ }
+
+ public Date getValidUntilDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validUntilDay == null) {
+ return null;
+ }
+
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime);
+
+ }
+
+ public Long getValidFromUTCOffset() {
+ return validFromUTCOffset;
+ }
+
+ public void setValidFromUTCOffset(Long validFromUTCOffset) {
+ this.validFromUTCOffset = validFromUTCOffset;
+ }
+
+ public Long getValidUntilUTCOffset() {
+ return validUntilUTCOffset;
+ }
+
+ public void setValidUntilUTCOffset(Long validUntilUTCOffset) {
+ this.validUntilUTCOffset = validUntilUTCOffset;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/CustomerCardData.java b/src/org/uic/barcode/ticket/api/asn/omv2/CustomerCardData.java new file mode 100644 index 0000000..4302f44 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/CustomerCardData.java @@ -0,0 +1,296 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfUnrestrictedLong;
+
+@Sequence
+@HasExtensionMarker
+public class CustomerCardData extends Object {
+ public CustomerCardData() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public TravelerType customer;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String cardIdIA5;
+
+ @FieldOrder(order = 2)
+ @Asn1Optional public Asn1BigInteger cardIdNum;
+
+ @FieldOrder(order = 3)
+ @IntRange(minValue=2016,maxValue=2269)
+ @Asn1Optional public Long validFromYear;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=0,maxValue=700)
+ @Asn1Optional public Long validFromDay;
+
+ @FieldOrder(order = 5)
+ @IntRange(minValue=0,maxValue=250)
+ @Asn1Optional public Long validUntilYear;
+
+ @FieldOrder(order = 6)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long validUntilDay;
+
+ @FieldOrder(order = 7)
+ @Asn1Optional public TravelClassType classCode;
+
+ @FieldOrder(order = 8)
+ @IntRange(minValue=0,maxValue=1000)
+ @Asn1Optional public Long cardType;
+
+ @FieldOrder(order = 9)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String cardTypeDescr;
+
+ @FieldOrder(order = 10)
+ @Asn1Optional public Asn1BigInteger customerStatus;
+
+ @FieldOrder(order = 11)
+ @Asn1Optional public String customerStatusDescr;
+
+ @FieldOrder(order = 12)
+ @Asn1Optional public SequenceOfUnrestrictedLong includedServices;
+
+ @FieldOrder(order = 13)
+ @Asn1Optional public ExtensionData extension;
+
+
+
+
+ public TravelerType getCustomer() {
+
+ return this.customer;
+ }
+
+ public String getCardIdIA5() {
+
+ return this.cardIdIA5;
+ }
+
+ public Asn1BigInteger getCardIdNum() {
+
+ return this.cardIdNum;
+ }
+
+ public Long getValidFromYear() {
+
+ return this.validFromYear;
+ }
+
+ public Long getValidFromDay() {
+
+ return this.validFromDay;
+ }
+
+ public Long getValidUntilYear() {
+
+ return this.validUntilYear;
+ }
+
+ public Long getValidUntilDay() {
+
+ return this.validUntilDay;
+ }
+
+ public TravelClassType getClassCode() {
+
+ return this.classCode;
+ }
+
+ public Long getCardType() {
+
+ return this.cardType;
+ }
+
+ public String getCardTypeDescr() {
+
+ return this.cardTypeDescr;
+ }
+
+ public Long getCustomerStatus() {
+
+ return Asn1BigInteger.toLong(this.customerStatus);
+ }
+
+ public String getCustomerStatusDescr() {
+
+ return this.customerStatusDescr;
+ }
+
+ public SequenceOfUnrestrictedLong getIncludedServices() {
+
+ return this.includedServices;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setCustomer(TravelerType customer) {
+
+ this.customer = customer;
+ }
+
+ public void setCardIdIA5(String cardIdIA5) {
+
+ this.cardIdIA5 = cardIdIA5;
+ }
+
+ public void setCardIdNum(Asn1BigInteger cardIdNum) {
+
+ this.cardIdNum = cardIdNum;
+ }
+
+ public void setCardIdNum(Long cardIdNum) {
+
+ this.cardIdNum = new Asn1BigInteger(cardIdNum);
+ }
+
+ public void setValidFromYear(Long validFromYear) {
+
+ this.validFromYear = validFromYear;
+ }
+
+ public void setValidFromDay(Long validFromDay) {
+
+ this.validFromDay = validFromDay;
+ }
+
+ public void setValidUntilYear(Long validUntilYear) {
+
+ this.validUntilYear = validUntilYear;
+ }
+
+ public void setValidUntilDay(Long validUntilDay) {
+
+ this.validUntilDay = validUntilDay;
+ }
+
+ public void setClassCode(TravelClassType classCode) {
+
+ this.classCode = classCode;
+ }
+
+ public void setCardType(Long cardType) {
+
+ this.cardType = cardType;
+ }
+
+ public void setCardTypeDescr(String cardTypeDescr) {
+
+ this.cardTypeDescr = cardTypeDescr;
+ }
+
+ public void setCustomerStatus(Long customerStatus) {
+
+ this.customerStatus = Asn1BigInteger.toAsn1(customerStatus);
+ }
+
+ public void setCustomerStatusDescr(String customerStatusDescr) {
+
+ this.customerStatusDescr = customerStatusDescr;
+ }
+
+ public void setIncludedServices(SequenceOfUnrestrictedLong includedServices) {
+
+ this.includedServices = includedServices;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public void setValidity (Date fromDate , Date untilDate){
+
+ Calendar fromCal = Calendar.getInstance();
+ fromCal.clear();
+ fromCal.setTime(fromDate);
+
+ this.validFromYear = new Long( fromCal.get(Calendar.YEAR));
+ this.validFromDay = new Long (fromCal.get(Calendar.DAY_OF_YEAR));
+
+ if (untilDate == null) return;
+
+ Calendar untilCal = Calendar.getInstance();
+ untilCal.clear();
+ untilCal.setTime(untilDate);
+
+ int untildays = untilCal.get(Calendar.DAY_OF_YEAR);
+
+ int yearDiff = untilCal.get(Calendar.YEAR) - fromCal.get(Calendar.YEAR);
+
+ this.validUntilYear = new Long( yearDiff);
+ this.validUntilDay = new Long (untildays);
+
+ }
+
+ public Date getValidFromDate (){
+
+ if (this.validFromYear == null || this.validFromYear == 0) return null;
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ cal.set(Calendar.YEAR, this.validFromYear.intValue());
+ cal.set(Calendar.DAY_OF_YEAR, this.validFromDay.intValue());
+
+ return cal.getTime();
+
+ }
+
+
+ public Date getValidUntilDate (){
+
+ if (this.validUntilYear == null || this.validUntilYear == 0) return null;
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ cal.set(Calendar.YEAR, this.validFromYear.intValue());
+ if (this.validUntilYear != null) {
+ cal.add(Calendar.YEAR, this.validUntilYear.intValue());
+ }
+ cal.set(Calendar.DAY_OF_YEAR, this.validUntilDay.intValue());
+
+ return cal.getTime();
+
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/CustomerStatusType.java b/src/org/uic/barcode/ticket/api/asn/omv2/CustomerStatusType.java new file mode 100644 index 0000000..cb10dc9 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/CustomerStatusType.java @@ -0,0 +1,93 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.IntRange;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+
+
+@Sequence
+public class CustomerStatusType extends Object {
+ public CustomerStatusType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long statusProviderNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String statusProviderIA5;
+
+ @FieldOrder(order = 2)
+ @Asn1Optional public Asn1BigInteger customerStatus;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String customerStatusDescr;
+
+ public Long getStatusProviderNum() {
+
+ return this.statusProviderNum;
+ }
+
+ public String getStatusProviderIA5() {
+
+ return this.statusProviderIA5;
+ }
+
+ public Long getCustomerStatus() {
+
+ return Asn1BigInteger.toLong(this.customerStatus);
+ }
+
+ public String getCustomerStatusDescr() {
+
+ return this.customerStatusDescr;
+ }
+
+ public void setStatusProviderNum(Long statusProviderNum) {
+
+ this.statusProviderNum = statusProviderNum;
+ }
+
+ public void setStatusProviderIA5(String statusProviderIA5) {
+
+ this.statusProviderIA5 = statusProviderIA5;
+ }
+
+ public void setCustomerStatus(Long customerStatus) {
+
+ this.customerStatus = Asn1BigInteger.toAsn1(customerStatus);
+ }
+
+ public void setCustomerStatusDescr(String customerStatusDescr) {
+
+ this.customerStatusDescr = customerStatusDescr;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/DateTimeUtils.java b/src/org/uic/barcode/ticket/api/asn/omv2/DateTimeUtils.java new file mode 100644 index 0000000..04b1c2e --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/DateTimeUtils.java @@ -0,0 +1,198 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+import java.util.concurrent.TimeUnit;
+
+public class DateTimeUtils {
+
+ public static Long getDateDifference(Date issuingDate, Date localDate) {
+
+ if (issuingDate == null || localDate == null) return null;
+
+ Calendar issuingCal = Calendar.getInstance();
+ issuingCal.clear();
+ issuingCal.setTime(issuingDate);
+ issuingCal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ issuingCal.set(Calendar.HOUR_OF_DAY, 0);
+ issuingCal.set(Calendar.MINUTE, 0);
+ issuingCal.set(Calendar.SECOND, 0);
+ issuingCal.set(Calendar.MILLISECOND, 0);
+
+ Calendar fromCal = Calendar.getInstance();
+ fromCal.clear();
+ fromCal.setTime(localDate);
+ fromCal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ fromCal.set(Calendar.HOUR_OF_DAY, 0);
+ fromCal.set(Calendar.MINUTE, 0);
+ fromCal.set(Calendar.SECOND, 0);
+ fromCal.set(Calendar.MILLISECOND, 0);
+
+ long diff = localDate.getTime() - issuingDate.getTime();
+ long dayDiff = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
+
+ return new Long(dayDiff);
+
+ }
+
+ public static Date getLocalDateFromDifference(Date issuingDate, int diff , Long time ) {
+
+ if (issuingDate == null) return null;
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTime(issuingDate);
+ cal.add(Calendar.DAY_OF_YEAR, diff);
+
+ if (time != null) {
+ int hours = time.intValue() / 60;
+ int minutes = time.intValue() - hours * 60;
+ cal.set(Calendar.HOUR_OF_DAY, hours);
+ cal.set(Calendar.MINUTE,minutes);
+ }
+
+ return cal.getTime();
+
+ }
+
+
+ public static void setTime(Calendar cal, Long time){
+
+ if (time != null) {
+ int hours = time.intValue() / 60;
+ int minutes = time.intValue() - hours * 60;
+ cal.set(Calendar.HOUR_OF_DAY, hours);
+ cal.set(Calendar.MINUTE,minutes);
+ }
+
+
+ }
+
+ public static Long getTime (Calendar cal) {
+
+ if (cal == null ||
+ !cal.isSet(Calendar.HOUR_OF_DAY) ||
+ !cal.isSet(Calendar.MINUTE) ) {
+ return null;
+ }
+
+ int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE);
+ if (time > 0) {
+ return new Long (time );
+ }
+ return null;
+ }
+
+ public static Long getTime (Date date) {
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTime(date);
+
+ if (cal == null ||
+ !cal.isSet(Calendar.HOUR_OF_DAY) ||
+ !cal.isSet(Calendar.MINUTE) ) {
+ return null;
+ }
+
+ int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE);
+ if (time > 0) {
+ return new Long (time );
+ }
+ return null;
+ }
+
+ public static Date getDate(Date issuingDate, Long date, Long time){
+
+ if (issuingDate == null) return null;
+
+ if (date == null) {
+ date = 0L;
+ }
+
+ Calendar issuingCal = Calendar.getInstance();
+ issuingCal.clear();
+ issuingCal.setTime(issuingDate);
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.set(Calendar.YEAR,issuingCal.get(Calendar.YEAR) );
+ cal.set(Calendar.DAY_OF_YEAR,issuingCal.get(Calendar.DAY_OF_YEAR) );
+
+ cal.add(Calendar.DAY_OF_YEAR, date.intValue());
+
+ DateTimeUtils.setTime(cal,time);
+
+ return cal.getTime();
+
+ }
+
+
+
+ /**
+ * Gets the UTC offset.
+ *
+ * @param date and time of the issuing date
+ * @param date and time of the departure
+ * @return the UTC offset in multiples of 15 minutes
+ * the offset needs to be added to local time to get the UTC time (UTC = local + offset)
+ */
+ public static Long getUTCoffset(Date local) {
+
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTime(local);
+
+ /*
+ * Returns the amount of time in milliseconds to add to UTC to get standard time in this
+ * time zone. Because this value is not affected by daylight saving time, it is called raw offset.
+ * If an underlying TimeZone implementation subclass supports historical GMT offset changes, the method
+ * returns the raw offset value of the current date. In Honolulu, for example, its raw offset
+ * changed from GMT-10:30 to GMT-10:00 in 1947, and this method
+ * always returns -36000000 milliseconds (i.e., -10 hours).
+ */
+ int minuteOffset = - cal.getTimeZone().getRawOffset()/ ( 1000 * 60 * 15 );
+
+ return new Long (minuteOffset);
+
+ }
+
+ public static Date getUTCDate(Date issuingDate, Long date, Long time, Long UTCOffset) {
+
+ if (issuingDate == null) return null;
+
+ if (UTCOffset == null) return null;
+
+ if (time == null) return null;
+
+ if (date == null) {
+ date = 0L;
+ }
+
+ Calendar issuingCal = Calendar.getInstance();
+ issuingCal.clear();
+ issuingCal.setTime(issuingDate);
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.set(Calendar.YEAR,issuingCal.get(Calendar.YEAR) );
+ cal.set(Calendar.DAY_OF_YEAR,issuingCal.get(Calendar.DAY_OF_YEAR) );
+ cal.add(Calendar.DAY_OF_YEAR, date.intValue());
+
+ int hours = time.intValue() / 60;
+ int minutes = time.intValue() - hours * 60;
+ cal.set(Calendar.HOUR_OF_DAY, hours);
+ cal.set(Calendar.MINUTE,minutes);
+
+ cal.add(Calendar.MINUTE, (int) (UTCOffset * 15) );
+
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+
+ return cal.getTime();
+
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/DelayConfirmation.java b/src/org/uic/barcode/ticket/api/asn/omv2/DelayConfirmation.java new file mode 100644 index 0000000..72abeb0 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/DelayConfirmation.java @@ -0,0 +1,339 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.TimeZone;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+
+@Sequence
+@HasExtensionMarker
+public class DelayConfirmation extends Object {
+ public DelayConfirmation() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 2)
+ @Asn1Optional public Asn1BigInteger trainNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String trainIA5;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=2016, maxValue=2269)
+ @Asn1Optional public Long plannedArrivalYear;
+
+ @FieldOrder(order = 5)
+ @IntRange(minValue=1, maxValue=366)
+ @Asn1Optional public Long plannedArrivalDay;
+
+ @FieldOrder(order = 6)
+ @IntRange(minValue=0, maxValue=1439)
+ @Asn1Optional public Long plannedArrivalTime;
+
+ @FieldOrder(order = 7)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long departureUTCOffset;
+
+ @FieldOrder(order = 8)
+ @Asn1Default(value="stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 9)
+ @IntRange(minValue=1, maxValue=9999999)
+ @Asn1Optional public Long stationNum;
+
+ @FieldOrder(order = 10)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String stationIA5;
+
+ @FieldOrder(order = 11)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String stationNameUTF8;
+
+ @FieldOrder(order = 12)
+ @IntRange(minValue=0, maxValue=999, hasExtensionMarker=false)
+ @Asn1Optional public Long delay;
+
+ @FieldOrder(order = 13)
+ @Asn1Optional public Boolean trainCancelled = false;
+
+ @FieldOrder(order = 14)
+ @Asn1Default(value="travelerDelayConfirmation")
+ @Asn1Optional public ConfirmationTypeType confirmationType;
+
+ @FieldOrder(order = 15)
+ @Asn1Optional public SequenceOfTicketLinkType affectedTickets;
+
+ @FieldOrder(order = 16)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String infoText;
+
+ @FieldOrder(order = 17)
+ @Asn1Optional public ExtensionData extension;
+
+
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Asn1BigInteger getReferenceNum() {
+
+ return this.referenceNum;
+ }
+
+ public Long getTrainNum() {
+
+ return Asn1BigInteger.toLong(this.trainNum);
+ }
+
+ public String getTrainIA5() {
+
+ return this.trainIA5;
+ }
+
+ public Long getPlannedArrivalYear() {
+
+ return this.plannedArrivalYear;
+ }
+
+ public Long getPlannedArrivalDay() {
+
+ return this.plannedArrivalDay;
+ }
+
+ public Long getPlannedArrivalTime() {
+
+ return this.plannedArrivalTime;
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null){
+ return CodeTableType.stationUIC;
+ }
+ return this.stationCodeTable;
+ }
+
+ public Long getStationNum() {
+
+ return this.stationNum;
+ }
+
+ public String getStationIA5() {
+
+ return this.stationIA5;
+ }
+
+ public String getStationNameUTF8() {
+
+ return this.stationNameUTF8;
+ }
+
+ public Long getDelay() {
+
+ return this.delay;
+ }
+
+ public Boolean getTrainCancelled() {
+
+ return this.trainCancelled;
+ }
+
+ public ConfirmationTypeType getConfirmationType() {
+
+ if (confirmationType == null){
+ return ConfirmationTypeType.trainDelayConfirmation;
+ }
+
+ return this.confirmationType;
+ }
+
+ public List<TicketLinkType> getAffectedTickets() {
+
+ return this.affectedTickets;
+ }
+
+ public String getInfoText() {
+
+ return this.infoText;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setReferenceNum(Asn1BigInteger referenceNum) {
+ this.referenceNum = referenceNum;
+ }
+
+ public void setReferenceNum(Long referenceNum) {
+ this.referenceNum = Asn1BigInteger.toAsn1(referenceNum);
+ }
+
+ public void setTrainNum(Asn1BigInteger trainNum) {
+
+ this.trainNum = trainNum;
+ }
+
+ public void setTrainIA5(String trainIA5) {
+
+ this.trainIA5 = trainIA5;
+ }
+
+ public void setPlannedArrivalYear(Long plannedArrivalYear) {
+
+ this.plannedArrivalYear = plannedArrivalYear;
+ }
+
+ public void setPlannedArrivalDay(Long plannedArrivalDay) {
+
+ this.plannedArrivalDay = plannedArrivalDay;
+ }
+
+ public void setPlannedArrivalTime(Long plannedArrivalTime) {
+
+ this.plannedArrivalTime = plannedArrivalTime;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setStationNum(Long stationNum) {
+
+ this.stationNum = stationNum;
+ }
+
+ public void setStationIA5(String stationIA5) {
+
+ this.stationIA5 = stationIA5;
+ }
+
+ public void setStationNameUTF8(String stationNameUTF8) {
+
+ this.stationNameUTF8 = stationNameUTF8;
+ }
+
+ public void setDelay(Long delay) {
+
+ this.delay = delay;
+ }
+
+ public void setTrainCancelled(Boolean trainCancelled) {
+
+ this.trainCancelled = trainCancelled;
+ }
+
+ public void setConfirmationType(ConfirmationTypeType confirmationType) {
+
+ this.confirmationType = confirmationType;
+ }
+
+ public void setAffectedTickets(SequenceOfTicketLinkType affectedTickets) {
+
+ this.affectedTickets = affectedTickets;
+ }
+
+ public void setInfoText(String infoText) {
+
+ this.infoText = infoText;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public void setPlannedArrivalDate(Date date){
+
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+
+ this.plannedArrivalYear = new Long( cal.get(Calendar.YEAR));
+ this.plannedArrivalDay = new Long (cal.get(Calendar.DAY_OF_YEAR));
+ int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE);
+ if (time > 0) {
+ this.plannedArrivalTime = new Long (time );
+ }
+
+ }
+
+ public Date getPlannedArrivalDate() {
+
+ if (this.plannedArrivalYear == null || this.plannedArrivalDay == null) return null;
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ cal.set(Calendar.YEAR, this.plannedArrivalYear.intValue());
+ cal.set(Calendar.DAY_OF_YEAR, this.plannedArrivalDay.intValue());
+
+ if (this.plannedArrivalTime != null) {
+
+ int hours = this.plannedArrivalTime.intValue() / 60;
+ int minutes = this.plannedArrivalTime.intValue() % 60;
+ cal.set(Calendar.HOUR_OF_DAY, hours);
+ cal.set(Calendar.MINUTE,minutes);
+
+ }
+
+ return cal.getTime();
+ }
+
+ public Long getDepartureUTCOffset() {
+ return departureUTCOffset;
+ }
+
+ public void setDepartureUTCOffset(Long departureUTCOffset) {
+ this.departureUTCOffset = departureUTCOffset;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/DeltaCoordinates.java b/src/org/uic/barcode/ticket/api/asn/omv2/DeltaCoordinates.java new file mode 100644 index 0000000..f4e47ea --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/DeltaCoordinates.java @@ -0,0 +1,58 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+public class DeltaCoordinates extends Object {
+ public DeltaCoordinates() {
+ }
+
+ @FieldOrder(order = 0)
+ public Asn1BigInteger longitude;
+
+ @FieldOrder(order = 1)
+ public Asn1BigInteger latitude;
+
+ public Asn1BigInteger getLongitude() {
+
+ return this.longitude;
+ }
+
+ public Asn1BigInteger getLatitude() {
+
+ return this.latitude;
+ }
+
+ public void setLongitude(Asn1BigInteger longitude) {
+
+ this.longitude = longitude;
+ }
+
+ public void setLatitude(Asn1BigInteger latitude) {
+
+ this.latitude = latitude;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/DocumentData.java b/src/org/uic/barcode/ticket/api/asn/omv2/DocumentData.java new file mode 100644 index 0000000..d6a759b --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/DocumentData.java @@ -0,0 +1,61 @@ +/*
+ * 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.asn.omv2;
+
+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.Sequence;
+
+@Sequence
+@HasExtensionMarker
+public class DocumentData extends Object {
+ public DocumentData() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public TokenType token;
+
+ @FieldOrder(order = 1)
+ public TicketDetailData ticket;
+
+ public TokenType getToken() {
+
+ return this.token;
+ }
+
+ public TicketDetailData getTicket() {
+
+ return this.ticket;
+ }
+
+ public void setToken(TokenType token) {
+
+ this.token = token;
+ }
+
+ public void setTicket(TicketDetailData ticket) {
+
+ this.ticket = ticket;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/ExtensionData.java b/src/org/uic/barcode/ticket/api/asn/omv2/ExtensionData.java new file mode 100644 index 0000000..1e3a33a --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/ExtensionData.java @@ -0,0 +1,64 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.OctetString;
+
+
+@Sequence
+public class ExtensionData extends Object {
+ public ExtensionData() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ public String extensionId;
+
+ @FieldOrder(order = 1)
+ public OctetString extensionData;
+
+ public String getExtensionId() {
+
+ return this.extensionId;
+ }
+
+ public byte[] getExtensionData() {
+
+ return extensionData.toByteArray();
+ }
+
+ public void setExtensionId(String extensionId) {
+
+ this.extensionId = extensionId;
+ }
+
+ public void setExtensionData(byte[] extensionData) {
+
+ this.extensionData = new OctetString(extensionData);
+
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/FIPTicketData.java b/src/org/uic/barcode/ticket/api/asn/omv2/FIPTicketData.java new file mode 100644 index 0000000..e11a66f --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/FIPTicketData.java @@ -0,0 +1,331 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.IntRange;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+
+public class FIPTicketData extends Object {
+ public FIPTicketData() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=0,maxValue=65535)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 6)
+ @IntRange(minValue=-1,maxValue=700)
+ @Asn1Optional public Long validFromDay;
+
+ @FieldOrder(order = 7)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long validUntilDay;
+
+ @FieldOrder(order = 8)
+ @Asn1Optional public SequenceOfActivatedDays activatedDay;
+
+ @FieldOrder(order = 9)
+ @Asn1Optional public SequenceOfCarrierNum carrierNum;
+
+ @FieldOrder(order = 10)
+ @Asn1Optional public SequenceOfStringIA5 carrierIA5;
+
+ @FieldOrder(order = 11)
+ @IntRange(minValue=1,maxValue=200)
+ public Long numberOfTravelDays;
+
+ @FieldOrder(order = 12)
+ public Boolean includesSupplements = false;
+
+ @FieldOrder(order = 13)
+ @Asn1Default(value="second")
+ @Asn1Optional public TravelClassType classCode;
+
+ @FieldOrder(order = 14)
+ @Asn1Optional public ExtensionData extension;
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Asn1BigInteger getReferenceNum() {
+
+ return this.referenceNum;
+ }
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+
+ return this.productIdIA5;
+ }
+
+ public Long getValidFromDay() {
+
+ return this.validFromDay;
+ }
+
+ public Long getValidUntilDay() {
+
+ return this.validUntilDay;
+ }
+
+ public List<Long> getActivatedDay() {
+
+ return this.activatedDay;
+ }
+
+ public List<Long> getCarrierNum() {
+
+ return this.carrierNum;
+ }
+
+ public List<String> getCarrierIA5() {
+
+ return this.carrierIA5;
+ }
+
+ public Long getNumberOfTravelDays() {
+
+ return this.numberOfTravelDays;
+ }
+
+ public Boolean getIncludesSupplements() {
+
+ return this.includesSupplements;
+ }
+
+ public TravelClassType getClassCode() {
+ if (classCode == null) return TravelClassType.second;
+ return this.classCode;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setReferenceNum(Asn1BigInteger referenceNum) {
+
+ this.referenceNum = referenceNum;
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setValidFromDay(Long validFromDay) {
+
+ this.validFromDay = validFromDay;
+ }
+
+ public void setValidUntilDay(Long validUntilDay) {
+
+ this.validUntilDay = validUntilDay;
+ }
+
+ public void setActivatedDay(SequenceOfActivatedDays activatedDay) {
+
+ this.activatedDay = activatedDay;
+ }
+
+ public void setCarrierNum(SequenceOfCarrierNum carrierNum) {
+
+ this.carrierNum = carrierNum;
+ }
+
+ public void setCarrierIA5(SequenceOfStringIA5 carrierIA5) {
+
+ this.carrierIA5 = carrierIA5;
+ }
+
+ public void setNumberOfTravelDays(Long numberOfTravelDays) {
+
+ this.numberOfTravelDays = numberOfTravelDays;
+ }
+
+ public void setIncludesSupplements(Boolean includesSupplements) {
+
+ this.includesSupplements = includesSupplements;
+ }
+
+ public void setClassCode(TravelClassType classCode) {
+ this.classCode = classCode;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public void setValidityDates (Date fromDate, Date untilDate, Date issuingDate){
+
+ if (issuingDate == null || fromDate == null) return;
+
+ this.validFromDay = DateTimeUtils.getDateDifference(issuingDate,fromDate);
+
+ if (untilDate != null){
+ this.validUntilDay = DateTimeUtils.getDateDifference(fromDate, untilDate);
+ }
+
+ }
+
+ public Date getValidFromDate(Date issuingDate){
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay,null);
+
+ }
+
+ public Date getValidUntilDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validUntilDay == null) {
+ return null;
+ }
+
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, null);
+
+ }
+
+ public void setActivatedDays(Collection<Date> dates, Date issuingDate){
+
+ if (this.activatedDay != null) {
+ this.activatedDay.clear();
+ } else {
+ this.activatedDay= new SequenceOfActivatedDays();
+ }
+
+ if (dates != null && !dates.isEmpty()) {
+
+ for (Date day : dates) {
+ this.addActivatedDay(issuingDate, day);
+ }
+
+ }
+
+ }
+
+ public void addActivatedDay(Date issuingDate, Date day){
+
+ Long dayDiff = DateTimeUtils.getDateDifference(issuingDate, day);
+
+ if (this.activatedDay == null) {
+ this.activatedDay = new SequenceOfActivatedDays();
+ }
+
+ if (dayDiff != null) {
+ this.activatedDay.add(dayDiff);
+ }
+
+ }
+
+ public Collection<Date> getActivatedDays(Date issuingDate) {
+
+ if (this.activatedDay == null) return null;
+
+ ArrayList<Date> dates = new ArrayList<Date>();
+
+ for (Long diff: this.getActivatedDay()) {
+
+ Date day = DateTimeUtils.getDate(issuingDate, diff, null);
+
+ if (day != null) {
+ dates.add(day);
+ }
+
+ }
+
+ return dates;
+
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/GenderType.java b/src/org/uic/barcode/ticket/api/asn/omv2/GenderType.java new file mode 100644 index 0000000..f81f045 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/GenderType.java @@ -0,0 +1,42 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum GenderType {
+ unspecified("unspecified"),
+ female("female"),
+ male("male"),
+ other("other");
+
+
+ public String text;
+
+ GenderType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/GeoCoordinateSystemType.java b/src/org/uic/barcode/ticket/api/asn/omv2/GeoCoordinateSystemType.java new file mode 100644 index 0000000..9a5bed4 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/GeoCoordinateSystemType.java @@ -0,0 +1,38 @@ +/*
+ * 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.asn.omv2;
+
+
+public enum GeoCoordinateSystemType {
+ wgs84("wgs84"),
+ grs80("grs80");
+
+
+ public String text;
+
+ GeoCoordinateSystemType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/GeoCoordinateType.java b/src/org/uic/barcode/ticket/api/asn/omv2/GeoCoordinateType.java new file mode 100644 index 0000000..16c4401 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/GeoCoordinateType.java @@ -0,0 +1,144 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+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.Sequence;
+
+@Sequence
+public class GeoCoordinateType extends Object {
+ public GeoCoordinateType() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Default(value="milliDegree")
+ @Asn1Optional public GeoUnitType geoUnit;
+
+ @FieldOrder(order = 1)
+ @Asn1Default(value="wgs84")
+ @Asn1Optional public GeoCoordinateSystemType coordinateSystem;
+
+ @FieldOrder(order = 2)
+ @Asn1Default(value="north")
+ @Asn1Optional public HemisphereLongitudeType hemisphereLongitude;
+
+ @FieldOrder(order = 3)
+ @Asn1Default(value="east")
+ @Asn1Optional public HemisphereLatitudeType hemisphereLatitude;
+
+ @FieldOrder(order = 4)
+ public Asn1BigInteger longitude;
+
+ @FieldOrder(order = 5)
+ public Asn1BigInteger latitude;
+
+ @FieldOrder(order = 6)
+ @Asn1Optional public GeoUnitType accuracy;
+
+ public GeoUnitType getGeoUnit() {
+
+ if (geoUnit == null){
+ return GeoUnitType.milliDegree;
+ }
+ return this.geoUnit;
+ }
+
+ public GeoCoordinateSystemType getCoordinateSystem() {
+
+ if (coordinateSystem == null) {
+ return GeoCoordinateSystemType.wgs84;
+ }
+
+ return this.coordinateSystem;
+ }
+
+ public HemisphereLongitudeType getHemisphereLongitude() {
+
+ if (hemisphereLongitude == null){
+ return HemisphereLongitudeType.north;
+ }
+
+ return this.hemisphereLongitude;
+ }
+
+ public HemisphereLatitudeType getHemisphereLatitude() {
+
+ if (hemisphereLatitude == null) {
+ return HemisphereLatitudeType.east;
+ }
+
+ return this.hemisphereLatitude;
+ }
+
+ public Long getLongitude() {
+
+ return Asn1BigInteger.toLong(this.longitude);
+ }
+
+ public Long getLatitude() {
+
+ return Asn1BigInteger.toLong(this.latitude);
+ }
+
+ public GeoUnitType getAccuracy() {
+
+ return this.accuracy;
+ }
+
+ public void setGeoUnit(GeoUnitType geoUnit) {
+
+ this.geoUnit = geoUnit;
+ }
+
+ public void setCoordinateSystem(GeoCoordinateSystemType coordinateSystem) {
+
+ this.coordinateSystem = coordinateSystem;
+ }
+
+ public void setHemisphereLongitude(HemisphereLongitudeType hemisphereLongitude) {
+
+ this.hemisphereLongitude = hemisphereLongitude;
+ }
+
+ public void setHemisphereLatitude(HemisphereLatitudeType hemisphereLatitude) {
+
+ this.hemisphereLatitude = hemisphereLatitude;
+ }
+
+ public void setLongitude(Long longitude) {
+
+ this.longitude = Asn1BigInteger.toAsn1(longitude);
+ }
+
+ public void setLatitude(Long latitude) {
+
+ this.latitude = Asn1BigInteger.toAsn1(latitude);
+ }
+
+ public void setAccuracy(GeoUnitType accuracy) {
+
+ this.accuracy = accuracy;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/GeoUnitType.java b/src/org/uic/barcode/ticket/api/asn/omv2/GeoUnitType.java new file mode 100644 index 0000000..225505b --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/GeoUnitType.java @@ -0,0 +1,40 @@ +/*
+ * 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.asn.omv2;
+
+public enum GeoUnitType {
+ microDegree("microDegree"),
+ tenthmilliDegree("tenthmilliDegree"),
+ milliDegree("milliDegree"),
+ centiDegree("centiDegree"),
+ deciDegree("deciDegree");
+
+
+ public String text;
+
+ GeoUnitType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/HemisphereLatitudeType.java b/src/org/uic/barcode/ticket/api/asn/omv2/HemisphereLatitudeType.java new file mode 100644 index 0000000..63ea321 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/HemisphereLatitudeType.java @@ -0,0 +1,37 @@ +/*
+ * 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.asn.omv2;
+
+public enum HemisphereLatitudeType {
+ east("east"),
+ west("west");
+
+
+ public String text;
+
+ HemisphereLatitudeType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/HemisphereLongitudeType.java b/src/org/uic/barcode/ticket/api/asn/omv2/HemisphereLongitudeType.java new file mode 100644 index 0000000..c493255 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/HemisphereLongitudeType.java @@ -0,0 +1,36 @@ +/*
+ * 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.asn.omv2;
+
+public enum HemisphereLongitudeType {
+ north("north"),
+ south("south");
+
+ public String text;
+
+ HemisphereLongitudeType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java b/src/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java new file mode 100644 index 0000000..dc43d75 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java @@ -0,0 +1,448 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.Date;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.IntRange;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.SizeRange;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+
+public class IncludedOpenTicketType extends Object {
+ public IncludedOpenTicketType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=0,maxValue=65535)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 4)
+ @Asn1Optional public Asn1BigInteger externalIssuerId;
+
+ @FieldOrder(order = 5)
+ @Asn1Optional public Asn1BigInteger issuerAutorizationId;
+
+ @FieldOrder(order = 6)
+ @Asn1Default("stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 7)
+ @Asn1Optional public SequenceOfRegionalValidityType validRegion;
+
+ @FieldOrder(order = 8)
+ @IntRange(minValue=-1,maxValue=700)
+ @Asn1Optional public Long validFromDay;
+
+ @FieldOrder(order = 9)
+ @IntRange(minValue=0,maxValue=1439)
+ @Asn1Optional public Long validFromTime;
+
+ @FieldOrder(order = 10)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validFromUTCOffset;
+
+ @FieldOrder(order = 11)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long validUntilDay;
+
+ @FieldOrder(order = 12)
+ @IntRange(minValue=0,maxValue=1439)
+ @Asn1Optional public Long validUntilTime;
+
+ @FieldOrder(order = 13)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validUntilUTCOffset;
+
+ @FieldOrder(order = 14)
+ @Asn1Default(value="second")
+ @Asn1Optional public TravelClassType classCode;
+
+ @FieldOrder(order = 15)
+ @SizeRange(minValue = 1, maxValue = 2)
+ @Asn1Optional public String serviceLevel;
+
+ @FieldOrder(order = 16)
+ @Asn1Optional public SequenceOfCarrierNum includedCarriersNum;
+
+ @FieldOrder(order = 17)
+ @Asn1Optional public SequenceOfStringIA5 includedCarriersIA5;
+
+ @FieldOrder(order = 18)
+ @Asn1Optional public SequenceOfServiceBrands includedServiceBrands;
+
+ @FieldOrder(order = 19)
+ @Asn1Optional public SequenceOfServiceBrands excludedServiceBrands;
+
+ @FieldOrder(order = 20)
+ @Asn1Optional public SequenceOfTariffType tariffs;
+
+ @FieldOrder(order = 21)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String infoText;
+
+ @FieldOrder(order = 22)
+ @Asn1Optional public SequenceOfTransportTypes includedTransportTypes;
+
+ @FieldOrder(order = 23)
+ @Asn1Optional public SequenceOfTransportTypes excludedTransportTypes;
+
+ @FieldOrder(order = 24)
+ @Asn1Optional public ExtensionData extension;
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+
+ return this.productIdIA5;
+ }
+
+ public Long getExternalIssuerId() {
+
+ return Asn1BigInteger.toLong(this.externalIssuerId);
+ }
+
+ public Long getIssuerAutorizationId() {
+
+ return Asn1BigInteger.toLong(this.issuerAutorizationId);
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUIC;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public List<RegionalValidityType> getValidRegion() {
+
+ return this.validRegion;
+ }
+
+ public Long getValidFromDay() {
+
+ return this.validFromDay;
+ }
+
+ public Long getValidFromTime() {
+
+ return this.validFromTime;
+ }
+
+ public Long getValidUntilDay() {
+
+ return this.validUntilDay;
+ }
+
+ public Long getValidUntilTime() {
+
+ return this.validUntilTime;
+ }
+
+ public TravelClassType getClassCode() {
+
+ if (classCode == null) {
+ return TravelClassType.second;
+ }
+
+ return this.classCode;
+ }
+
+ public String getServiceLevel() {
+
+ return this.serviceLevel;
+ }
+
+ public List<Long> getIncludedCarriersNum() {
+
+ return this.includedCarriersNum;
+ }
+
+ public List<String> getIncludedCarriersIA5() {
+
+ return this.includedCarriersIA5;
+ }
+
+ public List<Long> getIncludedServiceBrands() {
+
+ return this.includedServiceBrands;
+ }
+
+ public List<Long> getExcludedServiceBrands() {
+
+ return this.excludedServiceBrands;
+ }
+
+
+
+ public SequenceOfTransportTypes getIncludedTransportTypes() {
+ return includedTransportTypes;
+ }
+
+ public void setIncludedTransportTypes(SequenceOfTransportTypes includedTransportTypes) {
+ this.includedTransportTypes = includedTransportTypes;
+ }
+
+ public SequenceOfTransportTypes getExcludedTransportTypes() {
+ return excludedTransportTypes;
+ }
+
+ public void setExcludedTransportTypes(SequenceOfTransportTypes excludedTransportTypes) {
+ this.excludedTransportTypes = excludedTransportTypes;
+ }
+
+ public List<TariffType> getTariffs() {
+
+ return this.tariffs;
+ }
+
+ public String getInfoText() {
+
+ return this.infoText;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setExternalIssuerId(Long externalIssuerId) {
+
+ this.externalIssuerId = Asn1BigInteger.toAsn1(externalIssuerId);
+ }
+
+ public void setIssuerAutorizationId(Long issuerAutorizationId) {
+
+ this.issuerAutorizationId = Asn1BigInteger.toAsn1(issuerAutorizationId);
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setValidRegion(SequenceOfRegionalValidityType validRegion) {
+
+ this.validRegion = validRegion;
+ }
+
+ public void setValidFromDay(Long validFromDay) {
+
+ this.validFromDay = validFromDay;
+ }
+
+ public void setValidFromTime(Long validFromTime) {
+
+ this.validFromTime = validFromTime;
+ }
+
+ public void setValidUntilDay(Long validUntilDay) {
+
+ this.validUntilDay = validUntilDay;
+ }
+
+ public void setValidUntilTime(Long validUntilTime) {
+
+ this.validUntilTime = validUntilTime;
+ }
+
+ public void setClassCode(TravelClassType classCode) {
+
+ this.classCode = classCode;
+ }
+
+ public void setServiceLevel(String serviceLevel) {
+
+ this.serviceLevel = serviceLevel;
+ }
+
+ public void setIncludedCarriersNum(SequenceOfCarrierNum includedCarriersNum) {
+
+ this.includedCarriersNum = includedCarriersNum;
+ }
+
+ public void setIncludedCarriersIA5(SequenceOfStringIA5 includedCarriersIA5) {
+
+ this.includedCarriersIA5 = includedCarriersIA5;
+ }
+
+ public void setIncludedServiceBrands(SequenceOfServiceBrands includedServiceBrands) {
+
+ this.includedServiceBrands = includedServiceBrands;
+ }
+
+ public void setExcludedServiceBrands(SequenceOfServiceBrands excludedServiceBrands) {
+
+ this.excludedServiceBrands = excludedServiceBrands;
+ }
+
+ public void setTariffs(SequenceOfTariffType tariffs) {
+
+ this.tariffs = tariffs;
+ }
+
+ public void setInfoText(String infoText) {
+
+ this.infoText = infoText;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public void setValidityDates (Date fromDate, Date untilDate, Date issuingDate){
+
+ if (issuingDate == null || fromDate == null) return;
+
+ this.validFromDay = DateTimeUtils.getDateDifference(issuingDate,fromDate);
+ this.validFromTime = DateTimeUtils.getTime(fromDate);
+
+
+ if (untilDate != null){
+ this.validUntilDay = DateTimeUtils.getDateDifference(fromDate, untilDate);
+ this.validUntilTime = DateTimeUtils.getTime(untilDate);
+ }
+
+ }
+
+ public void setValidFromTimeZone(Date dateLocal, Date dateUTC ) {
+ // -- (UTC = local + offset * 15 Minutes)
+ this.validFromUTCOffset = new Long(dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15);
+ }
+
+ public void setValidUntilTimeZone(Date dateLocal, Date dateUTC ) {
+ // -- (UTC = local + offset * 15 Minutes)
+ this.validUntilUTCOffset = new Long(dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15);
+
+ if (this.validFromUTCOffset.longValue() == this.validUntilUTCOffset.longValue()) {
+ this.validUntilUTCOffset = null;
+ }
+ }
+
+
+
+ public Date getValidFromDate(Date issuingDate){
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay, this.validFromTime);
+
+ }
+
+ public Date getValidUntilDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validUntilDay == null) {
+ return null;
+ }
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime);
+
+ }
+
+ public Date getUTCValidFromDate(Date issuingDate){
+ return DateTimeUtils.getUTCDate(issuingDate, this.validFromDay, this.validFromTime, this.validFromUTCOffset);
+ }
+
+ public Date getUTCValidUntilDate(Date issuingDate){
+ if (this.validUntilUTCOffset == null) {
+ return DateTimeUtils.getUTCDate(issuingDate, this.validFromDay, this.validFromTime, this.validFromUTCOffset);
+ } else {
+ return DateTimeUtils.getUTCDate(issuingDate, this.validFromDay, this.validUntilTime, this.validFromUTCOffset);
+ }
+ }
+
+ public Long getValidFromUTCOffset() {
+ return validFromUTCOffset;
+ }
+
+ public void setValidFromUTCOffset(Long validFromUTCOffset) {
+ this.validFromUTCOffset = validFromUTCOffset;
+ }
+
+ public Long getValidUntilUTCOffset() {
+ return validUntilUTCOffset;
+ }
+
+ public void setValidUntilUTCOffset(Long validUntilUTCOffset) {
+ this.validUntilUTCOffset = validUntilUTCOffset;
+ }
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/IssuingData.java b/src/org/uic/barcode/ticket/api/asn/omv2/IssuingData.java new file mode 100644 index 0000000..2491d79 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/IssuingData.java @@ -0,0 +1,360 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.FixedSize;
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+import org.uic.barcode.asn1.datatypes.IntRange;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+@HasExtensionMarker
+public class IssuingData extends Object {
+ public IssuingData() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long securityProviderNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String securityProviderIA5;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long issuerNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String issuerIA5;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=2016,maxValue=2269)
+ public Long issuingYear;
+
+ @FieldOrder(order = 5)
+ @IntRange(minValue=1,maxValue=366)
+ public Long issuingDay;
+
+ @FieldOrder(order = 6)
+ @IntRange(minValue=0,maxValue=1439)
+ @Asn1Optional public Long issuingTime;
+
+ @FieldOrder(order = 7)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String issuerName;
+
+ @FieldOrder(order = 8)
+ public Boolean specimen = false;
+
+ @FieldOrder(order = 9)
+ public Boolean securePaperTicket = false;
+
+ @FieldOrder(order = 10)
+ public Boolean activated = true;
+
+ @FieldOrder(order = 11)
+ @FixedSize(3)
+ @Asn1Default(value="EUR")
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String currency;
+
+ @FieldOrder(order = 12)
+ @IntRange(minValue=1,maxValue=3)
+ @Asn1Default(value="2")
+ @Asn1Optional public Long currencyFract;
+
+ @FieldOrder(order = 13)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String issuerPNR;
+
+ @FieldOrder(order = 14)
+ @Asn1Optional public ExtensionData extension;
+
+ @FieldOrder(order = 15)
+ @Asn1Optional public Asn1BigInteger issuedOnTrainNum;
+
+ @FieldOrder(order = 16)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String issuedOnTrainIA5;
+
+ @FieldOrder(order = 17)
+ @Asn1Optional public Asn1BigInteger issuedOnLine;
+
+ @FieldOrder(order = 18)
+ @Asn1Optional public GeoCoordinateType pointOfSale;
+
+
+
+
+
+
+ public Long getSecurityProviderNum() {
+
+ return this.securityProviderNum;
+ }
+
+ public String getSecurityProviderIA5() {
+
+ return this.securityProviderIA5;
+ }
+
+ public Long getIssuerNum() {
+
+ return this.issuerNum;
+ }
+
+ public String getIssuerIA5() {
+
+ return this.issuerIA5;
+ }
+
+ public Long getIssuingYear() {
+
+ return this.issuingYear;
+ }
+
+ public Long getIssuingDay() {
+
+ return this.issuingDay;
+ }
+
+ public Long getIssuingTime() {
+
+ return this.issuingTime;
+ }
+
+ public String getIssuerName() {
+
+ return this.issuerName;
+ }
+
+ public Boolean getSpecimen() {
+
+ return this.specimen;
+ }
+
+ public Boolean getSecurePaperTicket() {
+
+ return this.securePaperTicket;
+ }
+
+ public Boolean getActivated() {
+
+ return this.activated;
+ }
+
+ public String getCurrency() {
+
+ if (currency == null || currency.length() == 0){
+ return "EUR";
+ }
+
+ return this.currency;
+ }
+
+ public Long getCurrencyFract() {
+
+ if (currencyFract == null) {
+ return new Long(2);
+ }
+ return this.currencyFract;
+ }
+
+ public String getIssuerPNR() {
+
+ return this.issuerPNR;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public Long getIssuedOnTrainNum() {
+
+ return Asn1BigInteger.toLong(issuedOnTrainNum);
+ }
+
+ public String getIssuedOnTrainIA5() {
+
+ return this.issuedOnTrainIA5;
+ }
+
+ public Long getIssuedOnLine() {
+
+ return Asn1BigInteger.toLong(issuedOnLine);
+ }
+
+ public GeoCoordinateType getPointOfSale() {
+
+ return this.pointOfSale;
+ }
+
+ public void setSecurityProviderNum(Long securityProviderNum) {
+
+ this.securityProviderNum = securityProviderNum;
+ }
+
+ public void setSecurityProviderIA5(String securityProviderIA5) {
+
+ this.securityProviderIA5 = securityProviderIA5;
+ }
+
+ public void setIssuerNum(Long issuerNum) {
+
+ this.issuerNum = issuerNum;
+ }
+
+ public void setIssuerIA5(String issuerIA5) {
+
+ this.issuerIA5 = issuerIA5;
+ }
+
+ public void setIssuingYear(Long issuingYear) {
+
+ this.issuingYear = issuingYear;
+ }
+
+ public void setIssuingDay(Long issuingDay) {
+
+ this.issuingDay = issuingDay;
+ }
+
+ public void setIssuingTime(Long issuingTime) {
+
+ this.issuingTime = issuingTime;
+ }
+
+ public void setIssuerName(String issuerName) {
+
+ this.issuerName = issuerName;
+ }
+
+ public void setSpecimen(Boolean specimen) {
+
+ this.specimen = specimen;
+ }
+
+ public void setSecurePaperTicket(Boolean securePaperTicket) {
+
+ this.securePaperTicket = securePaperTicket;
+ }
+
+ public void setActivated(Boolean activated) {
+
+ this.activated = activated;
+ }
+
+ public void setCurrency(String currency) {
+
+ this.currency = currency;
+ }
+
+ public void setCurrencyFract(Long currencyFract) {
+
+ this.currencyFract = currencyFract;
+ }
+
+ public void setIssuerPNR(String issuerPNR) {
+
+ this.issuerPNR = issuerPNR;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public void setIssuedOnTrainNum(Long issuedOnTrainNum) {
+
+ this.issuedOnTrainNum = Asn1BigInteger.toAsn1(issuedOnTrainNum);
+ }
+
+ public void setIssuedOnTrainIA5(String issuedOnTrainIA5) {
+
+ this.issuedOnTrainIA5 = issuedOnTrainIA5;
+ }
+
+ public void setIssuedOnLine(Long issuedOnLine) {
+
+ this.issuedOnLine = Asn1BigInteger.toAsn1(issuedOnLine);
+ }
+
+ public void setPointOfSale(GeoCoordinateType pointOfSale) {
+
+ this.pointOfSale = pointOfSale;
+ }
+
+ public void setIssuingDate(Date date){
+
+ if (date == null) {
+ date = Calendar.getInstance().getTime();
+ }
+
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+
+ this.issuingYear = new Long( cal.get(Calendar.YEAR));
+ this.issuingDay = new Long (cal.get(Calendar.DAY_OF_YEAR));
+ int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE);
+ if (time > 0) {
+ this.issuingTime = new Long (time );
+ }
+
+ }
+
+ public Date getIssuingDate() {
+
+ if (this.issuingYear == null || this.issuingDay == null) return null;
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ cal.set(Calendar.YEAR, this.issuingYear.intValue());
+ cal.set(Calendar.DAY_OF_YEAR, this.issuingDay.intValue());
+
+ if (this.issuingTime != null) {
+
+ int hours = this.issuingTime.intValue() / 60;
+ int minutes = this.issuingTime.intValue() % 60;
+ cal.set(Calendar.HOUR_OF_DAY, hours);
+ cal.set(Calendar.MINUTE,minutes);
+
+ }
+
+ return cal.getTime();
+ }
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/LineType.java b/src/org/uic/barcode/ticket/api/asn/omv2/LineType.java new file mode 100644 index 0000000..fff4499 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/LineType.java @@ -0,0 +1,185 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.OctetString;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfUnrestrictedLong;
+
+@Sequence
+@HasExtensionMarker
+
+public class LineType extends Object {
+ public LineType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long carrierNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String carrierIA5;
+
+ @FieldOrder(order = 2)
+ @Asn1Optional public SequenceOfUnrestrictedLong lineId;
+
+ @FieldOrder(order = 3)
+ @Asn1Default("stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=0,maxValue=9999999)
+ @Asn1Optional public Long entryStationNum;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String entryStationIA5;
+
+ @FieldOrder(order = 6)
+ @IntRange(minValue=0,maxValue=9999999)
+ @Asn1Optional public Long terminatingStationNum;
+
+ @FieldOrder(order = 7)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String terminatingStationIA5;
+
+ @FieldOrder(order = 8)
+ @Asn1Optional public Asn1BigInteger city;
+
+ @FieldOrder(order = 9)
+ @Asn1Optional public OctetString binaryZoneId;
+
+
+
+ public Long getCarrierNum() {
+
+ return this.carrierNum;
+ }
+
+ public String getCarrierIA5() {
+
+ return this.carrierIA5;
+ }
+
+ public SequenceOfUnrestrictedLong getLineId() {
+
+ return this.lineId;
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUIC;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public Long getEntryStationNum() {
+
+ return this.entryStationNum;
+ }
+
+ public String getEntryStationIA5() {
+
+ return this.entryStationIA5;
+ }
+
+ public Long getTerminatingStationNum() {
+
+ return this.terminatingStationNum;
+ }
+
+ public String getTerminatingStationIA5() {
+
+ return this.terminatingStationIA5;
+ }
+
+ public Long getCity() {
+
+ return Asn1BigInteger.toLong(this.city);
+ }
+
+ public byte[] getBinaryZoneId() {
+
+ return binaryZoneId.toByteArray();
+ }
+
+ public void setCarrierNum(Long carrierNum) {
+
+ this.carrierNum = carrierNum;
+ }
+
+ public void setCarrierIA5(String carrierIA5) {
+
+ this.carrierIA5 = carrierIA5;
+ }
+
+ public void setLineId(SequenceOfUnrestrictedLong lineId) {
+
+ this.lineId = lineId;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setEntryStationNum(Long entryStationNum) {
+
+ this.entryStationNum = entryStationNum;
+ }
+
+ public void setEntryStationIA5(String entryStationIA5) {
+
+ this.entryStationIA5 = entryStationIA5;
+ }
+
+ public void setTerminatingStationNum(Long terminatingStationNum) {
+
+ this.terminatingStationNum = terminatingStationNum;
+ }
+
+ public void setTerminatingStationIA5(String terminatingStationIA5) {
+
+ this.terminatingStationIA5 = terminatingStationIA5;
+ }
+
+ public void setCity(Long city) {
+
+ this.city = Asn1BigInteger.toAsn1(city);
+ }
+
+ public void setBinaryZoneId(byte[] binaryZoneId) {
+
+ this.binaryZoneId = new OctetString(binaryZoneId);
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/LinkMode.java b/src/org/uic/barcode/ticket/api/asn/omv2/LinkMode.java new file mode 100644 index 0000000..f4e7635 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/LinkMode.java @@ -0,0 +1,39 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum LinkMode {
+ issuedTogether("issuedTogether"),
+ onlyValidInCombination("onlyValidInCombination");
+
+ public String text;
+
+ LinkMode(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/LoadingDeckType.java b/src/org/uic/barcode/ticket/api/asn/omv2/LoadingDeckType.java new file mode 100644 index 0000000..8662877 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/LoadingDeckType.java @@ -0,0 +1,38 @@ +/*
+ * 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.asn.omv2;
+
+
+public enum LoadingDeckType {
+ unspecified("unspecified"),
+ upper("upper"),
+ lower("lower");
+
+ public String text;
+
+ LoadingDeckType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/LuggageRestrictionType.java b/src/org/uic/barcode/ticket/api/asn/omv2/LuggageRestrictionType.java new file mode 100644 index 0000000..caa1caa --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/LuggageRestrictionType.java @@ -0,0 +1,88 @@ +/*
+ * 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.asn.omv2;
+
+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;
+
+@Sequence
+@HasExtensionMarker
+public class LuggageRestrictionType extends Object {
+ public LuggageRestrictionType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=0,maxValue=99)
+ @Asn1Default(value="3")
+ @Asn1Optional public Long maxHandLuggagePieces;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue=0,maxValue=99)
+ @Asn1Default(value="1")
+ @Asn1Optional public Long maxNonHandLuggagePieces;
+
+ @FieldOrder(order = 2)
+ @Asn1Optional public SequenceOfRegisteredLuggageType registeredLuggage;
+
+
+ public void setRegisteredLuggage(
+ SequenceOfRegisteredLuggageType registeredLuggage) {
+ this.registeredLuggage = registeredLuggage;
+ }
+
+ public Long getMaxHandLuggagePieces() {
+
+ if (maxHandLuggagePieces == null) {
+ return new Long(3);
+ }
+
+ return this.maxHandLuggagePieces;
+ }
+
+ public Long getMaxNonHandLuggagePieces() {
+
+ if (maxNonHandLuggagePieces == null) {
+ return new Long(1);
+ }
+
+ return this.maxNonHandLuggagePieces;
+ }
+
+ public SequenceOfRegisteredLuggageType getRegisteredLuggage() {
+
+ return this.registeredLuggage;
+ }
+
+ public void setMaxHandLuggagePieces(Long maxHandLuggagePieces) {
+
+ this.maxHandLuggagePieces = maxHandLuggagePieces;
+ }
+
+ public void setMaxNonHandLuggagePieces(Long maxNonHandLuggagePieces) {
+
+ this.maxNonHandLuggagePieces = maxNonHandLuggagePieces;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java b/src/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java new file mode 100644 index 0000000..402323e --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java @@ -0,0 +1,674 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypes.SizeRange;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+
+@Sequence
+@HasExtensionMarker
+public class OpenTicketData extends Object {
+ public OpenTicketData() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=0,maxValue=65535)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 6)
+ @Asn1Optional public Asn1BigInteger externalIssuerId;
+
+ @FieldOrder(order = 7)
+ @Asn1Optional public Asn1BigInteger issuerAutorizationId;
+
+ @FieldOrder(order = 8)
+ public Boolean returnIncluded = false;
+
+ @FieldOrder(order = 9)
+ @Asn1Default("stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 10)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long fromStationNum;
+
+ @FieldOrder(order = 11)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String fromStationIA5;
+
+ @FieldOrder(order = 12)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long toStationNum;
+
+ @FieldOrder(order = 13)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String toStationIA5;
+
+ @FieldOrder(order = 14)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String fromStationNameUTF8;
+
+ @FieldOrder(order = 15)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String toStationNameUTF8;
+
+ @FieldOrder(order = 16)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String validRegionDesc;
+
+ @FieldOrder(order = 17)
+ @Asn1Optional public SequenceOfRegionalValidityType validRegion;
+
+ @FieldOrder(order = 18)
+ @Asn1Optional public ReturnRouteDescriptionType returnDescription;
+
+ @FieldOrder(order = 19)
+ @Asn1Default(value = "0")
+ @IntRange(minValue=-1,maxValue=700)
+ @Asn1Optional public Long validFromDay;
+
+ @FieldOrder(order = 20)
+ @IntRange(minValue=0,maxValue=1439)
+ @Asn1Optional public Long validFromTime;
+
+ @FieldOrder(order = 21)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validFromUTCOffset;
+
+ @FieldOrder(order = 22)
+ @Asn1Default(value = "0")
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long validUntilDay;
+
+ @FieldOrder(order = 23)
+ @IntRange(minValue=0,maxValue=1439)
+ @Asn1Optional public Long validUntilTime;
+
+ @FieldOrder(order = 24)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validUntilUTCOffset;
+
+ @FieldOrder(order = 25)
+ @Asn1Optional public SequenceOfActivatedDays activatedDay;
+
+ @FieldOrder(order = 26)
+ @Asn1Default(value="second")
+ @Asn1Optional public TravelClassType classCode;
+
+ @FieldOrder(order = 27)
+ @SizeRange(minValue = 1, maxValue = 2)
+ @Asn1Optional public String serviceLevel;
+
+ @FieldOrder(order = 28)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public SequenceOfCarrierNum carrierNum;
+
+ @FieldOrder(order = 29)
+ @Asn1Optional public SequenceOfStringIA5 carrierIA5;
+
+ @FieldOrder(order = 30)
+ @Asn1Optional public SequenceOfServiceBrands includedServiceBrands;
+
+ @FieldOrder(order = 31)
+ @Asn1Optional public SequenceOfServiceBrands excludedServiceBrands;
+
+ @FieldOrder(order = 32)
+ @Asn1Optional public SequenceOfTariffType tariffs;
+
+ @FieldOrder(order = 33)
+ @Asn1Optional Asn1BigInteger price;
+
+ @FieldOrder(order = 34)
+ @Asn1Optional SequenceOfVatDetail vatDetails;
+
+ @FieldOrder(order = 35)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String infoText;
+
+ @FieldOrder(order = 36)
+ @Asn1Optional public SequenceOfIncludedOpenTicketType includedAddOns;
+
+ @FieldOrder(order = 37)
+ @Asn1Optional public LuggageRestrictionType luggage;
+
+ @FieldOrder(order = 38)
+ @Asn1Optional public SequenceOfTransportTypes includedTransportTypes;
+
+ @FieldOrder(order = 39)
+ @Asn1Optional public SequenceOfTransportTypes excludedTransportTypes;
+
+ @FieldOrder(order = 40)
+ @Asn1Optional public ExtensionData extension;
+
+
+
+
+ public Long getReferenceNum() {
+ return Asn1BigInteger.toLong(this.referenceNum);
+ }
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+
+ return this.productIdIA5;
+ }
+
+ public Long getExtIssuerId() {
+
+ return Asn1BigInteger.toLong(externalIssuerId);
+ }
+
+ public Long getIssuerAutorizationId() {
+
+ return Asn1BigInteger.toLong(issuerAutorizationId);
+ }
+
+ public Boolean getReturnIncluded() {
+
+ return this.returnIncluded;
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUIC;
+ }
+
+
+ return this.stationCodeTable;
+ }
+
+ public Long getFromStationNum() {
+
+ return this.fromStationNum;
+ }
+
+ public String getFromStationIA5() {
+
+ return this.fromStationIA5;
+ }
+
+ public Long getToStationNum() {
+
+ return this.toStationNum;
+ }
+
+ public String getToStationIA5() {
+
+ return this.toStationIA5;
+ }
+
+ public String getFromStationNameUTF8() {
+
+ return this.fromStationNameUTF8;
+ }
+
+ public String getToStationNameUTF8() {
+
+ return this.toStationNameUTF8;
+ }
+
+ public String getValidRegionDesc() {
+
+ return this.validRegionDesc;
+ }
+
+ public List<RegionalValidityType> getValidRegion() {
+
+ return this.validRegion;
+ }
+
+ public ReturnRouteDescriptionType getReturnDescription() {
+
+ return this.returnDescription;
+ }
+
+ public Long getValidFromDay() {
+
+ return this.validFromDay;
+ }
+
+ public Long getValidFromTime() {
+
+ return this.validFromTime;
+ }
+
+ public Long getValidUntilDay() {
+
+ return this.validUntilDay;
+ }
+
+ public Long getValidUntilTime() {
+
+ return this.validUntilTime;
+ }
+
+ public List<Long> getActivatedDay() {
+
+ return this.activatedDay;
+ }
+
+ public TravelClassType getClassCode() {
+
+ if (classCode == null) {
+ return TravelClassType.second;
+ }
+
+ return this.classCode;
+ }
+
+ public String getServiceLevel() {
+
+ return this.serviceLevel;
+ }
+
+ public List<Long> getCarriersNum() {
+
+ return this.carrierNum;
+ }
+
+ public List<String> getCarriersIA5() {
+
+ return this.carrierIA5;
+ }
+
+ public List<Long> getIncludedServiceBrands() {
+
+ return this.includedServiceBrands;
+ }
+
+ public List<Long> getExcludedServiceBrands() {
+
+ return this.excludedServiceBrands;
+ }
+
+ public List<TariffType> getTariffs() {
+
+ return this.tariffs;
+ }
+
+ public String getInfoText() {
+
+ return this.infoText;
+ }
+
+ public List<IncludedOpenTicketType> getIncludedAddOns() {
+
+ return this.includedAddOns;
+ }
+
+ public LuggageRestrictionType getLuggage() {
+
+ return this.luggage;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setReferenceNum(Long referenceNum) {
+ this.referenceNum = Asn1BigInteger.toAsn1(referenceNum);
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setExtIssuerId(Long extIssuerId) {
+ this.externalIssuerId = Asn1BigInteger.toAsn1(extIssuerId);
+ }
+
+ public void setIssuerAutorizationId(Long issuerAutorizationId) {
+
+ this.issuerAutorizationId = Asn1BigInteger.toAsn1(issuerAutorizationId);
+ }
+
+ public void setReturnIncluded(Boolean returnIncluded) {
+ this.returnIncluded = returnIncluded;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setFromStationNum(Long fromStationNum) {
+ this.fromStationNum = fromStationNum;
+ }
+
+ public void setFromStationIA5(String fromStationIA5) {
+ this.fromStationIA5 = fromStationIA5;
+ }
+
+ public void setToStationNum(Long toStationNum) {
+ this.toStationNum = toStationNum;
+ }
+
+ public void setToStationIA5(String toStationIA5) {
+ this.toStationIA5 = toStationIA5;
+ }
+
+ public void setFromStationNameUTF8(String fromStationNameUTF8) {
+ this.fromStationNameUTF8 = fromStationNameUTF8;
+ }
+
+ public void setToStationNameUTF8(String toStationNameUTF8) {
+ this.toStationNameUTF8 = toStationNameUTF8;
+ }
+
+ public void setValidRegionDesc(String validRegionDesc) {
+ this.validRegionDesc = validRegionDesc;
+ }
+
+ public void setValidRegion(SequenceOfRegionalValidityType validRegion) {
+ this.validRegion = validRegion;
+ }
+
+ public void setReturnDescription(ReturnRouteDescriptionType returnDescription) {
+ this.returnDescription = returnDescription;
+ }
+
+ public void setValidFromDay(Long validFromDay) {
+ this.validFromDay = validFromDay;
+ }
+
+ public void setValidFromTime(Long validFromTime) {
+ this.validFromTime = validFromTime;
+ }
+
+ public void setValidUntilDay(Long validUntilDay) {
+ this.validUntilDay = validUntilDay;
+ }
+
+ public void setValidUntilTime(Long validUntilTime) {
+ this.validUntilTime = validUntilTime;
+ }
+
+ public void setActivatedDay(SequenceOfActivatedDays activatedDay) {
+ this.activatedDay = activatedDay;
+ }
+
+ public void setClassCode(TravelClassType classCode) {
+ this.classCode = classCode;
+ }
+
+ public void setServiceLevel(String serviceLevel) {
+ this.serviceLevel = serviceLevel;
+ }
+
+ public void setCarriersNum(SequenceOfCarrierNum carriersNum) {
+
+ this.carrierNum = carriersNum;
+ }
+
+ public void setCarriersIA5(SequenceOfStringIA5 carriersIA5) {
+ this.carrierIA5 = carriersIA5;
+ }
+
+ public void setIncludedServiceBrands(SequenceOfServiceBrands includedServiceBrands) {
+ this.includedServiceBrands = includedServiceBrands;
+ }
+
+ public void setExcludedServiceBrands(SequenceOfServiceBrands excludedServiceBrands) {
+ this.excludedServiceBrands = excludedServiceBrands;
+ }
+
+
+ public SequenceOfTransportTypes getIncludedTransportTypes() {
+ return includedTransportTypes;
+ }
+
+ public void setIncludedTransportTypes(SequenceOfTransportTypes includedTransportTypes) {
+ this.includedTransportTypes = includedTransportTypes;
+ }
+
+ public SequenceOfTransportTypes getExcludedTransportTypes() {
+ return excludedTransportTypes;
+ }
+
+ public void setExcludedTransportTypes(SequenceOfTransportTypes excludedTransportTypes) {
+ this.excludedTransportTypes = excludedTransportTypes;
+ }
+
+ public void setTariffs(SequenceOfTariffType tariffs) {
+ this.tariffs = tariffs;
+ }
+
+ public void setInfoText(String infoText) {
+
+ this.infoText = infoText;
+ }
+
+ public void setIncludedAddOns(SequenceOfIncludedOpenTicketType includedAddOns) {
+ this.includedAddOns = includedAddOns;
+ }
+
+ public void setLuggage(LuggageRestrictionType luggage) {
+ this.luggage = luggage;
+ }
+
+ public void setExtension(ExtensionData extension) {
+ this.extension = extension;
+ }
+
+ public Long getPrice() {
+ return Asn1BigInteger.toLong(price);
+ }
+
+ public void setPrice(Long price) {
+ this.price = Asn1BigInteger.toAsn1(price);
+ }
+
+ public SequenceOfVatDetail getVatDetails() {
+ return vatDetails;
+ }
+
+ public void setVatDetails(SequenceOfVatDetail vatDetails) {
+ this.vatDetails = vatDetails;
+ }
+
+ public void addVatDetail(VatDetailType vatDetail) {
+ if (this.vatDetails == null) {
+ this.vatDetails = new SequenceOfVatDetail();
+ }
+ this.vatDetails.add(vatDetail);
+ }
+
+ public void setValidityDates (Date fromDate, Date untilDate, Date issuingDate){
+
+ if (issuingDate == null || fromDate == null) return;
+
+ this.validFromDay = DateTimeUtils.getDateDifference(issuingDate,fromDate);
+ this.validFromTime = DateTimeUtils.getTime(fromDate);
+
+ if (untilDate != null){
+ this.validUntilDay = DateTimeUtils.getDateDifference(fromDate, untilDate);
+ this.validUntilTime = DateTimeUtils.getTime(untilDate);
+ }
+
+ }
+
+ public Date getValidFromDate(Date issuingDate){
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay, this.validFromTime);
+
+ }
+
+ public Date getValidUntilDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validUntilDay == null) {
+ return null;
+ }
+
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime);
+
+ }
+
+
+
+ public void setActivatedDays(Collection<Date> dates, Date issuingDate){
+
+ if (this.activatedDay != null) {
+ this.activatedDay.clear();
+ } else {
+ this.activatedDay= new SequenceOfActivatedDays();
+ }
+
+ if (dates != null && !dates.isEmpty()) {
+
+ for (Date day : dates) {
+ this.addActivatedDay(issuingDate, day);
+ }
+
+ }
+
+ }
+
+ public void addActivatedDay(Date issuingDate, Date day){
+
+ Long dayDiff = DateTimeUtils.getDateDifference(issuingDate, day);
+
+ if (this.activatedDay == null) {
+ this.activatedDay = new SequenceOfActivatedDays();
+ }
+
+ if (dayDiff != null) {
+ this.activatedDay.add(dayDiff);
+ }
+
+ }
+
+ public Collection<Date> getActivatedDays(Date issuingDate) {
+
+ if (this.activatedDay == null) return null;
+
+ ArrayList<Date> dates = new ArrayList<Date>();
+
+ for (Long diff: this.getActivatedDay()) {
+
+ Date day = DateTimeUtils.getDate(issuingDate, diff, null);
+
+ if (day != null) {
+ dates.add(day);
+ }
+
+ }
+
+ return dates;
+
+ }
+ public Long getValidFromUTCOffset() {
+ return validFromUTCOffset;
+ }
+
+ public void setValidFromUTCOffset(Long validFromUTCOffset) {
+ this.validFromUTCOffset = validFromUTCOffset;
+ }
+
+ public Long getValidUntilUTCOffset() {
+ return validUntilUTCOffset;
+ }
+
+ public void setValidUntilUTCOffset(Long validUntilUTCOffset) {
+ this.validUntilUTCOffset = validUntilUTCOffset;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/ParkingGroundData.java b/src/org/uic/barcode/ticket/api/asn/omv2/ParkingGroundData.java new file mode 100644 index 0000000..1e14394 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/ParkingGroundData.java @@ -0,0 +1,363 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.Date;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+@HasExtensionMarker
+public class ParkingGroundData extends Object {
+ public ParkingGroundData() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 2)
+ @RestrictedString(CharacterRestriction.IA5String)
+ public String parkingGroundId;
+
+ @FieldOrder(order = 3)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long fromParkingDate;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long toParkingDate;
+
+ @FieldOrder(order = 5)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 6)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 7)
+ @IntRange(minValue=0,maxValue=65535)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 8)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 9)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String accessCode;
+
+ @FieldOrder(order = 10)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ public String location;
+
+ @FieldOrder(order = 11)
+ @Asn1Default("stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 12)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long stationNum;
+
+ @FieldOrder(order = 13)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String stationIA5;
+
+ @FieldOrder(order = 14)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String specialInformation;
+
+ @FieldOrder(order = 15)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String entryTrack;
+
+ @FieldOrder(order = 16)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String numberPlate;
+
+ @FieldOrder(order = 17)
+ @Asn1Optional Asn1BigInteger price;
+
+ @FieldOrder(order = 18)
+ @Asn1Optional SequenceOfVatDetail vatDetails;
+
+ @FieldOrder(order = 19)
+ @Asn1Optional public ExtensionData extension;
+
+
+
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Asn1BigInteger getReferenceNum() {
+
+ return this.referenceNum;
+ }
+
+ public String getParkingGroundId() {
+
+ return this.parkingGroundId;
+ }
+
+ public Long getFromParkingDate() {
+
+ return this.fromParkingDate;
+ }
+
+ public Long getToParkingDate() {
+
+ return this.toParkingDate;
+ }
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+
+ return this.productIdIA5;
+ }
+
+ public String getAccessCode() {
+
+ return this.accessCode;
+ }
+
+ public String getLocation() {
+
+ return this.location;
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUIC;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public Long getStationNum() {
+
+ return this.stationNum;
+ }
+
+ public String getStationIA5() {
+
+ return this.stationIA5;
+ }
+
+ public String getSpecialInformation() {
+
+ return this.specialInformation;
+ }
+
+ public String getEntryTrack() {
+
+ return this.entryTrack;
+ }
+
+ public String getNumberPlate() {
+
+ return this.numberPlate;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setReferenceNum(Asn1BigInteger referenceNum) {
+
+ this.referenceNum = referenceNum;
+ }
+
+ public void setParkingGroundId(String parkingGroundId) {
+
+ this.parkingGroundId = parkingGroundId;
+ }
+
+ public void setFromParkingDate(Long fromParkingDate) {
+
+ this.fromParkingDate = fromParkingDate;
+ }
+
+ public void setToParkingDate(Long toParkingDate) {
+
+ this.toParkingDate = toParkingDate;
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setAccessCode(String accessCode) {
+
+ this.accessCode = accessCode;
+ }
+
+ public void setLocation(String location) {
+
+ this.location = location;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setStationNum(Long stationNum) {
+
+ this.stationNum = stationNum;
+ }
+
+ public void setStationIA5(String stationIA5) {
+
+ this.stationIA5 = stationIA5;
+ }
+
+ public void setSpecialInformation(String specialInformation) {
+
+ this.specialInformation = specialInformation;
+ }
+
+ public void setEntryTrack(String entryTrack) {
+
+ this.entryTrack = entryTrack;
+ }
+
+ public void setNumberPlate(String numberPlate) {
+
+ this.numberPlate = numberPlate;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public Long getPrice() {
+ return Asn1BigInteger.toLong(price);
+ }
+
+ public void setPrice(Long price) {
+ this.price = Asn1BigInteger.toAsn1(price);
+ }
+
+ public SequenceOfVatDetail getVatDetails() {
+ return vatDetails;
+ }
+
+ public void setVatDetails(SequenceOfVatDetail vatDetails) {
+ this.vatDetails = vatDetails;
+ }
+
+ public void addVatDetail(VatDetailType vatDetail) {
+ if (this.vatDetails == null) {
+ this.vatDetails = new SequenceOfVatDetail();
+ }
+ this.vatDetails.add(vatDetail);
+ }
+
+
+ public void setParkingDate (Date fromDate, Date issuingDate){
+
+ if (issuingDate == null || fromDate == null) return;
+
+ this.fromParkingDate = DateTimeUtils.getDateDifference(issuingDate,fromDate);
+
+ }
+
+ public Date getFromParkingDate(Date issuingDate){
+
+ return DateTimeUtils.getDate(issuingDate, this.fromParkingDate, null);
+
+ }
+
+ public Date getToParkingDate(Date issuingDate) {
+
+ if ( this.toParkingDate == null) return null;
+
+ return DateTimeUtils.getDate(issuingDate, this.fromParkingDate + this.toParkingDate, null);
+
+ }
+
+ public void setParkingDates(Date fromDate, Date toDate, Date issuingDate) {
+
+ if (issuingDate == null || fromDate == null) return;
+
+ this.fromParkingDate = DateTimeUtils.getDateDifference(issuingDate,fromDate);
+
+
+ if (toDate != null) {
+ this.toParkingDate = DateTimeUtils.getDateDifference(fromDate,toDate);
+
+ }
+
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/PassData.java b/src/org/uic/barcode/ticket/api/asn/omv2/PassData.java new file mode 100644 index 0000000..b3b02e7 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/PassData.java @@ -0,0 +1,590 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+
+@Sequence
+@HasExtensionMarker
+public class PassData extends Object {
+ public PassData() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=0,maxValue=65535)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 6)
+ @IntRange(minValue=1,maxValue=250)
+ @Asn1Optional public Long passType;
+
+ @FieldOrder(order = 7)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String passDescription;
+
+ @FieldOrder(order = 8)
+ @Asn1Default (value="second")
+ @Asn1Optional public TravelClassType classCode;
+
+ @FieldOrder(order = 9)
+ @IntRange(minValue=-1,maxValue=700)
+ @Asn1Optional public Long validFromDay;
+
+ @FieldOrder(order = 10)
+ @IntRange(minValue=0,maxValue=1439)
+ @Asn1Optional public Long validFromTime;
+
+ @FieldOrder(order = 11)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validFromUTCOffset;
+
+ @FieldOrder(order = 12)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long validUntilDay;
+
+ @FieldOrder(order = 13)
+ @IntRange(minValue=0,maxValue=1439)
+ @Asn1Optional public Long validUntilTime;
+
+ @FieldOrder(order = 14)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validUntilUTCOffset;
+
+ @FieldOrder(order = 15)
+ @Asn1Optional public ValidityPeriodDetailType validityPeriodDetails;
+
+ @FieldOrder(order = 16)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long numberOfValidityDays;
+
+ @FieldOrder(order = 17)
+ @IntRange(minValue=1,maxValue=250)
+ @Asn1Optional public Long numberOfPossibleTrips;
+
+ @FieldOrder(order = 18)
+ @IntRange(minValue=1,maxValue=250)
+ @Asn1Optional public Long numberOfDaysOfTravel;
+
+ @FieldOrder(order = 19)
+ @Asn1Optional public SequenceOfActivatedDays activatedDay;
+
+ @FieldOrder(order = 20)
+ @Asn1Optional public SequenceOfCountries countries;
+
+ @FieldOrder(order = 21)
+ @Asn1Optional public SequenceOfCarrierNum includedCarriersNum;
+
+ @FieldOrder(order = 22)
+ @Asn1Optional public SequenceOfStringIA5 includedCarriersIA5;
+
+ @FieldOrder(order = 23)
+ @Asn1Optional public SequenceOfCarrierNum excludedCarriersNum;
+
+ @FieldOrder(order = 24)
+ @Asn1Optional public SequenceOfStringIA5 excludedCarriersIA5;
+
+ @FieldOrder(order = 25)
+ @Asn1Optional public SequenceOfServiceBrands includedServiceBrands;
+
+ @FieldOrder(order = 26)
+ @Asn1Optional public SequenceOfServiceBrands excludedServiceBrands;
+
+ @FieldOrder(order = 27)
+ @Asn1Optional public SequenceOfRegionalValidityType validRegion;
+
+ @FieldOrder(order = 28)
+ @Asn1Optional public SequenceOfTariffType tariffs;
+
+ @FieldOrder(order = 29)
+ @Asn1Optional Asn1BigInteger price;
+
+ @FieldOrder(order = 30)
+ @Asn1Optional SequenceOfVatDetail vatDetails;
+
+ @FieldOrder(order = 31)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String infoText;
+
+ @FieldOrder(order = 32)
+ @Asn1Optional public ExtensionData extension;
+
+
+
+
+
+ public Asn1BigInteger getReferenceNum() {
+
+ return this.referenceNum;
+ }
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+
+ return this.productIdIA5;
+ }
+
+ public Long getPassType() {
+
+ return this.passType;
+ }
+
+ public String getPassDescription() {
+
+ return this.passDescription;
+ }
+
+ public TravelClassType getClassCode() {
+
+ if (classCode == null){
+ return TravelClassType.second;
+ }
+
+ return this.classCode;
+ }
+
+ public Long getValidFromDay() {
+
+ return this.validFromDay;
+ }
+
+ public Long getValidFromTime() {
+
+ return this.validFromTime;
+ }
+
+ public Long getValidUntilDay() {
+
+ return this.validUntilDay;
+ }
+
+ public Long getValidUntilTime() {
+
+ return this.validUntilTime;
+ }
+
+ public ValidityPeriodDetailType getValidityPeriodDetails() {
+
+ return this.validityPeriodDetails;
+ }
+
+ public Long getNumberOfValidityDays() {
+
+ return this.numberOfValidityDays;
+ }
+
+ public Long getNumberOfPossibleTrips() {
+
+ return this.numberOfPossibleTrips;
+ }
+
+ public Long getNumberOfDaysOfTravel() {
+
+ return this.numberOfDaysOfTravel;
+ }
+
+ public List<Long> getActivatedDay() {
+
+ return this.activatedDay;
+ }
+
+ public List<Long> getCountries() {
+
+ return this.countries;
+ }
+
+ public List<Long> getIncludedCarriersNum() {
+
+ return this.includedCarriersNum;
+ }
+
+ public List<String> getIncludedCarriersIA5() {
+
+ return this.includedCarriersIA5;
+ }
+
+ public List<Long> getExcludedCarriersNum() {
+
+ return this.excludedCarriersNum;
+ }
+
+ public SequenceOfStringIA5 getExcludedCarriersIA5() {
+
+ return this.excludedCarriersIA5;
+ }
+
+ public SequenceOfServiceBrands getIncludedServiceBrands() {
+
+ return this.includedServiceBrands;
+ }
+
+ public SequenceOfServiceBrands getExcludedServiceBrands() {
+
+ return this.excludedServiceBrands;
+ }
+
+ public List<RegionalValidityType> getValidRegion() {
+
+ return this.validRegion;
+ }
+
+ public List<TariffType> getTariffs() {
+
+ return this.tariffs;
+ }
+
+ public String getInfoText() {
+
+ return this.infoText;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setReferenceNum(Asn1BigInteger referenceNum) {
+
+ this.referenceNum = referenceNum;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setPassType(Long passType) {
+
+ this.passType = passType;
+ }
+
+ public void setPassDescription(String passDescription) {
+
+ this.passDescription = passDescription;
+ }
+
+ public void setClassCode(TravelClassType classCode) {
+
+ this.classCode = classCode;
+ }
+
+ public void setValidFromDay(Long validFromDay) {
+
+ this.validFromDay = validFromDay;
+ }
+
+ public void setValidFromTime(Long validFromTime) {
+
+ this.validFromTime = validFromTime;
+ }
+
+ public void setValidUntilDay(Long validUntilDay) {
+
+ this.validUntilDay = validUntilDay;
+ }
+
+ public void setValidUntilTime(Long validUntilTime) {
+
+ this.validUntilTime = validUntilTime;
+ }
+
+ public void setValidityPeriodDetails(ValidityPeriodDetailType validityPeriodDetails) {
+
+ this.validityPeriodDetails = validityPeriodDetails;
+ }
+
+ public void setNumberOfValidityDays(Long numberOfValidityDays) {
+
+ this.numberOfValidityDays = numberOfValidityDays;
+ }
+
+ public void setNumberOfPossibleTrips(Long numberOfPossibleTrips) {
+
+ this.numberOfPossibleTrips = numberOfPossibleTrips;
+ }
+
+ public void setNumberOfDaysOfTravel(Long numberOfDaysOfTravel) {
+
+ this.numberOfDaysOfTravel = numberOfDaysOfTravel;
+ }
+
+ public void setActivatedDay(SequenceOfActivatedDays activatedDay) {
+
+ this.activatedDay = activatedDay;
+ }
+
+ public void setCountries(SequenceOfCountries countries) {
+
+ this.countries = countries;
+ }
+
+ public void setIncludedCarriersNum(SequenceOfCarrierNum includedCarriersNum) {
+
+ this.includedCarriersNum = includedCarriersNum;
+ }
+
+ public void setIncludedCarriersIA5(SequenceOfStringIA5 includedCarriersIA5) {
+
+ this.includedCarriersIA5 = includedCarriersIA5;
+ }
+
+ public void setExcludedCarriersNum(SequenceOfCarrierNum excludedCarriersNum) {
+
+ this.excludedCarriersNum = excludedCarriersNum;
+ }
+
+ public void setExcludedCarriersIA5(SequenceOfStringIA5 excludedCarriersIA5) {
+
+ this.excludedCarriersIA5 = excludedCarriersIA5;
+ }
+
+ public void setIncludedServiceBrands(SequenceOfServiceBrands includedServiceBrands) {
+
+ this.includedServiceBrands = includedServiceBrands;
+ }
+
+ public void setExcludedServiceBrands(SequenceOfServiceBrands excludedServiceBrands) {
+
+ this.excludedServiceBrands = excludedServiceBrands;
+ }
+
+ public void setValidRegion(SequenceOfRegionalValidityType validRegion) {
+
+ this.validRegion = validRegion;
+ }
+
+ public void setTariffs(SequenceOfTariffType tariffs) {
+
+ this.tariffs = tariffs;
+ }
+
+ public void setInfoText(String infoText) {
+
+ this.infoText = infoText;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public Long getPrice() {
+ return Asn1BigInteger.toLong(price);
+ }
+
+ public void setPrice(Long price) {
+ this.price = Asn1BigInteger.toAsn1(price);
+ }
+
+ public SequenceOfVatDetail getVatDetails() {
+ return vatDetails;
+ }
+
+ public void setVatDetails(SequenceOfVatDetail vatDetails) {
+ this.vatDetails = vatDetails;
+ }
+
+ public void addVatDetail(VatDetailType vatDetail) {
+ if (this.vatDetails == null) {
+ this.vatDetails = new SequenceOfVatDetail();
+ }
+ this.vatDetails.add(vatDetail);
+ }
+
+ public void setValidityDates (Date fromDate, Date untilDate, Date issuingDate){
+
+ if (issuingDate == null || fromDate == null) return;
+
+ this.validFromDay = DateTimeUtils.getDateDifference(issuingDate,fromDate);
+ this.validFromTime = DateTimeUtils.getTime(fromDate);
+
+ if (untilDate != null){
+ this.validUntilDay = DateTimeUtils.getDateDifference(fromDate, untilDate);
+ this.validUntilTime = DateTimeUtils.getTime(untilDate);
+ }
+
+ }
+
+ public Date getValidFromDate(Date issuingDate){
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay, this.validFromTime);
+
+ }
+
+ public Date getValidUntilDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validUntilDay == null) {
+ return null;
+ }
+
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime);
+
+ }
+
+ public void setActivatedDays(Collection<Date> dates, Date issuingDate){
+
+ if (this.activatedDay != null) {
+ this.activatedDay.clear();
+ } else {
+ this.activatedDay= new SequenceOfActivatedDays();
+ }
+
+ if (dates != null && !dates.isEmpty()) {
+
+ for (Date day : dates) {
+ this.addActivatedDay(issuingDate, day);
+ }
+
+ }
+
+ }
+
+ public void addActivatedDay(Date issuingDate, Date day){
+
+ Long dayDiff = DateTimeUtils.getDateDifference(issuingDate, day);
+
+ if (this.activatedDay == null) {
+ this.activatedDay = new SequenceOfActivatedDays();
+ }
+
+ if (dayDiff != null) {
+ this.activatedDay.add(dayDiff);
+ }
+
+ }
+
+ public Collection<Date> getActivatedDays(Date issuingDate) {
+
+ if (this.activatedDay == null) return null;
+
+ ArrayList<Date> dates = new ArrayList<Date>();
+
+ for (Long diff: this.getActivatedDay()) {
+
+ Date day = DateTimeUtils.getDate(issuingDate, diff, null);
+
+ if (day != null) {
+ dates.add(day);
+ }
+
+ }
+
+ return dates;
+
+ }
+
+ public Long getValidFromUTCOffset() {
+ return validFromUTCOffset;
+ }
+
+ public void setValidFromUTCOffset(Long validFromUTCOffset) {
+ this.validFromUTCOffset = validFromUTCOffset;
+ }
+
+ public Long getValidUntilUTCOffset() {
+ return validUntilUTCOffset;
+ }
+
+ public void setValidUntilUTCOffset(Long validUntilUTCOffset) {
+ this.validUntilUTCOffset = validUntilUTCOffset;
+ }
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/PassengerType.java b/src/org/uic/barcode/ticket/api/asn/omv2/PassengerType.java new file mode 100644 index 0000000..daaba40 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/PassengerType.java @@ -0,0 +1,46 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum PassengerType {
+ adult("adult"),
+ senior("senior"),
+ child("child"),
+ youth("youth"),
+ dog("dog"),
+ bicycle("bicycle"),
+ freeAddonPassenger("freeAddonPassenger"),
+ freeAddonChild("freeAddonChild");
+
+ public String text;
+
+ PassengerType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/PlacesType.java b/src/org/uic/barcode/ticket/api/asn/omv2/PlacesType.java new file mode 100644 index 0000000..1204ea6 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/PlacesType.java @@ -0,0 +1,131 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+
+@Sequence
+public class PlacesType extends Object {
+ public PlacesType() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String coach;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String placeString;
+
+ @FieldOrder(order = 2)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String placeDescription;
+
+ @FieldOrder(order = 3)
+ @Asn1Optional public SequenceOfStringIA5 placeIA5;
+
+ @FieldOrder(order = 4)
+ @Asn1Optional public SequenceOfPlaceNum placeNum;
+
+
+
+ public String getCoach() {
+
+ return this.coach;
+ }
+
+ public String getPlaceString() {
+
+ return this.placeString;
+ }
+
+ public String getPlaceDescription() {
+
+ return this.placeDescription;
+ }
+
+ public SequenceOfStringIA5 getPlaceIA5() {
+
+ return this.placeIA5;
+ }
+
+ public SequenceOfPlaceNum getPlaceNum() {
+
+ return this.placeNum;
+ }
+
+ public void setCoach(String coach) {
+
+ this.coach = coach;
+ }
+
+ public void setPlaceString(String placeString) {
+
+ this.placeString = placeString;
+ }
+
+ public void setPlaceDescription(String placeDescription) {
+
+ this.placeDescription = placeDescription;
+ }
+
+ public void setPlaceIA5(SequenceOfStringIA5 placeIA5) {
+
+ this.placeIA5 = placeIA5;
+ }
+
+ public void setPlaceNum(SequenceOfPlaceNum placeNum) {
+
+ this.placeNum = placeNum;
+ }
+
+ @Override
+ public boolean equals(Object anObject) {
+ if (this == anObject) return true;
+ if ((anObject == null) || (anObject.getClass() != this.getClass())) return false;
+
+ PlacesType comparator = (PlacesType)anObject;
+
+ if ((this.getCoach() != comparator.getCoach()) && ((this.getCoach() == null) || (! this.getCoach().equals(comparator.getCoach())))) return false;
+ if ((this.getPlaceString() != comparator.getPlaceString()) && ((this.getPlaceString() == null) || (! this.getPlaceString().equals(comparator.getPlaceString())))) return false;
+ if ((this.getPlaceDescription() != comparator.getPlaceDescription()) && ((this.getPlaceDescription() == null) || (! this.getPlaceDescription().equals(comparator.getPlaceDescription())))) return false;
+ if ((this.getPlaceIA5() != comparator.getPlaceIA5()) && ((this.getPlaceIA5() == null) || (! this.getPlaceIA5().equals(comparator.getPlaceIA5())))) return false;
+ if ((this.getPlaceNum() != comparator.getPlaceNum()) && ((this.getPlaceNum() == null) || (! this.getPlaceNum().equals(comparator.getPlaceNum())))) return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 5477;
+
+ hash = 3547 * hash + (null == this.getCoach() ? 0 : this.getCoach().hashCode());
+ hash = 7321 * hash + (null == this.getPlaceString() ? 0 : this.getPlaceString().hashCode());
+ hash = 2083 * hash + (null == this.getPlaceDescription() ? 0 : this.getPlaceDescription().hashCode());
+ hash = 881 * hash + (null == this.getPlaceIA5() ? 0 : this.getPlaceIA5().hashCode());
+ hash = 6679 * hash + (null == this.getPlaceNum() ? 0 : this.getPlaceNum().hashCode());
+ return hash;
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/PolygoneType.java b/src/org/uic/barcode/ticket/api/asn/omv2/PolygoneType.java new file mode 100644 index 0000000..a936ee6 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/PolygoneType.java @@ -0,0 +1,58 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+public class PolygoneType extends Object {
+ public PolygoneType() {
+ }
+
+ @FieldOrder(order = 0)
+ public GeoCoordinateType firstEdge;
+
+ @FieldOrder(order = 1)
+ public SequenceOfDeltaCoordinates edges;
+
+
+ public GeoCoordinateType getFirstEdge() {
+
+ return this.firstEdge;
+ }
+
+ public SequenceOfDeltaCoordinates getEdges() {
+
+ return this.edges;
+ }
+
+ public void setFirstEdge(GeoCoordinateType firstEdge) {
+
+ this.firstEdge = firstEdge;
+ }
+
+ public void setEdges(SequenceOfDeltaCoordinates edges) {
+
+ this.edges = edges;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/PriceTypeType.java b/src/org/uic/barcode/ticket/api/asn/omv2/PriceTypeType.java new file mode 100644 index 0000000..4e849bc --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/PriceTypeType.java @@ -0,0 +1,39 @@ +/*
+ * 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.asn.omv2;
+
+public enum PriceTypeType {
+ noPrice("noPrice"),
+ reservationFee("reservationFee"),
+ supplement("supplement"),
+ travelPrice("travelPrice");
+
+
+ public String text;
+
+ PriceTypeType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/RegionalValidityType.java b/src/org/uic/barcode/ticket/api/asn/omv2/RegionalValidityType.java new file mode 100644 index 0000000..fbae3b1 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/RegionalValidityType.java @@ -0,0 +1,100 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.Choice;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+
+@Choice
+@HasExtensionMarker
+public class RegionalValidityType extends Object {
+ public RegionalValidityType() {
+ }
+
+ @FieldOrder(order = 0)
+ public TrainLinkType trainLink;
+
+ @FieldOrder(order = 1)
+ public ViaStationType viaStations;
+
+ @FieldOrder(order = 2)
+ public ZoneType zones;
+
+ @FieldOrder(order = 3)
+ public LineType lines;
+
+ @FieldOrder(order = 4)
+ public PolygoneType polygone;
+
+
+ public TrainLinkType getTrainLink() {
+
+ return this.trainLink;
+ }
+
+ public ViaStationType getViaStations() {
+
+ return this.viaStations;
+ }
+
+ public ZoneType getZones() {
+
+ return this.zones;
+ }
+
+ public LineType getLines() {
+
+ return this.lines;
+ }
+
+ public PolygoneType getPolygone() {
+
+ return this.polygone;
+ }
+
+ public void setTrainLink(TrainLinkType trainLink) {
+
+ this.trainLink = trainLink;
+ }
+
+ public void setViaStations(ViaStationType viaStations) {
+
+ this.viaStations = viaStations;
+ }
+
+ public void setZones(ZoneType zones) {
+
+ this.zones = zones;
+ }
+
+ public void setLines(LineType lines) {
+
+ this.lines = lines;
+ }
+
+ public void setPolygone(PolygoneType polygone) {
+
+ this.polygone = polygone;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/RegisteredLuggageType.java b/src/org/uic/barcode/ticket/api/asn/omv2/RegisteredLuggageType.java new file mode 100644 index 0000000..a9d053a --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/RegisteredLuggageType.java @@ -0,0 +1,80 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+
+@Sequence
+@HasExtensionMarker
+public class RegisteredLuggageType extends Object {
+ public RegisteredLuggageType() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String registrationId;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue=1,maxValue=99)
+ @Asn1Optional public Long maxWeight;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=300)
+ @Asn1Optional public Long maxSize;
+
+ public String getRegistrationId() {
+
+ return this.registrationId;
+ }
+
+ public Long getMaxWeight() {
+
+ return this.maxWeight;
+ }
+
+ public Long getMaxSize() {
+
+ return this.maxSize;
+ }
+
+ public void setRegistrationId(String registrationId) {
+
+ this.registrationId = registrationId;
+ }
+
+ public void setMaxWeight(Long maxWeight) {
+
+ this.maxWeight = maxWeight;
+ }
+
+ public void setMaxSize(Long maxSize) {
+
+ this.maxSize = maxSize;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/ReservationData.java b/src/org/uic/barcode/ticket/api/asn/omv2/ReservationData.java new file mode 100644 index 0000000..a474e7d --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/ReservationData.java @@ -0,0 +1,710 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.Date;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypes.SizeRange;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+
+@Sequence
+@HasExtensionMarker
+public class ReservationData extends Object {
+ public ReservationData() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public Asn1BigInteger trainNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String trainIA5;
+
+ @FieldOrder(order = 2)
+ @Asn1Default(value="0")
+ @IntRange(minValue=-1,maxValue=370)
+ @Asn1Optional public Long departureDate;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 4)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 5)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 6)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 7)
+ @IntRange(minValue=0,maxValue=65535)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 8)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 9)
+ @IntRange(minValue=0,maxValue=32000)
+ @Asn1Optional public Long serviceBrand;
+
+ @FieldOrder(order = 10)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String serviceBrandAbrUTF8;
+
+ @FieldOrder(order = 11)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String serviceBrandNameUTF8;
+
+ @FieldOrder(order = 12)
+ @Asn1Default("seat")
+ @Asn1Optional public ServiceType service;
+
+ @FieldOrder(order = 13)
+ @Asn1Default("stationUICReservation")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 14)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long fromStationNum;
+
+ @FieldOrder(order = 15)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String fromStationIA5;
+
+ @FieldOrder(order = 16)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long toStationNum;
+
+ @FieldOrder(order = 17)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String toStationIA5;
+
+ @FieldOrder(order = 18)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String fromStationNameUTF8;
+
+ @FieldOrder(order = 19)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String toStationNameUTF8;
+
+ @FieldOrder(order = 20)
+ @IntRange(minValue=0,maxValue=1440)
+ public Long departureTime;
+
+ @FieldOrder(order = 21)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long departureUTCOffset;
+
+ @FieldOrder(order = 22)
+ @IntRange(minValue=-1,maxValue=20)
+ @Asn1Default(value="0")
+ @Asn1Optional public Long arrivalDate;
+
+ @FieldOrder(order = 23)
+ @IntRange(minValue=0,maxValue=1439)
+ @Asn1Optional public Long arrivalTime;
+
+ @FieldOrder(order = 24)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long arrivalUTCOffset;
+
+ @FieldOrder(order = 25)
+ @Asn1Optional public SequenceOfCarrierNum carrierNum;
+
+ @FieldOrder(order = 26)
+ @Asn1Optional public SequenceOfStringIA5 carrierIA5;
+
+ @FieldOrder(order = 27)
+ @Asn1Default("second")
+ @Asn1Optional public TravelClassType classCode;
+
+ @FieldOrder(order = 28)
+ @SizeRange(minValue = 1, maxValue = 2)
+ @Asn1Optional public String serviceLevel;
+
+ @FieldOrder(order = 29)
+ @Asn1Optional public PlacesType places;
+
+ @FieldOrder(order = 30)
+ @Asn1Optional public PlacesType additionalPlaces;
+
+ @FieldOrder(order = 31)
+ @Asn1Optional public PlacesType bicyclePlaces;
+
+ @FieldOrder(order = 32)
+ @Asn1Optional public CompartmentDetailsType compartmentDetails;
+
+ @FieldOrder(order = 33)
+ @IntRange(minValue=0,maxValue=200)
+ @Asn1Default(value="0")
+ @Asn1Optional public Long numberOfOverbooked;
+
+ @FieldOrder(order = 34)
+ @Asn1Optional public SequenceOfBerthDetailData berth;
+
+ @FieldOrder(order = 35)
+ @Asn1Optional public SequenceOfTariffType tariff;
+
+ @FieldOrder(order = 36)
+ @Asn1Default("travelPrice")
+ @Asn1Optional public PriceTypeType priceType;
+
+ @FieldOrder(order = 37)
+ @Asn1Optional Asn1BigInteger price;
+
+ @FieldOrder(order = 38)
+ @Asn1Optional SequenceOfVatDetail vatDetails;
+
+ @FieldOrder(order = 39)
+ @IntRange(minValue=0,maxValue=9)
+ @Asn1Default("0")
+ @Asn1Optional public Long typeOfSupplement;
+
+ @FieldOrder(order = 40)
+ @IntRange(minValue=0,maxValue=200)
+ @Asn1Default("0")
+ @Asn1Optional public Long numberOfSupplements;
+
+ @FieldOrder(order = 41)
+ @Asn1Optional public LuggageRestrictionType luggage;
+
+ @FieldOrder(order = 42)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String infoText;
+
+ @FieldOrder(order = 43)
+ @Asn1Optional public ExtensionData extension;
+
+ public Long getTrainNum() {
+
+ return Asn1BigInteger.toLong(this.trainNum);
+ }
+
+ public String getTrainIA5() {
+ return this.trainIA5;
+ }
+
+ public Long getDepartureDate() {
+ return this.departureDate;
+ }
+
+ public String getReferenceIA5() {
+ return this.referenceIA5;
+ }
+
+ public Long getReferenceNum() {
+ return Asn1BigInteger.toLong(this.referenceNum);
+ }
+
+ public Long getProductOwnerNum() {
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+ return this.productIdIA5;
+ }
+
+ public Long getServiceBrand() {
+ return this.serviceBrand;
+ }
+
+ public String getServiceBrandAbrUTF8() {
+ return this.serviceBrandAbrUTF8;
+ }
+
+ public String getServiceBrandNameUTF8() {
+ return this.serviceBrandNameUTF8;
+ }
+
+ public ServiceType getService() {
+
+ if (service == null){
+ return ServiceType.seat;
+ }
+
+ return this.service;
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUICReservation;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public Long getFromStationNum() {
+
+ return this.fromStationNum;
+ }
+
+ public String getFromStationIA5() {
+
+ return this.fromStationIA5;
+ }
+
+ public Long getToStationNum() {
+
+ return this.toStationNum;
+ }
+
+ public String getToStationIA5() {
+
+ return this.toStationIA5;
+ }
+
+ public String getFromStationNameUTF8() {
+
+ return this.fromStationNameUTF8;
+ }
+
+ public String getToStationNameUTF8() {
+
+ return this.toStationNameUTF8;
+ }
+
+ public Long getDepartureTime() {
+
+ return this.departureTime;
+ }
+
+ public Long getArrivalDate() {
+
+ if (arrivalDate == null) {
+ return new Long(0);
+ }
+
+ return this.arrivalDate;
+ }
+
+ public Long getArrivalTime() {
+
+ return this.arrivalTime;
+ }
+
+ public List<Long> getCarrierNum() {
+
+ return this.carrierNum;
+ }
+
+ public List<String> getCarrierIA5() {
+
+ return this.carrierIA5;
+ }
+
+ public TravelClassType getClassCode() {
+
+
+ if (classCode == null) {
+ return TravelClassType.second;
+ }
+
+ return this.classCode;
+ }
+
+ public String getServiceLevel() {
+
+ return this.serviceLevel;
+ }
+
+ public PlacesType getPlaces() {
+
+ return this.places;
+ }
+
+ public PlacesType getAdditionalPlaces() {
+
+ return this.additionalPlaces;
+ }
+
+ public PlacesType getBicyclePlaces() {
+
+ return this.bicyclePlaces;
+ }
+
+ public CompartmentDetailsType getCompartmentDetails() {
+
+ return this.compartmentDetails;
+ }
+
+ public Long getNumberOfOverbooked() {
+
+ return this.numberOfOverbooked;
+ }
+
+ public List<BerthDetailData> getBerth() {
+
+ return this.berth;
+ }
+
+ public List<TariffType> getTariff() {
+
+ return this.tariff;
+ }
+
+ public PriceTypeType getPriceType() {
+
+ if (priceType == null) {
+ return PriceTypeType.travelPrice;
+ }
+
+ return this.priceType;
+ }
+
+ public Long getTypeOfSupplement() {
+
+ if (typeOfSupplement == null){
+ return new Long(0);
+ }
+
+
+ return this.typeOfSupplement;
+ }
+
+ public Long getNumberOfSupplements() {
+
+ if (numberOfSupplements == null) {
+ return new Long(0);
+ }
+
+ return this.numberOfSupplements;
+ }
+
+ public LuggageRestrictionType getLuggage() {
+
+ return this.luggage;
+ }
+
+ public String getInfoText() {
+
+ return this.infoText;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setTrainNum(Long trainNum) {
+
+ this.trainNum = Asn1BigInteger.toAsn1(trainNum);
+ }
+
+ public void setTrainIA5(String trainIA5) {
+
+ this.trainIA5 = trainIA5;
+ }
+
+ public void setDepartureDate(Long departureDate) {
+
+ this.departureDate = departureDate;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setReferenceNum(Long referenceNum) {
+ this.referenceNum = Asn1BigInteger.toAsn1(referenceNum);
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setServiceBrand(Long serviceBrand) {
+
+ this.serviceBrand = serviceBrand;
+ }
+
+ public void setServiceBrandAbrUTF8(String serviceBrandAbrUTF8) {
+
+ this.serviceBrandAbrUTF8 = serviceBrandAbrUTF8;
+ }
+
+ public void setServiceBrandNameUTF8(String serviceBrandNameUTF8) {
+
+ this.serviceBrandNameUTF8 = serviceBrandNameUTF8;
+ }
+
+ public void setService(ServiceType service) {
+
+ this.service = service;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setFromStationNum(Long fromStationNum) {
+
+ this.fromStationNum = fromStationNum;
+ }
+
+ public void setFromStationIA5(String fromStationIA5) {
+
+ this.fromStationIA5 = fromStationIA5;
+ }
+
+ public void setToStationNum(Long toStationNum) {
+
+ this.toStationNum = toStationNum;
+ }
+
+ public void setToStationIA5(String toStationIA5) {
+
+ this.toStationIA5 = toStationIA5;
+ }
+
+ public void setFromStationNameUTF8(String fromStationNameUTF8) {
+
+ this.fromStationNameUTF8 = fromStationNameUTF8;
+ }
+
+ public void setToStationNameUTF8(String toStationNameUTF8) {
+
+ this.toStationNameUTF8 = toStationNameUTF8;
+ }
+
+ public void setDepartureTime(Long departureTime) {
+
+ this.departureTime = departureTime;
+ }
+
+ public void setArrivalDate(Long arrivalDate) {
+
+ this.arrivalDate = arrivalDate;
+ }
+
+ public void setArrivalTime(Long arrivalTime) {
+
+ this.arrivalTime = arrivalTime;
+ }
+
+ public void setCarrierNum(SequenceOfCarrierNum carrierNum) {
+
+ this.carrierNum = carrierNum;
+ }
+
+ public void setCarriersNum(List<Long> longs) {
+ if (longs == null) return;
+
+ this.carrierNum = new SequenceOfCarrierNum();
+ this.carrierNum.addAll(longs);
+ }
+
+ public void setCarrierIA5(SequenceOfStringIA5 carrierIA5) {
+
+ this.carrierIA5 = carrierIA5;
+ }
+
+ public void setClassCode(TravelClassType classCode) {
+
+ this.classCode = classCode;
+ }
+
+ public void setServiceLevel(String serviceLevel) {
+
+ this.serviceLevel = serviceLevel;
+ }
+
+ public void setPlaces(PlacesType places) {
+
+ this.places = places;
+ }
+
+ public void setAdditionalPlaces(PlacesType additionalPlaces) {
+
+ this.additionalPlaces = additionalPlaces;
+ }
+
+ public void setBicyclePlaces(PlacesType bicyclePlaces) {
+
+ this.bicyclePlaces = bicyclePlaces;
+ }
+
+ public void setCompartmentDetails(CompartmentDetailsType compartmentDetails) {
+
+ this.compartmentDetails = compartmentDetails;
+ }
+
+ public void setNumberOfOverbooked(Long numberOfOverbooked) {
+
+ this.numberOfOverbooked = numberOfOverbooked;
+ }
+
+ public void setBerth(SequenceOfBerthDetailData berth) {
+
+ this.berth = berth;
+ }
+
+ public void setTariff(SequenceOfTariffType tariff) {
+
+ this.tariff = tariff;
+ }
+
+ public void setPriceType(PriceTypeType priceType) {
+
+ this.priceType = priceType;
+ }
+
+ public void setTypeOfSupplement(Long typeOfSupplement) {
+
+ this.typeOfSupplement = typeOfSupplement;
+ }
+
+ public void setNumberOfSupplements(Long numberOfSupplements) {
+
+ this.numberOfSupplements = numberOfSupplements;
+ }
+
+ public void setLuggage(LuggageRestrictionType luggage) {
+
+ this.luggage = luggage;
+ }
+
+ public void setInfoText(String infoText) {
+
+ this.infoText = infoText;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public Long getPrice() {
+ return Asn1BigInteger.toLong(price);
+ }
+
+ public void setPrice(Long price) {
+ this.price = Asn1BigInteger.toAsn1(price);
+ }
+
+ public SequenceOfVatDetail getVatDetails() {
+ return vatDetails;
+ }
+
+ public void setVatDetails(SequenceOfVatDetail vatDetails) {
+ this.vatDetails = vatDetails;
+ }
+
+ public void addVatDetail(VatDetailType vatDetail) {
+ if (this.vatDetails == null) {
+ this.vatDetails = new SequenceOfVatDetail();
+ }
+ this.vatDetails.add(vatDetail);
+ }
+
+ public void setDepartureArrivalDates (Date departure, Date arrival, Date issuingDate){
+
+ if (issuingDate == null || departure == null) return;
+
+ this.departureDate = DateTimeUtils.getDateDifference(issuingDate,departure);
+ this.departureTime = DateTimeUtils.getTime(departure);
+
+ if (arrival != null){
+ this.arrivalDate = DateTimeUtils.getDateDifference(departure, arrival);
+ this.arrivalTime = DateTimeUtils.getTime(arrival);
+ }
+
+ }
+
+ public Date getDepartureDate(Date issuingDate){
+
+ return DateTimeUtils.getDate(issuingDate, this.departureDate, this.departureTime);
+
+ }
+
+ public Date getArrivalDate(Date issuingDate){
+
+ if (this.departureDate == null) {
+ this.departureDate = 0L;
+ }
+
+ if (this.arrivalDate == null) {
+ return null;
+ }
+
+ return DateTimeUtils.getDate(issuingDate, this.departureDate + this.arrivalDate, this.arrivalTime);
+ }
+
+ public Long getDepartureUTCOffset() {
+ return departureUTCOffset;
+ }
+
+ public void setDepartureUTCOffset(Long departureUTCOffset) {
+ this.departureUTCOffset = departureUTCOffset;
+ }
+
+ public Long getArrivalUTCOffset() {
+ return arrivalUTCOffset;
+ }
+
+ public void setArrivalUTCOffset(Long arrivalUTCOffset) {
+ this.arrivalUTCOffset = arrivalUTCOffset;
+ }
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/ReturnRouteDescriptionType.java b/src/org/uic/barcode/ticket/api/asn/omv2/ReturnRouteDescriptionType.java new file mode 100644 index 0000000..5334b27 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/ReturnRouteDescriptionType.java @@ -0,0 +1,150 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+@HasExtensionMarker
+public class ReturnRouteDescriptionType extends Object {
+ public ReturnRouteDescriptionType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long fromStationNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String fromStationIA5;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long toStationNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String toStationIA5;
+
+ @FieldOrder(order = 4)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String fromStationNameUTF8;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String toStationNameUTF8;
+
+ @FieldOrder(order = 6)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String validReturnRegionDesc;
+
+ @FieldOrder(order = 7)
+ @Asn1Optional public SequenceOfRegionalValidityType validReturnRegion;
+
+ public Long getFromStationNum() {
+
+ return this.fromStationNum;
+ }
+
+ public String getFromStationIA5() {
+
+ return this.fromStationIA5;
+ }
+
+ public Long getToStationNum() {
+
+ return this.toStationNum;
+ }
+
+ public String getToStationIA5() {
+
+ return this.toStationIA5;
+ }
+
+ public String getFromStationNameUTF8() {
+
+ return this.fromStationNameUTF8;
+ }
+
+ public String getToStationNameUTF8() {
+
+ return this.toStationNameUTF8;
+ }
+
+ public String getValidReturnRegionDesc() {
+
+ return this.validReturnRegionDesc;
+ }
+
+ public List<RegionalValidityType> getValidReturnRegion() {
+
+ return this.validReturnRegion;
+ }
+
+ public void setFromStationNum(Long fromStationNum) {
+
+ this.fromStationNum = fromStationNum;
+ }
+
+ public void setFromStationIA5(String fromStationIA5) {
+
+ this.fromStationIA5 = fromStationIA5;
+ }
+
+ public void setToStationNum(Long toStationNum) {
+
+ this.toStationNum = toStationNum;
+ }
+
+ public void setToStationIA5(String toStationIA5) {
+
+ this.toStationIA5 = toStationIA5;
+ }
+
+ public void setFromStationNameUTF8(String fromStationNameUTF8) {
+
+ this.fromStationNameUTF8 = fromStationNameUTF8;
+ }
+
+ public void setToStationNameUTF8(String toStationNameUTF8) {
+
+ this.toStationNameUTF8 = toStationNameUTF8;
+ }
+
+ public void setValidReturnRegionDesc(String validReturnRegionDesc) {
+
+ this.validReturnRegionDesc = validReturnRegionDesc;
+ }
+
+ public void setValidReturnRegion(SequenceOfRegionalValidityType validReturnRegion) {
+
+ this.validReturnRegion = validReturnRegion;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/RoofRackType.java b/src/org/uic/barcode/ticket/api/asn/omv2/RoofRackType.java new file mode 100644 index 0000000..c05e917 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/RoofRackType.java @@ -0,0 +1,46 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum RoofRackType {
+ norack("norack"),
+ roofRailing("roofRailing"),
+ luggageRack("luggageRack"),
+ skiRack("skiRack"),
+ boxRack("boxRack"),
+ rackWithOneBox("rackWithOneBox"),
+ rackWithTwoBoxes("rackWithTwoBoxes"),
+ bicycleRack("bicycleRack"),
+ otherRack("otherRack");
+
+ public String text;
+
+ RoofRackType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/RouteSectionType.java b/src/org/uic/barcode/ticket/api/asn/omv2/RouteSectionType.java new file mode 100644 index 0000000..e0f9c46 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/RouteSectionType.java @@ -0,0 +1,136 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.IntRange;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+
+public class RouteSectionType extends Object {
+ public RouteSectionType() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Default("stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long fromStationNum;
+
+ @FieldOrder(order = 2)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String fromStationIA5;
+
+ @FieldOrder(order = 3)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long toStationNum;
+
+ @FieldOrder(order = 4)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String toStationIA5;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String fromStationNameUTF8;
+
+ @FieldOrder(order = 6)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String toStationNameUTF8;
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUIC;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public Long getFromStationNum() {
+
+ return this.fromStationNum;
+ }
+
+ public String getFromStationIA5() {
+
+ return this.fromStationIA5;
+ }
+
+ public Long getToStationNum() {
+
+ return this.toStationNum;
+ }
+
+ public String getToStationIA5() {
+
+ return this.toStationIA5;
+ }
+
+ public String getFromStationNameUTF8() {
+
+ return this.fromStationNameUTF8;
+ }
+
+ public String getToStationNameUTF8() {
+
+ return this.toStationNameUTF8;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setFromStationNum(Long fromStationNum) {
+
+ this.fromStationNum = fromStationNum;
+ }
+
+ public void setFromStationIA5(String fromStationIA5) {
+
+ this.fromStationIA5 = fromStationIA5;
+ }
+
+ public void setToStationNum(Long toStationNum) {
+
+ this.toStationNum = toStationNum;
+ }
+
+ public void setToStationIA5(String toStationIA5) {
+
+ this.toStationIA5 = toStationIA5;
+ }
+
+ public void setFromStationNameUTF8(String fromStationNameUTF8) {
+
+ this.fromStationNameUTF8 = fromStationNameUTF8;
+ }
+
+ public void setToStationNameUTF8(String toStationNameUTF8) {
+
+ this.toStationNameUTF8 = toStationNameUTF8;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfActivatedDays.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfActivatedDays.java new file mode 100644 index 0000000..776c774 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfActivatedDays.java @@ -0,0 +1,26 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.IntRange;
+
+@IntRange(minValue=0,maxValue=370)
+public class SequenceOfActivatedDays extends Asn1SequenceOf<Long> {
+ public SequenceOfActivatedDays() { super(); }
+ public SequenceOfActivatedDays(Collection<Long> coll) { super(coll); }
+
+ public SequenceOfActivatedDays(List<Long> numbers) {
+ super();
+ for (Long number: numbers){
+ this.add(new Long(number));
+ }
+ }
+
+ public static SequenceOfActivatedDays getSequence(List<Long> numList) {
+ if (numList == null || numList.isEmpty()) return null;
+ return new SequenceOfActivatedDays(numList);
+ }
+
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfBerthDetailData.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfBerthDetailData.java new file mode 100644 index 0000000..38482f4 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfBerthDetailData.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfBerthDetailData extends Asn1SequenceOf<BerthDetailData> {
+ public SequenceOfBerthDetailData() { super(); }
+ public SequenceOfBerthDetailData(Collection<BerthDetailData> coll) { super(coll); }
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCardReferenceType.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCardReferenceType.java new file mode 100644 index 0000000..4e602bb --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCardReferenceType.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfCardReferenceType extends Asn1SequenceOf<CardReferenceType> {
+ public SequenceOfCardReferenceType() { super(); }
+ public SequenceOfCardReferenceType(Collection<CardReferenceType> coll) { super(coll); }
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCarrierIA5.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCarrierIA5.java new file mode 100644 index 0000000..c06d78d --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCarrierIA5.java @@ -0,0 +1,13 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+
+@RestrictedString(CharacterRestriction.IA5String)
+public class SequenceOfCarrierIA5 extends Asn1SequenceOf<String> {
+ public SequenceOfCarrierIA5() { super(); }
+ public SequenceOfCarrierIA5(Collection<String> coll) { super(coll); }
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCarrierNum.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCarrierNum.java new file mode 100644 index 0000000..53417c2 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCarrierNum.java @@ -0,0 +1,28 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.IntRange;
+
+@IntRange(minValue=1,maxValue=32000)
+public class SequenceOfCarrierNum extends Asn1SequenceOf<Long> {
+ public SequenceOfCarrierNum() { super(); }
+ public SequenceOfCarrierNum(Collection<Long> coll) { super(coll); }
+
+
+ public SequenceOfCarrierNum(List<Long> numbers) {
+ super();
+ for (Long number: numbers){
+ this.add(new Long(number));
+ }
+ }
+ public static SequenceOfCarrierNum getSequence(List<Long> numList) {
+ if (numList == null || numList.isEmpty()) return null;
+ return new SequenceOfCarrierNum(numList);
+ }
+
+
+
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCountries.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCountries.java new file mode 100644 index 0000000..2dca27a --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCountries.java @@ -0,0 +1,27 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.IntRange;
+
+@IntRange(minValue=1,maxValue=250)
+public class SequenceOfCountries extends Asn1SequenceOf<Long> {
+ public SequenceOfCountries() { super(); }
+ public SequenceOfCountries(Collection<Long> coll) { super(coll); }
+
+
+ public SequenceOfCountries(List<Long> numbers) {
+ super();
+ for (Long number: numbers){
+ this.add(new Long(number));
+ }
+ }
+
+ public static SequenceOfCountries getSequence(List<Long> numList) {
+ if (numList == null || numList.isEmpty()) return null;
+ return new SequenceOfCountries(numList);
+ }
+
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCustomerStatusType.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCustomerStatusType.java new file mode 100644 index 0000000..e660e0c --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfCustomerStatusType.java @@ -0,0 +1,11 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfCustomerStatusType extends Asn1SequenceOf<CustomerStatusType> {
+ public SequenceOfCustomerStatusType() { super(); }
+ public SequenceOfCustomerStatusType(Collection<CustomerStatusType> coll) { super(coll); }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfDeltaCoordinates.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfDeltaCoordinates.java new file mode 100644 index 0000000..66ff4b0 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfDeltaCoordinates.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfDeltaCoordinates extends Asn1SequenceOf<DeltaCoordinates> {
+ public SequenceOfDeltaCoordinates() { super(); }
+ public SequenceOfDeltaCoordinates(Collection<DeltaCoordinates> coll) { super(coll); }
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfDocumentData.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfDocumentData.java new file mode 100644 index 0000000..57b3ba7 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfDocumentData.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfDocumentData extends Asn1SequenceOf<DocumentData> {
+ public SequenceOfDocumentData() { super(); }
+ public SequenceOfDocumentData(Collection<DocumentData> coll) { super(coll); }
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfExtensionData.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfExtensionData.java new file mode 100644 index 0000000..6def741 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfExtensionData.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfExtensionData extends Asn1SequenceOf<ExtensionData> {
+ public SequenceOfExtensionData() { super(); }
+ public SequenceOfExtensionData(Collection<ExtensionData> coll) { super(coll); }
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfIncludedOpenTicketType.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfIncludedOpenTicketType.java new file mode 100644 index 0000000..ac0efff --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfIncludedOpenTicketType.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfIncludedOpenTicketType extends Asn1SequenceOf<IncludedOpenTicketType> {
+ public SequenceOfIncludedOpenTicketType() { super(); }
+ public SequenceOfIncludedOpenTicketType(Collection<IncludedOpenTicketType> coll) { super(coll); }
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfPlaceNum.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfPlaceNum.java new file mode 100644 index 0000000..3cc6471 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfPlaceNum.java @@ -0,0 +1,28 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.IntRange;
+
+@IntRange(minValue=1,maxValue=254)
+public class SequenceOfPlaceNum extends Asn1SequenceOf<Long> {
+ public SequenceOfPlaceNum() { super(); }
+ public SequenceOfPlaceNum(Collection<Long> coll) { super(coll); }
+
+
+
+ public SequenceOfPlaceNum(List<Long> numbers) {
+ super();
+ for (Long number: numbers){
+ this.add(new Long(number));
+ }
+ }
+
+ public static SequenceOfPlaceNum getSequence(List<Long> numList) {
+ if (numList == null || numList.isEmpty()) return null;
+ return new SequenceOfPlaceNum(numList);
+ }
+
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfRegionalValidityType.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfRegionalValidityType.java new file mode 100644 index 0000000..e261eb8 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfRegionalValidityType.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfRegionalValidityType extends Asn1SequenceOf<RegionalValidityType> {
+ public SequenceOfRegionalValidityType() { super(); }
+ public SequenceOfRegionalValidityType(Collection<RegionalValidityType> coll) { super(coll); }
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfRegisteredLuggageType.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfRegisteredLuggageType.java new file mode 100644 index 0000000..e8709ce --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfRegisteredLuggageType.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfRegisteredLuggageType extends Asn1SequenceOf<RegisteredLuggageType> {
+ public SequenceOfRegisteredLuggageType() { super(); }
+ public SequenceOfRegisteredLuggageType(Collection<RegisteredLuggageType> coll) { super(coll); }
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfServiceBrands.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfServiceBrands.java new file mode 100644 index 0000000..4eb829b --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfServiceBrands.java @@ -0,0 +1,26 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.IntRange;
+
+@IntRange(minValue=0,maxValue=32000)
+public class SequenceOfServiceBrands extends Asn1SequenceOf<Long> {
+ public SequenceOfServiceBrands() { super(); }
+ public SequenceOfServiceBrands(Collection<Long> coll) { super(coll); }
+
+
+ public SequenceOfServiceBrands(List<Long> numbers) {
+ super();
+ for (Long number: numbers){
+ this.add(new Long(number));
+ }
+ }
+
+ public static SequenceOfServiceBrands getSequence(List<Long> numList) {
+ if (numList == null || numList.isEmpty()) return null;
+ return new SequenceOfServiceBrands(numList);
+ }
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTariffType.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTariffType.java new file mode 100644 index 0000000..5c7b773 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTariffType.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfTariffType extends Asn1SequenceOf<TariffType> {
+ public SequenceOfTariffType() { super(); }
+ public SequenceOfTariffType(Collection<TariffType> coll) { super(coll); }
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTicketLinkType.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTicketLinkType.java new file mode 100644 index 0000000..52005b1 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTicketLinkType.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfTicketLinkType extends Asn1SequenceOf<TicketLinkType> {
+ public SequenceOfTicketLinkType() { super(); }
+ public SequenceOfTicketLinkType(Collection<TicketLinkType> coll) { super(coll); }
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTransportTypes.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTransportTypes.java new file mode 100644 index 0000000..b8e2b64 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTransportTypes.java @@ -0,0 +1,26 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.IntRange;
+
+@IntRange(minValue=0,maxValue=31)
+public class SequenceOfTransportTypes extends Asn1SequenceOf<Long> {
+ public SequenceOfTransportTypes() { super(); }
+ public SequenceOfTransportTypes(Collection<Long> coll) { super(coll); }
+
+
+ public SequenceOfTransportTypes(List<Long> numbers) {
+ super();
+ for (Long number: numbers){
+ this.add(new Long(number));
+ }
+ }
+
+ public static SequenceOfTransportTypes getSequence(List<Long> numList) {
+ if (numList == null || numList.isEmpty()) return null;
+ return new SequenceOfTransportTypes(numList);
+ }
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTravelerId.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTravelerId.java new file mode 100644 index 0000000..eb9c3e2 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTravelerId.java @@ -0,0 +1,26 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.IntRange;
+
+@IntRange(minValue=1,maxValue=254)
+public class SequenceOfTravelerId extends Asn1SequenceOf<Long> {
+ public SequenceOfTravelerId() { super(); }
+ public SequenceOfTravelerId(Collection<Long> coll) { super(coll); }
+
+ public SequenceOfTravelerId(List<Long> numbers) {
+ super();
+ for (Long number: numbers){
+ this.add(new Long(number));
+ }
+ }
+
+ public static SequenceOfTravelerId getSequence(List<Long> numList) {
+ if (numList == null || numList.isEmpty()) return null;
+ return new SequenceOfTravelerId(numList);
+ }
+
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTravelerType.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTravelerType.java new file mode 100644 index 0000000..e1fd312 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfTravelerType.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfTravelerType extends Asn1SequenceOf<TravelerType> {
+ public SequenceOfTravelerType() { super(); }
+ public SequenceOfTravelerType(Collection<TravelerType> coll) { super(coll); }
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfVatDetail.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfVatDetail.java new file mode 100644 index 0000000..3aae8e9 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfVatDetail.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfVatDetail extends Asn1SequenceOf<VatDetailType> {
+ public SequenceOfVatDetail() { super(); }
+ public SequenceOfVatDetail(Collection<VatDetailType> coll) { super(coll); }
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfViaStationType.java b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfViaStationType.java new file mode 100644 index 0000000..b5bb0aa --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SequenceOfViaStationType.java @@ -0,0 +1,10 @@ +package org.uic.barcode.ticket.api.asn.omv2;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+
+public class SequenceOfViaStationType extends Asn1SequenceOf<ViaStationType> {
+ public SequenceOfViaStationType() { super(); }
+ public SequenceOfViaStationType(Collection<ViaStationType> coll) { super(coll); }
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/SeriesDetailType.java b/src/org/uic/barcode/ticket/api/asn/omv2/SeriesDetailType.java new file mode 100644 index 0000000..d7477d1 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/SeriesDetailType.java @@ -0,0 +1,75 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.IntRange;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+public class SeriesDetailType extends Object {
+ public SeriesDetailType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long supplyingCarrier;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue=1,maxValue=99)
+ @Asn1Optional public Long offerIdentification;
+
+ @FieldOrder(order = 2)
+ @Asn1Optional public Asn1BigInteger series;
+
+
+ public Long getSupplyingCarrier() {
+
+ return this.supplyingCarrier;
+ }
+
+ public Long getOfferIdentification() {
+
+ return this.offerIdentification;
+ }
+
+ public Long getSeries() {
+
+ return Asn1BigInteger.toLong(this.series);
+ }
+
+ public void setSupplyingCarrier(Long supplyingCarrier) {
+
+ this.supplyingCarrier = supplyingCarrier;
+ }
+
+ public void setOfferIdentification(Long offerIdentification) {
+
+ this.offerIdentification = offerIdentification;
+ }
+
+ public void setSeries(Long series) {
+
+ this.series = Asn1BigInteger.toAsn1(series);
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/ServiceType.java b/src/org/uic/barcode/ticket/api/asn/omv2/ServiceType.java new file mode 100644 index 0000000..b13c094 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/ServiceType.java @@ -0,0 +1,38 @@ +/*
+ * 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.asn.omv2;
+
+public enum ServiceType {
+ seat("seat"),
+ couchette("couchette"),
+ berth("berth"),
+ carcarriage("carcarriage");
+
+ public String text;
+
+ ServiceType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/StationPassageData.java b/src/org/uic/barcode/ticket/api/asn/omv2/StationPassageData.java new file mode 100644 index 0000000..6c6d36d --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/StationPassageData.java @@ -0,0 +1,386 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.Date;
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfUnrestrictedLong;
+
+@Sequence
+@HasExtensionMarker
+public class StationPassageData extends Object {
+ public StationPassageData() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=0,maxValue=65535)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 6)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String productName;
+
+ @FieldOrder(order = 7)
+ @Asn1Default("stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 8)
+ @Asn1Optional public SequenceOfUnrestrictedLong stationNum;
+
+ @FieldOrder(order = 9)
+ @Asn1Optional public SequenceOfStringIA5 stationIA5;
+
+ @FieldOrder(order = 10)
+ @Asn1Optional public SequenceOfStringUTF8 stationNameUTF8;
+
+ @FieldOrder(order = 11)
+ @Asn1Optional public SequenceOfUnrestrictedLong areaCodeNum;
+
+ @FieldOrder(order = 12)
+ @Asn1Optional public SequenceOfStringIA5 areaCodeIA5;
+
+ @FieldOrder(order = 13)
+ @Asn1Optional public SequenceOfStringUTF8 areaNameUTF8;
+
+ @FieldOrder(order = 14)
+ @IntRange(minValue=-1,maxValue=700)
+ public Long validFromDay;
+
+ @FieldOrder(order = 15)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long validFromTime;
+
+ @FieldOrder(order = 16)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validFromUTCOffset;
+
+ @FieldOrder(order = 17)
+ @Asn1Default(value="0")
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long validUntilDay;
+
+ @FieldOrder(order = 18)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long validUntilTime;
+
+ @FieldOrder(order = 19)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validUntilUTCOffset;
+
+ @FieldOrder(order = 20)
+ @Asn1Optional public Asn1BigInteger numberOfDaysValid;
+
+ @FieldOrder(order = 21)
+ @Asn1Optional public ExtensionData extension;
+
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Asn1BigInteger getReferenceNum() {
+
+ return this.referenceNum;
+ }
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+
+ return this.productIdIA5;
+ }
+
+ public String getProductName() {
+
+ return this.productName;
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUIC;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public SequenceOfUnrestrictedLong getStationNum() {
+
+ return this.stationNum;
+ }
+
+ public List<String> getStationIA5() {
+
+ return this.stationIA5;
+ }
+
+ public SequenceOfStringUTF8 getStationNameUTF8() {
+
+ return this.stationNameUTF8;
+ }
+
+ public SequenceOfUnrestrictedLong getAreaCodeNum() {
+
+ return this.areaCodeNum;
+ }
+
+ public List<String> getAreaCodeIA5() {
+
+ return this.areaCodeIA5;
+ }
+
+ public List<String> getAreaNameUTF8() {
+
+ return this.areaNameUTF8;
+ }
+
+ public Long getValidFromDay() {
+
+ return this.validFromDay;
+ }
+
+ public Long getValidFromTime() {
+
+ return this.validFromTime;
+ }
+
+ public Long getValidUntilDay() {
+
+ return this.validUntilDay;
+ }
+
+ public Long getValidUntilTime() {
+
+ return this.validUntilTime;
+ }
+
+ public Long getNumberOfDaysValid() {
+
+ return Asn1BigInteger.toLong(numberOfDaysValid);
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setReferenceNum(Asn1BigInteger referenceNum) {
+
+ this.referenceNum = referenceNum;
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setProductName(String productName) {
+
+ this.productName = productName;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setStationNum(SequenceOfUnrestrictedLong stationNum) {
+
+ this.stationNum = stationNum;
+ }
+
+ public void setStationIA5(SequenceOfStringIA5 stationIA5) {
+
+ this.stationIA5 = stationIA5;
+ }
+
+ public void setStationNameUTF8(SequenceOfStringUTF8 stationNameUTF8) {
+
+ this.stationNameUTF8 = stationNameUTF8;
+ }
+
+ public void setAreaCodeNum(SequenceOfUnrestrictedLong sequenceOfUnrestrictedLong) {
+
+ this.areaCodeNum = sequenceOfUnrestrictedLong;
+ }
+
+ public void setAreaCodeIA5(SequenceOfStringIA5 areaCodeIA5) {
+
+ this.areaCodeIA5 = areaCodeIA5;
+ }
+
+ public void setAreaNameUTF8(SequenceOfStringUTF8 areaNameUTF8) {
+
+ this.areaNameUTF8 = areaNameUTF8;
+ }
+
+ public void setValidFromDay(Long validFromDay) {
+
+ this.validFromDay = validFromDay;
+ }
+
+ public void setValidFromTime(Long validFromTime) {
+
+ this.validFromTime = validFromTime;
+ }
+
+ public void setValidUntilDay(Long validUntilDay) {
+
+ this.validUntilDay = validUntilDay;
+ }
+
+ public void setValidUntilTime(Long validUntilTime) {
+
+ this.validUntilTime = validUntilTime;
+ }
+
+ public void setNumberOfDaysValid(Long numberOfDaysValid) {
+
+ this.numberOfDaysValid = Asn1BigInteger.toAsn1(numberOfDaysValid);
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+ public void setValidityDates (Date fromDate, Date untilDate, Date issuingDate){
+
+ if (issuingDate == null || fromDate == null) return;
+
+ this.validFromDay = DateTimeUtils.getDateDifference(issuingDate,fromDate);
+ this.validFromTime = DateTimeUtils.getTime(fromDate);
+
+ if (untilDate != null){
+ this.validUntilDay = DateTimeUtils.getDateDifference(fromDate, untilDate);
+ this.validUntilTime = DateTimeUtils.getTime(untilDate);
+ }
+
+ }
+
+ public Date getValidFromDate(Date issuingDate){
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay, this.validFromTime);
+
+ }
+
+ public Date getValidUntilDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validUntilDay == null) {
+ return null;
+ }
+
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime);
+
+ }
+
+ public Long getValidFromUTCOffset() {
+ return validFromUTCOffset;
+ }
+
+ public void setValidFromUTCOffset(Long validFromUTCOffset) {
+ this.validFromUTCOffset = validFromUTCOffset;
+ }
+
+ public Long getValidUntilUTCOffset() {
+ return validUntilUTCOffset;
+ }
+
+ public void setValidUntilUTCOffset(Long validUntilUTCOffset) {
+ this.validUntilUTCOffset = validUntilUTCOffset;
+ }
+
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/TariffType.java b/src/org/uic/barcode/ticket/api/asn/omv2/TariffType.java new file mode 100644 index 0000000..efc5d3b --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/TariffType.java @@ -0,0 +1,206 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+@HasExtensionMarker
+public class TariffType extends Object {
+ public TariffType() {
+ }
+ @FieldOrder(order = 0)
+ @IntRange(minValue=1,maxValue=200)
+ @Asn1Default(value = "1")
+ @Asn1Optional public Long numberOfPassengers;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public PassengerType passengerType;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=64)
+ @Asn1Optional public Long ageBelow;
+
+ @FieldOrder(order = 3)
+ @IntRange(minValue=1,maxValue=128)
+ @Asn1Optional public Long ageAbove;
+
+ @FieldOrder(order = 5)
+ @Asn1Optional public SequenceOfTravelerId traverlerid;
+
+ @FieldOrder(order = 6)
+ public Boolean restrictedToCountryOfResidence;
+
+ @FieldOrder(order = 7)
+ @Asn1Optional public RouteSectionType restrictedToRouteSection;
+
+ @FieldOrder(order = 8)
+ @Asn1Optional public SeriesDetailType seriesDataDetails;
+
+ @FieldOrder(order = 9)
+ @Asn1Optional public Asn1BigInteger tariffIdNum;
+
+ @FieldOrder(order = 10)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String tariffIdIA5;
+
+ @FieldOrder(order = 11)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String tariffDesc;
+
+ @FieldOrder(order = 12)
+ @Asn1Optional public SequenceOfCardReferenceType reductionCard;
+
+
+
+ public Long getNumberOfPassengers() {
+
+ if (numberOfPassengers == null) {
+ return new Long(1);
+ }
+
+ return this.numberOfPassengers;
+ }
+
+ public PassengerType getPassengerType() {
+
+ return this.passengerType;
+ }
+
+ public Long getAgeBelow() {
+
+ return this.ageBelow;
+ }
+
+ public Long getAgeAbove() {
+
+ return this.ageAbove;
+ }
+
+ public SequenceOfTravelerId getTraverlerid() {
+
+ return this.traverlerid;
+ }
+
+ public Boolean getRestrictedToCountryOfResidence() {
+
+ return this.restrictedToCountryOfResidence;
+ }
+
+ public RouteSectionType getRestrictedToRouteSection() {
+
+ return this.restrictedToRouteSection;
+ }
+
+ public SeriesDetailType getSeriesDataDetails() {
+
+ return this.seriesDataDetails;
+ }
+
+ public Long getTariffIdNum() {
+
+ return Asn1BigInteger.toLong(this.tariffIdNum);
+ }
+
+ public String getTariffIdIA5() {
+
+ return this.tariffIdIA5;
+ }
+
+ public String getTariffDesc() {
+
+ return this.tariffDesc;
+ }
+
+ public SequenceOfCardReferenceType getReductionCard() {
+
+ return this.reductionCard;
+ }
+
+ public void setNumberOfPassengers(Long numberOfPassengers) {
+
+ this.numberOfPassengers = numberOfPassengers;
+ }
+
+ public void setPassengerType(PassengerType passengerType) {
+
+ this.passengerType = passengerType;
+ }
+
+ public void setAgeBelow(Long ageBelow) {
+
+ this.ageBelow = ageBelow;
+ }
+
+ public void setAgeAbove(Long ageAbove) {
+
+ this.ageAbove = ageAbove;
+ }
+
+ public void setTraverlerid(SequenceOfTravelerId traverlerid) {
+
+ this.traverlerid = traverlerid;
+ }
+
+ public void setRestrictedToCountryOfResidence(Boolean restrictedToCountryOfResidence) {
+
+ this.restrictedToCountryOfResidence = restrictedToCountryOfResidence;
+ }
+
+ public void setRestrictedToRouteSection(RouteSectionType restrictedToRouteSection) {
+
+ this.restrictedToRouteSection = restrictedToRouteSection;
+ }
+
+ public void setSeriesDataDetails(SeriesDetailType seriesDataDetails) {
+
+ this.seriesDataDetails = seriesDataDetails;
+ }
+
+ public void setTariffIdNum(Long tariffIdNum) {
+
+ this.tariffIdNum = Asn1BigInteger.toAsn1(tariffIdNum);
+ }
+
+ public void setTariffIdIA5(String tariffIdIA5) {
+
+ this.tariffIdIA5 = tariffIdIA5;
+ }
+
+ public void setTariffDesc(String tariffDesc) {
+
+ this.tariffDesc = tariffDesc;
+ }
+
+ public void setReductionCard(SequenceOfCardReferenceType reductionCard) {
+
+ this.reductionCard = reductionCard;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/TicketDetailData.java b/src/org/uic/barcode/ticket/api/asn/omv2/TicketDetailData.java new file mode 100644 index 0000000..4cdac60 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/TicketDetailData.java @@ -0,0 +1,190 @@ +/*
+ * 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.asn.omv2;
+
+
+
+import org.uic.barcode.asn1.datatypes.Choice;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@Choice
+@HasExtensionMarker
+public class TicketDetailData extends Object {
+ public TicketDetailData() {
+ }
+
+ @FieldOrder(order = 0)
+ public ReservationData reservation;
+
+ @FieldOrder(order = 1)
+ public CarCarriageReservationData carCarriageReservation;
+
+ @FieldOrder(order = 2)
+ public OpenTicketData openTicket;
+
+ @FieldOrder(order = 3)
+ public PassData pass;
+
+ @FieldOrder(order = 4)
+ public VoucherData voucher;
+
+ @FieldOrder(order = 5)
+ public CustomerCardData customerCard;
+
+ @FieldOrder(order = 6)
+ public CountermarkData counterMark;
+
+ @FieldOrder(order = 7)
+ public ParkingGroundData parkingGround;
+
+ @FieldOrder(order = 8)
+ public FIPTicketData fipTicket;
+
+ @FieldOrder(order = 9)
+ public StationPassageData stationPassage;
+
+ @FieldOrder(order = 10)
+ public DelayConfirmation delayConfirmation;
+
+ @FieldOrder(order = 11)
+ public ExtensionData extension;
+
+ public ReservationData getReservation() {
+
+ return this.reservation;
+ }
+
+ public CarCarriageReservationData getCarCarriageReservation() {
+
+ return this.carCarriageReservation;
+ }
+
+ public OpenTicketData getOpenTicket() {
+
+ return this.openTicket;
+ }
+
+ public PassData getPass() {
+
+ return this.pass;
+ }
+
+ public VoucherData getVoucher() {
+
+ return this.voucher;
+ }
+
+ public CustomerCardData getCustomerCard() {
+
+ return this.customerCard;
+ }
+
+ public CountermarkData getCounterMark() {
+
+ return this.counterMark;
+ }
+
+ public ParkingGroundData getParkingGround() {
+
+ return this.parkingGround;
+ }
+
+ public FIPTicketData getFipTicket() {
+
+ return this.fipTicket;
+ }
+
+ public StationPassageData getStationPassage() {
+
+ return this.stationPassage;
+ }
+
+ public DelayConfirmation getDelayConfirmation() {
+
+ return this.delayConfirmation;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setReservation(ReservationData reservation) {
+
+ this.reservation = reservation;
+ }
+
+ public void setCarCarriageReservation(CarCarriageReservationData carCarriageReservation) {
+
+ this.carCarriageReservation = carCarriageReservation;
+ }
+
+ public void setOpenTicket(OpenTicketData openTicket) {
+
+ this.openTicket = openTicket;
+ }
+
+ public void setPass(PassData pass) {
+
+ this.pass = pass;
+ }
+
+ public void setVoucher(VoucherData voucher) {
+
+ this.voucher = voucher;
+ }
+
+ public void setCustomerCard(CustomerCardData customerCard) {
+
+ this.customerCard = customerCard;
+ }
+
+ public void setCounterMark(CountermarkData counterMark) {
+
+ this.counterMark = counterMark;
+ }
+
+ public void setParkingGround(ParkingGroundData parkingGround) {
+
+ this.parkingGround = parkingGround;
+ }
+
+ public void setFipTicket(FIPTicketData fipTicket) {
+
+ this.fipTicket = fipTicket;
+ }
+
+ public void setStationPassage(StationPassageData stationPassage) {
+
+ this.stationPassage = stationPassage;
+ }
+
+ public void setDelayConfirmation(DelayConfirmation delayConfirmation) {
+
+ this.delayConfirmation = delayConfirmation;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/TicketLinkType.java b/src/org/uic/barcode/ticket/api/asn/omv2/TicketLinkType.java new file mode 100644 index 0000000..d1c02a6 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/TicketLinkType.java @@ -0,0 +1,156 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+@HasExtensionMarker
+public class TicketLinkType extends Object {
+ public TicketLinkType() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 2)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String issuerName;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String issuerPNR;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 6)
+ @Asn1Default(value="openTicket")
+ @Asn1Optional public TicketType ticketType;
+
+ @FieldOrder(order = 7)
+ @Asn1Default(value="issuedTogether")
+ @Asn1Optional public LinkMode linkMode;
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Long getReferenceNum() {
+ return Asn1BigInteger.toLong(this.referenceNum);
+ }
+
+ public String getIssuerName() {
+
+ return this.issuerName;
+ }
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public TicketType getTicketType() {
+
+ if (ticketType == null) {
+ return TicketType.openTicket;
+ }
+
+ return this.ticketType;
+ }
+
+ public LinkMode getLinkMode() {
+
+ if (linkMode == null){
+ return LinkMode.issuedTogether;
+ }
+
+ return this.linkMode;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setReferenceNum(Long referenceNum) {
+ this.referenceNum = Asn1BigInteger.toAsn1(referenceNum);
+ }
+
+ public void setIssuerName(String issuerName) {
+
+ this.issuerName = issuerName;
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setTicketType(TicketType ticketType) {
+
+ this.ticketType = ticketType;
+ }
+
+ public void setLinkMode(LinkMode linkMode) {
+
+ this.linkMode = linkMode;
+ }
+
+ public String getIssuerPNR() {
+ return issuerPNR;
+ }
+
+ public void setIssuerPNR(String issuerPNR) {
+ this.issuerPNR = issuerPNR;
+ }
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/TicketType.java b/src/org/uic/barcode/ticket/api/asn/omv2/TicketType.java new file mode 100644 index 0000000..3787266 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/TicketType.java @@ -0,0 +1,41 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum TicketType {
+ openTicket("openTicket"),
+ pass("pass"),
+ reservation("reservation"),
+ carCarriageReservation("carCarriageReservation");
+
+ public String text;
+
+ TicketType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/TimeRangeType.java b/src/org/uic/barcode/ticket/api/asn/omv2/TimeRangeType.java new file mode 100644 index 0000000..0c8bb90 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/TimeRangeType.java @@ -0,0 +1,59 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.IntRange;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+public class TimeRangeType extends Object {
+ public TimeRangeType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=0,maxValue=1439)
+ public Long fromTime;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue=0,maxValue=1439)
+ public Long untilTime;
+
+ public Long getFromTime() {
+
+ return this.fromTime;
+ }
+
+ public Long getUntilTime() {
+
+ return this.untilTime;
+ }
+
+ public void setFromTime(Long fromTime) {
+
+ this.fromTime = fromTime;
+ }
+
+ public void setUntilTime(Long untilTime) {
+
+ this.untilTime = untilTime;
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/TokenType.java b/src/org/uic/barcode/ticket/api/asn/omv2/TokenType.java new file mode 100644 index 0000000..d8ac20c --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/TokenType.java @@ -0,0 +1,92 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.OctetString;
+
+@Sequence
+public class TokenType extends Object {
+ public TokenType() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public Long tokenProviderNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String tokenProviderIA5;
+
+ @FieldOrder(order = 2)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String tokenSpecification;
+
+ @FieldOrder(order = 4)
+ public OctetString token;
+
+ public Long getTokenProviderNum() {
+
+ return this.tokenProviderNum;
+ }
+
+ public String getTokenProviderIA5() {
+
+ return this.tokenProviderIA5;
+ }
+
+ public String getTokenSpecification() {
+
+ return this.tokenSpecification;
+ }
+
+ public byte[] getToken() {
+
+ return token.toByteArray();
+
+ }
+
+ public void setTokenProviderNum(Long tokenProviderNum) {
+
+ this.tokenProviderNum = tokenProviderNum;
+ }
+
+ public void setTokenProviderIA5(String tokenProviderIA5) {
+
+ this.tokenProviderIA5 = tokenProviderIA5;
+ }
+
+ public void setTokenSpecification(String tokenSpecification) {
+
+ this.tokenSpecification = tokenSpecification;
+ }
+
+ public void setToken(byte[] token) {
+
+ this.token = new OctetString(token);
+
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java b/src/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java new file mode 100644 index 0000000..7c3de46 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java @@ -0,0 +1,184 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.Date;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.IntRange;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+public class TrainLinkType extends Object {
+ public TrainLinkType() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public Asn1BigInteger trainNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String trainIA5;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Optional public Long travelDate;
+
+ @FieldOrder(order = 3)
+ @IntRange(minValue=0,maxValue=1440)
+ @Asn1Optional public Long departureTime;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long departureUTCOffset;
+
+ @FieldOrder(order = 5)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long fromStationNum;
+
+ @FieldOrder(order = 6)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String fromStationIA5;
+
+ @FieldOrder(order = 7)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long toStationNum;
+
+ @FieldOrder(order = 8)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String toStationIA5;
+
+ @FieldOrder(order = 9)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String fromStationName;
+
+ @FieldOrder(order = 10)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String toStationName;
+
+ public Long getTrainNum() {
+ return Asn1BigInteger.toLong(this.trainNum);
+ }
+
+ public String getTrainIA5() {
+ return this.trainIA5;
+ }
+
+ public Long getTravelDate() {
+ return this.travelDate;
+ }
+
+ public Long getDepartureTime() {
+ return this.departureTime;
+ }
+
+ public Long getFromStationNum() {
+ return this.fromStationNum;
+ }
+
+ public String getFromStationIA5() {
+ return this.fromStationIA5;
+ }
+
+ public Long getToStationNum() {
+ return this.toStationNum;
+ }
+
+ public String getToStationIA5() {
+ return this.toStationIA5;
+ }
+
+ public String getFromStationName() {
+ return this.fromStationName;
+ }
+
+ public String getToStationName() {
+ return this.toStationName;
+ }
+
+ public void setTrainNum(Long trainNum) {
+ this.trainNum = Asn1BigInteger.toAsn1(trainNum);
+ }
+
+ public void setTrainIA5(String trainIA5) {
+ this.trainIA5 = trainIA5;
+ }
+
+ public void setTravelDate(Long travelDate) {
+ this.travelDate = travelDate;
+ }
+
+ public void setDepartureTime(Long departureTime) {
+ this.departureTime = departureTime;
+ }
+
+ public void setFromStationNum(Long fromStationNum) {
+ this.fromStationNum = fromStationNum;
+ }
+
+ public void setFromStationIA5(String fromStationIA5) {
+ this.fromStationIA5 = fromStationIA5;
+ }
+
+ public void setToStationNum(Long toStationNum) {
+ this.toStationNum = toStationNum;
+ }
+
+ public void setToStationIA5(String toStationIA5) {
+ this.toStationIA5 = toStationIA5;
+ }
+
+ public void setFromStationName(String fromStationName) {
+ this.fromStationName = fromStationName;
+ }
+
+ public void setToStationName(String toStationName) {
+ this.toStationName = toStationName;
+ }
+
+ public void setDepartureDate(Date departure, Date issuingDate){
+
+ if (issuingDate == null || departure == null) return;
+
+ this.travelDate = DateTimeUtils.getDateDifference(issuingDate,departure);
+ this.departureTime = DateTimeUtils.getTime(departure);
+ }
+
+ public void setDepartureTimeZone(Date dateLocal, Date dateUTC ) {
+ // -- (UTC = local + offset * 15 Minutes)
+ this.departureUTCOffset = new Long(dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15);
+ }
+
+ public Date getDepartureDate(Date issuingDate){
+ return DateTimeUtils.getDate(issuingDate, this.travelDate, this.departureTime);
+ }
+
+ public Date getUTCDepartureDate(Date issuingDate){
+ return DateTimeUtils.getUTCDate(issuingDate, this.travelDate, this.departureTime, this.departureUTCOffset);
+ }
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/TravelClassType.java b/src/org/uic/barcode/ticket/api/asn/omv2/TravelClassType.java new file mode 100644 index 0000000..37c4ac7 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/TravelClassType.java @@ -0,0 +1,50 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum TravelClassType {
+ notApplicabel("notApplicabel"),
+ first("first"),
+ second("second"),
+ tourist("tourist"),
+ comfort("comfort"),
+ premium("premium"),
+ business("business"),
+ all("all"),
+ premiumFirst("A"),
+ standardFirst("B"),
+ premiumSecond("C"),
+ standardSecond("D");
+
+
+ public String text;
+
+ TravelClassType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/TravelerData.java b/src/org/uic/barcode/ticket/api/asn/omv2/TravelerData.java new file mode 100644 index 0000000..53d6019 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/TravelerData.java @@ -0,0 +1,82 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.FixedSize;
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+@HasExtensionMarker
+public class TravelerData extends Object {
+ public TravelerData() {
+ }
+ @FieldOrder(order = 0)
+ @Asn1Optional public SequenceOfTravelerType traveler;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @FixedSize(2)
+ @Asn1Optional public String preferedLanguage;
+
+ @FieldOrder(order = 2)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String groupName;
+
+
+ public List<TravelerType> getTraveler() {
+
+ return this.traveler;
+ }
+
+ public String getPreferedLanguage() {
+
+ return this.preferedLanguage;
+ }
+
+ public String getGroupName() {
+
+ return this.groupName;
+ }
+
+ public void setTraveler(SequenceOfTravelerType traveler) {
+
+ this.traveler = traveler;
+ }
+
+ public void setPreferedLanguage(String preferedLanguage) {
+
+ this.preferedLanguage = preferedLanguage;
+ }
+
+ public void setGroupName(String groupName) {
+
+ this.groupName = groupName;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java b/src/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java new file mode 100644 index 0000000..b0efae0 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java @@ -0,0 +1,322 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypes.SizeRange;
+
+@Sequence
+@HasExtensionMarker
+public class TravelerType extends Object {
+ public TravelerType() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String firstName;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String secondName;
+
+ @FieldOrder(order = 2)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String lastName;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String idCard;
+
+ @FieldOrder(order = 4)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String passportId;
+
+ @FieldOrder(order = 5)
+ @SizeRange(minValue = 1, maxValue = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String title;
+
+ @FieldOrder(order = 6)
+ @Asn1Optional public GenderType gender;
+
+ @FieldOrder(order = 7)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String customerIdIA5;
+
+ @FieldOrder(order = 8)
+ @Asn1Optional public Long customerIdNum;
+
+ @FieldOrder(order = 9)
+ @IntRange(minValue=1901,maxValue=2155)
+ @Asn1Optional public Long yearOfBirth;
+
+ @FieldOrder(order = 10)
+ @IntRange(minValue=0,maxValue=366)
+ @Asn1Optional public Long dayOfBirth;
+
+ @FieldOrder(order = 11)
+ public Boolean ticketHolder = true;
+
+ @FieldOrder(order = 12)
+ @Asn1Optional public PassengerType passengerType;
+
+ @FieldOrder(order = 13)
+ @Asn1Optional public Boolean passengerWithReducedMobility;
+
+ @FieldOrder(order = 14)
+ @IntRange(minValue=1,maxValue=999)
+ @Asn1Optional public Long countryOfResidence;
+
+ @FieldOrder(order = 15)
+ @IntRange(minValue=1,maxValue=999)
+ @Asn1Optional public Long countryOfPassport;
+
+ @FieldOrder(order = 16)
+ @IntRange(minValue=1,maxValue=999)
+ @Asn1Optional public Long countryOfIdCard;
+
+ @FieldOrder(order = 17)
+ @Asn1Optional public SequenceOfCustomerStatusType status;
+
+
+
+ public String getFirstName() {
+
+ return this.firstName;
+ }
+
+ public String getSecondName() {
+
+ return this.secondName;
+ }
+
+ public String getLastName() {
+
+ return this.lastName;
+ }
+
+ public String getIdCard() {
+
+ return this.idCard;
+ }
+
+ public String getPassportId() {
+
+ return this.passportId;
+ }
+
+ public String getTitle() {
+
+ return this.title;
+ }
+
+ public GenderType getGender() {
+
+ return this.gender;
+ }
+
+ public String getCustomerIdIA5() {
+
+ return this.customerIdIA5;
+ }
+
+ public Long getCustomerIdNum() {
+
+ return this.customerIdNum;
+ }
+
+ public Long getYearOfBirth() {
+
+ return this.yearOfBirth;
+ }
+
+ public Long getDayOfBirth() {
+
+ return this.dayOfBirth;
+ }
+
+ public Boolean getTicketHolder() {
+
+ return this.ticketHolder;
+ }
+
+ public PassengerType getPassengerType() {
+
+ return this.passengerType;
+ }
+
+ public Boolean getPassengerWithReducedMobility() {
+ return this.passengerWithReducedMobility;
+ }
+
+ public Long getCountryOfResidence() {
+
+ return this.countryOfResidence;
+ }
+
+ public Long getCountryOfPassport() {
+
+ return this.countryOfPassport;
+ }
+
+ public Long getCountryOfIdCard() {
+
+ return this.countryOfIdCard;
+ }
+
+ public SequenceOfCustomerStatusType getStatus() {
+
+ return this.status;
+ }
+
+ public void setFirstName(String firstName) {
+
+ this.firstName = firstName;
+ }
+
+ public void setSecondName(String secondName) {
+
+ this.secondName = secondName;
+ }
+
+ public void setLastName(String lastName) {
+
+ this.lastName = lastName;
+ }
+
+ public void setIdCard(String idCard) {
+
+ this.idCard = idCard;
+ }
+
+ public void setPassportId(String passportId) {
+
+ this.passportId = passportId;
+ }
+
+ public void setTitle(String title) {
+
+ this.title = title;
+ }
+
+ public void setGender(GenderType gender) {
+
+ this.gender = gender;
+ }
+
+ public void setCustomerIdIA5(String customerIdIA5) {
+
+ this.customerIdIA5 = customerIdIA5;
+ }
+
+ public void setCustomerIdNum(Long customerIdNum) {
+
+ this.customerIdNum = customerIdNum;
+ }
+
+ public void setYearOfBirth(Long yearOfBirth) {
+
+ this.yearOfBirth = yearOfBirth;
+ }
+
+ public void setDayOfBirth(Long dayOfBirth) {
+
+ this.dayOfBirth = dayOfBirth;
+ }
+
+ public void setTicketHolder(Boolean ticketHolder) {
+
+ this.ticketHolder = ticketHolder;
+ }
+
+ public void setPassengerType(PassengerType passengerType) {
+
+ this.passengerType = passengerType;
+ }
+
+ public void setPassengerWithReducedMobility(Boolean passengerWithReducedMobility) {
+
+ this.passengerWithReducedMobility = passengerWithReducedMobility;
+ }
+
+ public void setCountryOfResidence(Long countryOfResidence) {
+
+ this.countryOfResidence = countryOfResidence;
+ }
+
+ public void setCountryOfPassport(Long countryOfPassport) {
+
+ this.countryOfPassport = countryOfPassport;
+ }
+
+ public void setCountryOfIdCard(Long countryOfIdCard) {
+
+ this.countryOfIdCard = countryOfIdCard;
+ }
+
+ public void setStatus(SequenceOfCustomerStatusType status) {
+
+ this.status = status;
+ }
+
+
+
+ public void setDateOfBirth(Date date){
+
+ if (date == null) return;
+
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+
+ this.yearOfBirth = new Long( cal.get(Calendar.YEAR));
+ this.dayOfBirth = new Long (cal.get(Calendar.DAY_OF_YEAR));
+
+
+ }
+
+ public Date getDateOfBirth() {
+
+ if (this.yearOfBirth == null) return null;
+ if (this.dayOfBirth == null) return null;
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ cal.set(Calendar.YEAR, this.yearOfBirth.intValue());
+ cal.set(Calendar.DAY_OF_YEAR, this.dayOfBirth.intValue());
+ cal.set(Calendar.HOUR_OF_DAY,0);
+ cal.set(Calendar.MINUTE,0);
+
+ return cal.getTime();
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/UicRailTicketData.java b/src/org/uic/barcode/ticket/api/asn/omv2/UicRailTicketData.java new file mode 100644 index 0000000..31fddba --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/UicRailTicketData.java @@ -0,0 +1,115 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.List;
+
+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.Sequence;
+import org.uic.barcode.asn1.uper.UperEncoder;
+
+@Sequence
+@HasExtensionMarker
+public class UicRailTicketData extends Object {
+ public UicRailTicketData() {
+ }
+
+ @FieldOrder(order = 0)
+ public IssuingData issuingDetail;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public TravelerData travelerDetail;
+
+ @FieldOrder(order = 2)
+ @Asn1Optional public SequenceOfDocumentData transportDocument;
+
+ @FieldOrder(order = 3)
+ @Asn1Optional public ControlData controlDetail;
+
+ @FieldOrder(order = 4)
+ @Asn1Optional public SequenceOfExtensionData extension;
+
+ public IssuingData getIssuingDetail() {
+
+ return this.issuingDetail;
+ }
+
+ public TravelerData getTravelerDetail() {
+
+ return this.travelerDetail;
+ }
+
+ public List<DocumentData> getTransportDocument() {
+
+ return this.transportDocument;
+ }
+
+ public ControlData getControlDetail() {
+
+ return this.controlDetail;
+ }
+
+ public List<ExtensionData> getExtension() {
+
+ return this.extension;
+ }
+
+ public void setIssuingDetail(IssuingData issuingDetail) {
+
+ this.issuingDetail = issuingDetail;
+ }
+
+ public void setTravelerDetail(TravelerData travelerDetail) {
+
+ this.travelerDetail = travelerDetail;
+ }
+
+ public void setTransportDocument(SequenceOfDocumentData transportDocument) {
+
+ this.transportDocument = transportDocument;
+ }
+
+ public void setControlDetail(ControlData controlDetail) {
+
+ this.controlDetail = controlDetail;
+ }
+
+ public void setExtension(SequenceOfExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+
+ public byte[] encode(){
+ return UperEncoder.encode(this);
+ }
+
+ public String encodeToHex(){
+ return UperEncoder.hexStringFromBytes(UperEncoder.encode(this));
+ }
+
+
+ public static UicRailTicketData decode(byte[] bytes) {
+ return UperEncoder.decode(bytes, UicRailTicketData.class);
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodDetailType.java b/src/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodDetailType.java new file mode 100644 index 0000000..dd9935b --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodDetailType.java @@ -0,0 +1,73 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.Collection;
+
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.Asn1SequenceOf;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+public class ValidityPeriodDetailType extends Object {
+ public ValidityPeriodDetailType() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Optional public SequenceOfValidityPeriodType validityPeriod;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public SequenceOfTimeRangeType excludedTimeRange;
+
+
+ public class SequenceOfTimeRangeType extends Asn1SequenceOf<TimeRangeType> {
+ public SequenceOfTimeRangeType() { super(); }
+ public SequenceOfTimeRangeType(Collection<TimeRangeType> coll) { super(coll); }
+ }
+
+
+ public class SequenceOfValidityPeriodType extends Asn1SequenceOf<ValidityPeriodType> {
+ public SequenceOfValidityPeriodType() { super(); }
+ public SequenceOfValidityPeriodType(Collection<ValidityPeriodType> coll) { super(coll); }
+ }
+
+ public SequenceOfValidityPeriodType getValidityPeriod() {
+
+ return this.validityPeriod;
+ }
+
+ public SequenceOfTimeRangeType getExcludedTimeRange() {
+
+ return this.excludedTimeRange;
+ }
+
+ public void setValidityPeriod(SequenceOfValidityPeriodType validityPeriod) {
+
+ this.validityPeriod = validityPeriod;
+ }
+
+ public void setExcludedTimeRange(SequenceOfTimeRangeType excludedTimeRange) {
+
+ this.excludedTimeRange = excludedTimeRange;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java b/src/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java new file mode 100644 index 0000000..6c36c97 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java @@ -0,0 +1,164 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.Date;
+
+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.IntRange;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+@Sequence
+public class ValidityPeriodType extends Object {
+ public ValidityPeriodType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=0,maxValue=700)
+ @Asn1Default(value="0")
+ @Asn1Optional public Long validFromDay;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue=0,maxValue=1439)
+ @Asn1Optional public Long validFromTime;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validFromUTCOffset;
+
+ @FieldOrder(order = 3)
+ @IntRange(minValue=0,maxValue=370)
+ @Asn1Default(value="0")
+ @Asn1Optional public Long validUntilDay;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=0,maxValue=1439)
+ @Asn1Optional public Long validUntilTime;
+
+ @FieldOrder(order = 5)
+ @IntRange(minValue=-60, maxValue=60)
+ @Asn1Optional public Long validUntilUTCOffset;
+
+ public Long getValidFromDay() {
+
+ if (validFromDay == null) {
+ return new Long(0);
+ }
+
+ return this.validFromDay;
+ }
+
+ public Long getValidFromTime() {
+
+ return this.validFromTime;
+ }
+
+ public Long getValidUntilDay() {
+
+ if (validUntilDay == null) {
+ return new Long(0);
+ }
+
+ return this.validUntilDay;
+ }
+
+ public Long getValidUntilTime() {
+
+ return this.validUntilTime;
+ }
+
+ public void setValidFromDay(Long validFromDay) {
+
+ this.validFromDay = validFromDay;
+ }
+
+ public void setValidFromTime(Long validFromTime) {
+
+ this.validFromTime = validFromTime;
+ }
+
+ public void setValidUntilDay(Long validUntilDay) {
+
+ this.validUntilDay = validUntilDay;
+ }
+
+ public void setValidUntilTime(Long validUntilTime) {
+
+ this.validUntilTime = validUntilTime;
+ }
+
+ public void setValidityDates (Date fromDate, Date untilDate, Date issuingDate){
+
+ if (issuingDate == null || fromDate == null) return;
+
+ this.validFromDay = DateTimeUtils.getDateDifference(issuingDate,fromDate);
+ this.validFromTime = DateTimeUtils.getTime(fromDate);
+
+ if (untilDate != null){
+ this.validUntilDay = DateTimeUtils.getDateDifference(fromDate, untilDate);
+ this.validUntilTime = DateTimeUtils.getTime(untilDate);
+ }
+
+ }
+
+ public Date getValidFromDate(Date issuingDate){
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay, this.validFromTime);
+
+ }
+
+ public Date getValidUntilDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validUntilDay == null) {
+ return null;
+ }
+
+
+ return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime);
+
+ }
+
+ public Long getValidFromUTCOffset() {
+ return validFromUTCOffset;
+ }
+
+ public void setValidFromUTCOffset(Long validFromUTCOffset) {
+ this.validFromUTCOffset = validFromUTCOffset;
+ }
+
+ public Long getValidUntilUTCOffset() {
+ return validUntilUTCOffset;
+ }
+
+ public void setValidUntilUTCOffset(Long validUntilUTCOffset) {
+ this.validUntilUTCOffset = validUntilUTCOffset;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/VatDetailType.java b/src/org/uic/barcode/ticket/api/asn/omv2/VatDetailType.java new file mode 100644 index 0000000..adfb4e8 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/VatDetailType.java @@ -0,0 +1,87 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+import org.uic.barcode.asn1.datatypes.FieldOrder;
+import org.uic.barcode.asn1.datatypes.IntRange;
+import org.uic.barcode.asn1.datatypes.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+
+@Sequence
+public class VatDetailType extends Object {
+ public VatDetailType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue = 1, maxValue = 999)
+ public Long country;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue = 0, maxValue = 999)
+ public Long percentage;
+
+ @FieldOrder(order = 2)
+ @Asn1Optional public Asn1BigInteger amount;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String vatId;
+
+ public Long getCountry() {
+ return country;
+ }
+
+ public void setCountry(Long country) {
+ this.country = country;
+ }
+
+ public Long getPercentage() {
+ return percentage;
+ }
+
+ public void setPercentage(Long percentage) {
+ this.percentage = percentage;
+ }
+
+ public Long getAmount() {
+ return Asn1BigInteger.toLong(amount);
+ }
+
+ public void setAmount(Long amount) {
+ this.amount = Asn1BigInteger.toAsn1(amount);
+ }
+
+ public String getVatId() {
+ return vatId;
+ }
+
+ public void setVatId(String vatId) {
+ this.vatId = vatId;
+ }
+
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/ViaStationType.java b/src/org/uic/barcode/ticket/api/asn/omv2/ViaStationType.java new file mode 100644 index 0000000..0e2ca6c --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/ViaStationType.java @@ -0,0 +1,181 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+
+@Sequence
+@HasExtensionMarker
+public class ViaStationType extends Object {
+ public ViaStationType() {
+ }
+
+ @FieldOrder(order = 0)
+ @Asn1Default("stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 1)
+ @IntRange(minValue=1,maxValue=9999999)
+ @Asn1Optional public Long stationNum;
+
+ @FieldOrder(order = 2)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String stationIA5;
+
+ @FieldOrder(order = 3)
+ @Asn1Optional public SequenceOfViaStationType alternativeRoutes;
+
+ @FieldOrder(order = 4)
+ @Asn1Optional public SequenceOfViaStationType route;
+
+ @FieldOrder(order = 5)
+ @Asn1Optional public Boolean border = false;
+
+ @FieldOrder(order = 6)
+ @Asn1Optional public SequenceOfCarrierNum carriersNum;
+
+ @FieldOrder(order = 7)
+ @Asn1Optional public SequenceOfStringIA5 carriersIA5;
+
+ @FieldOrder(order = 8)
+ @Asn1Optional public Asn1BigInteger seriesId;
+
+ @FieldOrder(order = 9)
+ @Asn1Optional public Asn1BigInteger routeId;
+
+
+
+
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUIC;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public Long getStationNum() {
+
+ return this.stationNum;
+ }
+
+ public String getStationIA5() {
+
+ return this.stationIA5;
+ }
+
+ public SequenceOfViaStationType getAlternativeRoutes() {
+
+ return this.alternativeRoutes;
+ }
+
+ public SequenceOfViaStationType getRoute() {
+
+ return this.route;
+ }
+
+ public Boolean getBorder() {
+
+ return this.border;
+ }
+
+ public SequenceOfCarrierNum getCarriersNum() {
+
+ return this.carriersNum;
+ }
+
+ public SequenceOfStringIA5 getCarriersIA5() {
+
+ return this.carriersIA5;
+ }
+
+ public Long getSeriesId() {
+
+ return Asn1BigInteger.toLong(this.seriesId);
+ }
+
+ public Long getRouteId() {
+
+ return Asn1BigInteger.toLong(this.routeId);
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setStationNum(Long stationNum) {
+
+ this.stationNum = stationNum;
+ }
+
+ public void setStationIA5(String stationIA5) {
+
+ this.stationIA5 = stationIA5;
+ }
+
+ public void setAlternativeRoutes(SequenceOfViaStationType alternativeRoutes) {
+
+ this.alternativeRoutes = alternativeRoutes;
+ }
+
+ public void setRoute(SequenceOfViaStationType route) {
+
+ this.route = route;
+ }
+
+ public void setBorder(Boolean border) {
+
+ this.border = border;
+ }
+
+ public void setCarriersNum(SequenceOfCarrierNum carriersNum) {
+
+ this.carriersNum = carriersNum;
+ }
+
+ public void setCarriersIA5(SequenceOfStringIA5 carriersIA5) {
+
+ this.carriersIA5 = carriersIA5;
+ }
+
+ public void setSeriesId(Long seriesId) {
+
+ this.seriesId = Asn1BigInteger.toAsn1(seriesId);
+ }
+
+ public void setRouteId(Long routeId) {
+
+ this.routeId = Asn1BigInteger.toAsn1(routeId);
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/VoucherData.java b/src/org/uic/barcode/ticket/api/asn/omv2/VoucherData.java new file mode 100644 index 0000000..458b040 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/VoucherData.java @@ -0,0 +1,313 @@ +/*
+ * 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.asn.omv2;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+
+
+@Sequence
+@HasExtensionMarker
+public class VoucherData extends Object {
+ public VoucherData() {
+ }
+
+ @FieldOrder(order = 0)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String referenceIA5;
+
+ @FieldOrder(order = 1)
+ @Asn1Optional public Asn1BigInteger referenceNum;
+
+ @FieldOrder(order = 2)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long productOwnerNum;
+
+ @FieldOrder(order = 3)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productOwnerIA5;
+
+ @FieldOrder(order = 4)
+ @IntRange(minValue=0,maxValue=65535)
+ @Asn1Optional public Long productIdNum;
+
+ @FieldOrder(order = 5)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String productIdIA5;
+
+ @FieldOrder(order = 6)
+ @IntRange(minValue=2016,maxValue=2269)
+ public Long validFromYear;
+
+ @FieldOrder(order = 7)
+ @IntRange(minValue=0,maxValue=370)
+ public Long validFromDay;
+
+ @FieldOrder(order = 8)
+ @IntRange(minValue=2016,maxValue=2269)
+ public Long validUntilYear;
+
+ @FieldOrder(order = 9)
+ @IntRange(minValue=0,maxValue=370)
+ public Long validUntilDay;
+
+ @FieldOrder(order = 10)
+ @Asn1Optional public Long value;
+
+ @FieldOrder(order = 11)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long type;
+
+ @FieldOrder(order = 12)
+ @RestrictedString(CharacterRestriction.UTF8String)
+ @Asn1Optional public String infoText;
+
+ @FieldOrder(order = 13)
+ @Asn1Optional public ExtensionData extension;
+
+
+ public String getReferenceIA5() {
+
+ return this.referenceIA5;
+ }
+
+ public Asn1BigInteger getReferenceNum() {
+
+ return this.referenceNum;
+ }
+
+ public Long getProductOwnerNum() {
+
+ return this.productOwnerNum;
+ }
+
+ public String getProductOwnerIA5() {
+
+ return this.productOwnerIA5;
+ }
+
+ public Long getProductIdNum() {
+
+ return this.productIdNum;
+ }
+
+ public String getProductIdIA5() {
+
+ return this.productIdIA5;
+ }
+
+ public Long getValidFromYear() {
+
+ return this.validFromYear;
+ }
+
+ public Long getValidFromDay() {
+
+ return this.validFromDay;
+ }
+
+ public Long getValidUntilYear() {
+
+ return this.validUntilYear;
+ }
+
+ public Long getValidUntilDay() {
+
+ return this.validUntilDay;
+ }
+
+ public Long getValue() {
+
+ return this.value;
+ }
+
+ public Long getType() {
+
+ return this.type;
+ }
+
+ public String getInfoText() {
+
+ return this.infoText;
+ }
+
+ public ExtensionData getExtension() {
+
+ return this.extension;
+ }
+
+ public void setReferenceIA5(String referenceIA5) {
+
+ this.referenceIA5 = referenceIA5;
+ }
+
+ public void setReferenceNum(Asn1BigInteger referenceNum) {
+
+ this.referenceNum = referenceNum;
+ }
+
+ public void setProductOwnerNum(Long productOwnerNum) {
+
+ this.productOwnerNum = productOwnerNum;
+ }
+
+ public void setProductOwnerIA5(String productOwnerIA5) {
+
+ this.productOwnerIA5 = productOwnerIA5;
+ }
+
+ public void setProductIdNum(Long productIdNum) {
+
+ this.productIdNum = productIdNum;
+ }
+
+ public void setProductIdIA5(String productIdIA5) {
+
+ this.productIdIA5 = productIdIA5;
+ }
+
+ public void setValidFromYear(Long validFromYear) {
+
+ this.validFromYear = validFromYear;
+ }
+
+ public void setValidFromDay(Long validFromDay) {
+
+ this.validFromDay = validFromDay;
+ }
+
+ public void setValidUntilYear(Long validUntilYear) {
+
+ this.validUntilYear = validUntilYear;
+ }
+
+ public void setValidUntilDay(Long validUntilDay) {
+
+ this.validUntilDay = validUntilDay;
+ }
+
+ public void setValue(Long value) {
+
+ this.value = value;
+ }
+
+ public void setType(Long type) {
+
+ this.type = type;
+ }
+
+ public void setInfoText(String infoText) {
+
+ this.infoText = infoText;
+ }
+
+ public void setExtension(ExtensionData extension) {
+
+ this.extension = extension;
+ }
+
+
+ public void setValidity (Date fromDate , Date untilDate){
+
+ Calendar fromCal = Calendar.getInstance();
+ fromCal.clear();
+ fromCal.setTime(fromDate);
+
+ this.validFromYear = new Long( fromCal.get(Calendar.YEAR));
+ this.validFromDay = new Long (fromCal.get(Calendar.DAY_OF_YEAR));
+
+ if (untilDate == null) return;
+
+ Calendar untilCal = Calendar.getInstance();
+ untilCal.clear();
+ untilCal.setTime(untilDate);
+
+ this.validUntilYear = new Long( untilCal.get(Calendar.YEAR));
+ this.validUntilDay = new Long (untilCal.get(Calendar.DAY_OF_YEAR));
+
+ }
+
+
+ public void setValidFrom (Date fromDate){
+
+ if (fromDate == null) return;
+
+ Calendar fromCal = Calendar.getInstance();
+ fromCal.clear();
+ fromCal.setTime(fromDate);
+
+ this.validFromYear = new Long( fromCal.get(Calendar.YEAR));
+ this.validFromDay = new Long (fromCal.get(Calendar.DAY_OF_YEAR));
+
+ }
+
+ public void setValidUntil (Date untilDate){
+
+ if (untilDate == null) return;
+
+ Calendar untilCal = Calendar.getInstance();
+ untilCal.clear();
+ untilCal.setTime(untilDate);
+
+ this.validUntilYear = new Long( untilCal.get(Calendar.YEAR));
+ this.validUntilDay = new Long (untilCal.get(Calendar.DAY_OF_YEAR));
+
+ }
+
+ public Date getValidFrom(){
+
+ if (this.validFromYear == null || this.validFromYear == 0) return null;
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ cal.set(Calendar.YEAR, this.validFromYear.intValue());
+ cal.set(Calendar.DAY_OF_YEAR, this.validFromDay.intValue());
+
+ return cal.getTime();
+
+ }
+
+ public Date getValidUntil(){
+
+ if (this.validUntilYear == null || this.validUntilYear == 0) return null;
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ cal.set(Calendar.YEAR, this.validUntilYear.intValue());
+ cal.set(Calendar.DAY_OF_YEAR, this.validUntilDay.intValue());
+
+ return cal.getTime();
+
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/ZoneType.java b/src/org/uic/barcode/ticket/api/asn/omv2/ZoneType.java new file mode 100644 index 0000000..3f269ee --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/ZoneType.java @@ -0,0 +1,182 @@ +/*
+ * 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.asn.omv2;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypes.Asn1Default;
+import org.uic.barcode.asn1.datatypes.Asn1Optional;
+import org.uic.barcode.asn1.datatypes.CharacterRestriction;
+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.RestrictedString;
+import org.uic.barcode.asn1.datatypes.Sequence;
+import org.uic.barcode.asn1.datatypesimpl.OctetString;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfUnrestrictedLong;
+
+@Sequence
+@HasExtensionMarker
+
+public class ZoneType extends Object {
+ public ZoneType() {
+ }
+
+ @FieldOrder(order = 0)
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long carrierNum;
+
+ @FieldOrder(order = 1)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String carrierIA5;
+
+ @FieldOrder(order = 2)
+ @Asn1Default("stationUIC")
+ @Asn1Optional public CodeTableType stationCodeTable;
+
+ @FieldOrder(order = 3)
+ @IntRange(minValue=0,maxValue=9999999)
+ @Asn1Optional public Long entryStationNum;
+
+ @FieldOrder(order = 4)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String entryStationIA5;
+
+ @FieldOrder(order = 5)
+ @IntRange(minValue=0,maxValue=9999999)
+ @Asn1Optional public Long terminatingStationNum;
+
+ @FieldOrder(order = 6)
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String terminatingStationIA5;
+
+ @FieldOrder(order = 7)
+ @Asn1Optional public Asn1BigInteger city;
+
+ @FieldOrder(order = 8)
+ @Asn1Optional public SequenceOfUnrestrictedLong zoneId;
+
+ @FieldOrder(order = 9)
+ @Asn1Optional public OctetString binaryZoneId;
+
+ @FieldOrder(order = 10)
+ @Asn1Optional public String nutsCode;
+
+
+ public Long getCarrierNum() {
+
+ return this.carrierNum;
+ }
+
+ public String getCarrierIA5() {
+
+ return this.carrierIA5;
+ }
+
+ public CodeTableType getStationCodeTable() {
+
+ if (stationCodeTable == null) {
+ return CodeTableType.stationUIC;
+ }
+
+ return this.stationCodeTable;
+ }
+
+ public Long getEntryStationNum() {
+ return this.entryStationNum;
+ }
+
+ public String getEntryStationIA5() {
+ return this.entryStationIA5;
+ }
+
+ public Long getTerminatingStationNum() {
+ return this.terminatingStationNum;
+ }
+
+ public String getTerminatingStationIA5() {
+ return this.terminatingStationIA5;
+ }
+
+ public Asn1BigInteger getCity() {
+ return this.city;
+ }
+
+ public SequenceOfUnrestrictedLong getZoneId() {
+ return this.zoneId;
+ }
+
+ public byte[] getBinaryZoneId() {
+
+ return binaryZoneId.toByteArray();
+
+ }
+
+ public String getNutsCode() {
+ return this.nutsCode;
+ }
+
+ public void setCarrierNum(Long carrierNum) {
+ this.carrierNum = carrierNum;
+ }
+
+ public void setCarrierIA5(String carrierIA5) {
+ this.carrierIA5 = carrierIA5;
+ }
+
+ public void setStationCodeTable(CodeTableType stationCodeTable) {
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ public void setEntryStationNum(Long entryStationNum) {
+ this.entryStationNum = entryStationNum;
+ }
+
+ public void setEntryStationIA5(String entryStationIA5) {
+ this.entryStationIA5 = entryStationIA5;
+ }
+
+ public void setTerminatingStationNum(Long terminatingStationNum) {
+ this.terminatingStationNum = terminatingStationNum;
+ }
+
+ public void setTerminatingStationIA5(String terminatingStationIA5) {
+ this.terminatingStationIA5 = terminatingStationIA5;
+ }
+
+ public void setCity(Asn1BigInteger city) {
+ this.city = city;
+ }
+
+ public void setZoneId(SequenceOfUnrestrictedLong zoneId) {
+ this.zoneId = zoneId;
+ }
+
+ public void setBinaryZoneId(byte[] binaryZoneId) {
+
+ this.binaryZoneId = new OctetString(binaryZoneId);
+
+ }
+
+ public void setNutsCode(String nutsCode) {
+ this.nutsCode = nutsCode;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/uicBarcodeFCBv2.0.asn b/src/org/uic/barcode/ticket/api/asn/omv2/uicBarcodeFCBv2.0.asn new file mode 100644 index 0000000..b67ac06 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/asn/omv2/uicBarcodeFCBv2.0.asn @@ -0,0 +1,2040 @@ +-- Creator: ASN.1 Editor (http://asneditor.sourceforge.net)
+-- Author: ClemensGantert
+-- Created: Tue Aug 11 11:40:28 CEST 2015
+ASN-Module DEFINITIONS AUTOMATIC TAGS ::= BEGIN
+
+-- imports and exports
+-- EXPORTS ALL;
+
+
+-- changes:
+-- product id 1 bit more 65535
+-- open ticket transport mode EN 1545-1
+-- allowing -1 in differences of days between dates (validity of tickets crossing time zones)
+
+-- ##############################################################################################
+-- #
+-- # Draft version 2.0 - value 2 in the UIC bar code version element
+-- # (see element 2 in U_FLEX record definition in leaflet 918.9)
+-- #
+-- ##############################################################################################
+
+
+-- ##############################################################################################
+-- #
+-- # Naming and encoding conventions
+-- #
+-- # Elements included as String and as Numeric values:
+-- # Some elements are included in different formats to reduce the data size.
+-- # These elements must be included only once.
+-- # These elements are named with the same name and appendix
+-- # Num (numeric values)
+-- # IA5 (String values according to ASN IA5String (7Bit))
+-- # Example:
+-- # trainNum - in case of a numeric train number
+-- # trainIA5 - in case of a alphanumeric train Id
+-- #
+-- #
+-- # RICS codes must be used to encode companies (issuer, product owner, ...) where available
+-- # other codes are possible based on bilateral agreements
+-- # the format is kept more flexible to cover upcoming extensions of the RICS code by ERA
+-- #
+-- # Stations can be coded using the UIC and upcoming ERA code lists. Proprietary codes are
+-- # possible based on bilateral agreements. Format: 1..9999999 or alphanumeric without
+-- # special character (IA5String)
+-- #
+-- #
+-- # ! INTEGERS must not exceed the value of 9,223,372,036,854,775,807 (64 bit) even in case
+-- # ! they are unrestricted!!!
+-- # !
+-- # ! Some elements like ReferenceNum or cardIdNum are defined as an unrestricted integer.
+-- # ! Unlike other numerical values the cardIdNum and referenceNum can be larger than a usual 32 bit Integer
+-- # ! Some ASN.1 implementation tools are limited to 32 bit integers which is too small.
+-- # ! Please ensure to use a tool capable of dealing with larger numbers.
+-- #
+-- # Optional BOOLEANs have three values: "true", "false", "unknown" = the Boolean is absent from the data.
+-- #
+-- #
+-- # Encoding of time:
+-- # time is encoded as the number of minutes of the day 0 = 00:00, 1439 = 23:59,
+-- # time data elements end with "time" in their name
+-- #
+-- # Encoding of date:
+-- # .........................................................................................................
+-- # The issuing date is given in UTC, but some other date values are given in local time where the exact time zone is not known.
+-- #
+-- # For local dates the date is associated with the corresponding location:
+-- # e.g.:
+-- # valid from date -> location where the journey starts
+-- # valid until date -> location where the journey covered by the ticket ends
+-- #
+-- # there could be rare cases where this does not provide a unique interpretation:
+-- # e.g. open ticket or pass without start and end location for a collection of zones or countries with different time zones.
+-- # in these cases the fare conditions must clarify the rules for these cases (e.g. by allowing to use the
+-- # ticket a few hours after the end of validity).
+-- #
+-- # The difference in days is calculated from dates only, ignoring the time and time zone information.
+-- #
+-- # example 1: (31.12.2017 23:05 UTC == 01.01.2018 00:05 CET) :
+-- # issuing date (UTC): 31.12.2017 23:05 == 01.01.2018 00:05 CET
+-- # issuingYear = 2017
+-- # issuingDay = 365
+-- # issuingTime = 1385
+-- # local departure date (CET): 01.01.2018 00:15 == 31.12.2017 23:15 UTC
+-- # departureDate = 1 (= 01.01.2018 - 31.12.2017)
+-- # departureTime = 15
+-- # departureUTCOffset = -4 (UTC = local + offset * 15 Minutes)
+-- #
+-- #
+-- # example 2: (01.01.2018 00:05 UTC == 31.12.2017 20:05 AST)
+-- # issuing date (UTC): 01.01.2018 00:05 UTC == 31.12.2017 20:05 AST
+-- # issuingYear = 2018
+-- # issuingDay = 1
+-- # issuingTime = 5
+-- # local departure date (AST): 31.12.2017 22:05 AST == 1.1.2018 02:05 UTC
+-- # departureDate = -1 (= 31.12.2017 - 01.01.2018)
+-- # departureTime = 1325
+-- # departureUTCOffset = 16 (UTC = local + offset * 15 Minutes)
+-- #
+-- # departureDate can become -1 with a departure west of the GMT zone only
+-- #
+-- #
+-- #
+-- #
+-- #
+-- #
+-- # ASN.1 Extensions:
+-- #
+-- # The specification makes use of extension (",...").
+-- # These extensions might be defined in future versions of the UIC specification
+-- # Implementations must support the extension feature of ASN.1, at least they must be able to ignore extensions while decoding the data
+-- # ASN.1 extensions will be defined by UIC. It is not allowed to define bilateral extensions.
+-- #
+-- # Bilateral Extensions:
+-- # Bilateral extensions can be included in the data element "ExtensionData".
+-- #
+-- #
+-- #
+-- #########################################################################################
+
+
+-- ############################################################################################
+
+
+-- type assignments
+
+ -- #########################################################################################
+ -- the basic entry point of the data structure
+ -- the data include:
+ -- -issuer informations
+ -- -the details of the transport document
+ -- -informations required for the control process
+ -- -informations on the travelers independent from the transport document
+ -- -proprietary extensions
+ --
+ -- ##########################################################################################
+ UicRailTicketData ::= SEQUENCE {
+ -- data specific to the issuer
+ issuingDetail IssuingData,
+
+ -- data on the travelers
+ travelerDetail TravelerData OPTIONAL,
+
+ -- data of the transport document
+ --!!! proposal: replace this by a comment in the lealet on the total size of the barcode: more than one document to be used on bilateral agreement only
+ transportDocument SEQUENCE OF DocumentData OPTIONAL,
+
+ -- data specific to support the ticket control process
+ controlDetail ControlData OPTIONAL,
+
+ -- proprietary data defined bilaterally
+ extension SEQUENCE OF ExtensionData OPTIONAL
+ ,...
+ }
+
+
+
+ -- ###########################################################################################
+ -- the choice on the different transport documents that can be included in the bar code data:
+ -- - reservation of seat / couchette or berths (IRT, RES, BOA)
+ -- - reservation of car carriage (VET)
+ -- - open ticket (NRT including NRT group ticket) (NRT, GRT, SUP, UPD, COI)
+ -- - Rail passes (including Eurail, Interail and local passes) (RPT)
+ -- - Voucher (TRV)
+ -- - Customer Cards (including bonus cards and reduction cards)
+ -- - counter marks issued for group tickets
+ -- - parking ground tickets
+ -- - FIP tickets
+ -- - station access / station passage tickets
+ -- - proprietary documents as an extension
+ -- ############################################################################################
+ DocumentData ::= SEQUENCE {
+
+ -- token
+ -- specific id to be exchanged with the ticket (e.g. id of the phone in case of tickets linked to a phone)
+ token TokenType OPTIONAL,
+
+ -- choice of the ticket
+ ticket CHOICE
+ {
+
+ -- Reservation (without car carriage) (IRT and RES)
+ reservation ReservationData,
+
+
+ -- Reservation of car carriage
+ carCarriageReservation CarCarriageReservationData,
+
+ -- open ticket specification (NRT)
+ openTicket OpenTicketData,
+
+ -- pass specification (RPT) including Eurail and Interrail
+ pass PassData,
+
+ -- voucher
+ voucher VoucherData,
+
+ -- customer card either to identify a customer and / or to provide reductions
+ customerCard CustomerCardData,
+
+ -- countermark to accompagny a group ticket
+ counterMark CountermarkData,
+
+ -- car parking slot
+ parkingGround ParkingGroundData,
+
+ -- FIP duty ticket
+ fipTicket FIPTicketData,
+
+ -- ticket to pass the gates at a station
+ stationPassage StationPassageData,
+
+ -- proprietary data defined bilaterally
+ extension ExtensionData,
+
+ -- delay confirmation
+ delayConfirmation DelayConfirmation
+
+ ,...
+ }
+ ,...
+ }
+
+ -- ########################################################################################
+ -- confirmation of the delay of a train
+ --
+ -- ########################################################################################
+ DelayConfirmation ::= SEQUENCE {
+
+ -- reference of the delay confirmation
+ referenceIA5 IA5String OPTIONAL,
+ referenceNum INTEGER OPTIONAL,
+
+ -- train number of the delayed train - numeric or alphanumeric
+ trainNum INTEGER OPTIONAL,
+ trainIA5 IA5String OPTIONAL,
+
+ -- departure date of the delayed train in local time
+ -- number of year
+ departureYear INTEGER (2016..2269) OPTIONAL,
+ -- number of the day in the year (1.1. = 1)
+ departureDay INTEGER (1..366) OPTIONAL,
+ departureTime INTEGER (0..1439) OPTIONAL,
+ departureUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC
+ -- (UTC = local + offset * 15 Minutes)
+
+
+ -- station where the delay became relevant
+ stationCodeTable CodeTableType DEFAULT stationUIC,
+ stationNum INTEGER (1..9999999) OPTIONAL,
+ stationIA5 IA5String OPTIONAL,
+
+ -- delay in minutes at the mentioned station
+ delay INTEGER (1..999),
+
+ -- indication that the train was cancelled
+ trainCancelled BOOLEAN,
+
+ -- type of confirmation provided
+ confirmationType ConfirmationType DEFAULT travelerDelayConfirmation,
+
+ -- affected original ticket(s)
+ affectedTickets SEQUENCE OF TicketLinkType OPTIONAL,
+
+ -- info text
+ infoText UTF8String OPTIONAL,
+
+ -- proprietary data defined bilaterally
+ extension ExtensionData OPTIONAL
+ ,...
+ }
+
+ ConfirmationType ::= ENUMERATED {
+ trainDelayConfirmation (0), -- confirmation of train delay, whether the traveler was on board in unconfirmed
+ travelerDelayConfirmation (1), -- confirmation that the traveler was on board of the delayed train
+ trainLinkedTicketDelay (2) -- confirmation that a ticket linked to the delayed train was issued
+ ,...
+ }
+
+
+ -- ########################################################################################
+ -- Details of the issuer and the issue of the ticket
+ -- - details on the issuer
+ -- - indication of test tickets (specimen)
+ -- - payment details: method of payment, currency
+ -- - proprietary PNR of the issuer to be used to identify the sale within
+ -- the issuers ecosystem
+ -- - web link to display more information for the customer
+ -- - proprietary extension data
+ -- ########################################################################################
+ IssuingData ::= SEQUENCE {
+
+ -- provider of the signature (RICS code)
+ securityProviderNum INTEGER (1..32000) OPTIONAL,
+ securityProviderIA5 IA5String OPTIONAL,
+
+ -- issuer of the transport document if the issuer is different from the security provider
+ -- (RICS code)
+ issuerNum INTEGER (1..32000) OPTIONAL,
+ issuerIA5 IA5String OPTIONAL,
+
+ -- issuing time stamp in UTC
+ -- number of year
+ issuingYear INTEGER (2016..2269),
+ -- number of the day in the year (1.1. = 1)
+ issuingDay INTEGER (1..366),
+ -- The number of the minutes of issue might be used in case of account
+ -- based ticketing with a delay of n minutes for the replication of central
+ -- booking data to the control devices (e.g. at SBB)
+ -- The time can be compared with the last synchronization time of
+ -- the control device
+ issuingTime INTEGER (0..1439) OPTIONAL,
+
+ -- name of the issuer (E.g. short name mentioned in RICS code table)
+ issuerName UTF8String OPTIONAL,
+
+ -- specimen indicates a test specimen not valid for travelling
+ specimen BOOLEAN,
+
+ -- secure paper indicates that this barcode is issued with a secure paper ticket
+ -- to ensure the uniqueness of the ticket. This allows to use the same control
+ -- procedure as for e-tickets also for anonymous tickets
+ -- the double use of the ticket is in this case excluded by the secure paper
+ securePaperTicket BOOLEAN,
+
+ -- indicates that the ticket is valid for traveling or still needs activation
+ activated BOOLEAN,
+
+ -- currency of the price: ISO4217 currency codes
+ currency IA5String (SIZE(3)) DEFAULT "EUR",
+
+ -- fraction of the prices included
+ currencyFract INTEGER (1..3) DEFAULT 2,
+
+ -- PNR used by the issuer to identify the document
+ issuerPNR IA5String OPTIONAL,
+
+ -- proprietary data defined bilaterally
+ extension ExtensionData OPTIONAL,
+
+ -- location of sale in case of a sale on board of a train
+ -- numeric train number or alphanumeric id of the train where the ticket was sold
+ issuedOnTrainNum INTEGER OPTIONAL,
+ issuedOnTrainIA5 IA5String OPTIONAL,
+ -- line number
+ issuedOnLine INTEGER OPTIONAL,
+
+ -- point of sale
+ pointOfSale GeoCoordinateType OPTIONAL
+ ,...
+ }
+
+ -- ###################################################################################
+ -- data supporting the control process
+ -- - list of items which the traveler can use to identify himself or the unique
+ -- usage of the ticket
+ -- (card ids, parts or identity card numbers, credit card numbers,..)
+ -- - hints on the validation to be made on board
+ --
+ -- ###################################################################################
+ ControlData ::= SEQUENCE {
+
+ -- cards that can be used to identify the ticket holder
+ identificationByCardReference SEQUENCE OF CardReferenceType OPTIONAL,
+
+ -- id-card id must be checked to identify the traveler
+ identificationByIdCard BOOLEAN,
+
+ -- passport id must be checked to identify the traveler
+ identificationByPassportId BOOLEAN,
+
+ -- other items which could be used to identify the ticket holder
+ -- (for future use, code list to be defined)
+ identificationItem INTEGER OPTIONAL,
+
+ -- validation of the passport is required (e.g. in case of Eurail)
+ passportValidationRequired BOOLEAN,
+
+ -- online validation of the ticket required
+ onlineValidationRequired BOOLEAN,
+
+ -- percentage of the tickets to be validated in more detail
+ -- (i.e. via online check or detailed checks later-on)
+ randomDetailedValidationRequired INTEGER (0..99) OPTIONAL,
+
+ -- manual validation of the traveler age required (in case of reductions)
+ ageCheckRequired BOOLEAN,
+
+ -- manual validation of the travelers reduction card required (in case of reductions)
+ reductionCardCheckRequired BOOLEAN,
+
+ -- controler info text
+ infoText UTF8String OPTIONAL,
+
+ -- additional tickets that should be controlled
+ includedTickets SEQUENCE OF TicketLinkType OPTIONAL,
+
+ -- proprietary data defined bilaterally
+ extension ExtensionData OPTIONAL
+ ,...
+ }
+
+ -- ################################################################################
+ -- Traveler data
+ -- these data do not include tariff details of the booked tariffs,
+ -- tariff data are included in the transport document details and might
+ -- have a reference to the traveler defined here.
+ -- - personal data of the travellers
+ -- - the index of the list can be used to identify the
+ -- traveler within other contexts (e.g. in assigned tariffs)
+ -- ################################################################################
+ TravelerData ::= SEQUENCE {
+ -- traveler list
+ traveler SEQUENCE OF TravelerType OPTIONAL,
+
+ -- ISO 639-1 coding of the language preferred for the traveler / ticket holder
+ preferredLanguage IA5String (SIZE(2)) OPTIONAL,
+
+ -- name of the group in case of a group ticket
+ groupName UTF8String OPTIONAL
+ ,...
+ }
+
+ -- ####################################################################################
+ -- the following part contains the different transport document specifications
+ -- ####################################################################################
+
+
+ -- ####################################################################################
+ -- reservations of seats , couchettes and berths
+ -- included are the data defined in:
+ -- - leaflet 918.1 for reservation data exchange
+ -- - a few additional data currently used by some railways via different interfaces
+ -- - information on trach an dplafoorm where the coach stops
+ -- - additional second coach for large groups
+ -- ####################################################################################
+ ReservationData ::= SEQUENCE {
+
+ -- train number - numeric or alphanumeric
+ trainNum INTEGER OPTIONAL,
+ trainIA5 IA5String OPTIONAL,
+
+ -- departure date in local time
+ -- number of the days calculated from the issuing date
+ departureDate INTEGER (-1..370) DEFAULT 0,
+
+
+ -- reservation reference according ton 918.1 in case ade via Hermes
+ referenceIA5 IA5String OPTIONAL,
+ referenceNum INTEGER OPTIONAL,
+
+ -- organization responsible for the product definition
+ -- (RICS Code to be used as standard)
+ productOwnerNum INTEGER (1..32000) OPTIONAL,
+ productOwnerIA5 IA5String OPTIONAL,
+
+ -- product id to identify the issued product codelist defined by the product owner
+ -- !!! productIdNum extended
+ productIdNum INTEGER (0..65535) OPTIONAL,
+ productIdIA5 IA5String OPTIONAL,
+
+ -- service brand: code list https://uic.org/service-brand-code-list
+ serviceBrand INTEGER (0..32000) OPTIONAL,
+ serviceBrandAbrUTF8 UTF8String OPTIONAL,
+ serviceBrandNameUTF8 UTF8String OPTIONAL,
+
+ -- service code list from 918.1 (seat couchette,..)
+ service ServiceType DEFAULT seat,
+
+ -- code table used to encode stations
+ stationCodeTable CodeTableType DEFAULT stationUICReservation,
+
+ -- origin station code
+ fromStationNum INTEGER (1..9999999) OPTIONAL,
+ fromStationIA5 IA5String OPTIONAL,
+
+ -- destination station code
+ toStationNum INTEGER (1..9999999) OPTIONAL,
+ toStationIA5 IA5String OPTIONAL,
+
+ -- origin station name
+ fromStationNameUTF8 UTF8String OPTIONAL,
+
+ -- destination station name
+ toStationNameUTF8 UTF8String OPTIONAL,
+
+ -- departure time
+ departureTime INTEGER (0..1439),
+ departureUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC
+ -- (UTC = local + offset * 15 Minutes)
+
+ -- arrival date and time in local time
+ -- number of days counted from the departure date
+ -- !!! proposal for change: arrivalDate INTEGER (-1..20) DEFAULT 0,
+ arrivalDate INTEGER (-1..20) DEFAULT 0,
+ arrivalTime INTEGER (0..1439) OPTIONAL,
+ arrivalUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC
+ -- (UTC = local + offset * 15 Minutes)
+ -- should be omitted in case it is the same as for departure
+
+ -- responsible carriers on the route
+ carrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL,
+ carrierIA5 SEQUENCE OF IA5String OPTIONAL,
+
+ -- travel class
+ classCode TravelClassType DEFAULT second,
+
+ -- service level code list from 918.1
+ serviceLevel IA5String (SIZE(1..2)) OPTIONAL,
+
+ -- places
+ places PlacesType OPTIONAL,
+
+ -- additional places in a second coach
+ additionalPlaces PlacesType OPTIONAL,
+
+ --bicycle places
+ bicyclePlaces PlacesType OPTIONAL,
+
+ -- compartment details (open space, wheelchair,..)
+ compartmentDetails CompartmentDetailsType OPTIONAL,
+
+ -- number of persons on the ticket without place numbers (on IRT)
+ numberOfOverbooked INTEGER (0..200) DEFAULT 0,
+
+ -- description of berths
+ berth SEQUENCE OF BerthDetailData OPTIONAL,
+
+ -- tariffs included (Adult, Children,... )
+ tariff SEQUENCE OF TariffType OPTIONAL,
+
+ -- type of the price (supplement,... )
+ priceType PriceTypeType DEFAULT travelPrice,
+
+ price INTEGER OPTIONAL,
+
+ vatDetail SEQUENCE OF VatDetailType OPTIONAL,
+
+ -- type of supplement - code list from 018.1
+ typeOfSupplement INTEGER (0..9) DEFAULT 0,
+
+ numberOfSupplements INTEGER (0..200) DEFAULT 0,
+
+ -- luggage restrictions and registered luggage
+ -- in case the luggage restrictions are general and do not depend on the
+ -- ticket type they should not be included
+ luggage LuggageRestrictionType OPTIONAL,
+
+ infoText UTF8String OPTIONAL,
+
+
+ -- bilaterally agreed proprietary extension
+ extension ExtensionData OPTIONAL
+ ,...
+ }
+
+ -- #################################################################################
+ -- details on the VAT included to be used in after sale processes
+ -- #################################################################################
+ VatDetailType ::= SEQUENCE {
+
+ -- ISO 3166 numeric country code
+ country INTEGER (1..999),
+
+ -- 1/10th of a percent
+ percentage INTEGER (0..999),
+
+ -- amount of VAT, the currency and the currency fraction is included in the issuing data
+ amount INTEGER OPTIONAL,
+
+ -- european tax id of the company paying VAT
+ vatId IA5String OPTIONAL
+
+ }
+
+
+ -- #################################################################################
+ -- reservations of car carriage
+ -- included are the data defined in:
+ -- - leaflet 918.1 for reservation data exchange
+ -- - a few additional data currently used by some railways via different interfaces
+ -- #################################################################################
+ CarCarriageReservationData ::= SEQUENCE {
+
+ trainNum INTEGER OPTIONAL,
+ trainIA5 IA5String OPTIONAL,
+
+
+ -- loading / unloading of the car in local date and time
+ -- number of the days calculated from the issuing date
+ beginLoadingDate INTEGER (-1..370) DEFAULT 0,
+ beginLoadingTime INTEGER (0..1439) OPTIONAL,
+ endLoadingTime INTEGER (0..1439) OPTIONAL,
+ loadingUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC
+ -- (UTC = local + offset * 15 Minutes)
+
+
+ -- reservation reference according on 918.1 in case ade via Hermes
+ referenceIA5 IA5String OPTIONAL,
+ referenceNum INTEGER OPTIONAL,
+
+ -- organization responsible for the product definition
+ -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique)
+ productOwnerNum INTEGER (1..32000) OPTIONAL,
+ productOwnerIA5 IA5String OPTIONAL,
+
+ -- product id to identify the issued product codelist defined by the product owner
+ -- !!! productIdNum extended
+ productIdNum INTEGER (0..65535) OPTIONAL,
+ productIdIA5 IA5String OPTIONAL,
+
+ -- service brand: code list https://uic.org/service-brand-code-list
+ serviceBrand INTEGER (1..32000) OPTIONAL,
+ serviceBrandAbrUTF8 UTF8String OPTIONAL,
+ serviceBrandNameUTF8 UTF8String OPTIONAL,
+
+ stationCodeTable CodeTableType DEFAULT stationUICReservation,
+
+ fromStationNum INTEGER (1..9999999) OPTIONAL,
+ fromStationIA5 IA5String OPTIONAL,
+
+ toStationNum INTEGER (1..9999999) OPTIONAL,
+ toStationIA5 IA5String OPTIONAL,
+
+ fromStationNameUTF8 UTF8String OPTIONAL,
+ toStationNameUTF8 UTF8String OPTIONAL,
+
+ coach IA5String OPTIONAL,
+ place IA5String OPTIONAL,
+
+ compartmentDetails CompartmentDetailsType OPTIONAL,
+
+ -- description of the car
+ numberPlate IA5String,
+ trailerPlate IA5String OPTIONAL,
+ carCategory INTEGER (0..9),
+ boatCategory INTEGER (0..6) OPTIONAL,
+ textileRoof BOOLEAN,
+ roofRackType RoofRackType DEFAULT norack,
+
+ -- height of a roof rack in cm
+ roofRackHeight INTEGER (0..99) OPTIONAL,
+
+ -- number of boats on a rack
+ attachedBoats INTEGER (0..2) OPTIONAL,
+
+ -- number of biycles on a rack
+ attachedBicycles INTEGER (0..4) OPTIONAL,
+
+ -- number of surf boards on a rack
+ attachedSurfboards INTEGER (0..5) OPTIONAL,
+
+ -- reference to an entry on the loading list
+ loadingListEntry INTEGER (0..999) OPTIONAL,
+ loadingDeck LoadingDeckType DEFAULT upper,
+
+ -- responsible carriers on the route (RICS codes)
+ carrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL,
+ carrierIA5 SEQUENCE OF IA5String OPTIONAL,
+
+ tariff TariffType,
+ priceType PriceTypeType DEFAULT travelPrice,
+
+ price INTEGER OPTIONAL,
+
+ vatDetail SEQUENCE OF VatDetailType OPTIONAL,
+
+ infoText UTF8String OPTIONAL,
+ extension ExtensionData OPTIONAL
+ ,...
+ }
+
+
+ -- #####################################################################################
+ -- data for open tickets (NRT and group tickets)
+ -- included are the data defined in:
+ -- - the ticket layout (leaflet 918.8)
+ -- - the ticket bar code version 3 (leaflet 918.9)
+ -- - additional data based on 108.1 with some extensions as 108.1
+ -- does not provide well structured data,
+ -- especially concerning regional validity
+ --
+ -- #####################################################################################
+
+ OpenTicketData ::= SEQUENCE {
+
+ -- reference must be given either in numeric or alphanumeric format
+ referenceNum INTEGER OPTIONAL,
+ referenceIA5 IA5String OPTIONAL,
+
+ -- organization responsible for the product definition
+ -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique)
+ productOwnerNum INTEGER (1..32000) OPTIONAL,
+ productOwnerIA5 IA5String OPTIONAL,
+
+ -- product id to identify the issued product codelist defined by the product owner
+ -- !!! productIdNum extended
+ productIdNum INTEGER (0..65535) OPTIONAL,
+ productIdIA5 IA5String OPTIONAL,
+
+ -- to support other ticket content (e.g. VDV, UTPF, V�V, CALYPSO)
+ -- issuer code using the default code table of the product owner
+ extIssuerId INTEGER OPTIONAL,
+ -- authorization id provided to the issuer by the product owner
+ issuerAutorizationId INTEGER OPTIONAL,
+
+ -- ticket includes the return trip - should be set to false if it is not relevant (e.g. zones)
+ returnIncluded BOOLEAN,
+
+ -- for tickets valid in regions without from or to stations no station is provided
+ stationCodeTable CodeTableType DEFAULT stationUIC,
+ fromStationNum INTEGER (1..9999999) OPTIONAL,
+ fromStationIA5 IA5String OPTIONAL,
+
+ -- for tickets valid in regions without from or to stations no station is provided
+ toStationNum INTEGER (1..9999999) OPTIONAL,
+ toStationIA5 IA5String OPTIONAL,
+
+ fromStationNameUTF8 UTF8String OPTIONAL,
+ toStationNameUTF8 UTF8String OPTIONAL,
+
+ -- description for manual evaluation in case structured data are not available
+ validRegionDesc UTF8String OPTIONAL,
+ -- specification of the ordered sequence of valid regions
+ validRegion SEQUENCE OF RegionalValidityType OPTIONAL,
+
+ -- return route description
+ -- the return route description can be omitted if it is identical to the
+ -- inversed outbound validRegion sequence
+ returnDescription ReturnRouteDescriptionType OPTIONAL,
+
+ -- temporal validity data in local time of the location where the journey starts
+ -- number of days from issuing date
+ validFromDay INTEGER (-1..700) DEFAULT 0,
+ validFromTime INTEGER (0..1439) OPTIONAL,
+ validFromUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC
+ -- (UTC = local + offset * 15 Minutes)
+
+ -- number of days from valid-from date, 0 = first day of validity
+ validUntilDay INTEGER (-1..370) DEFAULT 0,
+ validUntilTime INTEGER (0..1439) OPTIONAL,
+ validUntilUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC
+ -- (UTC = local + offset * 15 Minutes)
+ -- should be omitted in case it is the same as for departure
+
+ -- travel days of a ticket might be subject to a separate activation to be valid for traveling
+ -- here it is possible to list the activated days of the ticket:
+ -- list of activated days in case the entire ticket is not activated
+ -- the day is given by the number of days from the first day of validity
+ -- change in V2 1 -> 0..370
+ -- 0 = first day of validity
+ activatedDay SEQUENCE OF INTEGER (0..370) OPTIONAL,
+
+ classCode TravelClassType DEFAULT second,
+
+ -- servicelevel code according to leaflet 918.1 to encode other products
+ -- (e.g. PREMIUM, ...)
+ serviceLevel IA5String (SIZE(1..2)) OPTIONAL,
+
+ -- carriers involved in the transport (RICS codes)
+ -- the indication of carriers is mandatory on international routes, they can be
+ -- listed here but can also be included in viaDetails
+ carrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL,
+ carrierIA5 SEQUENCE OF IA5String OPTIONAL,
+
+
+ -- list of service brands for which the ticket is valid
+ -- in case the included service brands are listed all other brands are excluded
+ -- service brand: code list https://uic.org/service-brand-code-list
+ includedServiceBrands SEQUENCE OF INTEGER (1..32000) OPTIONAL,
+
+ -- list of service brands for which the ticket is not valid
+ -- service brand: code list https://uic.org/service-brand-code-list
+ excludedServiceBrands SEQUENCE OF INTEGER (1..32000) OPTIONAL,
+
+ tariffs SEQUENCE OF TariffType OPTIONAL,
+
+ price INTEGER OPTIONAL,
+
+ vatDetail SEQUENCE OF VatDetailType OPTIONAL,
+
+ infoText UTF8String OPTIONAL,
+
+ -- additional included open tickets
+ -- e.g. to include local city traffic on parts of a the route
+ includedAddOns SEQUENCE OF IncludedOpenTicketType OPTIONAL,
+
+ -- in case the luggage restrictions are general and do not depend
+ -- on the ticket type they should not be included
+ luggage LuggageRestrictionType OPTIONAL,
+
+ -- included or excluded transport modes
+ -- code list: EN 1545-1 (transport type code)
+ -- new data elements
+ includedTransportType SEQUENCE OF INTEGER (0..31) OPTIONAL,
+ excludedTransportType SEQUENCE OF INTEGER (0..31) OPTIONAL,
+
+ extension ExtensionData OPTIONAL
+ ,...
+ }
+
+
+
+ -- ####################################################################################
+ -- data for passes
+ -- included are the data defined in:
+ -- - the ticket layout (leaflet 918.8)
+ -- - the ticket bar code version 3 (leaflet 918.8)
+ -- ####################################################################################
+ PassData ::= SEQUENCE {
+
+ -- reference must be given in numeric or alphanumeric format
+ referenceNum INTEGER OPTIONAL,
+ referenceIA5 IA5String OPTIONAL,
+
+ -- organization responsible for the product definition
+ -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique)
+ productOwnerNum INTEGER (1..32000) OPTIONAL,
+ productOwnerIA5 IA5String OPTIONAL,
+
+ -- product id to identify the issued product codelist defined by the product owner
+ -- !!! productIdNum extended
+ productIdNum INTEGER (0..65535) OPTIONAL,
+ productIdIA5 IA5String OPTIONAL,
+
+ -- type of the pass, code list provided by the product owner
+ -- in case of Eurail:
+ -- 1 = Interrail
+ -- 2 = Eurail
+ -- 3 = Eurail Global (all countries)
+ passType INTEGER (1..250) OPTIONAL,
+
+ -- literal name of the pass
+ passDescription UTF8String OPTIONAL,
+
+ classCode TravelClassType DEFAULT second,
+
+ -- begin of validity (local time)
+ -- number of days from issuing date
+ validFromDay INTEGER (-1..700) DEFAULT 0,
+ validFromTime INTEGER (0..1439) OPTIONAL,
+ validFromUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC
+ -- (UTC = local + offset * 15 Minutes)
+
+ -- end of validity (local time)
+ -- number of days from valid from day, 0 = valid on valid-from-date
+ validUntilDay INTEGER (-1..370) DEFAULT 0,
+ validUntilTime INTEGER (0..1439) OPTIONAL,
+ validUntilUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC
+ -- (UTC = local + offset * 15 Minutes)
+ -- should be omitted in case it is the same as for departure
+
+
+
+ -- additional validity periods and excluded time ranges
+ validityPeriodDetails ValidityPeriodDetailType OPTIONAL,
+
+ -- max number of days of validity in case the valid from day is open
+ numberOfValidityDays INTEGER (0..370) OPTIONAL,
+
+ -- max number of possible trips to be activated
+ numberOfPossibleTrips INTEGER (1..250) OPTIONAL,
+ numberOfDaysOfTravel INTEGER (1..250) OPTIONAL,
+
+ -- list of activated days in case the entire ticket is not activated
+ -- the day is given by the number of days from the first day of validity
+ -- 0 = first day of validity
+ activatedDay SEQUENCE OF INTEGER (0..370) OPTIONAL,
+
+ -- included countries, code table according to UIC leaflet 918.9
+ countries SEQUENCE OF INTEGER (1..250) OPTIONAL,
+
+ -- included carriers (RICS codes)
+ includedCarrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL,
+ includedCarrierIA5 SEQUENCE OF IA5String OPTIONAL,
+
+ -- excluded carriers (RICS codes)
+ excludedCarrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL,
+ excludedCarrierIA5 SEQUENCE OF IA5String OPTIONAL,
+
+ -- service brand: code list https://uic.org/service-brand-code-list
+ includedServiceBrands SEQUENCE OF INTEGER (1..32000) OPTIONAL,
+ excludedServiceBrands SEQUENCE OF INTEGER (1..32000) OPTIONAL,
+
+ -- region description to cover local zones
+ validRegion SEQUENCE OF RegionalValidityType OPTIONAL,
+
+ tariffs SEQUENCE OF TariffType OPTIONAL,
+
+ price INTEGER OPTIONAL,
+
+ vatDetail SEQUENCE OF VatDetailType OPTIONAL,
+
+ infoText UTF8String OPTIONAL,
+ extension ExtensionData OPTIONAL
+ ,...
+ }
+
+ ValidityPeriodDetailType ::= SEQUENCE {
+ validityPeriod SEQUENCE OF ValidityPeriodType OPTIONAL,
+ excludedTimeRange SEQUENCE OF TimeRangeType OPTIONAL
+ }
+
+ ValidityPeriodType ::= SEQUENCE {
+ -- number of days from issuing date (local date)
+ validFromDay INTEGER (-1..700) DEFAULT 0,
+ validFromTime INTEGER (0..1439) OPTIONAL,
+ validFromUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC
+ -- (UTC = local + offset * 15 Minutes)
+
+ -- number of days from valid from day, 0 = valid on valid from date
+ validUntilDay INTEGER (-1..370) DEFAULT 0,
+ validUntilTime INTEGER (0..1439) OPTIONAL,
+ validUntilUTCOffset INTEGER (-60..60) OPTIONAL -- offset in units of 15 minutes from local time to UTC
+ -- (UTC = local + offset * 15 Minutes)
+ -- should be omitted in case it is the same as for departure
+
+ }
+
+ TimeRangeType ::= SEQUENCE {
+ fromTime INTEGER (0..1439),
+ untilTime INTEGER (0..1439)
+ }
+
+ -- ######################################################################################
+ -- data for vouchers
+ -- included are quite basic further study is required
+ -- ######################################################################################
+ VoucherData ::= SEQUENCE {
+
+ -- reference must be given in numeric or alphanumeric format
+ referenceIA5 IA5String OPTIONAL,
+ referenceNum INTEGER OPTIONAL,
+
+ -- organization responsible for the product definition
+ -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique)
+ productOwnerNum INTEGER (1..32000) OPTIONAL,
+ productOwnerIA5 IA5String OPTIONAL,
+
+ -- product id to identify the issued product codelist defined by the product owner
+ -- !!! productIdNum extended
+ productIdNum INTEGER (0..65535) OPTIONAL,
+ productIdIA5 IA5String OPTIONAL,
+
+ -- begin of validity in UTC
+ -- number of year
+ validFromYear INTEGER (2016..2269),
+ -- number of the day in the year (1.1. = 1)
+ validFromDay INTEGER (0..370),
+ -- end of validity
+ -- number of year
+ validUntilYear INTEGER (2016..2269),
+ -- number of the day in the year (1.1. = 1)
+ validUntilDay INTEGER (0..370),
+
+ value INTEGER DEFAULT 0,
+
+ -- type of the voucher, code list defined by the product owner
+ type INTEGER (1..32000) OPTIONAL,
+
+ infoText UTF8String OPTIONAL,
+ extension ExtensionData OPTIONAL
+ ,...
+ }
+ -- ###################################################################################
+ -- data for FIP tickets
+ -- included are data from the FIP ticket layout,
+ -- ###################################################################################
+ FIPTicketData ::= SEQUENCE {
+
+ -- reference must be given in numeric or alphanumeric format
+ referenceIA5 IA5String OPTIONAL,
+ referenceNum INTEGER OPTIONAL,
+
+ -- organization responsible for the product definition
+ -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique)
+ productOwnerNum INTEGER (1..32000) OPTIONAL,
+ productOwnerIA5 IA5String OPTIONAL,
+
+ -- product id to identify the issued product codelist defined by the product owner
+ -- !!! productIdNum extended
+ productIdNum INTEGER (0..65535) OPTIONAL,
+ productIdIA5 IA5String OPTIONAL,
+
+ -- first day of validity in UTC
+ --- number of days from issuing date
+ validFromDay INTEGER (-1..700) DEFAULT 0,
+ -- last day of validity
+ -- number of days from valid from day, 0 = first day of validity
+ validUntilDay INTEGER (-1..370) DEFAULT 0,
+
+ -- activated days: list of days for which the ticket is valid
+ -- the day is given by the number of days from the first day of validity
+ -- 0 = first day of validity
+ activatedDay SEQUENCE OF INTEGER (0..370) OPTIONAL,
+
+ -- included carriers
+ carrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL,
+ carrierIA5 SEQUENCE OF IA5String OPTIONAL,
+
+ -- number of travel days allowed
+ numberOfTravelDays INTEGER (1..200),
+ includesSupplements BOOLEAN,
+
+ -- travel class
+ classCode TravelClassType DEFAULT second,
+ extension ExtensionData OPTIONAL
+ ,...
+ }
+
+ -- #####################################################################################
+ -- data station passage and access
+ -- ticket used to enter, exit or pass a station without travelling by train.
+ -- E.g. for staff working in a station.
+ -- #####################################################################################
+ StationPassageData ::= SEQUENCE {
+
+ -- reference must be given in numeric or alphanumeric format
+ referenceIA5 IA5String OPTIONAL,
+ referenceNum INTEGER OPTIONAL,
+
+ -- organization responsible for the product definition
+ -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique)
+ productOwnerNum INTEGER (1..32000) OPTIONAL,
+ productOwnerIA5 IA5String OPTIONAL,
+
+ -- product id to identify the issued product codelist defined by the product owner
+ -- !!! productIdNum extended
+ productIdNum INTEGER (0..65535) OPTIONAL,
+ productIdIA5 IA5String OPTIONAL,
+
+ productName UTF8String OPTIONAL,
+
+ -- code table used to encode he stations
+ stationCodeTable CodeTableType DEFAULT stationUIC,
+ -- list of station where the passage is allowed
+ stationNum SEQUENCE OF INTEGER OPTIONAL,
+ stationIA5 SEQUENCE OF IA5String OPTIONAL,
+ -- station names
+ stationNameUTF8 SEQUENCE OF UTF8String OPTIONAL,
+
+ -- list of areas in a station where the access is allowed
+ areaCodeNum SEQUENCE OF INTEGER OPTIONAL,
+ areaCodeIA5 SEQUENCE OF IA5String OPTIONAL,
+ -- area names
+ areaNameUTF8 SEQUENCE OF UTF8String OPTIONAL,
+
+ -- begin of validity in local date and time
+ -- number of days from issuing date
+ validFromDay INTEGER (-1..700),
+ validFromTime INTEGER (0..1439) OPTIONAL,
+ validFromUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC
+ -- (UTC = local + offset * 15 Minutes)
+
+ -- end of validity
+ -- number of days from valid from day, 0 = first day of validity
+ validUntilDay INTEGER (-1..370) DEFAULT 0,
+ validUntilTime INTEGER (0..1439) OPTIONAL,
+ validUntilUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC
+ -- (UTC = local + offset * 15 Minutes)
+ -- should be omitted in case it is the same as for departure
+
+
+ -- number of days for station passage in case the number of days
+ -- is limited and less that the validity period
+ numberOfDaysValid INTEGER OPTIONAL,
+
+ extension ExtensionData OPTIONAL
+ ,...
+ }
+
+ -- ######################################################################################
+ -- data for customer cards
+ -- included are data from:
+ -- - �BB requirements on card data
+ -- - DB Bahncard as HandyTicket
+ -- note: customer data are included in the traveler data structure
+ -- ######################################################################################
+ CustomerCardData ::= SEQUENCE {
+
+ -- customer details
+ -- optional, as there might be an anonymous cards
+ customer TravelerType OPTIONAL,
+
+ -- card id might be numerical or alphanumerical
+ cardIdIA5 IA5String OPTIONAL,
+ cardIdNum INTEGER OPTIONAL,
+
+ -- valid from date in UTC
+ -- number of year
+ validFromYear INTEGER (2016..2269),
+ --- number of the day in the year (1.1. = 1)
+ validFromDay INTEGER (0..370) OPTIONAL,
+
+ --- number of year from valid from year onwards
+ validUntilYear INTEGER (0..250) DEFAULT 0,
+ --- number of the day in the year (1.1. = 1)
+ validUntilDay INTEGER (0..370) OPTIONAL,
+
+ classCode TravelClassType OPTIONAL,
+
+ -- code of the card type code list defined by the issuer
+ cardType INTEGER (1..1000) OPTIONAL,
+
+ -- readable description of the card type
+ cardTypeDescr UTF8String OPTIONAL,
+
+ -- customer status code
+ -- 1 = basic
+ -- 2 = premium
+ -- 3 = silver
+ -- 4 = gold
+ -- 5 = platinum
+ -- 6 = senator
+ -- > 50 - code table of the card issuer
+ customerStatus INTEGER OPTIONAL,
+
+ -- readable customer status "e.g. gold",
+ customerStatusDescr IA5String OPTIONAL,
+
+ -- list of included services,
+ -- 1 = Rail Plus
+ -- 2 = access to launch
+ -- > 50 code list of the issuer
+ includedServices SEQUENCE OF INTEGER OPTIONAL,
+
+ extension ExtensionData OPTIONAL
+ ,...
+ }
+
+ -- ######################################################################################
+ -- data for customer cards
+ -- included are data from:
+ -- - DB parking ground reservation
+ -- #######################################################################################
+ ParkingGroundData ::= SEQUENCE {
+
+ -- booking reference
+ referenceIA5 IA5String OPTIONAL,
+ referenceNum INTEGER OPTIONAL,
+
+ parkingGroundId IA5String,
+
+ -- parking date in local date time
+ -- number of days from the issuing date
+ fromParkingDate INTEGER (-1..370),
+ -- number of days from the from parking date in case it is different from that date
+ untilParkingDate INTEGER (0..370) DEFAULT 0,
+
+ -- organization responsible for the product definition
+ -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique)
+ productOwnerNum INTEGER (1..32000) OPTIONAL,
+ productOwnerIA5 IA5String OPTIONAL,
+
+ -- product id to identify the issued product codelist defined by the product owner
+ -- !!! productIdNum extended
+ productIdNum INTEGER (0..65535) OPTIONAL,
+ productIdIA5 IA5String OPTIONAL,
+
+ -- code needed to access the parking lot
+ accessCode IA5String OPTIONAL,
+
+ location UTF8String,
+
+ stationCodeTable CodeTableType DEFAULT stationUIC,
+ -- in case the parking ground is associated with a station
+ stationNum INTEGER OPTIONAL,
+ stationIA5 UTF8String OPTIONAL,
+
+ specialInformation UTF8String OPTIONAL,
+ entryTrack UTF8String OPTIONAL,
+ numberPlate IA5String OPTIONAL,
+
+ price INTEGER OPTIONAL,
+ vatDetail SEQUENCE OF VatDetailType OPTIONAL,
+
+
+ extension ExtensionData OPTIONAL
+ ,...
+ }
+
+ -- #######################################################################
+ -- data for countermarks issued with group tickets
+ -- included are data from:
+ -- - version 3 bar code (leaflet 918.9)
+ -- - printed layout (leaflet 918.8)
+ -- ########################################################################
+ CountermarkData ::= SEQUENCE {
+
+ referenceIA5 IA5String OPTIONAL,
+ referenceNum INTEGER OPTIONAL,
+
+ -- organization responsible for the product definition
+ -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique)
+ productOwnerNum INTEGER (1..32000) OPTIONAL,
+ productOwnerIA5 IA5String OPTIONAL,
+
+ -- product id to identify the issued product codelist defined by the product owner
+ -- !!! productIdNum extended
+ productIdNum INTEGER (0..65535) OPTIONAL,
+ productIdIA5 IA5String OPTIONAL,
+
+ -- reference of the group ticket
+ ticketReferenceIA5 IA5String OPTIONAL,
+ ticketReferenceNum INTEGER OPTIONAL,
+
+ -- sequential number of the countermark
+ numberOfCountermark INTEGER (1..200),
+ -- total number of countermarks
+ totalOfCountermarks INTEGER (1..200),
+ -- name of the group
+ groupName UTF8String,
+
+
+ stationCodeTable CodeTableType DEFAULT stationUIC,
+
+ fromStationNum INTEGER (1..9999999) OPTIONAL,
+ fromStationIA5 IA5String OPTIONAL,
+
+ toStationNum INTEGER (1..9999999) OPTIONAL,
+ toStationIA5 IA5String OPTIONAL,
+
+ fromStationNameUTF8 UTF8String OPTIONAL,
+ toStationNameUTF8 UTF8String OPTIONAL,
+
+ -- description for manual evaluation in case structured data are not available
+ validRegionDesc UTF8String OPTIONAL,
+ -- specification of the ordered sequence of valid regions
+ validRegion SEQUENCE OF RegionalValidityType OPTIONAL,
+
+
+ -- ticket includes the return trip
+ returnIncluded BOOLEAN,
+ -- retrurn route description
+ -- can be omitted if it is identical to the inversed outbound validRegion sequence
+ returnDescription ReturnRouteDescriptionType OPTIONAL,
+
+ -- local date
+ -- number of days from issuing date
+ validFromDay INTEGER (-1..700) DEFAULT 0,
+ validFromTime INTEGER (0..1439) OPTIONAL,
+ validFromUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC
+ -- (UTC = local + offset * 15 Minutes)
+
+
+
+ -- number of days from valid from day, 0 = first day of validity
+ validUntilDay INTEGER (-1..370) DEFAULT 0,
+ validUntilTime INTEGER (0..1439) OPTIONAL,
+ validUntilUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC
+ -- (UTC = local + offset * 15 Minutes)
+ -- should be omitted in case it is the same as for departure
+
+
+ classCode TravelClassType DEFAULT second,
+
+ -- valid carriers
+ carrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL,
+ carrierIA5 SEQUENCE OF IA5String OPTIONAL,
+
+ -- service brands where the ticket is valid
+ -- in case this list is provided the ticket is invalid on all other service brands
+ -- service brand: code list https://uic.org/service-brand-code-list
+ includedServiceBrands SEQUENCE OF INTEGER (1..32000) OPTIONAL,
+
+ -- service brands where the ticket is not valid
+ -- in case this list is provided the ticket is valid on all other service brands
+ excludedServiceBrands SEQUENCE OF INTEGER (1..32000) OPTIONAL,
+
+ infoText UTF8String OPTIONAL,
+
+ extension ExtensionData OPTIONAL
+ ,...
+ }
+
+
+ -- ###########################################################################################
+ -- generic non standard extension element
+ -- the generic non - standard element contains:
+ -- - an extension id to distinguish different extensions
+ -- - the extension data as binary data
+ -- proprietary extensions are by definition proprietary. This standard provides
+ -- the means to identify these extensions
+ -- within the data and to skip these data.
+ -- the evaluation of these data and the unique identification of the extensions
+ -- via the extension id is in the
+ -- responsibility of the railways which use these extensions.
+ -- ###########################################################################################
+ ExtensionData ::= SEQUENCE {
+ extensionId IA5String,
+ extensionData OCTET STRING
+ }
+
+ -- ############################################################################################
+ -- type definitions
+ -- ############################################################################################
+
+ -- #############################################################################################
+ -- included open ticke for a part of the travel (e.g. local city trafic)
+ -- - data identically already included in the covering open ticket do not need to be
+ -- repeated here
+ -- - main source are the data required for included regional and city traffic tickets
+ -- #############################################################################################
+ IncludedOpenTicketType ::= SEQUENCE {
+
+ -- organization responsible for the product definition
+ -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique)
+ productOwnerNum INTEGER (1..32000) OPTIONAL,
+ productOwnerIA5 IA5String OPTIONAL,
+
+ -- product id to identify the issued product codelist defined by the product owner
+ -- !!! productIdNum extended
+ productIdNum INTEGER (0..65535) OPTIONAL,
+ productIdIA5 IA5String OPTIONAL,
+
+ -- issuer code using the default code table of the product owner (today used e.g. by VDV)
+ externalIssuerId INTEGER OPTIONAL,
+ -- authorization id provided to the issuer by the poroduct owner (today used e.g. by VDV)
+ issuerAutorizationId INTEGER OPTIONAL,
+
+ -- regional validity data
+ stationCodeTable CodeTableType DEFAULT stationUIC,
+ -- specification of the ordered sequence of valid regions, ordered in the direction of travel
+ validRegion SEQUENCE OF RegionalValidityType OPTIONAL,
+
+ -- temporal validity data in local date and time
+ -- number of days from issuing date
+ validFromDay INTEGER (-1..700) DEFAULT 0,
+ validFromTime INTEGER (0..1439) OPTIONAL,
+ validFromUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC
+ -- (UTC = local + offset * 15 Minutes)
+
+
+ -- number of days from valid-from date, 0 = first day of validity
+ validUntilDay INTEGER (-1..370) DEFAULT 0,
+ validUntilTime INTEGER (0..1439) OPTIONAL,
+ validUntilUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC
+ -- (UTC = local + offset * 15 Minutes)
+ -- should be omitted in case it is the same as for departure
+
+
+ -- travel class to be given in case it differs from the class of the main ticket
+ classCode TravelClassType OPTIONAL,
+ -- servicelevel code according to leaflet 918.1 to encode other products (e.g. PREMIUM, ...)
+ -- to be provided in case it differs from the main ticket
+ serviceLevel IA5String (SIZE(1..2)) OPTIONAL,
+
+ -- valid carriers (RICS codes)
+ carrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL,
+ carrierIA5 SEQUENCE OF IA5String OPTIONAL,
+
+ -- service brands where the ticket is valid
+ -- in case this list is provided the ticket is invalid on all other service brands
+ -- service brand: code list https://uic.org/service-brand-code-list
+ includedServiceBrands SEQUENCE OF INTEGER (1..32000) OPTIONAL,
+
+ -- service brands where the ticket is not valid
+ -- in case this list is provided the ticket is valid on all other service brands
+ excludedServiceBrands SEQUENCE OF INTEGER (1..32000) OPTIONAL,
+
+ tariffs SEQUENCE OF TariffType OPTIONAL,
+ infoText UTF8String OPTIONAL,
+
+ -- included or excluded transport modes
+ -- code list: EN 1545-1 (transport type code)
+ -- !!! new data elements
+ includedTransportType SEQUENCE OF INTEGER (0..31) OPTIONAL,
+ excludedTransportType SEQUENCE OF INTEGER (0..31) OPTIONAL,
+
+ extension ExtensionData OPTIONAL
+ ,...
+ }
+
+ -- ######################################################################################
+ -- tariff data for open tickets
+ -- information included are:
+ -- - number of passengers
+ -- - optionally a link to the traveler data
+ -- #######################################################################################
+ TariffType ::= SEQUENCE {
+
+ -- number of passengers using the tariff
+ numberOfPassengers INTEGER (1..200) DEFAULT 1,
+
+ -- type indication youth, adult, senior,..
+ passengerType PassengerType OPTIONAL,
+
+ -- age restrictions of the tariff
+ ageBelow INTEGER (1..64) OPTIONAL,
+ ageAbove INTEGER (1..128) OPTIONAL,
+
+
+ -- named traveler list
+ -- link to the traveler in case the travelers have to be named (e.g. Eurail passes)
+ -- the number indicates the position in the traveler list starting from 1
+ -- change V2 0 -> 1..
+ travelerid SEQUENCE OF INTEGER (1..254) OPTIONAL,
+
+ -- restriction on country of residence
+ -- this tariff is restricted by the country of residence given in the traveler data
+ -- (e.g. Eurail tickets are not valid in the contry of residence)
+ restrictedToCountryOfResidence BOOLEAN,
+
+ -- section in case the tariff applies to a part of the route only
+ restrictedToRouteSection RouteSectionType OPTIONAL,
+
+ -- details on series according to leaflet 108.1
+ seriesDataDetails SeriesDetailType OPTIONAL,
+
+ -- tariff code
+ tariffIdNum INTEGER OPTIONAL,
+ tariffIdIA5 IA5String OPTIONAL,
+
+ -- tariff description
+ tariffDesc UTF8String OPTIONAL,
+
+ -- reduction cards applied (incl. discount cards, loyalty cards relevant for the tariff)
+ reductionCard SEQUENCE OF CardReferenceType OPTIONAL
+ ,...
+ }
+
+ SeriesDetailType ::= SEQUENCE {
+
+ -- data related to tariffs based on series according UIC leaflet 108.1
+ -- supplying carrier according to UIC leaflet 108.1 (RICS code)
+ supplyingCarrier INTEGER (1..32000) OPTIONAL,
+
+ -- offer identifier of the carrier according to UIC leaflet 108.1
+ offerIdentification INTEGER (1..99) OPTIONAL,
+
+ -- series of the carrier according to UIC leaflet 108.1
+ series INTEGER OPTIONAL
+ }
+
+
+ RouteSectionType ::= SEQUENCE {
+
+ stationCodeTable CodeTableType DEFAULT stationUIC,
+ fromStationNum INTEGER (1..9999999) OPTIONAL,
+ fromStationIA5 IA5String OPTIONAL, -- IA5 or Num not both
+
+ toStationNum INTEGER (1..9999999) OPTIONAL,
+ toStationIA5 IA5String OPTIONAL, -- IA5 or Num not both
+
+ fromStationNameUTF8 UTF8String OPTIONAL,
+ toStationNameUTF8 UTF8String OPTIONAL
+ }
+
+
+ -- #######################################################################################
+ -- customer card reference
+ -- #######################################################################################
+ CardReferenceType ::= SEQUENCE {
+
+ -- issuer of the card
+ -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique)
+ cardIssuerNum INTEGER (1..32000) OPTIONAL,
+ cardIssuerIA5 IA5String OPTIONAL,
+
+ cardIdNum INTEGER OPTIONAL,
+ cardIdIA5 IA5String OPTIONAL,
+
+ -- Name of the card e.g. "VISA-CARD"
+ cardName UTF8String OPTIONAL,
+
+ -- type of the card, code list defined by the issuer
+ cardType INTEGER OPTIONAL,
+
+ -- in case only the leading part of the card number is provided
+ leadingCardIdNum INTEGER OPTIONAL,
+ leadingCardIdIA5 IA5String OPTIONAL,
+
+
+ -- in case only the trailing part of the card number is provided
+ trailingCardIdNum INTEGER OPTIONAL,
+ trailingCardIdIA5 IA5String OPTIONAL
+
+ ,...
+ }
+
+ -- #######################################################################################
+ -- traveler data
+ -- - traveler data might contain all traveler details which are independent
+ -- from the type of travel document
+ -- e.g. it can include the date of birth as this is part of the traveler
+ -- but not the indication "Senior" as this is tariff dependent
+ --
+ -- #######################################################################################
+ TravelerType ::= SEQUENCE {
+
+ firstName UTF8String OPTIONAL,
+ secondName UTF8String OPTIONAL,
+ lastName UTF8String OPTIONAL,
+ idCard IA5String OPTIONAL,
+ passportId IA5String OPTIONAL,
+ title IA5String (SIZE(1..3)) OPTIONAL,
+ gender GenderType OPTIONAL,
+
+ -- customer id might be numerical or alphanumerical
+ customerIdIA5 IA5String OPTIONAL,
+ customerIdNum INTEGER OPTIONAL,
+
+ -- date of birth
+ -- number of year
+ yearOfBirth INTEGER (1901..2155) OPTIONAL,
+ monthOfBirth INTEGER (1..12) OPTIONAL,
+ dayOfBirthInMonth INTEGER (1..31) OPTIONAL,
+
+ -- indicates the ticket holder/group leader in case of groups
+ ticketHolder BOOLEAN,
+
+ passengerType PassengerType OPTIONAL,
+
+ passengerWithReducedMobility BOOLEAN OPTIONAL,
+
+ -- country of residence (numeric ISO country code)
+ -- to be used in case there product restrictions on the country of residence (e.g. Eurail passes)
+ countryOfResidence INTEGER (1..999) OPTIONAL,
+
+ countryOfPassport INTEGER (1..999) OPTIONAL,
+ countryOfIdCard INTEGER (1..999) OPTIONAL,
+
+ status SEQUENCE OF CustomerStatusType OPTIONAL
+ ,...
+ }
+
+ CustomerStatusType ::= SEQUENCE {
+
+ -- compagny providing the status, default is the issuer
+ -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique)
+ statusProviderNum INTEGER (1..32000) OPTIONAL,
+ statusProviderIA5 IA5String OPTIONAL,
+
+ -- customer status code
+ -- 1 = basic
+ -- 2 = premium
+ -- 3 = silver
+ -- 4 = gold
+ -- 5 = platinum
+ -- 6 = senator
+ -- > 50 - code table of the card issuer
+ customerStatus INTEGER OPTIONAL,
+
+ -- customer status "gold"
+ customerStatusDescr IA5String OPTIONAL
+ }
+
+
+ ReturnRouteDescriptionType ::= SEQUENCE {
+
+ fromStationNum INTEGER (1..9999999) OPTIONAL,
+ fromStationIA5 IA5String OPTIONAL,
+
+ toStationNum INTEGER (1..9999999) OPTIONAL,
+ toStationIA5 IA5String OPTIONAL,
+
+ fromStationNameUTF8 UTF8String OPTIONAL,
+ toStationNameUTF8 UTF8String OPTIONAL,
+
+ -- description for manual evaluation in case structured data are not available
+ validReturnRegionDesc UTF8String OPTIONAL,
+
+ -- specification of the ordered sequence of valid regions for the return trip
+ validReturnRegion SEQUENCE OF RegionalValidityType OPTIONAL
+ ,...
+
+ }
+
+ -- ######################################################################################
+ -- regional validity of an open ticket
+ -- specification of the regional validity.
+ -- ######################################################################################
+
+ RegionalValidityType ::= CHOICE {
+ trainLink TrainLinkType,
+ viaStations ViaStationType,
+ zones ZoneType,
+ lines LineType,
+ polygone PolygoneType
+ ,...
+ }
+
+
+
+ -- #######################################################################################
+ -- train link data
+ -- includes a restriction of an open ticket valid only on a specific train
+ -- and date on a part of the route
+ -- #######################################################################################
+ TrainLinkType ::= SEQUENCE {
+
+ trainNum INTEGER OPTIONAL,
+ trainIA5 IA5String OPTIONAL,
+
+ -- local date at the station where the train link starts
+ -- days from the issuing date onwards
+ travelDate INTEGER (-1..370),
+ departureTime INTEGER (0..1439), -- time in minutes
+ departureUTCOffset INTEGER (-60..60) OPTIONAL, -- offset in units of 15 minutes from local time to UTC
+ -- (UTC = local + offset * 15 Minutes)
+
+ fromStationNum INTEGER (1..9999999) OPTIONAL,
+ fromStationIA5 IA5String OPTIONAL,
+
+ toStationNum INTEGER (1..9999999) OPTIONAL,
+ toStationIA5 IA5String OPTIONAL,
+
+ fromStationNameUTF8 UTF8String OPTIONAL,
+ toStationNameUTF8 UTF8String OPTIONAL
+
+ }
+
+
+
+ -- ######################################################################################
+ -- regional validity using a set of lines
+ -- - based on data used in regional city trafic enviromnemnts
+ -- ######################################################################################
+ LineType ::= SEQUENCE {
+
+ -- local service provider / carrier within the zone
+ -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique)
+ carrierNum INTEGER (1..32000) OPTIONAL,
+ carrierIA5 IA5String OPTIONAL,
+
+ -- ids of the valid lines known by the local carriers on that line
+ lineId SEQUENCE OF INTEGER OPTIONAL,
+
+ stationCodeTable CodeTableType DEFAULT stationUIC,
+
+ -- in case the line must be entered via a specific station
+ -- (e.g. local city traffic at the end of a journey
+ -- starting from the main train station)
+ entryStationNum INTEGER (1..9999999) OPTIONAL,
+ entryStationIA5 IA5String OPTIONAL,
+
+ -- in case the line must be left via a specific station
+ -- (e.g. local city trafic at the beginning of a journey
+ -- terminating at the main train station)
+ terminatingStationNum INTEGER (1..9999999) OPTIONAL,
+ terminatingStationIA5 IA5String OPTIONAL,
+
+ -- code of the local city in case the line is part of regional city transport
+ -- code list of the local carrier
+ city INTEGER OPTIONAL
+ ,...
+ }
+
+
+ -- #################################################################################
+ -- regional validity in a zone
+ -- - based on data used in regional city trafic enviromnemnts
+ -- #################################################################################
+ ZoneType ::= SEQUENCE {
+
+ -- local service provider / carrier within the zone
+ -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique)
+ carrierNum INTEGER (1..32000) OPTIONAL,
+ carrierIA5 IA5String OPTIONAL,
+
+ stationCodeTable CodeTableType DEFAULT stationUIC,
+ -- in case the zone must be entered via a specific station
+ -- (e.g. local city traffic at the end of a journey starting
+ -- from the main train station)
+ entryStationNum INTEGER (1..9999999) OPTIONAL,
+ entryStationIA5 IA5String OPTIONAL,
+
+ -- in case the zone must be left via a specific station
+ -- (e.g. local city traffic at the beginning of a journey
+ -- terminating at the main train station)
+ terminatingStationNum INTEGER (1..9999999) OPTIONAL,
+ terminatingStationIA5 IA5String OPTIONAL,
+
+ -- code of the local city in case the zone is part of regional
+ -- city transport code list of the local carrier
+ city INTEGER OPTIONAL,
+
+ -- ids of the valid zones known by the local carriers in that zone
+ zoneId SEQUENCE OF INTEGER OPTIONAL,
+
+ -- binary encoding of zones, encoding specification provided by
+ -- the local service provider
+ binaryZoneId OCTET STRING OPTIONAL,
+
+ -- EU NUTS code for a region
+ nutsCode IA5String OPTIONAL
+ ,...
+ }
+
+
+ -- ##################################################################################
+ -- via station
+ -- includes a description of of the route by via stations.
+ -- Via stations follow the description in leaflet 108.1:
+ -- via stations can e mandatory to pass (but there does not need to be a
+ -- train stop at this stations): visible route description: "*station*"
+ -- there can be a list of alternative routes:
+ -- visible route description: "*(station1/station2)*"
+ -- there can also be alternative routes:
+ -- "*(station1*station2/station3*station4)*" although the
+ -- definition in 108.2 is not very precice on this option
+ -- ###################################################################################
+ ViaStationType ::= SEQUENCE {
+
+ stationCodeTable CodeTableType DEFAULT stationUIC,
+ -- mandatory via station
+ stationNum INTEGER (1..9999999) OPTIONAL,
+ stationIA5 IA5String OPTIONAL,
+
+ -- list of alternative routes, one of these has to be taken
+ alternativeRoutes SEQUENCE OF ViaStationType OPTIONAL,
+
+ -- list of stations along the route
+ route SEQUENCE OF ViaStationType OPTIONAL,
+ border BOOLEAN,
+
+ -- carrier responsible for the transport starting at this station (RICS-Code)
+ -- in case the carrier is included here it might be omitted
+ -- in the carrier list of the region data
+ carrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL,
+ carrierIA5 SEQUENCE OF IA5String OPTIONAL,
+
+ -- the route id as series number as defined in 108.1 data
+ seriesId INTEGER OPTIONAL,
+
+ -- route id of the route code list defined by the carrier on that route
+ routeId INTEGER OPTIONAL
+ ,...
+ }
+
+
+ PolygoneType ::= SEQUENCE {
+ firstEdge GeoCoordinateType,
+ edges SEQUENCE OF DeltaCoordinates
+ }
+
+
+ -- ###########################################################################################
+ -- TokenType provides an additional identifier
+ -- known use cases
+ -- - identified of the mobile phone for tickets linked with a specific phone (e.g. VDV standard)
+ -- ###########################################################################################
+ TokenType ::= SEQUENCE {
+ -- provider of the token
+ tokenProviderNum INTEGER OPTIONAL,
+ tokenProviderIA5 IA5String OPTIONAL,
+
+ -- in case the provider has multiple tokens
+ tokenSpecification IA5String OPTIONAL,
+ token OCTET STRING
+ }
+
+ -- ###########################################################################################
+ -- TicketLinkType is used to define a link from the ticket in the bar code to another ticket
+ -- (requirement from Eurail)
+ -- use cases
+ -- - DB Alleo (open ticket + reservation)
+ -- - reservation of trailer and car carriage and traveller reservation
+ -- - link between open ticket and bicycle reservations or pass
+ -- - open ticket and vouchers for meals
+ -- ###########################################################################################
+ TicketLinkType ::= SEQUENCE {
+
+ -- data to reference the external ticket
+ -- reference must be given in numeric or alphanumeric format
+ referenceIA5 IA5String OPTIONAL,
+ referenceNum INTEGER OPTIONAL,
+
+ issuerName UTF8String OPTIONAL, -- name of the issuer
+
+ issuerPNR IA5String OPTIONAL, -- in case the ticket can also be identified via
+ -- the issuer PNR
+
+ -- organization responsible for the product definition
+ -- (RICS Code / proprietary code in case no RICS code is defined, proprietary codes must ensure to be unique)
+ productOwnerNum INTEGER (1..32000) OPTIONAL,
+ productOwnerIA5 IA5String OPTIONAL,
+
+ -- type of linked ticket
+ ticketType TicketType DEFAULT openTicket,
+
+ -- type of link
+ linkMode LinkMode DEFAULT issuedTogether
+ ,...
+ }
+
+ -- ############################################################################################
+ -- code table used fort station codes
+ -- defines the code table used e.g. to define station code
+ -- - stationUIC = station codes as used in UIC leaflet 108.1 for open tickets
+ -- - stationUICReservation = station codes as used in Reservation leaflets 918.1 and 108.2
+ -- ############################################################################################
+
+ CodeTableType ::= ENUMERATED {
+ -- standard UIC station code from MERITS (UIC country code + 5 digit local code)
+ stationUIC (0),
+ -- standard UIC station code for reservation
+ stationUICReservation (1),
+ -- future standard ERA station code
+ stationERA (2),
+ -- local carrier code list
+ -- e.g. in case of stations / stops of non-railways stops (city traffic)
+ localCarrierStationCodeTable (3),
+
+ -- non standard code to be used within the issuer eco system only
+ -- not applicable for multi carrier travel documents
+ -- or in case issuer and carrier are different
+ proprietaryIssuerStationCodeTable (4)
+
+ }
+
+
+ ServiceType ::= ENUMERATED {
+ seat (0),
+ couchette (1),
+ berth (2),
+ carcarriage (3)
+ }
+
+
+ PassengerType ::= ENUMERATED {
+ adult (0),
+ senior (1),
+ child (2),
+ youth (3),
+ dog (4),
+ bicycle (5),
+ freeAddonPassenger (6),
+ freeAddonChild (7)
+ ,...
+ }
+
+ TicketType ::= ENUMERATED {
+ openTicket (0),
+ pass (1),
+ reservation (2),
+ carCarriageReservation (3)
+ ,...
+ }
+
+ LinkMode ::= ENUMERATED {
+ issuedTogether (0),
+ onlyValidInCombination (1)
+ ,...
+ }
+
+
+ -- ####################################################################################
+ -- place data corresponding to leaflet 918.1
+ -- placeString = place number ranges in case of groups
+ -- ####################################################################################
+ PlacesType ::= SEQUENCE {
+ coach IA5String OPTIONAL,
+
+ -- printable place string ("15-18, 21, 22" )
+ placeString IA5String OPTIONAL,
+
+ -- printable place description
+ placeDescription UTF8String OPTIONAL,
+
+ -- individual places
+ placeIA5 SEQUENCE OF IA5String OPTIONAL,
+ placeNum SEQUENCE OF INTEGER (1..254) OPTIONAL
+ }
+
+ PriceTypeType ::= ENUMERATED {
+ noPrice (0),
+ reservationFee (1),
+ supplement (2),
+ travelPrice (3)
+ }
+
+ BerthTypeType ::= ENUMERATED {
+ single (0),
+ special (1),
+ double (2),
+ t2 (3),
+ t3 (4),
+ t4 (5)
+ }
+
+ CompartmentGenderType ::= ENUMERATED {
+ unspecified (0),
+ family (1),
+ female (2),
+ male (3),
+ mixed (4)
+ ,...
+ }
+
+ GenderType ::= ENUMERATED {
+ unspecified (0),
+ female (1),
+ male (2),
+ other (3)
+ ,...
+ }
+
+ TravelClassType ::= ENUMERATED {
+ notApplicable (0),
+ first (1),
+ second (2),
+ tourist (3),
+ comfort (4),
+ premium (5),
+ business (6),
+ all (7),
+ premiumFirst (8),
+ standardFirst (9),
+ premiumSecond (10),
+ standardSecond (11)
+ ,...
+ }
+
+ -- ########################################################################################
+ -- sleeper compartment types corresponding to leaflet 918.1
+ -- ########################################################################################
+ BerthDetailData ::= SEQUENCE {
+ berthType BerthTypeType,
+ numberOfBerths INTEGER (1..999),
+ gender CompartmentGenderType DEFAULT family
+ ,...
+ }
+
+ -- ####################################################################################
+ -- compartment details corresponding to leaflet 918.1
+ -- ####################################################################################
+ CompartmentDetailsType ::= SEQUENCE {
+ coachType INTEGER (1..99) OPTIONAL,
+ compartmentType INTEGER (1..99) OPTIONAL,
+ specialAllocation INTEGER (1..99) OPTIONAL,
+ coachTypeDescr UTF8String OPTIONAL,
+ compartmentTypeDescr UTF8String OPTIONAL,
+ specialAllocationDescr UTF8String OPTIONAL,
+ position CompartmentPositionType DEFAULT unspecified
+ ,...
+ }
+
+
+ -- #####################################################################################
+ -- luggage restrictions
+ -- the basis for these data is week:
+ -- SCIC mentions a maximum of three pieces of hand luggage but does not includes
+ -- a definition of hand luggage
+ -- SCIC refers to special conditions on registered luggage, but SCIC NRT does
+ -- not contain definitions on that and UIC 108.1 does not
+ -- contain data structures for luggage
+ -- - current THALYS luggage restrictions
+ -- #####################################################################################
+ LuggageRestrictionType ::= SEQUENCE {
+ -- allowed hand luggage pieces on this ticket (3 = default in current NRT tariff)
+ maxHandLuggagePieces INTEGER(0..99) DEFAULT 3,
+ -- allowed hand luggage pieces on this ticket (3 = default in current NRT tariff)
+ maxNonHandLuggagePieces INTEGER(0..99) DEFAULT 1,
+ registeredLuggage SEQUENCE OF RegisteredLuggageType OPTIONAL
+ ,...
+
+ }
+
+ RegisteredLuggageType ::= SEQUENCE {
+ -- id of the additional registered luggage
+ registrationId IA5String OPTIONAL,
+ -- maximum weight in kg
+ maxWeight INTEGER (1..99) OPTIONAL,
+ -- sum of length with and height in cm
+ maxSize INTEGER (1..300) OPTIONAL
+ ,...
+
+ }
+
+ -- ##########################################################################################
+ -- generic type for geo coordinates
+ -- ##########################################################################################
+ GeoCoordinateType ::= SEQUENCE {
+ geoUnit GeoUnitType DEFAULT milliDegree,
+ coordinateSystem GeoCoordinateSystemType DEFAULT wgs84,
+ -- separate hemishpere flag reduces the data size
+ hemisphereLongitude HemisphereLongitudeType DEFAULT north,
+ -- separate hemishpere flag reduces the data size
+ hemisphereLatitude HemisphereLatitudeType DEFAULT east,
+ longitude INTEGER,
+ latitude INTEGER,
+ accuracy GeoUnitType OPTIONAL
+ }
+
+ DeltaCoordinates ::= SEQUENCE {
+ -- logitude difference to a reference point
+ longitude INTEGER,
+ -- latitude difference to a reference point
+ latitude INTEGER
+ }
+
+ GeoCoordinateSystemType ::= ENUMERATED {
+ wgs84 (0), -- WGS 84 standard system
+ grs80 (1) -- (outdated) GRS 80 coordinate system
+ }
+
+ GeoUnitType ::= ENUMERATED {
+ microDegree (0), -- approx. 11 cm on earth surface
+ tenthmilliDegree (1), -- 1 / 100000 degree is approx. 1.1 meter on earth surface
+ milliDegree (2), -- approx 110 meter on earth surface
+ centiDegree (3),
+ deciDegree (4)
+ }
+
+ HemisphereLongitudeType ::= ENUMERATED {
+ north (0),
+ south (1)
+ }
+
+ HemisphereLatitudeType ::= ENUMERATED {
+ east (0),
+ west (1)
+ }
+
+ LoadingDeckType ::= ENUMERATED {
+ unspecified (0),
+ upper (1),
+ lower (2)
+ }
+
+ CompartmentPositionType ::= ENUMERATED {
+ unspecified (0),
+ upperLevel (1),
+ lowerLevel (2)
+ }
+
+ RoofRackType ::= ENUMERATED {
+ norack (0),
+ roofRailing (1),
+ luggageRack (2),
+ skiRack (3),
+ boxRack (4),
+ rackWithOneBox (5),
+ rackWithTwoBoxes (6),
+ bicycleRack (7),
+ otherRack (8)
+ ,...
+ }
+
+END
\ No newline at end of file diff --git a/src/org/uic/ticket/api/asn/package.html b/src/org/uic/barcode/ticket/api/asn/package.html index 307075e..307075e 100644 --- a/src/org/uic/ticket/api/asn/package.html +++ b/src/org/uic/barcode/ticket/api/asn/package.html diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleBerth.java b/src/org/uic/barcode/ticket/api/impl/SimpleBerth.java new file mode 100644 index 0000000..a5f984e --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleBerth.java @@ -0,0 +1,69 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import org.uic.barcode.ticket.api.spec.IBerth;
+import org.uic.barcode.ticket.api.spec.IBerthTypeType;
+import org.uic.barcode.ticket.api.spec.ICompartmentGenderType;
+
+/**
+ * The Class SimpleBerth.
+ */
+public class SimpleBerth implements IBerth {
+
+
+ /** The type. */
+ protected IBerthTypeType type;
+
+ /** The number of berths. */
+ protected int numberOfBerths;
+
+ /** The gender. */
+ protected ICompartmentGenderType gender = ICompartmentGenderType.family;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IBerth#getType()
+ */
+ public IBerthTypeType getType() {
+ return type;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IBerth#setType(org.uic.ticket.api.asn.om.BerthTypeType)
+ */
+ public void setType(IBerthTypeType type) {
+ this.type = type;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IBerth#getNumberOfBerths()
+ */
+ public int getNumberOfBerths() {
+ return numberOfBerths;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IBerth#setNumberOfBerths(int)
+ */
+ public void setNumberOfBerths(int numberOfBerths) {
+ this.numberOfBerths = numberOfBerths;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IBerth#getGender()
+ */
+ public ICompartmentGenderType getGender() {
+ return gender;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IBerth#setGender(org.uic.ticket.api.asn.om.CompartmentGenderType)
+ */
+ public void setGender(ICompartmentGenderType gender) {
+ this.gender = gender;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleCarCarriageReservation.java b/src/org/uic/barcode/ticket/api/impl/SimpleCarCarriageReservation.java new file mode 100644 index 0000000..cd12a4f --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleCarCarriageReservation.java @@ -0,0 +1,655 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.LinkedHashSet;
+
+import org.uic.barcode.ticket.api.spec.ICarCarriageReservation;
+import org.uic.barcode.ticket.api.spec.ICompartmentDetails;
+import org.uic.barcode.ticket.api.spec.IExtension;
+import org.uic.barcode.ticket.api.spec.ILoadingDeckType;
+import org.uic.barcode.ticket.api.spec.IPriceTypeType;
+import org.uic.barcode.ticket.api.spec.IRoofRackType;
+import org.uic.barcode.ticket.api.spec.IServiceBrand;
+import org.uic.barcode.ticket.api.spec.IStationCodeTable;
+import org.uic.barcode.ticket.api.spec.ITariff;
+import org.uic.barcode.ticket.api.spec.IVatDetail;
+
+/**
+ * The Class SimpleCarCarriageReservation.
+ */
+public class SimpleCarCarriageReservation extends SimpleDocumentData implements ICarCarriageReservation {
+
+ /** The train. */
+ protected String train;
+
+
+ /** The reference. */
+ protected String reference;
+
+ /** The product id. */
+ protected String productId;
+
+ /** The product owner. */
+ protected String productOwner;
+
+ /** The service brand. */
+ protected IServiceBrand serviceBrand;
+
+
+ /** The station code table. */
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUICReservation;
+
+ /** The from station. */
+ protected String fromStation;
+
+ /** The to station. */
+ protected String toStation;
+
+ /** The from station name. */
+ protected String fromStationName;
+
+ /** The to station name. */
+ protected String toStationName;
+
+ /** The coach. */
+ protected String coach;
+
+ /** The place. */
+ protected String place;
+
+ /** The carriers. */
+ protected Collection<String>carriers = new LinkedHashSet<String>();
+
+
+ /** The tariff. */
+ protected ITariff tariff;
+
+ /** The service level. */
+ protected String serviceLevel;
+
+ /** The compartment details. */
+ protected ICompartmentDetails compartmentDetails;
+
+ /** The number plate. */
+ protected String numberPlate;
+
+ /** The trailer plate. */
+ protected String trailerPlate;
+
+ /** The car category. */
+ protected int carCategory;
+
+ /** The boat category. */
+ protected int boatCategory;
+
+ /** The textile roof. */
+ protected boolean textileRoof = false;
+
+ /** The roof rack type. */
+ protected IRoofRackType roofRackType = IRoofRackType.norack;
+
+ /** The roof rack height. */
+ protected int roofRackHeight;
+
+ /** The attached boats. */
+ protected int attachedBoats;
+
+ /** The attached bicycles. */
+ protected int attachedBicycles;
+
+ /** The attached surfboards. */
+ protected int attachedSurfboards;
+
+
+ /** The begin loading. */
+ protected Date beginLoading;
+
+ /** The end loading. */
+ protected Date endLoading;
+
+ /** The loading list entry. */
+ protected int loadingListEntry;
+
+ /** The loading deck. */
+ protected ILoadingDeckType loadingDeck = ILoadingDeckType.upper;
+
+ /** The price type. */
+ protected IPriceTypeType priceType = IPriceTypeType.travelPrice;
+
+ /** The VAT details. */
+ protected Collection<IVatDetail>vatDetails = new LinkedHashSet<IVatDetail>();
+
+ /** The price. */
+ protected Long price;
+
+
+ /** The info text. */
+ protected String infoText;
+
+ /** The extension. */
+ protected IExtension extension;
+
+ /** The loading time ut coffset. */
+ protected Long loadingTimeUTCoffset;
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getTrain()
+ */
+ public String getTrain() {
+ return train;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setTrain(java.lang.String)
+ */
+ public void setTrain(String train) {
+ this.train = train.trim();
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getReference()
+ */
+ public String getReference() {
+ return reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setReference(java.lang.String)
+ */
+ public void setReference(String reference) {
+ this.reference = reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getProductId()
+ */
+ public String getProductId() {
+ return productId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setProductId(java.lang.String)
+ */
+ public void setProductId(String productId) {
+ this.productId = productId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getServiceBrand()
+ */
+ public IServiceBrand getServiceBrand() {
+ return serviceBrand;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setServiceBrand(int)
+ */
+ public void setServiceBrand(IServiceBrand serviceBrand) {
+ this.serviceBrand = serviceBrand;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getStationCodeTable()
+ */
+ public IStationCodeTable getStationCodeTable() {
+ return stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getFromStation()
+ */
+ public String getFromStation() {
+ return fromStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setFromStation(java.lang.String)
+ */
+ public void setFromStation(String fromStation) {
+ this.fromStation = fromStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getToStation()
+ */
+ public String getToStation() {
+ return toStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setToStation(java.lang.String)
+ */
+ public void setToStation(String toStation) {
+ this.toStation = toStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getFromStationName()
+ */
+ public String getFromStationName() {
+ return fromStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setFromStationName(java.lang.String)
+ */
+ public void setFromStationName(String fromStationName) {
+ this.fromStationName = fromStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getToStationName()
+ */
+ public String getToStationName() {
+ return toStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setToStationName(java.lang.String)
+ */
+ public void setToStationName(String toStationName) {
+ this.toStationName = toStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getCarriers()
+ */
+ public Collection<String> getCarriers() {
+ return carriers;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#addCarrier(java.lang.Integer)
+ */
+ public void addCarrier(String carrier) {
+ this.carriers.add(carrier);
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getServiceLevel()
+ */
+ public String getServiceLevel() {
+ return serviceLevel;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setServiceLevel(java.lang.String)
+ */
+ public void setServiceLevel(String serviceLevel) {
+ this.serviceLevel = serviceLevel;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getCompartmentDetails()
+ */
+ public ICompartmentDetails getCompartmentDetails() {
+ return compartmentDetails;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setCompartmentDetails(org.uic.ticket.api.spec.ICompartmentDetails)
+ */
+ public void setCompartmentDetails(ICompartmentDetails compartmentDetails) {
+ this.compartmentDetails = compartmentDetails;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getPriceType()
+ */
+ public IPriceTypeType getPriceType() {
+ return priceType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setPriceType(org.uic.ticket.api.asn.om.PriceTypeType)
+ */
+ public void setPriceType(IPriceTypeType priceType) {
+ this.priceType = priceType;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getInfoText()
+ */
+ public String getInfoText() {
+ return infoText;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setInfoText(java.lang.String)
+ */
+ public void setInfoText(String infoText) {
+ this.infoText = infoText;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getExtension()
+ */
+ public IExtension getExtension() {
+ return extension;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setExtension(org.uic.ticket.api.spec.IExtension)
+ */
+ public void setExtension(IExtension extension) {
+ this.extension = extension;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getCoach()
+ */
+ public String getCoach() {
+ return coach;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setCoach(java.lang.String)
+ */
+ public void setCoach(String coach) {
+ this.coach = coach;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getPlace()
+ */
+ public String getPlace() {
+ return place;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setPlace(java.lang.String)
+ */
+ public void setPlace(String place) {
+ this.place = place;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getTariff()
+ */
+ public ITariff getTariff() {
+ return tariff;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setTariff(org.uic.ticket.api.spec.ITariff)
+ */
+ public void setTariff(ITariff tariff) {
+ this.tariff = tariff;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getNumberPlate()
+ */
+ public String getNumberPlate() {
+ return numberPlate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setNumberPlate(java.lang.String)
+ */
+ public void setNumberPlate(String numberPlate) {
+ this.numberPlate = numberPlate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getTrailerPlate()
+ */
+ public String getTrailerPlate() {
+ return trailerPlate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setTrailerPlate(java.lang.String)
+ */
+ public void setTrailerPlate(String trailerPlate) {
+ this.trailerPlate = trailerPlate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getCarCategory()
+ */
+ public int getCarCategory() {
+ return carCategory;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setCarCategory(int)
+ */
+ public void setCarCategory(int carCategory) {
+ this.carCategory = carCategory;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getBoatCategory()
+ */
+ public int getBoatCategory() {
+ return boatCategory;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setBoatCategory(int)
+ */
+ public void setBoatCategory(int boatCategory) {
+ this.boatCategory = boatCategory;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#isTextileRoof()
+ */
+ public boolean isTextileRoof() {
+ return textileRoof;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setTextileRoof(boolean)
+ */
+ public void setTextileRoof(boolean textileRoof) {
+ this.textileRoof = textileRoof;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getRoofRackType()
+ */
+ public IRoofRackType getRoofRackType() {
+ return roofRackType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setRoofRackType(org.uic.ticket.api.asn.om.RoofRackType)
+ */
+ public void setRoofRackType(IRoofRackType roofRackType) {
+ this.roofRackType = roofRackType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getRoofRackHeight()
+ */
+ public int getRoofRackHeight() {
+ return roofRackHeight;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setRoofRackHeight(int)
+ */
+ public void setRoofRackHeight(int roofRackHeight) {
+ this.roofRackHeight = roofRackHeight;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getAttachedBoats()
+ */
+ public int getAttachedBoats() {
+ return attachedBoats;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setAttachedBoats(int)
+ */
+ public void setAttachedBoats(int attachedBoats) {
+ this.attachedBoats = attachedBoats;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getAttachedBicycles()
+ */
+ public int getAttachedBicycles() {
+ return attachedBicycles;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setAttachedBicycles(int)
+ */
+ public void setAttachedBicycles(int attachedBicycles) {
+ this.attachedBicycles = attachedBicycles;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getAttachedSurfboards()
+ */
+ public int getAttachedSurfboards() {
+ return attachedSurfboards;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setAttachedSurfboards(int)
+ */
+ public void setAttachedSurfboards(int attachedSurfboards) {
+ this.attachedSurfboards = attachedSurfboards;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getBeginLoading()
+ */
+ public Date getBeginLoading() {
+ return beginLoading;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setBeginLoading(java.util.Date)
+ */
+ public void setBeginLoading(Date beginLoading) {
+ this.beginLoading = beginLoading;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getEndLoading()
+ */
+ public Date getEndLoading() {
+ return endLoading;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setEndLoading(java.util.Date)
+ */
+ public void setEndLoading(Date endLoading) {
+ this.endLoading = endLoading;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getLoadingListEntry()
+ */
+ public int getLoadingListEntry() {
+ return loadingListEntry;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setLoadingListEntry(int)
+ */
+ public void setLoadingListEntry(int loadingListEntry) {
+ this.loadingListEntry = loadingListEntry;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getLoadingDeck()
+ */
+ public ILoadingDeckType getLoadingDeck() {
+ return loadingDeck;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setLoadingDeck(org.uic.ticket.api.asn.om.LoadingDeckType)
+ */
+ public void setLoadingDeck(ILoadingDeckType loadingDeck) {
+ this.loadingDeck = loadingDeck;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getProductOwner()
+ */
+ public String getProductOwner() {
+ return productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setProductOwner(java.lang.String)
+ */
+ public void setProductOwner(String productOwner) {
+ this.productOwner = productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setPrice(java.lang.Long)
+ */
+ @Override
+ public void setPrice(Long price) {
+ this.price = price;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getPrice()
+ */
+ @Override
+ public Long getPrice() {
+ return price;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getVatDetails()
+ */
+ @Override
+ public Collection<IVatDetail> getVatDetails() {
+ return vatDetails;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#addVatDetail(org.uic.ticket.api.spec.IVatDetail)
+ */
+ @Override
+ public void addVatDetail(IVatDetail vatDetail) {
+ this.vatDetails.add(vatDetail);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#getLoadingTimeUTCoffset()
+ */
+ public Long getLoadingTimeUTCoffset() {
+ return loadingTimeUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICarCarriageReservation#setLoadingTimeUTCoffset(java.lang.Long)
+ */
+ public void setLoadingTimeUTCoffset(Long loadingTimeUTCoffset) {
+ this.loadingTimeUTCoffset = loadingTimeUTCoffset;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleCardReference.java b/src/org/uic/barcode/ticket/api/impl/SimpleCardReference.java new file mode 100644 index 0000000..a40ad76 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleCardReference.java @@ -0,0 +1,133 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import org.uic.barcode.ticket.api.spec.ICardReference;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimpleCardReference.
+ */
+public class SimpleCardReference implements ICardReference {
+
+
+ /** The card issuer. */
+ protected String cardIssuer;
+
+ /** The card id. */
+ protected String cardId;
+
+ /** The card name. */
+ protected String cardName;
+
+ /** The card type. */
+ protected int cardType;
+
+ /** The leading card id. */
+ protected String leadingCardId;
+
+ /** The trailing card id. */
+ protected String trailingCardId;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICardReference#getCardIssuer()
+ */
+ public String getCardIssuer() {
+ return cardIssuer;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICardReference#setCardIssuer(java.lang.String)
+ */
+ public void setCardIssuer(String cardIssuer) {
+ this.cardIssuer = cardIssuer;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICardReference#getCardId()
+ */
+ public String getCardId() {
+ return cardId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICardReference#setCardId(java.lang.String)
+ */
+ public void setCardId(String cardId) {
+ if (cardId != null && cardId.trim().length() > 0) {
+ this.cardId = cardId.trim();
+ } else {
+ this.cardId = null;
+ }
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICardReference#getCardName()
+ */
+ public String getCardName() {
+ return cardName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICardReference#setCardName(java.lang.String)
+ */
+ public void setCardName(String cardName) {
+ this.cardName = cardName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICardReference#getCardType()
+ */
+ public int getCardType() {
+ return cardType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICardReference#setCardType(int)
+ */
+ public void setCardType(int cardType) {
+ this.cardType = cardType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICardReference#getLeadingCardId()
+ */
+ public String getLeadingCardId() {
+ return leadingCardId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICardReference#setLeadingCardId(java.lang.String)
+ */
+ public void setLeadingCardId(String leadingCardId) {
+ if (leadingCardId != null && leadingCardId.trim().length() > 0) {
+ this.leadingCardId = leadingCardId.trim();
+ } else {
+ this.leadingCardId = null;
+ }
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICardReference#getTrailingCardId()
+ */
+ public String getTrailingCardId() {
+ return trailingCardId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICardReference#setTrailingCardId(java.lang.String)
+ */
+ public void setTrailingCardId(String trailingCardId) {
+ if (trailingCardId != null && trailingCardId.trim().length() > 0) {
+ this.trailingCardId = trailingCardId.trim();
+ } else {
+ this.trailingCardId = null;
+ }
+ }
+
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleCompartmentDetails.java b/src/org/uic/barcode/ticket/api/impl/SimpleCompartmentDetails.java new file mode 100644 index 0000000..0748874 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleCompartmentDetails.java @@ -0,0 +1,136 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import org.uic.barcode.ticket.api.spec.ICompartmentDetails;
+import org.uic.barcode.ticket.api.spec.ICompartmentPositionType;
+
+/**
+ * The Class SimpleCompartmentDetails.
+ */
+public class SimpleCompartmentDetails implements ICompartmentDetails {
+
+
+ /** The coach type. */
+ protected int coachType ;
+
+ /** The compartment type. */
+ protected int compartmentType;
+
+ /** The special allocation. */
+ protected int specialAllocation;
+
+ /** The coach type descr. */
+ protected String coachTypeDescr;
+
+ /** The compartment type descr. */
+ protected String compartmentTypeDescr;
+
+ /** The special allocation descr. */
+ protected String specialAllocationDescr;
+
+ /** The position. */
+ protected ICompartmentPositionType position = ICompartmentPositionType.unspecified;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICompartmentDetails#getCoachType()
+ */
+ public int getCoachType() {
+ return coachType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICompartmentDetails#setCoachType(int)
+ */
+ public void setCoachType(int coachType) {
+ this.coachType = coachType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICompartmentDetails#getCompartmentType()
+ */
+ public int getCompartmentType() {
+ return compartmentType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICompartmentDetails#setCompartmentType(int)
+ */
+ public void setCompartmentType(int compartmentType) {
+ this.compartmentType = compartmentType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICompartmentDetails#getSpecialAllocation()
+ */
+ public int getSpecialAllocation() {
+ return specialAllocation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICompartmentDetails#setSpecialAllocation(int)
+ */
+ public void setSpecialAllocation(int specialAllocation) {
+ this.specialAllocation = specialAllocation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICompartmentDetails#getCoachTypeDescr()
+ */
+ public String getCoachTypeDescr() {
+ return coachTypeDescr;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICompartmentDetails#setCoachTypeDescr(java.lang.String)
+ */
+ public void setCoachTypeDescr(String coachTypeDescr) {
+ this.coachTypeDescr = coachTypeDescr;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICompartmentDetails#getComparttmentTypeDescr()
+ */
+ public String getCompartmentTypeDescr() {
+ return compartmentTypeDescr;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICompartmentDetails#setComparttmentTypeDescr(java.lang.String)
+ */
+ public void setCompartmentTypeDescr(String comparttmentTypeDescr) {
+ this.compartmentTypeDescr = comparttmentTypeDescr;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICompartmentDetails#getSpecialAllocationDescr()
+ */
+ public String getSpecialAllocationDescr() {
+ return specialAllocationDescr;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICompartmentDetails#setSpecialAllocationDescr(java.lang.String)
+ */
+ public void setSpecialAllocationDescr(String specialAllocationDescr) {
+ this.specialAllocationDescr = specialAllocationDescr;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICompartmentDetails#getPosition()
+ */
+ public ICompartmentPositionType getPosition() {
+ return position;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICompartmentDetails#setPosition(org.uic.ticket.api.asn.om.CompartmentPositionType)
+ */
+ public void setPosition(ICompartmentPositionType position) {
+ this.position = position;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleControlDetail.java b/src/org/uic/barcode/ticket/api/impl/SimpleControlDetail.java new file mode 100644 index 0000000..0702563 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleControlDetail.java @@ -0,0 +1,229 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+
+import org.uic.barcode.ticket.api.spec.ICardReference;
+import org.uic.barcode.ticket.api.spec.IControlDetail;
+import org.uic.barcode.ticket.api.spec.IExtension;
+import org.uic.barcode.ticket.api.spec.ITicketLink;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimpleControlDetail.
+ */
+public class SimpleControlDetail implements IControlDetail {
+
+
+ /** The identification by card reference. */
+ protected Collection <ICardReference> identificationByCardReference = new LinkedHashSet<ICardReference>();
+
+ /** The identification by id card. */
+ protected boolean identificationByIdCard = false;
+
+ /** The identification by passport id. */
+ protected boolean identificationByPassportId = false;
+
+ /** The identification item. */
+ protected int identificationItem = 0;
+
+ /** The passport validation required. */
+ protected boolean passportValidationRequired = false;
+
+ /** The online validation required. */
+ protected boolean onlineValidationRequired = false;
+
+ /** The random online validation required. */
+ protected int randomDetailedValidationRequired = 0;
+
+ /** The age check required. */
+ protected boolean ageCheckRequired = false;
+
+ /** The reduction card check required. */
+ protected boolean reductionCardCheckRequired = false;
+
+ /** The info text. */
+ protected String infoText ;
+
+ /** The linked tickets. */
+ protected Collection<ITicketLink> linkedTickets = new HashSet<ITicketLink>();
+
+ /** The extension. */
+ protected IExtension extension ;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#getIdentificationByCardReference()
+ */
+ public Collection<ICardReference> getIdentificationByCardReference() {
+ return identificationByCardReference;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#addIdentificationByCardReference(org.uic.ticket.api.spec.ICardReference)
+ */
+ public void addIdentificationByCardReference(ICardReference cardReference) {
+ this.identificationByCardReference.add(cardReference);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#isIdentificationByIdCard()
+ */
+ public boolean isIdentificationByIdCard() {
+ return identificationByIdCard;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#setIdentificationByIdCard(boolean)
+ */
+ public void setIdentificationByIdCard(boolean identificationByIdCard) {
+ this.identificationByIdCard = identificationByIdCard;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#isIdentificationByPassportId()
+ */
+ public boolean isIdentificationByPassportId() {
+ return identificationByPassportId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#setIdentificationByPassportId(boolean)
+ */
+ public void setIdentificationByPassportId(boolean identificationByPassportId) {
+ this.identificationByPassportId = identificationByPassportId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#getIdentificationItem()
+ */
+ public int getIdentificationItem() {
+ return identificationItem;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#setIdentificationItem(int)
+ */
+ public void setIdentificationItem(int identificationItem) {
+ this.identificationItem = identificationItem;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#isPassportValidationRequired()
+ */
+ public boolean isPassportValidationRequired() {
+ return passportValidationRequired;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#setPassportValidationRequired(boolean)
+ */
+ public void setPassportValidationRequired(boolean passportValidationRequired) {
+ this.passportValidationRequired = passportValidationRequired;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#isOnlineValidationRequired()
+ */
+ public boolean isOnlineValidationRequired() {
+ return onlineValidationRequired;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#setOnlineValidationRequired(boolean)
+ */
+ public void setOnlineValidationRequired(boolean onlineValidationRequired) {
+ this.onlineValidationRequired = onlineValidationRequired;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#getRandomOnlineValidationRequired()
+ */
+ public int getRandomDetailedValidationRequired() {
+ return randomDetailedValidationRequired;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#setRandomOnlineValidationRequired(int)
+ */
+ public void setRandomDetailedValidationRequired(int randomDetailedValidationRequired) {
+ this.randomDetailedValidationRequired = randomDetailedValidationRequired;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#isAgeCheckRequired()
+ */
+ public boolean isAgeCheckRequired() {
+ return ageCheckRequired;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#setAgeCheckRequired(boolean)
+ */
+ public void setAgeCheckRequired(boolean ageCheckRequired) {
+ this.ageCheckRequired = ageCheckRequired;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#isReductionCardCheckRequired()
+ */
+ public boolean isReductionCardCheckRequired() {
+ return reductionCardCheckRequired;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#setReductionCardCheckRequired(boolean)
+ */
+ public void setReductionCardCheckRequired(boolean reductionCardCheckRequired) {
+ this.reductionCardCheckRequired = reductionCardCheckRequired;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#getInfoText()
+ */
+ public String getInfoText() {
+ return infoText;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#setInfoText(java.lang.String)
+ */
+ public void setInfoText(String infoText) {
+ this.infoText = infoText;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#getLinkedTickets()
+ */
+ public Collection<ITicketLink> getLinkedTickets() {
+ return linkedTickets;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#addLinkedTicket(org.uic.ticket.api.spec.ITicketLink)
+ */
+ public void addLinkedTicket(ITicketLink linkedTicket) {
+ this.linkedTickets.add(linkedTicket);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#getExtension()
+ */
+ public IExtension getExtension() {
+ return extension;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IControlDetail#setExtension(org.uic.ticket.api.spec.IExtension)
+ */
+ public void setExtension(IExtension extension) {
+ this.extension = extension;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleCounterMark.java b/src/org/uic/barcode/ticket/api/impl/SimpleCounterMark.java new file mode 100644 index 0000000..d8b0ebd --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleCounterMark.java @@ -0,0 +1,482 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.LinkedHashSet;
+
+import org.uic.barcode.ticket.api.spec.ICounterMark;
+import org.uic.barcode.ticket.api.spec.IExtension;
+import org.uic.barcode.ticket.api.spec.IRegionalValidity;
+import org.uic.barcode.ticket.api.spec.IReturnRouteDescription;
+import org.uic.barcode.ticket.api.spec.IStationCodeTable;
+import org.uic.barcode.ticket.api.spec.ITravelClassType;
+
+
+/**
+ * The Class SimpleCounterMark.
+ */
+public class SimpleCounterMark extends SimpleDocumentData implements ICounterMark {
+
+ /** The departure date. */
+ protected Date departureDate;
+
+ /** The arrival date. */
+ protected Date arrivalDate;
+
+ /** The reference. */
+ protected String reference;
+
+ /** The product owner. */
+ protected String productOwner;
+
+
+ /** The product id. */
+ protected String productId;
+
+ /** The number of countermark. */
+ protected int numberOfCountermark;
+
+ /** The total of countermarks. */
+ protected int totalOfCountermarks;
+
+ /** The group name. */
+ protected String groupName;
+
+ /** The return included. */
+ protected boolean returnIncluded = false;
+
+ /** The station code table. */
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUIC;
+
+ /** The from station. */
+ protected String fromStation;
+
+ /** The to station. */
+ protected String toStation;
+
+ /** The from station name. */
+ protected String fromStationName;
+
+ /** The to station name. */
+ protected String toStationName;
+
+ /** The valid region desc. */
+ protected String validRegionDesc;
+
+ /** The valid region list. */
+ protected Collection<IRegionalValidity> validRegionList = new LinkedHashSet<IRegionalValidity>();
+
+ /** The return description. */
+ protected IReturnRouteDescription returnDescription;
+
+ /** The valid from. */
+ protected Date validFrom;
+
+ /** The valid until. */
+ protected Date validUntil;
+
+ /** The class code. */
+ protected ITravelClassType classCode = ITravelClassType.second;
+
+ /** The included carriers. */
+ protected Collection<String>includedCarriers = new LinkedHashSet<String>();
+
+ /** The included service brands. */
+ protected Collection<Integer>includedServiceBrands = new LinkedHashSet<Integer>();
+
+ /** The excluded service brands. */
+ protected Collection<Integer>excludedServiceBrands = new LinkedHashSet<Integer>();
+
+ /** The info text. */
+ protected String infoText;
+
+
+ /** The extension. */
+ protected IExtension extension;
+
+
+ /** The ticket reference. */
+ protected String ticketReference;
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getReference()
+ */
+ public String getReference() {
+ return reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setReference(java.lang.String)
+ */
+ public void setReference(String reference) {
+ this.reference = reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#isReturnIncluded()
+ */
+ public boolean isReturnIncluded() {
+ return returnIncluded;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setReturnIncluded(boolean)
+ */
+ public void setReturnIncluded(boolean returnIncluded) {
+ this.returnIncluded = returnIncluded;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getStationCodeTable()
+ */
+ public IStationCodeTable getStationCodeTable() {
+ return stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getFromStation()
+ */
+ public String getFromStation() {
+ return fromStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setFromStation(java.lang.String)
+ */
+ public void setFromStation(String fromStation) {
+ this.fromStation = fromStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getToStation()
+ */
+ public String getToStation() {
+ return toStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setToStation(java.lang.String)
+ */
+ public void setToStation(String toStation) {
+ this.toStation = toStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getFromStationName()
+ */
+ public String getFromStationName() {
+ return fromStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setFromStationName(java.lang.String)
+ */
+ public void setFromStationName(String fromStationName) {
+ this.fromStationName = fromStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getToStationName()
+ */
+ public String getToStationName() {
+ return toStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setToStationName(java.lang.String)
+ */
+ public void setToStationName(String toStationName) {
+ this.toStationName = toStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getValidRegionDesc()
+ */
+ public String getValidRegionDesc() {
+ return validRegionDesc;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setValidRegionDesc(java.lang.String)
+ */
+ public void setValidRegionDesc(String validRegionDesc) {
+ this.validRegionDesc = validRegionDesc;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getValidRegionList()
+ */
+ public Collection<IRegionalValidity> getValidRegionList() {
+ return validRegionList;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#addValidRegionList(org.uic.ticket.api.spec.IRegionalValidity)
+ */
+ public void addValidRegionList(IRegionalValidity validRegion) {
+ this.validRegionList.add(validRegion);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getReturnDescription()
+ */
+ public IReturnRouteDescription getReturnDescription() {
+ return returnDescription;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setReturnDescription(org.uic.ticket.api.spec.IReturnRouteDescription)
+ */
+ public void setReturnDescription(IReturnRouteDescription returnDescription) {
+ this.returnDescription = returnDescription;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getValidFrom()
+ */
+ public Date getValidFrom() {
+ return validFrom;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setValidFrom(java.util.Date)
+ */
+ public void setValidFrom(Date validFrom) {
+ this.validFrom = validFrom;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getValidUntil()
+ */
+ public Date getValidUntil() {
+ return validUntil;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setValidUntil(java.util.Date)
+ */
+ public void setValidUntil(Date validUntil) {
+ this.validUntil = validUntil;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getClassCode()
+ */
+ public ITravelClassType getClassCode() {
+ return classCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setClassCode(org.uic.ticket.api.asn.om.TravelClassType)
+ */
+ public void setClassCode(ITravelClassType classCode) {
+ this.classCode = classCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getIncludedCarriers()
+ */
+ public Collection<String> getIncludedCarriers() {
+ return includedCarriers;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#addIncludedCarrier(java.lang.Integer)
+ */
+ public void addIncludedCarrier(String carrier) {
+ this.includedCarriers.add(carrier);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getIncludedServiceBrands()
+ */
+ public Collection<Integer> getIncludedServiceBrands() {
+ return includedServiceBrands;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#addIncludedServiceBrand(java.lang.Integer)
+ */
+ public void addIncludedServiceBrand(Integer includedServiceBrand) {
+ this.includedServiceBrands.add(includedServiceBrand);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getExcludedServiceBrands()
+ */
+ public Collection<Integer> getExcludedServiceBrands() {
+ return excludedServiceBrands;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#addExcludedServiceBrand(java.lang.Integer)
+ */
+ public void addExcludedServiceBrand(Integer excludedServiceBrand) {
+ this.excludedServiceBrands.add(excludedServiceBrand);
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getInfoText()
+ */
+ public String getInfoText() {
+ return infoText;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setInfoText(java.lang.String)
+ */
+ public void setInfoText(String infoText) {
+ this.infoText = infoText;
+ }
+
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getExtension()
+ */
+ public IExtension getExtension() {
+ return extension;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setExtension(org.uic.ticket.api.spec.IExtension)
+ */
+ public void setExtension(IExtension extension) {
+ this.extension = extension;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getTotalOfCountermarks()
+ */
+ public int getTotalOfCountermarks() {
+ return totalOfCountermarks;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setTotalOfCountermarks(int)
+ */
+ public void setTotalOfCountermarks(int totalOfCountermarks) {
+ this.totalOfCountermarks = totalOfCountermarks;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getGroupName()
+ */
+ public String getGroupName() {
+ return groupName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setGroupName(java.lang.String)
+ */
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getNumberOfCountermark()
+ */
+ public int getNumberOfCountermark() {
+ return numberOfCountermark;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setNumberOfCountermark(int)
+ */
+ public void setNumberOfCountermark(int numberOfCountermark) {
+ this.numberOfCountermark = numberOfCountermark;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getProductOwner()
+ */
+ public String getProductOwner() {
+ return productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setProductOwner(java.lang.String)
+ */
+ public void setProductOwner(String productOwner) {
+ this.productOwner = productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getTicketReference()
+ */
+ public String getTicketReference() {
+ return ticketReference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setTicketReference(java.lang.String)
+ */
+ public void setTicketReference(String ticketReference) {
+ this.ticketReference = ticketReference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getProductId()
+ */
+ public String getProductId() {
+ return productId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setProductId(java.lang.String)
+ */
+ public void setProductId(String productId) {
+ this.productId = productId;
+ }
+
+ /** The valid from utc coffset. */
+ protected Long validFromUTCoffset;
+
+ /** The valid until utc coffset. */
+ protected Long validUntilUTCoffset;
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getValidFromUTCoffset()
+ */
+ public Long getValidFromUTCoffset() {
+ return validFromUTCoffset;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setValidFromUTCoffset(java.lang.Long)
+ */
+ public void setValidFromUTCoffset(Long validFromUTCoffset) {
+ this.validFromUTCoffset = validFromUTCoffset;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#getValidUntilUTCoffset()
+ */
+ public Long getValidUntilUTCoffset() {
+ return validUntilUTCoffset;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICounterMark#setValidUntilUTCoffset(java.lang.Long)
+ */
+ public void setValidUntilUTCoffset(Long validUntilUTCoffset) {
+ this.validUntilUTCoffset = validUntilUTCoffset;
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleCustomerCard.java b/src/org/uic/barcode/ticket/api/impl/SimpleCustomerCard.java new file mode 100644 index 0000000..cfbba4c --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleCustomerCard.java @@ -0,0 +1,209 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.LinkedHashSet;
+
+import org.uic.barcode.ticket.api.spec.ICustomerCard;
+import org.uic.barcode.ticket.api.spec.IExtension;
+import org.uic.barcode.ticket.api.spec.ITravelClassType;
+import org.uic.barcode.ticket.api.spec.ITraveler;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimpleCustomerCard.
+ */
+public class SimpleCustomerCard extends SimpleDocumentData implements ICustomerCard {
+
+ /** The customer type. */
+ protected ITraveler customer;
+
+ /** The card id. */
+ protected String cardId;
+
+ /** The valid from. */
+ protected Date validFrom;
+
+ /** The valid until. */
+ protected Date validUntil;
+
+ /** The class code. */
+ protected ITravelClassType classCode;
+
+ /** The extension. */
+ protected IExtension extension;
+
+
+ /** The card type. */
+ protected int cardType;
+
+ /** The card type descr. */
+ protected String cardTypeDescr;
+
+ /** The customer status. */
+ protected int customerStatus;
+
+ /** The customer status descr. */
+ protected String customerStatusDescr;
+
+ /** The included services. */
+ protected Collection<Integer> includedServices = new LinkedHashSet<Integer>();
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#getCustomer()
+ */
+ public ITraveler getCustomer() {
+ return customer;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#setCustomer(org.uic.ticket.api.spec.ITraveler)
+ */
+ public void setCustomer(ITraveler customer) {
+ this.customer = customer;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#getCardId()
+ */
+ public String getCardId() {
+ return cardId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#setCardId(java.lang.String)
+ */
+ public void setCardId(String cardId) {
+ this.cardId = cardId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#getValidFrom()
+ */
+ public Date getValidFrom() {
+ return validFrom;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#setValidFrom(java.util.Date)
+ */
+ public void setValidFrom(Date validFrom) {
+ this.validFrom = validFrom;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#getValidUntil()
+ */
+ public Date getValidUntil() {
+ return validUntil;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#setValidUntil(java.util.Date)
+ */
+ public void setValidUntil(Date validUntil) {
+ this.validUntil = validUntil;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#getClassCode()
+ */
+ public ITravelClassType getClassCode() {
+ return classCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#setClassCode(org.uic.ticket.api.asn.om.TravelClassType)
+ */
+ public void setClassCode(ITravelClassType classCode) {
+ this.classCode = classCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#getCardType()
+ */
+ public int getCardType() {
+ return cardType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#setCardType(int)
+ */
+ public void setCardType(int cardType) {
+ this.cardType = cardType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#getCardTypeDescr()
+ */
+ public String getCardTypeDescr() {
+ return cardTypeDescr;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#setCardTypeDescr(java.lang.String)
+ */
+ public void setCardTypeDescr(String cardTypeDescr) {
+ this.cardTypeDescr = cardTypeDescr;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#getCustomerStatus()
+ */
+ public int getCustomerStatus() {
+ return customerStatus;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#setCustomerStatus(int)
+ */
+ public void setCustomerStatus(int customerStatus) {
+ this.customerStatus = customerStatus;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#getCustomerStatusDescr()
+ */
+ public String getCustomerStatusDescr() {
+ return customerStatusDescr;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#setCustomerStatusDescr(java.lang.String)
+ */
+ public void setCustomerStatusDescr(String customerStatusDescr) {
+ this.customerStatusDescr = customerStatusDescr;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#getIncludedServices()
+ */
+ public Collection<Integer> getIncludedServices() {
+ return includedServices;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#addIncludedService(java.lang.Integer)
+ */
+ public void addIncludedService(Integer includedService) {
+ this.includedServices.add(includedService);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#getExtension()
+ */
+ public IExtension getExtension() {
+ return extension;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerCard#setExtension(org.uic.ticket.api.spec.IExtension)
+ */
+ public void setExtension(IExtension extension) {
+ this.extension = extension;
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleCustomerStatusDescription.java b/src/org/uic/barcode/ticket/api/impl/SimpleCustomerStatusDescription.java new file mode 100644 index 0000000..d1a4a45 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleCustomerStatusDescription.java @@ -0,0 +1,69 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import org.uic.barcode.ticket.api.spec.ICustomerStatusDescription;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimpleCustomerStatusDescription.
+ */
+public class SimpleCustomerStatusDescription implements ICustomerStatusDescription {
+
+
+ /** The status provider. */
+ protected String statusProvider;
+
+ /** The description. */
+ protected String description;
+
+ /** The status. */
+ protected int status;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerStatusDescription#getStatusProvider()
+ */
+ public String getStatusProvider() {
+ return statusProvider;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerStatusDescription#setStatusProvider(java.lang.String)
+ */
+ public void setStatusProvider(String statusProvider) {
+ this.statusProvider = statusProvider;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerStatusDescription#getDescription()
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerStatusDescription#setDescription(java.lang.String)
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerStatusDescription#getStatus()
+ */
+ public int getStatus() {
+ return status;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ICustomerStatusDescription#setStatus(org.uic.ticket.api.asn.om.CustomerStatusType)
+ */
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleDelayConfirmation.java b/src/org/uic/barcode/ticket/api/impl/SimpleDelayConfirmation.java new file mode 100644 index 0000000..8948358 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleDelayConfirmation.java @@ -0,0 +1,326 @@ +package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+
+import org.uic.barcode.ticket.api.spec.IDelayConfirmation;
+import org.uic.barcode.ticket.api.spec.IExtension;
+import org.uic.barcode.ticket.api.spec.IStationCodeTable;
+import org.uic.barcode.ticket.api.spec.ITicketLink;
+
+/**
+ * The Class SimpleDelayConfirmation.
+ */
+public class SimpleDelayConfirmation extends SimpleDocumentData implements IDelayConfirmation {
+
+ /** The train. */
+ protected String train;
+
+ /** The reference. */
+ protected String reference;
+
+ /** The station code table. */
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUICReservation;
+
+ /** The station. */
+ protected String station;
+
+ /** The station name. */
+ protected String stationName;
+
+
+ /** The info text. */
+ protected String infoText;
+
+ /** The extension. */
+ protected IExtension extension;
+
+
+ /** The arrival date. */
+ protected Date arrivalDate;
+
+ /** The arrival ut coffset. */
+ protected Long arrivalUTCoffset;
+
+ /** The cancelled train. */
+ protected boolean cancelledTrain = false;
+
+ /** The delay. */
+ protected int delay = 0;
+
+ /** The confirmation type. */
+ protected int confirmationType = 0;
+
+ /** The linked tickets. */
+ protected Collection<ITicketLink> linkedTickets = new HashSet<ITicketLink>();
+
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#getReference()
+ */
+ @Override
+ public String getReference() {
+ return reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#setReference(java.lang.String)
+ */
+ @Override
+ public void setReference(String reference) {
+ this.reference = reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#getTrain()
+ */
+ @Override
+ public String getTrain() {
+ return train;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#setTrain(java.lang.String)
+ */
+ @Override
+ public void setTrain(String train) {
+ this.train = train;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#getStationCodeTable()
+ */
+ @Override
+ public IStationCodeTable getStationCodeTable() {
+ return stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#setStationCodeTable(org.uic.ticket.api.asn.omv1.CodeTableType)
+ */
+ @Override
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#getStation()
+ */
+ @Override
+ public String getStation() {
+ return station;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#setStation(java.lang.String)
+ */
+ @Override
+ public void setStation(String station) {
+ this.station = station;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#setStationName(java.lang.String)
+ */
+ @Override
+ public void setStationName(String name) {
+ this.stationName = name;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#getStationName()
+ */
+ @Override
+ public String getStationName() {
+ return stationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#getArrivalDate()
+ */
+ @Override
+ public Date getArrivalDate() {
+ return arrivalDate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#setArrivalDate(java.util.Date)
+ */
+ @Override
+ public void setArrivalDate(Date arrivalDate) {
+ this.arrivalDate = arrivalDate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#isTrainCancelled()
+ */
+ @Override
+ public boolean isTrainCancelled() {
+ return cancelledTrain;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#setTrainCancelled(boolean)
+ */
+ @Override
+ public void setTrainCancelled(boolean trainIsCancelled) {
+ this.cancelledTrain = trainIsCancelled;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#getDelay()
+ */
+ @Override
+ public int getDelay() {
+ return delay;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#setDelay(int)
+ */
+ @Override
+ public void setDelay(int delay) {
+ this.delay = delay;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#getConfirmationType()
+ */
+ @Override
+ public int getConfirmationType() {
+ return this.confirmationType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#setConfirmationType(int)
+ */
+ @Override
+ public void setConfirmationType(int type) {
+ this.confirmationType = type;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#setTravelerOnBoardDelayed(boolean)
+ */
+ @Override
+ public void setTravelerOnBoardDelayed(boolean travelerOnBoardDelayed) {
+ this.confirmationType = 0;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#setTrainDelayed(boolean)
+ */
+ @Override
+ public void setTrainDelayed(boolean trainDelayed) {
+ this.confirmationType = 1;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#setTrainDelayedTravelerHasTrainTicket(boolean)
+ */
+ @Override
+ public void setTrainDelayedTravelerHasTrainTicket(
+ boolean trainOfTravelerDelayed) {
+ this.confirmationType = 2;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#isTravelerOnBoardDelayed()
+ */
+ @Override
+ public boolean isTravelerOnBoardDelayed() {
+ if (this.confirmationType == 0) {
+ return true;
+ }
+ return false;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#isTrainDelayed()
+ */
+ @Override
+ public boolean isTrainDelayed() {
+ if (this.confirmationType == 1) {
+ return true;
+ }
+ return false;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#isTrainDelayedTravelerHasTrainTicket()
+ */
+ @Override
+ public boolean isTrainDelayedTravelerHasTrainTicket() {
+ if (this.confirmationType == 2) {
+ return true;
+ }
+ return false;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#getLinkedTickets()
+ */
+ @Override
+ public Collection<ITicketLink> getLinkedTickets() {
+ return linkedTickets;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#addLinkedTicket(org.uic.ticket.api.spec.ITicketLink)
+ */
+ @Override
+ public void addLinkedTicket(ITicketLink linkedTicket) {
+ this.linkedTickets.add(linkedTicket);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#getInfoText()
+ */
+ @Override
+ public String getInfoText() {
+ return infoText;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#setInfoText(java.lang.String)
+ */
+ @Override
+ public void setInfoText(String text) {
+ this.infoText = text;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#getExtension()
+ */
+ @Override
+ public IExtension getExtension() {
+ return extension;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#setExtension(org.uic.ticket.api.spec.IExtension)
+ */
+ @Override
+ public void setExtension(IExtension extension) {
+ this.extension = extension;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#getArrivalUTCoffset()
+ */
+ public Long getArrivalUTCoffset() {
+ return arrivalUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDelayConfirmation#setArrivalUTCoffset(java.lang.Long)
+ */
+ public void setArrivalUTCoffset(Long arrivalUTCoffset) {
+ this.arrivalUTCoffset = arrivalUTCoffset;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleDocumentData.java b/src/org/uic/barcode/ticket/api/impl/SimpleDocumentData.java new file mode 100644 index 0000000..dc352ab --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleDocumentData.java @@ -0,0 +1,31 @@ +package org.uic.barcode.ticket.api.impl;
+
+import org.uic.barcode.ticket.api.spec.IDocumentData;
+import org.uic.barcode.ticket.api.spec.IToken;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimpleDocumentData.
+ */
+public class SimpleDocumentData implements IDocumentData {
+
+ /** The token. */
+ protected IToken token;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDocumentData#getToken()
+ */
+ @Override
+ public IToken getToken() {
+ return token;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDocumentData#setToken(org.uic.ticket.api.spec.IToken)
+ */
+ @Override
+ public void setToken(IToken token) {
+ this.token = token;
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleDocumentExtension.java b/src/org/uic/barcode/ticket/api/impl/SimpleDocumentExtension.java new file mode 100644 index 0000000..621be6b --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleDocumentExtension.java @@ -0,0 +1,35 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import org.uic.barcode.ticket.api.spec.IDocumentExtension;
+import org.uic.barcode.ticket.api.spec.IToken;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimpleDocumentExtension.
+ */
+public class SimpleDocumentExtension extends SimpleExtension implements IDocumentExtension {
+
+ /** The token. */
+ protected IToken token;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDocumentData#getToken()
+ */
+ @Override
+ public IToken getToken() {
+ return token;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IDocumentData#setToken(org.uic.ticket.api.spec.IToken)
+ */
+ @Override
+ public void setToken(IToken token) {
+ this.token = token;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleExtension.java b/src/org/uic/barcode/ticket/api/impl/SimpleExtension.java new file mode 100644 index 0000000..3ff9107 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleExtension.java @@ -0,0 +1,50 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import org.uic.barcode.ticket.api.spec.IExtension;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimpleExtension.
+ */
+public class SimpleExtension implements IExtension{
+
+ /** The id. */
+ protected String id;
+
+ /** The binarydata. */
+ protected byte[] binarydata;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IExtension#getId()
+ */
+ public String getId() {
+ return id;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IExtension#setId(java.lang.String)
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IExtension#getBinarydata()
+ */
+ public byte[] getBinarydata() {
+ return binarydata;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IExtension#setBinarydata(byte[])
+ */
+ public void setBinarydata(byte[] binarydata) {
+ this.binarydata = binarydata;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleFipTicket.java b/src/org/uic/barcode/ticket/api/impl/SimpleFipTicket.java new file mode 100644 index 0000000..a5f9dc5 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleFipTicket.java @@ -0,0 +1,218 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.Date;
+
+import java.util.LinkedHashSet;
+
+import org.uic.barcode.ticket.api.spec.IExtension;
+import org.uic.barcode.ticket.api.spec.IFipTicket;
+import org.uic.barcode.ticket.api.spec.ITravelClassType;
+
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimpleFipTicket.
+ */
+public class SimpleFipTicket extends SimpleDocumentData implements IFipTicket {
+
+
+ /** The reference. */
+ protected String reference;
+
+ /** The product id. */
+ protected String productId;
+
+ /** The product owner. */
+ protected String productOwner;
+
+ /** The class code. */
+ protected ITravelClassType classCode = ITravelClassType.second;
+
+ /** The valid from. */
+ protected Date validFrom;
+
+ /** The valid until. */
+ protected Date validUntil;
+
+
+ /** The number of travel dates. */
+ protected int numberOfTravelDates;
+
+ /** The includes suplements. */
+ protected boolean includesSupplements = true;
+
+ /** The carriers. */
+ protected Collection<String>carriers = new LinkedHashSet<String>();
+
+ /** The extension data. */
+ protected IExtension extensionData;
+
+ protected Collection<Date> activatedDays = new LinkedHashSet<Date>();
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#getNumberOfTravelDates()
+ */
+ public int getNumberOfTravelDates() {
+ return numberOfTravelDates;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#setNumberOfTravelDates(int)
+ */
+ public void setNumberOfTravelDates(int numberOfTravelDates) {
+ this.numberOfTravelDates = numberOfTravelDates;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#isIncludesSuplements()
+ */
+ public boolean isIncludesSupplements() {
+ return includesSupplements;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#setIncludesSuplements(boolean)
+ */
+ public void setIncludesSupplements(boolean includesSuplements) {
+ this.includesSupplements = includesSuplements;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#getCarriers()
+ */
+ public Collection<String> getCarriers() {
+ return carriers;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#addCarrier(java.lang.Integer)
+ */
+ public void addCarrier(String carrier) {
+ this.carriers.add(carrier);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#getReference()
+ */
+ public String getReference() {
+ return reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#setReference(java.lang.String)
+ */
+ public void setReference(String reference) {
+ this.reference = reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#getProductId()
+ */
+ public String getProductId() {
+ return productId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#setProductId(java.lang.String)
+ */
+ public void setProductId(String productId) {
+ this.productId = productId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#getProductOwner()
+ */
+ public String getProductOwner() {
+ return productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#setProductOwner(java.lang.String)
+ */
+ public void setProductOwner(String productOwner) {
+ this.productOwner = productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#getClassCode()
+ */
+ public ITravelClassType getClassCode() {
+ return classCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#setClassCode(org.uic.ticket.api.asn.om.TravelClassType)
+ */
+ public void setClassCode(ITravelClassType classCode) {
+ this.classCode = classCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#getValidFrom()
+ */
+ public Date getValidFrom() {
+ return validFrom;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#setValidFrom(java.util.Date)
+ */
+ public void setValidFrom(Date validFrom) {
+ this.validFrom = validFrom;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#getValidUntil()
+ */
+ public Date getValidUntil() {
+ return validUntil;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#setValidUntil(java.util.Date)
+ */
+ public void setValidUntil(Date validUntil) {
+ this.validUntil = validUntil;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#getExtension()
+ */
+ @Override
+ public IExtension getExtension() {
+ return extensionData;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IFipTicket#setExtension(org.uic.ticket.api.spec.IExtension)
+ */
+ @Override
+ public void setExtension(IExtension extensionData) {
+ this.extensionData = extensionData;
+ }
+
+ @Override
+ public Collection<Date> getActivatedDays() {
+ return activatedDays;
+ }
+
+ @Override
+ public void addActivatedDay(Date day) {
+ this.activatedDays.add(day);
+ }
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleGeoCoordinate.java b/src/org/uic/barcode/ticket/api/impl/SimpleGeoCoordinate.java new file mode 100644 index 0000000..405cf99 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleGeoCoordinate.java @@ -0,0 +1,207 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+
+import org.uic.barcode.ticket.api.spec.IGeoCoordinate;
+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;
+
+
+/**
+ * The Class SimpleGeoCoordinate.
+ */
+public class SimpleGeoCoordinate implements IGeoCoordinate {
+
+ /** The unit. */
+ protected IGeoUnitType unit = IGeoUnitType.milliDegree;
+
+ /** The accuracy. */
+ protected IGeoUnitType accuracy;
+
+ /** The system. */
+ protected IGeoCoordinateSystemType system = IGeoCoordinateSystemType.wgs84;
+
+ /** The hemispher longiture. */
+ protected IHemisphereLongitudeType hemispherLongiture = IHemisphereLongitudeType.north;
+
+ /** The hemisphere latitude. */
+ protected IHemisphereLatitudeType hemisphereLatitude = IHemisphereLatitudeType.east;
+
+ /** The longitude. */
+ protected Long longitude;
+
+ /** The latitude. */
+ protected Long latitude;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IGeoCoordinate#getUnit()
+ */
+ public IGeoUnitType getUnit() {
+ return unit;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IGeoCoordinate#setUnit(org.uic.ticket.api.asn.om.GeoUnitType)
+ */
+ public void setUnit(IGeoUnitType unit) {
+ this.unit = unit;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IGeoCoordinate#getAccuracy()
+ */
+ public IGeoUnitType getAccuracy() {
+ return accuracy;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IGeoCoordinate#setAccuracy(org.uic.ticket.api.asn.om.GeoUnitType)
+ */
+ public void setAccuracy(IGeoUnitType accuracy) {
+ this.accuracy = accuracy;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IGeoCoordinate#getSystem()
+ */
+ public IGeoCoordinateSystemType getSystem() {
+ return system;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IGeoCoordinate#setSystem(org.uic.ticket.api.asn.om.GeoCoordinateSystemType)
+ */
+ public void setSystem(IGeoCoordinateSystemType system) {
+ this.system = system;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IGeoCoordinate#getHemispherLongitude()
+ */
+ public IHemisphereLongitudeType getHemisphereLongitude() {
+ return hemispherLongiture;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IGeoCoordinate#setHemispherLongitude(org.uic.ticket.api.asn.om.HemisphereLongitudeType)
+ */
+ public void setHemisphereLongitude(IHemisphereLongitudeType hemispherLongiture) {
+ this.hemispherLongiture = hemispherLongiture;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IGeoCoordinate#getHemisphereLatitude()
+ */
+ public IHemisphereLatitudeType getHemisphereLatitude() {
+ return hemisphereLatitude;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IGeoCoordinate#setHemisphereLatitude(org.uic.ticket.api.asn.om.HemisphereLatitudeType)
+ */
+ public void setHemisphereLatitude(IHemisphereLatitudeType hemisphereLatitude) {
+ this.hemisphereLatitude = hemisphereLatitude;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IGeoCoordinate#getLongitude()
+ */
+ public Long getLongitude() {
+ return limitValues(longitude);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IGeoCoordinate#setLongitude(long)
+ */
+ public void setLongitude(long longitude) {
+ this.longitude = longitude;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IGeoCoordinate#getLatitude()
+ */
+ public Long getLatitude() {
+
+ return limitValues(latitude);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IGeoCoordinate#setLatitude(long)
+ */
+ public void setLatitude(long latitude) {
+ this.latitude = latitude;
+ }
+
+ public long limitValues(long value){
+
+ while (value < 0) {
+ value = value + getFullCircle();
+ }
+
+ return value % getFullCircle();
+
+ }
+
+ public long getFullCircle(){
+ if (unit == IGeoUnitType.centiDegree) {
+ return 100 * 360;
+ } else if (unit == IGeoUnitType.deciDegree) {
+ return 10 * 360;
+ } else if (unit == IGeoUnitType.milliDegree) {
+ return 1000 * 360;
+ } else if (unit == IGeoUnitType.tenthmilliDegree) {
+ return 10000 * 360;
+ } else if (unit == IGeoUnitType.milliDegree) {
+ return 100000 * 360;
+ } else {
+ return 360;
+ }
+
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see java.lang.Object#clone()
+ */
+ public SimpleGeoCoordinate clone(){
+
+ SimpleGeoCoordinate clone = new SimpleGeoCoordinate();
+
+ clone.setSystem(this.getSystem());
+ clone.setAccuracy(this.getAccuracy());
+ clone.setHemisphereLatitude(this.getHemisphereLatitude());
+ clone.setHemisphereLongitude(this.getHemisphereLongitude());
+ clone.setLatitude(this.getLatitude());
+ clone.setLongitude(this.getLongitude());
+ clone.setUnit(this.getUnit());
+
+ return clone;
+
+
+ }
+
+ /**
+ * Adds the longitude.
+ *
+ * @param l the longitude
+ */
+ public void addLongitude(Long l) {
+ long value = this.longitude + longitude;
+ this.longitude = limitValues(value);
+ }
+
+ /**
+ * Adds the latitude.
+ *
+ * @param latitude the latitude
+ */
+ public void addLatitude(Long latitude) {
+ long value = this.latitude + latitude;
+ this.latitude = limitValues(value);
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleIncludedOpenTicket.java b/src/org/uic/barcode/ticket/api/impl/SimpleIncludedOpenTicket.java new file mode 100644 index 0000000..765b992 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleIncludedOpenTicket.java @@ -0,0 +1,462 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.LinkedHashSet;
+
+import org.uic.barcode.ticket.api.spec.IExtension;
+import org.uic.barcode.ticket.api.spec.IIncludedOpenTicket;
+import org.uic.barcode.ticket.api.spec.IRegionalValidity;
+import org.uic.barcode.ticket.api.spec.IStationCodeTable;
+import org.uic.barcode.ticket.api.spec.ITariff;
+import org.uic.barcode.ticket.api.spec.ITravelClassType;
+
+/**
+ * The Class SimpleIncludedOpenTicket.
+ */
+public class SimpleIncludedOpenTicket implements IIncludedOpenTicket {
+
+ /** The departure date. */
+ protected Date departureDate;
+
+ /** The arrival date. */
+ protected Date arrivalDate;
+
+ /** The product id. */
+ protected String productId;
+
+ /** The product owner. */
+ protected String productOwner;
+
+ /** The external issuer. */
+ protected int externalIssuer;
+
+ /** The authorization code. */
+ protected int authorizationCode;
+
+ /** The station code table. */
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUIC;
+
+ /** The from station. */
+ protected String fromStation;
+
+ /** The to station. */
+ protected String toStation;
+
+ /** The from station name. */
+ protected String fromStationName;
+
+ /** The to station name. */
+ protected String toStationName;
+
+ /** The valid region desc. */
+ protected String validRegionDesc;
+
+ /** The valid region list. */
+ protected Collection<IRegionalValidity> validRegionList = new LinkedHashSet<IRegionalValidity>();
+
+ /** The valid from. */
+ protected Date validFrom;
+
+ /** The valid until. */
+ protected Date validUntil;
+
+ /** The class code. */
+ protected ITravelClassType classCode = ITravelClassType.second;
+
+ /** The included carriers. */
+ protected Collection<String>includedCarriers = new LinkedHashSet<String>();
+
+ /** The included service brands. */
+ protected Collection<Integer>includedServiceBrands = new LinkedHashSet<Integer>();
+
+ /** The excluded service brands. */
+ protected Collection<Integer>excludedServiceBrands = new LinkedHashSet<Integer>();
+
+ /** The tariffs. */
+ protected Collection<ITariff> tariffs = new LinkedHashSet<ITariff>();
+
+
+ /** The info text. */
+ protected String infoText;
+
+ /** The extension. */
+ protected IExtension extension;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getDepartureDate()
+ */
+ public Date getDepartureDate() {
+ return departureDate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setDepartureDate(java.util.Date)
+ */
+ public void setDepartureDate(Date departureDate) {
+ this.departureDate = departureDate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getArrivalDate()
+ */
+ public Date getArrivalDate() {
+ return arrivalDate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setArrivalDate(java.util.Date)
+ */
+ public void setArrivalDate(Date arrivalDate) {
+ this.arrivalDate = arrivalDate;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getProductId()
+ */
+ public String getProductId() {
+ return productId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setProductId(java.lang.String)
+ */
+ public void setProductId(String productId) {
+ this.productId = productId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getProductOwner()
+ */
+ public String getProductOwner() {
+ return productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setProductOwner(java.lang.String)
+ */
+ public void setProductOwner(String productOwner) {
+ this.productOwner = productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getExternalIssuer()
+ */
+ public int getExternalIssuer() {
+ return externalIssuer;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setExternalIssuer(int)
+ */
+ public void setExternalIssuer(int externalIssuer) {
+ this.externalIssuer = externalIssuer;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getAuthorizationCode()
+ */
+ public int getAuthorizationCode() {
+ return authorizationCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setAuthorizationCode(int)
+ */
+ public void setAuthorizationCode(int authorizationCode) {
+ this.authorizationCode = authorizationCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getStationCodeTable()
+ */
+ public IStationCodeTable getStationCodeTable() {
+ return stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getFromStation()
+ */
+ public String getFromStation() {
+ return fromStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setFromStation(java.lang.String)
+ */
+ public void setFromStation(String fromStation) {
+ this.fromStation = fromStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getToStation()
+ */
+ public String getToStation() {
+ return toStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setToStation(java.lang.String)
+ */
+ public void setToStation(String toStation) {
+ this.toStation = toStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getFromStationName()
+ */
+ public String getFromStationName() {
+ return fromStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setFromStationName(java.lang.String)
+ */
+ public void setFromStationName(String fromStationName) {
+ this.fromStationName = fromStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getToStationName()
+ */
+ public String getToStationName() {
+ return toStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setToStationName(java.lang.String)
+ */
+ public void setToStationName(String toStationName) {
+ this.toStationName = toStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getValidRegionDesc()
+ */
+ public String getValidRegionDesc() {
+ return validRegionDesc;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setValidRegionDesc(java.lang.String)
+ */
+ public void setValidRegionDesc(String validRegionDesc) {
+ this.validRegionDesc = validRegionDesc;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getValidRegionList()
+ */
+ public Collection<IRegionalValidity> getValidRegionList() {
+ return validRegionList;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#addValidRegionList(org.uic.ticket.api.spec.IRegionalValidity)
+ */
+ public void addValidRegionList(IRegionalValidity validRegion) {
+ this.validRegionList.add(validRegion);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getValidFrom()
+ */
+ public Date getValidFrom() {
+ return validFrom;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setValidFrom(java.util.Date)
+ */
+ public void setValidFrom(Date validFrom) {
+ this.validFrom = validFrom;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getValidUntil()
+ */
+ public Date getValidUntil() {
+ return validUntil;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setValidUntil(java.util.Date)
+ */
+ public void setValidUntil(Date validUntil) {
+ this.validUntil = validUntil;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getClassCode()
+ */
+ public ITravelClassType getClassCode() {
+ return classCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setClassCode(org.uic.ticket.api.asn.om.TravelClassType)
+ */
+ public void setClassCode(ITravelClassType classCode) {
+ this.classCode = classCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getIncludedCarriers()
+ */
+ public Collection<String> getIncludedCarriers() {
+ return includedCarriers;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#addIncludedCarrier(java.lang.Integer)
+ */
+ public void addIncludedCarrier(String carrier) {
+ this.includedCarriers.add(carrier);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getIncludedServiceBrands()
+ */
+ public Collection<Integer> getIncludedServiceBrands() {
+ return includedServiceBrands;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#addIncludedServiceBrand(java.lang.Integer)
+ */
+ public void addIncludedServiceBrand(Integer includedServiceBrand) {
+ this.includedServiceBrands.add(includedServiceBrand);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getExcludedServiceBrands()
+ */
+ public Collection<Integer> getExcludedServiceBrands() {
+ return excludedServiceBrands;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#addExcludedServiceBrand(java.lang.Integer)
+ */
+ public void addExcludedServiceBrand(Integer excludedServiceBrand) {
+ this.excludedServiceBrands.add(excludedServiceBrand);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getTariffs()
+ */
+ public Collection<ITariff> getTariffs() {
+ return tariffs;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#addTariff(org.uic.ticket.api.spec.ITariff)
+ */
+ public void addTariff(ITariff tariff) {
+ this.tariffs.add(tariff);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getInfoText()
+ */
+ public String getInfoText() {
+ return infoText;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setInfoText(java.lang.String)
+ */
+ public void setInfoText(String infoText) {
+ this.infoText = infoText;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getExtension()
+ */
+ public IExtension getExtension() {
+ return extension;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setExtension(org.uic.ticket.api.spec.IExtension)
+ */
+ public void setExtension(IExtension extension) {
+ this.extension = extension;
+ }
+
+ /** The valid from utc coffset. */
+ protected Long validFromUTCoffset;
+
+ /** The valid until utc coffset. */
+ protected Long validUntilUTCoffset;
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getValidFromUTCoffset()
+ */
+ public Long getValidFromUTCoffset() {
+ return validFromUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setValidFromUTCoffset(java.lang.Long)
+ */
+ public void setValidFromUTCoffset(Long validFromUTCoffset) {
+ this.validFromUTCoffset = validFromUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#getValidUntilUTCoffset()
+ */
+ public Long getValidUntilUTCoffset() {
+ return validUntilUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIncludedOpenTicket#setValidUntilUTCoffset(java.lang.Long)
+ */
+ public void setValidUntilUTCoffset(Long validUntilUTCoffset) {
+ this.validUntilUTCoffset = validUntilUTCoffset;
+ }
+
+ @Override
+ public void setUntilDate(Date date) {
+ this.validUntil = date;
+ }
+
+ @Override
+ public Collection<Integer> getExcludedTransportTypes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addExcludedTransportType(Integer excludedTransportType) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Collection<Integer> getIncludedTransportTypes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addInludedTransportType(Integer includedTransportType) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleIssuingDetail.java b/src/org/uic/barcode/ticket/api/impl/SimpleIssuingDetail.java new file mode 100644 index 0000000..34a1ef2 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleIssuingDetail.java @@ -0,0 +1,230 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Date;
+
+import org.uic.barcode.ticket.api.spec.IExtension;
+import org.uic.barcode.ticket.api.spec.IGeoCoordinate;
+import org.uic.barcode.ticket.api.spec.IIssuingDetail;
+
+
+/**
+ * The Class SimpleIssuerDetails.
+ */
+public class SimpleIssuingDetail implements IIssuingDetail{
+
+
+ /** The issuer. */
+ protected String issuer;
+
+ /** The issuing date. */
+ protected Date issuingDate;
+
+ /** The security provider. */
+ protected String securityProvider;
+
+ /** The issuer name. */
+ protected String issuerName;
+
+ /** The specimen. */
+ protected boolean specimen = false;
+
+ /** The activated. */
+ protected boolean activated = true;
+
+ /** The issuer pnr. */
+ protected String issuerPNR;
+
+ /** The extension. */
+ protected IExtension extension;
+
+ /** The issued on train. */
+ protected String issuedOnTrain;
+
+ /** The line number in case the ticket was issuer on a local transport line. */
+ Integer issuedOnLine = 0;
+
+ /** The point of sale. */
+ protected IGeoCoordinate pointOfSale;
+
+ /** The secure paper ticket. */
+ protected boolean securePaperTicket;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.IIssuingDetail#getIssuer()
+ */
+ public String getIssuer() {
+ if (issuer == null || issuer.length() == 0){
+ return this.securityProvider;
+ }
+ return issuer;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.IIssuingDetail#setIssuer(java.lang.String)
+ */
+ public void setIssuer(String issuer) {
+ this.issuer = issuer;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.IIssuingDetail#getIssuingDate()
+ */
+ public Date getIssuingDate() {
+ return issuingDate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.IIssuingDetail#setIssuingDate(java.util.Date)
+ */
+ public void setIssuingDate(Date issuingDate) {
+ this.issuingDate = issuingDate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#getSecurityProvider()
+ */
+ public String getSecurityProvider() {
+ return securityProvider;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#setSecurityProvider(int)
+ */
+ public void setSecurityProvider(String securityProvider) {
+ this.securityProvider = securityProvider;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#getIssuerName()
+ */
+ public String getIssuerName() {
+ return issuerName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#setIssuerName(java.lang.String)
+ */
+ public void setIssuerName(String issuerName) {
+ this.issuerName = issuerName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#isSpecimen()
+ */
+ public boolean isSpecimen() {
+ return specimen;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#setSpecimen(boolean)
+ */
+ public void setSpecimen(boolean specimen) {
+ this.specimen = specimen;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#isActivated()
+ */
+ public boolean isActivated() {
+ return activated;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#setActivated(boolean)
+ */
+ public void setActivated(boolean activated) {
+ this.activated = activated;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#getIssuerPNR()
+ */
+ public String getIssuerPNR() {
+ return issuerPNR;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#setIssuerPNR(java.lang.String)
+ */
+ public void setIssuerPNR(String issuerPNR) {
+ this.issuerPNR = issuerPNR;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#getExtension()
+ */
+ public IExtension getExtension() {
+ return extension;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#setExtension(org.uic.ticket.api.spec.IExtension)
+ */
+ public void setExtension(IExtension extension) {
+ this.extension = extension;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#getIssuedOnTrain()
+ */
+ public String getIssuedOnTrain() {
+ return issuedOnTrain;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#setIssuedOnTrain(java.lang.String)
+ */
+ public void setIssuedOnTrain(String issuedOnTrain) {
+ this.issuedOnTrain = issuedOnTrain;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#getIssuedOnLine()
+ */
+ public Integer getIssuedOnLine() {
+ return issuedOnLine;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#setIssuedOnLine(int)
+ */
+ public void setIssuedOnLine(Integer issuedOnLine) {
+ this.issuedOnLine = issuedOnLine;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#getPointOfSale()
+ */
+ public IGeoCoordinate getPointOfSale() {
+ return pointOfSale;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#setPointOfSale(org.uic.ticket.api.spec.IGeoCoordinate)
+ */
+ public void setPointOfSale(IGeoCoordinate pointOfSale) {
+ this.pointOfSale = pointOfSale;
+ }
+
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#isSecurePaperTicket()
+ */
+ public boolean isSecurePaperTicket() {
+ return securePaperTicket;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IIssuingDetail#setSecurePaperTicket(boolean)
+ */
+ public void setSecurePaperTicket(boolean securePaperTicket) {
+ this.securePaperTicket = securePaperTicket;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleLine.java b/src/org/uic/barcode/ticket/api/impl/SimpleLine.java new file mode 100644 index 0000000..6fe82c9 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleLine.java @@ -0,0 +1,138 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.HashSet;
+
+import org.uic.barcode.ticket.api.spec.ILine;
+import org.uic.barcode.ticket.api.spec.IStationCodeTable;
+
+/**
+ * The Class SimpleLine.
+ */
+public class SimpleLine implements ILine {
+
+ /** The carrier. */
+ protected String carrier;
+
+ /** The line ids. */
+ protected HashSet<Integer> lineIds = new HashSet<Integer>();
+
+ /** The station code table. */
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUIC;
+
+ /** The entry station. */
+ protected String entryStation;
+
+ /** The terminating station. */
+ protected String terminatingStation;
+
+ /** The city. */
+ protected int city;
+
+ /** The binary zone id. */
+ protected byte[] binaryZoneId;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILine#getCarrier()
+ */
+ public String getCarrier() {
+ return carrier;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILine#setCarrier(java.lang.String)
+ */
+ public void setCarrier(String carrier) {
+ this.carrier = carrier;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILine#getLineIds()
+ */
+ public HashSet<Integer> getLineIds() {
+ return lineIds;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILine#addLineId(java.lang.Integer)
+ */
+ public void addLineId(Integer lineId) {
+ this.lineIds.add(lineId);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILine#getStationCodeTable()
+ */
+ public IStationCodeTable getStationCodeTable() {
+ return stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILine#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILine#getEntryStation()
+ */
+ public String getEntryStation() {
+ return entryStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILine#setEntryStation(java.lang.String)
+ */
+ public void setEntryStation(String entryStation) {
+ this.entryStation = entryStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILine#getTerminatingStation()
+ */
+ public String getTerminatingStation() {
+ return terminatingStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILine#setTerminatingStation(java.lang.String)
+ */
+ public void setTerminatingStation(String terminatingStation) {
+ this.terminatingStation = terminatingStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILine#getCity()
+ */
+ public int getCity() {
+ return city;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILine#setCity(int)
+ */
+ public void setCity(int city) {
+ this.city = city;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILine#getBinaryZoneId()
+ */
+ public byte[] getBinaryZoneId() {
+ return binaryZoneId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILine#setBinaryZoneId(byte[])
+ */
+ public void setBinaryZoneId(byte[] binatyZoneId) {
+ this.binaryZoneId = binatyZoneId;
+ }
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleLuggageRestriction.java b/src/org/uic/barcode/ticket/api/impl/SimpleLuggageRestriction.java new file mode 100644 index 0000000..8ded7ba --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleLuggageRestriction.java @@ -0,0 +1,71 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.uic.barcode.ticket.api.spec.ILuggageRestriction;
+import org.uic.barcode.ticket.api.spec.IRegisteredLuggage;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimpleLuggageRestriction.
+ */
+public class SimpleLuggageRestriction implements ILuggageRestriction {
+
+ /** The max hand luggage pieces. */
+ protected int maxHandLuggagePieces = 3;
+
+ /** The max non hand luggage pieces. */
+ protected int maxNonHandLuggagePieces= 1;
+
+ /** The registered luggage. */
+ protected Collection<IRegisteredLuggage> registeredLuggage = new HashSet<IRegisteredLuggage>();
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILuggageRestriction#getMaxHandLuggagePieces()
+ */
+ public int getMaxHandLuggagePieces() {
+ return maxHandLuggagePieces;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILuggageRestriction#setMaxHandLuggagePieces(int)
+ */
+ public void setMaxHandLuggagePieces(int maxHandLuggagePieces) {
+ this.maxHandLuggagePieces = maxHandLuggagePieces;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILuggageRestriction#getMaxNonHandLuggagePieces()
+ */
+ public int getMaxNonHandLuggagePieces() {
+ return maxNonHandLuggagePieces;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILuggageRestriction#setMaxNonHandLuggagePieces(int)
+ */
+ public void setMaxNonHandLuggagePieces(int maxNonHandLuggagePieces) {
+ this.maxNonHandLuggagePieces = maxNonHandLuggagePieces;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILuggageRestriction#getRegisteredLuggage()
+ */
+ public Collection<IRegisteredLuggage> getRegisteredLuggage() {
+ return registeredLuggage;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ILuggageRestriction#addRegisteredLuggage(org.uic.ticket.api.spec.IRegisteredLuggage)
+ */
+ public void addRegisteredLuggage(IRegisteredLuggage registeredLuggage) {
+ this.registeredLuggage.add(registeredLuggage);
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleOpenTicket.java b/src/org/uic/barcode/ticket/api/impl/SimpleOpenTicket.java new file mode 100644 index 0000000..0af10a8 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleOpenTicket.java @@ -0,0 +1,603 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.LinkedHashSet;
+
+import org.uic.barcode.ticket.api.spec.IExtension;
+import org.uic.barcode.ticket.api.spec.IIncludedOpenTicket;
+import org.uic.barcode.ticket.api.spec.ILuggageRestriction;
+import org.uic.barcode.ticket.api.spec.IOpenTicket;
+import org.uic.barcode.ticket.api.spec.IRegionalValidity;
+import org.uic.barcode.ticket.api.spec.IReturnRouteDescription;
+import org.uic.barcode.ticket.api.spec.IStationCodeTable;
+import org.uic.barcode.ticket.api.spec.ITariff;
+import org.uic.barcode.ticket.api.spec.ITravelClassType;
+import org.uic.barcode.ticket.api.spec.IVatDetail;
+
+
+/**
+ * The Class SimpleOpenTicket.
+ */
+public class SimpleOpenTicket extends SimpleDocumentData implements IOpenTicket {
+
+ /** The reference. */
+ protected String reference;
+
+ /** The product id. */
+ protected String productId;
+
+ /** The product owner. */
+ protected String productOwner;
+
+
+ /** The valid from. */
+ protected Date validFrom;
+
+ /** The valid until. */
+ protected Date validUntil;
+
+ /** The info text. */
+ protected String infoText;
+
+ /** The extension. */
+ protected IExtension extension;
+
+
+ /** The departure date. */
+ protected Date departureDate;
+
+ /** The arrival date. */
+ protected Date arrivalDate;
+
+ /** The external issuer. */
+ protected int externalIssuer;
+
+ /** The authorization code. */
+ protected int authorizationCode;
+
+ /** The return included. */
+ protected boolean returnIncluded = false;
+
+ /** The station code table. */
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUIC;
+
+ /** The from station. */
+ protected String fromStation;
+
+ /** The to station. */
+ protected String toStation;
+
+ /** The from station name. */
+ protected String fromStationName;
+
+ /** The to station name. */
+ protected String toStationName;
+
+ /** The valid region desc. */
+ protected String validRegionDesc;
+
+ /** The valid region list. */
+ protected Collection<IRegionalValidity> validRegionList = new LinkedHashSet<IRegionalValidity>();
+
+ /** The return description. */
+ protected IReturnRouteDescription returnDescription;
+
+
+ /** The activated days. */
+ protected Collection<Date> activatedDays = new LinkedHashSet<Date>();
+
+ /** The class code. */
+ protected ITravelClassType classCode = ITravelClassType.second;
+
+
+ /** The service level. */
+ protected String serviceLevel;
+
+ /** The included carriers. */
+ protected Collection<String>includedCarriers = new LinkedHashSet<String>();
+
+ /** The included service brands. */
+ protected Collection<Integer>includedServiceBrands = new LinkedHashSet<Integer>();
+
+ /** The excluded service brands. */
+ protected Collection<Integer>excludedServiceBrands = new LinkedHashSet<Integer>();
+
+ /** The included service brands. */
+ protected Collection<Integer>includedTransportTypes = new LinkedHashSet<Integer>();
+
+ /** The excluded service brands. */
+ protected Collection<Integer>excludedTransportTypes = new LinkedHashSet<Integer>();
+
+ /** The tariffs. */
+ protected Collection<ITariff> tariffs = new LinkedHashSet<ITariff>();
+
+ /** The included add ons. */
+ protected Collection<IIncludedOpenTicket>includedAddOns = new LinkedHashSet<IIncludedOpenTicket>();
+
+
+ /** The luggage restriction. */
+ protected ILuggageRestriction luggageRestriction;
+
+ /** The price. */
+ protected Long price;
+
+ /** The included add ons. */
+ protected Collection<IVatDetail> vatDetails = new LinkedHashSet<IVatDetail>();
+
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getExternalIssuer()
+ */
+ public int getExternalIssuer() {
+ return externalIssuer;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setExternalIssuer(int)
+ */
+ public void setExternalIssuer(int externalIssuer) {
+ this.externalIssuer = externalIssuer;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getAuthorizationCode()
+ */
+ public int getAuthorizationCode() {
+ return authorizationCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setAuthorizationCode(int)
+ */
+ public void setAuthorizationCode(int authorizationCode) {
+ this.authorizationCode = authorizationCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#isReturnIncluded()
+ */
+ public boolean isReturnIncluded() {
+ return returnIncluded;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setReturnIncluded(boolean)
+ */
+ public void setReturnIncluded(boolean returnIncluded) {
+ this.returnIncluded = returnIncluded;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getStationCodeTable()
+ */
+ public IStationCodeTable getStationCodeTable() {
+ return stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getFromStation()
+ */
+ public String getFromStation() {
+ return fromStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setFromStation(java.lang.String)
+ */
+ public void setFromStation(String fromStation) {
+ this.fromStation = fromStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getToStation()
+ */
+ public String getToStation() {
+ return toStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setToStation(java.lang.String)
+ */
+ public void setToStation(String toStation) {
+ this.toStation = toStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getFromStationName()
+ */
+ public String getFromStationName() {
+ return fromStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setFromStationName(java.lang.String)
+ */
+ public void setFromStationName(String fromStationName) {
+ this.fromStationName = fromStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getToStationName()
+ */
+ public String getToStationName() {
+ return toStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setToStationName(java.lang.String)
+ */
+ public void setToStationName(String toStationName) {
+ this.toStationName = toStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getValidRegionDesc()
+ */
+ public String getValidRegionDesc() {
+ return validRegionDesc;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setValidRegionDesc(java.lang.String)
+ */
+ public void setValidRegionDesc(String validRegionDesc) {
+ this.validRegionDesc = validRegionDesc;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getValidRegionList()
+ */
+ public Collection<IRegionalValidity> getValidRegionList() {
+ return validRegionList;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#addValidRegionList(org.uic.ticket.api.spec.IRegionalValidity)
+ */
+ public void addValidRegionList(IRegionalValidity validRegion) {
+ this.validRegionList.add(validRegion);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getReturnDescription()
+ */
+ public IReturnRouteDescription getReturnDescription() {
+ return returnDescription;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setReturnDescription(org.uic.ticket.api.spec.IReturnRouteDescription)
+ */
+ public void setReturnDescription(IReturnRouteDescription returnDescription) {
+ this.returnDescription = returnDescription;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getActivatedDays()
+ */
+ public Collection<Date> getActivatedDays() {
+ return activatedDays;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#addActivatedDay(java.util.Date)
+ */
+ public void addActivatedDay(Date activatedDay) {
+ this.activatedDays.add(activatedDay);
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getIncludedCarriers()
+ */
+ public Collection<String> getIncludedCarriers() {
+ return includedCarriers;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#addIncludedCarrier(java.lang.Integer)
+ */
+ public void addIncludedCarrier(String includedCarrier) {
+ this.includedCarriers.add(includedCarrier);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getIncludedServiceBrands()
+ */
+ public Collection<Integer> getIncludedServiceBrands() {
+ return includedServiceBrands;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#addIncludedServiceBrand(java.lang.Integer)
+ */
+ public void addIncludedServiceBrand(Integer includedServiceBrand) {
+ this.includedServiceBrands.add(includedServiceBrand);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getExcludedServiceBrands()
+ */
+ public Collection<Integer> getExcludedServiceBrands() {
+ return excludedServiceBrands;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#addExcludedServiceBrand(java.lang.Integer)
+ */
+ public void addExcludedServiceBrand(Integer excludedServiceBrand) {
+ this.excludedServiceBrands.add(excludedServiceBrand);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getTariffs()
+ */
+ public Collection<ITariff> getTariffs() {
+ return tariffs;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#addTariff(org.uic.ticket.api.spec.ITariff)
+ */
+ public void addTariff(ITariff tariff) {
+ this.tariffs.add(tariff);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getIncludedAddOns()
+ */
+ public Collection<IIncludedOpenTicket> getIncludedAddOns() {
+ return includedAddOns;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#addIncludedAddOn(org.uic.ticket.api.spec.IIncludedOpenTicket)
+ */
+ public void addIncludedAddOn(IIncludedOpenTicket includedAddOn) {
+ this.includedAddOns.add(includedAddOn);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getLuggageRestriction()
+ */
+ public ILuggageRestriction getLuggageRestriction() {
+ return luggageRestriction;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setLuggageRestriction(org.uic.ticket.api.spec.ILuggageRestriction)
+ */
+ public void setLuggageRestriction(ILuggageRestriction luggageRestriction) {
+ this.luggageRestriction = luggageRestriction;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getReference()
+ */
+ public String getReference() {
+ return reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setReference(java.lang.String)
+ */
+ public void setReference(String reference) {
+ this.reference = reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getProductId()
+ */
+ public String getProductId() {
+ return productId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setProductId(java.lang.String)
+ */
+ public void setProductId(String productId) {
+ this.productId = productId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getProductOwner()
+ */
+ public String getProductOwner() {
+ return productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setProductOwner(java.lang.String)
+ */
+ public void setProductOwner(String productOwner) {
+ this.productOwner = productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getValidFrom()
+ */
+ public Date getValidFrom() {
+ return validFrom;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setValidFrom(java.util.Date)
+ */
+ public void setValidFrom(Date validFrom) {
+ this.validFrom = validFrom;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getValidUntil()
+ */
+ public Date getValidUntil() {
+ return validUntil;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setValidUntil(java.util.Date)
+ */
+ public void setValidUntil(Date validUntil) {
+ this.validUntil = validUntil;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getInfoText()
+ */
+ public String getInfoText() {
+ return infoText;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setInfoText(java.lang.String)
+ */
+ public void setInfoText(String infoText) {
+ this.infoText = infoText;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getExtension()
+ */
+ public IExtension getExtension() {
+ return extension;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setExtension(org.uic.ticket.api.spec.IExtension)
+ */
+ public void setExtension(IExtension extension) {
+ this.extension = extension;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getClassCode()
+ */
+ public ITravelClassType getClassCode() {
+ return classCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setClassCode(org.uic.ticket.api.asn.om.TravelClassType)
+ */
+ public void setClassCode(ITravelClassType classCode) {
+ this.classCode = classCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setServiceLevel(java.lang.String)
+ */
+ @Override
+ public void setServiceLevel(String serviceLevel) {
+ this.serviceLevel = serviceLevel;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getServiceLevel()
+ */
+ @Override
+ public String getServiceLevel() {
+ return serviceLevel;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setPrice(java.lang.Long)
+ */
+ @Override
+ public void setPrice(Long price) {
+ this.price = price;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getPrice()
+ */
+ @Override
+ public Long getPrice() {
+ return this.price;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getVatDetails()
+ */
+ @Override
+ public Collection<IVatDetail> getVatDetails() {
+ return this.vatDetails;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#addVatDetail(org.uic.ticket.api.spec.IVatDetail)
+ */
+ @Override
+ public void addVatDetail(IVatDetail vatDetail) {
+ this.vatDetails.add(vatDetail);
+ }
+
+
+ /** The valid from utc coffset. */
+ protected Long validFromUTCoffset;
+
+ /** The valid until utc coffset. */
+ protected Long validUntilUTCoffset;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getValidFromUTCoffset()
+ */
+ public Long getValidFromUTCoffset() {
+ return validFromUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setValidFromUTCoffset(java.lang.Long)
+ */
+ public void setValidFromUTCoffset(Long validFromUTCoffset) {
+ this.validFromUTCoffset = validFromUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#getValidUntilUTCoffset()
+ */
+ public Long getValidUntilUTCoffset() {
+ return validUntilUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IOpenTicket#setValidUntilUTCoffset(java.lang.Long)
+ */
+ public void setValidUntilUTCoffset(Long validUntilUTCoffset) {
+ this.validUntilUTCoffset = validUntilUTCoffset;
+ }
+
+ @Override
+ public Collection<Integer> getExcludedTransportTypes() {
+ return excludedTransportTypes;
+ }
+
+ @Override
+ public void addExcludedTransportType(Integer excludedTransportType) {
+ excludedTransportTypes.add(excludedTransportType);
+ }
+
+ @Override
+ public Collection<Integer> getIncludedTransportTypes() {
+ return includedTransportTypes;
+ }
+
+ @Override
+ public void addInludedTransportType(Integer includedTransportType) {
+ includedTransportTypes.add(includedTransportType);
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleParkingGround.java b/src/org/uic/barcode/ticket/api/impl/SimpleParkingGround.java new file mode 100644 index 0000000..b52c6a1 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleParkingGround.java @@ -0,0 +1,291 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.LinkedHashSet;
+
+import org.uic.barcode.ticket.api.spec.IExtension;
+import org.uic.barcode.ticket.api.spec.IParkingGround;
+import org.uic.barcode.ticket.api.spec.IStationCodeTable;
+import org.uic.barcode.ticket.api.spec.IVatDetail;
+
+
+/**
+ * The Class SimpleParkingGround.
+ */
+public class SimpleParkingGround extends SimpleDocumentData implements IParkingGround {
+
+ /** The parking ground id. */
+ protected String parkingGroundId;
+
+ /** The product owner. */
+ protected String productOwner;
+
+ /** The product id. */
+ protected String productId;
+
+ /** The from parking date. */
+ protected Date fromParkingDate;
+
+ /** The to parking date. */
+ protected Date toParkingDate;
+
+ /** The reference. */
+ protected String reference;
+
+ /** The access code. */
+ protected String accessCode;
+
+ /** The location. */
+ protected String location;
+
+ /** The station. */
+ protected String station;
+
+ /** The special information. */
+ protected String specialInformation;
+
+ /** The entry track. */
+ protected String entryTrack;
+
+ /** The number plate. */
+ protected String numberPlate;
+
+ /** The station code table. */
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUIC;
+
+ /** The extension data. */
+ protected IExtension extensionData;
+
+ /** The VAT details. */
+ protected Collection<IVatDetail>vatDetails = new LinkedHashSet<IVatDetail>();
+
+ protected Long price;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#getParkingGroundId()
+ */
+ public String getParkingGroundId() {
+ return parkingGroundId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#setParkingGroundId(java.lang.String)
+ */
+ public void setParkingGroundId(String parkingGroundId) {
+ this.parkingGroundId = parkingGroundId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#getFromParkingDate()
+ */
+ public Date getFromParkingDate() {
+ return fromParkingDate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#setFromParkingDate(java.util.Date)
+ */
+ public void setFromParkingDate(Date parkingDate) {
+ this.fromParkingDate = parkingDate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#getToParkingDate()
+ */
+ public Date getToParkingDate() {
+ if (toParkingDate==null) {
+ return fromParkingDate;
+ }
+
+ return toParkingDate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#setToParkingDate(java.util.Date)
+ */
+ public void setToParkingDate(Date parkingDate) {
+ this.toParkingDate = parkingDate;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#getReference()
+ */
+ public String getReference() {
+ return reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#setReference(java.lang.String)
+ */
+ public void setReference(String reference) {
+ this.reference = reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#getAccessCode()
+ */
+ public String getAccessCode() {
+ return accessCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#setAccessCode(java.lang.String)
+ */
+ public void setAccessCode(String accessCode) {
+ this.accessCode = accessCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#getLocation()
+ */
+ public String getLocation() {
+ return location;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#setLocation(java.lang.String)
+ */
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#getStation()
+ */
+ public String getStation() {
+ return station;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#setStation(java.lang.String)
+ */
+ public void setStation(String station) {
+ this.station = station;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#getSpecialInformation()
+ */
+ public String getSpecialInformation() {
+ return specialInformation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#setSpecialInformation(java.lang.String)
+ */
+ public void setSpecialInformation(String specialInformation) {
+ this.specialInformation = specialInformation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#getEntryTrack()
+ */
+ public String getEntryTrack() {
+ return entryTrack;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#setEntryTrack(java.lang.String)
+ */
+ public void setEntryTrack(String entryTrack) {
+ this.entryTrack = entryTrack;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#getNumberPlate()
+ */
+ public String getNumberPlate() {
+ return numberPlate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#setNumberPlate(java.lang.String)
+ */
+ public void setNumberPlate(String numberPlate) {
+ this.numberPlate = numberPlate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#getExtension()
+ */
+ public IExtension getExtension() {
+ return extensionData;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#setExtension(org.uic.ticket.api.spec.IExtension)
+ */
+ public void setExtension(IExtension extensionData) {
+ this.extensionData = extensionData;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#getStationCodeTable()
+ */
+ public IStationCodeTable getStationCodeTable() {
+ return stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#getProductOwner()
+ */
+ public String getProductOwner() {
+ return productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#setProductOwner(java.lang.String)
+ */
+ public void setProductOwner(String productOwner) {
+ this.productOwner = productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#getProductId()
+ */
+ @Override
+ public String getProductId() {
+ return productId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IParkingGround#setProductId(java.lang.String)
+ */
+ @Override
+ public void setProductId(String productId) {
+ this.productId = productId;
+ }
+
+ @Override
+ public void setPrice(Long price) {
+ this.price = price;
+ }
+
+ @Override
+ public Long getPrice() {
+ return price;
+ }
+
+ @Override
+ public Collection<IVatDetail> getVatDetails() {
+ return vatDetails;
+ }
+
+ @Override
+ public void addVatDetail(IVatDetail vatDetail) {
+ this.vatDetails.add(vatDetail);
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimplePass.java b/src/org/uic/barcode/ticket/api/impl/SimplePass.java new file mode 100644 index 0000000..a8f4a92 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimplePass.java @@ -0,0 +1,485 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.LinkedHashSet;
+
+import org.uic.barcode.ticket.api.spec.IExtension;
+import org.uic.barcode.ticket.api.spec.IPass;
+import org.uic.barcode.ticket.api.spec.IRegionalValidity;
+import org.uic.barcode.ticket.api.spec.ITariff;
+import org.uic.barcode.ticket.api.spec.ITravelClassType;
+import org.uic.barcode.ticket.api.spec.IValidityDetails;
+import org.uic.barcode.ticket.api.spec.IVatDetail;
+
+
+/**
+ * The Class SimplePass.
+ */
+public class SimplePass extends SimpleDocumentData implements IPass {
+
+ /** The reference. */
+ protected String reference;
+
+ /** The product id. */
+ protected String productId;
+
+ /** The product owner. */
+ protected String productOwner;
+
+ /** The class code. */
+ protected ITravelClassType classCode = ITravelClassType.second;
+
+ /** The valid from. */
+ protected Date validFrom;
+
+ /** The valid until. */
+ protected Date validUntil;
+
+ /** The info text. */
+ protected String infoText;
+
+ /** The extension. */
+ protected IExtension extension;
+
+
+ /** The pass type. */
+ protected int passType;
+
+ /** The pass description. */
+ protected String passDescription;
+
+
+ /** The number of validity days. */
+ protected int numberOfValidityDays;
+
+ /** The number of possible trips. */
+ protected int numberOfPossibleTrips;
+
+ /** The number of days of travel. */
+ protected int numberOfDaysOfTravel;
+
+
+ /** The activated days. */
+ protected Collection<Date> activatedDays = new LinkedHashSet<Date>();
+
+ /** The countries. */
+ protected Collection<Integer>countries = new LinkedHashSet<Integer>();
+
+ /** The included carriers. */
+ protected Collection<String>includedCarriers = new LinkedHashSet<String>();
+
+ /** The excluded carriers. */
+ protected Collection<String>excludedCarriers = new LinkedHashSet<String>();
+
+ /** The included service brands. */
+ protected Collection<Integer>includedServiceBrands = new LinkedHashSet<Integer>();
+
+ /** The excluded service brands. */
+ protected Collection<Integer>excludedServiceBrands = new LinkedHashSet<Integer>();
+
+ /** The valid region list. */
+ protected Collection<IRegionalValidity> validRegionList = new LinkedHashSet<IRegionalValidity>();
+
+ /** The tariffs. */
+ protected Collection<ITariff> tariffs = new LinkedHashSet<ITariff>();
+
+
+
+ /** The validity details. */
+ protected IValidityDetails validityDetails;
+
+ /** The VAT details. */
+ protected Collection<IVatDetail>vatDetails = new LinkedHashSet<IVatDetail>();
+
+ /** The price. */
+ protected Long price;
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getPassType()
+ */
+ public int getPassType() {
+ return passType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#setPassType(int)
+ */
+ public void setPassType(int passType) {
+ this.passType = passType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getPassDescription()
+ */
+ public String getPassDescription() {
+ return passDescription;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#setPassDescription(java.lang.String)
+ */
+ public void setPassDescription(String passDescription) {
+ this.passDescription = passDescription;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getNumberOfValidityDays()
+ */
+ public int getNumberOfValidityDays() {
+ return numberOfValidityDays;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#setNumberOfValidityDays(int)
+ */
+ public void setNumberOfValidityDays(int numberOfValidityDays) {
+ this.numberOfValidityDays = numberOfValidityDays;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getNumberOfPossibleTrips()
+ */
+ public int getNumberOfPossibleTrips() {
+ return numberOfPossibleTrips;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#setNumberOfPossibleTrips(int)
+ */
+ public void setNumberOfPossibleTrips(int numberOfPossibleTrips) {
+ this.numberOfPossibleTrips = numberOfPossibleTrips;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getNumberOfDaysOfTravel()
+ */
+ public int getNumberOfDaysOfTravel() {
+ return numberOfDaysOfTravel;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#setNumberOfDaysOfTravel(int)
+ */
+ public void setNumberOfDaysOfTravel(int numberOfDaysOfTravel) {
+ this.numberOfDaysOfTravel = numberOfDaysOfTravel;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getActivatedDays()
+ */
+ public Collection<Date> getActivatedDays() {
+ return activatedDays;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#addActivatedDay(java.util.Date)
+ */
+ public void addActivatedDay(Date activatedDay) {
+ this.activatedDays.add(activatedDay);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getCountries()
+ */
+ public Collection<Integer> getCountries() {
+ return countries;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#addCountry(java.lang.Integer)
+ */
+ public void addCountry(Integer country) {
+ this.countries.add(country);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getIncludedCarriers()
+ */
+ public Collection<String> getIncludedCarriers() {
+ return includedCarriers;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#addIncludedCarrier(java.lang.Integer)
+ */
+ public void addIncludedCarrier(String carrier) {
+ this.includedCarriers.add(carrier);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getExcludedCarriers()
+ */
+ public Collection<String> getExcludedCarriers() {
+ return excludedCarriers;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#addIncludedCarrier(java.lang.Integer)
+ */
+ public void addExcludedCarrier(String carrier) {
+ this.excludedCarriers.add(carrier);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getIncludedServiceBrands()
+ */
+ public Collection<Integer> getIncludedServiceBrands() {
+ return includedServiceBrands;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#addIncludedServiceBrand(java.lang.Integer)
+ */
+ public void addIncludedServiceBrand(Integer includedServiceBrand) {
+ this.includedServiceBrands.add(includedServiceBrand);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getExcludedServiceBrands()
+ */
+ public Collection<Integer> getExcludedServiceBrands() {
+ return excludedServiceBrands;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#addExcludedServiceBrand(java.lang.Integer)
+ */
+ public void addExcludedServiceBrand(Integer excludedServiceBrand) {
+ this.excludedServiceBrands.add(excludedServiceBrand);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getValidRegionList()
+ */
+ public Collection<IRegionalValidity> getValidRegionList() {
+ return validRegionList;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#addValidRegion(org.uic.ticket.api.spec.IRegionalValidity)
+ */
+ public void addValidRegion(IRegionalValidity validRegion) {
+ this.validRegionList.add(validRegion);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getTariffs()
+ */
+ public Collection<ITariff> getTariffs() {
+ return tariffs;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#addTariff(org.uic.ticket.api.spec.ITariff)
+ */
+ public void addTariff(ITariff tariff) {
+ this.tariffs.add(tariff);
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getReference()
+ */
+ public String getReference() {
+ return reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#setReference(java.lang.String)
+ */
+ public void setReference(String reference) {
+ this.reference = reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getProductId()
+ */
+ public String getProductId() {
+ return productId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#setProductId(java.lang.String)
+ */
+ public void setProductId(String productId) {
+ this.productId = productId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getProductOwner()
+ */
+ public String getProductOwner() {
+ return productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#setProductOwner(java.lang.String)
+ */
+ public void setProductOwner(String productOwner) {
+ this.productOwner = productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getClassCode()
+ */
+ public ITravelClassType getClassCode() {
+ return classCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#setClassCode(org.uic.ticket.api.asn.om.TravelClassType)
+ */
+ public void setClassCode(ITravelClassType classCode) {
+ this.classCode = classCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getValidFrom()
+ */
+ public Date getValidFrom() {
+ return validFrom;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#setValidFrom(java.util.Date)
+ */
+ public void setValidFrom(Date validFrom) {
+ this.validFrom = validFrom;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getValidUntil()
+ */
+ public Date getValidUntil() {
+ return validUntil;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#setValidUntil(java.util.Date)
+ */
+ public void setValidUntil(Date validUntil) {
+ this.validUntil = validUntil;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getInfoText()
+ */
+ public String getInfoText() {
+ return infoText;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#setInfoText(java.lang.String)
+ */
+ public void setInfoText(String infoText) {
+ this.infoText = infoText;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getExtension()
+ */
+ public IExtension getExtension() {
+ return extension;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#setExtension(org.uic.ticket.api.spec.IExtension)
+ */
+ public void setExtension(IExtension extension) {
+ this.extension = extension;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#setValidityDetails(org.uic.ticket.api.spec.IValidityDetails)
+ */
+ @Override
+ public void setValidityDetails(IValidityDetails validityDetails) {
+ this.validityDetails = validityDetails;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getValidityDetails()
+ */
+ @Override
+ public IValidityDetails getValidityDetails() {
+ return validityDetails;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#setPrice(java.lang.Long)
+ */
+ @Override
+ public void setPrice(Long price) {
+ this.price = price;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getPrice()
+ */
+ @Override
+ public Long getPrice() {
+ return price;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getVatDetails()
+ */
+ @Override
+ public Collection<IVatDetail> getVatDetails() {
+ return vatDetails;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#addVatDetail(org.uic.ticket.api.spec.IVatDetail)
+ */
+ @Override
+ public void addVatDetail(IVatDetail vatDetail) {
+ this.vatDetails.add(vatDetail);
+ }
+
+ /** The valid from utc coffset. */
+ protected Long validFromUTCoffset;
+
+ /** The valid until utc coffset. */
+ protected Long validUntilUTCoffset;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getValidFromUTCoffset()
+ */
+ public Long getValidFromUTCoffset() {
+ return validFromUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#setValidFromUTCoffset(java.lang.Long)
+ */
+ public void setValidFromUTCoffset(Long validFromUTCoffset) {
+ this.validFromUTCoffset = validFromUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#getValidUntilUTCoffset()
+ */
+ public Long getValidUntilUTCoffset() {
+ return validUntilUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPass#setValidUntilUTCoffset(java.lang.Long)
+ */
+ public void setValidUntilUTCoffset(Long validUntilUTCoffset) {
+ this.validUntilUTCoffset = validUntilUTCoffset;
+ }
+
+ @Override
+ public void setUntilDate(Date date) {
+ this.setValidUntil(date);
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimplePlaces.java b/src/org/uic/barcode/ticket/api/impl/SimplePlaces.java new file mode 100644 index 0000000..1567b56 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimplePlaces.java @@ -0,0 +1,89 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+
+import org.uic.barcode.ticket.api.spec.IPlaces;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimplePlaces.
+ */
+public class SimplePlaces implements IPlaces {
+
+ /** The coach. */
+ protected String coach;
+
+ /** The place string. */
+ protected String placeString;
+
+ /** The place description. */
+ protected String placeDescription;
+
+ /** The places. */
+ protected Collection<String> places = new LinkedHashSet<String>();
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPlaces#getCoach()
+ */
+ public String getCoach() {
+ return coach;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPlaces#setCoach(java.lang.String)
+ */
+ public void setCoach(String coach) {
+ this.coach = coach;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPlaces#getPlaceString()
+ */
+ public String getPlaceString() {
+ return placeString;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPlaces#setPlaceString(java.lang.String)
+ */
+ public void setPlaceString(String placeString) {
+ this.placeString = placeString;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPlaces#getPlaceDescription()
+ */
+ public String getPlaceDescription() {
+ return placeDescription;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPlaces#setPlaceDescription(java.lang.String)
+ */
+ public void setPlaceDescription(String placeDescription) {
+ this.placeDescription = placeDescription;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPlaces#getPlaces()
+ */
+ public Collection<String> getPlaces() {
+ return places;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPlaces#addPlace(java.lang.String)
+ */
+ public void addPlace(String place) {
+ this.places.add(place);
+ }
+
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimplePolygone.java b/src/org/uic/barcode/ticket/api/impl/SimplePolygone.java new file mode 100644 index 0000000..e467f33 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimplePolygone.java @@ -0,0 +1,37 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+
+import org.uic.barcode.ticket.api.spec.IGeoCoordinate;
+import org.uic.barcode.ticket.api.spec.IPolygone;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimplePolygone.
+ */
+public class SimplePolygone implements IPolygone{
+
+ /** The edges. */
+ protected Collection<IGeoCoordinate> edges = new LinkedHashSet<IGeoCoordinate>();
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPolygone#getEdges()
+ */
+ public Collection<IGeoCoordinate> getEdges() {
+ return edges;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IPolygone#addEdge(org.uic.ticket.api.spec.IGeoCoordinate)
+ */
+ public void addEdge(IGeoCoordinate edge) {
+ this.edges.add(edge);
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleRegisteredLuggage.java b/src/org/uic/barcode/ticket/api/impl/SimpleRegisteredLuggage.java new file mode 100644 index 0000000..8704d6e --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleRegisteredLuggage.java @@ -0,0 +1,67 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import org.uic.barcode.ticket.api.spec.IRegisteredLuggage;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimpleRegisteredLuggage.
+ */
+public class SimpleRegisteredLuggage implements IRegisteredLuggage{
+
+ /** The registration id. */
+ protected String registrationId;
+
+ /** The max weight. */
+ protected int maxWeight;
+
+ /** The max size. */
+ protected int maxSize;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IRegisteredLuggage#getRegistrationId()
+ */
+ public String getRegistrationId() {
+ return registrationId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IRegisteredLuggage#setRegistrationId(java.lang.String)
+ */
+ public void setRegistrationId(String registrationId) {
+ this.registrationId = registrationId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IRegisteredLuggage#getMaxWeight()
+ */
+ public int getMaxWeight() {
+ return maxWeight;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IRegisteredLuggage#setMaxWeight(int)
+ */
+ public void setMaxWeight(int maxWeight) {
+ this.maxWeight = maxWeight;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IRegisteredLuggage#getMaxSize()
+ */
+ public int getMaxSize() {
+ return maxSize;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IRegisteredLuggage#setMaxSize(int)
+ */
+ public void setMaxSize(int maxSize) {
+ this.maxSize = maxSize;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleReservation.java b/src/org/uic/barcode/ticket/api/impl/SimpleReservation.java new file mode 100644 index 0000000..f600c97 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleReservation.java @@ -0,0 +1,611 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.LinkedHashSet;
+
+import org.uic.barcode.ticket.api.spec.IBerth;
+import org.uic.barcode.ticket.api.spec.ICompartmentDetails;
+import org.uic.barcode.ticket.api.spec.IExtension;
+import org.uic.barcode.ticket.api.spec.ILuggageRestriction;
+import org.uic.barcode.ticket.api.spec.IPlaces;
+import org.uic.barcode.ticket.api.spec.IPriceTypeType;
+import org.uic.barcode.ticket.api.spec.IReservation;
+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.ITariff;
+import org.uic.barcode.ticket.api.spec.ITravelClassType;
+import org.uic.barcode.ticket.api.spec.IVatDetail;
+
+
+/**
+ * The Class SimpleReservation.
+ */
+public class SimpleReservation extends SimpleDocumentData implements IReservation {
+
+ /** The train. */
+ protected String train;
+
+ /** The departure date. */
+ protected Date departureDate;
+
+ /** The arrival date. */
+ protected Date arrivalDate;
+
+ /** The reference. */
+ protected String reference;
+
+ /** The product id. */
+ protected String productId;
+
+ /** The product owner. */
+ protected String productOwner;
+
+ /** The service brand. */
+ protected IServiceBrand serviceBrand;
+
+ /** The service. */
+ protected IServiceType service = IServiceType.seat;
+
+ /** The service brand description. */
+ protected String serviceBrandDescription;
+
+ /** The service brand abbreviation. */
+ protected String serviceBrandAbbreviation;
+
+
+ /** The station code table. */
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUICReservation;
+
+ /** The from station. */
+ protected String fromStation;
+
+ /** The to station. */
+ protected String toStation;
+
+ /** The from station name. */
+ protected String fromStationName;
+
+ /** The to station name. */
+ protected String toStationName;
+
+ /** The carriers. */
+ protected Collection<String>carriers = new LinkedHashSet<String>();
+
+ /** The berths. */
+ protected Collection<IBerth> berths = new LinkedHashSet<IBerth>();
+
+ /** The tariffs. */
+ protected Collection<ITariff> tariffs = new LinkedHashSet<ITariff>();
+
+ /** The class code. */
+ protected ITravelClassType classCode = ITravelClassType.second;
+
+ /** The service level. */
+ protected String serviceLevel;
+
+ /** The additional places of a second coach. */
+ protected IPlaces additionalPlaces;
+
+ /** The places. */
+ protected IPlaces places;
+
+ /** The bicycle places. */
+ protected IPlaces bicyclePlaces;
+
+ /** The compartment details. */
+ protected ICompartmentDetails compartmentDetails;
+
+ /** The number of overbooked. */
+ protected int numberOfOverbooked;
+
+
+
+ /** The price type. */
+ protected IPriceTypeType priceType = IPriceTypeType.travelPrice;
+
+ /** The type of supplement. */
+ protected int typeOfSupplement;
+
+ /** The number of supplements. */
+ protected int numberOfSupplements;
+
+ /** The VAT details. */
+ protected Collection<IVatDetail>vatDetails = new LinkedHashSet<IVatDetail>();
+
+ /** The price. */
+ protected Long price;
+
+ /** The info text. */
+ protected String infoText;
+
+ /** The luggage restriction. */
+ protected ILuggageRestriction luggageRestriction;
+
+ /** The extension. */
+ protected IExtension extension;
+
+ /** The departure ut coffset. */
+ protected Long departureUTCoffset;
+
+ /** The arrival ut coffset. */
+ protected Long arrivalUTCoffset;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getTrain()
+ */
+ public String getTrain() {
+ return train;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setTrain(java.lang.String)
+ */
+ public void setTrain(String train) {
+ this.train = train.trim();
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getDepartureDate()
+ */
+ public Date getDepartureDate() {
+ return departureDate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setDepartureDate(java.util.Date)
+ */
+ public void setDepartureDate(Date departureDate) {
+ this.departureDate = departureDate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getArrivalDate()
+ */
+ public Date getArrivalDate() {
+ return arrivalDate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setArrivalDate(java.util.Date)
+ */
+ public void setArrivalDate(Date arrivalDate) {
+ this.arrivalDate = arrivalDate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getReference()
+ */
+ public String getReference() {
+ return reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setReference(java.lang.String)
+ */
+ public void setReference(String reference) {
+ this.reference = reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getProductId()
+ */
+ public String getProductId() {
+ return productId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setProductId(java.lang.String)
+ */
+ public void setProductId(String productId) {
+ this.productId = productId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getServiceBrand()
+ */
+ public IServiceBrand getServiceBrand() {
+ return serviceBrand;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setServiceBrand(int)
+ */
+ public void setServiceBrand(IServiceBrand serviceBrand) {
+ this.serviceBrand = serviceBrand;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getService()
+ */
+ public IServiceType getService() {
+ return service;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setService(org.uic.ticket.api.asn.om.ServiceType)
+ */
+ public void setService(IServiceType service) {
+ this.service = service;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getStationCodeTable()
+ */
+ public IStationCodeTable getStationCodeTable() {
+ return stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getFromStation()
+ */
+ public String getFromStation() {
+ return fromStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setFromStation(java.lang.String)
+ */
+ public void setFromStation(String fromStation) {
+ this.fromStation = fromStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getToStation()
+ */
+ public String getToStation() {
+ return toStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setToStation(java.lang.String)
+ */
+ public void setToStation(String toStation) {
+ this.toStation = toStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getFromStationName()
+ */
+ public String getFromStationName() {
+ return fromStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setFromStationName(java.lang.String)
+ */
+ public void setFromStationName(String fromStationName) {
+ this.fromStationName = fromStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getToStationName()
+ */
+ public String getToStationName() {
+ return toStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setToStationName(java.lang.String)
+ */
+ public void setToStationName(String toStationName) {
+ this.toStationName = toStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getCarriers()
+ */
+ public Collection<String> getCarriers() {
+ return carriers;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#addCarrier(java.lang.Integer)
+ */
+ public void addCarrier(String carrier) {
+ this.carriers.add(carrier);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getClassCode()
+ */
+ public ITravelClassType getClassCode() {
+ return classCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setClassCode(org.uic.ticket.api.asn.om.TravelClassType)
+ */
+ public void setClassCode(ITravelClassType classCode) {
+ this.classCode = classCode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getServiceLevel()
+ */
+ public String getServiceLevel() {
+ return serviceLevel;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setServiceLevel(java.lang.String)
+ */
+ public void setServiceLevel(String serviceLevel) {
+ this.serviceLevel = serviceLevel;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getPlaces()
+ */
+ public IPlaces getPlaces() {
+ return places;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setPlaces(org.uic.ticket.api.spec.IPlaces)
+ */
+ public void setPlaces(IPlaces places) {
+ this.places = places;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getAdditionalPlaces()
+ */
+ public IPlaces getAdditionalPlaces() {
+ return additionalPlaces;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setAdditionalPlaces(org.uic.ticket.api.spec.IPlaces)
+ */
+ public void setAdditionalPlaces(IPlaces places) {
+ this.additionalPlaces = places;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getBicyclePlaces()
+ */
+ public IPlaces getBicyclePlaces() {
+ return bicyclePlaces;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setBicyclePlaces(org.uic.ticket.api.spec.IPlaces)
+ */
+ public void setBicyclePlaces(IPlaces bicyclePlaces) {
+ this.bicyclePlaces = bicyclePlaces;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getCompartmentDetails()
+ */
+ public ICompartmentDetails getCompartmentDetails() {
+ return compartmentDetails;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setCompartmentDetails(org.uic.ticket.api.spec.ICompartmentDetails)
+ */
+ public void setCompartmentDetails(ICompartmentDetails compartmentDetails) {
+ this.compartmentDetails = compartmentDetails;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getNumberOfOverbooked()
+ */
+ public int getNumberOfOverbooked() {
+ return numberOfOverbooked;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setNumberOfOverbooked(int)
+ */
+ public void setNumberOfOverbooked(int numberOfOverbooked) {
+ this.numberOfOverbooked = numberOfOverbooked;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getBerths()
+ */
+ public Collection<IBerth> getBerths() {
+ return berths;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#addBerth(org.uic.ticket.api.spec.IBerth)
+ */
+ public void addBerth(IBerth berth) {
+ this.berths.add(berth);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getTariffs()
+ */
+ public Collection<ITariff> getTariffs() {
+ return tariffs;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#addTariff(org.uic.ticket.api.spec.ITariff)
+ */
+ public void addTariff(ITariff tariff) {
+ this.tariffs.add(tariff);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getPriceType()
+ */
+ public IPriceTypeType getPriceType() {
+ return priceType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setPriceType(org.uic.ticket.api.asn.om.PriceTypeType)
+ */
+ public void setPriceType(IPriceTypeType priceType) {
+ this.priceType = priceType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getTypeOfSupplement()
+ */
+ public int getTypeOfSupplement() {
+ return typeOfSupplement;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setTypeOfSupplement(int)
+ */
+ public void setTypeOfSupplement(int typeOfSupplement) {
+ this.typeOfSupplement = typeOfSupplement;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getNumberOfSupplements()
+ */
+ public int getNumberOfSupplements() {
+ return numberOfSupplements;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setNumberOfSupplements(int)
+ */
+ public void setNumberOfSupplements(int numberOfSupplements) {
+ this.numberOfSupplements = numberOfSupplements;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getInfoText()
+ */
+ public String getInfoText() {
+ return infoText;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setInfoText(java.lang.String)
+ */
+ public void setInfoText(String infoText) {
+ this.infoText = infoText;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getLuggageRestriction()
+ */
+ public ILuggageRestriction getLuggageRestriction() {
+ return luggageRestriction;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setLuggageRestriction(org.uic.ticket.api.spec.ILuggageRestriction)
+ */
+ public void setLuggageRestriction(ILuggageRestriction luggageRestriction) {
+ this.luggageRestriction = luggageRestriction;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getExtension()
+ */
+ public IExtension getExtension() {
+ return extension;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setExtension(org.uic.ticket.api.spec.IExtension)
+ */
+ public void setExtension(IExtension extension) {
+ this.extension = extension;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getProductOwner()
+ */
+ public String getProductOwner() {
+ return productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setProductOwner(java.lang.String)
+ */
+ public void setProductOwner(String productOwner) {
+ this.productOwner = productOwner;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setPrice(java.lang.Long)
+ */
+ @Override
+ public void setPrice(Long price) {
+ this.price = price;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getPrice()
+ */
+ @Override
+ public Long getPrice() {
+ return price;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getVatDetails()
+ */
+ @Override
+ public Collection<IVatDetail> getVatDetails() {
+ return vatDetails;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#addVatDetail(org.uic.ticket.api.spec.IVatDetail)
+ */
+ @Override
+ public void addVatDetail(IVatDetail vatDetail) {
+ this.vatDetails.add(vatDetail);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getDepartureUTCoffset()
+ */
+ public Long getDepartureUTCoffset() {
+ return departureUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setDepartureUTCoffset(java.lang.Long)
+ */
+ public void setDepartureUTCoffset(Long departureUTCoffset) {
+ this.departureUTCoffset = departureUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#getArrivalUTCoffset()
+ */
+ public Long getArrivalUTCoffset() {
+ return arrivalUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReservation#setArrivalUTCoffset(java.lang.Long)
+ */
+ public void setArrivalUTCoffset(Long arrivalUTCoffset) {
+ this.arrivalUTCoffset = arrivalUTCoffset;
+ }
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleReturnRouteDescription.java b/src/org/uic/barcode/ticket/api/impl/SimpleReturnRouteDescription.java new file mode 100644 index 0000000..4b3aeee --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleReturnRouteDescription.java @@ -0,0 +1,122 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+
+import org.uic.barcode.ticket.api.spec.IRegionalValidity;
+import org.uic.barcode.ticket.api.spec.IReturnRouteDescription;
+
+/**
+ * The Class SimpleReturnRouteDescription.
+ */
+public class SimpleReturnRouteDescription implements IReturnRouteDescription{
+
+ /** The from station. */
+ protected String fromStation;
+
+ /** The to station. */
+ protected String toStation;
+
+ /** The from station name. */
+ protected String fromStationName;
+
+ /** The to station name. */
+ protected String toStationName;
+
+
+ /** The valid region desc. */
+ protected String validRegionDesc;
+
+ /** The valid region list. */
+ protected Collection<IRegionalValidity> validRegionList = new LinkedHashSet<IRegionalValidity>();
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReturnRouteDescription#getFromStation()
+ */
+ public String getFromStation() {
+ return fromStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReturnRouteDescription#setFromStation(java.lang.String)
+ */
+ public void setFromStation(String fromStation) {
+ this.fromStation = fromStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReturnRouteDescription#getToStation()
+ */
+ public String getToStation() {
+ return toStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReturnRouteDescription#setToStation(java.lang.String)
+ */
+ public void setToStation(String toStation) {
+ this.toStation = toStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReturnRouteDescription#getFromStationName()
+ */
+ public String getFromStationName() {
+ return fromStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReturnRouteDescription#setFromStationName(java.lang.String)
+ */
+ public void setFromStationName(String fromStationName) {
+ this.fromStationName = fromStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReturnRouteDescription#getToStationName()
+ */
+ public String getToStationName() {
+ return toStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReturnRouteDescription#setToStationName(java.lang.String)
+ */
+ public void setToStationName(String toStationName) {
+ this.toStationName = toStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReturnRouteDescription#getValidRegionDesc()
+ */
+ public String getValidRegionDesc() {
+ return validRegionDesc;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReturnRouteDescription#setValidRegionDesc(java.lang.String)
+ */
+ public void setValidRegionDesc(String validRegionDesc) {
+ this.validRegionDesc = validRegionDesc;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReturnRouteDescription#getValidRegionList()
+ */
+ public Collection<IRegionalValidity> getValidRegionList() {
+ return validRegionList;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IReturnRouteDescription#addValidRegionList(org.uic.ticket.api.spec.IRegionalValidity)
+ */
+ public void addValidRegionList(IRegionalValidity validRegion) {
+ this.validRegionList.add(validRegion);
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleRouteSection.java b/src/org/uic/barcode/ticket/api/impl/SimpleRouteSection.java new file mode 100644 index 0000000..980927d --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleRouteSection.java @@ -0,0 +1,107 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+
+import org.uic.barcode.ticket.api.spec.IRouteSection;
+import org.uic.barcode.ticket.api.spec.IStationCodeTable;
+
+
+/**
+ * The Class SimpleRouteSection.
+ */
+public class SimpleRouteSection implements IRouteSection {
+
+
+ /** The station code table. */
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUIC;
+
+ /** The from station. */
+ protected String fromStation;
+
+ /** The to station. */
+ protected String toStation;
+
+ /** The from station name. */
+ protected String fromStationName;
+
+ /** The to station name. */
+ protected String toStationName;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IRouteSection#getStationCodeTable()
+ */
+ public IStationCodeTable getStationCodeTable() {
+ return stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IRouteSection#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IRouteSection#getFromStation()
+ */
+ public String getFromStation() {
+ return fromStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IRouteSection#setFromStation(java.lang.String)
+ */
+ public void setFromStation(String fromStation) {
+ this.fromStation = fromStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IRouteSection#getToStation()
+ */
+ public String getToStation() {
+ return toStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IRouteSection#setToStation(java.lang.String)
+ */
+ public void setToStation(String toStation) {
+ this.toStation = toStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IRouteSection#getFromStationName()
+ */
+ public String getFromStationName() {
+ return fromStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IRouteSection#setFromStationName(java.lang.String)
+ */
+ public void setFromStationName(String fromStationName) {
+ this.fromStationName = fromStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IRouteSection#getToStationName()
+ */
+ public String getToStationName() {
+ return toStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IRouteSection#setToStationName(java.lang.String)
+ */
+ public void setToStationName(String toStationName) {
+ this.toStationName = toStationName;
+ }
+
+
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleSeriesDataDetails.java b/src/org/uic/barcode/ticket/api/impl/SimpleSeriesDataDetails.java new file mode 100644 index 0000000..33f6416 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleSeriesDataDetails.java @@ -0,0 +1,64 @@ +package org.uic.barcode.ticket.api.impl;
+
+import org.uic.barcode.ticket.api.spec.ISeriesDataDetails;
+
+public class SimpleSeriesDataDetails implements ISeriesDataDetails {
+
+
+ protected int offerIdentification;
+
+ /** The supplying carrier. */
+ protected int supplyingCarrier;
+
+ /** The series. */
+ protected int series;
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#getSupplyingCarrier()
+ */
+ public int getSupplyingCarrier() {
+ return supplyingCarrier;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#setSupplyingCarrier(int)
+ */
+ public void setSupplyingCarrier(int supplyingCarrier) {
+ this.supplyingCarrier = supplyingCarrier;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#getOfferIdentification()
+ */
+ public int getOfferIdentification() {
+ return offerIdentification;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#setOfferIdentification(int)
+ */
+ public void setOfferIdentification(int offerIdentification) {
+ this.offerIdentification = offerIdentification;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#getSeries()
+ */
+ public int getSeries() {
+ return series;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#setSeries(int)
+ */
+ public void setSeries(int series) {
+ this.series = series;
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleServiceBrand.java b/src/org/uic/barcode/ticket/api/impl/SimpleServiceBrand.java new file mode 100644 index 0000000..b0b613d --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleServiceBrand.java @@ -0,0 +1,43 @@ +package org.uic.barcode.ticket.api.impl;
+
+import org.uic.barcode.ticket.api.spec.IServiceBrand;
+
+
+
+public class SimpleServiceBrand implements IServiceBrand {
+
+ /** The service brand. */
+ protected int serviceBrand;
+
+ /** The service brand description. */
+ protected String serviceBrandDescription;
+
+ /** The service brand abbreviation. */
+ protected String serviceBrandAbbreviation;
+
+ public int getServiceBrand() {
+ return serviceBrand;
+ }
+
+ public void setServiceBrand(int serviceBrand) {
+ this.serviceBrand = serviceBrand;
+ }
+
+ public String getServiceBrandDescription() {
+ return serviceBrandDescription;
+ }
+
+ public void setServiceBrandDescription(String serviceBrandDescription) {
+ this.serviceBrandDescription = serviceBrandDescription;
+ }
+
+ public String getServiceBrandAbbreviation() {
+ return serviceBrandAbbreviation;
+ }
+
+ public void setServiceBrandAbbreviation(String serviceBrandAbbreviation) {
+ this.serviceBrandAbbreviation = serviceBrandAbbreviation;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleStationPassage.java b/src/org/uic/barcode/ticket/api/impl/SimpleStationPassage.java new file mode 100644 index 0000000..eaf300b --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleStationPassage.java @@ -0,0 +1,296 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.LinkedHashSet;
+
+import org.uic.barcode.ticket.api.spec.IExtension;
+import org.uic.barcode.ticket.api.spec.IStationCodeTable;
+import org.uic.barcode.ticket.api.spec.IStationPassage;
+
+
+/**
+ * The Class SimpleStationPassage.
+ */
+public class SimpleStationPassage extends SimpleDocumentData implements IStationPassage {
+
+ /** The reference. */
+ protected String reference;
+
+ /** The product name. */
+ protected String productName;
+
+ /** The product type. */
+ protected String productId;
+
+ /** The product owner. */
+ protected String productOwner;
+
+ /** The valid from. */
+ protected Date validFrom;
+
+ /** The valid until. */
+ protected Date validUntil;
+
+ /** The station code table. */
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUIC;
+
+ /** The station name. */
+ protected String stationName;
+
+ /** The number ofdays allowed. */
+ protected int numberOfdaysAllowed;
+
+ /** The stations. */
+ protected Collection<String> stations = new LinkedHashSet<String>();
+
+ /** The station names. */
+ protected Collection<String> stationNames = new LinkedHashSet<String>();
+
+
+ /** The extension data. */
+ protected IExtension extensionData;
+
+
+ /** The area codes. */
+ protected Collection<String> areaCodes = new LinkedHashSet<String>();
+
+ /** The area names. */
+ protected Collection<String> areaNames = new LinkedHashSet<String>();
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#getReference()
+ */
+ public String getReference() {
+ return reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#setReference(java.lang.String)
+ */
+ public void setReference(String reference) {
+ this.reference = reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#getProductName()
+ */
+ public String getProductName() {
+ return productName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#setProductName(java.lang.String)
+ */
+ public void setProductName(String name) {
+ this.productName = name;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#getProductType()
+ */
+ public String getProductId() {
+ return productId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#setProductType(int)
+ */
+ public void setProductId(String id) {
+ this.productId = id;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#getProductOwner()
+ */
+ public String getProductOwner() {
+ return productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#setProductOwner(java.lang.String)
+ */
+ public void setProductOwner(String productOwner) {
+ this.productOwner = productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#getValidFrom()
+ */
+ public Date getValidFrom() {
+ return validFrom;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#setValidFrom(java.util.Date)
+ */
+ public void setValidFrom(Date validFrom) {
+ this.validFrom = validFrom;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#getValidUntil()
+ */
+ public Date getValidUntil() {
+ return validUntil;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#setValidUntil(java.util.Date)
+ */
+ public void setValidUntil(Date validUntil) {
+ this.validUntil = validUntil;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#getStationCodeTable()
+ */
+ public IStationCodeTable getStationCodeTable() {
+ return stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#getStations()
+ */
+ public Collection<String> getStations() {
+ return stations;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#addStation(java.lang.String)
+ */
+ public void addStation(String station) {
+ this.stations.add(station);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#addStationName(java.lang.String)
+ */
+ public void addStationName(String name) {
+ this.stationNames.add(name);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#getStationNames()
+ */
+ public Collection<String> getStationNames() {
+ return stationNames;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#getNumberOfdaysAllowed()
+ */
+ public int getNumberOfdaysAllowed() {
+ return numberOfdaysAllowed;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#setNumberOfdaysAllowed(int)
+ */
+ public void setNumberOfdaysAllowed(int numberOfdaysAllowed) {
+ this.numberOfdaysAllowed = numberOfdaysAllowed;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#getExtension()
+ */
+ @Override
+ public IExtension getExtension() {
+ return extensionData;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#setExtension(org.uic.ticket.api.spec.IExtension)
+ */
+ @Override
+ public void setExtension(IExtension extensionData) {
+ this.extensionData = extensionData;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#getAreaCodes()
+ */
+ @Override
+ public Collection<String> getAreaCodes() {
+ return areaCodes;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#getAreaNames()
+ */
+ @Override
+ public Collection<String> getAreaNames() {
+ return areaNames;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#addAreaCode(java.lang.String)
+ */
+ @Override
+ public void addAreaCode(String code) {
+ areaCodes.add(code);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#addAreaName(java.lang.String)
+ */
+ @Override
+ public void addAreaName(String name) {
+ areaNames.add(name);
+ }
+
+
+ /** The valid from utc coffset. */
+ protected Long validFromUTCoffset;
+
+ /** The valid until utc coffset. */
+ protected Long validUntilUTCoffset;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#getValidFromUTCoffset()
+ */
+ public Long getValidFromUTCoffset() {
+ return validFromUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#setValidFromUTCoffset(java.lang.Long)
+ */
+ public void setValidFromUTCoffset(Long validFromUTCoffset) {
+ this.validFromUTCoffset = validFromUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#getValidUntilUTCoffset()
+ */
+ public Long getValidUntilUTCoffset() {
+ return validUntilUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IStationPassage#setValidUntilUTCoffset(java.lang.Long)
+ */
+ public void setValidUntilUTCoffset(Long validUntilUTCoffset) {
+ this.validUntilUTCoffset = validUntilUTCoffset;
+ }
+
+ @Override
+ public void setUntilDate(Date date) {
+ // TODO Automatisch generierter Methodenstub
+ this.validUntil = date;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleTariff.java b/src/org/uic/barcode/ticket/api/impl/SimpleTariff.java new file mode 100644 index 0000000..5dc163c --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleTariff.java @@ -0,0 +1,238 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+
+import org.uic.barcode.ticket.api.spec.ICardReference;
+import org.uic.barcode.ticket.api.spec.IPassengerType;
+import org.uic.barcode.ticket.api.spec.IRouteSection;
+import org.uic.barcode.ticket.api.spec.ISeriesDataDetails;
+import org.uic.barcode.ticket.api.spec.ITariff;
+
+
+/**
+ * The Class SimpleTariff.
+ */
+public class SimpleTariff implements ITariff {
+
+ /** The number of passengers. */
+ protected int numberOfPassengers = 1;
+
+ /** The passenger type. */
+ protected IPassengerType passengerType ;
+
+
+ /** The age below. */
+ protected int ageBelow;
+
+ /** The age above. */
+ protected int ageAbove;
+
+
+ /** The traveler ids. */
+ protected Collection<Integer>travelerIds = new LinkedHashSet<Integer>();
+
+
+ /** The restricted to country of residence. */
+ protected boolean restrictedToCountryOfResidence = false;
+
+
+ protected ISeriesDataDetails seriesDataDetails;
+
+
+ /** The restricted to route section. */
+ protected IRouteSection restrictedToRouteSection;
+
+
+ /** The tariff id. */
+ protected String tariffId;
+
+ /** The tariff description. */
+ protected String tariffDescription;
+
+
+ /** The reduction cards. */
+ protected Collection<ICardReference> reductionCards = new LinkedHashSet<ICardReference>();
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#getNumberOfPassengers()
+ */
+ public int getNumberOfPassengers() {
+ return numberOfPassengers;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#setNumberOfPassengers(int)
+ */
+ public void setNumberOfPassengers(int numberOfPassengers) {
+ this.numberOfPassengers = numberOfPassengers;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#getPassengerType()
+ */
+ public IPassengerType getPassengerType() {
+ return passengerType;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#setPassengerType(org.uic.ticket.api.asn.om.PassengerType)
+ */
+ public void setPassengerType(IPassengerType passengerType) {
+ this.passengerType = passengerType;
+ }
+
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#getAgeBelow()
+ */
+ public int getAgeBelow() {
+ return ageBelow;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#setAgeBelow(int)
+ */
+ public void setAgeBelow(int ageBelow) {
+ this.ageBelow = ageBelow;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#getAgeAbove()
+ */
+ public int getAgeAbove() {
+ return ageAbove;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#setAgeAbove(int)
+ */
+ public void setAgeAbove(int ageAbove) {
+ this.ageAbove = ageAbove;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#getTravelerIds()
+ */
+ public Collection<Integer> getTravelerIds() {
+ return travelerIds;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#addTravelerId(java.lang.Integer)
+ */
+ public void addTravelerId(Integer travelerId) {
+ this.travelerIds.add(travelerId);
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#isRestrictedToCountryOfResidence()
+ */
+ public boolean isRestrictedToCountryOfResidence() {
+ return restrictedToCountryOfResidence;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#setRestrictedToCountryOfResidence(boolean)
+ */
+ public void setRestrictedToCountryOfResidence(
+ boolean restrictedToCountryOfResidence) {
+ this.restrictedToCountryOfResidence = restrictedToCountryOfResidence;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#getRestrictedToRouteSection()
+ */
+ public IRouteSection getRestrictedToRouteSection() {
+ return restrictedToRouteSection;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#setRestrictedToRouteSection(org.uic.ticket.api.spec.IRouteSection)
+ */
+ public void setRestrictedToRouteSection(IRouteSection restrictedToRouteSection) {
+ this.restrictedToRouteSection = restrictedToRouteSection;
+ }
+
+
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#getTariffId()
+ */
+ public String getTariffId() {
+ return tariffId;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#setTariffId(java.lang.String)
+ */
+ public void setTariffId(String tariffId) {
+ this.tariffId = tariffId;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#getTariffDescription()
+ */
+ public String getTariffDescription() {
+ return tariffDescription;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#setTariffDescription(java.lang.String)
+ */
+ public void setTariffDescription(String tariffDescription) {
+ this.tariffDescription = tariffDescription;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#getReductionCards()
+ */
+ public Collection<ICardReference> getReductionCards() {
+ return reductionCards;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITariff#addReductionCard(org.uic.ticket.api.spec.ICardReference)
+ */
+ public void addReductionCard(ICardReference reductionCard) {
+ this.reductionCards.add(reductionCard);
+ }
+
+
+ @Override
+ public void setSeriesDataDetails(ISeriesDataDetails seriesDataDetails) {
+ this.seriesDataDetails = seriesDataDetails;
+ }
+
+
+ @Override
+ public ISeriesDataDetails getSeriesDataDetails() {
+ return seriesDataDetails;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleTicketLink.java b/src/org/uic/barcode/ticket/api/impl/SimpleTicketLink.java new file mode 100644 index 0000000..22fb3b0 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleTicketLink.java @@ -0,0 +1,123 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+
+import org.uic.barcode.ticket.api.spec.ILinkMode;
+import org.uic.barcode.ticket.api.spec.ITicketLink;
+import org.uic.barcode.ticket.api.spec.ITicketType;
+
+
+/**
+ * The Class SimpleTicketLink.
+ */
+public class SimpleTicketLink implements ITicketLink {
+
+ /** The reference. */
+ protected String reference;
+
+ /** The issuer. */
+ protected String issuer;
+
+ /** The issuer PNR. */
+ protected String issuerPNR;
+
+ /** The product owner. */
+ protected String productOwner;
+
+ /** The ticket type. */
+ protected ITicketType ticketType = ITicketType.openTicket;
+
+ /** The link mode. */
+ protected ILinkMode linkMode = ILinkMode.issuedTogether;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITicketLink#getReference()
+ */
+ public String getReference() {
+ return reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITicketLink#setReference(java.lang.String)
+ */
+ public void setReference(String reference) {
+ this.reference = reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITicketLink#getIssuer()
+ */
+ public String getIssuer() {
+ return issuer;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITicketLink#setIssuer(java.lang.String)
+ */
+ public void setIssuer(String issuer) {
+ this.issuer = issuer;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITicketLink#getProductOwner()
+ */
+ public String getProductOwner() {
+ return productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITicketLink#setProductOwner(java.lang.String)
+ */
+ public void setProductOwner(String productOwner) {
+ this.productOwner = productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITicketLink#getTicketType()
+ */
+ public ITicketType getTicketType() {
+ return ticketType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITicketLink#setTicketType(org.uic.ticket.api.asn.om.TicketType)
+ */
+ public void setTicketType(ITicketType ticketType) {
+ this.ticketType = ticketType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITicketLink#getLinkMode()
+ */
+ public ILinkMode getLinkMode() {
+ return linkMode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITicketLink#setLinkMode(org.uic.ticket.api.asn.om.LinkMode)
+ */
+ public void setLinkMode(ILinkMode linkMode) {
+ this.linkMode = linkMode;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITicketLink#getIssuerPNR()
+ */
+ public String getIssuerPNR() {
+ return issuerPNR;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITicketLink#setIssuerPNR(java.lang.String)
+ */
+ public void setIssuerPNR(String issuerPNR) {
+ this.issuerPNR = issuerPNR;
+ }
+
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleTimeRange.java b/src/org/uic/barcode/ticket/api/impl/SimpleTimeRange.java new file mode 100644 index 0000000..268c378 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleTimeRange.java @@ -0,0 +1,56 @@ +package org.uic.barcode.ticket.api.impl;
+
+
+
+import org.uic.barcode.ticket.api.spec.ITimeRange;
+
+public class SimpleTimeRange implements ITimeRange {
+
+ int fromTime = 0;
+ int untilTime = 1440;
+
+ @Override
+ public int getFromTime() {
+ return fromTime;
+ }
+
+ @Override
+ public int getUntilTime() {
+ return untilTime;
+ }
+
+ @Override
+ public void setFromTime(int minutes) {
+ this.fromTime = minutes;
+ }
+
+ @Override
+ public void setUntilTime(int minutes) {
+ this.untilTime = minutes;
+ }
+
+ /** The valid from utc coffset. */
+ protected Long validFromUTCoffset;
+
+ /** The valid until utc coffset. */
+ protected Long validUntilUTCoffset;
+
+ public Long getValidFromUTCoffset() {
+ return validFromUTCoffset;
+ }
+
+ public void setValidFromUTCoffset(Long validFromUTCoffset) {
+ this.validFromUTCoffset = validFromUTCoffset;
+ }
+
+ public Long getValidUntilUTCoffset() {
+ return validUntilUTCoffset;
+ }
+
+ public void setValidUntilUTCoffset(Long validUntilUTCoffset) {
+ this.validUntilUTCoffset = validUntilUTCoffset;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleToken.java b/src/org/uic/barcode/ticket/api/impl/SimpleToken.java new file mode 100644 index 0000000..f260d91 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleToken.java @@ -0,0 +1,68 @@ +package org.uic.barcode.ticket.api.impl;
+
+import org.uic.barcode.ticket.api.spec.IToken;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimpleToken.
+ */
+public class SimpleToken implements IToken {
+
+ /** The provider. */
+ protected String provider;
+
+ /** The specification. */
+ protected String specification;
+
+ /** The token. */
+ protected byte[] token;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IToken#getTokenProvider()
+ */
+ @Override
+ public String getTokenProvider() {
+ return provider;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IToken#getTokenSpecification()
+ */
+ @Override
+ public String getTokenSpecification() {
+ return specification;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IToken#getToken()
+ */
+ @Override
+ public byte[] getToken() {
+ return token;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IToken#setTokenProvider(java.lang.String)
+ */
+ @Override
+ public void setTokenProvider(String provider) {
+ this.provider = provider;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IToken#setTokenSppecification(java.lang.String)
+ */
+ @Override
+ public void setTokenSpecification(String specification) {
+ this.specification = specification;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IToken#setToken(byte[])
+ */
+ @Override
+ public void setToken(byte[] token) {
+ this.token = token;
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleTrainLink.java b/src/org/uic/barcode/ticket/api/impl/SimpleTrainLink.java new file mode 100644 index 0000000..73403cd --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleTrainLink.java @@ -0,0 +1,138 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Date;
+
+import org.uic.barcode.ticket.api.spec.ITrainLink;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimpleTrainLink.
+ */
+public class SimpleTrainLink implements ITrainLink{
+
+
+ /** The train. */
+ protected String train;
+
+ /** The departure date time. */
+ protected Date departureDateTime;
+
+ /** offset to UTC time in units of 15 minutes. */
+ protected Long departureUTCoffset;
+
+ /** The from station. */
+ protected String fromStation;
+
+ /** The to station. */
+ protected String toStation;
+
+ /** The from station name. */
+ protected String fromStationName;
+
+ /** The to station name. */
+ protected String toStationName;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITrainLink#getTrain()
+ */
+ public String getTrain() {
+ return train;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITrainLink#setTrain(java.lang.String)
+ */
+ public void setTrain(String train) {
+ this.train = train.trim();
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITrainLink#getDepartureDateTime()
+ */
+ public Date getDepartureDateTime() {
+ return departureDateTime;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITrainLink#setDepartureDateTime(java.util.Date)
+ */
+ public void setDepartureDateTime(Date departureDateTime) {
+ this.departureDateTime = departureDateTime;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITrainLink#getFromStation()
+ */
+ public String getFromStation() {
+ return fromStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITrainLink#setFromStation(java.lang.String)
+ */
+ public void setFromStation(String fromStation) {
+ this.fromStation = fromStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITrainLink#getToStation()
+ */
+ public String getToStation() {
+ return toStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITrainLink#setToStation(java.lang.String)
+ */
+ public void setToStation(String toStation) {
+ this.toStation = toStation.trim();
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITrainLink#getFromStationName()
+ */
+ public String getFromStationName() {
+ return fromStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITrainLink#setFromStationName(java.lang.String)
+ */
+ public void setFromStationName(String fromStationName) {
+ this.fromStationName = fromStationName.trim();
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITrainLink#getToStationName()
+ */
+ public String getToStationName() {
+ return toStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITrainLink#setToStationName(java.lang.String)
+ */
+ public void setToStationName(String toStationName) {
+ this.toStationName = toStationName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITrainLink#getDepartureUTCoffset()
+ */
+ public Long getDepartureUTCoffset() {
+ return departureUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITrainLink#setDepartureUTCoffset(java.lang.Long)
+ */
+ public void setDepartureUTCoffset(Long departureUTCoffset) {
+ this.departureUTCoffset = departureUTCoffset;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleTraveler.java b/src/org/uic/barcode/ticket/api/impl/SimpleTraveler.java new file mode 100644 index 0000000..afc351d --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleTraveler.java @@ -0,0 +1,289 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+
+import org.uic.barcode.ticket.api.spec.ICustomerStatusDescription;
+import org.uic.barcode.ticket.api.spec.IGenderType;
+import org.uic.barcode.ticket.api.spec.IPassengerType;
+import org.uic.barcode.ticket.api.spec.ITraveler;
+
+
+/**
+ * The Class SimpleTraveler.
+ */
+public class SimpleTraveler implements ITraveler {
+
+
+ /** The first name. */
+ protected String firstName;
+
+ /** The second name. */
+ protected String secondName;
+
+ /** The last name. */
+ protected String lastName;
+
+ /** The id card. */
+ protected String idCard;
+
+ /** The passport id. */
+ protected String passportId;
+
+ /** The title. */
+ protected String title;
+
+ /** The gender. */
+ protected IGenderType gender;
+
+ /** The customer id. */
+ protected String customerId;
+
+ /** The date of birth. */
+ protected Date dateOfBirth;
+
+ /** The ticket holder. */
+ protected boolean ticketHolder = true;
+
+ /** The passenger type. */
+ protected IPassengerType passengerType;
+
+ /** The passenger with reduced mobility. */
+ protected boolean passengerWithReducedMobility;
+
+ /** The country of residence. */
+ protected int countryOfResidence = 0;
+
+
+ /** The country of passport. */
+ protected int countryOfPassport = 0;
+
+ /** The country of id card. */
+ protected int countryOfIDCard = 0;
+
+ /** The status collection. */
+ protected Collection<ICustomerStatusDescription> statusCollection = new HashSet<ICustomerStatusDescription>();
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#getFirstName()
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#setFirstName(java.lang.String)
+ */
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#getSecondName()
+ */
+ public String getSecondName() {
+ return secondName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#setSecondName(java.lang.String)
+ */
+ public void setSecondName(String secondName) {
+ this.secondName = secondName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#getLastName()
+ */
+ public String getLastName() {
+ return lastName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#setLastName(java.lang.String)
+ */
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#getIdCard()
+ */
+ public String getIdCard() {
+ return idCard;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#setIdCard(java.lang.String)
+ */
+ public void setIdCard(String idCard) {
+ this.idCard = idCard;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#getPassportId()
+ */
+ public String getPassportId() {
+ return passportId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#setPassportId(java.lang.String)
+ */
+ public void setPassportId(String passportId) {
+ this.passportId = passportId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#getTitle()
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#setTitle(java.lang.String)
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#getGender()
+ */
+ public IGenderType getGender() {
+ return gender;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#setGender(org.uic.ticket.api.asn.om.GenderType)
+ */
+ public void setGender(IGenderType gender) {
+ this.gender = gender;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#getCustomerId()
+ */
+ public String getCustomerId() {
+ return customerId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#setCustomerId(java.lang.String)
+ */
+ public void setCustomerId(String customerId) {
+ this.customerId = customerId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#getDateOfBirth()
+ */
+ public Date getDateOfBirth() {
+ return dateOfBirth;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#setDateOfBirth(java.util.Date)
+ */
+ public void setDateOfBirth(Date dateOfBirth) {
+ this.dateOfBirth = dateOfBirth;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#isTicketHolder()
+ */
+ public boolean isTicketHolder() {
+ return ticketHolder;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#setTicketHolder(boolean)
+ */
+ public void setTicketHolder(boolean ticketHolder) {
+ this.ticketHolder = ticketHolder;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#getPassengerType()
+ */
+ public IPassengerType getPassengerType() {
+ return passengerType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#setPassengerType(org.uic.ticket.api.asn.om.PassengerType)
+ */
+ public void setPassengerType(IPassengerType passengerType) {
+ this.passengerType = passengerType;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#isPassengerWithReducedMobility()
+ */
+ public Boolean isPassengerWithReducedMobility() {
+ return passengerWithReducedMobility;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#setPassengerWithReducedMobility(boolean)
+ */
+ public void setPassengerWithReducedMobility(Boolean passengerWithReducedMobility) {
+ this.passengerWithReducedMobility = passengerWithReducedMobility;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#getCountryOfResidence()
+ */
+ public int getCountryOfResidence() {
+ return countryOfResidence;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#setCountryOfResidence(int)
+ */
+ public void setCountryOfResidence(int countryOfResidence) {
+ this.countryOfResidence = countryOfResidence;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#getStatusCollection()
+ */
+ public Collection<ICustomerStatusDescription> getStatusCollection() {
+ return statusCollection;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.ITraveler#addStatusDescription(org.uic.ticket.api.spec.ICustomerStatusDescription)
+ */
+ public void addStatusDescription(ICustomerStatusDescription statusDescription) {
+ this.statusCollection.add(statusDescription);
+ }
+
+ @Override
+ public int getPassportCountry() {
+ return countryOfPassport;
+ }
+
+ @Override
+ public void setPassportCountry(int country) {
+ this.countryOfPassport = country;
+ }
+
+ @Override
+ public int getIDCardCountry() {
+ return countryOfIDCard;
+ }
+
+ @Override
+ public void setIDCardCountry(int country) {
+ this.countryOfIDCard = country;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleTravelerDetail.java b/src/org/uic/barcode/ticket/api/impl/SimpleTravelerDetail.java new file mode 100644 index 0000000..d76f742 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleTravelerDetail.java @@ -0,0 +1,83 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.uic.barcode.ticket.api.spec.ITraveler;
+import org.uic.barcode.ticket.api.spec.ITravelerDetail;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimpleTravelerDetail.
+ */
+public class SimpleTravelerDetail implements ITravelerDetail{
+
+ /** The group name. */
+ String groupName;
+
+ /** The preferred language. */
+ String preferredLanguage;
+
+ /** The travelers. */
+ LinkedHashSet<ITraveler> travelers = new LinkedHashSet<ITraveler>();
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.ITravelerDetail#getGroupName()
+ */
+ public String getGroupName() {
+ return groupName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.ITravelerDetail#setGroupName(java.lang.String)
+ */
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.ITravelerDetail#addTraveler(org.uic.ticket.api.ITravelerData)
+ */
+ public void addTraveler (ITraveler traveler) {
+ travelers.add(traveler);
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.ITravelerDetail#getTravelers()
+ */
+ public Set<ITraveler> getTravelers() {
+ return travelers;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.ITravelerDetail#setTravelers(java.util.LinkedHashSet)
+ */
+ /**
+ * Sets the travelers.
+ *
+ * @param travelers the new travelers
+ */
+ public void setTravelers(LinkedHashSet<ITraveler> travelers) {
+ this.travelers = travelers;
+ }
+
+
+ @Override
+ public String getPreferredLanguage() {
+ return preferredLanguage;
+ }
+
+ @Override
+ public void setPreferredLanguage(String language) {
+ this.preferredLanguage = language;
+ }
+
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleUicRailTicket.java b/src/org/uic/barcode/ticket/api/impl/SimpleUicRailTicket.java new file mode 100644 index 0000000..708cd75 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleUicRailTicket.java @@ -0,0 +1,224 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+
+import org.uic.barcode.ticket.api.spec.ICarCarriageReservation;
+import org.uic.barcode.ticket.api.spec.IControlDetail;
+import org.uic.barcode.ticket.api.spec.ICounterMark;
+import org.uic.barcode.ticket.api.spec.ICustomerCard;
+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.IIssuingDetail;
+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.IReservation;
+import org.uic.barcode.ticket.api.spec.IStationPassage;
+import org.uic.barcode.ticket.api.spec.ITravelerDetail;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.api.spec.IVoucher;
+
+
+/**
+ * The Class SimpleUicRailTicket.
+ */
+public class SimpleUicRailTicket implements IUicRailTicket {
+
+ /** The issuer details. */
+ private IIssuingDetail issuerDetails = new SimpleIssuingDetail();
+
+ /** The traveler details. */
+ private ITravelerDetail travelerDetails;
+
+ /** The control details. */
+ private IControlDetail controlDetails;
+
+ /** The extensions. */
+ private Collection<IExtension> extensions = new LinkedHashSet<IExtension>();
+
+ /** The documents. */
+ private Collection<IDocumentData> documents = new LinkedHashSet<IDocumentData>();
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.IUicRailTicket#getIssuerDetails()
+ */
+ @Override
+ public IIssuingDetail getIssuerDetails() {
+
+ if (issuerDetails == null) {
+ issuerDetails = new SimpleIssuingDetail();
+ }
+ return issuerDetails;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.IUicRailTicket#getTravelerDetails()
+ */
+ public ITravelerDetail getTravelerDetails() {
+
+ if (travelerDetails == null) {
+ travelerDetails = new SimpleTravelerDetail();
+ }
+ return travelerDetails;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IUicRailTicket#getControlDetails()
+ */
+ public IControlDetail getControlDetails() {
+
+ if (controlDetails == null) {
+ controlDetails = new SimpleControlDetail();
+ }
+ return controlDetails;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IUicRailTicket#getExtensions()
+ */
+ public Collection<IExtension> getExtensions() {
+ return extensions;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IUicRailTicket#addExtension(org.uic.ticket.api.spec.IExtension)
+ */
+ public void addExtension(IExtension extension) {
+ this.extensions.add(extension);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IUicRailTicket#setIssuerDetails(org.uic.ticket.api.spec.IIssuingDetail)
+ */
+ public void setIssuerDetails(IIssuingDetail issuerDetails) {
+ this.issuerDetails = issuerDetails;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IUicRailTicket#setTravelerDetails(org.uic.ticket.api.spec.ITravelerDetail)
+ */
+ public void setTravelerDetails(ITravelerDetail travelerDetails) {
+ this.travelerDetails = travelerDetails;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IUicRailTicket#setControlDetails(org.uic.ticket.api.spec.IControlDetail)
+ */
+ public void setControlDetails(IControlDetail controlDetails) {
+ this.controlDetails = controlDetails;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IUicRailTicket#getDocumentData()
+ */
+ @Override
+ public Collection<IDocumentData> getDocumentData() {
+ return this.documents;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IUicRailTicket#addReservation(org.uic.ticket.api.spec.IReservation)
+ */
+ @Override
+ public void addReservation(IReservation document) {
+ this.documents.add(document);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IUicRailTicket#addOpenTicket(org.uic.ticket.api.spec.IOpenTicket)
+ */
+ @Override
+ public void addOpenTicket(IOpenTicket document) {
+ this.documents.add(document);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IUicRailTicket#addCarCarriageReservation(org.uic.ticket.api.spec.ICarCarriageReservation)
+ */
+ @Override
+ public void addCarCarriageReservation(ICarCarriageReservation document) {
+ this.documents.add(document);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IUicRailTicket#addPass(org.uic.ticket.api.spec.IPass)
+ */
+ @Override
+ public void addPass(IPass document) {
+ this.documents.add(document);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IUicRailTicket#addVoucher(org.uic.ticket.api.spec.IVoucher)
+ */
+ @Override
+ public void addVoucher(IVoucher document) {
+ this.documents.add(document);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IUicRailTicket#addCustomerCard(org.uic.ticket.api.spec.ICustomerCard)
+ */
+ @Override
+ public void addCustomerCard(ICustomerCard document) {
+ this.documents.add(document);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IUicRailTicket#addCounterMark(org.uic.ticket.api.spec.ICounterMark)
+ */
+ @Override
+ public void addCounterMark(ICounterMark document) {
+ this.documents.add(document);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IUicRailTicket#addParkingGround(org.uic.ticket.api.spec.IParkingGround)
+ */
+ @Override
+ public void addParkingGround(IParkingGround document) {
+ this.documents.add(document);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IUicRailTicket#addFipTicket(org.uic.ticket.api.spec.IFipTicket)
+ */
+ @Override
+ public void addFipTicket(IFipTicket document) {
+ this.documents.add(document);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IUicRailTicket#addStationPassage(org.uic.ticket.api.spec.IStationPassage)
+ */
+ @Override
+ public void addStationPassage(IStationPassage document) {
+ this.documents.add(document);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IUicRailTicket#addDocumentExtension(org.uic.ticket.api.spec.IDocumentExtension)
+ */
+ @Override
+ public void addDocumentExtension(IDocumentExtension document) {
+ this.documents.add(document);
+ }
+
+ @Override
+ public void addDelayConfirmation(IDelayConfirmation document) {
+ this.documents.add(document);
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleUicTicketObjectFactory.java b/src/org/uic/barcode/ticket/api/impl/SimpleUicTicketObjectFactory.java new file mode 100644 index 0000000..3e3eac0 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleUicTicketObjectFactory.java @@ -0,0 +1,243 @@ +package org.uic.barcode.ticket.api.impl;
+
+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.IControlDetail;
+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.IGeoCoordinate;
+import org.uic.barcode.ticket.api.spec.IIncludedOpenTicket;
+import org.uic.barcode.ticket.api.spec.IIssuingDetail;
+import org.uic.barcode.ticket.api.spec.ILine;
+import org.uic.barcode.ticket.api.spec.ILuggageRestriction;
+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.IPlaces;
+import org.uic.barcode.ticket.api.spec.IPolygone;
+import org.uic.barcode.ticket.api.spec.IRegisteredLuggage;
+import org.uic.barcode.ticket.api.spec.IReservation;
+import org.uic.barcode.ticket.api.spec.IReturnRouteDescription;
+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.IStationPassage;
+import org.uic.barcode.ticket.api.spec.ITariff;
+import org.uic.barcode.ticket.api.spec.ITicketLink;
+import org.uic.barcode.ticket.api.spec.ITimeRange;
+import org.uic.barcode.ticket.api.spec.IToken;
+import org.uic.barcode.ticket.api.spec.ITrainLink;
+import org.uic.barcode.ticket.api.spec.ITraveler;
+import org.uic.barcode.ticket.api.spec.ITravelerDetail;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.api.spec.IUicTicketObjectFactory;
+import org.uic.barcode.ticket.api.spec.IValidityDetails;
+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;
+
+
+
+
+public class SimpleUicTicketObjectFactory implements IUicTicketObjectFactory {
+
+ public static IUicTicketObjectFactory getInstance(){
+ return new SimpleUicTicketObjectFactory();
+ }
+
+
+ public IBerth createBerth() {
+ return new SimpleBerth();
+ }
+
+ public ICarCarriageReservation createCarCarriageReservation() {
+ return new SimpleCarCarriageReservation();
+ }
+
+ public ICardReference createCardReference() {
+ return new SimpleCardReference();
+ }
+
+ public ICompartmentDetails createCompartmentDetails() {
+ return new SimpleCompartmentDetails();
+ }
+
+ public IControlDetail createControlDetail() {
+ return new SimpleControlDetail();
+ }
+
+ public ICounterMark createCounterMark() {
+ return new SimpleCounterMark();
+ }
+
+ public ICustomerCard createCustomerCard() {
+ return new SimpleCustomerCard();
+ }
+
+ public ICustomerStatusDescription createCustomerStatusDescription() {
+ return new SimpleCustomerStatusDescription();
+ }
+
+ public IDelayConfirmation createDelayConfirmation() {
+ return new SimpleDelayConfirmation();
+ }
+
+ public IDocumentData createDocumentData() {
+ return new SimpleDocumentData();
+ }
+
+ public IExtension createExtension() {
+ return new SimpleExtension();
+ }
+
+ public IFipTicket createFipTicket() {
+ return new SimpleFipTicket();
+ }
+
+ public IGeoCoordinate createGeoCoordinate() {
+ return new SimpleGeoCoordinate();
+ }
+
+ public IIncludedOpenTicket createIncludedOpenTicket() {
+ return new SimpleIncludedOpenTicket();
+ }
+
+ public IIssuingDetail createIssuingDetail() {
+ return new SimpleIssuingDetail();
+ }
+
+ public ILine createLine() {
+ return new SimpleLine();
+ }
+
+ public ILuggageRestriction createLuggageRestriction() {
+ return new SimpleLuggageRestriction();
+ }
+
+ public IOpenTicket createOpenTicket() {
+ return new SimpleOpenTicket();
+ }
+
+ public IParkingGround createParkingGround() {
+ return new SimpleParkingGround();
+ }
+
+ public IPass createPass() {
+ return new SimplePass();
+ }
+
+ public IPlaces createPlaces() {
+ return new SimplePlaces();
+ }
+
+ public IPolygone createPolygone() {
+ return new SimplePolygone();
+ }
+
+ public IRegisteredLuggage createRegisteredLuggage() {
+ return new SimpleRegisteredLuggage();
+ }
+
+ public IReservation createReservation() {
+ return new SimpleReservation();
+ }
+
+ public IReturnRouteDescription createReturnRouteDescription() {
+ return new SimpleReturnRouteDescription();
+ }
+
+ public IRouteSection createRouteSection() {
+ return new SimpleRouteSection();
+ }
+
+ public ISeriesDataDetails createSeriesDataDetails() {
+ return new SimpleSeriesDataDetails();
+ }
+
+ public IStationPassage createStationPassage() {
+ return new SimpleStationPassage();
+ }
+
+ public ITariff createTariff() {
+ return new SimpleTariff();
+ }
+
+ public ITicketLink createTicketLink() {
+ return new SimpleTicketLink();
+ }
+
+ public ITimeRange createTimeRange() {
+ return new SimpleTimeRange();
+ }
+
+ public IToken createToken() {
+ return new SimpleToken();
+ }
+
+ public ITrainLink createTrainLink() {
+ return new SimpleTrainLink();
+ }
+
+ public ITraveler createTraveler() {
+ return new SimpleTraveler();
+ }
+
+ public ITravelerDetail createTravelerDetail() {
+ return new SimpleTravelerDetail();
+ }
+
+ public IUicRailTicket createUicRailTicket() {
+ return new SimpleUicRailTicket();
+ }
+
+ public IValidityDetails createValidityDetails() {
+ return new SimpleValidityDetails();
+ }
+
+ public IValidityRange createValidityRange() {
+ return new SimpleValidityRange();
+ }
+
+ public IViaStation createViaStation() {
+ return new SimpleViaStation();
+ }
+
+ public IVoucher createVoucher() {
+ return new SimpleVoucher();
+ }
+
+ public IZone createZone() {
+ return new SimpleZone();
+ }
+
+ public IDocumentExtension createDocumentExtension() {
+ return new SimpleDocumentExtension();
+ }
+
+
+ @Override
+ public IServiceBrand createServiceBrand() {
+ return new SimpleServiceBrand();
+ }
+
+
+ @Override
+ public IVatDetail createVatDetail() {
+ return new SimpleVatDetail();
+ }
+
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleValidityDetails.java b/src/org/uic/barcode/ticket/api/impl/SimpleValidityDetails.java new file mode 100644 index 0000000..a5c46a5 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleValidityDetails.java @@ -0,0 +1,37 @@ +package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+
+import org.uic.barcode.ticket.api.spec.ITimeRange;
+import org.uic.barcode.ticket.api.spec.IValidityDetails;
+import org.uic.barcode.ticket.api.spec.IValidityRange;
+
+public class SimpleValidityDetails implements IValidityDetails {
+
+
+ private Collection<IValidityRange> validityRanges = new LinkedHashSet<IValidityRange>();
+
+ private Collection<ITimeRange> timeRanges = new LinkedHashSet<ITimeRange>();
+
+ @Override
+ public Collection<IValidityRange> getValidityRanges() {
+ return validityRanges;
+ }
+
+ @Override
+ public Collection<ITimeRange> getTimeRanges() {
+ return timeRanges;
+ }
+
+ @Override
+ public void addValidityRanges(IValidityRange range) {
+ this.validityRanges.add(range);
+ }
+
+ @Override
+ public void addTimeRanges(ITimeRange range) {
+ this.timeRanges.add(range);
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleValidityRange.java b/src/org/uic/barcode/ticket/api/impl/SimpleValidityRange.java new file mode 100644 index 0000000..e9a4082 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleValidityRange.java @@ -0,0 +1,90 @@ +package org.uic.barcode.ticket.api.impl;
+
+import java.util.Date;
+
+import org.uic.barcode.ticket.api.spec.IValidityRange;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimpleValidityRange.
+ */
+public class SimpleValidityRange implements IValidityRange {
+
+ /** The from date. */
+ private Date fromDate;
+
+ /** The until date. */
+ private Date untilDate;
+
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IValidityRange#getFromDate()
+ */
+ @Override
+ public Date getFromDate() {
+ return fromDate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IValidityRange#getUntilDate()
+ */
+ @Override
+ public Date getUntilDate() {
+ return untilDate;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IValidityRange#setFromDate(java.util.Date)
+ */
+ @Override
+ public void setFromDate(Date date) {
+ fromDate = date;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IValidityRange#setUntilDate(java.util.Date)
+ */
+ @Override
+ public void setUntilDate(Date date) {
+ untilDate = date;
+ }
+
+ /** The valid from utc coffset. */
+ protected Long validFromUTCoffset;
+
+ /** The valid until utc coffset. */
+ protected Long validUntilUTCoffset;
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IValidityRange#getValidFromUTCoffset()
+ */
+ public Long getValidFromUTCoffset() {
+ return validFromUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IValidityRange#setValidFromUTCoffset(java.lang.Long)
+ */
+ public void setValidFromUTCoffset(Long validFromUTCoffset) {
+ this.validFromUTCoffset = validFromUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IValidityRange#getValidUntilUTCoffset()
+ */
+ public Long getValidUntilUTCoffset() {
+ return validUntilUTCoffset;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IValidityRange#setValidUntilUTCoffset(java.lang.Long)
+ */
+ public void setValidUntilUTCoffset(Long validUntilUTCoffset) {
+ this.validUntilUTCoffset = validUntilUTCoffset;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleVatDetail.java b/src/org/uic/barcode/ticket/api/impl/SimpleVatDetail.java new file mode 100644 index 0000000..3a4032a --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleVatDetail.java @@ -0,0 +1,54 @@ +package org.uic.barcode.ticket.api.impl;
+
+
+import org.uic.barcode.ticket.api.spec.IVatDetail;
+
+public class SimpleVatDetail implements IVatDetail {
+
+
+ public int country;
+
+ public int percentage;
+
+ public Long amount;
+
+ public String vatId;
+
+ public int getCountry() {
+ return country;
+ }
+
+ public void setCountry(int country) {
+ this.country = country;
+ }
+
+ public int getPercentage() {
+ return percentage;
+ }
+
+ public void setPercentage(int percentage) {
+ this.percentage = percentage;
+ }
+
+ public Long getAmount() {
+ return amount;
+ }
+
+ public void setAmount(Long amount) {
+ this.amount = amount;
+ }
+
+ public String getVatId() {
+ return vatId;
+ }
+
+ public void setVatId(String vatId) {
+ this.vatId = vatId;
+ }
+
+
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleViaStation.java b/src/org/uic/barcode/ticket/api/impl/SimpleViaStation.java new file mode 100644 index 0000000..da0d815 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleViaStation.java @@ -0,0 +1,157 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+
+import org.uic.barcode.ticket.api.spec.IStationCodeTable;
+import org.uic.barcode.ticket.api.spec.IViaStation;
+
+
+/**
+ * The Class SimpleViaStation.
+ */
+public class SimpleViaStation implements IViaStation {
+
+ /** The station code table. */
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUIC;
+
+ /** The station. */
+ protected String station;
+
+ /** The alternative routes. */
+ protected Collection<IViaStation>alternativeRoutes = new LinkedHashSet<IViaStation>();
+
+ /** The route. */
+ protected Collection<IViaStation>route = new LinkedHashSet<IViaStation>();
+
+ /** The border. */
+ protected boolean border = false;
+
+ /** The carriers. */
+ protected Collection<String>carriers = new LinkedHashSet<String>();
+
+ /** The route id. */
+ protected int routeId;
+
+ /** The series id. */
+ protected int seriesId;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IViaStation#getStationCodeTable()
+ */
+ public IStationCodeTable getStationCodeTable() {
+ return stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IViaStation#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IViaStation#getStation()
+ */
+ public String getStation() {
+ return station;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IViaStation#setStation(java.lang.String)
+ */
+ public void setStation(String station) {
+ this.station = station;
+ }
+
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IViaStation#getAlternativeRoutes()
+ */
+ public Collection<IViaStation> getAlternativeRoutes() {
+ return alternativeRoutes;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IViaStation#addAlternativeRoute(org.uic.ticket.api.spec.IViaStation)
+ */
+ public void addAlternativeRoute(IViaStation route) {
+ this.alternativeRoutes.add(route);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IViaStation#getRoute()
+ */
+ public Collection<IViaStation> getRoute() {
+ return route;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IViaStation#addRouteStation(org.uic.ticket.api.spec.IViaStation)
+ */
+ public void addRouteStation(IViaStation viaStation) {
+ this.route.add(viaStation);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IViaStation#isBorder()
+ */
+ public boolean isBorder() {
+ return border;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IViaStation#setBorder(boolean)
+ */
+ public void setBorder(boolean border) {
+ this.border = border;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IViaStation#getCarriers()
+ */
+ public Collection<String> getCarriers() {
+ return carriers;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IViaStation#addCarrier(int)
+ */
+ public void addCarrier(String carrier) {
+ this.carriers.add(carrier);
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IViaStation#getRouteId()
+ */
+ public int getRouteId() {
+ return routeId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IViaStation#setRouteId(int)
+ */
+ public void setRouteId(int routeId) {
+ this.routeId = routeId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IViaStation#getSeriesId()
+ */
+ public int getSeriesId() {
+ return seriesId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IViaStation#setSeriesId(int)
+ */
+ public void setSeriesId(int seriesId) {
+ this.seriesId = seriesId;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleVoucher.java b/src/org/uic/barcode/ticket/api/impl/SimpleVoucher.java new file mode 100644 index 0000000..f124464 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleVoucher.java @@ -0,0 +1,180 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Date;
+
+import org.uic.barcode.ticket.api.spec.IExtension;
+import org.uic.barcode.ticket.api.spec.IVoucher;
+
+
+
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimpleVoucher.
+ */
+public class SimpleVoucher extends SimpleDocumentData implements IVoucher {
+
+ /** The reference. */
+ protected String reference;
+
+ /** The product id. */
+ protected String productId;
+
+ /** The product owner. */
+ protected String productOwner;
+
+ /** The valid from. */
+ protected Date validFrom;
+
+ /** The valid until. */
+ protected Date validUntil;
+
+ /** The info text. */
+ protected String infoText;
+
+ /** The amount. */
+ protected Integer amount;
+
+ /** The type. */
+ protected Integer type;
+
+ /** The extension data. */
+ protected IExtension extensionData;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IVoucher#getAmount()
+ */
+ public Integer getAmount() {
+ return amount;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IVoucher#setAmount(java.lang.Integer)
+ */
+ public void setAmount(Integer amount) {
+ this.amount = amount;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IVoucher#getType()
+ */
+ public Integer getType() {
+ return type;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IVoucher#setType(java.lang.Integer)
+ */
+ public void setType(Integer type) {
+ this.type = type;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IVoucher#getReference()
+ */
+ public String getReference() {
+ return reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IVoucher#setReference(java.lang.String)
+ */
+ public void setReference(String reference) {
+ this.reference = reference;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IVoucher#getProductId()
+ */
+ public String getProductId() {
+ return productId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IVoucher#setProductId(java.lang.String)
+ */
+ public void setProductId(String productId) {
+ this.productId = productId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IVoucher#getProductOwner()
+ */
+ public String getProductOwner() {
+ return productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IVoucher#setProductOwner(java.lang.String)
+ */
+ public void setProductOwner(String productOwner) {
+ this.productOwner = productOwner;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IVoucher#getValidFrom()
+ */
+ public Date getValidFrom() {
+ return validFrom;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IVoucher#setValidFrom(java.util.Date)
+ */
+ public void setValidFrom(Date validFrom) {
+ this.validFrom = validFrom;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IVoucher#getValidUntil()
+ */
+ public Date getValidUntil() {
+ return validUntil;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IVoucher#setValidUntil(java.util.Date)
+ */
+ public void setValidUntil(Date validUntil) {
+ this.validUntil = validUntil;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IVoucher#getInfoText()
+ */
+ public String getInfoText() {
+ return infoText;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IVoucher#setInfoText(java.lang.String)
+ */
+ public void setInfoText(String infoText) {
+ this.infoText = infoText;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IVoucher#getExtension()
+ */
+ @Override
+ public IExtension getExtension() {
+ return extensionData;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IVoucher#setExtension(org.uic.ticket.api.spec.IExtension)
+ */
+ @Override
+ public void setExtension(IExtension extensionData) {
+ this.extensionData = extensionData;
+ }
+
+
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/impl/SimpleZone.java b/src/org/uic/barcode/ticket/api/impl/SimpleZone.java new file mode 100644 index 0000000..46c54ef --- /dev/null +++ b/src/org/uic/barcode/ticket/api/impl/SimpleZone.java @@ -0,0 +1,155 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.impl;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.uic.barcode.ticket.api.spec.IStationCodeTable;
+import org.uic.barcode.ticket.api.spec.IZone;
+
+
+/**
+ * The Class SimpleZone.
+ */
+public class SimpleZone implements IZone {
+
+ /** The carrier. */
+ protected String carrier;
+
+
+ /** The station code table. */
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUIC;
+
+ /** The entry station. */
+ protected String entryStation;
+
+ /** The terminating station. */
+ protected String terminatingStation;
+
+ /** The city. */
+ protected int city;
+
+
+ /** The zone ids. */
+ protected Collection<Integer>zoneIds = new HashSet<Integer>();
+
+ /** The binaty zone id. */
+ protected byte[] binaryZoneId;
+
+
+ protected String nutsCode;
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IZone#getCarrier()
+ */
+ public String getCarrier() {
+ return carrier;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IZone#setCarrier(java.lang.String)
+ */
+ public void setCarrier(String carrier) {
+ this.carrier = carrier;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IZone#getStationCodeTable()
+ */
+ public IStationCodeTable getStationCodeTable() {
+ return stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IZone#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
+ this.stationCodeTable = stationCodeTable;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IZone#getEntryStation()
+ */
+ public String getEntryStation() {
+ return entryStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IZone#setEntryStation(java.lang.String)
+ */
+ public void setEntryStation(String entryStation) {
+ this.entryStation = entryStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IZone#getTerminatingStation()
+ */
+ public String getTerminatingStation() {
+ return terminatingStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IZone#setTerminatingStation(java.lang.String)
+ */
+ public void setTerminatingStation(String terminatingStation) {
+ this.terminatingStation = terminatingStation;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IZone#getCity()
+ */
+ public int getCity() {
+ return city;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IZone#setCity(int)
+ */
+ public void setCity(int city) {
+ this.city = city;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IZone#getBinatyZoneId()
+ */
+ public byte[] getBinaryZoneId() {
+ return binaryZoneId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IZone#setBinatyZoneId(byte[])
+ */
+ public void setBinaryZoneId(byte[] binaryZoneId) {
+ this.binaryZoneId = binaryZoneId;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IZone#getZoneIds()
+ */
+ public Collection<Integer> getZoneIds() {
+ return zoneIds;
+ }
+
+ /* (nicht-Javadoc)
+ * @see org.uic.ticket.api.spec.IZone#addZoneId(int)
+ */
+ public void addZoneId(int zoneId) {
+ this.zoneIds.add(new Integer (zoneId));
+ }
+
+ @Override
+ public String getNUTScode() {
+ return nutsCode;
+ }
+
+ @Override
+ public void setNUTScode(String code) {
+ nutsCode = code;
+ }
+
+
+
+
+}
diff --git a/src/org/uic/ticket/api/impl/package.html b/src/org/uic/barcode/ticket/api/impl/package.html index 587b741..587b741 100644 --- a/src/org/uic/ticket/api/impl/package.html +++ b/src/org/uic/barcode/ticket/api/impl/package.html diff --git a/src/org/uic/barcode/ticket/api/spec/IBerth.java b/src/org/uic/barcode/ticket/api/spec/IBerth.java new file mode 100644 index 0000000..80f5304 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IBerth.java @@ -0,0 +1,60 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import org.uic.barcode.ticket.EncodingFormatException;
+
+
+
+/**
+ * The Interface IBerth to specify the number and type of reserved berths in a reservation.
+ */
+public interface IBerth {
+
+ /**
+ * Gets the type of the berth (Single, Special, Double,..).
+ * -- sleeper compartment types corresponding to UIC leaflet 918.1
+ *
+ * @return the type
+ */
+ public IBerthTypeType getType() ;
+
+ /**
+ * Sets the type of the Berth.
+ * -- sleeper compartment types corresponding to UIC leaflet 918.1
+ *
+ * @param type the new berth type
+ */
+ public void setType(IBerthTypeType type);
+
+ /**
+ * Gets the number of berths.
+ *
+ * @return the number of berths reserved for the specified type of berth.
+ */
+ public int getNumberOfBerths();
+
+ /**
+ * Sets the number of berths reserved for the specified type of berth. The largest number allowed is 200.
+ *
+ * @param numberOfBerths the new number of berths
+ * @throws EncodingFormatException
+ */
+ public void setNumberOfBerths(int numberOfBerths);
+
+ /**
+ * Gets the gender information of the compartment reserved (family, male, female, mixed,..).
+ *
+ * @return the gender
+ */
+ public ICompartmentGenderType getGender();
+
+ /**
+ * Sets the gender information of the compartment reserved (family, male, female, mixed,..).
+ *
+ * @param gender the new gender
+ */
+ public void setGender(ICompartmentGenderType gender) ;
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IBerthTypeType.java b/src/org/uic/barcode/ticket/api/spec/IBerthTypeType.java new file mode 100644 index 0000000..4c4cb7c --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IBerthTypeType.java @@ -0,0 +1,41 @@ +/*
+ * 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.spec;
+
+public enum IBerthTypeType {
+ single("single"),
+ special("special"),
+ double_("double_"),
+ t2("t2"),
+ t3("t3"),
+ t4("t4");
+
+
+ public String text;
+
+ IBerthTypeType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/spec/ICarCarriageReservation.java b/src/org/uic/barcode/ticket/api/spec/ICarCarriageReservation.java new file mode 100644 index 0000000..21c03f3 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ICarCarriageReservation.java @@ -0,0 +1,590 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+import java.util.Date;
+
+
+/**
+ * The Interface ICarCarriageReservation.
+ *
+ * The data describe a car carriage reservation
+ *
+ */
+public interface ICarCarriageReservation extends IDocumentData {
+
+ /**
+ * Gets the train.
+ *
+ * @return the train
+ */
+ public String getTrain();
+
+ /**
+ * Sets the train.
+ *
+ * @param train the new train
+ */
+ public void setTrain(String train);
+
+ /**
+ * Gets the booking reference.
+ *
+ * The booking reference must contain the booking reference exchanged via
+ * booking interface according to UIC leaflet 918.1 in case this interface was used.
+ *
+ * @return the booking reference
+ */
+ public String getReference();
+
+ /**
+ * Sets the reference.
+ *
+ * The booking reference must contain the booking reference exchanged via
+ * booking interface according to UIC leaflet 918.1 in case this interface was used.
+ *
+ * @param reference the new reference
+ */
+ public void setReference(String reference);
+
+ /**
+ * Gets the product id.
+ *
+ * A product id to be looked up in a product catalog
+ *
+ * @return the product id
+ */
+ public String getProductId() ;
+
+ /**
+ * Sets the product id.
+ *
+ * @param productId the new product id
+ */
+ public void setProductId(String productId);
+
+ /**
+ * Gets the product owner.
+ *
+ * The company that defined the product. This is the allocating railway in case of car carriage reservations.
+ *
+ * @return the product owner
+ */
+ public String getProductOwner() ;
+
+ /**
+ * Sets the product owner.
+ *
+ * The company that defined the product. This is the allocating railway in case of car carriage reservations.
+ *
+ * @param productOwner the new product owner
+ */
+ public void setProductOwner(String productOwner);
+
+ /**
+ * Gets the service brand of the train.
+ *
+ * @return the service brand of the train
+ */
+ public IServiceBrand getServiceBrand();
+
+ /**
+ * sets the service brand of the train.
+ * @return
+ *
+ * @return the service brand of the train
+ */
+ public void setServiceBrand(IServiceBrand serviceBrand);
+
+
+ /**
+ * Gets the station code table.
+ *
+ * Defines the station code table to be used to retrieve station information.
+ * Default in case of reservations is the UIC station codes table for reservations
+ *
+ * @return the station code table
+ */
+ public IStationCodeTable getStationCodeTable();
+
+ /**
+ * Sets the station code table.
+ *
+ * Defines the station code table to be used to retrieve station information.
+ * Default in case of reservations is the UIC station codes table for reservations
+ *
+ * @param stationCodeTable the new station code table
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable);
+
+ /**
+ * Gets the from station code
+ *
+ * @return the from station code
+ */
+ public String getFromStation();
+
+ /**
+ * Sets the from station code
+ *
+ * @param fromStation the new from station code
+ */
+ public void setFromStation(String fromStation);
+
+ /**
+ * Gets the to station code
+ *
+ * @return the to station code
+ */
+ public String getToStation();
+
+ /**
+ * Sets the to station code
+ *
+ * @param toStation the new to station code
+ */
+ public void setToStation(String toStation);
+
+ /**
+ * Gets the from station name.
+ *
+ * Station names should be used only in bilateral scenarios where the
+ * control devices do not provide a station code table.
+ *
+ * @return the from station name
+ */
+ public String getFromStationName();
+
+ /**
+ * Sets the from station name.
+ *
+ * Station names should be used only in bilateral scenarios where the
+ * control devices do not provide a station code table.
+ *
+ * @param fromStationName the new from station name
+ */
+ public void setFromStationName(String fromStationName);
+
+ /**
+ * Gets the to station name.
+ *
+ * Station names should be used only in bilateral scenarios where the
+ * control devices do not provide a station code table.
+ *
+ * @return the to station name
+ */
+ public String getToStationName();
+
+ /**
+ * Sets the to station name.
+ *
+ * Station names should be used only in bilateral scenarios where the
+ * control devices do not provide a station code table.
+ *
+ * @param toStationName the new to station name
+ */
+ public void setToStationName(String toStationName);
+
+ /**
+ * Gets the carriers responsible for the transport
+ *
+ * @return the carriers
+ */
+ public Collection<String> getCarriers();
+
+ /**
+ * Adds a carrier responsible for the transport
+ *
+ * @param carrier the carrier
+ */
+ public void addCarrier(String carrier);
+
+
+ /**
+ * Gets the service level.
+ *
+ * Service level codes are defined in UIC leaflet 918.1
+ *
+ * @return the service level
+ */
+ public String getServiceLevel();
+
+ /**
+ * Sets the service level.
+ *
+ * Service level codes are defined in UIC leaflet 918.1
+ *
+ * @param serviceLevel the new service level
+ */
+ public void setServiceLevel(String serviceLevel);
+
+
+ /**
+ * Gets the place type details.
+ *
+ * @return the place type details
+ */
+ public ICompartmentDetails getCompartmentDetails();
+
+ /**
+ * Sets the place type details.
+ *
+ * @param compartmentDetails the new place type details
+ */
+ public void setCompartmentDetails(ICompartmentDetails compartmentDetails);
+
+ /**
+ * Gets the price type.
+ *
+ * price type indicates whether the price for the travel is included or not
+ *
+ * @return the price type
+ */
+ public IPriceTypeType getPriceType();
+
+ /**
+ * Sets the price type.
+ *
+ * price type indicates whether the price for the travel is included or not
+ *
+ * @param priceType the new price type
+ */
+ public void setPriceType(IPriceTypeType priceType) ;
+
+ /**
+ * Gets the info text for the control staff
+ *
+ * @return the info text for the control staff
+ */
+ public String getInfoText();
+
+ /**
+ * Sets the info text for the control staff
+ *
+ * @param infoText the new info text for the control staff
+ */
+ public void setInfoText(String infoText);
+
+ /**
+ * Gets the proprietary extension
+ *
+ * @return the proprietary extension
+ */
+ public IExtension getExtension();
+
+ /**
+ * Sets the proprietary extension.
+ *
+ * @param extension the new proprietary extension
+ */
+ public void setExtension(IExtension extension);
+
+ /**
+ * Gets the coach.
+ *
+ * @return the coach
+ */
+ public String getCoach();
+
+ /**
+ * Sets the coach.
+ *
+ * @param coach the new coach
+ */
+ public void setCoach(String coach);
+
+ /**
+ * Gets the place.
+ *
+ * @return the place
+ */
+ public String getPlace();
+
+ /**
+ * Sets the place.
+ *
+ * @param place the new place
+ */
+ public void setPlace(String place);
+
+ /**
+ * Gets the tariff.
+ *
+ * @return the tariff
+ */
+ public ITariff getTariff();
+
+ /**
+ * Sets the tariff.
+ *
+ * @param tariff the new tariff
+ */
+ public void setTariff(ITariff tariff);
+
+ /**
+ * Gets the number plate.
+ *
+ * @return the number plate
+ */
+ public String getNumberPlate();
+
+ /**
+ * Sets the number plate.
+ *
+ * @param numberPlate the new number plate
+ */
+ public void setNumberPlate(String numberPlate);
+
+ /**
+ * Gets the trailer plate.
+ *
+ * @return the trailer plate
+ */
+ public String getTrailerPlate();
+
+ /**
+ * Sets the trailer plate.
+ *
+ * @param trailerPlate the new trailer plate
+ */
+ public void setTrailerPlate(String trailerPlate);
+
+ /**
+ * Gets the car category.
+ *
+ * Car categories are defined in UIC leaflet 918.1
+ *
+ * @return the car category
+ */
+ public int getCarCategory() ;
+
+ /**
+ * Sets the car category.
+ *
+ * Car categories are defined in UIC leaflet 918.1
+ *
+ * @param carCategory the new car category
+ */
+ public void setCarCategory(int carCategory);
+
+ /**
+ * Gets the boat category.
+ *
+ * Boat categories are defined in UIC leaflet 918.1
+ *
+ * @return the boat category
+ */
+ public int getBoatCategory();
+
+ /**
+ * Sets the boat category.
+ *
+ * Boat categories are defined in UIC leaflet 918.1
+ *
+ * @param boatCategory the new boat category
+ */
+ public void setBoatCategory(int boatCategory) ;
+
+ /**
+ * Checks if the car has a textile roof.
+ *
+ * @return true, if the car has a textile roof
+ */
+ public boolean isTextileRoof();
+
+ /**
+ * Sets that the car bas a textile roof.
+ *
+ * @param textileRoof the textile roof of a car
+ */
+ public void setTextileRoof(boolean textileRoof);
+
+ /**
+ * Gets the roof rack type.
+ *
+ * Roof rack types are defined in UIC leaflet 918.1
+ *
+ * @return the roof rack type
+ */
+ public IRoofRackType getRoofRackType();
+
+ /**
+ * Sets the roof rack type.
+ *
+ * Roof rack types are defined in UIC leaflet 918.1
+ *
+ * @param roofRackType the new roof rack type
+ */
+ public void setRoofRackType(IRoofRackType roofRackType);
+
+ /**
+ * Gets the roof rack height in cm
+ *
+ * @return the roof rack height in cm
+ */
+ public int getRoofRackHeight();
+
+ /**
+ * Sets the roof rack height in cm
+ *
+ * @param roofRackHeight the new roof rack height in cm
+ */
+ public void setRoofRackHeight(int roofRackHeight);
+
+ /**
+ * Gets the number of attached boats.
+ *
+ * @return the number of attached boats
+ */
+ public int getAttachedBoats();
+
+ /**
+ * Sets the number of attached boats.
+ *
+ * @param attachedBoats the number of attached boats
+ */
+ public void setAttachedBoats(int attachedBoats) ;
+
+ /**
+ * Gets the number of attached bicycles.
+ *
+ * @return the number of attached bicycles
+ */
+ public int getAttachedBicycles();
+
+ /**
+ * Sets the number of attached bicycles.
+ *
+ * @param attachedBicycles the number of attached bicycles
+ */
+ public void setAttachedBicycles(int attachedBicycles);
+
+ /**
+ * Gets the number of attached surfboards.
+ *
+ * @return the number of attached surfboards
+ */
+ public int getAttachedSurfboards();
+
+ /**
+ * Sets the number of attached surfboards.
+ *
+ * @param attachedSurfboards the number of attached surfboards
+ */
+ public void setAttachedSurfboards(int attachedSurfboards);
+
+ /**
+ * Gets the begin of the loading on the train
+ *
+ * @return the begin loading date and time
+ */
+ public Date getBeginLoading();
+
+ /**
+ * Sets the begin of the loading on the train
+ *
+ * @param beginLoading the begin loading date and time
+ */
+ public void setBeginLoading(Date beginLoading);
+
+ /**
+ * Gets the end of the loading on the train
+ *
+ * @return the end of the loading on the train
+ */
+ public Date getEndLoading();
+
+ /**
+ * Sets the end of the loading on the train
+ *
+ * @param endLoading the end of the loading on the train
+ */
+ public void setEndLoading(Date endLoading);
+
+ /**
+ * Gets the loading list entry.
+ *
+ * @return the loading list entry
+ */
+ public int getLoadingListEntry();
+
+ /**
+ * Sets the loading list entry.
+ *
+ * @param loadingListEntry the new loading list entry
+ */
+ public void setLoadingListEntry(int loadingListEntry);
+
+ /**
+ * Gets the loading deck.
+ *
+ * @return the loading deck
+ */
+ public ILoadingDeckType getLoadingDeck();
+
+ /**
+ * Sets the loading deck.
+ *
+ * @param loadingDeck the new loading deck
+ */
+ public void setLoadingDeck(ILoadingDeckType loadingDeck);
+
+
+ /**
+ * Sets the price.
+ *
+ *
+ * @param price
+ */
+ public void setPrice(Long price);
+
+
+ /**
+ * Gets the price.
+ *
+ * The price
+ *
+ * @return the price
+ */
+ public Long getPrice();
+
+
+ /**
+ * Gets the included add on tickets.
+ *
+ * E.g. an included local transport ticket at the beginning or end of the route.
+ *
+ * @return the included add ons
+ */
+ public Collection<IVatDetail> getVatDetails();
+
+ /**
+ * Adds an included add on ticket.
+ *
+ * E.g. an included local transport ticket at the beginning or end of the route.
+ *
+ * @param includedAddOn the included add on
+ */
+ public void addVatDetail(IVatDetail vatDetail) ;
+
+
+ /**
+ * Gets the departure date time offset to UTC in units of 15 minutes.
+ *
+ * @return the loading time UTC offset
+ */
+ public Long getLoadingTimeUTCoffset();
+
+ /**
+ * Sets the departure date time.
+ *
+ * @param the loading time UTC offset
+ */
+ public void setLoadingTimeUTCoffset(Long UTCoffset) ;
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/ICardReference.java b/src/org/uic/barcode/ticket/api/spec/ICardReference.java new file mode 100644 index 0000000..b85acd6 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ICardReference.java @@ -0,0 +1,107 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+/**
+ * The Interface ICardReference.
+ *
+ * ICardReference defines the data for a reference to a customer card
+ */
+public interface ICardReference {
+
+
+ /**
+ * Gets the card issuer.
+ *
+ * For rail cards the RICS code has to be used.
+ *
+ * @return the card issuer
+ */
+ public String getCardIssuer();
+
+ /**
+ * Sets the card issuer.
+ *
+ * For rail cards the RICS code has to be used.
+ *
+ * @param cardIssuer the new card issuer
+ */
+ public void setCardIssuer(String cardIssuer);
+
+ /**
+ * Gets the card id.
+ *
+ * The id will be trimmed. The maximum size is 20 positions
+ *
+ * @return the card id
+ */
+ public String getCardId();
+
+ /**
+ * Sets the card id.
+ *
+ * @param cardId the new card id
+ */
+ public void setCardId(String cardId);
+
+ /**
+ * Gets the card name.
+ *
+ * @return the card name
+ */
+ public String getCardName();
+
+ /**
+ * Sets the card name.
+ *
+ *
+ * @param cardName the new card name
+ */
+ public void setCardName(String cardName);
+
+ /**
+ * Gets the card type.
+ *
+ * @return the card type
+ */
+ public int getCardType();
+
+ /**
+ * Sets the card type.
+ *
+ * Code list defined and published by the issuer of the card
+ *
+ * @param cardType the new card type
+ */
+ public void setCardType(int cardType);
+
+ /**
+ * Gets the leading card id in case the entire cardId must not be provided.
+ *
+ * @return the leading card id
+ */
+ public String getLeadingCardId();
+
+ /**
+ * Sets the leading card id in case the entire cardId must not be provided.
+ *
+ * @param leadingCardId the new leading card id
+ */
+ public void setLeadingCardId(String leadingCardId);
+
+ /**
+ * Gets the trailing card id in case the entire cardId must not be provided.
+ *
+ * @return the trailing card id
+ */
+ public String getTrailingCardId();
+
+ /**
+ * Sets the trailing card id in case the entire cardId must not be provided.
+ *
+ * @param trailingCardId the new trailing card id
+ */
+ public void setTrailingCardId(String trailingCardId);
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/ICompartmentDetails.java b/src/org/uic/barcode/ticket/api/spec/ICompartmentDetails.java new file mode 100644 index 0000000..c65e094 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ICompartmentDetails.java @@ -0,0 +1,126 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+/**
+ * The Interface ICompartmentDetails.
+ *
+ * ICompartmentDetails defines details on reserved place types
+ *
+ * The codes corresponds to UIC leaflet 918.1 element 51
+ *
+ */
+public interface ICompartmentDetails {
+
+ /**
+ * Gets the coach type.
+ *
+ * The codes corresponds to UIC leaflet 918.1 element 51 position 1 and 2
+ *
+ * @return the coach type
+ */
+ public int getCoachType();
+
+ /**
+ * Sets the coach type.
+ *
+ * The codes corresponds to UIC leaflet 918.1 element 51 position 1 and 2
+ *
+ * @param coachType the new coach type
+ */
+ public void setCoachType(int coachType);
+
+ /**
+ * Gets the compartment type.
+ *
+ * The codes corresponds to UIC leaflet 918.1 element 51 position 3 and 4
+ *
+ * @return the compartment type
+ */
+ public int getCompartmentType() ;
+
+ /**
+ * Sets the compartment type.
+ *
+ * The codes corresponds to UIC leaflet 918.1 element 51 position 3 and 4
+ *
+ * @param compartmentType the new compartment type
+ */
+ public void setCompartmentType(int compartmentType);
+
+ /**
+ * Gets the special allocation.
+ *
+ * The codes corresponds to UIC leaflet 918.1 element 51 position 5 and 6
+ *
+ * @return the special allocation
+ */
+ public int getSpecialAllocation() ;
+
+ /**
+ * Sets the special allocation.
+ *
+ * The codes corresponds to UIC leaflet 918.1 element 51 position 5 and 6
+ *
+ * @param specialAllocation the new special allocation
+ */
+ public void setSpecialAllocation(int specialAllocation);
+
+ /**
+ * Gets the coach type description.
+ *
+ * @return the coach type description
+ */
+ public String getCoachTypeDescr();
+
+ /**
+ * Sets the coach type description.
+ *
+ * @param coachTypeDescr the new coach type description
+ */
+ public void setCoachTypeDescr(String coachTypeDescr);
+
+ /**
+ * Gets the compartment type description.
+ *
+ * @return the compartment type description
+ */
+ public String getCompartmentTypeDescr();
+
+ /**
+ * Sets the compartment type description
+ *
+ * @param comparttmentTypeDescr the new compartment type description
+ */
+ public void setCompartmentTypeDescr(String comparttmentTypeDescr);
+
+ /**
+ * Gets the special allocation description.
+ *
+ * @return the special allocation description
+ */
+ public String getSpecialAllocationDescr();
+
+ /**
+ * Sets the special allocation description.
+ *
+ * @param specialAllocationDescr the new special allocation description
+ */
+ public void setSpecialAllocationDescr(String specialAllocationDescr);
+
+ /**
+ * Gets the position in trains with different decks.
+ *
+ * @return the position
+ */
+ public ICompartmentPositionType getPosition();
+
+ /**
+ * Sets the position of the compartment in trains with different decks
+ *
+ * @param position the new position
+ */
+ public void setPosition(ICompartmentPositionType position);
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/ICompartmentGenderType.java b/src/org/uic/barcode/ticket/api/spec/ICompartmentGenderType.java new file mode 100644 index 0000000..3b89947 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ICompartmentGenderType.java @@ -0,0 +1,42 @@ +/*
+ * 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.spec;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum ICompartmentGenderType {
+ unspecified("unspecified"),
+ family("family"),
+ female("female"),
+ male("male"),
+ mixed("mixed");
+
+ public String text;
+
+ ICompartmentGenderType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+
+}
\ No newline at end of file diff --git a/src/org/uic/barcode/ticket/api/spec/ICompartmentPositionType.java b/src/org/uic/barcode/ticket/api/spec/ICompartmentPositionType.java new file mode 100644 index 0000000..36effac --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ICompartmentPositionType.java @@ -0,0 +1,38 @@ +/*
+ * 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.spec;
+
+
+public enum ICompartmentPositionType {
+ unspecified("unspecified"),
+ upperLevel("upperLevel"),
+ lowerLevel("lowerLevel");
+
+ public String text;
+
+ ICompartmentPositionType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/spec/IControlDetail.java b/src/org/uic/barcode/ticket/api/spec/IControlDetail.java new file mode 100644 index 0000000..7e24c8b --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IControlDetail.java @@ -0,0 +1,249 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+
+/**
+ * The Interface IControlDetail.
+ *
+ *
+ * IControlDetails provides data supporting the control process:
+ * -- - list of items which the traveler can use to identify himself or the unique
+ * -- usage of the ticket
+ * -- (card ids, parts or identity card numbers, credit card numbers,..)
+ * -- - hints on the validation to be made on board
+ */
+public interface IControlDetail {
+
+ /**
+ * Gets the card references the traveler can use to identify himself.
+ *
+ * @return the card references
+ */
+ public Collection<ICardReference> getIdentificationByCardReference();
+
+
+
+ /**
+ * Adds a card references the traveler can use to identify himself.
+ *
+ * @param cardReference the card reference
+ */
+ public void addIdentificationByCardReference(ICardReference cardReference);
+
+
+ /**
+ * Checks if the traveler can be identified by id card.
+ *
+ * @return true, if identification by id card is possible
+ */
+ public boolean isIdentificationByIdCard();
+
+
+ /**
+ * Sets whether the traveler can be identified by id card.
+ *
+ * @param identificationByIdCard the new identification by id card flag
+ */
+ public void setIdentificationByIdCard(boolean identificationByIdCard);
+
+
+ /**
+ * Checks whether the traveler can be identified by passport id.
+ *
+ * @return true, if the traveler can be identified by passport id
+ */
+ public boolean isIdentificationByPassportId();
+
+
+ /**
+ * Sets whether the traveler can be identified by passport id.
+ *
+ * @param identificationByPassportId the new identification by passport id flag
+ */
+ public void setIdentificationByPassportId(boolean identificationByPassportId);
+
+
+ /**
+ * Gets the identification item code.
+ *
+ * For future use, no code list defined yet
+ *
+ * @return the identification item
+ */
+ public int getIdentificationItem();
+
+
+ /**
+ * Sets the identification item.
+ *
+ * For future use, no code list defined yet
+ *
+ * @param identificationItem the new identification item
+ */
+ public void setIdentificationItem(int identificationItem);
+
+
+ /**
+ * Checks if passport validation is required.
+ *
+ * @return true, if is passport validation required
+ */
+ public boolean isPassportValidationRequired();
+
+
+ /**
+ * Sets the passport validation required.
+ *
+ * @param passportValidationRequired the new passport validation required flag
+ */
+ public void setPassportValidationRequired(boolean passportValidationRequired);
+
+
+ /**
+ * Checks if is online validation required.
+ *
+ * In this case the ticket must be validated with the online server holding the ticket.
+ * This is usually the server of the product owner of a ticket.
+ *
+ * @return true, if is online validation required
+ */
+ public boolean isOnlineValidationRequired();
+
+
+ /**
+ * Sets the online validation required.
+ *
+ * In this case the ticket must be validated with the online server holding the ticket.
+ * This is usually the server of the product owner of a ticket.
+ *
+ * @param onlineValidationRequired the new online validation required
+ */
+ public void setOnlineValidationRequired(boolean onlineValidationRequired);
+
+
+ /**
+ * Gets the random detailed validation required.
+ *
+ * This indicates to the control device, that this ticket type should be
+ * checked in more detail in the indicated percentage of cases.
+ *
+ * The ticket type is identified by:
+ * - product owner
+ * - type of the ticket (Reservation, Open Ticket, Pass,..)
+ *
+ * The detailed inspection might be implemented by storing the entire bar code data for
+ * further inspection and in taking a picture of the paper ticket.
+ *
+ * @return the random detailed validation required
+ */
+ public int getRandomDetailedValidationRequired();
+
+
+ /**
+ * Sets the random detailed validation required.
+ *
+ * This indicates to the control device, that this ticket type should be
+ * checked in more detail in the indicated percentage of cases.
+ *
+ * The ticket type is identified by:
+ * - product owner
+ * - type of the ticket (Reservation, Open Ticket, Pass,..)
+ *
+ * The detailed inspection might be implemented by storing the entire bar code data for
+ * further inspection and in taking a picture of the paper ticket.
+ *
+ * @param randomOnlineValidationRequired the new random detailed validation required
+ */
+ public void setRandomDetailedValidationRequired(int randomOnlineValidationRequired);
+
+
+ /**
+ * Checks if an age check on the passengers is required.
+ *
+ * @return true, if an age check on the passengers is required
+ */
+ public boolean isAgeCheckRequired();
+
+
+ /**
+ * Sets whether an age check on the passengers is required.
+ *
+ * @param ageCheckRequired the new age check required flag
+ */
+ public void setAgeCheckRequired(boolean ageCheckRequired);
+
+
+ /**
+ * Checks if is reduction card check required.
+ *
+ * @return true, if is reduction card check required
+ */
+ public boolean isReductionCardCheckRequired();
+
+
+ /**
+ * Sets the reduction card check required.
+ *
+ * @param reductionCardCheckRequired the new reduction card check required
+ */
+ public void setReductionCardCheckRequired(boolean reductionCardCheckRequired);
+
+
+ /**
+ * Gets the info text for the control staff.
+ *
+ * @return the info text for the control staff
+ */
+ public String getInfoText();
+
+
+ /**
+ * Sets the info text for the control staff.
+ *
+ * @param infoText the new info text for the control staff
+ */
+ public void setInfoText(String infoText);
+
+
+ /**
+ * Gets the linked tickets.
+ *
+ * Linked tickets are separate tickets which should be included in the check.
+ * E.g. A Rail Pass accompanying a Reservation with a tariff valid for passes only.
+ *
+ * @return the linked tickets
+ */
+ public Collection<ITicketLink> getLinkedTickets() ;
+
+
+ /**
+ * Adds the linked ticket.
+ *
+ * Linked tickets are separate tickets which should be included in the check.
+ * E.g. A Rail Pass accompanying a Reservation with a tariff valid for passes only.
+ *
+ * @param linkedTicket the linked ticket
+ */
+ public void addLinkedTicket(ITicketLink linkedTicket) ;
+
+
+ /**
+ * Gets the extension.
+ *
+ * @return the extension
+ */
+ public IExtension getExtension();
+
+
+ /**
+ * Sets the extension.
+ *
+ * @param extension the new extension
+ */
+ public void setExtension(IExtension extension);
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/ICounterMark.java b/src/org/uic/barcode/ticket/api/spec/ICounterMark.java new file mode 100644 index 0000000..43b7cc5 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ICounterMark.java @@ -0,0 +1,397 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+import java.util.Date;
+
+/**
+ * The Interface ICounterMark.
+ *
+ * The group ticket counter mark.
+ *
+ * Members of a group might be provided with a counter mark indicating their
+ * participation in a group. The counter mark is not itself a ticket, but referees to a
+ * ticket.
+ *
+ * The content corresponds to the open ticket content.
+ *
+ */
+public interface ICounterMark extends IDocumentData {
+
+
+ /**
+ * Gets the reference.
+ *
+ * @return the reference
+ */
+ public String getReference();
+
+ /**
+ * Sets the reference.
+ *
+ * @param reference the new reference
+ */
+ public void setReference(String reference);
+
+ /**
+ * Gets the product owner.
+ *
+ * The product owner is the railways responsible for assembling this ticket. As there is currently no
+ * standard interface for open tickets between an product owner and an issuer this is usually
+ * identical to the issuer of a counter mark.
+ *
+ * @return the product owner
+ */
+ public String getProductOwner();
+
+ /**
+ * Sets the product owner.
+ *
+ * The product owner is the railways responsible for assembling this ticket. As there is currently no
+ * standard interface for open tickets between an product owner and an issuer this is usually
+ * identical to the issuer of a counter mark.
+ *
+ * @param productOwner the new product owner
+ */
+ public void setProductOwner(String productOwner);
+
+ /**
+ * Gets the product id.
+ *
+ * @return the product id
+ */
+ public String getProductId();
+
+ /**
+ * Sets the product id.
+ *
+ * @param productId the new product id
+ */
+ public void setProductId(String productId);
+
+
+ /**
+ * Checks if is return included.
+ *
+ * @return true, if is return included
+ */
+ public boolean isReturnIncluded();
+
+ /**
+ * Sets the return included.
+ *
+ * @param returnIncluded the new return included
+ */
+ public void setReturnIncluded(boolean returnIncluded);
+
+ /**
+ * Gets the station code table.
+ *
+ * Defines the station code table to be used to retrieve station information.
+ * Default in this case is the UIC station codes table for standard UIC
+ * station code from MERITS (UIC country code + 5 digit local code)
+ *
+ * @return the station code table
+ */
+ public IStationCodeTable getStationCodeTable();
+
+ /**
+ * Sets the station code table.
+ *
+ * Defines the station code table to be used to retrieve station information.
+ * Default in this case is the UIC station codes table for standard UIC
+ * station code from MERITS (UIC country code + 5 digit local code)
+ *
+ * @param stationCodeTable the new station code table
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable);
+
+ /**
+ * Gets the from station.
+ *
+ * @return the from station
+ */
+ public String getFromStation();
+
+ /**
+ * Sets the from station.
+ *
+ * @param fromStation the new from station
+ */
+ public void setFromStation(String fromStation);
+
+ /**
+ * Gets the to station.
+ *
+ * @return the to station
+ */
+ public String getToStation();
+
+ /**
+ * Sets the to station.
+ *
+ * @param toStation the new to station
+ */
+ public void setToStation(String toStation);
+
+ /**
+ * Gets the from station name.
+ *
+ * @return the from station name
+ */
+ public String getFromStationName();
+
+ /**
+ * Sets the from station name.
+ *
+ * @param fromStationName the new from station name
+ */
+ public void setFromStationName(String fromStationName);
+
+ /**
+ * Gets the to station name.
+ *
+ * @return the to station name
+ */
+ public String getToStationName();
+
+ /**
+ * Sets the to station name.
+ *
+ * @param toStationName the new to station name
+ */
+ public void setToStationName(String toStationName);
+
+ /**
+ * Gets the valid region desc.
+ *
+ * @return the valid region desc
+ */
+ public String getValidRegionDesc();
+
+ /**
+ * Sets the valid region desc.
+ *
+ * @param validRegionDesc the new valid region desc
+ */
+ public void setValidRegionDesc(String validRegionDesc);
+
+ /**
+ * Gets the valid region list.
+ *
+ * @return the valid region list
+ */
+ public Collection<IRegionalValidity> getValidRegionList();
+
+ /**
+ * Adds the valid region list.
+ *
+ * @param validRegion the valid region
+ */
+ public void addValidRegionList(IRegionalValidity validRegion);
+
+ /**
+ * Gets the return description.
+ *
+ * @return the return description
+ */
+ public IReturnRouteDescription getReturnDescription() ;
+
+ /**
+ * Sets the return description.
+ *
+ * @param returnDescription the new return description
+ */
+ public void setReturnDescription(IReturnRouteDescription returnDescription);
+
+ /**
+ * Gets the valid from.
+ *
+ * @return the valid from
+ */
+ public Date getValidFrom() ;
+
+ /**
+ * Sets the valid from.
+ *
+ * @param validFrom the new valid from
+ */
+ public void setValidFrom(Date validFrom);
+
+ /**
+ * Gets the valid until.
+ *
+ * @return the valid until
+ */
+ public Date getValidUntil();
+
+ /**
+ * Sets the valid until.
+ *
+ * @param validUntil the new valid until
+ */
+ public void setValidUntil(Date validUntil);
+
+ /**
+ * Gets the class code.
+ *
+ * @return the class code
+ */
+ public ITravelClassType getClassCode();
+
+ /**
+ * Sets the class code.
+ *
+ * @param classCode the new class code
+ */
+ public void setClassCode(ITravelClassType classCode);
+
+ /**
+ * Gets the included carriers.
+ *
+ * @return the included carriers
+ */
+ public Collection<String> getIncludedCarriers();
+
+ /**
+ * Adds the included carrier.
+ *
+ * @param includedCarrier the included carrier
+ */
+ public void addIncludedCarrier(String includedCarrier);
+
+ /**
+ * Gets the included service brands.
+ *
+ * @return the included service brands
+ */
+ public Collection<Integer> getIncludedServiceBrands();
+
+ /**
+ * Adds the included service brand.
+ *
+ * @param includedServiceBrand the included service brand
+ */
+ public void addIncludedServiceBrand(Integer includedServiceBrand);
+
+ /**
+ * Gets the excluded service brands.
+ *
+ * @return the excluded service brands
+ */
+ public Collection<Integer> getExcludedServiceBrands();
+
+ /**
+ * Adds the excluded service brand.
+ *
+ * @param excludedServiceBrand the excluded service brand
+ */
+ public void addExcludedServiceBrand(Integer excludedServiceBrand);
+
+ /**
+ * Gets the info text.
+ *
+ * @return the info text
+ */
+ public String getInfoText();
+
+ /**
+ * Sets the info text.
+ *
+ * @param infoText the new info text
+ */
+ public void setInfoText(String infoText);
+
+ /**
+ * Gets the extension.
+ *
+ * @return the extension
+ */
+ public IExtension getExtension();
+
+ /**
+ * Sets the extension.
+ *
+ * @param extension the new extension
+ */
+ public void setExtension(IExtension extension);
+
+ /**
+ * Gets the total of countermarks.
+ *
+ * @return the total of countermarks
+ */
+ public int getTotalOfCountermarks();
+
+ /**
+ * Sets the total of countermarks.
+ *
+ * @param totalOfCountermarks the new total of countermarks
+ */
+ public void setTotalOfCountermarks(int totalOfCountermarks);
+
+ /**
+ * Gets the group name.
+ *
+ * @return the group name
+ */
+ public String getGroupName();
+
+ /**
+ * Sets the group name.
+ *
+ * @param groupName the new group name
+ */
+ public void setGroupName(String groupName);
+
+ /**
+ * Gets the number of countermark.
+ *
+ * @return the number of countermark
+ */
+ public int getNumberOfCountermark();
+
+ /**
+ * Sets the number of countermark.
+ *
+ * @param numberOfCountermark the new number of countermark
+ */
+ public void setNumberOfCountermark(int numberOfCountermark) ;
+
+
+ public void setTicketReference(String ticketReference);
+ public String getTicketReference();
+
+ /**
+ * Gets the validFrom date time offset to UTC in units of 15 minutes.
+ *
+ * @return the validFrom date time UTC offset
+ */
+ public Long getValidFromUTCoffset();
+
+ /**
+ * Sets the validFrom date time.
+ *
+ * @param validFromDateTime the new validFrom date time
+ */
+ public void setValidFromUTCoffset(Long validFromUTCoffset) ;
+
+ /**
+ * Gets the validUntil date time offset to UTC in units of 15 minutes.
+ *
+ * @return the validUntil date time UTC offset
+ */
+ public Long getValidUntilUTCoffset();
+
+ /**
+ * Sets the validUntil date time.
+ *
+ * @param validUntilDateTime the new validUntil date time
+ */
+ public void setValidUntilUTCoffset(Long validUntilUTCoffset) ;
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/ICustomerCard.java b/src/org/uic/barcode/ticket/api/spec/ICustomerCard.java new file mode 100644 index 0000000..f4001e8 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ICustomerCard.java @@ -0,0 +1,171 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+import java.util.Date;
+
+
+
+/**
+ * The Interface ICustomerCard.
+ */
+public interface ICustomerCard extends IDocumentData {
+
+
+ /**
+ * Gets the customer.
+ *
+ * @return the customer
+ */
+ public ITraveler getCustomer() ;
+
+ /**
+ * Sets the customer.
+ *
+ * @param customer the new customer
+ */
+ public void setCustomer(ITraveler customer) ;
+
+ /**
+ * Gets the card id.
+ *
+ * @return the card id
+ */
+ public String getCardId();
+
+ /**
+ * Sets the card id.
+ *
+ * @param cardId the new card id
+ */
+ public void setCardId(String cardId);
+
+ /**
+ * Gets the valid from.
+ *
+ * @return the valid from
+ */
+ public Date getValidFrom();
+
+ /**
+ * Sets the valid from.
+ *
+ * @param validFrom the new valid from
+ */
+ public void setValidFrom(Date validFrom);
+
+ /**
+ * Gets the valid until.
+ *
+ * @return the valid until
+ */
+ public Date getValidUntil();
+
+ /**
+ * Sets the valid until.
+ *
+ * @param validUntil the new valid until
+ */
+ public void setValidUntil(Date validUntil) ;
+
+ /**
+ * Gets the class code.
+ *
+ * @return the class code
+ */
+ public ITravelClassType getClassCode();
+
+ /**
+ * Sets the class code.
+ *
+ * @param classCode the new class code
+ */
+ public void setClassCode(ITravelClassType classCode);
+
+ /**
+ * Gets the card type.
+ *
+ * @return the card type
+ */
+ public int getCardType();
+
+ /**
+ * Sets the card type.
+ *
+ * @param cardType the new card type
+ */
+ public void setCardType(int cardType);
+
+ /**
+ * Gets the card type descr.
+ *
+ * @return the card type descr
+ */
+ public String getCardTypeDescr();
+
+ /**
+ * Sets the card type descr.
+ *
+ * @param cardTypeDescr the new card type descr
+ */
+ public void setCardTypeDescr(String cardTypeDescr);
+
+ /**
+ * Gets the customer status.
+ *
+ * @return the customer status
+ */
+ public int getCustomerStatus();
+
+ /**
+ * Sets the customer status.
+ *
+ * @param customerStatus the new customer status
+ */
+ public void setCustomerStatus(int customerStatus);
+
+ /**
+ * Gets the customer status descr.
+ *
+ * @return the customer status descr
+ */
+ public String getCustomerStatusDescr();
+
+ /**
+ * Sets the customer status descr.
+ *
+ * @param customerStatusDescr the new customer status descr
+ */
+ public void setCustomerStatusDescr(String customerStatusDescr);
+
+ /**
+ * Gets the included services.
+ *
+ * @return the included services
+ */
+ public Collection<Integer> getIncludedServices();
+
+ /**
+ * Adds the included service.
+ *
+ * @param includedService the included service
+ */
+ public void addIncludedService(Integer includedService);
+
+ /**
+ * Gets the extension.
+ *
+ * @return the extension
+ */
+ public IExtension getExtension();
+
+ /**
+ * Sets the extension.
+ *
+ * @param extension the new extension
+ */
+ public void setExtension(IExtension extension);
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/ICustomerStatusDescription.java b/src/org/uic/barcode/ticket/api/spec/ICustomerStatusDescription.java new file mode 100644 index 0000000..487612c --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ICustomerStatusDescription.java @@ -0,0 +1,79 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+/**
+ * The Interface ICustomerStatusDescription.
+ *
+ *
+ * ICustomerStatusDescription provides a description of the customer status.
+ *
+ */
+public interface ICustomerStatusDescription {
+
+ /**
+ * Gets the status provider.
+ *
+ * RICS codes should be used in case the status is provided by a railway.
+ *
+ * @return the status provider
+ */
+ public String getStatusProvider();
+
+ /**
+ * Sets the status provider.
+ *
+ * RICS codes should be used in case the status is provided by a railway.
+ *
+ * @param statusProvider the new status provider
+ */
+ public void setStatusProvider(String statusProvider);
+
+ /**
+ * Gets the human readable status description.
+ *
+ * @return the human readable status description.
+ */
+ public String getDescription();
+
+ /**
+ * Sets the human readable status description.
+ *
+ * @param description the new the human readable status description.
+ */
+ public void setDescription(String description) ;
+
+ /**
+ * Gets the status code.
+ *
+ * -- customer status code
+ * -- 1 = basic
+ * -- 2 = premium
+ * -- 3 = silver
+ * -- 4 = gold
+ * -- 5 = platinum
+ * -- 6 = senator
+ * -- > 50 - code table of the status provider
+ *
+ * @return the status code
+ */
+ public int getStatus() ;
+
+ /**
+ * Sets the status.
+ *
+ * -- customer status code
+ * -- 1 = basic
+ * -- 2 = premium
+ * -- 3 = silver
+ * -- 4 = gold
+ * -- 5 = platinum
+ * -- 6 = senator
+ * -- > 50 - code table of the status provider
+ *
+ * @param status the new status
+ */
+ public void setStatus(int status) ;
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IDelayConfirmation.java b/src/org/uic/barcode/ticket/api/spec/IDelayConfirmation.java new file mode 100644 index 0000000..3d55a8b --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IDelayConfirmation.java @@ -0,0 +1,266 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+import java.util.Date;
+
+
+/**
+ * The Interface IDelayConfirmation implements
+ * a confirmation of delay given to a traveler to prove to another carrier he want tu use to continue the journey
+ * that he was delayed.
+ */
+public interface IDelayConfirmation extends IDocumentData {
+
+
+ /**
+ * Gets the reference.
+ *
+ * @return the reference
+ */
+ public String getReference();
+
+ /**
+ * Sets the reference.
+ *
+ * @param reference the new reference
+ */
+ public void setReference(String reference);
+
+ /**
+ * Gets the train.
+ *
+ * @return the train
+ */
+ public String getTrain();
+
+ /**
+ * Sets the train.
+ *
+ * @param train the new train
+ */
+ public void setTrain(String train);
+
+ /**
+ * Gets the station code table.
+ *
+ * Defines the station code table to be used to retrieve station information.
+ * Default in this case is the UIC station codes table for standard UIC
+ * station code from MERITS (UIC country code + 5 digit local code)
+ *
+ * @return the station code table
+ */
+ public IStationCodeTable getStationCodeTable();
+
+ /**
+ * Sets the station code table.
+ *
+ * Defines the station code table to be used to retrieve station information.
+ * Default in this case is the UIC station codes table for standard UIC
+ * station code from MERITS (UIC country code + 5 digit local code)
+ *
+ * @param stationCodeTable the new station code table
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable);
+
+ /**
+ * Gets the from station code where the delay was final (usually the station where the traveler left the train).
+ *
+ * @return the from station code
+ */
+ public String getStation();
+
+ /**
+ * Sets the from station code where the delay was final (usually the station where the traveler left the train).
+ *
+ * @param station the new station
+ */
+ public void setStation(String station);
+
+
+ /**
+ * Sets the from station name where the delay was final (usually the station where the traveler left the train).
+ *
+ * @param fromStationName the new from station name
+ */
+ public void setStationName(String fromStationName);
+
+ /**
+ * Gets the to station name where the delay was final (usually the station where the traveler left the train).
+ *
+ * @return the to station name
+ */
+ public String getStationName();
+
+ /**
+ * Gets the planned arrival date and time where the traveler left the train.
+ *
+ * @return the planned arrival date and time
+ */
+ public Date getArrivalDate();
+
+ /**
+ * Sets the planned arrival date and time where the traveler left the train.
+ *
+ * @param arrivalDate the new planned arrival date and time
+ */
+ public void setArrivalDate(Date arrivalDate);
+
+ /**
+ * Checks if is train was cancelled.
+ *
+ * @return true, if is train cancelled
+ */
+ public boolean isTrainCancelled();
+
+ /**
+ * Sets the train cancelled.
+ *
+ * @param trainIsCancelled the new train cancelled
+ */
+ public void setTrainCancelled(boolean trainIsCancelled);
+
+
+ /**
+ * Gets the delay in minutes.
+ *
+ * @return the delay in minutes
+ */
+ public int getDelay();
+
+ /**
+ * Sets the delay in minutes.
+ *
+ * @param delay the delay in minutes
+ */
+ public void setDelay(int delay);
+
+ /**
+ * Gets the confirmation type.
+ *
+ * See code list of the specification for the meaning of the values.
+ *
+ * @return the confirmation type
+ */
+ public int getConfirmationType();
+
+ /**
+ * Sets the confirmation type.
+ *
+ * See code list of the specification for the meaning of the values.
+ *
+ * @param type the new confirmation type
+ */
+ public void setConfirmationType(int type);
+
+ /**
+ * Sets the confirmation that the traveler was on board of the delayed train.
+ *
+ * @param travelerOnBoardDelayed the confirmation that the traveler was on the delayed train
+ */
+ public void setTravelerOnBoardDelayed(boolean travelerOnBoardDelayed);
+
+ /**
+ * Sets the confirmation that the train was delayed.
+ *
+ * @param trainDelayed the confirmation that the train was delayed
+ */
+ public void setTrainDelayed(boolean trainDelayed);
+
+ /**
+ * Sets the confirmation that the train was delayed and the traveler had a ticket designated to the delayed train.
+ *
+ * @param trainOfTravelerDelayed the confirmation that the train was delayed and the traveler had a ticket designated to the delayed train.
+ */
+ public void setTrainDelayedTravelerHasTrainTicket(boolean trainOfTravelerDelayed);
+
+ /**
+ * Checks if this document confirms that the traveler was on board of the delayed train.
+ *
+ * @return true, if this document confirms that the traveler was on board of the delayed train
+ */
+ public boolean isTravelerOnBoardDelayed();
+
+ /**
+ * Checks if this document confirms that the train is delayed.
+ *
+ * @return true, if is train delay is confirmed
+ */
+ public boolean isTrainDelayed();
+
+ /**
+ * Checks if this document confirms that the train where the traveler had a designated ticket for is delayed.
+ *
+ * @return true, if this document confirms that the traveler has a ticket designated to the delayed train.
+ */
+ public boolean isTrainDelayedTravelerHasTrainTicket();
+
+
+ /**
+ * Gets the linked tickets.
+ *
+ * Link to the ticket valid on the delayed train.
+ *
+ * @return the linked tickets
+ */
+ public Collection<ITicketLink> getLinkedTickets() ;
+
+
+ /**
+ * Adds the linked ticket valid on the delayed train.
+ *
+ *
+ * @param linkedTicket the linked ticket
+ */
+ public void addLinkedTicket(ITicketLink linkedTicket) ;
+
+
+
+
+ /**
+ * Gets the info text.
+ *
+ * @return the info text
+ */
+ public String getInfoText();
+
+ /**
+ * Sets the info text.
+ *
+ * @param infoText the new info text
+ */
+ public void setInfoText(String infoText);
+
+
+ /**
+ * Gets the extension.
+ *
+ * @return the extension
+ */
+ public IExtension getExtension();
+
+ /**
+ * Sets the extension.
+ *
+ * @param extension the new extension
+ */
+ public void setExtension(IExtension extension);
+
+ /**
+ * Gets the arrival ut coffset.
+ *
+ * @return the arrival ut coffset
+ */
+ public Long getArrivalUTCoffset();
+
+ /**
+ * Sets the arrival ut coffset.
+ *
+ * @param arrivalUTCoffset the new arrival ut coffset
+ */
+ public void setArrivalUTCoffset(Long arrivalUTCoffset);
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IDocumentData.java b/src/org/uic/barcode/ticket/api/spec/IDocumentData.java new file mode 100644 index 0000000..6bfe048 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IDocumentData.java @@ -0,0 +1,32 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+/**
+ * The Interface IDocumentData.
+ *
+ * IDocumentData is the super class of transport documents and customer cards. It provides a token.
+ *
+ */
+public interface IDocumentData {
+
+ /**
+ * Gets the token.
+ *
+ * @return the token
+ */
+ public IToken getToken();
+
+ /**
+ * Sets the token.
+ *
+ * @param token the new token
+ */
+ public void setToken(IToken token);
+
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IDocumentExtension.java b/src/org/uic/barcode/ticket/api/spec/IDocumentExtension.java new file mode 100644 index 0000000..4808dde --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IDocumentExtension.java @@ -0,0 +1,14 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+/**
+ * The Interface IDocumentExtension.
+ *
+ * IDocumentExtension provides a transport document that contains purely proprietary extension data.
+ *
+ */
+public interface IDocumentExtension extends IDocumentData, IExtension {
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IExtension.java b/src/org/uic/barcode/ticket/api/spec/IExtension.java new file mode 100644 index 0000000..c774e9e --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IExtension.java @@ -0,0 +1,58 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+
+/**
+ * The Interface IExtension.
+ *
+ * IExtension defines an extension of the data defined in the UIC standard
+ *
+ * If not agreed bilaterally otherwise these extensions must be ignored.
+ *
+ * -- the generic non - standard extension contains:
+ * -- - an extension id to distinguish different extensions
+ * -- - the extension data as binary data
+ * -- proprietary extensions are by definition proprietary. This standard provides
+ * -- the means to identify these extensions
+ * -- within the data and to skip these data.
+ * -- the evaluation of these data and the unique identification of the extensions
+ * -- via the extension id is in the
+ * -- responsibility of the railways which use these extensions.
+ *
+ */
+public interface IExtension {
+
+ /**
+ * Gets the id of the extension.
+ * The id identifies the type of the extension.
+ *
+ * @return the id
+ */
+ public String getId() ;
+
+ /**
+ * Sets the id.
+ * The id identifies the type of the extension.
+ *
+ * @param id the new id
+ */
+ public void setId(String id);
+
+ /**
+ * Gets the binary data content.
+ *
+ * @return the binary data content
+ */
+ public byte[] getBinarydata();
+
+ /**
+ * Sets the binary data content.
+ *
+ * @param binarydata the new binary data content
+ */
+ public void setBinarydata(byte[] binarydata);
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IFipTicket.java b/src/org/uic/barcode/ticket/api/spec/IFipTicket.java new file mode 100644 index 0000000..f67fa57 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IFipTicket.java @@ -0,0 +1,176 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+import java.util.Date;
+
+
+/**
+ * The Interface IFipTicket.
+ *
+ * IFipTicket provides a description of the FIP ticket.
+ *
+ */
+public interface IFipTicket extends IDocumentData {
+
+ /**
+ * Gets the reference.
+ *
+ * @return the reference
+ */
+ public String getReference();
+
+ /**
+ * Sets the reference.
+ *
+ * @param reference the new reference
+ */
+ public void setReference(String reference);
+
+ /**
+ * Gets the product id.
+ *
+ * @return the product id
+ */
+ public String getProductId() ;
+
+ /**
+ * Sets the product id.
+ *
+ * @param productId the new product id
+ */
+ public void setProductId(String productId);
+
+ /**
+ * Gets the product owner.
+ *
+ * @return the product owner
+ */
+ public String getProductOwner();
+
+ /**
+ * Sets the product owner.
+ *
+ * @param productOwner the new product owner
+ */
+ public void setProductOwner(String productOwner);
+
+
+
+ /**
+ * Gets the travel class code.
+ *
+ * @return the travel class code
+ */
+ public ITravelClassType getClassCode();
+
+ /**
+ * Sets the class code.
+ *
+ * @param classCode the new class code
+ */
+ public void setClassCode(ITravelClassType classCode);
+
+ /**
+ * Gets the valid from date.
+ *
+ * @return the valid from date
+ */
+ public Date getValidFrom();
+
+ /**
+ * Sets the valid from date.
+ *
+ * @param validFrom the new valid from date
+ */
+ public void setValidFrom(Date validFrom);
+
+ /**
+ * Gets the valid until date.
+ *
+ * @return the valid until date
+ */
+ public Date getValidUntil();
+
+ /**
+ * Sets the valid until date.
+ *
+ * @param validUntil the new valid until date
+ */
+ public void setValidUntil(Date validUntil);
+
+ /**
+ * Gets the number of travel days allowed for traveling within the validity range.
+ *
+ * @return the number of travel days allowed for traveling within the validity range.
+ */
+ public int getNumberOfTravelDates();
+
+ /**
+ * Sets the number of travel days allowed for traveling within the validity range.
+ *
+ * @param numberOfTravelDates the new number of travel days
+ */
+ public void setNumberOfTravelDates(int numberOfTravelDates);
+
+ /**
+ * Checks if supplements are included.
+ *
+ * @return true, if is supplements are included
+ */
+ public boolean isIncludesSupplements();
+
+ /**
+ * Sets whether supplements are included.
+ *
+ * @param includesSuplements the new includes supplements flag
+ */
+ public void setIncludesSupplements(boolean includesSuplements);
+
+ /**
+ * Gets the carriers valid for traveling.
+ *
+ * @return the carriers valid for traveling
+ */
+ public Collection<String> getCarriers();
+
+ /**
+ * Adds a carrier.
+ *
+ * @param carrier the carrier
+ */
+ public void addCarrier(String carrier);
+
+ /**
+ * Gets the extension.
+ *
+ * @return the extension
+ */
+ public IExtension getExtension();
+
+ /**
+ * Sets the extension.
+ *
+ * @param extensionData the new extension
+ */
+ public void setExtension(IExtension extensionData);
+
+ /**
+ * Gets the activated days where the ticket is valid for tarveling.
+ *
+ * @return the activated days
+ */
+ public Collection<Date> getActivatedDays();
+
+ /**
+ * Adds the activated day.
+ *
+ * @param day the day
+ */
+ public void addActivatedDay(Date day);
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IGenderType.java b/src/org/uic/barcode/ticket/api/spec/IGenderType.java new file mode 100644 index 0000000..bbb8eef --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IGenderType.java @@ -0,0 +1,42 @@ +/*
+ * 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.spec;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum IGenderType {
+ unspecified("unspecified"),
+ female("female"),
+ male("male"),
+ other("other");
+
+
+ public String text;
+
+ IGenderType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/spec/IGeoCoordinate.java b/src/org/uic/barcode/ticket/api/spec/IGeoCoordinate.java new file mode 100644 index 0000000..5526afb --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IGeoCoordinate.java @@ -0,0 +1,133 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+
+
+/**
+ * The Interface IGeoCoordinate.
+ *
+ * IGeoCoordinate provides the data for a geo coordinate.
+ *
+ */
+public interface IGeoCoordinate {
+
+ /**
+ * Gets the unit.
+ *
+ * Default is milliDegree
+ *
+ * @return the unit
+ */
+ public IGeoUnitType getUnit();
+
+ /**
+ * Sets the unit.
+ *
+ * Default is milliDegree
+ *
+ * @param unit the new unit
+ */
+ public void setUnit(IGeoUnitType unit);
+
+ /**
+ * Gets the accuracy.
+ *
+ * @return the accuracy
+ */
+ public IGeoUnitType getAccuracy();
+
+ /**
+ * Sets the accuracy.
+ *
+ * @param accuracy the new accuracy
+ */
+ public void setAccuracy(IGeoUnitType accuracy);
+
+ /**
+ * Gets the geo coordinate system.
+ *
+ * Default is wgs84
+ *
+ * @return the geo coordinate
+ */
+ public IGeoCoordinateSystemType getSystem();
+
+ /**
+ * Sets the geo coordinate
+ *
+ * Default is wgs84
+ *
+ * @param system the new geo coordinate
+ */
+ public void setSystem(IGeoCoordinateSystemType system);
+
+ /**
+ * Gets the longitude hemisphere.
+ *
+ * @return the longitude hemisphere
+ */
+ public IHemisphereLongitudeType getHemisphereLongitude() ;
+
+ /**
+ * Sets the longitude hemisphere.
+ *
+ * Default is north
+ *
+ * @param hemispherLongiture the new longitude hemisphere.
+ */
+ public void setHemisphereLongitude(IHemisphereLongitudeType hemispherLongiture);
+
+ /**
+ * Gets the latitude hemisphere.
+ *
+ * Default is east
+ *
+ * @return the latitude hemisphere.
+ */
+ public IHemisphereLatitudeType getHemisphereLatitude();
+
+ /**
+ * Sets the latitude hemisphere.
+ *
+ * Default is east
+ *
+ * @param hemisphereLatitude the new latitude hemisphere.
+ */
+ public void setHemisphereLatitude(IHemisphereLatitudeType hemisphereLatitude);
+
+ /**
+ * Gets the longitude.
+ *
+ * @return the longitude
+ */
+ public Long getLongitude();
+
+ /**
+ * Sets the longitude.
+ *
+ * @param longitude the new longitude
+ */
+ public void setLongitude(long longitude) ;
+
+ /**
+ * Gets the latitude.
+ *
+ * @return the latitude
+ */
+ public Long getLatitude() ;
+
+ /**
+ * Sets the latitude.
+ *
+ * @param latitude the new latitude
+ */
+ public void setLatitude(long latitude);
+
+ public IGeoCoordinate clone();
+
+ public void addLongitude(Long longValue);
+
+ public void addLatitude(Long longValue);
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IGeoCoordinateSystemType.java b/src/org/uic/barcode/ticket/api/spec/IGeoCoordinateSystemType.java new file mode 100644 index 0000000..d177657 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IGeoCoordinateSystemType.java @@ -0,0 +1,38 @@ +/*
+ * 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.spec;
+
+
+public enum IGeoCoordinateSystemType {
+ wgs84("wgs84"),
+ grs80("grs80");
+
+
+ public String text;
+
+ IGeoCoordinateSystemType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/spec/IGeoUnitType.java b/src/org/uic/barcode/ticket/api/spec/IGeoUnitType.java new file mode 100644 index 0000000..796fad2 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IGeoUnitType.java @@ -0,0 +1,40 @@ +/*
+ * 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.spec;
+
+public enum IGeoUnitType {
+ microDegree("microDegree"),
+ tenthmilliDegree("tenthmilliDegree"),
+ milliDegree("milliDegree"),
+ centiDegree("centiDegree"),
+ deciDegree("deciDegree");
+
+
+ public String text;
+
+ IGeoUnitType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/spec/IHemisphereLatitudeType.java b/src/org/uic/barcode/ticket/api/spec/IHemisphereLatitudeType.java new file mode 100644 index 0000000..37b95b6 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IHemisphereLatitudeType.java @@ -0,0 +1,37 @@ +/*
+ * 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.spec;
+
+public enum IHemisphereLatitudeType {
+ east("east"),
+ west("west");
+
+
+ public String text;
+
+ IHemisphereLatitudeType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/spec/IHemisphereLongitudeType.java b/src/org/uic/barcode/ticket/api/spec/IHemisphereLongitudeType.java new file mode 100644 index 0000000..8344450 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IHemisphereLongitudeType.java @@ -0,0 +1,36 @@ +/*
+ * 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.spec;
+
+public enum IHemisphereLongitudeType {
+ north("north"),
+ south("south");
+
+ public String text;
+
+ IHemisphereLongitudeType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/spec/IIncludedOpenTicket.java b/src/org/uic/barcode/ticket/api/spec/IIncludedOpenTicket.java new file mode 100644 index 0000000..f64d374 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IIncludedOpenTicket.java @@ -0,0 +1,433 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+import java.util.Date;
+
+
+/**
+ * The Interface IIncludedOpenTicket.
+ *
+ * IIncludedOpenTicket provides the description of an add on ticket to be added to an open ticket.
+ * E.g. a local transport ticket at the end or begin of the route.
+ *
+ */
+public interface IIncludedOpenTicket {
+
+ /**
+ * Gets the departure date.
+ *
+ * @return the departure date
+ */
+ public Date getDepartureDate();
+
+ /**
+ * Sets the departure date.
+ *
+ * @param departureDate the new departure date
+ */
+ public void setDepartureDate(Date departureDate);
+
+ /**
+ * Gets the arrival date.
+ *
+ * @return the arrival date
+ */
+ public Date getArrivalDate() ;
+
+ /**
+ * Sets the arrival date.
+ *
+ * @param arrivalDate the new arrival date
+ */
+ public void setArrivalDate(Date arrivalDate);
+
+
+ /**
+ * Gets the product id.
+ *
+ * @return the product id
+ */
+ public String getProductId() ;
+
+ /**
+ * Sets the product id.
+ *
+ * @param productId the new product id
+ */
+ public void setProductId(String productId) ;
+
+ /**
+ * Gets the product owner.
+ *
+ * @return the product owner
+ */
+ public String getProductOwner();
+
+ /**
+ * Sets the product owner.
+ *
+ * @param productOwner the new product owner
+ */
+ public void setProductOwner(String productOwner);
+
+ /**
+ * Gets the external issuer.
+ *
+ * @return the external issuer
+ */
+ public int getExternalIssuer();
+
+ /**
+ * Sets the external issuer.
+ *
+ * Identification of the issuer provided by an external carrier
+ *
+ * @param externalIssuer the new external issuer
+ */
+ public void setExternalIssuer(int externalIssuer);
+
+ /**
+ * Gets the authorization code.
+ *
+ * Authorization code given by a carrier to the product owner to allow the sale
+ *
+ * @return the authorization code
+ */
+ public int getAuthorizationCode();
+
+ /**
+ * Sets the authorization code.
+ *
+ * An authorization code given by a carrier to the product owner to allow the sale
+ *
+ * @param authorizationCode the new authorization code
+ */
+ public void setAuthorizationCode(int authorizationCode);
+
+ /**
+ * Gets the station code table.
+ *
+ * Defines the station code table to be used to retrieve station information.
+ * Default in this case is the UIC station codes table for standard UIC
+ * station code from MERITS (UIC country code + 5 digit local code)
+ *
+ * @return the station code table
+ */
+ public IStationCodeTable getStationCodeTable();
+
+ /**
+ * Sets the station code table.
+ *
+ * Defines the station code table to be used to retrieve station information.
+ * Default in this case is the UIC station codes table for standard UIC
+ * station code from MERITS (UIC country code + 5 digit local code)
+ *
+ * @param stationCodeTable the new station code table
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable);
+
+ /**
+ * Gets the from station code.
+ *
+ * @return the from station code
+ */
+ public String getFromStation();
+
+ /**
+ * Sets the from station code.
+ *
+ * @param fromStation the new from station code
+ */
+ public void setFromStation(String fromStation);
+
+ /**
+ * Gets the to station code.
+ *
+ * @return the to station code
+ */
+ public String getToStation();
+
+ /**
+ * Sets the to station code.
+ *
+ * @param toStation the new to station code
+ */
+ public void setToStation(String toStation);
+
+ /**
+ * Gets the from station name.
+ *
+ * @return the from station name
+ */
+ public String getFromStationName();
+
+ /**
+ * Sets the from station name.
+ *
+ * @param fromStationName the new from station name
+ */
+ public void setFromStationName(String fromStationName);
+
+ /**
+ * Gets the to station name.
+ *
+ * @return the to station name
+ */
+ public String getToStationName();
+
+ /**
+ * Sets the to station name.
+ *
+ * @param toStationName the new to station name
+ */
+ public void setToStationName(String toStationName);
+
+ /**
+ * Gets the valid region description.
+ *
+ * @return the valid region desc
+ */
+ public String getValidRegionDesc();
+
+ /**
+ * Sets the valid region description.
+ *
+ * @param validRegionDesc the new valid region description
+ */
+ public void setValidRegionDesc(String validRegionDesc);
+
+ /**
+ * Gets the list of valid regions.
+ *
+ * @return the list of valid regions
+ */
+ public Collection<IRegionalValidity> getValidRegionList();
+
+ /**
+ * Adds a valid region.
+ *
+ * @param validRegion the valid region
+ */
+ public void addValidRegionList(IRegionalValidity validRegion);
+
+ /**
+ * Gets the valid from date and time.
+ *
+ * @return the valid from date and time.
+ */
+ public Date getValidFrom();
+
+ /**
+ * Sets the valid from date and time.
+ *
+ * @param validFrom the new valid from date and time.
+ */
+ public void setValidFrom(Date validFrom);
+
+ /**
+ * Gets the valid until date and time.
+ *
+ * @return the valid until date and time.
+ */
+ public Date getValidUntil();
+
+ /**
+ * Sets the valid until date and time.
+ *
+ * @param validUntil the new valid until date and time.
+ */
+ public void setValidUntil(Date validUntil);
+
+ /**
+ * Gets the travel class code.
+ *
+ * @return the travel class code
+ */
+ public ITravelClassType getClassCode();
+
+ /**
+ * Sets the travel class code.
+ *
+ * @param classCode the new travel class code
+ */
+ public void setClassCode(ITravelClassType classCode);
+
+ /**
+ * Gets the carriers included in the transport contract.
+ *
+ * @return the included carriers
+ */
+ public Collection<String> getIncludedCarriers();
+
+ /**
+ * Adds the included carrier.
+ *
+ * @param includedCarrier the included carrier
+ */
+ public void addIncludedCarrier(String includedCarrier);
+
+ /**
+ * Gets the included service brands on which the ticket is valid
+ *
+ * The list should be omitted in case all service brands are
+ * included or a list of excluded service brands is provided.
+ *
+ * @return the included service brands
+ */
+ public Collection<Integer> getIncludedServiceBrands();
+
+ /**
+ * Adds an included service brand.
+ *
+ * The list should be omitted in case all service brands are
+ * included or a list of excluded service brands is provided.
+ *
+ * @param includedServiceBrand the included service brand
+ */
+ public void addIncludedServiceBrand(Integer includedServiceBrand);
+
+ /**
+ * Gets the list of excluded service brands.
+ *
+ * The list should be omitted in case a complete
+ * list of included service brands is provided.
+ *
+ * @return the list of excluded service brands
+ */
+ public Collection<Integer> getExcludedServiceBrands();
+
+ /**
+ * Adds an excluded service brand.
+ *
+ * The list should be omitted in case a complete
+ * list of included service brands is provided.
+ *
+ * @param excludedServiceBrand the excluded service brand
+ */
+ public void addExcludedServiceBrand(Integer excludedServiceBrand);
+
+
+ /**
+ * Gets the list of excluded Transport Types.
+ *
+ * The list should be omitted in case a complete
+ * list of included transport types is provided.
+ *
+ * @return the list of excluded transport types
+ */
+ public Collection<Integer> getExcludedTransportTypes();
+
+ /**
+ * Adds an excluded service brand.
+ *
+ * The list should be omitted in case a complete
+ * list of included TransportTypes is provided.
+ *
+ * @param excluded TransportType the excluded TransportTypes
+ */
+ public void addExcludedTransportType(Integer excludedTransportType);
+
+
+ /**
+ * Gets the list of excluded Transport Types.
+ *
+ * The list should be omitted in case a complete
+ * list of included transport types is provided.
+ *
+ * @return the list of included transport types
+ */
+ public Collection<Integer> getIncludedTransportTypes();
+
+ /**
+ * Adds an excluded service brand.
+ *
+ * The list should be omitted in case a complete
+ * list of included TransportTypes is provided.
+ *
+ * @param excluded TransportType the excluded TransportTypes
+ */
+ public void addInludedTransportType(Integer includedTransportType);
+
+ /**
+ * Gets the tariffs.
+ *
+ * @return the tariffs
+ */
+ public Collection<ITariff> getTariffs();
+
+ /**
+ * Adds the tariff.
+ *
+ * @param tariff the tariff
+ */
+ public void addTariff(ITariff tariff);
+
+ /**
+ * Gets the info text.
+ *
+ * @return the info text
+ */
+ public String getInfoText();
+
+ /**
+ * Sets the info text.
+ *
+ * @param infoText the new info text
+ */
+ public void setInfoText(String infoText);
+
+ /**
+ * Gets the extension.
+ *
+ * @return the extension
+ */
+ public IExtension getExtension() ;
+
+ /**
+ * Sets the extension.
+ *
+ * @param extension the new extension
+ */
+ public void setExtension(IExtension extension);
+
+
+ /**
+ * Sets the until date and time.
+ *
+ * @param date the new until date and time
+ */
+ public void setUntilDate(Date date);
+
+
+ /**
+ * Gets the validFrom date time offset to UTC in units of 15 minutes.
+ *
+ * @return the validFrom date time UTC offset
+ */
+ public Long getValidFromUTCoffset();
+
+ /**
+ * Sets the validFrom date time.
+ *
+ * @param validFromDateTime the new validFrom date time
+ */
+ public void setValidFromUTCoffset(Long validFromUTCoffset) ;
+
+ /**
+ * Gets the validUntil date time offset to UTC in units of 15 minutes.
+ *
+ * @return the validUntil date time UTC offset
+ */
+ public Long getValidUntilUTCoffset();
+
+ /**
+ * Sets the validUntil date time.
+ *
+ * @param validUntilDateTime the new validUntil date time
+ */
+ public void setValidUntilUTCoffset(Long validUntilUTCoffset) ;
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IIssuingDetail.java b/src/org/uic/barcode/ticket/api/spec/IIssuingDetail.java new file mode 100644 index 0000000..ecaf9c7 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IIssuingDetail.java @@ -0,0 +1,189 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Date;
+
+
+/**
+ * The Interface IIssuerDetails.
+ */
+public interface IIssuingDetail {
+
+ /**
+ * Gets the issuing date.
+ *
+ * @return the issuing date
+ */
+ public Date getIssuingDate();
+
+ /**
+ * Sets the issuing date.
+ *
+ * @param date the new issuing date
+ */
+ public void setIssuingDate(Date date);
+
+ /**
+ * Gets the issuer.
+ *
+ * @return the issuer
+ */
+ public String getIssuer();
+
+ /**
+ * Sets the issuer.
+ *
+ * @param issuer the new issuer
+ */
+ public void setIssuer(String issuer);
+
+ /**
+ * Gets the security provider.
+ *
+ * @return the security provider
+ */
+ public String getSecurityProvider();
+
+
+ /**
+ * Sets the security provider.
+ *
+ * @param securityProvider the new security provider
+ */
+ public void setSecurityProvider(String securityProvider);
+
+
+ /**
+ * Gets the issuer name.
+ *
+ * @return the issuer name
+ */
+ public String getIssuerName();
+
+
+ /**
+ * Sets the issuer name.
+ *
+ * @param issuerName the new issuer name
+ */
+ public void setIssuerName(String issuerName);
+
+
+ /**
+ * Checks if is specimen.
+ *
+ * @return true, if is specimen
+ */
+ public boolean isSpecimen();
+
+
+ /**
+ * Sets the specimen.
+ *
+ * @param specimen the new specimen
+ */
+ public void setSpecimen(boolean specimen);
+
+
+ /**
+ * Checks if is activated.
+ *
+ * @return true, if is activated
+ */
+ public boolean isActivated();
+
+
+ /**
+ * Sets the activated.
+ *
+ * @param activated the new activated
+ */
+ public void setActivated(boolean activated);
+
+
+ /**
+ * Gets the issuer pnr.
+ *
+ * @return the issuer pnr
+ */
+ public String getIssuerPNR();
+
+
+ /**
+ * Sets the issuer pnr.
+ *
+ * @param issuerPNR the new issuer pnr
+ */
+ public void setIssuerPNR(String issuerPNR);
+
+
+ /**
+ * Gets the extension.
+ *
+ * @return the extension
+ */
+ public IExtension getExtension();
+
+
+ /**
+ * Sets the extension.
+ *
+ * @param extension the new extension
+ */
+ public void setExtension(IExtension extension);
+
+
+ /**
+ * Gets the issued on train.
+ *
+ * @return the issued on train
+ */
+ public String getIssuedOnTrain();
+
+
+ /**
+ * Sets the issued on train.
+ *
+ * @param issuedOnTrain the new issued on train
+ */
+ public void setIssuedOnTrain(String issuedOnTrain);
+
+
+ /**
+ * Gets the issued on line.
+ *
+ * @return the issued on line
+ */
+ public Integer getIssuedOnLine();
+
+
+ /**
+ * Sets the line number or id in case the ticket was issued on a local transport line.
+ *
+ * @param issuedOnLine the new issued on line
+ */
+ public void setIssuedOnLine(Integer issuedOnLine);
+
+
+ /**
+ * Gets the point of sale.
+ *
+ * @return the point of sale
+ */
+ public IGeoCoordinate getPointOfSale();
+
+
+ /**
+ * Sets the point of sale.
+ *
+ * @param pointOfSale the new point of sale
+ */
+ public void setPointOfSale(IGeoCoordinate pointOfSale);
+
+
+ public boolean isSecurePaperTicket();
+ public void setSecurePaperTicket(boolean securePaperTicket);
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/ILine.java b/src/org/uic/barcode/ticket/api/spec/ILine.java new file mode 100644 index 0000000..525ffd7 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ILine.java @@ -0,0 +1,114 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.HashSet;
+
+
+
+/**
+ * The Interface ILine.
+ */
+public interface ILine extends IRegionalValidity{
+
+ /**
+ * Gets the carrier.
+ *
+ * @return the carrier
+ */
+ public String getCarrier();
+
+ /**
+ * Sets the carrier.
+ *
+ * @param carrier the new carrier
+ */
+ public void setCarrier(String carrier);
+
+ /**
+ * Gets the line ids.
+ *
+ * @return the line ids
+ */
+ public HashSet<Integer> getLineIds();
+
+ /**
+ * Adds the line id.
+ *
+ * @param lineId the line id
+ */
+ public void addLineId(Integer lineId);
+
+ /**
+ * Gets the station code table.
+ *
+ * @return the station code table
+ */
+ public IStationCodeTable getStationCodeTable();
+
+ /**
+ * Sets the station code table.
+ *
+ * @param stationCodeTable the new station code table
+ */
+ public void setStationCodeTable( IStationCodeTable stationCodeTable);
+
+ /**
+ * Gets the entry station.
+ *
+ * @return the entry station
+ */
+ public String getEntryStation() ;
+
+ /**
+ * Sets the entry station.
+ *
+ * @param entryStation the new entry station
+ */
+ public void setEntryStation(String entryStation);
+
+ /**
+ * Gets the terminating station.
+ *
+ * @return the terminating station
+ */
+ public String getTerminatingStation();
+
+ /**
+ * Sets the terminating station.
+ *
+ * @param terminatingStation the new terminating station
+ */
+ public void setTerminatingStation(String terminatingStation);
+
+ /**
+ * Gets the city.
+ *
+ * @return the city
+ */
+ public int getCity() ;
+
+ /**
+ * Sets the city.
+ *
+ * @param city the new city
+ */
+ public void setCity(int city);
+
+ /**
+ * Gets the binary zone id.
+ *
+ * @return the binary zone id
+ */
+ public byte[] getBinaryZoneId() ;
+
+ /**
+ * Sets the binary zone id.
+ *
+ * @param binatyZoneId the new binary zone id
+ */
+ public void setBinaryZoneId(byte[] binatyZoneId);
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/ILinkMode.java b/src/org/uic/barcode/ticket/api/spec/ILinkMode.java new file mode 100644 index 0000000..918510d --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ILinkMode.java @@ -0,0 +1,39 @@ +/*
+ * 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.spec;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum ILinkMode {
+ issuedTogether("issuedTogether"),
+ onlyValidInCombination("onlyValidInCombination");
+
+ public String text;
+
+ ILinkMode(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/spec/ILoadingDeckType.java b/src/org/uic/barcode/ticket/api/spec/ILoadingDeckType.java new file mode 100644 index 0000000..52e41a6 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ILoadingDeckType.java @@ -0,0 +1,38 @@ +/*
+ * 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.spec;
+
+
+public enum ILoadingDeckType {
+ unspecified("unspecified"),
+ upper("upper"),
+ lower("lower");
+
+ public String text;
+
+ ILoadingDeckType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/spec/ILuggageRestriction.java b/src/org/uic/barcode/ticket/api/spec/ILuggageRestriction.java new file mode 100644 index 0000000..d915aaa --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ILuggageRestriction.java @@ -0,0 +1,56 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Interface ILuggageRestriction.
+ */
+public interface ILuggageRestriction {
+
+ /**
+ * Gets the max hand luggage pieces.
+ *
+ * @return the max hand luggage pieces
+ */
+ public int getMaxHandLuggagePieces();
+
+ /**
+ * Sets the max hand luggage pieces.
+ *
+ * @param maxHandLuggagePieces the new max hand luggage pieces
+ */
+ public void setMaxHandLuggagePieces(int maxHandLuggagePieces);
+
+ /**
+ * Gets the max non hand luggage pieces.
+ *
+ * @return the max non hand luggage pieces
+ */
+ public int getMaxNonHandLuggagePieces();
+
+ /**
+ * Sets the max non hand luggage pieces.
+ *
+ * @param maxNonHandLuggagePieces the new max non hand luggage pieces
+ */
+ public void setMaxNonHandLuggagePieces(int maxNonHandLuggagePieces);
+
+ /**
+ * Gets the registered luggage.
+ *
+ * @return the registered luggage
+ */
+ public Collection<IRegisteredLuggage> getRegisteredLuggage();
+
+ /**
+ * Adds the registered luggage.
+ *
+ * @param registeredLuggage the registered luggage
+ */
+ public void addRegisteredLuggage(IRegisteredLuggage registeredLuggage);
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IOpenTicket.java b/src/org/uic/barcode/ticket/api/spec/IOpenTicket.java new file mode 100644 index 0000000..174eb92 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IOpenTicket.java @@ -0,0 +1,561 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+import java.util.Date;
+
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Interface IOpenTicket.
+ */
+public interface IOpenTicket extends IDocumentData {
+
+
+ /**
+ * Gets the reference.
+ *
+ * @return the reference
+ */
+ public String getReference();
+
+ /**
+ * Sets the reference.
+ *
+ * @param reference the new reference
+ */
+ public void setReference(String reference);
+
+ /**
+ * Gets the product id.
+ *
+ * @return the product id
+ */
+ public String getProductId();
+
+ /**
+ * Sets the product id.
+ *
+ * @param productId the new product id
+ */
+ public void setProductId(String productId);
+
+ /**
+ * Gets the product owner.
+ *
+ * The product owner is the railways responsible for assembling this ticket. As there is currently no
+ * standard interface for open tickets between an product owner and an issuer this is usually
+ * identical to the issuer of an open ticket.
+ *
+ * @return the product owner
+ */
+ public String getProductOwner();
+
+ /**
+ * Sets the product owner.
+ *
+ * The product owner is the railways responsible for assembling this ticket. As there is currently no
+ * standard interface for open tickets between an product owner and an issuer this is usually
+ * identical to the issuer of an open ticket.
+ *
+ * @param productOwner the new product owner
+ */
+ public void setProductOwner(String productOwner);
+
+ /**
+ * Gets the external issuer.
+ *
+ * @return the external issuer
+ */
+ public int getExternalIssuer();
+
+ /**
+ * Sets the external issuer.
+ *
+ * Identification of the issuer provided by an external carrier
+ *
+ * @param externalIssuer the new external issuer
+ */
+ public void setExternalIssuer(int externalIssuer);
+
+ /**
+ * Gets the authorization code.
+ *
+ * Authorization code given by a carrier to the product owner to allow the sale
+ *
+ * @return the authorization code
+ */
+ public int getAuthorizationCode();
+
+ /**
+ * Sets the authorization code.
+ *
+ * An authorization code given by a carrier to the product owner to allow the sale
+ *
+ * @param authorizationCode the new authorization code
+ */
+ public void setAuthorizationCode(int authorizationCode);
+
+ /**
+ * Checks if the ticket includes the return trip.
+ *
+ * @return true, if the ticket includes the return trip.
+ */
+ public boolean isReturnIncluded();
+
+ /**
+ * Sets that the ticket includes the return trip.
+ *
+ * @param returnIncluded the new return included
+ */
+ public void setReturnIncluded(boolean returnIncluded);
+
+ /**
+ * Gets the station code table.
+ *
+ * Defines the station code table to be used to retrieve station information.
+ * Default in this case is the UIC station codes table for standard UIC
+ * station code from MERITS (UIC country code + 5 digit local code)
+ *
+ * @return the station code table
+ */
+ public IStationCodeTable getStationCodeTable();
+
+ /**
+ * Sets the station code table.
+ *
+ * Defines the station code table to be used to retrieve station information.
+ * Default in this case is the UIC station codes table for standard UIC
+ * station code from MERITS (UIC country code + 5 digit local code)
+ *
+ * @param stationCodeTable the new station code table
+ */
+ public void setStationCodeTable( IStationCodeTable stationCodeTable);
+
+ /**
+ * Gets the from station code.
+ *
+ * @return the from station code
+ */
+ public String getFromStation();
+
+ /**
+ * Sets the from station code.
+ *
+ * @param fromStation the new from station code
+ */
+ public void setFromStation(String fromStation);
+
+ /**
+ * Gets the to station code.
+ *
+ * @return the to station code
+ */
+ public String getToStation();
+
+ /**
+ * Sets the to station code.
+ *
+ * @param toStation the new to station code
+ */
+ public void setToStation(String toStation);
+
+ /**
+ * Gets the from station name.
+ *
+ * @return the from station name
+ */
+ public String getFromStationName();
+
+ /**
+ * Sets the from station name.
+ *
+ * @param fromStationName the new from station name
+ */
+ public void setFromStationName(String fromStationName);
+
+ /**
+ * Gets the to station name.
+ *
+ * @return the to station name
+ */
+ public String getToStationName();
+
+ /**
+ * Sets the to station name.
+ *
+ * @param toStationName the new to station name
+ */
+ public void setToStationName(String toStationName);
+
+ /**
+ * Gets the valid region description.
+ *
+ * @return the valid region desc
+ */
+ public String getValidRegionDesc();
+
+ /**
+ * Sets the human readable description of the valid region.
+ *
+ * @param validRegionDesc the new human readable description of the valid region
+ */
+ public void setValidRegionDesc(String validRegionDesc);
+
+ /**
+ * Gets the list of valid regions.
+ *
+ * @return the list of valid regions
+ */
+ public Collection<IRegionalValidity> getValidRegionList();
+
+ /**
+ * Adds a valid region.
+ *
+ * @param validRegion the valid region
+ */
+ public void addValidRegionList(IRegionalValidity validRegion);
+
+ /**
+ * Gets the return trip description.
+ *
+ * @return the return trip description
+ */
+ public IReturnRouteDescription getReturnDescription() ;
+
+ /**
+ * Sets the return description.
+ *
+ * @param returnDescription the new return description
+ */
+ public void setReturnDescription(IReturnRouteDescription returnDescription);
+
+ /**
+ * Gets the valid from date and time.
+ *
+ * @return the valid from date and time.
+ */
+ public Date getValidFrom() ;
+
+ /**
+ * Sets the valid from date and time.
+ *
+ * @param validFrom the new valid from date and time
+ */
+ public void setValidFrom(Date validFrom);
+
+ /**
+ * Gets the valid until date and time.
+ *
+ * @return the valid until date and time.
+ */
+ public Date getValidUntil();
+
+ /**
+ * Sets the valid until date and time.
+ *
+ * @param validUntil the new valid until date and time.
+ */
+ public void setValidUntil(Date validUntil);
+
+ /**
+ * Gets the activated days.
+ *
+ * A list of days where the ticket is valid. This should be omitted if
+ * the ticket is valid on the entire validity range.
+ *
+ * @return the activated days
+ */
+ public Collection<Date> getActivatedDays();
+
+ /**
+ * Adds the activated day.
+ *
+ * A list of days where the ticket is valid. This should be omitted if
+ * the ticket is valid on the entire validity range.
+ *
+ * @param activatedDay the activated day
+ */
+ public void addActivatedDay(Date activatedDay);
+
+ /**
+ * Gets the travel class code.
+ *
+ * @return the travel class code
+ */
+ public ITravelClassType getClassCode();
+
+ /**
+ * Sets the travel class code.
+ *
+ * @param classCode the new travel class code
+ */
+ public void setClassCode(ITravelClassType classCode);
+
+ /**
+ * Gets the carriers included in the transport contract.
+ *
+ * @return the included carriers
+ */
+ public Collection<String> getIncludedCarriers();
+
+ /**
+ * Adds a carrier to the transport contract.
+ *
+ * @param includedCarrier the carrier
+ */
+ public void addIncludedCarrier(String includedCarrier);
+
+ /**
+ * Gets the included service brands on which the ticket is valid
+ *
+ * The list should be omitted in case all service brands are
+ * included or a list of excluded service brands is provided.
+ *
+ * @return the included service brands
+ */
+ public Collection<Integer> getIncludedServiceBrands();
+
+ /**
+ * Adds an included service brand.
+ *
+ * The list should be omitted in case all service brands are
+ * included or a list of excluded service brands is provided.
+ *
+ * @param includedServiceBrand the included service brand
+ */
+ public void addIncludedServiceBrand(Integer includedServiceBrand);
+
+ /**
+ * Gets the list of excluded service brands.
+ *
+ * The list should be omitted in case a complete
+ * list of included service brands is provided.
+ *
+ * @return the list of excluded service brands
+ */
+ public Collection<Integer> getExcludedServiceBrands();
+
+ /**
+ * Adds an excluded service brand.
+ *
+ * The list should be omitted in case a complete
+ * list of included service brands is provided.
+ *
+ * @param excludedServiceBrand the excluded service brand
+ */
+ public void addExcludedServiceBrand(Integer excludedServiceBrand);
+
+
+
+
+ /**
+ * Gets the list of excluded Transport Types.
+ *
+ * The list should be omitted in case a complete
+ * list of included transport types is provided.
+ *
+ * @return the list of excluded transport types
+ */
+ public Collection<Integer> getExcludedTransportTypes();
+
+ /**
+ * Adds an excluded service brand.
+ *
+ * The list should be omitted in case a complete
+ * list of included TransportTypes is provided.
+ *
+ * @param excluded TransportType the excluded TransportTypes
+ */
+ public void addExcludedTransportType(Integer excludedTransportType);
+
+
+ /**
+ * Gets the list of excluded Transport Types.
+ *
+ * The list should be omitted in case a complete
+ * list of included transport types is provided.
+ *
+ * @return the list of included transport types
+ */
+ public Collection<Integer> getIncludedTransportTypes();
+
+ /**
+ * Adds an excluded service brand.
+ *
+ * The list should be omitted in case a complete
+ * list of included TransportTypes is provided.
+ *
+ * @param excluded TransportType the excluded TransportTypes
+ */
+ public void addInludedTransportType(Integer includedTransportType);
+
+
+ /**
+ * Gets the tariffs.
+ *
+ * @return the tariffs
+ */
+ public Collection<ITariff> getTariffs();
+
+ /**
+ * Adds the tariff.
+ *
+ * @param tariff the tariff
+ */
+ public void addTariff(ITariff tariff);
+
+ /**
+ * Gets the included add on tickets.
+ *
+ * E.g. an included local transport ticket at the beginning or end of the route.
+ *
+ * @return the included add ons
+ */
+ public Collection<IIncludedOpenTicket> getIncludedAddOns();
+
+ /**
+ * Adds an included add on ticket.
+ *
+ * E.g. an included local transport ticket at the beginning or end of the route.
+ *
+ * @param includedAddOn the included add on
+ */
+ public void addIncludedAddOn(IIncludedOpenTicket includedAddOn) ;
+
+ /**
+ * Gets the info text.
+ *
+ * @return the info text
+ */
+ public String getInfoText();
+
+ /**
+ * Sets the info text.
+ *
+ * @param infoText the new info text
+ */
+ public void setInfoText(String infoText);
+
+ /**
+ * Gets the luggage restriction.
+ *
+ * @return the luggage restriction
+ */
+ public ILuggageRestriction getLuggageRestriction();
+
+ /**
+ * Sets the luggage restriction.
+ *
+ * @param luggageRestriction the new luggage restriction
+ */
+ public void setLuggageRestriction(ILuggageRestriction luggageRestriction);
+
+ /**
+ * Gets the extension.
+ *
+ * @return the extension
+ */
+ public IExtension getExtension();
+
+ /**
+ * Sets the extension.
+ *
+ * @param extension the new extension
+ */
+ public void setExtension(IExtension extension);
+
+
+ /**
+ * Sets the service level.
+ *
+ * The service level codes are defined in UIC leaflet 918.1
+ *
+ * @param serviceLevel the new service level
+ */
+ public void setServiceLevel(String serviceLevel);
+
+
+ /**
+ * Gets the service level.
+ *
+ * The service level codes are defined in UIC leaflet 918.1
+ *
+ * @return the service level
+ */
+ public String getServiceLevel();
+
+
+
+ /**
+ * Sets the price.
+ *
+ *
+ * @param price
+ */
+ public void setPrice(Long price);
+
+
+ /**
+ * Gets the price.
+ *
+ * The price
+ *
+ * @return the price
+ */
+ public Long getPrice();
+
+
+ /**
+ * Gets the included add on tickets.
+ *
+ * E.g. an included local transport ticket at the beginning or end of the route.
+ *
+ * @return the included add ons
+ */
+ public Collection<IVatDetail> getVatDetails();
+
+ /**
+ * Adds an included add on ticket.
+ *
+ * E.g. an included local transport ticket at the beginning or end of the route.
+ *
+ * @param includedAddOn the included add on
+ */
+ public void addVatDetail(IVatDetail vatDetail) ;
+
+
+
+
+ /**
+ * Gets the validFrom date time offset to UTC in units of 15 minutes.
+ *
+ * @return the validFrom date time UTC offset
+ */
+ public Long getValidFromUTCoffset();
+
+ /**
+ * Sets the validFrom date time.
+ *
+ * @param validFromDateTime the new validFrom date time
+ */
+ public void setValidFromUTCoffset(Long validFromUTCoffset) ;
+
+ /**
+ * Gets the validUntil date time offset to UTC in units of 15 minutes.
+ *
+ * @return the validUntil date time UTC offset
+ */
+ public Long getValidUntilUTCoffset();
+
+ /**
+ * Sets the validUntil date time.
+ *
+ * @param validUntilDateTime the new validUntil date time
+ */
+ public void setValidUntilUTCoffset(Long validUntilUTCoffset) ;
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IParkingGround.java b/src/org/uic/barcode/ticket/api/spec/IParkingGround.java new file mode 100644 index 0000000..8ef465d --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IParkingGround.java @@ -0,0 +1,252 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+import java.util.Date;
+
+
+
+/**
+ * The Interface IParkingGround.
+ *
+ * IParkingGround provides the data for a prking ground reservation
+ */
+public interface IParkingGround extends IDocumentData {
+
+ /**
+ * Gets the parking ground id.
+ *
+ * @return the parking ground id
+ */
+ public String getParkingGroundId();
+
+ /**
+ * Sets the id of the parking ground
+ *
+ * @param parkingGroundId the new parking ground id
+ */
+ public void setParkingGroundId(String parkingGroundId);
+
+ /**
+ * Gets the from parking date.
+ *
+ * @return the from parking date
+ */
+ public Date getFromParkingDate();
+
+ /**
+ * Sets the from parking date.
+ *
+ * @param parkingDate the new from parking date
+ */
+ public void setFromParkingDate(Date parkingDate);
+
+ /**
+ * Gets the to parking date.
+ *
+ * @return the to parking date
+ */
+ public Date getToParkingDate();
+
+ /**
+ * Sets the to parking date.
+ *
+ * @param parkingDate the new to parking date
+ */
+ public void setToParkingDate(Date parkingDate);
+
+ /**
+ * Gets the reference.
+ *
+ * @return the reference
+ */
+ public String getReference();
+
+ /**
+ * Sets the reference.
+ *
+ * @param reference the new reference
+ */
+ public void setReference(String reference);
+
+ /**
+ * Gets the access code to enter the parking ground.
+ *
+ * @return the access code to enter the parking ground
+ */
+ public String getAccessCode();
+
+ /**
+ * Sets the access code to enter the parking ground.
+ *
+ * @param accessCode the new access code to enter the parking ground
+ */
+ public void setAccessCode(String accessCode);
+
+ /**
+ * Gets the human readable location name of the parking ground.
+ *
+ * @return the human readable location name of the parking ground.
+ */
+ public String getLocation();
+
+ /**
+ * Sets the human readable location name of the parking ground.
+ *
+ * @param location the new human readable location name of the parking ground.
+ */
+ public void setLocation(String location);
+
+ /**
+ * Gets the station code in case the parking ground is associated with a station
+ *
+ * @return the station code in case the parking ground is associated with a station
+ */
+ public String getStation();
+
+ /**
+ * Sets the station code in case the parking ground is associated with a station
+ *
+ * @param station the new station code in case the parking ground is associated with a station
+ */
+ public void setStation(String station);
+
+ /**
+ * Gets the special information.
+ *
+ * @return the special information
+ */
+ public String getSpecialInformation();
+
+ /**
+ * Sets the special information.
+ *
+ * @param specialInformation the new special information
+ */
+ public void setSpecialInformation(String specialInformation);
+
+ /**
+ * Gets the entry track to enter the parking ground.
+ *
+ * @return the entry track to enter the parking ground.
+ */
+ public String getEntryTrack();
+
+ /**
+ * Sets the entry track to enter the parking ground..
+ *
+ * @param entryTrack the new entry track to enter the parking ground.
+ */
+ public void setEntryTrack(String entryTrack);
+
+ /**
+ * Gets the number plate.
+ *
+ * @return the number plate
+ */
+ public String getNumberPlate();
+
+ /**
+ * Sets the number plate.
+ *
+ * @param numberPlate the new number plate
+ */
+ public void setNumberPlate(String numberPlate);
+
+ /**
+ * Gets the extension.
+ *
+ * @return the extension
+ */
+ public IExtension getExtension();
+
+ /**
+ * Sets the extension.
+ *
+ * @param extensionData the new extension
+ */
+ public void setExtension(IExtension extensionData);
+
+ /**
+ * Gets the station code table.
+ *
+ * @return the station code table
+ */
+ public IStationCodeTable getStationCodeTable();
+
+ /**
+ * Sets the station code table.
+ *
+ * @param stationCodeTable the new station code table
+ */
+ public void setStationCodeTable( IStationCodeTable stationCodeTable);
+
+ /**
+ * Gets the product owner.
+ *
+ * @return the product owner
+ */
+ public String getProductOwner();
+
+ /**
+ * Sets the product owner.
+ *
+ * @param productOwner the new product owner
+ */
+ public void setProductOwner(String productOwner);
+
+
+ /**
+ * Gets the product type.
+ *
+ * @return the product type
+ */
+ public String getProductId();
+
+ /**
+ * Sets the product type.
+ *
+ * @param id the new product id
+ */
+ public void setProductId(String type);
+
+ /**
+ * Sets the price.
+ *
+ *
+ * @param price
+ */
+ public void setPrice(Long price);
+
+
+ /**
+ * Gets the price.
+ *
+ * The price
+ *
+ * @return the price
+ */
+ public Long getPrice();
+
+
+ /**
+ * Gets the included add on tickets.
+ *
+ * E.g. an included local transport ticket at the beginning or end of the route.
+ *
+ * @return the included add ons
+ */
+ public Collection<IVatDetail> getVatDetails();
+
+ /**
+ * Adds an included add on ticket.
+ *
+ * E.g. an included local transport ticket at the beginning or end of the route.
+ *
+ * @param includedAddOn the included add on
+ */
+ public void addVatDetail(IVatDetail vatDetail) ;
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IPass.java b/src/org/uic/barcode/ticket/api/spec/IPass.java new file mode 100644 index 0000000..5968b03 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IPass.java @@ -0,0 +1,412 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+import java.util.Date;
+
+/**
+ * The Interface IPass.
+ *
+ * IPass provides the data for a rail pass ticket.
+ *
+ */
+public interface IPass extends IDocumentData {
+
+ /**
+ * Gets the reference.
+ *
+ * @return the reference
+ */
+ public String getReference();
+
+ /**
+ * Sets the reference.
+ *
+ * @param reference the new reference
+ */
+ public void setReference(String reference);
+
+ /**
+ * Gets the product id.
+ *
+ * @return the product id
+ */
+ public String getProductId();
+
+ /**
+ * Sets the product id.
+ *
+ * @param productId the new product id
+ */
+ public void setProductId(String productId);
+
+ /**
+ * Gets the product owner.
+ *
+ * Company that provides the product.
+ * E.g. The RICS code of Eurail G.E.I. for Eurail passes.
+ *
+ * @return the product owner
+ */
+ public String getProductOwner();
+
+ /**
+ * Sets the product owner.
+ *
+ * Company that provides the product.
+ * E.g. The RICS code of Eurail G.E.I. for Eurail passes.
+ *
+ * @param productOwner the new product owner
+ */
+ public void setProductOwner(String productOwner);
+
+ /**
+ * Gets the pass type.
+ *
+ * @return the pass type
+ */
+ public int getPassType();
+
+ /**
+ * Sets the pass type.
+ *
+ * -- type of the pass, code list provided by the product owner
+ *
+ * @param passType the new pass type
+ */
+ public void setPassType(int passType);
+
+ /**
+ * Gets the human readable pass description.
+ *
+ * @return the human readable pass description.
+ */
+ public String getPassDescription();
+
+ /**
+ * Sets the human readable pass description.
+ *
+ * @param passDescription the new human readable pass description.
+ */
+ public void setPassDescription(String passDescription);
+
+ /**
+ * Gets the class code.
+ *
+ * @return the class code
+ */
+ public ITravelClassType getClassCode();
+
+ /**
+ * Sets the travel class code.
+ *
+ * @param classCode the new travel class code
+ */
+ public void setClassCode(ITravelClassType classCode);
+
+ /**
+ * Gets the valid from date and time.
+ *
+ * @return the valid from date and time
+ */
+ public Date getValidFrom();
+
+ /**
+ * Sets the valid from date and time.
+ *
+ * @param validFrom the new valid from date and time
+ */
+ public void setValidFrom(Date validFrom);
+
+ /**
+ * Gets the valid until date and time.
+ *
+ * @return the valid until date and time
+ */
+ public Date getValidUntil();
+
+ /**
+ * Sets the valid until date and time.
+ *
+ * @param validUntil the new valid until date and time
+ */
+ public void setValidUntil(Date validUntil);
+
+ /**
+ * Gets the number of validity days in case this is less than the entire validity range and the valid from day is open.
+ *
+ * @return the number of validity days in case this is less than the entire validity range.
+ */
+ public int getNumberOfValidityDays();
+
+ /**
+ * Sets the number of validity days in case this is less than the entire validity range and the valid from day is open.
+ *
+ * @param numberOfValidityDays the new number of validity days in case this is less than the entire validity range.
+ */
+ public void setNumberOfValidityDays(int numberOfValidityDays);
+
+ /**
+ * Gets the number of possible trips.
+ *
+ * @return the number of possible trips
+ */
+ public int getNumberOfPossibleTrips();
+
+ /**
+ * Sets the number of possible trips.
+ *
+ * @param numberOfPossibleTrips the new number of possible trips
+ */
+ public void setNumberOfPossibleTrips(int numberOfPossibleTrips);
+
+ /**
+ * Gets the number of days of travel in case this is less than the entire validity range.
+ *
+ * @return the number of days of travel in case this is less than the entire validity range
+ */
+ public int getNumberOfDaysOfTravel();
+
+ /**
+ * Sets the number of days of travel in case this is less than the entire validity range.
+ *
+ * @param numberOfDaysOfTravel the new number of days of travel in case this is less than the entire validity range
+ */
+ public void setNumberOfDaysOfTravel(int numberOfDaysOfTravel) ;
+
+ /**
+ * Gets the activated days valid for traveling.
+ *
+ * @return the activated days valid for traveling
+ */
+ public Collection<Date> getActivatedDays() ;
+
+ /**
+ * Adds an activated day valid for traveling.
+ *
+ * @param activatedDay the activated day valid for traveling
+ */
+ public void addActivatedDay(Date activatedDay);
+
+ /**
+ * Gets the countries where the pass is valid.
+ *
+ * Code list according to the codes in UIC leaflet 918.2
+ *
+ * @return the countries
+ */
+ public Collection<Integer> getCountries();
+
+ /**
+ * Adds a country.
+ *
+ * Code list according to the codes in UIC leaflet 918.2
+ *
+ * @param country the country
+ */
+ public void addCountry(Integer country);
+
+ /**
+ * Gets the included carriers.
+ *
+ * @return the included carriers
+ */
+ public Collection<String> getIncludedCarriers();
+
+ /**
+ * Adds the included carrier.
+ *
+ * @param carrier the carrier
+ */
+ public void addIncludedCarrier(String carrier);
+
+ /**
+ * Gets the excluded carriers.
+ *
+ * @return the excluded carriers
+ */
+ public Collection<String> getExcludedCarriers();
+
+ /**
+ * Adds the excluded carrier.
+ *
+ * @param carrier the carrier
+ */
+ public void addExcludedCarrier(String carrier);
+
+ /**
+ * Gets the included service brands.
+ *
+ * @return the included service brands
+ */
+ public Collection<Integer> getIncludedServiceBrands();
+
+ /**
+ * Adds the included service brand.
+ *
+ * @param includedServiceBrand the included service brand
+ */
+ public void addIncludedServiceBrand(Integer includedServiceBrand);
+
+ /**
+ * Gets the excluded service brands.
+ *
+ * @return the excluded service brands
+ */
+ public Collection<Integer> getExcludedServiceBrands();
+
+ /**
+ * Adds the excluded service brand.
+ *
+ * @param excludedServiceBrand the excluded service brand
+ */
+ public void addExcludedServiceBrand(Integer excludedServiceBrand);
+
+ /**
+ * Gets the list of valid regions.
+ *
+ * @return the valid region list
+ */
+ public Collection<IRegionalValidity> getValidRegionList();
+
+ /**
+ * Adds a valid region.
+ *
+ * @param validRegion the valid region to be added
+ */
+ public void addValidRegion(IRegionalValidity validRegion);
+
+ /**
+ * Gets the tariffs.
+ *
+ * @return the tariffs
+ */
+ public Collection<ITariff> getTariffs();
+
+ /**
+ * Adds the tariff.
+ *
+ * @param tariff the tariff
+ */
+ public void addTariff(ITariff tariff);
+
+ /**
+ * Gets the info text.
+ *
+ * @return the info text
+ */
+ public String getInfoText();
+
+ /**
+ * Sets the info text.
+ *
+ * @param infoText the new info text
+ */
+ public void setInfoText(String infoText);
+
+ /**
+ * Gets the extension.
+ *
+ * @return the extension
+ */
+ public IExtension getExtension();
+
+ /**
+ * Sets the extension.
+ *
+ * @param extension the new extension
+ */
+ public void setExtension(IExtension extension);
+
+
+ /**
+ * Sets the validity details containing additional validity ranges and excluded time ranges.
+ *
+ * @param validityDetails the new validity details
+ */
+ public void setValidityDetails(IValidityDetails validityDetails);
+
+
+ /**
+ * Gets the validity details containing additional validity ranges and excluded time ranges.
+ *
+ * @return the validity details
+ */
+ public IValidityDetails getValidityDetails();
+
+ /**
+ * Sets the price.
+ *
+ *
+ * @param price
+ */
+ public void setPrice(Long price);
+
+
+ /**
+ * Gets the price.
+ *
+ * The price
+ *
+ * @return the price
+ */
+ public Long getPrice();
+
+
+ /**
+ * Gets the included add on tickets.
+ *
+ * E.g. an included local transport ticket at the beginning or end of the route.
+ *
+ * @return the included add ons
+ */
+ public Collection<IVatDetail> getVatDetails();
+
+ /**
+ * Adds an included add on ticket.
+ *
+ * E.g. an included local transport ticket at the beginning or end of the route.
+ *
+ * @param includedAddOn the included add on
+ */
+ public void addVatDetail(IVatDetail vatDetail) ;
+
+ /**
+ * Sets the until date and time.
+ *
+ * @param date the new until date and time
+ */
+ public void setUntilDate(Date date);
+
+
+ /**
+ * Gets the validFrom date time offset to UTC in units of 15 minutes.
+ *
+ * @return the validFrom date time UTC offset
+ */
+ public Long getValidFromUTCoffset();
+
+ /**
+ * Sets the validFrom date time.
+ *
+ * @param validFromDateTime the new validFrom date time
+ */
+ public void setValidFromUTCoffset(Long validFromUTCoffset) ;
+
+ /**
+ * Gets the validUntil date time offset to UTC in units of 15 minutes.
+ *
+ * @return the validUntil date time UTC offset
+ */
+ public Long getValidUntilUTCoffset();
+
+ /**
+ * Sets the validUntil date time.
+ *
+ * @param validUntilDateTime the new validUntil date time
+ */
+ public void setValidUntilUTCoffset(Long validUntilUTCoffset) ;
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IPassengerType.java b/src/org/uic/barcode/ticket/api/spec/IPassengerType.java new file mode 100644 index 0000000..1ef7ba0 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IPassengerType.java @@ -0,0 +1,46 @@ +/*
+ * 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.spec;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum IPassengerType {
+ adult("adult"),
+ senior("senior"),
+ child("child"),
+ youth("youth"),
+ dog("dog"),
+ bicycle("bicycle"),
+ freeAddonPassenger("freeAddonPassenger"),
+ freeAddonChild("freeAddonChild");
+
+ public String text;
+
+ IPassengerType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+
+}
+
diff --git a/src/org/uic/barcode/ticket/api/spec/IPlaces.java b/src/org/uic/barcode/ticket/api/spec/IPlaces.java new file mode 100644 index 0000000..3a468d5 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IPlaces.java @@ -0,0 +1,80 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+
+/**
+ * The Interface IPlaces.
+ *
+ * IPlaces provides data on reserved places
+ */
+public interface IPlaces {
+
+ /**
+ * Gets the coach.
+ *
+ * @return the coach
+ */
+ public String getCoach() ;
+
+ /**
+ * Sets the coach.
+ *
+ * @param coach the new coach
+ */
+ public void setCoach(String coach) ;
+
+ /**
+ * Gets the human readable place string.
+ * E.g.: "15-18, 21, 22"
+ *
+ * @return the place string
+ */
+ public String getPlaceString() ;
+
+ /**
+ * Sets the the human readable place string.
+ * E.g.: "15-18, 21, 22"
+ *
+ * This elements should be avoided if not explicitly required for a special product.
+ *
+ * @param placeString the new place string
+ */
+ public void setPlaceString(String placeString);
+
+ /**
+ * Gets the human readable place description.
+ * E.g. "2 Window, open space"
+ *
+ * This elements should be avoided if not explicitly required for a special product.
+ *
+ * @return the human readable place description
+ */
+ public String getPlaceDescription();
+
+ /**
+ * Sets the human readable place description.
+ * E.g. "2 Window, open space"
+ *
+ * @param placeDescription the new place description
+ */
+ public void setPlaceDescription(String placeDescription);
+
+ /**
+ * Gets the places.
+ *
+ * @return the places
+ */
+ public Collection<String> getPlaces();
+
+ /**
+ * Adds the place.
+ *
+ * @param place the place
+ */
+ public void addPlace(String place);
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IPolygone.java b/src/org/uic/barcode/ticket/api/spec/IPolygone.java new file mode 100644 index 0000000..41f9d9c --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IPolygone.java @@ -0,0 +1,32 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+
+/**
+ * The Interface IPolygone.
+ *
+ *
+ * IPolygone provides a description of a region valid for traveling by a polygon of geo-coordinates.
+ *
+ */
+public interface IPolygone extends IRegionalValidity {
+
+ /**
+ * Gets the edges of the polygon.
+ *
+ * @return the edges
+ */
+ public Collection<IGeoCoordinate> getEdges();
+
+ /**
+ * Adds an edge to the polygon.
+ *
+ * @param edge the geo-coordinate of the edge
+ */
+ public void addEdge(IGeoCoordinate edge);
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IPriceTypeType.java b/src/org/uic/barcode/ticket/api/spec/IPriceTypeType.java new file mode 100644 index 0000000..13b4c77 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IPriceTypeType.java @@ -0,0 +1,39 @@ +/*
+ * 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.spec;
+
+public enum IPriceTypeType {
+ noPrice("noPrice"),
+ reservationFee("reservationFee"),
+ supplement("supplement"),
+ travelPrice("travelPrice");
+
+
+ public String text;
+
+ IPriceTypeType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/spec/IRegionalValidity.java b/src/org/uic/barcode/ticket/api/spec/IRegionalValidity.java new file mode 100644 index 0000000..a188775 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IRegionalValidity.java @@ -0,0 +1,15 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+/**
+ * The Interface IRegionalValidity.
+ *
+ * IRegionalValidity indicates a description of a region valid for travelling
+ *
+ */
+public interface IRegionalValidity {
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IRegisteredLuggage.java b/src/org/uic/barcode/ticket/api/spec/IRegisteredLuggage.java new file mode 100644 index 0000000..00d0d24 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IRegisteredLuggage.java @@ -0,0 +1,56 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+/**
+ * The Interface IRegisteredLuggage.
+ *
+ * IRegisteredLuggage provides a description for a piece of luggage registered for traveling and
+ * thus exceeding the general restrictions for luggage transport.
+ *
+ */
+public interface IRegisteredLuggage {
+
+ /**
+ * Gets the registration id.
+ *
+ * @return the registration id
+ */
+ public String getRegistrationId();
+
+ /**
+ * Sets the registration id.
+ *
+ * @param registrationId the new registration id
+ */
+ public void setRegistrationId(String registrationId);
+
+ /**
+ * Gets the max weight of the luggage piece in kg.
+ *
+ * @return the max weight
+ */
+ public int getMaxWeight();
+
+ /**
+ * Sets the max weight of the luggage piece in kg.
+ *
+ * @param maxWeight the new max weight
+ */
+ public void setMaxWeight(int maxWeight);
+
+ /**
+ * Gets the max size as sum of length with and height in cm
+ *
+ * @return the max size
+ */
+ public int getMaxSize() ;
+
+ /**
+ * Sets the max size as sum of length with and height in cm.
+ *
+ * @param maxSize the new max size
+ */
+ public void setMaxSize(int maxSize);
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IReservation.java b/src/org/uic/barcode/ticket/api/spec/IReservation.java new file mode 100644 index 0000000..0dba3bb --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IReservation.java @@ -0,0 +1,517 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+import java.util.Date;
+
+
+/**
+ * The Interface IReservation.
+ *
+ * IReservation describes a reservation, either a reservation only or an integrated reservation ticket
+ */
+public interface IReservation extends IDocumentData {
+
+ /**
+ * Gets the train.
+ *
+ * @return the train
+ */
+ public String getTrain();
+
+ /**
+ * Sets the train.
+ *
+ * @param train the new train
+ */
+ public void setTrain(String train);
+
+ /**
+ * Gets the departure date and time.
+ *
+ * @return the departure date and time
+ */
+ public Date getDepartureDate();
+
+ /**
+ * Sets the departure date and time.
+ *
+ * @param departureDate the new departure date and time
+ */
+ public void setDepartureDate(Date departureDate);
+
+ /**
+ * Gets the arrival date and time.
+ *
+ * @return the arrival date and time
+ */
+ public Date getArrivalDate();
+
+ /**
+ * Sets the arrival date and time.
+ *
+ * @param arrivalDate the new arrival date and time
+ */
+ public void setArrivalDate(Date arrivalDate);
+
+ /**
+ * Gets the booking reference.
+ *
+ * The booking reference must contain the booking reference exchanged via
+ * booking interface according to UIC leaflet 918.1 in case this interface was used.
+ *
+ * @return the booking reference
+ */
+ public String getReference();
+
+ /**
+ * Sets the reference.
+ *
+ * The booking reference must contain the booking reference exchanged via
+ * booking interface according to UIC leaflet 918.1 in case this interface was used.
+ *
+ * @param reference the new reference
+ */
+ public void setReference(String reference);
+
+ /**
+ * Gets the product id.
+ *
+ * @return the product id
+ */
+ public String getProductId();
+
+ /**
+ * Sets the product id.
+ *
+ * @param productId the new product id
+ */
+ public void setProductId(String productId);
+
+ /**
+ * Gets the product owner.
+ *
+ * The company that defined the product. This is the allocating railway in case of car carriage reservations.
+ *
+ * @return the product owner
+ */
+ public String getProductOwner() ;
+
+ /**
+ * Sets the product owner.
+ *
+ * The company that defined the product. This is the allocating railway in case of car carriage reservations.
+ *
+ * @param productOwner the new product owner
+ */
+ public void setProductOwner(String productOwner);
+
+ /**
+ * Gets the service brand of the train.
+ *
+ * Service brand code list provided by UIC
+ *
+ * @return the service brand of the train
+ */
+ public IServiceBrand getServiceBrand();
+
+ /**
+ * Sets the service brand of the train
+ *
+ * Service brand code list provided by UIC
+ *
+ * @param serviceBrand the new service brand of the train
+ */
+ public void setServiceBrand(IServiceBrand serviceBrand);
+
+ /**
+ * Gets the service.
+ *
+ * @return the service
+ */
+ public IServiceType getService();
+
+ /**
+ * Sets the service.
+ *
+ * Services according to UIC leaflet 918.1
+ *
+ * @param service the new service
+ */
+ public void setService(IServiceType service);
+
+
+ /**
+ * Gets the station code table.
+ *
+ * @return the station code table
+ */
+ public IStationCodeTable getStationCodeTable();
+
+ /**
+ * Gets the station code table.
+ *
+ * Defines the station code table to be used to retrieve station information.
+ * Default in case of reservations is the UIC station codes table for reservations
+ *
+ * @return the station code table
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable);
+
+ /**
+ * Gets the from station code.
+ *
+ * @return the from station code
+ */
+ public String getFromStation();
+
+ /**
+ * Sets the from station code.
+ *
+ * @param fromStation the new from station code
+ */
+ public void setFromStation(String fromStation);
+
+ /**
+ * Gets the to station code.
+ *
+ * @return the to station code
+ */
+ public String getToStation();
+
+ /**
+ * Sets the to station code.
+ *
+ * @param toStation the new to station code
+ */
+ public void setToStation(String toStation);
+
+ /**
+ * Gets the from station name.
+ *
+ * @return the from station name
+ */
+ public String getFromStationName();
+
+ /**
+ * Sets the from station name.
+ *
+ * @param fromStationName the new from station name
+ */
+ public void setFromStationName(String fromStationName);
+
+ /**
+ * Gets the to station name.
+ *
+ * @return the to station name
+ */
+ public String getToStationName();
+
+ /**
+ * Sets the to station name.
+ *
+ * @param toStationName the new to station name
+ */
+ public void setToStationName(String toStationName);
+
+ /**
+ * Gets the carriers responsible for the transport.
+ *
+ * @return the carriers
+ */
+ public Collection<String> getCarriers();
+
+ /**
+ * Adds a carrier responsible for the transport.
+ *
+ * @param carrier the carrier
+ */
+ public void addCarrier(String carrier);
+
+ /**
+ * Gets the travel class code.
+ *
+ * @return the travel class code
+ */
+ public ITravelClassType getClassCode();
+
+ /**
+ * Sets the travel class code.
+ *
+ * @param classCode the new travel class code
+ */
+ public void setClassCode(ITravelClassType classCode);
+
+ /**
+ * Gets the service level.
+ *
+ * Service level codes as defined in UIC leaflet 918.1
+ *
+ * @return the service level
+ */
+ public String getServiceLevel();
+
+ /**
+ * Sets the service level.
+ *
+ * Service level codes as defined in UIC leaflet 918.1
+ *
+ * @param serviceLevel the new service level
+ */
+ public void setServiceLevel(String serviceLevel);
+
+ /**
+ * Gets the places.
+ *
+ * @return the places
+ */
+ public IPlaces getPlaces();
+
+ /**
+ * Sets the places.
+ *
+ * @param places the new places
+ */
+ public void setPlaces(IPlaces places);
+
+
+ /**
+ * Gets the additional places in a second coach.
+ *
+ * @return the additional places in a second coach.
+ */
+ public IPlaces getAdditionalPlaces();
+
+ /**
+ * Sets the additional places.
+ *
+ * @param places the new places
+ */
+ public void setAdditionalPlaces(IPlaces places);
+
+ /**
+ * Gets the bicycle places.
+ *
+ * @return the bicycle places
+ */
+ public IPlaces getBicyclePlaces();
+
+ /**
+ * Sets the bicycle places.
+ *
+ * @param bicyclePlaces the new bicycle places
+ */
+ public void setBicyclePlaces(IPlaces bicyclePlaces);
+
+ /**
+ * Gets the compartment details.
+ *
+ * @return the compartment details
+ */
+ public ICompartmentDetails getCompartmentDetails();
+
+ /**
+ * Sets the compartment details.
+ *
+ * @param compartmentDetails the new compartment details
+ */
+ public void setCompartmentDetails(ICompartmentDetails compartmentDetails);
+
+ /**
+ * Gets the number of overbooked travelers.
+ *
+ * @return the number of overbooked travelers
+ */
+ public int getNumberOfOverbooked();
+
+ /**
+ * Sets the number of overbooked travelers.
+ *
+ * @param numberOfOverbooked the new number of overbooked travelers
+ */
+ public void setNumberOfOverbooked(int numberOfOverbooked);
+
+ /**
+ * Gets the berths.
+ *
+ * @return the berths
+ */
+ public Collection<IBerth> getBerths();
+
+ /**
+ * Adds the berth.
+ *
+ * @param berth the berth
+ */
+ public void addBerth(IBerth berth);
+
+ /**
+ * Gets the tariffs.
+ *
+ * @return the tariffs
+ */
+ public Collection<ITariff> getTariffs();
+
+ /**
+ * Adds the tariff.
+ *
+ * @param tariff the tariff
+ */
+ public void addTariff(ITariff tariff);
+
+ /**
+ * Gets the price type.
+ *
+ * @return the price type
+ */
+ public IPriceTypeType getPriceType();
+
+ /**
+ * Sets the price type.
+ *
+ * @param priceType the new price type
+ */
+ public void setPriceType(IPriceTypeType priceType) ;
+
+ /**
+ * Gets the type of supplement.
+ *
+ * Codes according to UIC leaflet 918.1
+ *
+ * @return the type of supplement
+ */
+ public int getTypeOfSupplement() ;
+
+ /**
+ * Sets the type of supplement.
+ *
+ * Codes according to UIC leaflet 918.1
+ *
+ * @param typeOfSupplement the new type of supplement
+ */
+ public void setTypeOfSupplement(int typeOfSupplement);
+
+ /**
+ * Gets the number of supplements.
+ *
+ * @return the number of supplements
+ */
+ public int getNumberOfSupplements();
+
+ /**
+ * Sets the number of supplements.
+ *
+ * @param numberOfSupplements the new number of supplements
+ */
+ public void setNumberOfSupplements(int numberOfSupplements);
+
+
+ /**
+ * Gets the info text.
+ *
+ * @return the info text
+ */
+ public String getInfoText();
+
+ /**
+ * Sets the info text.
+ *
+ * @param infoText the new info text
+ */
+ public void setInfoText(String infoText) ;
+
+ /**
+ * Gets the luggage restriction.
+ *
+ * @return the luggage restriction
+ */
+ public ILuggageRestriction getLuggageRestriction();
+
+ /**
+ * Sets the luggage restriction.
+ *
+ * @param luggageRestriction the new luggage restriction
+ */
+ public void setLuggageRestriction(ILuggageRestriction luggageRestriction);
+
+ /**
+ * Gets the extension.
+ *
+ * @return the extension
+ */
+ public IExtension getExtension();
+
+ /**
+ * Sets the extension.
+ *
+ * @param extension the new extension
+ */
+ public void setExtension(IExtension extension);
+
+ /**
+ * Sets the price.
+ *
+ *
+ * @param price
+ */
+ public void setPrice(Long price);
+
+
+ /**
+ * Gets the price.
+ *
+ * The price
+ *
+ * @return the price
+ */
+ public Long getPrice();
+
+
+ /**
+ * Gets the included add on tickets.
+ *
+ * E.g. an included local transport ticket at the beginning or end of the route.
+ *
+ * @return the included add ons
+ */
+ public Collection<IVatDetail> getVatDetails();
+
+ /**
+ * Adds an included add on ticket.
+ *
+ * E.g. an included local transport ticket at the beginning or end of the route.
+ *
+ * @param includedAddOn the included add on
+ */
+ public void addVatDetail(IVatDetail vatDetail) ;
+
+ /**
+ * Gets the departure date time offset to UTC in units of 15 minutes.
+ *
+ * @return the departure date time UTC offset
+ */
+ public Long getDepartureUTCoffset();
+
+ /**
+ * Sets the departure date time.
+ *
+ * @param departureDateTime the new departure date time
+ */
+ public void setDepartureUTCoffset(Long departureUTCoffset) ;
+
+ /**
+ * Gets the arrival date time offset to UTC in units of 15 minutes.
+ *
+ * @return the arrival date time UTC offset
+ */
+ public Long getArrivalUTCoffset();
+
+ /**
+ * Sets the arrival date time.
+ *
+ * @param arrivalDateTime the new arrival date time
+ */
+ public void setArrivalUTCoffset(Long arrivalUTCoffset) ;
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IReturnRouteDescription.java b/src/org/uic/barcode/ticket/api/spec/IReturnRouteDescription.java new file mode 100644 index 0000000..b24a9dd --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IReturnRouteDescription.java @@ -0,0 +1,100 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+
+/**
+ * The Interface IReturnRouteDescription.
+ *
+ * IReturnRouteDescription provides the description of a return route for an open
+ * ticket. The data elements for the route description are repeated.
+ */
+public interface IReturnRouteDescription {
+
+ /**
+ * Gets the from station code.
+ *
+ * @return the from station code
+ */
+ public String getFromStation() ;
+
+ /**
+ * Sets the from station code.
+ *
+ * @param fromStation the new from station code
+ */
+ public void setFromStation(String fromStation);
+
+ /**
+ * Gets the to station code.
+ *
+ * @return the to station code
+ */
+ public String getToStation();
+
+ /**
+ * Sets the to station code.
+ *
+ * @param toStation the new to station code
+ */
+ public void setToStation(String toStation) ;
+
+ /**
+ * Gets the from station name.
+ *
+ * @return the from station name
+ */
+ public String getFromStationName() ;
+
+ /**
+ * Sets the from station name.
+ *
+ * @param fromStationName the new from station name
+ */
+ public void setFromStationName(String fromStationName);
+
+ /**
+ * Gets the to station name.
+ *
+ * @return the to station name
+ */
+ public String getToStationName();
+
+ /**
+ * Sets the to station name.
+ *
+ * @param toStationName the new to station name
+ */
+ public void setToStationName(String toStationName);
+
+ /**
+ * Gets the valid region description.
+ *
+ * @return the valid region desc
+ */
+ public String getValidRegionDesc();
+
+ /**
+ * Sets the valid region description.
+ *
+ * @param validRegionDesc the new valid region description
+ */
+ public void setValidRegionDesc(String validRegionDesc);
+
+ /**
+ * Gets the list of valid regions.
+ *
+ * @return the valid region list
+ */
+ public Collection<IRegionalValidity> getValidRegionList() ;
+
+ /**
+ * Adds the valid region list.
+ *
+ * @param validRegion the valid region
+ */
+ public void addValidRegionList(IRegionalValidity validRegion);
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IRoofRackType.java b/src/org/uic/barcode/ticket/api/spec/IRoofRackType.java new file mode 100644 index 0000000..223dc22 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IRoofRackType.java @@ -0,0 +1,46 @@ +/*
+ * 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.spec;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum IRoofRackType {
+ norack("norack"),
+ roofRailing("roofRailing"),
+ luggageRack("luggageRack"),
+ skiRack("skiRack"),
+ boxRack("boxRack"),
+ rackWithOneBox("rackWithOneBox"),
+ rackWithTwoBoxes("rackWithTwoBoxes"),
+ bicycleRack("bicycleRack"),
+ otherRack("otherRack");
+
+ public String text;
+
+ IRoofRackType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/spec/IRouteSection.java b/src/org/uic/barcode/ticket/api/spec/IRouteSection.java new file mode 100644 index 0000000..134ef5e --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IRouteSection.java @@ -0,0 +1,83 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+
+/**
+ * The Interface IRouteSection.
+ *
+ * IRouteSection describes a section of a route by the beginn and end station.
+ */
+public interface IRouteSection {
+
+ /**
+ * Gets the station code table.
+ *
+ * @return the station code table
+ */
+ public IStationCodeTable getStationCodeTable();
+
+ /**
+ * Sets the station code table.
+ *
+ * @param stationCodeTable the new station code table
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable);
+
+ /**
+ * Gets the from station code.
+ *
+ * @return the from station code
+ */
+ public String getFromStation();
+
+ /**
+ * Sets the from station code.
+ *
+ * @param fromStation the new from station code
+ */
+ public void setFromStation(String fromStation) ;
+
+ /**
+ * Gets the to station code.
+ *
+ * @return the to station code
+ */
+ public String getToStation();
+
+ /**
+ * Sets the to station code.
+ *
+ * @param toStation the new to station code
+ */
+ public void setToStation(String toStation);
+
+ /**
+ * Gets the from station name.
+ *
+ * @return the from station name
+ */
+ public String getFromStationName();
+
+ /**
+ * Sets the from station name.
+ *
+ * @param fromStationName the new from station name
+ */
+ public void setFromStationName(String fromStationName);
+
+ /**
+ * Gets the to station name.
+ *
+ * @return the to station name
+ */
+ public String getToStationName();
+
+ /**
+ * Sets the to station name.
+ *
+ * @param toStationName the new to station name
+ */
+ public void setToStationName(String toStationName);
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/ISeriesDataDetails.java b/src/org/uic/barcode/ticket/api/spec/ISeriesDataDetails.java new file mode 100644 index 0000000..af7623b --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ISeriesDataDetails.java @@ -0,0 +1,66 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+/**
+ * The Interface ISeriesDataDetails.
+ *
+ * ISeriesDataDetails describes details of a series (according to UIC leaflet 108.1
+ *
+ * Series details should be omitted if not explicitely required for a specific product.
+ *
+ *
+ */
+public interface ISeriesDataDetails {
+
+
+
+ /**
+ * Gets the supplying carrier of the series data.
+ *
+ * @return the supplying carrier of the series data
+ */
+ public int getSupplyingCarrier() ;
+
+
+ /**
+ * Sets the supplying carrier of the series data.
+ *
+ * @param supplyingCarrier the new supplying carrier of the series data
+ */
+ public void setSupplyingCarrier(int supplyingCarrier);
+
+
+ /**
+ * Gets the offer identification of the series data.
+ *
+ * @return the offer identification of the series data
+ */
+ public int getOfferIdentification();
+
+
+ /**
+ * Sets the offer identification of the series data.
+ *
+ * @param offerIdentification the new offer identification of the series data
+ */
+ public void setOfferIdentification(int offerIdentification) ;
+
+
+ /**
+ * Gets the series id.
+ *
+ * @return the series id
+ */
+ public int getSeries();
+
+
+ /**
+ * Sets the series id.
+ *
+ * @param series the new series id
+ */
+ public void setSeries(int series) ;
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IServiceBrand.java b/src/org/uic/barcode/ticket/api/spec/IServiceBrand.java new file mode 100644 index 0000000..38923b6 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IServiceBrand.java @@ -0,0 +1,55 @@ +package org.uic.barcode.ticket.api.spec;
+
+
+public interface IServiceBrand {
+
+ /**
+ * Gets the service brand of the train.
+ *
+ * Service brand code list provided by UIC
+ *
+ * @return the service brand of the train
+ */
+ public int getServiceBrand();
+
+ /**
+ * Sets the service brand of the train
+ *
+ * Service brand code list provided by UIC
+ *
+ * @param serviceBrand the new service brand of the train
+ */
+ public void setServiceBrand(int serviceBrand);
+
+
+ /**
+ * Gets the service brand description.
+ *
+ * Services according to UIC leaflet 918.1
+ *
+ * @return the service brand description
+ */
+ public String getServiceBrandDescription();
+
+ /**
+ * Sets the service brand description.
+ *
+ * @param serviceBrandDescription the new service brand description
+ */
+ public void setServiceBrandDescription(String serviceBrandDescription);
+
+ /**
+ * Gets the service brand abbreviation.
+ *
+ * @return the service brand abbreviation
+ */
+ public String getServiceBrandAbbreviation();
+
+ /**
+ * Sets the service brand abbreviation.
+ *
+ * @param serviceBrandAbbreviation the new service brand abbreviation
+ */
+ public void setServiceBrandAbbreviation(String serviceBrandAbbreviation);
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IServiceType.java b/src/org/uic/barcode/ticket/api/spec/IServiceType.java new file mode 100644 index 0000000..173d0ab --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IServiceType.java @@ -0,0 +1,38 @@ +/*
+ * 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.spec;
+
+public enum IServiceType {
+ seat("seat"),
+ couchette("couchette"),
+ berth("berth"),
+ carcarriage("carcarriage");
+
+ public String text;
+
+ IServiceType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/spec/IStationCodeTable.java b/src/org/uic/barcode/ticket/api/spec/IStationCodeTable.java new file mode 100644 index 0000000..9e27fd0 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IStationCodeTable.java @@ -0,0 +1,25 @@ +package org.uic.barcode.ticket.api.spec;
+
+ public enum IStationCodeTable {
+
+ stationUIC("stationUIC"),
+ stationUICReservation("stationUICReservation"),
+ stationERA("stationERA"),
+ localCarrierStationCodeTable("localCarrierStationCodeTable"),
+ proprietaryIssuerStationCodeTable("proprietaryIssuerStationCodeTable");
+
+ public String text;
+
+ IStationCodeTable(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+
+
+ }
+
+
+
diff --git a/src/org/uic/barcode/ticket/api/spec/IStationPassage.java b/src/org/uic/barcode/ticket/api/spec/IStationPassage.java new file mode 100644 index 0000000..e5acc18 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IStationPassage.java @@ -0,0 +1,239 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+import java.util.Date;
+
+
+/**
+ * The Interface IStationPassage.
+ *
+ * IStationPassage describes a ticket to enter or pass a station or platform.
+ *
+ */
+public interface IStationPassage extends IDocumentData {
+
+ /**
+ * Gets the reference.
+ *
+ * @return the reference
+ */
+ public String getReference();
+
+ /**
+ * Sets the reference.
+ *
+ * @param reference the new reference
+ */
+ public void setReference(String reference);
+
+ /**
+ * Gets the product type.
+ *
+ * @return the product type
+ */
+ public String getProductId();
+
+ /**
+ * Sets the product type.
+ *
+ * @param type the new product id
+ */
+ public void setProductId(String type);
+
+ /**
+ * Gets the product owner.
+ *
+ * @return the product owner
+ */
+ public String getProductOwner();
+
+ /**
+ * Sets the product owner.
+ *
+ * @param productOwner the new product owner
+ */
+ public void setProductOwner(String productOwner);
+
+ /**
+ * Gets the valid from date and time.
+ *
+ * @return the valid from date and time
+ */
+ public Date getValidFrom();
+
+ /**
+ * Sets the valid from date and time.
+ *
+ * @param validFrom the new valid from date and time
+ */
+ public void setValidFrom(Date validFrom);
+
+ /**
+ * Gets the valid until date and time.
+ *
+ * @return the valid until date and time
+ */
+ public Date getValidUntil() ;
+
+ /**
+ * Sets the valid until date and time.
+ *
+ * @param validUntil the new valid until date and time
+ */
+ public void setValidUntil(Date validUntil);
+
+ /**
+ * Gets the station code table.
+ *
+ * @return the station code table
+ */
+ public IStationCodeTable getStationCodeTable();
+
+ /**
+ * Sets the station code table.
+ *
+ * @param stationCodeTable the new station code table
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable);
+
+ /**
+ * Gets the list of station codes of all stations where the passage is allowed.
+ *
+ * @return the stations list
+ */
+ public Collection<String> getStations();
+
+ /**
+ * Adds a station where the passage is allowed.
+ *
+ * @param station the station code
+ */
+ public void addStation(String station);
+
+ /**
+ * Adds a station name of a station where the passage is allowed.
+ *
+ * @param name the name
+ */
+ public void addStationName(String name);
+
+ /**
+ * Gets the station names of all stations where the passage is allowed.
+ *
+ * @return the station names
+ */
+ public Collection<String> getStationNames();
+
+ /**
+ * Gets the number of days allowed the passage is allowed in case the number is smaller that the validity range.
+ *
+ * @return the number of passage days allowed
+ */
+ public int getNumberOfdaysAllowed();
+
+ /**
+ * Sets the number of days allowed the passage is allowed in case the number is smaller that the validity range.
+ *
+ * @param numberOfdaysAllowed the new number of allowed days
+ */
+ public void setNumberOfdaysAllowed(int numberOfdaysAllowed);
+
+
+ /**
+ * Gets the product name.
+ *
+ * @return the product name
+ */
+ public String getProductName();
+
+ /**
+ * Sets the product name.
+ *
+ * @param name the new product name
+ */
+ public void setProductName(String name);
+
+
+ /**
+ * Gets the extension.
+ *
+ * @return the extension
+ */
+ public IExtension getExtension();
+
+ /**
+ * Sets the extension.
+ *
+ * @param extensionData the new extension
+ */
+ public void setExtension(IExtension extensionData);
+
+
+ /**
+ * Gets the area codes of areas in a station where the access is allowed.
+ *
+ * @return the area codes of areas in a station where the access is allowed
+ */
+ public Collection<String> getAreaCodes();
+
+ /**
+ * Gets the area names of areas in a station where the access is allowed.
+ *
+ * @return the area names of areas in a station where the access is allowed
+ */
+ public Collection<String> getAreaNames();
+
+ /**
+ * Adds an area code of an area in a station where the access is allowed.
+ *
+ * @param code the area code of an area in a station where the access is allowed.
+ */
+ public void addAreaCode(String code);
+
+ /**
+ * Adds an area name of an area in a station where the access is allowed.
+ *
+ * @param name the name of an area in a station where the access is allowed
+ */
+ public void addAreaName(String name);
+
+ /**
+ * Sets the until date and time.
+ *
+ * @param date the new until date and time
+ */
+ public void setUntilDate(Date date);
+
+
+ /**
+ * Gets the validFrom date time offset to UTC in units of 15 minutes.
+ *
+ * @return the validFrom date time UTC offset
+ */
+ public Long getValidFromUTCoffset();
+
+ /**
+ * Sets the validFrom date time.
+ *
+ * @param validFromDateTime the new validFrom date time
+ */
+ public void setValidFromUTCoffset(Long validFromUTCoffset) ;
+
+ /**
+ * Gets the validUntil date time offset to UTC in units of 15 minutes.
+ *
+ * @return the validUntil date time UTC offset
+ */
+ public Long getValidUntilUTCoffset();
+
+ /**
+ * Sets the validUntil date time.
+ *
+ * @param validUntilDateTime the new validUntil date time
+ */
+ public void setValidUntilUTCoffset(Long validUntilUTCoffset) ;
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/ITariff.java b/src/org/uic/barcode/ticket/api/spec/ITariff.java new file mode 100644 index 0000000..6561430 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ITariff.java @@ -0,0 +1,204 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+
+/**
+ * The Interface ITariff.
+ *
+ * ITariff describes the tariff of an open ticket, reservation or or IRT
+ *
+ *
+ */
+public interface ITariff {
+
+ /**
+ * Gets the number of passengers associated with that tariff.
+ *
+ * @return the number of passengers associated with that tariff
+ */
+ public int getNumberOfPassengers();
+
+
+ /**
+ * Sets the number of passengers associated with that tariff.
+ *
+ * @param numberOfPassengers the new number of passengers associated with that tariff
+ */
+ public void setNumberOfPassengers(int numberOfPassengers);
+
+
+ /**
+ * Gets the passenger type.
+ *
+ * @return the passenger type
+ */
+ public IPassengerType getPassengerType();
+
+
+ /**
+ * Sets the passenger type.
+ *
+ * @param passengerType the new passenger type
+ */
+ public void setPassengerType(IPassengerType passengerType);
+
+ /**
+ * Gets the upper limit of the age of the passenger to qualify for that tariff.
+ *
+ * @return the upper age limit
+ */
+ public int getAgeBelow();
+
+ /**
+ * Sets the upper limit of the age of the passenger to qualify for that tariff.
+ *
+ * @param ageBelow the new upper limit of the age of the passenger to qualify for that tariff
+ */
+ public void setAgeBelow(int ageBelow);
+
+
+ /**
+ * Gets the lower limit of the age of the passenger to qualify for that tariff.
+ *
+ * @return the lower limit of the age of the passenger to qualify for that tariff
+ */
+ public int getAgeAbove();
+
+
+ /**
+ * Sets the lower limit of the age of the passenger to qualify for that tariff.
+ *
+ * @param ageAbove the new lower limit of the age of the passenger to qualify for that tariff
+ */
+ public void setAgeAbove(int ageAbove);
+
+
+ /**
+ * Gets the traveler ids.
+ *
+ * This provides a link to the travelers listed in the data in case the travelers have to be named (e.g. Eurail passes)
+ * -- the number indicates the position in the traveler list starting from 1
+ *
+ * @return the traveler ids
+ */
+ public Collection<Integer> getTravelerIds() ;
+
+
+ /**
+ * Adds the traveler id.
+ *
+ * This provides a link to the travelers listed in the data in case the travelers have to be named (e.g. Eurail passes)
+ * -- the number indicates the position in the traveler list starting from 1
+ *
+ * @param travelerId the traveler id
+ */
+ public void addTravelerId(Integer travelerId);
+
+ /**
+ * Checks if this tariff is restricted to the country of residence given in the traveler data.
+ *
+ * @return true, if is restricted to country of residence
+ */
+ public boolean isRestrictedToCountryOfResidence();
+
+
+
+ /**
+ * Sets if this tariff is restricted to the country of residence given in the traveler data.
+ *
+ * @param restrictedToCountryOfResidence the new restricted to country of residence
+ */
+ public void setRestrictedToCountryOfResidence(boolean restrictedToCountryOfResidence);
+
+
+ /**
+ * Gets the restricted to route section.
+ *
+ * This limits the tariff to a route section.
+ * This could be used in case the age restrictions vary along the route.
+ *
+ * @return the restricted to route section
+ */
+ public IRouteSection getRestrictedToRouteSection();
+
+
+ /**
+ * Sets the restricted to route section.
+ *
+ * This limits the tariff to a route section.
+ * This could be used in case the age restrictions vary along the route.
+ *
+ * @param restrictedToRouteSection the new restricted to route section
+ */
+ public void setRestrictedToRouteSection(IRouteSection restrictedToRouteSection);
+
+
+ /**
+ * Sets the series data details.
+ *
+ * Add series details in case the tariff is based on data from UIC leaflet 108.1.
+ *
+ * @param seriesDataDetails the new series data details
+ */
+ public void setSeriesDataDetails(ISeriesDataDetails seriesDataDetails);
+
+
+ /**
+ * Gets the series data details.
+ *
+ * Add series details in case the tariff is based on data from UIC leaflet 108.1.
+ *
+ * @return the series data details
+ */
+ public ISeriesDataDetails getSeriesDataDetails();
+
+ /**
+ * Gets the tariff code.
+ *
+ * @return the tariff code
+ */
+ public String getTariffId() ;
+
+
+ /**
+ * Sets the tariff code.
+ *
+ * @param tariffId the new tariff code
+ */
+ public void setTariffId(String tariffId);
+
+
+ /**
+ * Gets the human readable tariff description.
+ *
+ * @return the human readable tariff description
+ */
+ public String getTariffDescription();
+
+
+ /**
+ * Sets the human readable tariff description.
+ *
+ * @param tariffDescription the new human readable tariff description
+ */
+ public void setTariffDescription(String tariffDescription);
+
+ /**
+ * Gets the list of reduction cards required to qualify for that tariff.
+ *
+ *
+ * @return the reduction cards required to qualify for that tariff
+ */
+ public Collection<ICardReference> getReductionCards();
+
+
+ /**
+ * Adds a reduction card required to qualify for that tariff.
+ *
+ * @param reductionCard the reduction card
+ */
+ public void addReductionCard(ICardReference reductionCard);
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/ITicketLink.java b/src/org/uic/barcode/ticket/api/spec/ITicketLink.java new file mode 100644 index 0000000..87e418e --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ITicketLink.java @@ -0,0 +1,97 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+
+/**
+ * The Interface ITicketLink.
+ *
+ * ITicketLink provides data to reference an external separate ticket
+ */
+public interface ITicketLink {
+
+ /**
+ * Gets the reference.
+ *
+ * @return the reference
+ */
+ public String getReference() ;
+
+ /**
+ * Sets the reference.
+ *
+ * @param reference the new reference
+ */
+ public void setReference(String reference);
+
+ /**
+ * Gets the issuer.
+ *
+ * @return the issuer
+ */
+ public String getIssuer();
+
+ /**
+ * Sets the issuer.
+ *
+ * @param issuer the new issuer
+ */
+ public void setIssuer(String issuer) ;
+
+ /**
+ * Gets the product owner.
+ *
+ * @return the product owner
+ */
+ public String getProductOwner();
+
+ /**
+ * Sets the product owner.
+ *
+ * @param productOwner the new product owner
+ */
+ public void setProductOwner(String productOwner);
+
+ /**
+ * Gets the ticket type.
+ *
+ * @return the ticket type
+ */
+ public ITicketType getTicketType();
+
+ /**
+ * Sets the ticket type.
+ *
+ * @param ticketType the new ticket type
+ */
+ public void setTicketType(ITicketType ticketType);
+
+ /**
+ * Gets the link mode.
+ *
+ * @return the link mode
+ */
+ public ILinkMode getLinkMode();
+
+ /**
+ * Sets the link mode.
+ *
+ * @param linkMode the new link mode
+ */
+ public void setLinkMode(ILinkMode linkMode);
+
+ /**
+ * Gets the issuer PNR.
+ *
+ * @return the issuer PNR
+ */
+ public String getIssuerPNR() ;
+
+ /**
+ * Sets the issuer PNR.
+ *
+ * @param train the new train
+ */
+ public void setIssuerPNR(String issuerPNR);
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/ITicketType.java b/src/org/uic/barcode/ticket/api/spec/ITicketType.java new file mode 100644 index 0000000..269c9a4 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ITicketType.java @@ -0,0 +1,41 @@ +/*
+ * 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.spec;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum ITicketType {
+ openTicket("openTicket"),
+ pass("pass"),
+ reservation("reservation"),
+ carCarriageReservation("carCarriageReservation");
+
+ public String text;
+
+ ITicketType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/spec/ITimeRange.java b/src/org/uic/barcode/ticket/api/spec/ITimeRange.java new file mode 100644 index 0000000..5602330 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ITimeRange.java @@ -0,0 +1,72 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+
+
+/**
+ * The Interface ITimeRange.
+ *
+ * ITimeRange defines a range of times. The times are encoded as Minutes of the day (0 = 0:00 , 1440 = 24:00)
+ */
+public interface ITimeRange {
+
+ /**
+ * Gets the from time.
+ *
+ * @return the from time
+ */
+ public int getFromTime();
+
+ /**
+ * Gets the until time.
+ *
+ * @return the until time
+ */
+ public int getUntilTime();
+
+ /**
+ * Sets the from time.
+ *
+ * @param minutes the new from time
+ */
+ public void setFromTime(int minutes);
+
+ /**
+ * Sets the until time.
+ *
+ * @param minutes the new until time
+ */
+ public void setUntilTime(int minutes);
+
+
+ /**
+ * Gets the validFrom date time offset to UTC in units of 15 minutes.
+ *
+ * @return the validFrom date time UTC offset
+ */
+ public Long getValidFromUTCoffset();
+
+ /**
+ * Sets the validFrom date time.
+ *
+ * @param validFromDateTime the new validFrom date time
+ */
+ public void setValidFromUTCoffset(Long validFromUTCoffset) ;
+
+ /**
+ * Gets the validUntil date time offset to UTC in units of 15 minutes.
+ *
+ * @return the validUntil date time UTC offset
+ */
+ public Long getValidUntilUTCoffset();
+
+ /**
+ * Sets the validUntil date time.
+ *
+ * @param validUntilDateTime the new validUntil date time
+ */
+ public void setValidUntilUTCoffset(Long validUntilUTCoffset) ;
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IToken.java b/src/org/uic/barcode/ticket/api/spec/IToken.java new file mode 100644 index 0000000..96b1bf7 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IToken.java @@ -0,0 +1,52 @@ +package org.uic.barcode.ticket.api.spec;
+
+
+/**
+ * The Interface IToken.
+ *
+ * IToken specifies a unique token
+ */
+public interface IToken {
+
+ /**
+ * Gets the token provider.
+ *
+ * @return the token provider
+ */
+ public String getTokenProvider();
+
+ /**
+ * Gets the token specification.
+ *
+ * @return the token specification
+ */
+ public String getTokenSpecification();
+
+ /**
+ * Gets the token.
+ *
+ * @return the token
+ */
+ public byte[] getToken();
+
+ /**
+ * Sets the token provider.
+ *
+ * @param provider the new token provider
+ */
+ public void setTokenProvider(String provider);
+
+ /**
+ * Sets the token specification.
+ *
+ * @param specification the new token specification
+ */
+ public void setTokenSpecification(String specification);
+
+ /**
+ * Sets the token.
+ *
+ * @param token the new token
+ */
+ public void setToken(byte[] token);
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/ITrainLink.java b/src/org/uic/barcode/ticket/api/spec/ITrainLink.java new file mode 100644 index 0000000..79fd963 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ITrainLink.java @@ -0,0 +1,122 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Date;
+
+/**
+ * The Interface ITrainLink.
+ *
+ * ITrainLink specifies the mandatory use of a train within the route of an open ticket or counter mark.
+ */
+public interface ITrainLink extends IRegionalValidity {
+
+ /**
+ * Gets the train.
+ *
+ * @return the train
+ */
+ public String getTrain() ;
+
+ /**
+ * Sets the train.
+ *
+ * @param train the new train
+ */
+ public void setTrain(String train);
+
+ /**
+ * Gets the departure date time.
+ *
+ * @return the departure date time
+ */
+ public Date getDepartureDateTime();
+
+ /**
+ * Sets the departure date time.
+ *
+ * @param departureDateTime the new departure date time
+ */
+ public void setDepartureDateTime(Date departureDateTime) ;
+
+
+ /**
+ * Gets the departure date time offset to UTC in units of 15 minutes.
+ *
+ * @return the departure date time UTC offset
+ */
+ public Long getDepartureUTCoffset();
+
+ /**
+ * Sets the departure date time.
+ *
+ * @param departureDateTime the new departure date time
+ */
+ public void setDepartureUTCoffset(Long departureUTCoffset) ;
+
+
+
+
+ /**
+ * Gets the from station code.
+ *
+ * @return the from station code
+ */
+ public String getFromStation();
+
+ /**
+ * Sets the from station code.
+ *
+ * @param fromStation the new from station code
+ */
+ public void setFromStation(String fromStation);
+
+ /**
+ * Gets the to station code.
+ *
+ * @return the to station code
+ */
+ public String getToStation();
+
+ /**
+ * Sets the to station code.
+ *
+ * @param toStation the new to station code
+ */
+ public void setToStation(String toStation);
+
+ /**
+ * Gets the from station name.
+ *
+ * @return the from station name
+ */
+ public String getFromStationName() ;
+
+ /**
+ * Sets the from station name.
+ *
+ * @param fromStationName the new from station name
+ */
+ public void setFromStationName(String fromStationName);
+
+ /**
+ * Gets the to station name.
+ *
+ * @return the to station name
+ */
+ public String getToStationName();
+
+ /**
+ * Sets the to station name.
+ *
+ * @param toStationName the new to station name
+ */
+ public void setToStationName(String toStationName);
+
+
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/ITravelClassType.java b/src/org/uic/barcode/ticket/api/spec/ITravelClassType.java new file mode 100644 index 0000000..c064d42 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ITravelClassType.java @@ -0,0 +1,49 @@ +/*
+ * 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.spec;
+
+import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
+
+@HasExtensionMarker
+public enum ITravelClassType {
+ notApplicabel("notApplicabel"),
+ first("first"),
+ second("second"),
+ tourist("tourist"),
+ comfort("comfort"),
+ premium("premium"),
+ business("business"),
+ all("all"),
+ premiumFirst("A"),
+ standardFirst("B"),
+ premiumSecond("C"),
+ standardSecond("D");
+
+ public String text;
+
+ ITravelClassType(String text) {
+ this.text = text;
+ }
+
+ public String toString(){
+ return text;
+ }
+}
+
diff --git a/src/org/uic/barcode/ticket/api/spec/ITraveler.java b/src/org/uic/barcode/ticket/api/spec/ITraveler.java new file mode 100644 index 0000000..7734bc4 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ITraveler.java @@ -0,0 +1,250 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+import java.util.Date;
+
+
+/**
+ * The Interface ITravelerData.
+ *
+ * ITravelerData specifies the details of a traveler.
+ *
+ */
+public interface ITraveler {
+
+ /**
+ * Gets the first name.
+ *
+ * @return the first name
+ */
+ public String getFirstName();
+
+ /**
+ * Sets the first name.
+ *
+ * @param firstName the new first name
+ */
+ public void setFirstName(String firstName);
+
+ /**
+ * Gets the second name.
+ *
+ * @return the second name
+ */
+ public String getSecondName() ;
+
+ /**
+ * Sets the second name.
+ *
+ * @param secondName the new second name
+ */
+ public void setSecondName(String secondName);
+
+ /**
+ * Gets the last name.
+ *
+ * @return the last name
+ */
+ public String getLastName();
+
+ /**
+ * Sets the last name.
+ *
+ * @param lastName the new last name
+ */
+ public void setLastName(String lastName);
+
+ /**
+ * Gets the id card.
+ *
+ * @return the id card
+ */
+ public String getIdCard();
+
+ /**
+ * Sets the id card.
+ *
+ * @param idCard the new id card
+ */
+ public void setIdCard(String idCard) ;
+
+ /**
+ * Gets the passport id.
+ *
+ * @return the passport id
+ */
+ public String getPassportId() ;
+
+ /**
+ * Sets the passport id.
+ *
+ * @param passportId the new passport id
+ */
+ public void setPassportId(String passportId);
+
+ /**
+ * Gets the title.
+ *
+ * @return the title
+ */
+ public String getTitle();
+
+ /**
+ * Sets the title.
+ *
+ * @param title the new title
+ */
+ public void setTitle(String title);
+
+ /**
+ * Gets the gender.
+ *
+ * @return the gender
+ */
+ public IGenderType getGender();
+
+ /**
+ * Sets the gender.
+ *
+ * @param gender the new gender
+ */
+ public void setGender(IGenderType gender);
+
+ /**
+ * Gets the customer id.
+ *
+ * @return the customer id
+ */
+ public String getCustomerId();
+
+ /**
+ * Sets the customer id.
+ *
+ * @param customerId the new customer id
+ */
+ public void setCustomerId(String customerId);
+
+ /**
+ * Gets the date of birth.
+ *
+ * @return the date of birth
+ */
+ public Date getDateOfBirth();
+
+ /**
+ * Sets the date of birth.
+ *
+ * @param dateOfBirth the new date of birth
+ */
+ public void setDateOfBirth(Date dateOfBirth);
+
+ /**
+ * Checks if is ticket holder.
+ *
+ * @return true, if is ticket holder
+ */
+ public boolean isTicketHolder();
+
+ /**
+ * Sets the ticket holder.
+ *
+ * @param ticketHolder the new ticket holder
+ */
+ public void setTicketHolder(boolean ticketHolder);
+
+ /**
+ * Gets the passenger type.
+ *
+ * @return the passenger type
+ */
+ public IPassengerType getPassengerType();
+
+ /**
+ * Sets the passenger type.
+ *
+ * @param passengerType the new passenger type
+ */
+ public void setPassengerType(IPassengerType passengerType);
+
+ /**
+ * Checks if is passenger with reduced mobility.
+ *
+ * @return true, if is passenger with reduced mobility
+ */
+ public Boolean isPassengerWithReducedMobility();
+
+ /**
+ * Sets the passenger with reduced mobility.
+ *
+ * @param passengerWithReducedMobility the new passenger with reduced mobility
+ */
+ public void setPassengerWithReducedMobility(Boolean passengerWithReducedMobility);
+
+ /**
+ * Gets the country of residence (numeric ISO country code) .
+ *
+ * @return the country of residence (numeric ISO country code)
+ */
+ public int getCountryOfResidence();
+
+ /**
+ * Sets the country of residence (numeric ISO country code) .
+ *
+ * @param countryOfResidence the new country of residence (numeric ISO country code)
+ */
+ public void setCountryOfResidence(int countryOfResidence);
+
+
+
+ /**
+ * Gets the passport country (numeric ISO country code) .
+ *
+ * @return the passport country (numeric ISO country code)
+ */
+ public int getPassportCountry();
+
+
+ /**
+ * Sets the passport country (numeric ISO country code) .
+ *
+ * @param passportCountry the new passport country (numeric ISO country code)
+ */
+ public void setPassportCountry(int passportCountry);
+
+
+ /**
+ * Gets the ID card country (numeric ISO country code) .
+ *
+ * @return the ID card country (numeric ISO country code)
+ */
+ public int getIDCardCountry();
+
+
+ /**
+ * Sets the ID card country (numeric ISO country code) .
+ *
+ * @param idcardCountry the new ID card country (numeric ISO country code)
+ */
+ public void setIDCardCountry(int idcardCountry);
+
+ /**
+ * Gets the status collection.
+ *
+ * @return the status collection
+ */
+ public Collection<ICustomerStatusDescription> getStatusCollection();
+
+ /**
+ * Adds the status description.
+ *
+ * @param statusDescription the status description
+ */
+ public void addStatusDescription(ICustomerStatusDescription statusDescription) ;
+
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/ITravelerDetail.java b/src/org/uic/barcode/ticket/api/spec/ITravelerDetail.java new file mode 100644 index 0000000..af9278c --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/ITravelerDetail.java @@ -0,0 +1,61 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+
+import java.util.Set;
+
+/**
+ * The Interface ITravelerDetail.
+ *
+ * ITravelerDetail provides a list of traveler data.
+ */
+public interface ITravelerDetail {
+
+ /**
+ * Gets the group name.
+ *
+ * @return the group name
+ */
+ public String getGroupName() ;
+
+ /**
+ * Sets the group name.
+ *
+ * @param groupName the new group name
+ */
+ public void setGroupName(String groupName) ;
+
+ /**
+ * Adds the traveler.
+ *
+ * @param traveler the traveler
+ */
+ public void addTraveler (ITraveler traveler) ;
+
+ /**
+ * Gets the travelers.
+ *
+ * @return the travelers
+ */
+ public Set<ITraveler> getTravelers() ;
+
+ /**
+ * Gets the preferred language.
+ * ISO 639-1 coding of the language preferred for the traveler / ticket holder
+ *
+ * @return the preferred language
+ */
+ public String getPreferredLanguage();
+
+ /**
+ * Sets the preferred language.
+ * ISO 639-1 coding of the language preferred for the traveler / ticket holder
+ *
+ * @param language the new preferred language
+ */
+ public void setPreferredLanguage(String language);
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IUicRailTicket.java b/src/org/uic/barcode/ticket/api/spec/IUicRailTicket.java new file mode 100644 index 0000000..a361a26 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IUicRailTicket.java @@ -0,0 +1,184 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+
+
+/**
+ * The Interface IUicRailTicket.
+ *
+ * This class provides the top level of the data for a document to be encoded
+ * according to the:
+ * UIC standard for ticket control data in asn.1 / PER unaligned encoding.
+ * version 1.0
+ *
+ * The data contains:
+ * -- -issuer informations
+ * -- -the details of the transport document
+ * -- -informations required for the control process
+ * -- -informations on the travelers independent from the transport document
+ * -- -proprietary extensions
+ *
+ */
+public interface IUicRailTicket {
+
+ /**
+ * Gets the issuer details.
+ *
+ * @return the issuer details
+ */
+ public IIssuingDetail getIssuerDetails();
+
+ /**
+ * Gets the traveler details.
+ *
+ * @return the traveler details
+ */
+ public ITravelerDetail getTravelerDetails();
+
+ /**
+ * Gets the traveler details.
+ *
+ * @return the traveler details
+ */
+ public IControlDetail getControlDetails();
+
+ /**
+ * Gets the extensions.
+ *
+ * @return the extensions
+ */
+ public Collection<IExtension> getExtensions();
+
+ /**
+ * Adds an extension
+ *
+ * @param extension the extension
+ */
+ public void addExtension(IExtension extension);
+
+ /**
+ * Sets the issuer details.
+ *
+ * @param issuerDetails the new issuer details
+ */
+ public void setIssuerDetails(IIssuingDetail issuerDetails);
+
+ /**
+ * Sets the traveler details.
+ *
+ * @param travelerDetails the new traveler details
+ */
+ public void setTravelerDetails(ITravelerDetail travelerDetails);
+
+ /**
+ * Sets the control details
+ *
+ * @param controlDetails the new control details
+ */
+ public void setControlDetails(IControlDetail controlDetails);
+
+
+ /**
+ * Gets the travel document data.
+ *
+ * @return the travel document data
+ */
+ public Collection<IDocumentData> getDocumentData();
+
+ /**
+ * Adds the reservation.
+ * -- more than one document to be used on bilateral agreement only
+ *
+ * @param document the reservation
+ */
+ public void addReservation(IReservation document);
+
+ /**
+ * Adds the open ticket.
+ * -- more than one document to be used on bilateral agreement only
+ *
+ * @param document the open ticket
+ */
+ public void addOpenTicket(IOpenTicket document);
+
+ /**
+ * Adds the car carriage reservation.
+ *
+ * @param document the car carriage reservation
+ */
+ public void addCarCarriageReservation(ICarCarriageReservation document);
+
+ /**
+ * Adds the rail pass.
+ * -- more than one document to be used on bilateral agreement only
+ *
+ * @param document the rail pass
+ */
+ public void addPass(IPass document);
+
+ /**
+ * Adds the voucher.
+ *
+ * @param document the voucher
+ */
+ public void addVoucher(IVoucher document);
+
+ /**
+ * Adds the customer card.
+ * -- more than one document to be used on bilateral agreement only
+ *
+ * @param document the customer card
+ */
+ public void addCustomerCard(ICustomerCard document);
+
+ /**
+ * Adds the group ticket counter mark.
+ * -- more than one document to be used on bilateral agreement only
+ *
+ * @param document the group ticket counter mark
+ */
+ public void addCounterMark(ICounterMark document);
+
+ /**
+ * Adds the parking ground reservation
+ * -- more than one document to be used on bilateral agreement only
+ *
+ * @param document the parking ground reservation
+ */
+ public void addParkingGround(IParkingGround document);
+
+ /**
+ * Adds the FIP ticket.
+ *
+ * @param document the FIP ticket
+ */
+ public void addFipTicket (IFipTicket document);
+
+ /**
+ * Adds the station passage allowance.
+ * -- more than one document to be used on bilateral agreement only
+ *
+ * @param document the station passage allowance
+ */
+ public void addStationPassage(IStationPassage document);
+
+ /**
+ * Adds the delay confirmation
+ * -- more than one document to be used on bilateral agreement only
+ *
+ * @param document the delay confirmation
+ */
+ public void addDelayConfirmation(IDelayConfirmation document);
+
+ /**
+ * Adds a proprietary document.
+ * if not bilaterally agreed otherwise proprietary extensions must be ignored
+ *
+ * @param document the proprietary document
+ */
+ public void addDocumentExtension(IDocumentExtension document);
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IUicTicketObjectFactory.java b/src/org/uic/barcode/ticket/api/spec/IUicTicketObjectFactory.java new file mode 100644 index 0000000..075ee81 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IUicTicketObjectFactory.java @@ -0,0 +1,51 @@ +package org.uic.barcode.ticket.api.spec;
+
+public interface IUicTicketObjectFactory {
+
+ public abstract IBerth createBerth();
+ public abstract ICarCarriageReservation createCarCarriageReservation();
+ public abstract ICardReference createCardReference();
+ public abstract ICompartmentDetails createCompartmentDetails();
+ public abstract IControlDetail createControlDetail();
+ public abstract ICounterMark createCounterMark();
+ public abstract ICustomerCard createCustomerCard();
+ public abstract ICustomerStatusDescription createCustomerStatusDescription();
+ public abstract IDelayConfirmation createDelayConfirmation();
+ public abstract IDocumentData createDocumentData();
+ public abstract IExtension createExtension();
+ public abstract IFipTicket createFipTicket();
+ public abstract IGeoCoordinate createGeoCoordinate();
+ public abstract IIncludedOpenTicket createIncludedOpenTicket();
+ public abstract IIssuingDetail createIssuingDetail();
+ public abstract ILine createLine();
+ public abstract ILuggageRestriction createLuggageRestriction();
+ public abstract IOpenTicket createOpenTicket();
+ public abstract IParkingGround createParkingGround();
+ public abstract IPass createPass();
+ public abstract IPlaces createPlaces();
+ public abstract IPolygone createPolygone();
+ public abstract IRegisteredLuggage createRegisteredLuggage();
+ public abstract IReservation createReservation();
+ public abstract IReturnRouteDescription createReturnRouteDescription();
+ public abstract IRouteSection createRouteSection();
+ public abstract ISeriesDataDetails createSeriesDataDetails();
+ public abstract IStationPassage createStationPassage();
+ public abstract ITariff createTariff();
+ public abstract ITicketLink createTicketLink();
+ public abstract ITimeRange createTimeRange();
+ public abstract IToken createToken();
+ public abstract ITrainLink createTrainLink();
+ public abstract ITraveler createTraveler();
+ public abstract ITravelerDetail createTravelerDetail();
+ public abstract IUicRailTicket createUicRailTicket();
+ public abstract IValidityDetails createValidityDetails();
+ public abstract IValidityRange createValidityRange();
+ public abstract IViaStation createViaStation();
+ public abstract IVoucher createVoucher();
+ public abstract IZone createZone();
+ public abstract IDocumentExtension createDocumentExtension();
+ public abstract IServiceBrand createServiceBrand();
+ public abstract IVatDetail createVatDetail();
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IValidityDetails.java b/src/org/uic/barcode/ticket/api/spec/IValidityDetails.java new file mode 100644 index 0000000..92c055d --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IValidityDetails.java @@ -0,0 +1,45 @@ +package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+
+/**
+ * The Interface IValidityDetails.
+ *
+ * IValidityDetails provides a more detailed validity description:
+ *
+ * a list of date/time ranges
+ * a list of excluded time ranges
+ *
+ */
+public interface IValidityDetails {
+
+
+ /**
+ * Gets the validity ranges.
+ *
+ * @return the validity ranges
+ */
+ public Collection<IValidityRange> getValidityRanges();
+
+ /**
+ * Gets the time ranges.
+ *
+ * @return the time ranges
+ */
+ public Collection<ITimeRange> getTimeRanges();
+
+ /**
+ * Adds the validity ranges.
+ *
+ * @param range the range
+ */
+ public void addValidityRanges(IValidityRange range);
+
+ /**
+ * Adds the time ranges.
+ *
+ * @param range the range
+ */
+ public void addTimeRanges(ITimeRange range);
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IValidityRange.java b/src/org/uic/barcode/ticket/api/spec/IValidityRange.java new file mode 100644 index 0000000..b81a38c --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IValidityRange.java @@ -0,0 +1,72 @@ +package org.uic.barcode.ticket.api.spec;
+
+import java.util.Date;
+
+/**
+ * The Interface IValidityRange.
+ *
+ * IValidityRange describes a validity range by from / until date and time
+ */
+public interface IValidityRange {
+
+
+ /**
+ * Gets the from date and time.
+ *
+ * @return the from date and time
+ */
+ public Date getFromDate();
+
+ /**
+ * Gets the until date and time.
+ *
+ * @return the until date and time
+ */
+ public Date getUntilDate();
+
+
+ /**
+ * Sets the from date and time.
+ *
+ * @param date the new from date and time
+ */
+ public void setFromDate(Date date);
+
+ /**
+ * Sets the until date and time.
+ *
+ * @param date the new until date and time
+ */
+ public void setUntilDate(Date date);
+
+
+ /**
+ * Gets the validFrom date time offset to UTC in units of 15 minutes.
+ *
+ * @return the validFrom date time UTC offset
+ */
+ public Long getValidFromUTCoffset();
+
+ /**
+ * Sets the validFrom date time.
+ *
+ * @param validFromDateTime the new validFrom date time
+ */
+ public void setValidFromUTCoffset(Long validFromUTCoffset) ;
+
+ /**
+ * Gets the validUntil date time offset to UTC in units of 15 minutes.
+ *
+ * @return the validUntil date time UTC offset
+ */
+ public Long getValidUntilUTCoffset();
+
+ /**
+ * Sets the validUntil date time.
+ *
+ * @param validUntilDateTime the new validUntil date time
+ */
+ public void setValidUntilUTCoffset(Long validUntilUTCoffset) ;
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IVatDetail.java b/src/org/uic/barcode/ticket/api/spec/IVatDetail.java new file mode 100644 index 0000000..4739415 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IVatDetail.java @@ -0,0 +1,22 @@ +package org.uic.barcode.ticket.api.spec;
+
+public interface IVatDetail {
+
+ public int getCountry();
+
+ public void setCountry(int country);
+
+ public int getPercentage();
+
+ public void setPercentage(int percentage);
+
+ public Long getAmount();
+
+ public void setAmount(Long amount);
+
+ public String getVatId();
+
+ public void setVatId(String vatId);
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IViaStation.java b/src/org/uic/barcode/ticket/api/spec/IViaStation.java new file mode 100644 index 0000000..34900a8 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IViaStation.java @@ -0,0 +1,170 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+
+
+/**
+ * The Interface IViaStation.
+ *
+ * IViaStation describes a route description or a part of a route description by
+ * via station according to UIC leaflet 108.1
+ *
+ * Note: as route description with via stations can contain alternative routes and can include
+ * other routes the data structure is used recursively!
+ *
+ *
+ * ViaStation could be
+ * - a simple station
+ * or
+ * - a list of alternative routes defined as a list of other IViaStations
+ * or
+ * - a route defined as a list of other IViaStations
+ *
+ *
+ *
+ */
+public interface IViaStation extends IRegionalValidity {
+
+ /**
+ * Gets the station code table.
+ *
+ * Defines the station code table to be used to retrieve station information.
+ * Default in this case is the UIC station codes table for standard UIC
+ * station code from MERITS (UIC country code + 5 digit local code)
+ *
+ * The station code table should be included only in case it differs from the station
+ * code table used in the travel document!
+ *
+ * @return the station code table
+ */
+ public IStationCodeTable getStationCodeTable();
+
+ /**
+ * Sets the station code table.
+ *
+ * Defines the station code table to be used to retrieve station information.
+ * Default in this case is the UIC station codes table for standard UIC
+ * station code from MERITS (UIC country code + 5 digit local code)
+ *
+ * The station code table should be included only in case it differs from the station
+ * code table used in the travel document!
+ *
+ * @param stationCodeTable the new station code table
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable);
+
+ /**
+ * Gets the station code.
+ *
+ * @return the station code
+ */
+ public String getStation();
+
+ /**
+ * Sets the station code.
+ *
+ * @param station the new station code
+ */
+ public void setStation(String station);
+
+
+ /**
+ * Gets the alternative routes.
+ *
+ * @return the alternative routes
+ */
+ public Collection<IViaStation> getAlternativeRoutes();
+
+ /**
+ * Adds an alternative route.
+ *
+ * @param route the alternative route
+ */
+ public void addAlternativeRoute(IViaStation route);
+
+ /**
+ * Gets the route.
+ *
+ * @return the route
+ */
+ public Collection<IViaStation> getRoute();
+
+ /**
+ * Adds the route station.
+ *
+ * @param viaStation the via station
+ */
+ public void addRouteStation(IViaStation viaStation);
+
+ /**
+ * Checks if the via station is a border point.
+ *
+ * @return true, if is border point
+ */
+ public boolean isBorder();
+
+ /**
+ * Sets if the via station is a border point.
+ *
+ * @param border the new border point flag
+ */
+ public void setBorder(boolean border);
+
+ /**
+ * Gets the carriers.
+ *
+ * The carriers along the route should preferably be indicated as a list within
+ * the ticket, and not in the via stations.
+ *
+ * @return the carriers
+ */
+ public Collection<String> getCarriers();
+
+ /**
+ * Adds the carrier.
+ *
+ * The carriers along the route should preferably be indicated as a list within
+ * the ticket, and not in the via stations.
+ * *
+ * @param carrier the carrier
+ */
+ public void addCarrier(String carrier);
+
+ /**
+ * Gets the route id.
+ *
+ * A route id indicating the route in a lookup table.
+ *
+ * @return the route id
+ */
+ public int getRouteId();
+
+ /**
+ * Sets the route id.
+ *
+ * A route id indicating the route in a lookup table.
+ *
+ * @param routeId the new route id
+ */
+ public void setRouteId(int routeId);
+
+
+ /**
+ * Gets the series id as defined in the price data according to UIC leaflet 108.1.
+ *
+ * @return the series id as defined in the price data according to UIC leaflet 108.1.
+ */
+ public int getSeriesId();
+
+ /**
+ * Sets the series id as defined in the price data according to UIC leaflet 108.1..
+ *
+ * @param seriesId the new series id as defined in the price data according to UIC leaflet 108.1.
+ */
+ public void setSeriesId(int seriesId);
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IVoucher.java b/src/org/uic/barcode/ticket/api/spec/IVoucher.java new file mode 100644 index 0000000..a276b04 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IVoucher.java @@ -0,0 +1,146 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Date;
+
+/**
+ * The Interface IVoucher.
+ *
+ * IVoucher provides the description of a voucher.
+ *
+ */
+public interface IVoucher extends IDocumentData {
+
+ /**
+ * Gets the reference.
+ *
+ * @return the reference
+ */
+ public String getReference() ;
+
+ /**
+ * Sets the reference.
+ *
+ * @param reference the new reference
+ */
+ public void setReference(String reference);
+
+ /**
+ * Gets the product owner.
+ *
+ * @return the product owner
+ */
+ public String getProductOwner();
+
+ /**
+ * Sets the product owner.
+ *
+ * @param productOwner the new product owner
+ */
+ public void setProductOwner(String productOwner);
+
+
+ /**
+ * Gets the product type.
+ *
+ * @return the product type
+ */
+ public String getProductId();
+
+ /**
+ * Sets the product type.
+ *
+ * @param id the new product id
+ */
+ public void setProductId(String type);
+
+
+ /**
+ * Gets the valid from date.
+ *
+ * @return the valid from date
+ */
+ public Date getValidFrom();
+
+ /**
+ * Sets the valid from date.
+ *
+ * @param validFrom the new valid from date
+ */
+ public void setValidFrom(Date validFrom);
+
+ /**
+ * Gets the valid until date.
+ *
+ * @return the valid until date
+ */
+ public Date getValidUntil();
+
+ /**
+ * Sets the valid until date.
+ *
+ * @param validUntil the new valid until date
+ */
+ public void setValidUntil(Date validUntil);
+
+
+ /**
+ * Gets the info text.
+ *
+ * @return the info text
+ */
+ public String getInfoText();
+
+ /**
+ * Sets the info text.
+ *
+ * @param infoText the new info text
+ */
+ public void setInfoText(String infoText) ;
+
+
+ /**
+ * Gets the amount in the currency and the fraction indicated in the issuer detail data.
+ *
+ * @return the amount in the currency and the fraction indicated in the issuer detail data
+ */
+ public Integer getAmount() ;
+
+ /**
+ * Sets the amount in the currency and the fraction indicated in the issuer detail data.
+ *
+ * @param amount the new amount in the currency and the fraction indicated in the issuer detail data
+ */
+ public void setAmount(Integer amount);
+
+ /**
+ * Gets the type of the voucher (code list defined by the product owner).
+ *
+ * @return the type of the voucher
+ */
+ public Integer getType() ;
+
+ /**
+ * Sets the type of the voucher (code list defined by the product owner).
+ *
+ * @param type the new type
+ */
+ public void setType(Integer type);
+
+ /**
+ * Gets the extension.
+ *
+ * @return the extension
+ */
+ public IExtension getExtension();
+
+ /**
+ * Sets the extension.
+ *
+ * @param extensionData the new extension
+ */
+ public void setExtension(IExtension extensionData);
+
+}
diff --git a/src/org/uic/barcode/ticket/api/spec/IZone.java b/src/org/uic/barcode/ticket/api/spec/IZone.java new file mode 100644 index 0000000..75fc69d --- /dev/null +++ b/src/org/uic/barcode/ticket/api/spec/IZone.java @@ -0,0 +1,141 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.spec;
+
+import java.util.Collection;
+
+/**
+ * The Interface IZone.
+ *
+ *
+ * IZone describes a regional validity in a zone.
+ *
+ */
+public interface IZone extends IRegionalValidity{
+
+ /**
+ * Gets the carrier.
+ *
+ * @return the carrier
+ */
+ public String getCarrier();
+
+ /**
+ * Sets the carrier.
+ *
+ * @param carrier the new carrier
+ */
+ public void setCarrier(String carrier);
+
+ /**
+ * Gets the station code table.
+ *
+ * @return the station code table
+ */
+ public IStationCodeTable getStationCodeTable();
+
+ /**
+ * Sets the station code table.
+ *
+ * @param stationCodeTable the new station code table
+ */
+ public void setStationCodeTable(IStationCodeTable stationCodeTable);
+
+ /**
+ * Gets the entry station in case the journey in the zone has to start at a specific station in the zone
+ * E.g. city traffic at the end of a train journey starting at the final train station.
+ *
+ * @return the entry station
+ */
+ public String getEntryStation() ;
+
+ /**
+ * Sets the entry station in case the journey in the zone has to start at a specific station in the zone
+ * E.g. city traffic at the end of a train journey starting at the final train station.
+ *
+ * @param entryStation the new entry station
+ */
+ public void setEntryStation(String entryStation);
+
+ /**
+ * Gets the terminating station in case the journey in the zone has to end at a specific station in the zone
+ * E.g. city traffic at the begin of a train journey starting at the first train station.
+ *
+ * @return the terminating station
+ */
+ public String getTerminatingStation();
+
+ /**
+ * Sets the terminating station in case the journey in the zone has to end at a specific station in the zone
+ * E.g. city traffic at the begin of a train journey starting at the first train station.
+ *
+ * @param terminatingStation the new terminating station
+ */
+ public void setTerminatingStation(String terminatingStation);
+
+ /**
+ * Gets the city code of the local city in case the zone is part of regional
+ * city transport: code list of the local carrier.
+ *
+ * @return the city
+ */
+ public int getCity() ;
+
+ /**
+ * Sets the city code of the local city in case the zone is part of regional
+ * city transport: code list of the local carrier
+ *
+ * @param city the new city
+ */
+ public void setCity(int city);
+
+ /**
+ * Gets the binary zone id.
+ * binary encoding of zones, encoding specification provided by
+ * the local service provider
+ *
+ * @return the binary zone id
+ */
+ public byte[] getBinaryZoneId() ;
+
+ /**
+ * Sets the binary zone id.
+ * binary encoding of zones, encoding specification provided by
+ * the local service provider
+ *
+ * @param binatyZoneId the new binaty zone id
+ */
+ public void setBinaryZoneId(byte[] binatyZoneId);
+
+ /**
+ * Gets the zone ids.
+ * ids of the valid zones known by the local carriers in that zone
+ *
+ * @return the zone ids
+ */
+ public Collection<Integer> getZoneIds() ;
+
+ /**
+ * Adds a zone id.
+ * id of the valid zones known by the local carriers in that zone
+ *
+ * @param zoneId the zone id
+ */
+ public void addZoneId(int zoneId);
+
+ /**
+ * Gets the European NUTS code in case this code is used to encode the zone.
+ *
+ * @return the NUTS code
+ */
+ public String getNUTScode();
+
+ /**
+ * Sets the European NUTS code in case this code is used to encode the zone.
+ *
+ * @param code the new NUTS code
+ */
+ public void setNUTScode(String code);
+
+}
diff --git a/src/org/uic/ticket/api/spec/package.html b/src/org/uic/barcode/ticket/api/spec/package.html index 18d8b53..18d8b53 100644 --- a/src/org/uic/ticket/api/spec/package.html +++ b/src/org/uic/barcode/ticket/api/spec/package.html diff --git a/src/org/uic/ticket/api/spec/uicBarcodeHeader0.1.asn b/src/org/uic/barcode/ticket/api/spec/uicBarcodeHeader0.1.asn index 2999d18..2999d18 100644 --- a/src/org/uic/ticket/api/spec/uicBarcodeHeader0.1.asn +++ b/src/org/uic/barcode/ticket/api/spec/uicBarcodeHeader0.1.asn diff --git a/src/org/uic/barcode/ticket/api/test/DateTimeUtilsTest.java b/src/org/uic/barcode/ticket/api/test/DateTimeUtilsTest.java new file mode 100644 index 0000000..5435c6b --- /dev/null +++ b/src/org/uic/barcode/ticket/api/test/DateTimeUtilsTest.java @@ -0,0 +1,45 @@ +package org.uic.barcode.ticket.api.test; + +import java.util.Calendar; +import java.util.TimeZone; +import org.junit.Test; +import org.uic.barcode.ticket.api.asn.omv1.DateTimeUtils; + + +public class DateTimeUtilsTest{ + + + + @Test public void testDateDiff1() throws IllegalArgumentException, IllegalAccessException { + + Calendar issuing = Calendar.getInstance(); + issuing.setTimeZone(TimeZone.getTimeZone("UTC")); + issuing.set(Calendar.YEAR,2017); + issuing.set(Calendar.DAY_OF_MONTH, 31); + issuing.set(Calendar.MONTH, 12); + issuing.set(Calendar.HOUR_OF_DAY, 23); + issuing.set(Calendar.MINUTE, 5); + + Calendar local = Calendar.getInstance(); + local.set(Calendar.YEAR,2018); + local.set(Calendar.DAY_OF_MONTH, 1); + local.set(Calendar.MONTH, 1); + issuing.set(Calendar.HOUR_OF_DAY, 0); + issuing.set(Calendar.MINUTE, 5); + + Long diff = DateTimeUtils.getDateDifference(issuing.getTime(), local.getTime()); + + + assert(diff.intValue() == 1); + } + + + + + + + + + + +} diff --git a/src/org/uic/barcode/ticket/api/test/SimpleTicketLinkTestTicket.java b/src/org/uic/barcode/ticket/api/test/SimpleTicketLinkTestTicket.java new file mode 100644 index 0000000..483d97e --- /dev/null +++ b/src/org/uic/barcode/ticket/api/test/SimpleTicketLinkTestTicket.java @@ -0,0 +1,574 @@ +package org.uic.barcode.ticket.api.test;
+
+ import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8;
+ import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
+ import org.uic.barcode.ticket.api.asn.omv1.ControlData;
+ import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
+ import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
+ import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
+ import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
+ import org.uic.barcode.ticket.api.asn.omv1.LinkMode;
+ import org.uic.barcode.ticket.api.asn.omv1.OpenTicketData;
+ import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
+ import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
+ import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
+ import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
+ import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTicketLinkType;
+ import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
+ import org.uic.barcode.ticket.api.asn.omv1.StationPassageData;
+ import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
+ import org.uic.barcode.ticket.api.asn.omv1.TicketLinkType;
+ import org.uic.barcode.ticket.api.asn.omv1.TicketType;
+ import org.uic.barcode.ticket.api.asn.omv1.TokenType;
+ import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
+ import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
+ import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
+
+ public class SimpleTicketLinkTestTicket {
+
+ public static UicRailTicketData getUicTestTicket() {
+ UicRailTicketData ticket = new UicRailTicketData();
+ populateTicket(ticket);
+ return ticket;
+ }
+
+ /*
+ value UicRailTicketData ::= {
+ issuingDetail {
+ issuingYear 2018
+ issuingDay 1
+ specimen TRUE,
+ securePaperTicket FALSE,
+ activated TRUE,
+ 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
+ infoText "openTicketInfo"
+ }
+ }
+ ,{
+ ticket stationPassage : {
+ productName "passage"
+ ,stationNameUTF8 { "Amsterdam" }
+ ,validFromDay 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 }
+ }
+ }
+ */
+
+ /*
+ * asn.1 version 1.3 encoding:
+Encoding to the file 'data.uper' using PER UNALIGNED encoding rule...
+UicRailTicketData SEQUENCE [root fieldcount (not encoded) = 5]
+ issuingDetail IssuingData SEQUENCE [root fieldcount (not encoded) = 7]
+ issuingYear INTEGER [length (not encoded) = 1.0]
+ 2018
+ issuingDay INTEGER [length (not encoded) = 1.1]
+ 1
+ specimen BOOLEAN [length (not encoded) = 0.1]
+ TRUE
+ securePaperTicket BOOLEAN [length (not encoded) = 0.1]
+ FALSE
+ activated BOOLEAN [length (not encoded) = 0.1]
+ TRUE
+ issuerPNR IA5String [length = 13.0]
+ "issuerTestPNR"
+ issuedOnLine INTEGER [length = 1.0]
+ 12
+ travelerDetail TravelerData SEQUENCE [root fieldcount (not encoded) = 2]
+ traveler SEQUENCE OF [count = 1]
+ TravelerType SEQUENCE [root fieldcount (not encoded) = 5]
+ firstName UTF8String [length = 4.0]
+ 0x4a6f686e
+ secondName UTF8String [length = 3.0]
+ 0x446f77
+ idCard IA5String [length = 5.0]
+ "12345"
+ ticketHolder BOOLEAN [length (not encoded) = 0.1]
+ TRUE
+ status SEQUENCE OF [count = 1]
+ CustomerStatusType SEQUENCE [fieldcount (not encoded) = 1]
+ customerStatusDescr IA5String [length = 6.0]
+ "senior"
+ groupName UTF8String [length = 7.0]
+ 0x6d7947726f7570
+ transportDocument SEQUENCE OF [count = 2]
+ DocumentData SEQUENCE [root fieldcount (not encoded) = 2]
+ token TokenType SEQUENCE [fieldcount (not encoded) = 2]
+ tokenProviderIA5 IA5String [length = 3.0]
+ "VDV"
+ token OCTET STRING [length = 2.0]
+ 0x82da
+ ticket CHOICE [index = 2]
+ openTicket OpenTicketData SEQUENCE [root fieldcount (not encoded) = 2]
+ returnIncluded BOOLEAN [length (not encoded) = 0.1]
+ FALSE
+ infoText UTF8String [length = 14.0]
+ 0x6f70656e5469636b6574496e666f
+ DocumentData SEQUENCE [root fieldcount (not encoded) = 1]
+ ticket CHOICE [index = 9]
+ stationPassage StationPassageData SEQUENCE [root fieldcount (not encoded) = 4]
+ productName UTF8String [length = 7.0]
+ 0x70617373616765
+ stationNameUTF8 SEQUENCE OF [count = 1]
+ UTF8String [length = 9.0]
+ 0x416d7374657264616d
+ validFromDay INTEGER [length (not encoded) = 1.2]
+ 0
+ numberOfDaysValid INTEGER [length = 1.0]
+ 123
+ controlDetail ControlData SEQUENCE [root fieldcount (not encoded) = 9]
+ identificationByCardReference SEQUENCE OF [count = 1]
+ CardReferenceType SEQUENCE [root fieldcount (not encoded) = 1]
+ trailingCardIdNum INTEGER [length = 1.0]
+ 100
+ identificationByIdCard BOOLEAN [length (not encoded) = 0.1]
+ FALSE
+ identificationByPassportId BOOLEAN [length (not encoded) = 0.1]
+ FALSE
+ passportValidationRequired BOOLEAN [length (not encoded) = 0.1]
+ FALSE
+ onlineValidationRequired BOOLEAN [length (not encoded) = 0.1]
+ FALSE
+ ageCheckRequired BOOLEAN [length (not encoded) = 0.1]
+ FALSE
+ reductionCardCheckRequired BOOLEAN [length (not encoded) = 0.1]
+ FALSE
+ infoText UTF8String [length = 2.0]
+ 0x6364
+ includedTickets SEQUENCE OF [count = 1]
+ TicketLinkType SEQUENCE [root fieldcount (not encoded) = 6]
+ referenceIA5 IA5String [length = 11.0]
+ "UED12435867"
+ issuerName UTF8String [length = 4.0]
+ 0x4f454242
+ issuerPNR IA5String [length = 3.0]
+ "PNR"
+ productOwnerIA5 IA5String [length = 4.0]
+ "test"
+ ticketType TicketType ENUMERATED [length (not encoded) = 0.2]
+ 1
+ linkMode LinkMode ENUMERATED [length (not encoded) = 0.1]
+ 1
+ extension SEQUENCE OF [count = 2]
+ ExtensionData SEQUENCE [fieldcount (not encoded) = 2]
+ extensionId IA5String [length = 1.0]
+ "1"
+ extensionData OCTET STRING [length = 2.0]
+ 0x82da
+ ExtensionData SEQUENCE [fieldcount (not encoded) = 2]
+ extensionId IA5String [length = 1.0]
+ "2"
+ extensionData OCTET STRING [length = 2.0]
+ 0x83da
+Total encoded length = 154.3
+Encoded successfully in 155 bytes:
+78022020 050DD3CF 9F5CBCAA 65E7D284 EA40218A 02D00082 2537B437 01A237BB
+82B164CD A3580883 73CBBB4E FE40EDAF 28EE4DEE AE004A03 AD12B014 16D08000
+00000403 9BDC195B 951A58DA D95D125B 999BC480 88040EE0 C2E6E6C2 CECA0212
+82DAE6E8 CAE4C8C2 DA0080BD A6010040 2C800131 B200ADC2 EAC588C5 93466D5C
+366E089E 8A848407 4275204E 9979F428 100B1028 2DA01640 507B40
+ *
+ *
+ */
+
+ /*
+ * asn.1 version 2.0 encoding
+ *
+ Encoding to the file 'data.uper' using PER UNALIGNED encoding rule...
+UicRailTicketData SEQUENCE [root fieldcount (not encoded) = 5]
+ issuingDetail IssuingData SEQUENCE [root fieldcount (not encoded) = 7]
+ issuingYear INTEGER [length (not encoded) = 1.0]
+ 2018
+ issuingDay INTEGER [length (not encoded) = 1.1]
+ 1
+ specimen BOOLEAN [length (not encoded) = 0.1]
+ TRUE
+ securePaperTicket BOOLEAN [length (not encoded) = 0.1]
+ FALSE
+ activated BOOLEAN [length (not encoded) = 0.1]
+ TRUE
+ issuerPNR IA5String [length = 13.0]
+ "issuerTestPNR"
+ issuedOnLine INTEGER [length = 1.0]
+ 12
+ travelerDetail TravelerData SEQUENCE [root fieldcount (not encoded) = 2]
+ traveler SEQUENCE OF [count = 1]
+ TravelerType SEQUENCE [root fieldcount (not encoded) = 5]
+ firstName UTF8String [length = 4.0]
+ 0x4a6f686e
+ secondName UTF8String [length = 3.0]
+ 0x446f77
+ idCard IA5String [length = 5.0]
+ "12345"
+ ticketHolder BOOLEAN [length (not encoded) = 0.1]
+ TRUE
+ status SEQUENCE OF [count = 1]
+ CustomerStatusType SEQUENCE [fieldcount (not encoded) = 1]
+ customerStatusDescr IA5String [length = 6.0]
+ "senior"
+ groupName UTF8String [length = 7.0]
+ 0x6d7947726f7570
+ transportDocument SEQUENCE OF [count = 2]
+ DocumentData SEQUENCE [root fieldcount (not encoded) = 2]
+ token TokenType SEQUENCE [fieldcount (not encoded) = 2]
+ tokenProviderIA5 IA5String [length = 3.0]
+ "VDV"
+ token OCTET STRING [length = 2.0]
+ 0x82da
+ ticket CHOICE [index = 2]
+ openTicket OpenTicketData SEQUENCE [root fieldcount (not encoded) = 2]
+ returnIncluded BOOLEAN [length (not encoded) = 0.1]
+ FALSE
+ infoText UTF8String [length = 14.0]
+ 0x6f70656e5469636b6574496e666f
+ DocumentData SEQUENCE [root fieldcount (not encoded) = 1]
+ ticket CHOICE [index = 9]
+ stationPassage StationPassageData SEQUENCE [root fieldcount (not encoded) = 4]
+ productName UTF8String [length = 7.0]
+ 0x70617373616765
+ stationNameUTF8 SEQUENCE OF [count = 1]
+ UTF8String [length = 9.0]
+ 0x416d7374657264616d
+ validFromDay INTEGER [length (not encoded) = 1.2]
+ 0
+ numberOfDaysValid INTEGER [length = 1.0]
+ 123
+ controlDetail ControlData SEQUENCE [root fieldcount (not encoded) = 9]
+ identificationByCardReference SEQUENCE OF [count = 1]
+ CardReferenceType SEQUENCE [root fieldcount (not encoded) = 1]
+ trailingCardIdNum INTEGER [length = 1.0]
+ 100
+ identificationByIdCard BOOLEAN [length (not encoded) = 0.1]
+ FALSE
+ identificationByPassportId BOOLEAN [length (not encoded) = 0.1]
+ FALSE
+ passportValidationRequired BOOLEAN [length (not encoded) = 0.1]
+ FALSE
+ onlineValidationRequired BOOLEAN [length (not encoded) = 0.1]
+ FALSE
+ ageCheckRequired BOOLEAN [length (not encoded) = 0.1]
+ FALSE
+ reductionCardCheckRequired BOOLEAN [length (not encoded) = 0.1]
+ FALSE
+ infoText UTF8String [length = 2.0]
+ 0x6364
+ includedTickets SEQUENCE OF [count = 1]
+ TicketLinkType SEQUENCE [root fieldcount (not encoded) = 6]
+ referenceIA5 IA5String [length = 11.0]
+ "UED12435867"
+ issuerName UTF8String [length = 4.0]
+ 0x4f454242
+ issuerPNR IA5String [length = 3.0]
+ "PNR"
+ productOwnerIA5 IA5String [length = 4.0]
+ "test"
+ ticketType TicketType ENUMERATED [length (not encoded) = 0.2]
+ 1
+ linkMode LinkMode ENUMERATED [length (not encoded) = 0.1]
+ 1
+ extension SEQUENCE OF [count = 2]
+ ExtensionData SEQUENCE [fieldcount (not encoded) = 2]
+ extensionId IA5String [length = 1.0]
+ "1"
+ extensionData OCTET STRING [length = 2.0]
+ 0x82da
+ ExtensionData SEQUENCE [fieldcount (not encoded) = 2]
+ extensionId IA5String [length = 1.0]
+ "2"
+ extensionData OCTET STRING [length = 2.0]
+ 0x83da
+Total encoded length = 154.6
+Encoded successfully in 155 bytes:
+78022020 050DD3CF 9F5CBCAA 65E7D284 EA40218A 02D00041 129BDA1B 80D11BDD
+C158B266 D1AC0441 B9E5DDA7 7F2076D7 947726F7 57002501 D689580A 0B684000
+00000200 737B832B 72A34B1B 5B2BA24B 73337890 110081DC 185CDCD8 59D94042
+505B5CDD 195C9918 5B401017 B4C02008 05900026 364015B8 5D58B118 B268CDAB
+86CDC113 D1509080 E84EA409 D32F3E85 02016205 05B402C8 0A0F68
+ *
+ *
+ *
+ */
+
+ public static String getEncodingV1Hex() {
+ return "78022020050DD3CF9F5CBCAA65E7D284EA40218A02D000822537B43701A237BB" +
+ "82B164CDA358088373CBBB4EFE40EDAF28EE4DEEAE004A03AD12B01416D08000" +
+ "000004039BDC195B951A58DAD95D125B999BC48088040EE0C2E6E6C2CECA0212" +
+ "82DAE6E8CAE4C8C2DA0080BDA60100402C800131B200ADC2EAC588C593466D5C" +
+ "366E089E8A8484074275204E9979F428100B10282DA01640507B40";
+ }
+
+ public static String getEncodingV2Hex() {
+ return "78022020050DD3CF9F5CBCAA65E7D284EA40218A02D00041129BDA1B80D11BDD" +
+ "C158B266D1AC0441B9E5DDA77F2076D7947726F757002501D689580A0B684000" +
+ "00000200737B832B72A34B1B5B2BA24B73337890110081DC185CDCD859D94042" +
+ "505B5CDD195C99185B401017B4C0200805900026364015B85D58B118B268CDAB" +
+ "86CDC113D1509080E84EA409D32F3E850201620505B402C80A0F68";
+ }
+
+
+ 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);
+
+ }
+
+ /*
+ ticket stationPassage : {
+ productName "passage"
+ ,stationNameUTF8 { "Amsterdam" }
+ ,validFromDay 0
+ ,numberOfDaysValid 123
+ }
+ */
+ 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);
+ }
+
+ /*
+ {
+ token {tokenProviderIA5 "VDV", token '82DA'H }
+ ,ticket openTicket : {
+ returnIncluded FALSE
+ 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.setReturnIncluded(false);
+ tdd.setOpenTicket(otd);
+ dd.setTicket(tdd);
+ }
+
+
+ /*
+ ,travelerDetail{
+ traveler {
+ {
+ firstName "John"
+ ,secondName "Dow"
+ ,idCard "12345"
+ ,ticketHolder TRUE
+ ,status {{customerStatusDescr "senior" }}
+ }
+ }
+ ,groupName "myGroup"
+ }
+ */
+
+ 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);
+ }
+
+ /*
+ ,issuingDetail {
+ issuingYear 2018
+ issuingDay 1
+ specimen TRUE,
+ securePaperTicket FALSE,
+ activated TRUE,
+ issuerPNR "issuerTestPNR",
+ issuedOnLine 12
+ }
+ */
+ private static void populateIssuingData(IssuingData issuingDetail) {
+ issuingDetail.setIssuingYear(2018L);
+ issuingDetail.setIssuingDay(1L);
+ issuingDetail.setIssuerPNR("issuerTestPNR");
+ issuingDetail.setSpecimen(true);
+ issuingDetail.setSecurePaperTicket(false);
+ issuingDetail.setActivated(true);
+ issuingDetail.setIssuedOnLine(12L);
+ }
+
+ /*
+ ,extension {
+ { extensionId "1", extensionData '82DA'H }
+ ,{ extensionId "2", extensionData '83DA'H }
+ }
+ */
+ 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);
+ }
+
+ /*
+ ,controlDetail {
+ identificationByCardReference {
+ { trailingCardIdNum 100 }
+ }
+ ,identificationByIdCard FALSE
+ ,identificationByPassportId FALSE
+ ,passportValidationRequired FALSE
+ ,onlineValidationRequired FALSE
+ ,ageCheckRequired FALSE
+ ,reductionCardCheckRequired FALSE
+ ,infoText "cd"
+ ,includedTickets {
+ { productOwnerIA5 "test"
+ ,
+
+
+ }
+ }
+ }
+ */
+ 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;
+ }
+
+
+
+ }
diff --git a/src/org/uic/barcode/ticket/api/test/SimpleUicTestTicket.java b/src/org/uic/barcode/ticket/api/test/SimpleUicTestTicket.java new file mode 100644 index 0000000..dc191a5 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/test/SimpleUicTestTicket.java @@ -0,0 +1,244 @@ +package org.uic.barcode.ticket.api.test;
+
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8;
+import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
+import org.uic.barcode.ticket.api.asn.omv1.ControlData;
+import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
+import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
+import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
+import org.uic.barcode.ticket.api.asn.omv1.OpenTicketData;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTicketLinkType;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
+import org.uic.barcode.ticket.api.asn.omv1.StationPassageData;
+import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
+import org.uic.barcode.ticket.api.asn.omv1.TicketLinkType;
+import org.uic.barcode.ticket.api.asn.omv1.TokenType;
+import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
+import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
+import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
+
+public class SimpleUicTestTicket {
+
+
+ public static UicRailTicketData getUicTestTicket() {
+ UicRailTicketData ticket = new UicRailTicketData();
+ populateTicket(ticket);
+ return ticket;
+ }
+
+
+
+ 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);
+
+ }
+
+ /*
+ ticket stationPassage : {
+ productName "passage"
+ ,stationNameUTF8 { "Amsterdam" }
+ ,validFromDay 0
+ ,numberOfDaysValid 123
+ }
+ */
+ 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);
+ }
+
+ /*
+ {
+ token {tokenProviderIA5 "VDV", token '82DA'H }
+ ,ticket openTicket : {
+ returnIncluded FALSE
+ 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.setReturnIncluded(false);
+ tdd.setOpenTicket(otd);
+ dd.setTicket(tdd);
+ }
+
+
+ /*
+ ,travelerDetail{
+ traveler {
+ {
+ firstName "John"
+ ,secondName "Dow"
+ ,idCard "12345"
+ ,ticketHolder TRUE
+ ,status {{customerStatusDescr "senior" }}
+ }
+ }
+ ,groupName "myGroup"
+ }
+ */
+
+ 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);
+ }
+
+ /*
+ ,issuingDetail {
+ issuingYear 2018
+ issuingDay 1
+ specimen TRUE,
+ securePaperTicket FALSE,
+ activated TRUE,
+ issuerPNR "issuerTestPNR",
+ issuedOnLine 12
+ }
+ */
+ private static void populateIssuingData(IssuingData issuingDetail) {
+ issuingDetail.setIssuingYear(2018L);
+ issuingDetail.setIssuingDay(1L);
+ issuingDetail.setIssuerPNR("issuerTestPNR");
+ issuingDetail.setSpecimen(true);
+ issuingDetail.setSecurePaperTicket(false);
+ issuingDetail.setActivated(true);
+ issuingDetail.setIssuedOnLine(12L);
+ }
+
+ /*
+ ,extension {
+ { extensionId "1", extensionData '82DA'H }
+ ,{ extensionId "2", extensionData '83DA'H }
+ }
+ */
+ 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);
+ }
+
+ /*
+ ,controlDetail {
+ identificationByCardReference {
+ { trailingCardIdNum 100 }
+ }
+ ,identificationByIdCard FALSE
+ ,identificationByPassportId FALSE
+ ,passportValidationRequired FALSE
+ ,onlineValidationRequired FALSE
+ ,ageCheckRequired FALSE
+ ,reductionCardCheckRequired FALSE
+ ,infoText "cd"
+ ,includedTickets {
+ { productOwnerIA5 "test" }
+ }
+ }
+ */
+ 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";
+ sequenceOfTicketLinkType.add(tlt);
+ }
+
+ /*
+ {
+ trailingCardIdNum 100
+ }
+ */
+ private static CardReferenceType populateCardRefrence() {
+ CardReferenceType cr = new CardReferenceType();
+ cr.setTrailingCardIdNum(100L);
+ return cr;
+ }
+
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/test/UperEncodeTicketLinkTestV1.java b/src/org/uic/barcode/ticket/api/test/UperEncodeTicketLinkTestV1.java new file mode 100644 index 0000000..96d003d --- /dev/null +++ b/src/org/uic/barcode/ticket/api/test/UperEncodeTicketLinkTestV1.java @@ -0,0 +1,74 @@ +package org.uic.barcode.ticket.api.test; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.uper.UperEncoder; +import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData; +import org.uic.barcode.ticket.api.spec.ILinkMode; +import org.uic.barcode.ticket.api.spec.ITicketLink; +import org.uic.barcode.ticket.api.spec.ITicketType; +import org.uic.barcode.ticket.api.spec.IUicRailTicket; +import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoder; + + +public class UperEncodeTicketLinkTestV1 { + + + + + + @Test public void testEncodeTicket() throws IllegalArgumentException, IllegalAccessException { + UicRailTicketData ticket = SimpleTicketLinkTestTicket.getUicTestTicket(); + byte[] encoded = UperEncoder.encode(ticket); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + + String expectedHex = SimpleTicketLinkTestTicket.getEncodingV1Hex(); + UperEncoder.logger.debug(String.format("first difference at index: %d",hex.compareTo(expectedHex))); + UperEncoder.logger.debug(String.format("data returned: %s",hex)); + UperEncoder.logger.debug(String.format("data expected: %s",expectedHex)); + assert(hex.equals(expectedHex)); + } + + @Test public void testDecodeTicket() throws IllegalArgumentException, IllegalAccessException { + UicRailTicketData ticket = SimpleTicketLinkTestTicket.getUicTestTicket(); + byte[] encoded = UperEncoder.encode(ticket); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + String expectedHex = SimpleTicketLinkTestTicket.getEncodingV1Hex(); + assertEquals(hex,expectedHex); + UicRailTicketData decodedTicket = UperEncoder.decode(encoded, UicRailTicketData.class); + assert(decodedTicket != null); + assertEquals(decodedTicket.controlDetail.ageCheckRequired , false ); + assertEquals(decodedTicket.controlDetail.getInfoText() , "cd" ); + assertEquals(decodedTicket.controlDetail.getIncludedTickets().get(0).getProductOwnerIA5() , "test" ); + assert(decodedTicket.controlDetail.getIdentificationByCardReference().get(0).getTrailingCardIdNum() == 100L ); + assert(decodedTicket.controlDetail.getIncludedTickets().size() == 1); + } + + @Test public void testDecodeTicket2Api() throws IllegalArgumentException, IllegalAccessException { + UicRailTicketData ticket = SimpleTicketLinkTestTicket.getUicTestTicket(); + byte[] encoded = UperEncoder.encode(ticket); + UicRailTicketData decodedTicket = UperEncoder.decode(encoded, UicRailTicketData.class); + + OpenAsn2ApiDecoder decoder = new OpenAsn2ApiDecoder(); + IUicRailTicket uicTicket = null; + try { + uicTicket = decoder.decodeFromAsn(decodedTicket); + } catch (IOException e) { + assert (false); + } + + assert(uicTicket.getControlDetails().getLinkedTickets().size() == 1); + for (ITicketLink link: uicTicket.getControlDetails().getLinkedTickets() ) { + assert(link.getLinkMode() == ILinkMode.onlyValidInCombination); + assert(link.getTicketType() == ITicketType.pass); + } + } + + +} diff --git a/src/org/uic/barcode/ticket/api/test/UperEncodeTicketTestV1.java b/src/org/uic/barcode/ticket/api/test/UperEncodeTicketTestV1.java new file mode 100644 index 0000000..e2a5558 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/test/UperEncodeTicketTestV1.java @@ -0,0 +1,117 @@ +package org.uic.barcode.ticket.api.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.uper.UperEncoder; +import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData; + + +public class UperEncodeTicketTestV1 { + + /** + * Example from the Standard on UPER. + <pre> + value UicRailTicketData ::= { + issuingDetail { + issuingYear 2018 + issuingDay 1 + specimen TRUE, + securePaperTicket FALSE, + activated TRUE, + 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 + infoText "openTicketInfo" + } + } + ,{ + ticket stationPassage : { + productName "passage" + ,stationNameUTF8 { "Amsterdam" } + ,validFromDay 0 + ,numberOfDaysValid 123 + } + } + } + ,controlDetail { + identificationByCardReference { + { trailingCardIdNum 100 } + } + ,identificationByIdCard FALSE + ,identificationByPassportId FALSE + ,passportValidationRequired FALSE + ,onlineValidationRequired FALSE + ,ageCheckRequired FALSE + ,reductionCardCheckRequired FALSE + ,infoText "cd" + ,includedTickets { + { productOwnerIA5 "test" } + } + } + ,extension { + { extensionId "1", extensionData '82DA'H } + ,{ extensionId "2", extensionData '83DA'H } + } + } + + +78022020 050DD3CF 9F5CBCAA 65E7D284 EA40218A 02D00082 2537B437 01A237BB +82B164CD A3580883 73CBBB4E FE40EDAF 28EE4DEE AE004A03 AD12B014 16D08000 +00000403 9BDC195B 951A58DA D95D125B 999BC480 88040EE0 C2E6E6C2 CECA0212 +82DAE6E8 CAE4C8C2 DA0080BD A6010040 2C800131 B2008101 3A65E7D0 08058814 +16D00B20 283DA0 + + </pre> + */ + + + + @Test public void testEncodeTicket() throws IllegalArgumentException, IllegalAccessException { + UicRailTicketData ticket = SimpleUicTestTicket.getUicTestTicket(); + byte[] encoded = UperEncoder.encode(ticket); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + + String expectedHex = "78022020050DD3CF9F5CBCAA65E7D284EA40218A02D000822537B43701A237BB82B164CDA358088373CBBB4EFE40EDAF28EE4DEEAE004A03AD12B01416D08000000004039BDC195B951A58DAD95D125B999BC48088040EE0C2E6E6C2CECA021282DAE6E8CAE4C8C2DA0080BDA60100402C800131B20081013A65E7D00805881416D00B20283DA0"; + UperEncoder.logger.debug(String.format("first difference at index: %d",hex.compareTo(expectedHex))); + UperEncoder.logger.debug(String.format("data returned: %s",hex)); + UperEncoder.logger.debug(String.format("data expected: %s",expectedHex)); + assert(hex.equals(expectedHex)); + } + + @Test public void testDecodeTicket() throws IllegalArgumentException, IllegalAccessException { + UicRailTicketData ticket = SimpleUicTestTicket.getUicTestTicket(); + byte[] encoded = UperEncoder.encode(ticket); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + String expectedHex = "78022020050DD3CF9F5CBCAA65E7D284EA40218A02D000822537B43701A237BB82B164CDA358088373CBBB4EFE40EDAF28EE4DEEAE004A03AD12B01416D08000000004039BDC195B951A58DAD95D125B999BC48088040EE0C2E6E6C2CECA021282DAE6E8CAE4C8C2DA0080BDA60100402C800131B20081013A65E7D00805881416D00B20283DA0"; + assertEquals(hex,expectedHex); + UicRailTicketData decodedTicket = UperEncoder.decode(encoded, UicRailTicketData.class); + assert(decodedTicket != null); + assertEquals(decodedTicket.controlDetail.ageCheckRequired , false ); + assertEquals(decodedTicket.controlDetail.getInfoText() , "cd" ); + assertEquals(decodedTicket.controlDetail.getIncludedTickets().get(0).getProductOwnerIA5() , "test" ); + assert(decodedTicket.controlDetail.getIdentificationByCardReference().get(0).getTrailingCardIdNum() == 100L ); + } + +} diff --git a/src/org/uic/barcode/ticket/api/test/UperEncodeUICTicketExtensionTest.java b/src/org/uic/barcode/ticket/api/test/UperEncodeUICTicketExtensionTest.java new file mode 100644 index 0000000..da59f67 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/test/UperEncodeUICTicketExtensionTest.java @@ -0,0 +1,126 @@ +package org.uic.barcode.ticket.api.test; + +import static org.junit.Assert.assertEquals; + +import java.util.logging.Level; + +import org.junit.Test; +import org.uic.barcode.asn1.datatypes.Asn1Optional; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; +import org.uic.barcode.ticket.api.asn.omv1.ExtensionData; +import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData; + + +public class UperEncodeUICTicketExtensionTest { + + /** + * Example from the Standard on UPER. + <pre> + World-Schema DEFINITIONS AUTOMATIC TAGS ::= + BEGIN + TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE { + extensionList SEQUENCE OF ExtensionData OPTIONAL + } + ExtensionData ::= SEQUENCE { + extensionId IA5String, + extensionData OCTET STRING + } + END + + + value TestRecord ::= { extensionList { + { extensionId "1", extensionData '82DA'H } + ,{ extensionId "2", extensionData '83DA'H } + } + } + +Encoding to the file 'data.uper' using PER UNALIGNED encoding rule... +TestRecord SEQUENCE [fieldcount (not encoded) = 1] + extensionList SEQUENCE OF [count = 2] + ExtensionData SEQUENCE [fieldcount (not encoded) = 2] + extensionId IA5String [length = 1.0] + "1" + extensionData OCTET STRING [length = 2.0] + 0x82da + ExtensionData SEQUENCE [fieldcount (not encoded) = 2] + extensionId IA5String [length = 1.0] + "2" + extensionData OCTET STRING [length = 2.0] + 0x83da +Total encoded length = 10.7 +Encoded successfully in 11 bytes: +8100B102 82DA0164 0507B4 + </pre> + */ + + + @Sequence + public static class TestRecord { + + @Asn1Optional public SequenceOfExtensionData extension; + + public TestRecord() {} + public void setExtensionList(SequenceOfExtensionData sd){ + this.extension = sd; + } + } + + + @Test public void testEncodeTicket() throws IllegalArgumentException, IllegalAccessException { + TestRecord ticket = new TestRecord(); + populateTicket(ticket); + byte[] encoded = UperEncoder.encode(ticket); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + String expectedHex = "8100B10282DA01640507B4"; + UperEncoder.logger.debug(String.format("first diference at index: %d",hex.compareTo(expectedHex))); + assertEquals(hex,expectedHex); + } + + @Test public void testDecodeTicket() throws IllegalArgumentException, IllegalAccessException { + TestRecord ticket = new TestRecord(); + populateTicket(ticket); + byte[] encoded = UperEncoder.encode(ticket); + String hex = UperEncoder.hexStringFromBytes(encoded); + UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); + String expectedHex = "8100B10282DA01640507B4"; + TestRecord decodedTicket = UperEncoder.decode(encoded, TestRecord.class); + assert(decodedTicket != null); + assertEquals(hex,expectedHex); + } + + private void populateTicket(TestRecord ticket) { + + SequenceOfExtensionData ed = new SequenceOfExtensionData(); + populateExtensionSequence(ed); + ticket.setExtensionList(ed); + + } + + + + /* + ,extension { + { extensionId "1", extensionData '82DA'H } + ,{ extensionId "2", extensionData '83DA'H } + } + */ + private 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); + } + + + + + +} diff --git a/src/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java b/src/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java new file mode 100644 index 0000000..bb4cb2d --- /dev/null +++ b/src/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java @@ -0,0 +1,2313 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.utils;
+
+import java.util.Collection;
+import java.util.Date;
+
+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.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.api.asn.omv1.BerthDetailData;
+import org.uic.barcode.ticket.api.asn.omv1.BerthTypeType;
+import org.uic.barcode.ticket.api.asn.omv1.CarCarriageReservationData;
+import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
+import org.uic.barcode.ticket.api.asn.omv1.CodeTableType;
+import org.uic.barcode.ticket.api.asn.omv1.CompartmentDetailsType;
+import org.uic.barcode.ticket.api.asn.omv1.CompartmentGenderType;
+import org.uic.barcode.ticket.api.asn.omv1.ConfirmationTypeType;
+import org.uic.barcode.ticket.api.asn.omv1.ControlData;
+import org.uic.barcode.ticket.api.asn.omv1.CountermarkData;
+import org.uic.barcode.ticket.api.asn.omv1.CustomerCardData;
+import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv1.DelayConfirmation;
+import org.uic.barcode.ticket.api.asn.omv1.DeltaCoordinates;
+import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
+import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
+import org.uic.barcode.ticket.api.asn.omv1.FIPTicketData;
+import org.uic.barcode.ticket.api.asn.omv1.GenderType;
+import org.uic.barcode.ticket.api.asn.omv1.GeoCoordinateSystemType;
+import org.uic.barcode.ticket.api.asn.omv1.GeoCoordinateType;
+import org.uic.barcode.ticket.api.asn.omv1.GeoUnitType;
+import org.uic.barcode.ticket.api.asn.omv1.HemisphereLatitudeType;
+import org.uic.barcode.ticket.api.asn.omv1.HemisphereLongitudeType;
+import org.uic.barcode.ticket.api.asn.omv1.IncludedOpenTicketType;
+import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
+import org.uic.barcode.ticket.api.asn.omv1.LineType;
+import org.uic.barcode.ticket.api.asn.omv1.LinkMode;
+import org.uic.barcode.ticket.api.asn.omv1.LoadingDeckType;
+import org.uic.barcode.ticket.api.asn.omv1.LuggageRestrictionType;
+import org.uic.barcode.ticket.api.asn.omv1.OpenTicketData;
+import org.uic.barcode.ticket.api.asn.omv1.ParkingGroundData;
+import org.uic.barcode.ticket.api.asn.omv1.PassData;
+import org.uic.barcode.ticket.api.asn.omv1.PassengerType;
+import org.uic.barcode.ticket.api.asn.omv1.PlacesType;
+import org.uic.barcode.ticket.api.asn.omv1.PolygoneType;
+import org.uic.barcode.ticket.api.asn.omv1.PriceTypeType;
+import org.uic.barcode.ticket.api.asn.omv1.RegionalValidityType;
+import org.uic.barcode.ticket.api.asn.omv1.RegisteredLuggageType;
+import org.uic.barcode.ticket.api.asn.omv1.ReservationData;
+import org.uic.barcode.ticket.api.asn.omv1.ReturnRouteDescriptionType;
+import org.uic.barcode.ticket.api.asn.omv1.RoofRackType;
+import org.uic.barcode.ticket.api.asn.omv1.RouteSectionType;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfBerthDetailData;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCarrierNum;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCountries;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDeltaCoordinates;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfIncludedOpenTicketType;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfPlaceNum;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfRegionalValidityType;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfRegisteredLuggageType;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfServiceBrands;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTariffType;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTicketLinkType;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerId;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfViaStationType;
+import org.uic.barcode.ticket.api.asn.omv1.SeriesDetailType;
+import org.uic.barcode.ticket.api.asn.omv1.ServiceType;
+import org.uic.barcode.ticket.api.asn.omv1.StationPassageData;
+import org.uic.barcode.ticket.api.asn.omv1.TariffType;
+import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
+import org.uic.barcode.ticket.api.asn.omv1.TicketLinkType;
+import org.uic.barcode.ticket.api.asn.omv1.TicketType;
+import org.uic.barcode.ticket.api.asn.omv1.TimeRangeType;
+import org.uic.barcode.ticket.api.asn.omv1.TokenType;
+import org.uic.barcode.ticket.api.asn.omv1.TrainLinkType;
+import org.uic.barcode.ticket.api.asn.omv1.TravelClassType;
+import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
+import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
+import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
+import org.uic.barcode.ticket.api.asn.omv1.ValidityPeriodDetailType;
+import org.uic.barcode.ticket.api.asn.omv1.ValidityPeriodType;
+import org.uic.barcode.ticket.api.asn.omv1.VatDetailType;
+import org.uic.barcode.ticket.api.asn.omv1.ViaStationType;
+import org.uic.barcode.ticket.api.asn.omv1.VoucherData;
+import org.uic.barcode.ticket.api.asn.omv1.ZoneType;
+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.IControlDetail;
+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.IExtension;
+import org.uic.barcode.ticket.api.spec.IFipTicket;
+import org.uic.barcode.ticket.api.spec.IGeoCoordinate;
+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.IIssuingDetail;
+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.ILuggageRestriction;
+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.IPlaces;
+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.IReturnRouteDescription;
+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.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.IToken;
+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.ITravelerDetail;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.api.spec.IValidityDetails;
+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;
+
+/**
+ * The Class Api2OpenAsnEncoder.
+ */
+public class Api2OpenAsnEncoder {
+
+
+ /**
+ * encode to asn1 model.
+ *
+ * @param uicTicket the uic ticket
+ * @return the encoded byte array
+ * @throws EncodingFormatException the encoding format exception
+ */
+ public byte[] encode(IUicRailTicket uicTicket) throws EncodingFormatException {
+
+ UicRailTicketData asnUicRailTicketData = populateToAsn1Model(uicTicket);
+
+ return asnUicRailTicketData.encode();
+
+ }
+
+
+
+ /**
+ * Populate asn1 model.
+ *
+ * @param uicTicket the uic ticket
+ * @return the org.uic.ticket.asn.om. uic rail ticket data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ public UicRailTicketData populateToAsn1Model(IUicRailTicket uicTicket) throws EncodingFormatException {
+
+ UicRailTicketData asnTicket = new UicRailTicketData();
+
+ if (uicTicket.getIssuerDetails() != null) {
+ asnTicket.setIssuingDetail(encodeIssuingDetails(uicTicket.getIssuerDetails()));
+ }
+
+
+ if (uicTicket.getControlDetails() != null) {
+ asnTicket.setControlDetail(encodeControlDetails(uicTicket.getControlDetails(), uicTicket.getIssuerDetails().getIssuingDate()));
+ }
+
+
+ if (uicTicket.getExtensions() != null && !uicTicket.getExtensions().isEmpty()){
+
+ SequenceOfExtensionData asnList = new SequenceOfExtensionData();
+ for (IExtension extension : uicTicket.getExtensions()){
+ ExtensionData asnExtension = encodeExtension(extension);
+ if (asnExtension!= null) {
+ asnList.add(asnExtension);
+ }
+ }
+ if (!asnList.isEmpty()){
+ asnTicket.setExtension(asnList);
+ }
+
+
+ }
+
+
+ if (uicTicket.getTravelerDetails() != null) {
+ asnTicket.setTravelerDetail(encodeTravelers(uicTicket.getTravelerDetails(),uicTicket.getIssuerDetails().getIssuingDate() ));
+ }
+
+ if (uicTicket.getDocumentData() != null && !uicTicket.getDocumentData().isEmpty()) {
+
+ SequenceOfDocumentData documents = new SequenceOfDocumentData();
+
+ for (IDocumentData document : uicTicket.getDocumentData()){
+
+ DocumentData asnDocument = null;
+
+ if (document instanceof IReservation) {
+ asnDocument = convertReservation((IReservation) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+ if (document instanceof IOpenTicket) {
+ asnDocument = convertOpenTicket((IOpenTicket) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+ if (document instanceof ICarCarriageReservation) {
+ asnDocument = convertCarCarriageReservation((ICarCarriageReservation) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+ if (document instanceof IFipTicket) {
+ asnDocument = convertFipTicket((IFipTicket) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+ if (document instanceof IPass) {
+ asnDocument = convertPass((IPass) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+ if (document instanceof IVoucher) {
+ asnDocument = convertVoucher((IVoucher) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+ if (document instanceof ICounterMark) {
+ asnDocument = convertCounterMark((ICounterMark) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+ if (document instanceof IParkingGround) {
+ asnDocument = convertParkingGround((IParkingGround) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+ if (document instanceof IStationPassage) {
+ asnDocument = convertStationPassage((IStationPassage) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+ if (document instanceof ICustomerCard) {
+ asnDocument = encodeCustomerCard((ICustomerCard) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+
+ if (document instanceof IDelayConfirmation) {
+ asnDocument = encodeDelayConfirmation((IDelayConfirmation) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+
+ if (asnDocument!= null && document.getToken()!= null) {
+ asnDocument.setToken(encodeToken(document.getToken()));
+ }
+
+ if (asnDocument != null) {
+ documents.add(asnDocument);
+ }
+ }
+ asnTicket.setTransportDocument(documents);
+ }
+
+
+ return asnTicket;
+ }
+
+
+
+ private DocumentData encodeDelayConfirmation(IDelayConfirmation document, Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+ DelayConfirmation asnData = new DelayConfirmation();
+ asnDocument.getTicket().setDelayConfirmation(asnData);
+
+ asnData.setTrainIA5(UicEncoderUtils.getIA5NonNum(document.getTrain()));
+ asnData.setTrainNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getTrain())));
+
+ asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+ asnData.setStationIA5(UicEncoderUtils.getIA5NonNum(document.getStation()));
+ asnData.setStationNum(UicEncoderUtils.getNum(document.getStation()));
+
+
+ asnData.setPlannedArrivalDate(document.getArrivalDate());
+ asnData.setDepartureUTCOffset(document.getArrivalUTCoffset());
+
+ asnData.setAffectedTickets(encodeTicketLickList(document.getLinkedTickets()));
+
+ asnData.setConfirmationType(ConfirmationTypeType.values()[document.getConfirmationType()]);
+
+ asnData.setDelay(new Long(document.getDelay()));
+
+ asnData.setTrainCancelled(document.isTrainCancelled());
+
+
+ asnData.setInfoText(document.getInfoText());
+
+ asnData.setStationNameUTF8(document.getStationName());
+
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ return asnDocument;
+ }
+
+
+ /**
+ * Convert car carriage reservation.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData convertCarCarriageReservation( ICarCarriageReservation document, Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+ CarCarriageReservationData asnData = new CarCarriageReservationData();
+ asnDocument.getTicket().setCarCarriageReservation(asnData);
+
+ 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.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUICReservation && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+ asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
+ asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
+
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ asnData.setCompartmentDetails(encodeCompartmentDetails(document.getCompartmentDetails()));
+
+
+ if (document.getPriceType()!= IPriceTypeType.travelPrice && document.getPriceType() != null ){
+ asnData.setPriceType(PriceTypeType.valueOf(document.getPriceType().name()));
+ }
+
+
+ if (document.getServiceBrand()!= null) {
+ asnData.setServiceBrand(UicEncoderUtils.getRestrictedInt(document.getServiceBrand().getServiceBrand(),1,9999));
+ asnData.setServiceBrandAbrUTF8(document.getServiceBrand().getServiceBrandAbbreviation());
+ asnData.setServiceBrandNameUTF8(document.getServiceBrand().getServiceBrandDescription());
+
+ }
+ if (document.getStationCodeTable() != IStationCodeTable.stationUICReservation && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+ asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(document.getFromStation()));
+ asnData.setFromStationNum(UicEncoderUtils.getNum(document.getFromStation()));
+
+ asnData.setToStationIA5(UicEncoderUtils.getIA5NonNum(document.getToStation()));
+ asnData.setToStationNum(UicEncoderUtils.getNum(document.getToStation()));
+
+ asnData.setFromStationNameUTF8(document.getFromStationName());
+ asnData.setToStationNameUTF8(document.getToStationName());
+
+
+ asnData.setAttachedBicycles(UicEncoderUtils.getRestrictedInt(document.getAttachedBicycles(),1,5));
+ asnData.setAttachedBoats(UicEncoderUtils.getRestrictedInt(document.getAttachedBoats(),1,2));
+ asnData.setAttachedSurfboards(UicEncoderUtils.getRestrictedInt(document.getAttachedSurfboards(),1,5));
+
+ if (document.getLoadingDeck() != ILoadingDeckType.upper && document.getLoadingDeck() != null){
+ asnData.setLoadingDeck(LoadingDeckType.valueOf(document.getLoadingDeck().name()));
+ }
+
+ asnData.setLoadingListEntry(UicEncoderUtils.getRestrictedInt(document.getAttachedSurfboards(),1,200));
+
+ asnData.setBoatCategory(UicEncoderUtils.getRestrictedInt(document.getBoatCategory(),1,6));
+ asnData.setCarCategory(UicEncoderUtils.getRestrictedInt(document.getCarCategory(),1,9));
+ asnData.setCoach(UicEncoderUtils.getIA5(document.getCoach()));
+
+ asnData.setRoofRackHeight(UicEncoderUtils.getRestrictedInt(document.getRoofRackHeight(),1,99));
+
+ if (document.getRoofRackType()!= IRoofRackType.norack && document.getRoofRackType() != null ) {
+ asnData.setRoofRackType(RoofRackType.valueOf(document.getRoofRackType().name()));
+ }
+
+ if (document.getTariff() != null) {
+ asnData.setTariff(encodeTariff(document.getTariff()));
+ }
+ asnData.setNumberPlate(UicEncoderUtils.getIA5(document.getNumberPlate()));
+ asnData.setPlace(UicEncoderUtils.getIA5(document.getPlace()));
+
+ if (document.isTextileRoof() ) {
+ asnData.setTextileRoof(true);
+ } else {
+ asnData.setTextileRoof(false);
+ }
+
+ asnData.setTrailerPlate(UicEncoderUtils.getIA5(document.getTrailerPlate()));
+
+ asnData.setLoadingDates(document.getBeginLoading(),document.getEndLoading(), issuingDate);
+
+ asnData.setLoadingUTCOffset(document.getLoadingTimeUTCoffset());
+
+ asnData.setPrice(document.getPrice());
+
+ if (document.getVatDetails() != null && !document.getVatDetails().isEmpty()){
+ for (IVatDetail vat : document.getVatDetails()) {
+ asnData.addVatDetail(encodeVatDetail(vat));
+ }
+ }
+
+
+ return asnDocument;
+ }
+
+
+ /**
+ * Encode places.
+ *
+ * @param places the places
+ * @return the places type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private PlacesType encodePlaces(IPlaces places) throws EncodingFormatException {
+
+ if (places == null) {
+ return null;
+ }
+
+ PlacesType asnData = new PlacesType();
+
+ 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()));
+
+ return asnData;
+ }
+
+
+ /**
+ * Encode compartment details.
+ *
+ * @param compartmentDetails the compartment details
+ * @return the compartment details type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private CompartmentDetailsType encodeCompartmentDetails(ICompartmentDetails compartmentDetails) throws EncodingFormatException {
+
+ if (compartmentDetails == null) {
+ return null;
+ }
+ CompartmentDetailsType asnData = new CompartmentDetailsType();
+
+ asnData.setCoachType(UicEncoderUtils.getRestrictedInt(compartmentDetails.getCoachType(), 1,99));
+ asnData.setCoachTypeDescr(compartmentDetails.getCoachTypeDescr());
+ asnData.setCompartmentType(UicEncoderUtils.getRestrictedInt(compartmentDetails.getCompartmentType(), 1,99));
+ asnData.setCompartmentTypeDescr(compartmentDetails.getCompartmentTypeDescr());
+ asnData.setSpecialAllocation(UicEncoderUtils.getRestrictedInt(compartmentDetails.getSpecialAllocation(), 1,99));
+ asnData.setSpecialAllocationDescr(compartmentDetails.getSpecialAllocationDescr());
+
+ return asnData;
+ }
+
+ /**
+ * Encode berths.
+ *
+ * @param berths the berths
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private SequenceOfBerthDetailData encodeBerths(Collection<IBerth> berths) throws EncodingFormatException {
+
+ if (berths == null || berths.isEmpty()) {
+ return null;
+ }
+ SequenceOfBerthDetailData asnList = new SequenceOfBerthDetailData();
+
+ for ( IBerth berth : berths){
+ BerthDetailData asnBerth = new BerthDetailData();
+
+ if (berth.getType() != null) {
+ asnBerth.setBerthType(BerthTypeType.valueOf(berth.getType().name()));
+ }
+
+ if (berth.getGender()!= ICompartmentGenderType.family && berth.getGender() != null) {
+ asnBerth.setGender(CompartmentGenderType.valueOf(berth.getGender().name()));
+ }
+
+ asnBerth.setNumberOfBerths(UicEncoderUtils.getRestrictedInt(berth.getNumberOfBerths(), 1 , 999 ));
+
+ asnList.add(asnBerth);
+ }
+
+ if (asnList.isEmpty()) {
+ return null;
+ }
+ return asnList;
+ }
+
+ /**
+ * Convert reservation.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData convertReservation(IReservation document, Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+ ReservationData asnData = new ReservationData();
+ asnDocument.getTicket().setReservation(asnData);
+
+ asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
+ asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
+
+ 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()));
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUICReservation && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+ asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(document.getFromStation()));
+ asnData.setFromStationNum(UicEncoderUtils.getNum(document.getFromStation()));
+
+ asnData.setToStationIA5(UicEncoderUtils.getIA5NonNum(document.getToStation()));
+ asnData.setToStationNum(UicEncoderUtils.getNum(document.getToStation()));
+
+ asnData.setFromStationNameUTF8(document.getFromStationName());
+ asnData.setToStationNameUTF8(document.getToStationName());
+
+ asnData.setTrainIA5(UicEncoderUtils.getIA5NonNum(document.getTrain()));
+ asnData.setTrainNum(UicEncoderUtils.getNum(document.getTrain()));
+
+ asnData.setTariff(encodeTariffCollection(document.getTariffs()));
+
+ asnData.setDepartureArrivalDates(document.getDepartureDate(),document.getArrivalDate(), issuingDate);
+
+ if (document.getDepartureUTCoffset() != null) {
+ asnData.setDepartureUTCOffset(document.getDepartureUTCoffset());
+ if (document.getArrivalUTCoffset() != null && document.getArrivalUTCoffset() != document.getDepartureUTCoffset()){
+ asnData.setArrivalUTCOffset(document.getArrivalUTCoffset());
+ }
+ }
+
+
+
+ if (document.getClassCode() != ITravelClassType.second){
+ asnData.setClassCode(convertTravelClass(document.getClassCode()));
+ }
+
+ asnData.setBerth(encodeBerths(document.getBerths()));
+
+ asnData.setCompartmentDetails(encodeCompartmentDetails(document.getCompartmentDetails()));
+
+ asnData.setLuggage(encodeLuggage(document.getLuggageRestriction()));
+
+ asnData.setNumberOfOverbooked(UicEncoderUtils.getRestrictedInt(document.getNumberOfOverbooked(), 1, 200));
+ asnData.setNumberOfSupplements(UicEncoderUtils.getRestrictedInt(document.getNumberOfSupplements(), 1, 200));
+
+ if (document.getPriceType()!= IPriceTypeType.travelPrice && document.getPriceType() != null){
+ asnData.setPriceType(PriceTypeType.valueOf(document.getPriceType().name()));
+ }
+ asnData.setTypeOfSupplement(UicEncoderUtils.getRestrictedInt(document.getTypeOfSupplement(), 1, 9));
+
+ asnData.setPlaces(encodePlaces(document.getPlaces()));
+ asnData.setBicyclePlaces(encodePlaces(document.getBicyclePlaces()));
+
+
+ if (document.getService() != IServiceType.seat && document.getService() != null) {
+ asnData.setService(ServiceType.valueOf(document.getService().name()));
+ }
+
+ if (document.getServiceBrand()!= null) {
+ asnData.setServiceBrand(UicEncoderUtils.getRestrictedInt(document.getServiceBrand().getServiceBrand(),1,9999));
+ asnData.setServiceBrandAbrUTF8(document.getServiceBrand().getServiceBrandAbbreviation());
+ asnData.setServiceBrandNameUTF8(document.getServiceBrand().getServiceBrandDescription());
+
+ }
+
+ if (document.getServiceLevel() != null && document.getServiceLevel().length() > 2) {
+ throw new EncodingFormatException("Service level too long");
+ }
+ asnData.setServiceLevel(UicEncoderUtils.getIA5(document.getServiceLevel()));
+
+ asnData.setPrice(document.getPrice());
+
+ if (document.getVatDetails() != null && !document.getVatDetails().isEmpty()){
+ for (IVatDetail vat : document.getVatDetails()) {
+ asnData.addVatDetail(encodeVatDetail(vat));
+ }
+ }
+
+ return asnDocument;
+ }
+
+ /**
+ * Encode included addons.
+ *
+ * @param tickets the tickets
+ * @param issuingDate the issuing date
+ * @param travelClassType the class code
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private SequenceOfIncludedOpenTicketType encodeIncludedAddons(Collection<IIncludedOpenTicket> tickets, Date issuingDate, ITravelClassType travelClassType) throws EncodingFormatException {
+
+ if (tickets == null || tickets.isEmpty()) {
+ return null;
+ }
+ SequenceOfIncludedOpenTicketType asnList = new SequenceOfIncludedOpenTicketType();
+
+ for ( IIncludedOpenTicket ticket : tickets){
+
+ IncludedOpenTicketType asnTicket = encodeIncludedOpenTicket(ticket,issuingDate,travelClassType);
+ if (asnTicket!=null) {
+ asnList.add(asnTicket);
+ }
+ }
+
+ if (asnList.isEmpty()) {
+ return null;
+ }
+ return asnList;
+ }
+
+
+ /**
+ * Encode included open ticket.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @param classCode the class code
+ * @return the included open ticket type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private IncludedOpenTicketType encodeIncludedOpenTicket(IIncludedOpenTicket document, Date issuingDate, ITravelClassType classCode) throws EncodingFormatException {
+
+ if (document == null) return null;
+
+ 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()));
+
+
+ asnData.setInfoText(document.getInfoText());
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ 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)));
+
+ asnData.setValidityDates(document.getValidFrom(), document.getValidUntil(), issuingDate);
+
+ if (document.getValidFromUTCoffset() != null) {
+ asnData.setValidFromUTCOffset(document.getValidFromUTCoffset());
+ if (document.getValidUntilUTCoffset() != null && document.getValidUntilUTCoffset() != document.getValidFromUTCoffset()){
+ asnData.setValidUntilUTCOffset(document.getValidUntilUTCoffset());
+ }
+ }
+
+
+ if (document.getTariffs() != null && document.getTariffs().size() > 0){
+ asnData.setTariffs(encodeTariffCollection(document.getTariffs()));
+ }
+
+ if (document.getClassCode() != classCode){
+ asnData.setClassCode(convertTravelClass(document.getClassCode()));
+ }
+ if (document.getExternalIssuer() > 0) {
+ asnData.setExternalIssuerId(new Long(document.getExternalIssuer()));
+ }
+
+ if (document.getAuthorizationCode() > 0) {
+ asnData.setIssuerAutorizationId(new Long(document.getAuthorizationCode()));
+ }
+
+ if (document.getValidRegionList()!= null && document.getValidRegionList().size() > 0) {
+ asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
+ }
+
+ return asnData;
+ }
+
+ /**
+ * Encode return description.
+ *
+ * @param route the route
+ * @param issuingDate the issuing date
+ * @return the return route description type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private ReturnRouteDescriptionType encodeReturnDescription(IReturnRouteDescription route, Date issuingDate) throws EncodingFormatException {
+
+ if (route == null) return null;
+
+ ReturnRouteDescriptionType asnData = new ReturnRouteDescriptionType();
+
+ asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(route.getFromStation()));
+ asnData.setFromStationNum(UicEncoderUtils.getNum(route.getFromStation()));
+
+ asnData.setToStationIA5(UicEncoderUtils.getIA5NonNum(route.getToStation()));
+ asnData.setToStationNum(UicEncoderUtils.getNum(route.getToStation()));
+
+ asnData.setFromStationNameUTF8(route.getFromStationName());
+ asnData.setToStationNameUTF8(route.getToStationName());
+
+ if (route.getValidRegionList()!= null && route.getValidRegionList().size() > 0) {
+ asnData.setValidReturnRegion(encodeRegionCollection(route.getValidRegionList(), issuingDate));
+ }
+
+ if (route.getValidRegionDesc() != null && route.getValidRegionDesc().length() > 0){
+ asnData.setValidReturnRegionDesc(route.getValidRegionDesc());
+ }
+
+ return asnData;
+ }
+
+ /**
+ * Encode luggage.
+ *
+ * @param luggageRestriction the luggage restriction
+ * @return the luggage restriction type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private LuggageRestrictionType encodeLuggage(ILuggageRestriction luggageRestriction) throws EncodingFormatException {
+
+ if (luggageRestriction== null) return null;
+
+ LuggageRestrictionType asnData = new LuggageRestrictionType();
+
+ asnData.setMaxHandLuggagePieces(UicEncoderUtils.getRestrictedIntWithDefault(luggageRestriction.getMaxHandLuggagePieces(),1,99,3));
+
+ asnData.setMaxNonHandLuggagePieces(UicEncoderUtils.getRestrictedIntWithDefault(luggageRestriction.getMaxNonHandLuggagePieces(),1,99,1));
+
+ if (luggageRestriction.getRegisteredLuggage() != null && luggageRestriction.getRegisteredLuggage().size() > 0) {
+ asnData.setRegisteredLuggage(encodeRegisteredLuggage(luggageRestriction.getRegisteredLuggage()));
+ }
+
+ return asnData;
+ }
+
+ /**
+ * Encode registered luggage.
+ *
+ * @param registeredLuggage the registered luggage
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private SequenceOfRegisteredLuggageType encodeRegisteredLuggage(Collection<IRegisteredLuggage> registeredLuggage) throws EncodingFormatException {
+ if (registeredLuggage== null || registeredLuggage.isEmpty()) {
+ return null;
+ }
+ SequenceOfRegisteredLuggageType asnList = new SequenceOfRegisteredLuggageType();
+
+ for ( IRegisteredLuggage luggage : registeredLuggage){
+ RegisteredLuggageType asnLuggage = new RegisteredLuggageType();
+ asnLuggage.setMaxSize(UicEncoderUtils.getRestrictedInt(luggage.getMaxSize(),1,300));
+ asnLuggage.setMaxWeight(UicEncoderUtils.getRestrictedInt(luggage.getMaxWeight(),1,99));
+ asnLuggage.setRegistrationId(luggage.getRegistrationId());
+
+ asnList.add(asnLuggage);
+ }
+
+ if (asnList.isEmpty()){
+ return null;
+ }
+ return asnList;
+ }
+
+ /**
+ * Convert open ticket.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData convertOpenTicket(IOpenTicket document,Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+ OpenTicketData asnData = new OpenTicketData();
+ asnTicket.setOpenTicket(asnData);
+
+ asnDocument.setTicket(asnTicket);
+ asnTicket.setOpenTicket(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()));
+
+ asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ asnData.setInfoText(document.getInfoText());
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+ asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(document.getFromStation()));
+ asnData.setFromStationNum(UicEncoderUtils.getNum(document.getFromStation()));
+
+ asnData.setToStationIA5(UicEncoderUtils.getIA5NonNum(document.getToStation()));
+ asnData.setToStationNum(UicEncoderUtils.getNum(document.getToStation()));
+
+ asnData.setFromStationNameUTF8(document.getFromStationName());
+ asnData.setToStationNameUTF8(document.getToStationName());
+
+ asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getIncludedCarriers())));
+ asnData.setCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getIncludedCarriers()));
+
+ 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) {
+ asnData.setValidFromUTCOffset(document.getValidFromUTCoffset());
+ if (document.getValidUntilUTCoffset() != null && document.getValidUntilUTCoffset() != document.getValidFromUTCoffset()){
+ asnData.setValidUntilUTCOffset(document.getValidUntilUTCoffset());
+ }
+ }
+
+
+ asnData.setTariffs(encodeTariffCollection(document.getTariffs()));
+
+ asnData.setActivatedDays(document.getActivatedDays(),document.getValidFrom());
+
+ if (document.getClassCode() != ITravelClassType.second){
+ asnData.setClassCode(convertTravelClass(document.getClassCode()));
+ }
+ if (document.getExternalIssuer()>0) {
+ asnData.setExtIssuerId(new Long(document.getExternalIssuer()));
+ }
+
+ if (document.getAuthorizationCode()>0) {
+ asnData.setIssuerAutorizationId(new Long (document.getAuthorizationCode()));
+ }
+
+ if (document.getValidRegionList() != null && document.getValidRegionList().size() > 0) {
+ asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
+ }
+ asnData.setValidRegionDesc(document.getValidRegionDesc());
+
+ if (document.getIncludedAddOns() != null && document.getIncludedAddOns().size() > 0) {
+ asnData.setIncludedAddOns(encodeIncludedAddons(document.getIncludedAddOns(),issuingDate, document.getClassCode()));
+ }
+
+ if (document.getLuggageRestriction() != null) {
+ asnData.setLuggage(encodeLuggage(document.getLuggageRestriction()));
+ }
+
+ if (document.isReturnIncluded()) {
+ asnData.setReturnIncluded(true);
+ asnData.setReturnDescription(encodeReturnDescription(document.getReturnDescription(),issuingDate));
+ } else {
+ asnData.setReturnIncluded(false);
+ }
+
+ asnData.setPrice(document.getPrice());
+
+ if (document.getVatDetails() != null && !document.getVatDetails().isEmpty()){
+ for (IVatDetail vat : document.getVatDetails()) {
+ asnData.addVatDetail(encodeVatDetail(vat));
+ }
+ }
+
+
+ return asnDocument;
+ }
+
+ /**
+ * Convert counter mark.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData convertCounterMark(ICounterMark document, Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+ CountermarkData asnData = new CountermarkData();
+ asnDocument.getTicket().setCounterMark(asnData);
+
+ asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
+ asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
+
+
+ asnData.setTicketReferenceNum(UicEncoderUtils.getNum(document.getTicketReference()));
+ asnData.setTicketReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getTicketReference()));
+
+ asnData.setInfoText(document.getInfoText());
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+ asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(document.getFromStation()));
+ asnData.setFromStationNum(UicEncoderUtils.getNum(document.getFromStation()));
+
+ asnData.setToStationIA5(UicEncoderUtils.getIA5NonNum(document.getToStation()));
+ asnData.setToStationNum(UicEncoderUtils.getNum(document.getToStation()));
+
+ asnData.setFromStationNameUTF8(document.getFromStationName());
+ asnData.setToStationNameUTF8(document.getToStationName());
+
+ asnData.setValidityDates(document.getValidFrom(), document.getValidUntil(), issuingDate);
+
+ if (document.getValidFromUTCoffset() != null) {
+ asnData.setValidFromUTCOffset(document.getValidFromUTCoffset());
+ if (document.getValidUntilUTCoffset() != null && document.getValidUntilUTCoffset() != document.getValidFromUTCoffset()){
+ asnData.setValidUntilUTCOffset(document.getValidUntilUTCoffset());
+ }
+ }
+
+
+
+ asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ asnData.setInfoText(document.getInfoText());
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+ asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(document.getFromStation()));
+ asnData.setFromStationNum(UicEncoderUtils.getNum(document.getFromStation()));
+
+ asnData.setToStationIA5(UicEncoderUtils.getIA5NonNum(document.getToStation()));
+ asnData.setToStationNum(UicEncoderUtils.getNum(document.getToStation()));
+
+ asnData.setFromStationNameUTF8(document.getFromStationName());
+ asnData.setToStationNameUTF8(document.getToStationName());
+
+ asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getIncludedCarriers())));
+ asnData.setCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getIncludedCarriers()));
+
+ asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,32000)));
+ asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,32000)));
+
+ if (document.getValidRegionList() != null && document.getValidRegionList().size() > 0) {
+ asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
+ }
+ asnData.setValidRegionDesc(document.getValidRegionDesc());
+
+ if (document.getClassCode() != ITravelClassType.second){
+ asnData.setClassCode(convertTravelClass(document.getClassCode()));
+ }
+
+
+ if (document.isReturnIncluded()) {
+ asnData.setReturnIncluded(true);
+ if (document.getReturnDescription()!= null) {
+ asnData.setReturnDescription(encodeReturnDescription(document.getReturnDescription(),issuingDate));
+ }
+ } else {
+ asnData.setReturnIncluded(false);
+ }
+
+ return asnDocument;
+ }
+
+
+
+ /**
+ * Encode via station collection.
+ *
+ * @param stations the stations
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private SequenceOfViaStationType encodeViaStationCollection(Collection<IViaStation> stations) throws EncodingFormatException {
+ if (stations== null || stations.isEmpty()) {
+ return null;
+ }
+ SequenceOfViaStationType asnList = new SequenceOfViaStationType();
+
+ for ( IViaStation station : stations) {
+ ViaStationType asnData = encodeViaStation(station);
+ if (asnData != null) {
+ asnList.add(asnData);
+ }
+ }
+
+ if (asnList.isEmpty()) {
+ return null;
+ }
+
+ return asnList;
+ }
+
+
+ /**
+ * Encode via station.
+ *
+ * @param document the data
+ * @return the via station type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private ViaStationType encodeViaStation(IViaStation document) throws EncodingFormatException {
+ if (document == null) return null;
+
+ ViaStationType asnData =new ViaStationType();
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+ asnData.setStationIA5(UicEncoderUtils.getIA5NonNum(document.getStation()));
+ asnData.setStationNum(UicEncoderUtils.getNum(document.getStation()));
+
+ asnData.setAlternativeRoutes(encodeViaStationCollection(document.getAlternativeRoutes()));
+
+ if (document.isBorder()) {
+ asnData.setBorder(true);
+ } else {
+ asnData.setBorder(false);
+ }
+
+ asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
+ asnData.setCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
+
+ asnData.setRoute(encodeViaStationCollection(document.getRoute()));
+
+ if (document.getRouteId() > 0){
+ asnData.setSeriesId(new Long(document.getRouteId()));
+ }
+ return asnData;
+ }
+
+ /**
+ * Encode zone.
+ *
+ * @param data the data
+ * @return the zone type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private ZoneType encodeZone(IZone data) throws EncodingFormatException {
+ if (data == null) return null;
+
+ ZoneType asnData =new ZoneType();
+
+ if (data.getBinaryZoneId() != null && data.getBinaryZoneId().length > 0) {
+ asnData.setBinaryZoneId(data.getBinaryZoneId());
+ }
+ asnData.setCarrierNum(UicEncoderUtils.getNum(data.getCarrier()));
+ asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNum(data.getCarrier()));
+
+ if (data.getStationCodeTable() != IStationCodeTable.stationUIC && data.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(data.getStationCodeTable().name()));
+ }
+ asnData.setEntryStationIA5(UicEncoderUtils.getIA5NonNum(data.getEntryStation()));
+ asnData.setEntryStationNum(UicEncoderUtils.getNum(data.getEntryStation()));
+
+ asnData.setTerminatingStationIA5(UicEncoderUtils.getIA5NonNum(data.getTerminatingStation()));
+ asnData.setTerminatingStationNum(UicEncoderUtils.getNum(data.getTerminatingStation()));
+
+ asnData.setZoneId(SequenceOfUnrestrictedLong.getSequence(UicEncoderUtils.encodeIntegerCollection(data.getZoneIds())));
+
+ if (data.getCity() > 0) {
+ asnData.setCity(Asn1BigInteger.toAsn1(data.getCity()));
+ }
+
+ if (data.getNUTScode() != null && data.getNUTScode().length() > 0) {
+ asnData.setNutsCode(data.getNUTScode());
+ }
+
+ return asnData;
+ }
+
+
+
+
+
+ /**
+ * Encode train link.
+ *
+ * @param data the data
+ * @param issuingDate the issuing date
+ * @return the train link type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private TrainLinkType encodeTrainLink(ITrainLink data, Date issuingDate) throws EncodingFormatException {
+ if (data == null) return null;
+
+ TrainLinkType asnData =new TrainLinkType();
+
+ asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(data.getFromStation()));
+ asnData.setFromStationNum(UicEncoderUtils.getNum(data.getFromStation()));
+
+ asnData.setToStationIA5(UicEncoderUtils.getIA5NonNum(data.getToStation()));
+ asnData.setToStationNum(UicEncoderUtils.getNum(data.getToStation()));
+
+ asnData.setFromStationName(data.getFromStationName());
+ asnData.setToStationName(data.getToStationName());
+
+ asnData.setTrainIA5(UicEncoderUtils.getIA5NonNum(data.getTrain()));
+ asnData.setTrainNum(UicEncoderUtils.getNum(data.getTrain()));
+
+ asnData.setDepartureDate(data.getDepartureDateTime(), issuingDate);
+
+ return asnData;
+ }
+
+ /**
+ * Encode polygone.
+ *
+ * @param data the data
+ * @return the polygone type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private PolygoneType encodePolygone(IPolygone data) throws EncodingFormatException {
+ if (data == null) return null;
+ if (data.getEdges() == null || data.getEdges().isEmpty()) {
+ return null;
+ }
+
+ PolygoneType asnData = new PolygoneType();
+ SequenceOfDeltaCoordinates asnList = new SequenceOfDeltaCoordinates();
+
+ boolean firstEdge = true;
+
+ for ( IGeoCoordinate edge : data.getEdges()) {
+
+ if (firstEdge) {
+ asnData.setFirstEdge(encodeGeoCoordinate(edge));
+ firstEdge = false;
+ } else {
+ DeltaCoordinates delta = new DeltaCoordinates();
+ delta.setLatitude(Asn1BigInteger.toAsn1(asnData.getFirstEdge().getLatitude() - edge.getLatitude()));
+ delta.setLatitude(Asn1BigInteger.toAsn1(asnData.getFirstEdge().getLongitude() - edge.getLongitude()));
+ }
+
+ }
+ if (!asnList.isEmpty()) {
+ asnData.setEdges(asnList);
+ }
+ return asnData;
+ }
+
+ /**
+ * Encode line.
+ *
+ * @param data the data
+ * @return the line type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private LineType encodeLine(ILine data) throws EncodingFormatException {
+ if (data == null) return null;
+ LineType asnData =new LineType();
+
+ asnData.setBinaryZoneId(data.getBinaryZoneId());
+ asnData.setCarrierNum(UicEncoderUtils.getNum(data.getCarrier()));
+ asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNum(data.getCarrier()));
+ if (data.getStationCodeTable() != IStationCodeTable.stationUIC && data.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(data.getStationCodeTable().name()));
+ }
+ asnData.setEntryStationIA5(UicEncoderUtils.getIA5NonNum(data.getEntryStation()));
+ asnData.setEntryStationNum(UicEncoderUtils.getNum(data.getEntryStation()));
+
+ asnData.setTerminatingStationIA5(UicEncoderUtils.getIA5NonNum(data.getTerminatingStation()));
+ asnData.setTerminatingStationNum(UicEncoderUtils.getNum(data.getTerminatingStation()));
+
+ if (data.getCity() > 0) {
+ asnData.setCity(new Long(data.getCity()));
+ }
+
+ asnData.setLineId(SequenceOfUnrestrictedLong.getSequence(UicEncoderUtils.encodeIntegerCollection(data.getLineIds())));
+
+ return asnData;
+ }
+
+
+
+ /**
+ * Encode region collection.
+ *
+ * @param regionList the region list
+ * @param issuingDate the issuing date
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private SequenceOfRegionalValidityType encodeRegionCollection(Collection<IRegionalValidity> regionList, Date issuingDate) throws EncodingFormatException {
+
+ if (regionList == null || regionList.isEmpty()) {
+ return null;
+ }
+
+ SequenceOfRegionalValidityType asnList = new SequenceOfRegionalValidityType();
+
+ for ( IRegionalValidity region :regionList) {
+
+ RegionalValidityType asnRegion = new RegionalValidityType();
+
+ if (region instanceof ILine ) {
+ LineType line = encodeLine((ILine)region);
+ if (line == null){
+ break;
+ }
+ asnRegion.setLines(line);
+ asnList.add(asnRegion);
+ } else if (region instanceof IPolygone ) {
+ PolygoneType line = encodePolygone((IPolygone)region);
+ if (line == null){
+ break;
+ }
+ asnRegion.setPolygone(line);
+ asnList.add(asnRegion);
+ } else if (region instanceof ITrainLink ) {
+ TrainLinkType trainLink = encodeTrainLink((ITrainLink)region, issuingDate);
+ if (trainLink == null){
+ break;
+ }
+ asnRegion.setTrainLink(trainLink);
+ asnList.add(asnRegion);
+ } else if (region instanceof IViaStation ) {
+ ViaStationType viaStation = encodeViaStation((IViaStation)region);
+ if (viaStation == null){
+ break;
+ }
+ asnRegion.setViaStations(viaStation);
+ asnList.add(asnRegion);
+ } else if (region instanceof IZone ) {
+ ZoneType zone = encodeZone((IZone)region);
+ if (zone == null){
+ break;
+ }
+ asnRegion.setZones(zone);
+ asnList.add(asnRegion);
+ }
+
+ }
+
+ if (asnList.isEmpty()) {
+ return null;
+ }
+
+ return asnList;
+ }
+
+ /**
+ * Convert parking ground.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData convertParkingGround(IParkingGround document, Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+ ParkingGroundData asnData = new ParkingGroundData();
+ asnDocument.getTicket().setParkingGround(asnData);
+
+ asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
+ asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
+
+ asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+ asnData.setStationIA5(UicEncoderUtils.getIA5NonNum(document.getStation()));
+ asnData.setStationNum(UicEncoderUtils.getNum(document.getStation()));
+
+ asnData.setAccessCode(UicEncoderUtils.getIA5(document.getAccessCode()));
+ asnData.setEntryTrack(document.getEntryTrack());
+
+ if (document.getFromParkingDate() != null){
+ asnData.setParkingDates(document.getFromParkingDate(),document.getToParkingDate(),issuingDate);
+ }
+
+ asnData.setLocation(document.getLocation());
+ asnData.setNumberPlate(UicEncoderUtils.getIA5(document.getNumberPlate()));
+ asnData.setParkingGroundId(UicEncoderUtils.getIA5(document.getParkingGroundId()));
+ asnData.setSpecialInformation(document.getSpecialInformation());
+
+ asnData.setPrice(document.getPrice());
+
+ if (document.getVatDetails() != null && !document.getVatDetails().isEmpty()){
+ for (IVatDetail vat : document.getVatDetails()) {
+ asnData.addVatDetail(encodeVatDetail(vat));
+ }
+ }
+
+ return asnDocument;
+ }
+
+
+ /**
+ * Encode route section.
+ *
+ * @param document the route
+ * @return the route section type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private RouteSectionType encodeRouteSection(IRouteSection document) throws EncodingFormatException {
+
+ if (document == null) return null;
+
+ RouteSectionType asnRoute = new RouteSectionType();
+
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnRoute.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+ asnRoute.setFromStationIA5(UicEncoderUtils.getIA5NonNum(document.getFromStation()));
+ asnRoute.setFromStationNum(UicEncoderUtils.getNum(document.getFromStation()));
+
+ asnRoute.setToStationIA5(UicEncoderUtils.getIA5NonNum(document.getToStation()));
+ asnRoute.setToStationNum(UicEncoderUtils.getNum(document.getToStation()));
+
+ asnRoute.setFromStationNameUTF8(document.getFromStationName());
+ asnRoute.setToStationNameUTF8(document.getToStationName());
+
+
+ return asnRoute;
+ }
+
+ /**
+ * Encode tariff collection.
+ *
+ * @param tariffs the tariffs
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private SequenceOfTariffType encodeTariffCollection(Collection<ITariff> tariffs) throws EncodingFormatException {
+
+ if (tariffs== null || tariffs.isEmpty()) {
+ return null;
+ }
+
+ SequenceOfTariffType tariffList = new SequenceOfTariffType();
+
+ for (ITariff tariff :tariffs){
+
+ TariffType asnTariff = encodeTariff(tariff);
+
+ if (asnTariff != null) {
+ tariffList.add(asnTariff);
+ }
+ }
+
+ if (tariffList.isEmpty()) {
+ return null;
+ }
+
+ return tariffList;
+ }
+
+ /**
+ * Encode tariff.
+ *
+ * @param tariff the tariff
+ * @return the tariff type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private TariffType encodeTariff(ITariff tariff) throws EncodingFormatException {
+
+ if (tariff == null ) {
+ return null;
+ }
+
+ TariffType asnTariff = new TariffType();
+
+ asnTariff.setAgeAbove(UicEncoderUtils.getRestrictedInt(tariff.getAgeAbove(),2,120));
+ asnTariff.setAgeBelow(UicEncoderUtils.getRestrictedInt(tariff.getAgeBelow(),1,40));
+
+ asnTariff.setNumberOfPassengers(UicEncoderUtils.getRestrictedIntWithDefault(tariff.getNumberOfPassengers(),1,200,1));
+
+
+ try {
+ if (tariff.getPassengerType() != null) {
+ asnTariff.setPassengerType(PassengerType.valueOf(tariff.getPassengerType().name()));
+ }
+ } catch (Exception e){
+ //no value found
+ }
+
+
+ asnTariff.setReductionCard(encodeCardReferences(tariff.getReductionCards()));
+ asnTariff.setRestrictedToCountryOfResidence(tariff.isRestrictedToCountryOfResidence());
+ asnTariff.setRestrictedToRouteSection(encodeRouteSection(tariff.getRestrictedToRouteSection()));
+
+ if (tariff.getSeriesDataDetails()!= null) {
+ asnTariff.setSeriesDataDetails(encodeSeriesDataDetails(tariff.getSeriesDataDetails()));
+ }
+
+
+ asnTariff.setTariffDesc(tariff.getTariffDescription());
+ asnTariff.setTariffIdIA5(UicEncoderUtils.getIA5NonNum(tariff.getTariffId()));
+ asnTariff.setTariffIdNum(UicEncoderUtils.getNum(tariff.getTariffId()));
+
+ asnTariff.setTraverlerid(SequenceOfTravelerId.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(tariff.getTravelerIds(), 1, 254)));
+
+ return asnTariff;
+ }
+
+ private SeriesDetailType encodeSeriesDataDetails( ISeriesDataDetails seriesDataDetails) throws EncodingFormatException {
+ SeriesDetailType details = new SeriesDetailType();
+ 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;
+ }
+
+ /**
+ * Convert voucher.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData convertVoucher(IVoucher document, Date issuingDate) throws EncodingFormatException {
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+
+ 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()));
+
+ asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ asnData.setInfoText(document.getInfoText());
+
+ asnData.setValidity(document.getValidFrom(), document.getValidUntil());
+
+ asnData.setType(UicEncoderUtils.getRestrictedInt(document.getType(), 1,9999));
+
+ asnData.setValue(UicEncoderUtils.getRestrictedInt(document.getAmount(),1,9999999));
+
+ return asnDocument;
+ }
+
+ /**
+ * Convert pass.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData convertPass(IPass document, Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+ 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()));
+
+ asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ 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()));
+
+ asnData.setValidityDates(document.getValidFrom(), document.getValidUntil(), issuingDate);
+
+ if (document.getValidFromUTCoffset() != null) {
+ asnData.setValidFromUTCOffset(document.getValidFromUTCoffset());
+ if (document.getValidUntilUTCoffset() != null && document.getValidUntilUTCoffset() != document.getValidFromUTCoffset()){
+ asnData.setValidUntilUTCOffset(document.getValidUntilUTCoffset());
+ }
+ }
+
+
+ if(document.getActivatedDays()!= null && document.getActivatedDays().size() > 0) {
+ if (document.getValidFrom() != null) {
+ asnData.setActivatedDays(document.getActivatedDays(),document.getValidFrom());
+ } else {
+ asnData.setActivatedDays(document.getActivatedDays(),issuingDate);
+ }
+ }
+
+ asnData.setClassCode(convertTravelClass(document.getClassCode()));
+
+ if (document.getCountries() != null && document.getCountries().size() > 0){
+ asnData.setCountries(SequenceOfCountries.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getCountries(),1,250)));
+ }
+
+ asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,32000)));
+ asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,32000)));
+
+ asnData.setNumberOfDaysOfTravel(UicEncoderUtils.getRestrictedInt(document.getNumberOfDaysOfTravel(), 1, 93));
+ asnData.setNumberOfPossibleTrips(UicEncoderUtils.getRestrictedInt(document.getNumberOfPossibleTrips(), 1, 30));
+ asnData.setNumberOfValidityDays(UicEncoderUtils.getRestrictedInt(document.getNumberOfValidityDays(), 1, 370));
+ asnData.setPassDescription(document.getPassDescription());
+ if (document.getPassType() > 0 ){
+ asnData.setPassType(new Long(document.getPassType()));
+ }
+
+ asnData.setTariffs(encodeTariffCollection(document.getTariffs()));
+
+
+
+ if(document.getValidRegionList()!= null && document.getValidRegionList().size() > 0) {
+ asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
+ }
+
+ if (document.getValidityDetails() != null) {
+ asnData.setValidityPeriodDetails(encodeValidityDetails(document.getValidityDetails(), issuingDate));
+ }
+
+
+
+ asnData.setPrice(document.getPrice());
+
+ if (document.getVatDetails() != null && !document.getVatDetails().isEmpty()){
+ for (IVatDetail vat : document.getVatDetails()) {
+ asnData.addVatDetail(encodeVatDetail(vat));
+ }
+ }
+
+
+ return asnDocument;
+ }
+
+
+ private ValidityPeriodDetailType encodeValidityDetails( IValidityDetails validityDetails, Date referenceDate) throws EncodingFormatException {
+
+ if ( (validityDetails.getTimeRanges() == null || validityDetails.getTimeRanges().isEmpty())
+ ||
+ (validityDetails.getValidityRanges() == null || validityDetails.getValidityRanges().isEmpty()) ) {
+ return null;
+ }
+
+
+ ValidityPeriodDetailType asnData = new ValidityPeriodDetailType();
+
+ if (validityDetails.getTimeRanges() != null) {
+ for (ITimeRange range : validityDetails.getTimeRanges()) {
+
+ if (range.getFromTime() == range.getUntilTime()){
+ break;
+ }
+
+ TimeRangeType asnRange = new TimeRangeType();
+ asnRange.setFromTime(new Long(range.getFromTime()));
+ asnRange.setUntilTime(new Long(range.getUntilTime()));
+
+ asnData.getExcludedTimeRange().add(asnRange);
+ }
+ }
+
+ if (validityDetails.getValidityRanges() != null) {
+ for (IValidityRange range : validityDetails.getValidityRanges()) {
+
+ ValidityPeriodType asnRange = new ValidityPeriodType();
+
+ asnRange.setValidityDates(range.getFromDate(), range.getUntilDate(), referenceDate);
+
+ if (range.getValidFromUTCoffset() != null) {
+ asnRange.setValidFromUTCOffset(range.getValidFromUTCoffset());
+ if (range.getValidUntilUTCoffset() != null && range.getValidUntilUTCoffset() != range.getValidFromUTCoffset()){
+ asnRange.setValidUntilUTCOffset(range.getValidUntilUTCoffset());
+ }
+ }
+
+
+ asnData.getValidityPeriod().add(asnRange);
+ }
+ }
+
+ return asnData;
+ }
+
+ /**
+ * Convert fip ticket.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData convertFipTicket(IFipTicket document, Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+
+ 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()));
+
+ 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()));
+
+ asnData.setClassCode(convertTravelClass(document.getClassCode()));
+
+ if (!document.isIncludesSupplements()){
+ asnData.setIncludesSupplements(false);
+ }
+ asnData.setNumberOfTravelDays(UicEncoderUtils.getRestrictedInt(document.getNumberOfTravelDates(), 1, 8));
+
+ asnData.setValidityDates(document.getValidFrom(), document.getValidUntil(), issuingDate);
+
+ if(document.getActivatedDays()!= null && document.getActivatedDays().size() > 0) {
+ asnData.setActivatedDays(document.getActivatedDays(), document.getValidFrom());
+ }
+
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ return asnDocument;
+ }
+
+ /**
+ * Convert station passage.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData convertStationPassage(IStationPassage document,Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+ 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()));
+
+ asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ if (document.getNumberOfdaysAllowed() > 0) {
+ asnData.setNumberOfDaysValid(new Long(document.getNumberOfdaysAllowed()));
+ }
+
+ asnData.setProductName(document.getProductName());
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+
+ if (document.getStations()!= null && !document.getStations().isEmpty()){
+ SequenceOfStringIA5 stationsIA5 = new SequenceOfStringIA5();
+ SequenceOfUnrestrictedLong stationsNum = new SequenceOfUnrestrictedLong();
+
+ for (String station : document.getStations()) {
+ String ia5 = UicEncoderUtils.getIA5NonNum(station);
+ Long num = UicEncoderUtils.getNum(station);
+ if (ia5 != null && ia5.length() > 0) {
+ stationsIA5.add(ia5);
+ }
+ if (num != null && num > 0){
+ stationsNum.add(num);
+ }
+ }
+ if (!stationsIA5.isEmpty()){
+ asnData.setStationIA5(stationsIA5);
+ }
+ if (!stationsNum.isEmpty()){
+ asnData.setStationNum(stationsNum);
+ }
+ }
+
+ if (document.getStationNames()!= null && !document.getStationNames().isEmpty()) {
+
+ SequenceOfStringUTF8 asnList = new SequenceOfStringUTF8();
+ for ( String text :document.getStationNames()){
+ if (text.length() > 0) {
+ asnList.add(text);
+ }
+ }
+
+ if (!asnList.isEmpty()) {
+ asnData.setStationNameUTF8(asnList);
+ }
+
+ }
+
+ asnData.setValidityDates(document.getValidFrom(), document.getValidUntil(), issuingDate);
+
+ if (document.getValidFromUTCoffset() != null) {
+ asnData.setValidFromUTCOffset(document.getValidFromUTCoffset());
+ if (document.getValidUntilUTCoffset() != null && document.getValidUntilUTCoffset() != document.getValidFromUTCoffset()){
+ asnData.setValidUntilUTCOffset(document.getValidUntilUTCoffset());
+ }
+ }
+
+
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ asnData.setAreaCodeNum(SequenceOfUnrestrictedLong.getSequence(UicEncoderUtils.getNumList(document.getAreaCodes())));
+ asnData.setAreaCodeIA5(UicEncoderUtils.getIA5NonNumList(document.getAreaCodes()));
+
+ asnData.setAreaNameUTF8(UicEncoderUtils.encodeStringCollection(document.getAreaNames()));
+
+ return asnDocument;
+ }
+
+
+ /**
+ * Encode control details.
+ *
+ * @param data the data
+ * @param issuingDate the issuing date
+ * @return the control data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private ControlData encodeControlDetails(IControlDetail data, Date issuingDate) throws EncodingFormatException {
+
+ if (data == null) return null;
+
+ ControlData asnData = new ControlData();
+
+ asnData.setExtension(encodeExtension(data.getExtension()));
+
+ if (data.isAgeCheckRequired()) {
+ asnData.setAgeCheckRequired(true);
+ } else {
+ asnData.setAgeCheckRequired(false);
+ }
+
+ if (data.isIdentificationByIdCard()){
+ asnData.setIdentificationByIdCard(true);
+ } else {
+ asnData.setIdentificationByIdCard(false);
+ }
+
+ if (data.isIdentificationByPassportId()){
+ asnData.setIdentificationByPassportId(true);
+ } else {
+ asnData.setIdentificationByPassportId(false);
+ }
+
+ if (data.isOnlineValidationRequired()){
+ asnData.setOnlineValidationRequired(true);
+ } else {
+ asnData.setOnlineValidationRequired(false);
+ }
+
+ if (data.isPassportValidationRequired()){
+ asnData.setPassportValidationRequired(true);
+ } else {
+ asnData.setPassportValidationRequired(false);
+ }
+
+ if (data.isReductionCardCheckRequired()){
+ asnData.setReductionCardCheckRequired(true);
+ } else {
+ asnData.setReductionCardCheckRequired(false);
+ }
+
+ asnData.setInfoText(data.getInfoText());
+
+ asnData.setRandomDetailedValidationRequired(UicEncoderUtils.getRestrictedInt(data.getRandomDetailedValidationRequired(), 0,99));
+
+ asnData.setIdentificationItem(UicEncoderUtils.getUnRestrictedInt(data.getIdentificationItem()));
+
+ asnData.setIncludedTickets(encodeTicketLickList(data.getLinkedTickets()));
+
+ asnData.setIdentificationByCardReference(encodeCardReferences(data.getIdentificationByCardReference()));
+
+ return asnData;
+ }
+
+
+
+ /**
+ * Encode card references.
+ *
+ * @param cardReferences the card references
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private SequenceOfCardReferenceType encodeCardReferences(Collection<ICardReference> cardReferences) throws EncodingFormatException {
+
+ if (cardReferences == null || cardReferences.isEmpty()) return null;
+
+ SequenceOfCardReferenceType asnList = new SequenceOfCardReferenceType();
+
+ for (ICardReference card : cardReferences){
+
+ CardReferenceType asnCard = new CardReferenceType();
+
+ if (card.getCardId() != null && card.getCardId().length() > 0){
+ //only longs allowed
+ try {
+ long num = Long.parseLong(card.getCardId());
+ asnCard.setCardIdNum(num);
+ } catch (Exception e ){
+ asnCard.setCardIdIA5(card.getCardId());
+ }
+ }
+
+
+ asnCard.setCardIssuerNum(UicEncoderUtils.getNum(card.getCardIssuer()));
+ asnCard.setCardIssuerIA5(UicEncoderUtils.getIA5NonNum(card.getCardIssuer()));
+ asnCard.setCardName(card.getCardName());
+ asnCard.setCardType(UicEncoderUtils.getUnRestrictedInt(card.getCardType()));
+
+ asnCard.setLeadingCardIdNum(UicEncoderUtils.getNum(card.getLeadingCardId()));
+ asnCard.setLeadingCardIdIA5(UicEncoderUtils.getIA5NonNum(card.getLeadingCardId()));
+
+ asnCard.setTrailingCardIdNum(UicEncoderUtils.getNum(card.getTrailingCardId()));
+ asnCard.setTrailingCardIdIA5(UicEncoderUtils.getIA5NonNum(card.getTrailingCardId()));
+
+ asnList.add(asnCard);
+
+ }
+
+
+ if (asnList.isEmpty()) return null;
+
+ return asnList;
+ }
+
+ /**
+ * Encode ticket lick list.
+ *
+ * @param linkedTickets the linked tickets
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private SequenceOfTicketLinkType encodeTicketLickList(Collection<ITicketLink> linkedTickets) throws EncodingFormatException {
+
+ if (linkedTickets == null || linkedTickets.isEmpty()) return null;
+
+ SequenceOfTicketLinkType asnList = new SequenceOfTicketLinkType();
+
+ 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()));
+ }
+
+ asnList.add(asnTicket);
+ }
+
+ if (asnList.isEmpty()) return null;
+
+ return asnList;
+ }
+
+ /**
+ * Encode travelers.
+ *
+ * @param data the data
+ * @param issuingDate the issuing date
+ * @return the traveler data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private TravelerData encodeTravelers(ITravelerDetail data,Date issuingDate) throws EncodingFormatException {
+
+ if (data == null) return null;
+
+ TravelerData asnData = new TravelerData();
+
+ asnData.setGroupName(data.getGroupName());
+
+ asnData.setPreferedLanguage(data.getPreferredLanguage());
+
+ if (data.getTravelers()!=null && !data.getTravelers().isEmpty()) {
+
+ SequenceOfTravelerType asnTravelers = new SequenceOfTravelerType();
+
+ for (ITraveler traveler : data.getTravelers()){
+
+ TravelerType asnTraveler = encodeTraveler(traveler);
+
+ if (asnTraveler !=null){
+ asnTravelers.add(asnTraveler);
+ }
+ }
+
+ if (!asnTravelers.isEmpty()) {
+ asnData.setTraveler(asnTravelers);
+ }
+
+ }
+
+ return asnData;
+ }
+
+ /**
+ * Encode issuing details.
+ *
+ * @param data the data
+ * @return the issuing data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private IssuingData encodeIssuingDetails(IIssuingDetail data) throws EncodingFormatException {
+
+ if (data == null){
+ throw new EncodingFormatException("Issuind data missing");
+ }
+
+ IssuingData asnData = new IssuingData();
+
+ if (!data.isActivated()){
+ asnData.setActivated(false);
+ } else {
+ asnData.setActivated(true);
+ }
+
+ if (!data.isSecurePaperTicket()) {
+ asnData.setSecurePaperTicket(false);
+ } else {
+ asnData.setSecurePaperTicket(true);
+ }
+
+ asnData.setExtension(encodeExtension(data.getExtension()));
+
+
+ asnData.setIssuedOnLine(UicEncoderUtils.getRestrictedInt(data.getIssuedOnLine(), 1, 99999));
+
+ asnData.setIssuedOnTrainNum(UicEncoderUtils.getNum(data.getIssuedOnTrain()));
+ asnData.setIssuedOnTrainIA5(UicEncoderUtils.getIA5NonNum(data.getIssuedOnTrain()));
+
+ if (data.getSecurityProvider() != null) {
+ asnData.setSecurityProviderNum(UicEncoderUtils.getNum(data.getSecurityProvider()));
+ data.setSecurityProvider(data.getIssuer());
+ } else {
+ asnData.setSecurityProviderNum(UicEncoderUtils.getNum(data.getIssuer()));
+ }
+
+ if (data.getIssuer()!= null && !data.getIssuer().equals(data.getSecurityProvider()) ){
+ asnData.setIssuerNum(UicEncoderUtils.getNum(data.getIssuer()));
+ asnData.setIssuerIA5(UicEncoderUtils.getIA5NonNum(data.getIssuer()));
+ }
+
+ asnData.setIssuerName(data.getIssuerName());
+ asnData.setIssuerPNR(UicEncoderUtils.getIA5(data.getIssuerPNR()));
+
+
+ asnData.setIssuingDate(data.getIssuingDate());
+
+ if (data.isSpecimen()){
+ asnData.setSpecimen(true);
+ } else {
+ asnData.setSpecimen(false);
+ }
+
+ if (data.getPointOfSale()!= null){
+ asnData.setPointOfSale(encodeGeoCoordinate(data.getPointOfSale()));
+ }
+
+ return asnData;
+ }
+
+ /**
+ * Encode geo coordinate.
+ *
+ * @param point the point
+ * @return the geo coordinate type
+ */
+ private GeoCoordinateType encodeGeoCoordinate(IGeoCoordinate point) {
+
+ if (point == null) return null;
+
+ GeoCoordinateType asnPoint = new GeoCoordinateType();
+
+ asnPoint.setLatitude(point.getLatitude());
+ asnPoint.setLongitude(point.getLongitude());
+
+ if (point.getUnit() != IGeoUnitType.milliDegree && point.getUnit() != null){
+ asnPoint.setGeoUnit(GeoUnitType.valueOf(point.getUnit().name()));
+ }
+
+ if (point.getAccuracy() != null) {
+ asnPoint.setAccuracy(GeoUnitType.valueOf(point.getAccuracy().name()));
+ }
+
+ if (point.getHemisphereLatitude() != IHemisphereLatitudeType.east && point.getHemisphereLatitude() != null) {
+ asnPoint.setHemisphereLatitude(HemisphereLatitudeType.valueOf(point.getHemisphereLatitude().name()));
+ }
+
+ if (point.getHemisphereLongitude() != IHemisphereLongitudeType.north && point.getHemisphereLongitude() != null) {
+ asnPoint.setHemisphereLongitude(HemisphereLongitudeType.valueOf(point.getHemisphereLongitude().name()));
+ }
+
+ if (point.getSystem() != IGeoCoordinateSystemType.wgs84 && point.getSystem() != null){
+ asnPoint.setCoordinateSystem(GeoCoordinateSystemType.valueOf(point.getSystem().name()));
+ }
+
+ return asnPoint;
+ }
+
+ /**
+ * Encode customer card.
+ *
+ * @param document the customer card
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData encodeCustomerCard(ICustomerCard document,Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+ CustomerCardData asnData = new CustomerCardData();
+ asnDocument.getTicket().setCustomerCard(asnData);
+
+
+ if (document.getCardId() != null && document.getCardId().length() > 0){
+ //only longs allowed
+ try {
+ long num = Long.parseLong(document.getCardId());
+ asnData.setCardIdNum(num);
+ } catch (Exception e ){
+ asnData.setCardIdIA5(document.getCardId());
+ }
+ }
+
+
+ asnData.setCardType(UicEncoderUtils.getRestrictedInt(document.getCardType(),1,1000));
+
+ asnData.setCardTypeDescr(document.getCardTypeDescr());
+
+ asnData.setClassCode(convertTravelClass(document.getClassCode()));
+
+ if (document.getCustomer()!=null){
+ asnData.setCustomer(encodeTraveler(document.getCustomer()));
+ }
+
+ asnData.setCustomerStatus(UicEncoderUtils.getUnRestrictedInt(document.getCustomerStatus()));
+
+ asnData.setCustomerStatusDescr(document.getCustomerStatusDescr());
+
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ asnData.setIncludedServices(SequenceOfUnrestrictedLong.getSequence(UicEncoderUtils.getUnRestrictedIntList(document.getIncludedServices())));
+
+ asnData.setValidity(document.getValidFrom(), document.getValidUntil());
+
+ return asnDocument;
+ }
+
+ private TokenType encodeToken(IToken token) throws EncodingFormatException {
+ TokenType asnToken = new TokenType();
+ asnToken.setToken(token.getToken());
+ asnToken.setTokenProviderNum(UicEncoderUtils.getNum(token.getTokenProvider()));
+ asnToken.setTokenProviderIA5(UicEncoderUtils.getIA5NonNum(token.getTokenProvider()));
+ asnToken.setTokenSpecification(token.getTokenSpecification());
+ return asnToken;
+ }
+
+
+
+
+ private VatDetailType encodeVatDetail(IVatDetail vatDetail) {
+
+ if (vatDetail == null) return null;
+
+ VatDetailType asnVatDetail = new VatDetailType();
+
+ asnVatDetail.setAmount(vatDetail.getAmount());
+ asnVatDetail.setCountry(new Long(vatDetail.getCountry()));
+ asnVatDetail.setPercentage(new Long(vatDetail.getPercentage()));
+ asnVatDetail.setVatId(vatDetail.getVatId());
+
+ return asnVatDetail;
+
+ }
+
+ /**
+ * Encode traveler.
+ *
+ * @param traveler the traveler
+ * @return the traveler type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private TravelerType encodeTraveler(ITraveler traveler) throws EncodingFormatException {
+
+ if (traveler == null) return null;
+
+ TravelerType asnTraveler = new TravelerType();
+
+ asnTraveler.setCountryOfResidence(UicEncoderUtils.getRestrictedInt(traveler.getCountryOfResidence(), 1, 999));
+ asnTraveler.setCountryOfPassport(UicEncoderUtils.getRestrictedInt(traveler.getPassportCountry(), 1, 999));
+ asnTraveler.setCountryOfIdCard(UicEncoderUtils.getRestrictedInt(traveler.getIDCardCountry(), 1, 999));
+
+
+ asnTraveler.setCustomerIdNum(UicEncoderUtils.getNum(traveler.getCustomerId()));
+ asnTraveler.setCustomerIdIA5(UicEncoderUtils.getIA5NonNum(traveler.getCustomerId()));
+
+ asnTraveler.setDateOfBirth(traveler.getDateOfBirth());
+
+ asnTraveler.setFirstName(traveler.getFirstName());
+ asnTraveler.setSecondName(traveler.getSecondName());
+ asnTraveler.setLastName(traveler.getLastName());
+ if (traveler.getGender() != null) {
+ asnTraveler.setGender(GenderType.valueOf(traveler.getGender().name()));
+ }
+ asnTraveler.setIdCard(UicEncoderUtils.getIA5(traveler.getIdCard()));
+ asnTraveler.setPassportId(UicEncoderUtils.getIA5(traveler.getPassportId()));
+ asnTraveler.setTitle(UicEncoderUtils.getIA5(traveler.getTitle()));
+
+ if (traveler.getPassengerType() != null) {
+ asnTraveler.setPassengerType(PassengerType.valueOf(traveler.getPassengerType().name()));
+ }
+
+ asnTraveler.setPassengerWithReducedMobility(traveler.isPassengerWithReducedMobility());
+ if (traveler.isTicketHolder()){
+ asnTraveler.setTicketHolder(true);
+ } else {
+ asnTraveler.setTicketHolder(false);
+ }
+
+ if (traveler.getStatusCollection()!= null && !traveler.getStatusCollection().isEmpty()){
+
+ SequenceOfCustomerStatusType asnList = new SequenceOfCustomerStatusType();
+
+ for (ICustomerStatusDescription status : traveler.getStatusCollection() ) {
+ asnList.add(mapCustomerStatusType(status));
+ }
+ if (!asnList.isEmpty()) {
+ asnTraveler.setStatus(asnList);
+ }
+ }
+
+
+ return asnTraveler;
+ }
+
+ /**
+ * Map customer status type.
+ *
+ * @param status the status
+ * @return the customer status type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private CustomerStatusType mapCustomerStatusType(ICustomerStatusDescription status) throws EncodingFormatException {
+
+ CustomerStatusType asnStatus = new CustomerStatusType();
+
+ if (status.getStatus() > 0) {
+ asnStatus.setCustomerStatus(new Long(status.getStatus()));
+ }
+ asnStatus.setCustomerStatusDescr(status.getDescription());
+ asnStatus.setStatusProviderIA5(UicEncoderUtils.getIA5NonNum(status.getStatusProvider()));
+ asnStatus.setStatusProviderNum(UicEncoderUtils.getNum(status.getStatusProvider()));
+
+ return asnStatus;
+ }
+
+ /**
+ * Encode extension.
+ *
+ * @param extension the extension
+ * @return the extension data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private ExtensionData encodeExtension(IExtension extension) throws EncodingFormatException {
+
+ if (extension==null) return null;
+
+ if (extension.getBinarydata() == null || extension.getBinarydata().length == 0) {
+ throw new EncodingFormatException("Extension does not include data");
+ }
+
+ if (extension.getId() == null || extension.getId().length() == 0) {
+ throw new EncodingFormatException("Extension does not include id");
+ }
+
+ ExtensionData asnExtension = new ExtensionData();
+
+ asnExtension.setExtensionData(extension.getBinarydata());
+ asnExtension.setExtensionId(UicEncoderUtils.getIA5(extension.getId()));
+
+ return asnExtension;
+ }
+
+ private TravelClassType convertTravelClass(ITravelClassType apiClass){
+
+ if (apiClass == null) return null;
+
+ if (apiClass == ITravelClassType.premiumFirst || apiClass == ITravelClassType.standardFirst){
+ return TravelClassType.first;
+ }
+
+ if (apiClass == ITravelClassType.premiumSecond || apiClass == ITravelClassType.standardSecond){
+ return TravelClassType.second;
+ }
+
+
+ return TravelClassType.valueOf(apiClass.name());
+
+
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java b/src/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java new file mode 100644 index 0000000..97abcfa --- /dev/null +++ b/src/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java @@ -0,0 +1,2301 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.utils;
+
+import java.util.Collection;
+import java.util.Date;
+
+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.ticket.EncodingFormatException;
+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.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.DeltaCoordinates;
+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.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.SequenceOfCustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv2.SequenceOfDeltaCoordinates;
+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.SequenceOfRegionalValidityType;
+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.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.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.TravelerType;
+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;
+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.IControlDetail;
+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.IExtension;
+import org.uic.barcode.ticket.api.spec.IFipTicket;
+import org.uic.barcode.ticket.api.spec.IGeoCoordinate;
+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.IIssuingDetail;
+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.ILuggageRestriction;
+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.IPlaces;
+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.IReturnRouteDescription;
+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.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.IToken;
+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.ITravelerDetail;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.api.spec.IValidityDetails;
+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;
+
+/**
+ * The Class Api2OpenAsnEncoder.
+ */
+public class Api2OpenAsnEncoderV2 {
+
+ /**
+ * encode to asn1 model.
+ *
+ * @param uicTicket the uic ticket
+ * @return the encoded byte array
+ * @throws EncodingFormatException the encoding format exception
+ */
+ public byte[] encode(IUicRailTicket uicTicket) throws EncodingFormatException {
+
+ UicRailTicketData asnUicRailTicketData = populateToAsn1Model(uicTicket);
+
+ return asnUicRailTicketData.encode();
+
+ }
+
+
+ /**
+ * Populate asn1 model.
+ *
+ * @param uicTicket the uic ticket
+ * @return the org.uic.ticket.asn.om. uic rail ticket data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ public UicRailTicketData populateToAsn1Model(IUicRailTicket uicTicket) throws EncodingFormatException {
+
+ UicRailTicketData asnTicket = new UicRailTicketData();
+
+ if (uicTicket.getIssuerDetails() != null) {
+ asnTicket.setIssuingDetail(encodeIssuingDetails(uicTicket.getIssuerDetails()));
+ }
+
+
+ if (uicTicket.getControlDetails() != null) {
+ asnTicket.setControlDetail(encodeControlDetails(uicTicket.getControlDetails(), uicTicket.getIssuerDetails().getIssuingDate()));
+ }
+
+
+ if (uicTicket.getExtensions() != null && !uicTicket.getExtensions().isEmpty()){
+
+ SequenceOfExtensionData asnList = new SequenceOfExtensionData();
+ for (IExtension extension : uicTicket.getExtensions()){
+ ExtensionData asnExtension = encodeExtension(extension);
+ if (asnExtension!= null) {
+ asnList.add(asnExtension);
+ }
+ }
+ if (!asnList.isEmpty()){
+ asnTicket.setExtension(asnList);
+ }
+
+
+ }
+
+
+ if (uicTicket.getTravelerDetails() != null) {
+ asnTicket.setTravelerDetail(encodeTravelers(uicTicket.getTravelerDetails(),uicTicket.getIssuerDetails().getIssuingDate() ));
+ }
+
+ if (uicTicket.getDocumentData() != null && !uicTicket.getDocumentData().isEmpty()) {
+
+ SequenceOfDocumentData documents = new SequenceOfDocumentData();
+
+ for (IDocumentData document : uicTicket.getDocumentData()){
+
+ DocumentData asnDocument = null;
+
+ if (document instanceof IReservation) {
+ asnDocument = convertReservation((IReservation) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+ if (document instanceof IOpenTicket) {
+ asnDocument = convertOpenTicket((IOpenTicket) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+ if (document instanceof ICarCarriageReservation) {
+ asnDocument = convertCarCarriageReservation((ICarCarriageReservation) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+ if (document instanceof IFipTicket) {
+ asnDocument = convertFipTicket((IFipTicket) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+ if (document instanceof IPass) {
+ asnDocument = convertPass((IPass) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+ if (document instanceof IVoucher) {
+ asnDocument = convertVoucher((IVoucher) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+ if (document instanceof ICounterMark) {
+ asnDocument = convertCounterMark((ICounterMark) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+ if (document instanceof IParkingGround) {
+ asnDocument = convertParkingGround((IParkingGround) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+ if (document instanceof IStationPassage) {
+ asnDocument = convertStationPassage((IStationPassage) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+ if (document instanceof ICustomerCard) {
+ asnDocument = encodeCustomerCard((ICustomerCard) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+
+ if (document instanceof IDelayConfirmation) {
+ asnDocument = encodeDelayConfirmation((IDelayConfirmation) document , uicTicket.getIssuerDetails().getIssuingDate());
+ }
+
+
+ if (asnDocument!= null && document.getToken()!= null) {
+ asnDocument.setToken(encodeToken(document.getToken()));
+ }
+
+ if (asnDocument != null) {
+ documents.add(asnDocument);
+ }
+ }
+ asnTicket.setTransportDocument(documents);
+ }
+
+
+ return asnTicket;
+ }
+
+ private DocumentData encodeDelayConfirmation(IDelayConfirmation document, Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+ DelayConfirmation asnData = new DelayConfirmation();
+ asnDocument.getTicket().setDelayConfirmation(asnData);
+
+ asnData.setTrainIA5(UicEncoderUtils.getIA5NonNum(document.getTrain()));
+ asnData.setTrainNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getTrain())));
+
+ asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+ asnData.setStationIA5(UicEncoderUtils.getIA5NonNum(document.getStation()));
+ asnData.setStationNum(UicEncoderUtils.getNum(document.getStation()));
+
+
+ asnData.setPlannedArrivalDate(document.getArrivalDate());
+ asnData.setDepartureUTCOffset(document.getArrivalUTCoffset());
+
+ asnData.setAffectedTickets(encodeTicketLickList(document.getLinkedTickets()));
+
+ asnData.setConfirmationType(ConfirmationTypeType.values()[document.getConfirmationType()]);
+
+ asnData.setDelay(new Long(document.getDelay()));
+
+ asnData.setTrainCancelled(document.isTrainCancelled());
+
+
+ asnData.setInfoText(document.getInfoText());
+
+ asnData.setStationNameUTF8(document.getStationName());
+
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ return asnDocument;
+ }
+
+
+ /**
+ * Convert car carriage reservation.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData convertCarCarriageReservation( ICarCarriageReservation document, Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+ CarCarriageReservationData asnData = new CarCarriageReservationData();
+ asnDocument.getTicket().setCarCarriageReservation(asnData);
+
+ 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.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUICReservation && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+ asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
+ asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
+
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ asnData.setCompartmentDetails(encodeCompartmentDetails(document.getCompartmentDetails()));
+
+
+ if (document.getPriceType()!= IPriceTypeType.travelPrice && document.getPriceType() != null){
+ asnData.setPriceType(PriceTypeType.valueOf(document.getPriceType().name()));
+ }
+
+
+ if (document.getServiceBrand()!= null) {
+ asnData.setServiceBrand(UicEncoderUtils.getRestrictedInt(document.getServiceBrand().getServiceBrand(),1,9999));
+ asnData.setServiceBrandAbrUTF8(document.getServiceBrand().getServiceBrandAbbreviation());
+ asnData.setServiceBrandNameUTF8(document.getServiceBrand().getServiceBrandDescription());
+
+ }
+ if (document.getStationCodeTable() != IStationCodeTable.stationUICReservation && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+ asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(document.getFromStation()));
+ asnData.setFromStationNum(UicEncoderUtils.getNum(document.getFromStation()));
+
+ asnData.setToStationIA5(UicEncoderUtils.getIA5NonNum(document.getToStation()));
+ asnData.setToStationNum(UicEncoderUtils.getNum(document.getToStation()));
+
+ asnData.setFromStationNameUTF8(document.getFromStationName());
+ asnData.setToStationNameUTF8(document.getToStationName());
+
+
+ asnData.setAttachedBicycles(UicEncoderUtils.getRestrictedInt(document.getAttachedBicycles(),1,5));
+ asnData.setAttachedBoats(UicEncoderUtils.getRestrictedInt(document.getAttachedBoats(),1,2));
+ asnData.setAttachedSurfboards(UicEncoderUtils.getRestrictedInt(document.getAttachedSurfboards(),1,5));
+
+ if (document.getLoadingDeck() != ILoadingDeckType.upper && document.getLoadingDeck() != null){
+ asnData.setLoadingDeck(LoadingDeckType.valueOf(document.getLoadingDeck().name()));
+ }
+
+ asnData.setLoadingListEntry(UicEncoderUtils.getRestrictedInt(document.getAttachedSurfboards(),1,200));
+
+ asnData.setBoatCategory(UicEncoderUtils.getRestrictedInt(document.getBoatCategory(),1,6));
+ asnData.setCarCategory(UicEncoderUtils.getRestrictedInt(document.getCarCategory(),1,9));
+ asnData.setCoach(UicEncoderUtils.getIA5(document.getCoach()));
+
+ asnData.setRoofRackHeight(UicEncoderUtils.getRestrictedInt(document.getRoofRackHeight(),1,99));
+
+ if (document.getRoofRackType()!= IRoofRackType.norack && document.getRoofRackType() != null) {
+ asnData.setRoofRackType(RoofRackType.valueOf(document.getRoofRackType().name()));
+ }
+
+ if (document.getTariff() != null) {
+ asnData.setTariff(encodeTariff(document.getTariff()));
+ }
+ asnData.setNumberPlate(UicEncoderUtils.getIA5(document.getNumberPlate()));
+ asnData.setPlace(UicEncoderUtils.getIA5(document.getPlace()));
+
+ if (document.isTextileRoof() ) {
+ asnData.setTextileRoof(true);
+ } else {
+ asnData.setTextileRoof(false);
+ }
+
+ asnData.setTrailerPlate(UicEncoderUtils.getIA5(document.getTrailerPlate()));
+
+ asnData.setLoadingDates(document.getBeginLoading(),document.getEndLoading(), issuingDate);
+
+ asnData.setLoadingUTCOffset(document.getLoadingTimeUTCoffset());
+
+ asnData.setPrice(document.getPrice());
+
+ if (document.getVatDetails() != null && !document.getVatDetails().isEmpty()){
+ for (IVatDetail vat : document.getVatDetails()) {
+ asnData.addVatDetail(encodeVatDetail(vat));
+ }
+ }
+
+
+ return asnDocument;
+ }
+
+
+ /**
+ * Encode places.
+ *
+ * @param places the places
+ * @return the places type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private PlacesType encodePlaces(IPlaces places) throws EncodingFormatException {
+
+ if (places == null) {
+ return null;
+ }
+
+ PlacesType asnData = new PlacesType();
+
+ 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()));
+
+ return asnData;
+ }
+
+
+ /**
+ * Encode compartment details.
+ *
+ * @param compartmentDetails the compartment details
+ * @return the compartment details type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private CompartmentDetailsType encodeCompartmentDetails(ICompartmentDetails compartmentDetails) throws EncodingFormatException {
+
+ if (compartmentDetails == null) {
+ return null;
+ }
+ CompartmentDetailsType asnData = new CompartmentDetailsType();
+
+ asnData.setCoachType(UicEncoderUtils.getRestrictedInt(compartmentDetails.getCoachType(), 1,99));
+ asnData.setCoachTypeDescr(compartmentDetails.getCoachTypeDescr());
+ asnData.setCompartmentType(UicEncoderUtils.getRestrictedInt(compartmentDetails.getCompartmentType(), 1,99));
+ asnData.setCompartmentTypeDescr(compartmentDetails.getCompartmentTypeDescr());
+ asnData.setSpecialAllocation(UicEncoderUtils.getRestrictedInt(compartmentDetails.getSpecialAllocation(), 1,99));
+ asnData.setSpecialAllocationDescr(compartmentDetails.getSpecialAllocationDescr());
+
+ return asnData;
+ }
+
+ /**
+ * Encode berths.
+ *
+ * @param berths the berths
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private SequenceOfBerthDetailData encodeBerths(Collection<IBerth> berths) throws EncodingFormatException {
+
+ if (berths == null || berths.isEmpty()) {
+ return null;
+ }
+ SequenceOfBerthDetailData asnList = new SequenceOfBerthDetailData();
+
+ for ( IBerth berth : berths){
+ BerthDetailData asnBerth = new BerthDetailData();
+
+ if (berth.getType() != null) {
+ asnBerth.setBerthType(BerthTypeType.valueOf(berth.getType().name()));
+ }
+
+ if (berth.getGender()!= ICompartmentGenderType.family && berth.getGender() != null) {
+ asnBerth.setGender(CompartmentGenderType.valueOf(berth.getGender().name()));
+ }
+
+ asnBerth.setNumberOfBerths(UicEncoderUtils.getRestrictedInt(berth.getNumberOfBerths(), 1 , 999 ));
+
+ asnList.add(asnBerth);
+ }
+
+ if (asnList.isEmpty()) {
+ return null;
+ }
+ return asnList;
+ }
+
+ /**
+ * Convert reservation.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData convertReservation(IReservation document, Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+ ReservationData asnData = new ReservationData();
+ asnDocument.getTicket().setReservation(asnData);
+
+ asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
+ asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
+
+ 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()));
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUICReservation && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+ asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(document.getFromStation()));
+ asnData.setFromStationNum(UicEncoderUtils.getNum(document.getFromStation()));
+
+ asnData.setToStationIA5(UicEncoderUtils.getIA5NonNum(document.getToStation()));
+ asnData.setToStationNum(UicEncoderUtils.getNum(document.getToStation()));
+
+ asnData.setFromStationNameUTF8(document.getFromStationName());
+ asnData.setToStationNameUTF8(document.getToStationName());
+
+ asnData.setTrainIA5(UicEncoderUtils.getIA5NonNum(document.getTrain()));
+ asnData.setTrainNum(UicEncoderUtils.getNum(document.getTrain()));
+
+ asnData.setTariff(encodeTariffCollection(document.getTariffs()));
+
+ asnData.setDepartureArrivalDates(document.getDepartureDate(),document.getArrivalDate(), issuingDate);
+
+ if (document.getDepartureUTCoffset() != null) {
+ asnData.setDepartureUTCOffset(document.getDepartureUTCoffset());
+ if (document.getArrivalUTCoffset() != null && document.getArrivalUTCoffset() != document.getDepartureUTCoffset()){
+ asnData.setArrivalUTCOffset(document.getArrivalUTCoffset());
+ }
+ }
+
+
+
+ if (document.getClassCode() != ITravelClassType.second && document.getClassCode() != null){
+ asnData.setClassCode(TravelClassType.valueOf(document.getClassCode().name()));
+ }
+
+ asnData.setBerth(encodeBerths(document.getBerths()));
+
+ asnData.setCompartmentDetails(encodeCompartmentDetails(document.getCompartmentDetails()));
+
+ asnData.setLuggage(encodeLuggage(document.getLuggageRestriction()));
+
+ asnData.setNumberOfOverbooked(UicEncoderUtils.getRestrictedInt(document.getNumberOfOverbooked(), 1, 200));
+ asnData.setNumberOfSupplements(UicEncoderUtils.getRestrictedInt(document.getNumberOfSupplements(), 1, 200));
+
+ if (document.getPriceType()!= IPriceTypeType.travelPrice && document.getPriceType() != null){
+ asnData.setPriceType(PriceTypeType.valueOf(document.getPriceType().name()));
+ }
+ asnData.setTypeOfSupplement(UicEncoderUtils.getRestrictedInt(document.getTypeOfSupplement(), 1, 9));
+
+ asnData.setPlaces(encodePlaces(document.getPlaces()));
+ asnData.setBicyclePlaces(encodePlaces(document.getBicyclePlaces()));
+
+
+ if (document.getService() != IServiceType.seat && document.getService() != null) {
+ asnData.setService(ServiceType.valueOf(document.getService().name()));
+ }
+
+ if (document.getServiceBrand()!= null) {
+ asnData.setServiceBrand(UicEncoderUtils.getRestrictedInt(document.getServiceBrand().getServiceBrand(),1,9999));
+ asnData.setServiceBrandAbrUTF8(document.getServiceBrand().getServiceBrandAbbreviation());
+ asnData.setServiceBrandNameUTF8(document.getServiceBrand().getServiceBrandDescription());
+
+ }
+
+ if (document.getServiceLevel() != null && document.getServiceLevel().length() > 2) {
+ throw new EncodingFormatException("Service level too long");
+ }
+ asnData.setServiceLevel(UicEncoderUtils.getIA5(document.getServiceLevel()));
+
+ asnData.setPrice(document.getPrice());
+
+ if (document.getVatDetails() != null && !document.getVatDetails().isEmpty()){
+ for (IVatDetail vat : document.getVatDetails()) {
+ asnData.addVatDetail(encodeVatDetail(vat));
+ }
+ }
+
+ return asnDocument;
+ }
+
+ /**
+ * Encode included addons.
+ *
+ * @param tickets the tickets
+ * @param issuingDate the issuing date
+ * @param classCode the class code
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private SequenceOfIncludedOpenTicketType encodeIncludedAddons(Collection<IIncludedOpenTicket> tickets, Date issuingDate, ITravelClassType classCode) throws EncodingFormatException {
+
+ if (tickets == null || tickets.isEmpty()) {
+ return null;
+ }
+ SequenceOfIncludedOpenTicketType asnList = new SequenceOfIncludedOpenTicketType();
+
+ for ( IIncludedOpenTicket ticket : tickets){
+
+ IncludedOpenTicketType asnTicket = encodeIncludedOpenTicket(ticket,issuingDate,classCode);
+ if (asnTicket!=null) {
+ asnList.add(asnTicket);
+ }
+ }
+
+ if (asnList.isEmpty()) {
+ return null;
+ }
+ return asnList;
+ }
+
+
+ /**
+ * Encode included open ticket.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @param classCode the class code
+ * @return the included open ticket type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private IncludedOpenTicketType encodeIncludedOpenTicket(IIncludedOpenTicket document, Date issuingDate, ITravelClassType classCode) throws EncodingFormatException {
+
+ if (document == null) return null;
+
+ 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()));
+
+
+ asnData.setInfoText(document.getInfoText());
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ 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)));
+
+ asnData.setExcludedTransportTypes(SequenceOfTransportTypes.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedTransportTypes(),0,31)));
+ asnData.setIncludedTransportTypes(SequenceOfTransportTypes.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedTransportTypes(),0,31)));
+
+
+ asnData.setValidityDates(document.getValidFrom(), document.getValidUntil(), issuingDate);
+
+ if (document.getValidFromUTCoffset() != null) {
+ asnData.setValidFromUTCOffset(document.getValidFromUTCoffset());
+ if (document.getValidUntilUTCoffset() != null && document.getValidUntilUTCoffset() != document.getValidFromUTCoffset()){
+ asnData.setValidUntilUTCOffset(document.getValidUntilUTCoffset());
+ }
+ }
+
+
+ if (document.getTariffs() != null && document.getTariffs().size() > 0){
+ asnData.setTariffs(encodeTariffCollection(document.getTariffs()));
+ }
+
+ if (document.getClassCode() != classCode && document.getClassCode() != null){
+ asnData.setClassCode(TravelClassType.valueOf(document.getClassCode().name()));
+ }
+ if (document.getExternalIssuer() > 0) {
+ asnData.setExternalIssuerId(new Long(document.getExternalIssuer()));
+ }
+
+ if (document.getAuthorizationCode() > 0) {
+ asnData.setIssuerAutorizationId(new Long(document.getAuthorizationCode()));
+ }
+
+ if (document.getValidRegionList()!= null && document.getValidRegionList().size() > 0) {
+ asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
+ }
+
+ return asnData;
+ }
+
+ /**
+ * Encode return description.
+ *
+ * @param route the route
+ * @param issuingDate the issuing date
+ * @return the return route description type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private ReturnRouteDescriptionType encodeReturnDescription(IReturnRouteDescription route, Date issuingDate) throws EncodingFormatException {
+
+ if (route == null) return null;
+
+ ReturnRouteDescriptionType asnData = new ReturnRouteDescriptionType();
+
+ asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(route.getFromStation()));
+ asnData.setFromStationNum(UicEncoderUtils.getNum(route.getFromStation()));
+
+ asnData.setToStationIA5(UicEncoderUtils.getIA5NonNum(route.getToStation()));
+ asnData.setToStationNum(UicEncoderUtils.getNum(route.getToStation()));
+
+ asnData.setFromStationNameUTF8(route.getFromStationName());
+ asnData.setToStationNameUTF8(route.getToStationName());
+
+ if (route.getValidRegionList()!= null && route.getValidRegionList().size() > 0) {
+ asnData.setValidReturnRegion(encodeRegionCollection(route.getValidRegionList(), issuingDate));
+ }
+
+ if (route.getValidRegionDesc() != null && route.getValidRegionDesc().length() > 0){
+ asnData.setValidReturnRegionDesc(route.getValidRegionDesc());
+ }
+
+ return asnData;
+ }
+
+ /**
+ * Encode luggage.
+ *
+ * @param luggageRestriction the luggage restriction
+ * @return the luggage restriction type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private LuggageRestrictionType encodeLuggage(ILuggageRestriction luggageRestriction) throws EncodingFormatException {
+
+ if (luggageRestriction== null) return null;
+
+ LuggageRestrictionType asnData = new LuggageRestrictionType();
+
+ asnData.setMaxHandLuggagePieces(UicEncoderUtils.getRestrictedIntWithDefault(luggageRestriction.getMaxHandLuggagePieces(),1,99,3));
+
+ asnData.setMaxNonHandLuggagePieces(UicEncoderUtils.getRestrictedIntWithDefault(luggageRestriction.getMaxNonHandLuggagePieces(),1,99,1));
+
+ if (luggageRestriction.getRegisteredLuggage() != null && luggageRestriction.getRegisteredLuggage().size() > 0) {
+ asnData.setRegisteredLuggage(encodeRegisteredLuggage(luggageRestriction.getRegisteredLuggage()));
+ }
+
+ return asnData;
+ }
+
+ /**
+ * Encode registered luggage.
+ *
+ * @param registeredLuggage the registered luggage
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private SequenceOfRegisteredLuggageType encodeRegisteredLuggage(Collection<IRegisteredLuggage> registeredLuggage) throws EncodingFormatException {
+ if (registeredLuggage== null || registeredLuggage.isEmpty()) {
+ return null;
+ }
+ SequenceOfRegisteredLuggageType asnList = new SequenceOfRegisteredLuggageType();
+
+ for ( IRegisteredLuggage luggage : registeredLuggage){
+ RegisteredLuggageType asnLuggage = new RegisteredLuggageType();
+ asnLuggage.setMaxSize(UicEncoderUtils.getRestrictedInt(luggage.getMaxSize(),1,300));
+ asnLuggage.setMaxWeight(UicEncoderUtils.getRestrictedInt(luggage.getMaxWeight(),1,99));
+ asnLuggage.setRegistrationId(luggage.getRegistrationId());
+
+ asnList.add(asnLuggage);
+ }
+
+ if (asnList.isEmpty()){
+ return null;
+ }
+ return asnList;
+ }
+
+ /**
+ * Convert open ticket.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData convertOpenTicket(IOpenTicket document,Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+ OpenTicketData asnData = new OpenTicketData();
+ asnTicket.setOpenTicket(asnData);
+
+ asnDocument.setTicket(asnTicket);
+ asnTicket.setOpenTicket(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()));
+
+ asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ asnData.setInfoText(document.getInfoText());
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+ asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(document.getFromStation()));
+ asnData.setFromStationNum(UicEncoderUtils.getNum(document.getFromStation()));
+
+ asnData.setToStationIA5(UicEncoderUtils.getIA5NonNum(document.getToStation()));
+ asnData.setToStationNum(UicEncoderUtils.getNum(document.getToStation()));
+
+ asnData.setFromStationNameUTF8(document.getFromStationName());
+ asnData.setToStationNameUTF8(document.getToStationName());
+
+ asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getIncludedCarriers())));
+ asnData.setCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getIncludedCarriers()));
+
+ 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)));
+
+
+ asnData.setValidityDates(document.getValidFrom(), document.getValidUntil(), issuingDate);
+
+ if (document.getValidFromUTCoffset() != null) {
+ asnData.setValidFromUTCOffset(document.getValidFromUTCoffset());
+ if (document.getValidUntilUTCoffset() != null && document.getValidUntilUTCoffset() != document.getValidFromUTCoffset()){
+ asnData.setValidUntilUTCOffset(document.getValidUntilUTCoffset());
+ }
+ }
+
+
+ asnData.setTariffs(encodeTariffCollection(document.getTariffs()));
+
+ asnData.setActivatedDays(document.getActivatedDays(),document.getValidFrom());
+
+ if (document.getClassCode() != ITravelClassType.second && document.getClassCode() != null){
+ asnData.setClassCode(TravelClassType.valueOf(document.getClassCode().name()));
+ }
+ if (document.getExternalIssuer()>0) {
+ asnData.setExtIssuerId(new Long(document.getExternalIssuer()));
+ }
+
+ if (document.getAuthorizationCode()>0) {
+ asnData.setIssuerAutorizationId(new Long (document.getAuthorizationCode()));
+ }
+
+ if (document.getValidRegionList() != null && document.getValidRegionList().size() > 0) {
+ asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
+ }
+ asnData.setValidRegionDesc(document.getValidRegionDesc());
+
+ if (document.getIncludedAddOns() != null && document.getIncludedAddOns().size() > 0) {
+ asnData.setIncludedAddOns(encodeIncludedAddons(document.getIncludedAddOns(),issuingDate, document.getClassCode()));
+ }
+
+ if (document.getLuggageRestriction() != null) {
+ asnData.setLuggage(encodeLuggage(document.getLuggageRestriction()));
+ }
+
+ if (document.isReturnIncluded()) {
+ asnData.setReturnIncluded(true);
+ asnData.setReturnDescription(encodeReturnDescription(document.getReturnDescription(),issuingDate));
+ } else {
+ asnData.setReturnIncluded(false);
+ }
+
+ asnData.setPrice(document.getPrice());
+
+ if (document.getVatDetails() != null && !document.getVatDetails().isEmpty()){
+ for (IVatDetail vat : document.getVatDetails()) {
+ asnData.addVatDetail(encodeVatDetail(vat));
+ }
+ }
+
+
+ return asnDocument;
+ }
+
+ /**
+ * Convert counter mark.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData convertCounterMark(ICounterMark document, Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+ CountermarkData asnData = new CountermarkData();
+ asnDocument.getTicket().setCounterMark(asnData);
+
+ asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
+ asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
+
+
+ asnData.setTicketReferenceNum(UicEncoderUtils.getNum(document.getTicketReference()));
+ asnData.setTicketReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getTicketReference()));
+
+ asnData.setInfoText(document.getInfoText());
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+ asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(document.getFromStation()));
+ asnData.setFromStationNum(UicEncoderUtils.getNum(document.getFromStation()));
+
+ asnData.setToStationIA5(UicEncoderUtils.getIA5NonNum(document.getToStation()));
+ asnData.setToStationNum(UicEncoderUtils.getNum(document.getToStation()));
+
+ asnData.setFromStationNameUTF8(document.getFromStationName());
+ asnData.setToStationNameUTF8(document.getToStationName());
+
+ asnData.setValidityDates(document.getValidFrom(), document.getValidUntil(), issuingDate);
+
+ if (document.getValidFromUTCoffset() != null) {
+ asnData.setValidFromUTCOffset(document.getValidFromUTCoffset());
+ if (document.getValidUntilUTCoffset() != null && document.getValidUntilUTCoffset() != document.getValidFromUTCoffset()){
+ asnData.setValidUntilUTCOffset(document.getValidUntilUTCoffset());
+ }
+ }
+
+
+
+ asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ asnData.setInfoText(document.getInfoText());
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+ asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(document.getFromStation()));
+ asnData.setFromStationNum(UicEncoderUtils.getNum(document.getFromStation()));
+
+ asnData.setToStationIA5(UicEncoderUtils.getIA5NonNum(document.getToStation()));
+ asnData.setToStationNum(UicEncoderUtils.getNum(document.getToStation()));
+
+ asnData.setFromStationNameUTF8(document.getFromStationName());
+ asnData.setToStationNameUTF8(document.getToStationName());
+
+ asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getIncludedCarriers())));
+ asnData.setCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getIncludedCarriers()));
+
+ asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,32000)));
+ asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,32000)));
+
+ if (document.getValidRegionList() != null && document.getValidRegionList().size() > 0) {
+ asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
+ }
+ asnData.setValidRegionDesc(document.getValidRegionDesc());
+
+ if (document.getClassCode() != ITravelClassType.second && document.getClassCode() != null){
+ asnData.setClassCode(TravelClassType.valueOf(document.getClassCode().name()));
+ }
+
+
+ if (document.isReturnIncluded()) {
+ asnData.setReturnIncluded(true);
+ if (document.getReturnDescription()!= null) {
+ asnData.setReturnDescription(encodeReturnDescription(document.getReturnDescription(),issuingDate));
+ }
+ } else {
+ asnData.setReturnIncluded(false);
+ }
+
+ return asnDocument;
+ }
+
+
+
+ /**
+ * Encode via station collection.
+ *
+ * @param stations the stations
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private SequenceOfViaStationType encodeViaStationCollection(Collection<IViaStation> stations) throws EncodingFormatException {
+ if (stations== null || stations.isEmpty()) {
+ return null;
+ }
+ SequenceOfViaStationType asnList = new SequenceOfViaStationType();
+
+ for ( IViaStation station : stations) {
+ ViaStationType asnData = encodeViaStation(station);
+ if (asnData != null) {
+ asnList.add(asnData);
+ }
+ }
+
+ if (asnList.isEmpty()) {
+ return null;
+ }
+
+ return asnList;
+ }
+
+
+ /**
+ * Encode via station.
+ *
+ * @param document the data
+ * @return the via station type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private ViaStationType encodeViaStation(IViaStation document) throws EncodingFormatException {
+ if (document == null) return null;
+
+ ViaStationType asnData =new ViaStationType();
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+ asnData.setStationIA5(UicEncoderUtils.getIA5NonNum(document.getStation()));
+ asnData.setStationNum(UicEncoderUtils.getNum(document.getStation()));
+
+ asnData.setAlternativeRoutes(encodeViaStationCollection(document.getAlternativeRoutes()));
+
+ if (document.isBorder()) {
+ asnData.setBorder(true);
+ } else {
+ asnData.setBorder(false);
+ }
+
+ asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
+ asnData.setCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
+
+ asnData.setRoute(encodeViaStationCollection(document.getRoute()));
+
+ if (document.getRouteId() > 0){
+ asnData.setSeriesId(new Long(document.getRouteId()));
+ }
+ return asnData;
+ }
+
+ /**
+ * Encode zone.
+ *
+ * @param document the data
+ * @return the zone type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private ZoneType encodeZone(IZone document) throws EncodingFormatException {
+ if (document == null) return null;
+
+ ZoneType asnData =new ZoneType();
+
+ if (document.getBinaryZoneId() != null && document.getBinaryZoneId().length > 0) {
+ asnData.setBinaryZoneId(document.getBinaryZoneId());
+ }
+ asnData.setCarrierNum(UicEncoderUtils.getNum(document.getCarrier()));
+ asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNum(document.getCarrier()));
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+ asnData.setEntryStationIA5(UicEncoderUtils.getIA5NonNum(document.getEntryStation()));
+ asnData.setEntryStationNum(UicEncoderUtils.getNum(document.getEntryStation()));
+
+ asnData.setTerminatingStationIA5(UicEncoderUtils.getIA5NonNum(document.getTerminatingStation()));
+ asnData.setTerminatingStationNum(UicEncoderUtils.getNum(document.getTerminatingStation()));
+
+ asnData.setZoneId(SequenceOfUnrestrictedLong.getSequence(UicEncoderUtils.encodeIntegerCollection(document.getZoneIds())));
+
+ if (document.getCity() > 0) {
+ asnData.setCity(Asn1BigInteger.toAsn1(document.getCity()));
+ }
+
+ if (document.getNUTScode() != null && document.getNUTScode().length() > 0) {
+ asnData.setNutsCode(document.getNUTScode());
+ }
+
+ return asnData;
+ }
+
+
+
+
+
+ /**
+ * Encode train link.
+ *
+ * @param data the data
+ * @param issuingDate the issuing date
+ * @return the train link type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private TrainLinkType encodeTrainLink(ITrainLink data, Date issuingDate) throws EncodingFormatException {
+ if (data == null) return null;
+
+ TrainLinkType asnData =new TrainLinkType();
+
+ asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(data.getFromStation()));
+ asnData.setFromStationNum(UicEncoderUtils.getNum(data.getFromStation()));
+
+ asnData.setToStationIA5(UicEncoderUtils.getIA5NonNum(data.getToStation()));
+ asnData.setToStationNum(UicEncoderUtils.getNum(data.getToStation()));
+
+ asnData.setFromStationName(data.getFromStationName());
+ asnData.setToStationName(data.getToStationName());
+
+ asnData.setTrainIA5(UicEncoderUtils.getIA5NonNum(data.getTrain()));
+ asnData.setTrainNum(UicEncoderUtils.getNum(data.getTrain()));
+
+ asnData.setDepartureDate(data.getDepartureDateTime(), issuingDate);
+
+ return asnData;
+ }
+
+ /**
+ * Encode polygone.
+ *
+ * @param data the data
+ * @return the polygone type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private PolygoneType encodePolygone(IPolygone data) throws EncodingFormatException {
+ if (data == null) return null;
+ if (data.getEdges() == null || data.getEdges().isEmpty()) {
+ return null;
+ }
+
+ PolygoneType asnData = new PolygoneType();
+ SequenceOfDeltaCoordinates asnList = new SequenceOfDeltaCoordinates();
+
+ boolean firstEdge = true;
+
+ for ( IGeoCoordinate edge : data.getEdges()) {
+
+ if (firstEdge) {
+ asnData.setFirstEdge(encodeGeoCoordinate(edge));
+ firstEdge = false;
+ } else {
+ DeltaCoordinates delta = new DeltaCoordinates();
+ delta.setLatitude(Asn1BigInteger.toAsn1(asnData.getFirstEdge().getLatitude() - edge.getLatitude()));
+ delta.setLatitude(Asn1BigInteger.toAsn1(asnData.getFirstEdge().getLongitude() - edge.getLongitude()));
+ }
+
+ }
+ if (!asnList.isEmpty()) {
+ asnData.setEdges(asnList);
+ }
+ return asnData;
+ }
+
+ /**
+ * Encode line.
+ *
+ * @param document the data
+ * @return the line type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private LineType encodeLine(ILine document) throws EncodingFormatException {
+ if (document == null) return null;
+ LineType asnData =new LineType();
+
+ asnData.setBinaryZoneId(document.getBinaryZoneId());
+ asnData.setCarrierNum(UicEncoderUtils.getNum(document.getCarrier()));
+ asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNum(document.getCarrier()));
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+ asnData.setEntryStationIA5(UicEncoderUtils.getIA5NonNum(document.getEntryStation()));
+ asnData.setEntryStationNum(UicEncoderUtils.getNum(document.getEntryStation()));
+
+ asnData.setTerminatingStationIA5(UicEncoderUtils.getIA5NonNum(document.getTerminatingStation()));
+ asnData.setTerminatingStationNum(UicEncoderUtils.getNum(document.getTerminatingStation()));
+
+ if (document.getCity() > 0) {
+ asnData.setCity(new Long(document.getCity()));
+ }
+
+ asnData.setLineId(SequenceOfUnrestrictedLong.getSequence(UicEncoderUtils.encodeIntegerCollection(document.getLineIds())));
+
+ return asnData;
+ }
+
+
+
+ /**
+ * Encode region collection.
+ *
+ * @param regionList the region list
+ * @param issuingDate the issuing date
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private SequenceOfRegionalValidityType encodeRegionCollection(Collection<IRegionalValidity> regionList, Date issuingDate) throws EncodingFormatException {
+
+ if (regionList == null || regionList.isEmpty()) {
+ return null;
+ }
+
+ SequenceOfRegionalValidityType asnList = new SequenceOfRegionalValidityType();
+
+ for ( IRegionalValidity region :regionList) {
+
+ RegionalValidityType asnRegion = new RegionalValidityType();
+
+ if (region instanceof ILine ) {
+ LineType line = encodeLine((ILine)region);
+ if (line == null){
+ break;
+ }
+ asnRegion.setLines(line);
+ asnList.add(asnRegion);
+ } else if (region instanceof IPolygone ) {
+ PolygoneType line = encodePolygone((IPolygone)region);
+ if (line == null){
+ break;
+ }
+ asnRegion.setPolygone(line);
+ asnList.add(asnRegion);
+ } else if (region instanceof ITrainLink ) {
+ TrainLinkType trainLink = encodeTrainLink((ITrainLink)region, issuingDate);
+ if (trainLink == null){
+ break;
+ }
+ asnRegion.setTrainLink(trainLink);
+ asnList.add(asnRegion);
+ } else if (region instanceof IViaStation ) {
+ ViaStationType viaStation = encodeViaStation((IViaStation)region);
+ if (viaStation == null){
+ break;
+ }
+ asnRegion.setViaStations(viaStation);
+ asnList.add(asnRegion);
+ } else if (region instanceof IZone ) {
+ ZoneType zone = encodeZone((IZone)region);
+ if (zone == null){
+ break;
+ }
+ asnRegion.setZones(zone);
+ asnList.add(asnRegion);
+ }
+
+ }
+
+ if (asnList.isEmpty()) {
+ return null;
+ }
+
+ return asnList;
+ }
+
+ /**
+ * Convert parking ground.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData convertParkingGround(IParkingGround document, Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+ ParkingGroundData asnData = new ParkingGroundData();
+ asnDocument.getTicket().setParkingGround(asnData);
+
+ asnData.setProductOwnerNum(UicEncoderUtils.getNum(document.getProductOwner()));
+ asnData.setProductOwnerIA5(UicEncoderUtils.getIA5NonNum(document.getProductOwner()));
+
+ asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+ asnData.setStationIA5(UicEncoderUtils.getIA5NonNum(document.getStation()));
+ asnData.setStationNum(UicEncoderUtils.getNum(document.getStation()));
+
+ asnData.setAccessCode(UicEncoderUtils.getIA5(document.getAccessCode()));
+ asnData.setEntryTrack(document.getEntryTrack());
+
+ if (document.getFromParkingDate() != null){
+ asnData.setParkingDates(document.getFromParkingDate(),document.getToParkingDate(),issuingDate);
+ }
+
+ asnData.setLocation(document.getLocation());
+ asnData.setNumberPlate(UicEncoderUtils.getIA5(document.getNumberPlate()));
+ asnData.setParkingGroundId(UicEncoderUtils.getIA5(document.getParkingGroundId()));
+ asnData.setSpecialInformation(document.getSpecialInformation());
+
+ asnData.setPrice(document.getPrice());
+
+ if (document.getVatDetails() != null && !document.getVatDetails().isEmpty()){
+ for (IVatDetail vat : document.getVatDetails()) {
+ asnData.addVatDetail(encodeVatDetail(vat));
+ }
+ }
+
+ return asnDocument;
+ }
+
+
+ /**
+ * Encode route section.
+ *
+ * @param document the route
+ * @return the route section type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private RouteSectionType encodeRouteSection(IRouteSection document) throws EncodingFormatException {
+
+ if (document == null) return null;
+
+ RouteSectionType asnRoute = new RouteSectionType();
+
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnRoute.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+ asnRoute.setFromStationIA5(UicEncoderUtils.getIA5NonNum(document.getFromStation()));
+ asnRoute.setFromStationNum(UicEncoderUtils.getNum(document.getFromStation()));
+
+ asnRoute.setToStationIA5(UicEncoderUtils.getIA5NonNum(document.getToStation()));
+ asnRoute.setToStationNum(UicEncoderUtils.getNum(document.getToStation()));
+
+ asnRoute.setFromStationNameUTF8(document.getFromStationName());
+ asnRoute.setToStationNameUTF8(document.getToStationName());
+
+
+ return asnRoute;
+ }
+
+ /**
+ * Encode tariff collection.
+ *
+ * @param tariffs the tariffs
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private SequenceOfTariffType encodeTariffCollection(Collection<ITariff> tariffs) throws EncodingFormatException {
+
+ if (tariffs== null || tariffs.isEmpty()) {
+ return null;
+ }
+
+ SequenceOfTariffType tariffList = new SequenceOfTariffType();
+
+ for (ITariff tariff :tariffs){
+
+ TariffType asnTariff = encodeTariff(tariff);
+
+ if (asnTariff != null) {
+ tariffList.add(asnTariff);
+ }
+ }
+
+ if (tariffList.isEmpty()) {
+ return null;
+ }
+
+ return tariffList;
+ }
+
+ /**
+ * Encode tariff.
+ *
+ * @param tariff the tariff
+ * @return the tariff type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private TariffType encodeTariff(ITariff tariff) throws EncodingFormatException {
+
+ if (tariff == null ) {
+ return null;
+ }
+
+ TariffType asnTariff = new TariffType();
+
+ asnTariff.setAgeAbove(UicEncoderUtils.getRestrictedInt(tariff.getAgeAbove(),2,120));
+ asnTariff.setAgeBelow(UicEncoderUtils.getRestrictedInt(tariff.getAgeBelow(),1,40));
+
+ asnTariff.setNumberOfPassengers(UicEncoderUtils.getRestrictedIntWithDefault(tariff.getNumberOfPassengers(),1,200,1));
+
+
+ try {
+ if (tariff.getPassengerType() != null) {
+ asnTariff.setPassengerType(PassengerType.valueOf(tariff.getPassengerType().name()));
+ }
+ } catch (Exception e){
+ //no value found
+ }
+
+
+ asnTariff.setReductionCard(encodeCardReferences(tariff.getReductionCards()));
+ asnTariff.setRestrictedToCountryOfResidence(tariff.isRestrictedToCountryOfResidence());
+ asnTariff.setRestrictedToRouteSection(encodeRouteSection(tariff.getRestrictedToRouteSection()));
+
+ if (tariff.getSeriesDataDetails()!= null) {
+ asnTariff.setSeriesDataDetails(encodeSeriesDataDetails(tariff.getSeriesDataDetails()));
+ }
+
+
+ asnTariff.setTariffDesc(tariff.getTariffDescription());
+ asnTariff.setTariffIdIA5(UicEncoderUtils.getIA5NonNum(tariff.getTariffId()));
+ asnTariff.setTariffIdNum(UicEncoderUtils.getNum(tariff.getTariffId()));
+
+ asnTariff.setTraverlerid(SequenceOfTravelerId.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(tariff.getTravelerIds(), 1, 254)));
+
+ return asnTariff;
+ }
+
+ private SeriesDetailType encodeSeriesDataDetails( ISeriesDataDetails seriesDataDetails) throws EncodingFormatException {
+ SeriesDetailType details = new SeriesDetailType();
+ 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;
+ }
+
+ /**
+ * Convert voucher.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData convertVoucher(IVoucher document, Date issuingDate) throws EncodingFormatException {
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+
+ 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()));
+
+ asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ asnData.setInfoText(document.getInfoText());
+
+ asnData.setValidity(document.getValidFrom(), document.getValidUntil());
+
+ asnData.setType(UicEncoderUtils.getRestrictedInt(document.getType(), 1,9999));
+
+ asnData.setValue(UicEncoderUtils.getRestrictedInt(document.getAmount(),1,9999999));
+
+ return asnDocument;
+ }
+
+ /**
+ * Convert pass.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData convertPass(IPass document, Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+ 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()));
+
+ asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ 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()));
+
+ asnData.setValidityDates(document.getValidFrom(), document.getValidUntil(), issuingDate);
+
+ if (document.getValidFromUTCoffset() != null) {
+ asnData.setValidFromUTCOffset(document.getValidFromUTCoffset());
+ if (document.getValidUntilUTCoffset() != null && document.getValidUntilUTCoffset() != document.getValidFromUTCoffset()){
+ asnData.setValidUntilUTCOffset(document.getValidUntilUTCoffset());
+ }
+ }
+
+
+ if(document.getActivatedDays()!= null && document.getActivatedDays().size() > 0) {
+ if (document.getValidFrom() != null) {
+ asnData.setActivatedDays(document.getActivatedDays(),document.getValidFrom());
+ } else {
+ asnData.setActivatedDays(document.getActivatedDays(),issuingDate);
+ }
+ }
+ if (document.getClassCode() != null) {
+ asnData.setClassCode(TravelClassType.valueOf(document.getClassCode().name()));
+ }
+ if (document.getCountries() != null && document.getCountries().size() > 0){
+ asnData.setCountries(SequenceOfCountries.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getCountries(),1,250)));
+ }
+
+ asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,32000)));
+ asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,32000)));
+
+ asnData.setNumberOfDaysOfTravel(UicEncoderUtils.getRestrictedInt(document.getNumberOfDaysOfTravel(), 1, 93));
+ asnData.setNumberOfPossibleTrips(UicEncoderUtils.getRestrictedInt(document.getNumberOfPossibleTrips(), 1, 30));
+ asnData.setNumberOfValidityDays(UicEncoderUtils.getRestrictedInt(document.getNumberOfValidityDays(), 1, 370));
+ asnData.setPassDescription(document.getPassDescription());
+ if (document.getPassType() > 0 ){
+ asnData.setPassType(new Long(document.getPassType()));
+ }
+
+ asnData.setTariffs(encodeTariffCollection(document.getTariffs()));
+
+
+
+ if(document.getValidRegionList()!= null && document.getValidRegionList().size() > 0) {
+ asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
+ }
+
+ if (document.getValidityDetails() != null) {
+ asnData.setValidityPeriodDetails(encodeValidityDetails(document.getValidityDetails(), issuingDate));
+ }
+
+
+
+ asnData.setPrice(document.getPrice());
+
+ if (document.getVatDetails() != null && !document.getVatDetails().isEmpty()){
+ for (IVatDetail vat : document.getVatDetails()) {
+ asnData.addVatDetail(encodeVatDetail(vat));
+ }
+ }
+
+
+ return asnDocument;
+ }
+
+
+ private ValidityPeriodDetailType encodeValidityDetails( IValidityDetails validityDetails, Date referenceDate) throws EncodingFormatException {
+
+ if ( (validityDetails.getTimeRanges() == null || validityDetails.getTimeRanges().isEmpty())
+ ||
+ (validityDetails.getValidityRanges() == null || validityDetails.getValidityRanges().isEmpty()) ) {
+ return null;
+ }
+
+
+ ValidityPeriodDetailType asnData = new ValidityPeriodDetailType();
+
+ if (validityDetails.getTimeRanges() != null) {
+ for (ITimeRange range : validityDetails.getTimeRanges()) {
+
+ if (range.getFromTime() == range.getUntilTime()){
+ break;
+ }
+
+ TimeRangeType asnRange = new TimeRangeType();
+ asnRange.setFromTime(new Long(range.getFromTime()));
+ asnRange.setUntilTime(new Long(range.getUntilTime()));
+
+ asnData.getExcludedTimeRange().add(asnRange);
+ }
+ }
+
+ if (validityDetails.getValidityRanges() != null) {
+ for (IValidityRange range : validityDetails.getValidityRanges()) {
+
+ ValidityPeriodType asnRange = new ValidityPeriodType();
+
+ asnRange.setValidityDates(range.getFromDate(), range.getUntilDate(), referenceDate);
+
+ if (range.getValidFromUTCoffset() != null) {
+ asnRange.setValidFromUTCOffset(range.getValidFromUTCoffset());
+ if (range.getValidUntilUTCoffset() != null && range.getValidUntilUTCoffset() != range.getValidFromUTCoffset()){
+ asnRange.setValidUntilUTCOffset(range.getValidUntilUTCoffset());
+ }
+ }
+
+
+ asnData.getValidityPeriod().add(asnRange);
+ }
+ }
+
+ return asnData;
+ }
+
+ /**
+ * Convert fip ticket.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData convertFipTicket(IFipTicket document, Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+
+ 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()));
+
+ 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()));
+
+ if (document.getClassCode() != null) {
+ asnData.setClassCode(TravelClassType.valueOf(document.getClassCode().name()));
+ }
+ if (!document.isIncludesSupplements()){
+ asnData.setIncludesSupplements(false);
+ }
+ asnData.setNumberOfTravelDays(UicEncoderUtils.getRestrictedInt(document.getNumberOfTravelDates(), 1, 8));
+
+ asnData.setValidityDates(document.getValidFrom(), document.getValidUntil(), issuingDate);
+
+ if(document.getActivatedDays()!= null && document.getActivatedDays().size() > 0) {
+ asnData.setActivatedDays(document.getActivatedDays(), document.getValidFrom());
+ }
+
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ return asnDocument;
+ }
+
+ /**
+ * Convert station passage.
+ *
+ * @param document the document
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData convertStationPassage(IStationPassage document,Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+ 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()));
+
+ asnData.setReferenceNum(Asn1BigInteger.toAsn1(UicEncoderUtils.getNum(document.getReference())));
+ asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
+
+ if (document.getNumberOfdaysAllowed() > 0) {
+ asnData.setNumberOfDaysValid(new Long(document.getNumberOfdaysAllowed()));
+ }
+
+ asnData.setProductName(document.getProductName());
+
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
+ }
+
+
+ if (document.getStations()!= null && !document.getStations().isEmpty()){
+ SequenceOfStringIA5 stationsIA5 = new SequenceOfStringIA5();
+ SequenceOfUnrestrictedLong stationsNum = new SequenceOfUnrestrictedLong();
+
+ for (String station : document.getStations()) {
+ String ia5 = UicEncoderUtils.getIA5NonNum(station);
+ Long num = UicEncoderUtils.getNum(station);
+ if (ia5 != null && ia5.length() > 0) {
+ stationsIA5.add(ia5);
+ }
+ if (num != null && num > 0){
+ stationsNum.add(num);
+ }
+ }
+ if (!stationsIA5.isEmpty()){
+ asnData.setStationIA5(stationsIA5);
+ }
+ if (!stationsNum.isEmpty()){
+ asnData.setStationNum(stationsNum);
+ }
+ }
+
+ if (document.getStationNames()!= null && !document.getStationNames().isEmpty()) {
+
+ SequenceOfStringUTF8 asnList = new SequenceOfStringUTF8();
+ for ( String text :document.getStationNames()){
+ if (text.length() > 0) {
+ asnList.add(text);
+ }
+ }
+
+ if (!asnList.isEmpty()) {
+ asnData.setStationNameUTF8(asnList);
+ }
+
+ }
+
+ asnData.setValidityDates(document.getValidFrom(), document.getValidUntil(), issuingDate);
+
+ if (document.getValidFromUTCoffset() != null) {
+ asnData.setValidFromUTCOffset(document.getValidFromUTCoffset());
+ if (document.getValidUntilUTCoffset() != null && document.getValidUntilUTCoffset() != document.getValidFromUTCoffset()){
+ asnData.setValidUntilUTCOffset(document.getValidUntilUTCoffset());
+ }
+ }
+
+
+ asnData.setExtension(encodeExtension(document.getExtension()));
+
+ asnData.setAreaCodeNum(SequenceOfUnrestrictedLong.getSequence(UicEncoderUtils.getNumList(document.getAreaCodes())));
+ asnData.setAreaCodeIA5(UicEncoderUtils.getIA5NonNumList(document.getAreaCodes()));
+
+ asnData.setAreaNameUTF8(UicEncoderUtils.encodeStringCollection(document.getAreaNames()));
+
+ return asnDocument;
+ }
+
+
+ /**
+ * Encode control details.
+ *
+ * @param data the data
+ * @param issuingDate the issuing date
+ * @return the control data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private ControlData encodeControlDetails(IControlDetail data, Date issuingDate) throws EncodingFormatException {
+
+ if (data == null) return null;
+
+ ControlData asnData = new ControlData();
+
+ asnData.setExtension(encodeExtension(data.getExtension()));
+
+ if (data.isAgeCheckRequired()) {
+ asnData.setAgeCheckRequired(true);
+ } else {
+ asnData.setAgeCheckRequired(false);
+ }
+
+ if (data.isIdentificationByIdCard()){
+ asnData.setIdentificationByIdCard(true);
+ } else {
+ asnData.setIdentificationByIdCard(false);
+ }
+
+ if (data.isIdentificationByPassportId()){
+ asnData.setIdentificationByPassportId(true);
+ } else {
+ asnData.setIdentificationByPassportId(false);
+ }
+
+ if (data.isOnlineValidationRequired()){
+ asnData.setOnlineValidationRequired(true);
+ } else {
+ asnData.setOnlineValidationRequired(false);
+ }
+
+ if (data.isPassportValidationRequired()){
+ asnData.setPassportValidationRequired(true);
+ } else {
+ asnData.setPassportValidationRequired(false);
+ }
+
+ if (data.isReductionCardCheckRequired()){
+ asnData.setReductionCardCheckRequired(true);
+ } else {
+ asnData.setReductionCardCheckRequired(false);
+ }
+
+ asnData.setInfoText(data.getInfoText());
+
+ asnData.setRandomDetailedValidationRequired(UicEncoderUtils.getRestrictedInt(data.getRandomDetailedValidationRequired(), 0,99));
+
+ asnData.setIdentificationItem(UicEncoderUtils.getUnRestrictedInt(data.getIdentificationItem()));
+
+ asnData.setIncludedTickets(encodeTicketLickList(data.getLinkedTickets()));
+
+ asnData.setIdentificationByCardReference(encodeCardReferences(data.getIdentificationByCardReference()));
+
+ return asnData;
+ }
+
+
+
+ /**
+ * Encode card references.
+ *
+ * @param cardReferences the card references
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private SequenceOfCardReferenceType encodeCardReferences(Collection<ICardReference> cardReferences) throws EncodingFormatException {
+
+ if (cardReferences == null || cardReferences.isEmpty()) return null;
+
+ SequenceOfCardReferenceType asnList = new SequenceOfCardReferenceType();
+
+ for (ICardReference card : cardReferences){
+
+ CardReferenceType asnCard = new CardReferenceType();
+
+ if (card.getCardId() != null && card.getCardId().length() > 0){
+ //only longs allowed
+ try {
+ long num = Long.parseLong(card.getCardId());
+ asnCard.setCardIdNum(num);
+ } catch (Exception e ){
+ asnCard.setCardIdIA5(card.getCardId());
+ }
+ }
+
+
+ asnCard.setCardIssuerNum(UicEncoderUtils.getNum(card.getCardIssuer()));
+ asnCard.setCardIssuerIA5(UicEncoderUtils.getIA5NonNum(card.getCardIssuer()));
+ asnCard.setCardName(card.getCardName());
+ asnCard.setCardType(UicEncoderUtils.getUnRestrictedInt(card.getCardType()));
+
+ asnCard.setLeadingCardIdNum(UicEncoderUtils.getNum(card.getLeadingCardId()));
+ asnCard.setLeadingCardIdIA5(UicEncoderUtils.getIA5NonNum(card.getLeadingCardId()));
+
+ asnCard.setTrailingCardIdNum(UicEncoderUtils.getNum(card.getTrailingCardId()));
+ asnCard.setTrailingCardIdIA5(UicEncoderUtils.getIA5NonNum(card.getTrailingCardId()));
+
+ asnList.add(asnCard);
+
+ }
+
+
+ if (asnList.isEmpty()) return null;
+
+ return asnList;
+ }
+
+ /**
+ * Encode ticket lick list.
+ *
+ * @param linkedTickets the linked tickets
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private SequenceOfTicketLinkType encodeTicketLickList(Collection<ITicketLink> linkedTickets) throws EncodingFormatException {
+
+ if (linkedTickets == null || linkedTickets.isEmpty()) return null;
+
+ SequenceOfTicketLinkType asnList = new SequenceOfTicketLinkType();
+
+ 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()));
+ }
+
+ asnList.add(asnTicket);
+ }
+
+ if (asnList.isEmpty()) return null;
+
+ return asnList;
+ }
+
+ /**
+ * Encode travelers.
+ *
+ * @param data the data
+ * @param issuingDate the issuing date
+ * @return the traveler data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private TravelerData encodeTravelers(ITravelerDetail data,Date issuingDate) throws EncodingFormatException {
+
+ if (data == null) return null;
+
+ TravelerData asnData = new TravelerData();
+
+ asnData.setGroupName(data.getGroupName());
+
+ asnData.setPreferedLanguage(data.getPreferredLanguage());
+
+ if (data.getTravelers()!=null && !data.getTravelers().isEmpty()) {
+
+ SequenceOfTravelerType asnTravelers = new SequenceOfTravelerType();
+
+ for (ITraveler traveler : data.getTravelers()){
+
+ TravelerType asnTraveler = encodeTraveler(traveler);
+
+ if (asnTraveler !=null){
+ asnTravelers.add(asnTraveler);
+ }
+ }
+
+ if (!asnTravelers.isEmpty()) {
+ asnData.setTraveler(asnTravelers);
+ }
+
+ }
+
+ return asnData;
+ }
+
+ /**
+ * Encode issuing details.
+ *
+ * @param data the data
+ * @return the issuing data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private IssuingData encodeIssuingDetails(IIssuingDetail data) throws EncodingFormatException {
+
+ if (data == null){
+ throw new EncodingFormatException("Issuind data missing");
+ }
+
+ IssuingData asnData = new IssuingData();
+
+ if (!data.isActivated()){
+ asnData.setActivated(false);
+ } else {
+ asnData.setActivated(true);
+ }
+
+ if (!data.isSecurePaperTicket()) {
+ asnData.setSecurePaperTicket(false);
+ } else {
+ asnData.setSecurePaperTicket(true);
+ }
+
+ asnData.setExtension(encodeExtension(data.getExtension()));
+
+
+ asnData.setIssuedOnLine(UicEncoderUtils.getRestrictedInt(data.getIssuedOnLine(), 1, 99999));
+
+ asnData.setIssuedOnTrainNum(UicEncoderUtils.getNum(data.getIssuedOnTrain()));
+ asnData.setIssuedOnTrainIA5(UicEncoderUtils.getIA5NonNum(data.getIssuedOnTrain()));
+
+
+ asnData.setSecurityProviderNum(UicEncoderUtils.getNum(data.getSecurityProvider()));
+
+
+ if (data.getIssuer()!= null && !data.getIssuer().equals(data.getSecurityProvider()) ){
+ asnData.setIssuerNum(UicEncoderUtils.getNum(data.getIssuer()));
+ asnData.setIssuerIA5(UicEncoderUtils.getIA5NonNum(data.getIssuer()));
+ }
+
+ asnData.setIssuerName(data.getIssuerName());
+ asnData.setIssuerPNR(UicEncoderUtils.getIA5(data.getIssuerPNR()));
+
+
+ asnData.setIssuingDate(data.getIssuingDate());
+
+ if (data.isSpecimen()){
+ asnData.setSpecimen(true);
+ } else {
+ asnData.setSpecimen(false);
+ }
+
+ if (data.getPointOfSale()!= null){
+ asnData.setPointOfSale(encodeGeoCoordinate(data.getPointOfSale()));
+ }
+
+ return asnData;
+ }
+
+ /**
+ * Encode geo coordinate.
+ *
+ * @param point the point
+ * @return the geo coordinate type
+ */
+ private GeoCoordinateType encodeGeoCoordinate(IGeoCoordinate point) {
+
+ if (point == null) return null;
+
+ GeoCoordinateType asnPoint = new GeoCoordinateType();
+
+ asnPoint.setLatitude(point.getLatitude());
+ asnPoint.setLongitude(point.getLongitude());
+
+ if (point.getUnit() != IGeoUnitType.milliDegree && point.getUnit() != null){
+ asnPoint.setGeoUnit(GeoUnitType.valueOf(point.getUnit().name()));
+ }
+
+ if (point.getAccuracy() != null) {
+ asnPoint.setAccuracy(GeoUnitType.valueOf(point.getAccuracy().name()));
+ }
+
+ if (point.getHemisphereLatitude() != IHemisphereLatitudeType.east && point.getHemisphereLatitude() != null) {
+ asnPoint.setHemisphereLatitude(HemisphereLatitudeType.valueOf(point.getHemisphereLatitude().name()));
+ }
+
+ if (point.getHemisphereLongitude() != IHemisphereLongitudeType.north && point.getHemisphereLongitude() != null) {
+ asnPoint.setHemisphereLongitude(HemisphereLongitudeType.valueOf(point.getHemisphereLongitude().name()));
+ }
+
+ if (point.getSystem() != IGeoCoordinateSystemType.wgs84 && point.getSystem() != null){
+ asnPoint.setCoordinateSystem(GeoCoordinateSystemType.valueOf(point.getSystem().name()));
+ }
+
+
+ return asnPoint;
+ }
+
+ /**
+ * Encode customer card.
+ *
+ * @param document the customer card
+ * @param issuingDate the issuing date
+ * @return the document data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private DocumentData encodeCustomerCard(ICustomerCard document,Date issuingDate) throws EncodingFormatException {
+
+ DocumentData asnDocument = new DocumentData();
+ TicketDetailData asnTicket = new TicketDetailData();
+ asnDocument.setTicket(asnTicket);
+
+ CustomerCardData asnCustomerCard = new CustomerCardData();
+ asnDocument.getTicket().setCustomerCard(asnCustomerCard);
+
+
+ if (document.getCardId() != null && document.getCardId().length() > 0){
+ //only longs allowed
+ try {
+ long num = Long.parseLong(document.getCardId());
+ asnCustomerCard.setCardIdNum(num);
+ } catch (Exception e ){
+ asnCustomerCard.setCardIdIA5(document.getCardId());
+ }
+ }
+
+
+ asnCustomerCard.setCardType(UicEncoderUtils.getRestrictedInt(document.getCardType(),1,1000));
+
+ asnCustomerCard.setCardTypeDescr(document.getCardTypeDescr());
+
+ if (document.getClassCode() != null) {
+ asnCustomerCard.setClassCode(TravelClassType.valueOf(document.getClassCode().name()));
+ }
+
+ if (document.getCustomer()!=null){
+ asnCustomerCard.setCustomer(encodeTraveler(document.getCustomer()));
+ }
+
+ asnCustomerCard.setCustomerStatus(UicEncoderUtils.getUnRestrictedInt(document.getCustomerStatus()));
+
+ asnCustomerCard.setCustomerStatusDescr(document.getCustomerStatusDescr());
+
+ asnCustomerCard.setExtension(encodeExtension(document.getExtension()));
+
+ asnCustomerCard.setIncludedServices(SequenceOfUnrestrictedLong.getSequence(UicEncoderUtils.getUnRestrictedIntList(document.getIncludedServices())));
+
+ asnCustomerCard.setValidity(document.getValidFrom(), document.getValidUntil());
+
+ return asnDocument;
+ }
+
+ private TokenType encodeToken(IToken token) throws EncodingFormatException {
+ TokenType asnToken = new TokenType();
+ asnToken.setToken(token.getToken());
+ asnToken.setTokenProviderNum(UicEncoderUtils.getNum(token.getTokenProvider()));
+ asnToken.setTokenProviderIA5(UicEncoderUtils.getIA5NonNum(token.getTokenProvider()));
+ asnToken.setTokenSpecification(token.getTokenSpecification());
+ return asnToken;
+ }
+
+
+
+
+ private VatDetailType encodeVatDetail(IVatDetail vatDetail) {
+
+ if (vatDetail == null) return null;
+
+ VatDetailType asnVatDetail = new VatDetailType();
+
+ asnVatDetail.setAmount(vatDetail.getAmount());
+ asnVatDetail.setCountry(new Long(vatDetail.getCountry()));
+ asnVatDetail.setPercentage(new Long(vatDetail.getPercentage()));
+ asnVatDetail.setVatId(vatDetail.getVatId());
+
+ return asnVatDetail;
+
+ }
+
+ /**
+ * Encode traveler.
+ *
+ * @param traveler the traveler
+ * @return the traveler type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private TravelerType encodeTraveler(ITraveler traveler) throws EncodingFormatException {
+
+ if (traveler == null) return null;
+
+ TravelerType asnTraveler = new TravelerType();
+
+ asnTraveler.setCountryOfResidence(UicEncoderUtils.getRestrictedInt(traveler.getCountryOfResidence(), 1, 999));
+ asnTraveler.setCountryOfPassport(UicEncoderUtils.getRestrictedInt(traveler.getPassportCountry(), 1, 999));
+ asnTraveler.setCountryOfIdCard(UicEncoderUtils.getRestrictedInt(traveler.getIDCardCountry(), 1, 999));
+
+
+ asnTraveler.setCustomerIdNum(UicEncoderUtils.getNum(traveler.getCustomerId()));
+ asnTraveler.setCustomerIdIA5(UicEncoderUtils.getIA5NonNum(traveler.getCustomerId()));
+
+ asnTraveler.setDateOfBirth(traveler.getDateOfBirth());
+
+ asnTraveler.setFirstName(traveler.getFirstName());
+ asnTraveler.setSecondName(traveler.getSecondName());
+ asnTraveler.setLastName(traveler.getLastName());
+ if (traveler.getGender() != null) {
+ asnTraveler.setGender(GenderType.valueOf(traveler.getGender().toString()));
+ }
+ asnTraveler.setIdCard(UicEncoderUtils.getIA5(traveler.getIdCard()));
+ asnTraveler.setPassportId(UicEncoderUtils.getIA5(traveler.getPassportId()));
+ asnTraveler.setTitle(UicEncoderUtils.getIA5(traveler.getTitle()));
+
+ if (traveler.getPassengerType() != null) {
+ asnTraveler.setPassengerType(PassengerType.valueOf(traveler.getPassengerType().name()));
+ }
+
+ asnTraveler.setPassengerWithReducedMobility(traveler.isPassengerWithReducedMobility());
+ if (traveler.isTicketHolder()){
+ asnTraveler.setTicketHolder(true);
+ } else {
+ asnTraveler.setTicketHolder(false);
+ }
+
+ if (traveler.getStatusCollection()!= null && !traveler.getStatusCollection().isEmpty()){
+
+ SequenceOfCustomerStatusType asnList = new SequenceOfCustomerStatusType();
+
+ for (ICustomerStatusDescription status : traveler.getStatusCollection() ) {
+ asnList.add(mapCustomerStatusType(status));
+ }
+ if (!asnList.isEmpty()) {
+ asnTraveler.setStatus(asnList);
+ }
+ }
+
+
+ return asnTraveler;
+ }
+
+ /**
+ * Map customer status type.
+ *
+ * @param status the status
+ * @return the customer status type
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private CustomerStatusType mapCustomerStatusType(ICustomerStatusDescription status) throws EncodingFormatException {
+
+ CustomerStatusType asnStatus = new CustomerStatusType();
+
+ if (status.getStatus() > 0) {
+ asnStatus.setCustomerStatus(new Long(status.getStatus()));
+ }
+ asnStatus.setCustomerStatusDescr(status.getDescription());
+ asnStatus.setStatusProviderIA5(UicEncoderUtils.getIA5NonNum(status.getStatusProvider()));
+ asnStatus.setStatusProviderNum(UicEncoderUtils.getNum(status.getStatusProvider()));
+
+ return asnStatus;
+ }
+
+ /**
+ * Encode extension.
+ *
+ * @param extension the extension
+ * @return the extension data
+ * @throws EncodingFormatException the encoding format exception
+ */
+ private ExtensionData encodeExtension(IExtension extension) throws EncodingFormatException {
+
+ if (extension==null) return null;
+
+ if (extension.getBinarydata() == null || extension.getBinarydata().length == 0) {
+ throw new EncodingFormatException("Extension does not include data");
+ }
+
+ if (extension.getId() == null || extension.getId().length() == 0) {
+ throw new EncodingFormatException("Extension does not include id");
+ }
+
+ ExtensionData asnExtension = new ExtensionData();
+
+ asnExtension.setExtensionData(extension.getBinarydata());
+ asnExtension.setExtensionId(UicEncoderUtils.getIA5(extension.getId()));
+
+ return asnExtension;
+ }
+
+
+}
diff --git a/src/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoder.java b/src/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoder.java new file mode 100644 index 0000000..46f201d --- /dev/null +++ b/src/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoder.java @@ -0,0 +1,2221 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.utils;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
+
+import org.uic.barcode.ticket.api.asn.omv1.BerthDetailData;
+import org.uic.barcode.ticket.api.asn.omv1.CarCarriageReservationData;
+import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
+import org.uic.barcode.ticket.api.asn.omv1.CompartmentDetailsType;
+import org.uic.barcode.ticket.api.asn.omv1.ControlData;
+import org.uic.barcode.ticket.api.asn.omv1.CountermarkData;
+import org.uic.barcode.ticket.api.asn.omv1.CustomerCardData;
+import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv1.DelayConfirmation;
+import org.uic.barcode.ticket.api.asn.omv1.DeltaCoordinates;
+import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
+import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
+import org.uic.barcode.ticket.api.asn.omv1.FIPTicketData;
+import org.uic.barcode.ticket.api.asn.omv1.GeoCoordinateType;
+import org.uic.barcode.ticket.api.asn.omv1.IncludedOpenTicketType;
+import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
+import org.uic.barcode.ticket.api.asn.omv1.LineType;
+import org.uic.barcode.ticket.api.asn.omv1.LuggageRestrictionType;
+import org.uic.barcode.ticket.api.asn.omv1.OpenTicketData;
+import org.uic.barcode.ticket.api.asn.omv1.ParkingGroundData;
+import org.uic.barcode.ticket.api.asn.omv1.PassData;
+import org.uic.barcode.ticket.api.asn.omv1.PlacesType;
+import org.uic.barcode.ticket.api.asn.omv1.PolygoneType;
+import org.uic.barcode.ticket.api.asn.omv1.RegionalValidityType;
+import org.uic.barcode.ticket.api.asn.omv1.RegisteredLuggageType;
+import org.uic.barcode.ticket.api.asn.omv1.ReservationData;
+import org.uic.barcode.ticket.api.asn.omv1.ReturnRouteDescriptionType;
+import org.uic.barcode.ticket.api.asn.omv1.RouteSectionType;
+import org.uic.barcode.ticket.api.asn.omv1.SeriesDetailType;
+import org.uic.barcode.ticket.api.asn.omv1.StationPassageData;
+import org.uic.barcode.ticket.api.asn.omv1.TariffType;
+import org.uic.barcode.ticket.api.asn.omv1.TicketLinkType;
+import org.uic.barcode.ticket.api.asn.omv1.TimeRangeType;
+import org.uic.barcode.ticket.api.asn.omv1.TokenType;
+import org.uic.barcode.ticket.api.asn.omv1.TrainLinkType;
+import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
+import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
+import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
+import org.uic.barcode.ticket.api.asn.omv1.ValidityPeriodDetailType;
+import org.uic.barcode.ticket.api.asn.omv1.ValidityPeriodType;
+import org.uic.barcode.ticket.api.asn.omv1.VatDetailType;
+import org.uic.barcode.ticket.api.asn.omv1.ViaStationType;
+import org.uic.barcode.ticket.api.asn.omv1.VoucherData;
+import org.uic.barcode.ticket.api.asn.omv1.ZoneType;
+import org.uic.barcode.ticket.api.impl.SimpleUicTicketObjectFactory;
+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.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;
+import org.uic.barcode.ticket.api.spec.ICustomerStatusDescription;
+import org.uic.barcode.ticket.api.spec.IDelayConfirmation;
+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.IGeoCoordinate;
+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.IIssuingDetail;
+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.ILuggageRestriction;
+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.IPlaces;
+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.IReturnRouteDescription;
+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.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.IToken;
+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.ITravelerDetail;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.api.spec.IUicTicketObjectFactory;
+import org.uic.barcode.ticket.api.spec.IValidityDetails;
+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;
+
+
+/**
+ * The Class OpenAsn2ApiDecoder.
+ */
+public class OpenAsn2ApiDecoder {
+
+ IUicTicketObjectFactory factory = SimpleUicTicketObjectFactory.getInstance();
+
+ /**
+ * Decode from asn.1 unaligned PER encoded data.
+ *
+ * @param asnUicRailTicketData the asn uic rail ticket data
+ * @return the decoded uic rail ticket
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ public IUicRailTicket decodeFromAsn (UicRailTicketData asnUicRailTicketData) throws IOException{
+
+ IUicRailTicket uicRailTicket = factory.createUicRailTicket();
+
+ populateFromAsn1Model(uicRailTicket, asnUicRailTicketData);
+
+ return uicRailTicket;
+
+ }
+
+ /**
+ * Decode from asn.1 unaligned PER encoded data.
+ *
+ * @param data byte array of the asn.1 encoded FCB data
+ * @return the decoded uic rail ticket
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ public IUicRailTicket decodeFromAsn (byte[] data) throws IOException{
+
+ UicRailTicketData asnUicRailTicketData = UicRailTicketData.decode(data);
+
+ IUicRailTicket uicRailTicket = factory.createUicRailTicket();
+
+ populateFromAsn1Model(uicRailTicket, asnUicRailTicketData);
+
+ return uicRailTicket;
+
+ }
+
+
+
+
+
+ /**
+ * Populate from asn1 model.
+ *
+ * @param uicRailTicket the uic rail ticket
+ * @param asnUicRailTicketData the asn uic rail ticket data
+ */
+ protected void populateFromAsn1Model(IUicRailTicket uicRailTicket, UicRailTicketData asnUicRailTicketData) {
+
+ if (asnUicRailTicketData.getExtension()!= null && !asnUicRailTicketData.getExtension().isEmpty()) {
+ for (ExtensionData asnExtension : asnUicRailTicketData.getExtension()){
+ uicRailTicket.addExtension(convertExtension(asnExtension));
+ }
+ }
+
+ if (asnUicRailTicketData.getIssuingDetail() != null) {
+ populateIssuingDetail(asnUicRailTicketData.getIssuingDetail(), uicRailTicket.getIssuerDetails());
+ }
+
+ if (asnUicRailTicketData.getControlDetail() != null) {
+ populateControlDetails(asnUicRailTicketData.getControlDetail(),uicRailTicket.getControlDetails());
+ }
+
+ if (asnUicRailTicketData.getTravelerDetail() != null) {
+ populateTravelerDetails(asnUicRailTicketData.getTravelerDetail(),uicRailTicket.getTravelerDetails());
+ }
+
+ if (asnUicRailTicketData.getTransportDocument() != null && !asnUicRailTicketData.getTransportDocument().isEmpty()) {
+ populateTravelDocuments(asnUicRailTicketData.getTransportDocument(),uicRailTicket,uicRailTicket.getIssuerDetails().getIssuingDate() );
+ }
+
+
+ }
+
+
+
+
+
+
+ /**
+ * Populate travel documents.
+ *
+ * @param asnTransportDocuments the asn transport documents
+ * @param uicRailTicket the uic rail ticket
+ * @param issuingDate the issuing date
+ */
+ protected void populateTravelDocuments(List<DocumentData> asnTransportDocuments,IUicRailTicket uicRailTicket, Date issuingDate) {
+
+ for ( DocumentData asnDocument : asnTransportDocuments){
+
+ if (asnDocument.getTicket() == null) {
+ break;
+ }
+
+ if (asnDocument.getTicket().getExtension() != null) {
+ IDocumentExtension ticket = convertDocumentExtension(asnDocument.getTicket().getExtension());
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addDocumentExtension(ticket);
+ }
+
+ if (asnDocument.getTicket().getCarCarriageReservation() != null) {
+ ICarCarriageReservation ticket = convertCarCarriage(asnDocument.getTicket().getCarCarriageReservation(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addCarCarriageReservation(ticket);
+ }
+
+ if (asnDocument.getTicket().getCounterMark() != null) {
+ ICounterMark ticket = convertCountermark(asnDocument.getTicket().getCounterMark(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addCounterMark(ticket);
+ }
+
+ if (asnDocument.getTicket().getCustomerCard()!= null) {
+ ICustomerCard ticket = convertCustomerCard(asnDocument.getTicket().getCustomerCard(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addCustomerCard(ticket);
+ }
+
+ if (asnDocument.getTicket().getFipTicket()!= null) {
+ IFipTicket ticket = convertFipTicket(asnDocument.getTicket().getFipTicket(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addFipTicket(ticket);
+ }
+
+ if (asnDocument.getTicket().getOpenTicket()!= null) {
+ IOpenTicket ticket = convertOpenTicket(asnDocument.getTicket().getOpenTicket(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addOpenTicket(ticket);
+ }
+
+
+ if (asnDocument.getTicket().getParkingGround()!= null) {
+ IParkingGround ticket = convertParkingGround(asnDocument.getTicket().getParkingGround(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addParkingGround(ticket);
+ }
+
+ if (asnDocument.getTicket().getPass() != null) {
+ IPass ticket = convertPass(asnDocument.getTicket().getPass(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addPass(ticket);
+ }
+
+ if (asnDocument.getTicket().getStationPassage() != null) {
+ IStationPassage ticket = convertStationPassage(asnDocument.getTicket().getStationPassage(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addStationPassage(ticket);
+ }
+
+ if (asnDocument.getTicket().getReservation() != null) {
+ IReservation ticket = convertReservation(asnDocument.getTicket().getReservation(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addReservation(ticket);
+ }
+
+ if (asnDocument.getTicket().getVoucher()!= null) {
+ IVoucher ticket = convertVoucher(asnDocument.getTicket().getVoucher(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addVoucher(ticket);
+ }
+
+ if (asnDocument.getTicket().getDelayConfirmation()!= null) {
+ IDelayConfirmation ticket = convertDelayConfirmation(asnDocument.getTicket().getDelayConfirmation(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addDelayConfirmation(ticket);
+ }
+ }
+ }
+
+
+
+
+
+
+
+
+
+
+ private IToken convertToken(TokenType asnToken) {
+
+ if (asnToken == null) return null;
+
+ IToken token = factory.createToken();
+ token.setToken(asnToken.getToken());
+ token.setTokenProvider(UicEncoderUtils.mapToString(asnToken.getTokenProviderNum(), asnToken.getTokenProviderIA5()));
+ token.setTokenSpecification(asnToken.getTokenSpecification());
+ return token;
+ }
+
+
+
+ private IDelayConfirmation convertDelayConfirmation(DelayConfirmation asnDocument, Date issuingDate) {
+
+ IDelayConfirmation document = factory.createDelayConfirmation();
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum().longValue(),asnDocument.getReferenceIA5()));
+
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+ document.setInfoText(asnDocument.getInfoText());
+
+ if (asnDocument.getStationCodeTable()!=null){
+ 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());
+
+ if (asnDocument.getConfirmationType() != null) {
+ document.setConfirmationType(asnDocument.getConfirmationType().ordinal());
+ }
+
+ if (asnDocument.getDelay() != null) {
+ document.setDelay(asnDocument.getDelay().intValue());
+ }
+
+ if (asnDocument.getTrainCancelled() != null) {
+ document.setTrainCancelled(asnDocument.getTrainCancelled());
+ } else {
+ document.setTrainCancelled(false);
+ }
+
+ if (asnDocument.getAffectedTickets() !=null && !asnDocument.getAffectedTickets().isEmpty()) {
+ for (TicketLinkType asnTicketLink : asnDocument.getAffectedTickets()) {
+ document.addLinkedTicket(convertTicketLink(asnTicketLink));
+ }
+ }
+
+ return document;
+ }
+
+
+
+
+
+
+ /**
+ * Convert reservation.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @return the i reservation
+ */
+ protected IReservation convertReservation(ReservationData asnDocument, Date issuingDate) {
+
+ IReservation document = factory.createReservation();
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+ document.setInfoText(asnDocument.getInfoText());
+
+ 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()));
+ document.setFromStationName(asnDocument.getFromStationNameUTF8());
+ document.setToStationName(asnDocument.getToStationNameUTF8());
+
+ document.setDepartureDate(asnDocument.getDepartureDate(issuingDate));
+ document.setArrivalDate(asnDocument.getArrivalDate(issuingDate));
+
+ document.setDepartureUTCoffset(asnDocument.getDepartureUTCOffset());
+ if (asnDocument.getArrivalUTCOffset() != null) {
+ document.setArrivalUTCoffset(asnDocument.getArrivalUTCOffset());
+ } else {
+ document.setArrivalUTCoffset(asnDocument.getDepartureUTCOffset());
+ }
+
+ if(asnDocument.getClassCode()!=null){
+ document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
+ }
+
+ document.setCompartmentDetails(convertCompartmentDetails(asnDocument.getCompartmentDetails()));
+
+ document.setLuggageRestriction(convertLuggageRestriction(asnDocument.getLuggage()));
+
+ if (asnDocument.getNumberOfOverbooked() != null) {
+ document.setNumberOfOverbooked(asnDocument.getNumberOfOverbooked().intValue());
+ }
+
+ if (asnDocument.getNumberOfSupplements() != null) {
+ document.setNumberOfSupplements(asnDocument.getNumberOfSupplements().intValue());
+ }
+
+ if (asnDocument.getPlaces()!=null) {
+ document.setPlaces(convertPlaces(asnDocument.getPlaces()));
+ }
+
+ if (asnDocument.getBicyclePlaces()!=null) {
+ document.setBicyclePlaces(convertPlaces(asnDocument.getBicyclePlaces()));
+ }
+
+ document.setPriceType(IPriceTypeType.valueOf(asnDocument.getPriceType().name()));
+
+ IServiceBrand serviceBrand = factory.createServiceBrand();
+
+ if (asnDocument.getServiceBrand()!=null){
+ serviceBrand.setServiceBrand(asnDocument.getServiceBrand().intValue());
+ }
+ serviceBrand.setServiceBrandAbbreviation(asnDocument.getServiceBrandAbrUTF8());
+ serviceBrand.setServiceBrandDescription(asnDocument.getServiceBrandNameUTF8());
+
+ document.setServiceBrand(serviceBrand);
+
+ if (asnDocument.getServiceLevel()!=null && asnDocument.getServiceLevel().length() != 0) {
+ document.setServiceLevel(asnDocument.getServiceLevel());
+ }
+
+ document.setTrain(UicEncoderUtils.mapToString(asnDocument.getTrainNum(), asnDocument.getTrainIA5()));
+
+ if (asnDocument.getTypeOfSupplement()!=null) {
+ document.setTypeOfSupplement(asnDocument.getTypeOfSupplement().intValue());
+ }
+
+ if (asnDocument.getBerth()!=null && !asnDocument.getBerth().isEmpty()){
+ for (BerthDetailData asnBerth : asnDocument.getBerth()){
+ document.addBerth(convertBerth(asnBerth));
+ }
+ }
+
+ 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.getTariff()!=null && !asnDocument.getTariff().isEmpty()){
+ for (TariffType asnTariff : asnDocument.getTariff()) {
+ document.addTariff(convertTariff(asnTariff));
+ }
+ }
+
+ document.setPrice(asnDocument.getPrice());
+
+ if (asnDocument.getVatDetails() != null && !asnDocument.getVatDetails().isEmpty()){
+ for (VatDetailType vat : asnDocument.getVatDetails()) {
+ document.addVatDetail(decodeVatDetail(vat));
+ }
+ }
+
+ return document;
+ }
+
+
+
+
+
+
+
+
+
+ /**
+ * Convert car carriage.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @return the i car carriage reservation
+ */
+ protected ICarCarriageReservation convertCarCarriage(CarCarriageReservationData asnDocument , Date issuingDate) {
+
+ ICarCarriageReservation document = factory.createCarCarriageReservation();
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+ document.setInfoText(asnDocument.getInfoText());
+
+ 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()));
+ document.setFromStationName(asnDocument.getFromStationNameUTF8());
+ document.setToStationName(asnDocument.getToStationNameUTF8());
+
+ document.setBeginLoading(asnDocument.getBeginLoadingDate(issuingDate));
+ document.setEndLoading(asnDocument.getEndLoadingDate(issuingDate));
+
+ document.setLoadingTimeUTCoffset(asnDocument.getLoadingUTCOffset());
+
+
+ if(asnDocument.getAttachedBicycles()!=null){
+ document.setAttachedBicycles(asnDocument.getAttachedBicycles().intValue());
+ }
+
+ if (asnDocument.getAttachedBoats()!=null) {
+ document.setAttachedBoats(asnDocument.getAttachedBoats().intValue());
+ }
+
+ if(asnDocument.getAttachedSurfboards()!=null) {
+ document.setAttachedSurfboards(asnDocument.getAttachedSurfboards().intValue());
+ }
+
+ if (asnDocument.getBoatCategory()!=null){
+ document.setBoatCategory(asnDocument.getBoatCategory().intValue());
+ }
+
+ if(asnDocument.getCarCategory()!=null){
+ document.setCarCategory(asnDocument.getCarCategory().intValue());
+ }
+
+ if (asnDocument.getLoadingDeck()!=null){
+ document.setLoadingDeck(ILoadingDeckType.valueOf(asnDocument.getLoadingDeck().name()));
+ }
+
+ if(asnDocument.getLoadingListEntry()!=null){
+ document.setLoadingListEntry(asnDocument.getLoadingListEntry().intValue());
+ }
+
+ if (asnDocument.getRoofRackHeight()!=null){
+ document.setRoofRackHeight(asnDocument.getRoofRackHeight().intValue());
+ }
+
+ document.setNumberPlate(asnDocument.getNumberPlate());
+ document.setTrailerPlate(asnDocument.getTrailerPlate());
+
+ if(asnDocument.getRoofRackType()!=null){
+ document.setRoofRackType(IRoofRackType.valueOf(asnDocument.getRoofRackType().name()));
+ }
+
+ if(asnDocument.getTextileRoof()) {
+ document.setTextileRoof(asnDocument.getTextileRoof());
+ }
+
+
+ document.setCompartmentDetails(convertCompartmentDetails(asnDocument.getCompartmentDetails()));
+
+ 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.getCoach()!=null) {
+ document.setCoach(asnDocument.getCoach());
+ }
+ if (asnDocument.getPlace()!=null) {
+ document.setPlace(asnDocument.getPlace());
+ }
+
+
+ document.setPriceType(IPriceTypeType.valueOf(asnDocument.getPriceType().name()));
+
+ IServiceBrand serviceBrand = factory.createServiceBrand();
+
+ if (asnDocument.getServiceBrand()!=null){
+ serviceBrand.setServiceBrand(asnDocument.getServiceBrand().intValue());
+ }
+ serviceBrand.setServiceBrandAbbreviation(asnDocument.getServiceBrandAbrUTF8());
+ serviceBrand.setServiceBrandDescription(asnDocument.getServiceBrandNameUTF8());
+
+ document.setServiceBrand(serviceBrand);
+
+ document.setTrain(UicEncoderUtils.mapToString(asnDocument.getTrainNum(), asnDocument.getTrainIA5()));
+
+
+ if (asnDocument.getTariff()!=null){
+ document.setTariff(convertTariff(asnDocument.getTariff()));
+ }
+
+ document.setPrice(asnDocument.getPrice());
+
+ if (asnDocument.getVatDetails() != null && !asnDocument.getVatDetails().isEmpty()){
+ for (VatDetailType vat : asnDocument.getVatDetails()) {
+ document.addVatDetail(decodeVatDetail(vat));
+ }
+ }
+
+ return null;
+ }
+
+
+ private IVatDetail decodeVatDetail(VatDetailType asnVat) {
+
+ IVatDetail vat = factory.createVatDetail();
+
+ vat.setAmount(asnVat.getAmount());
+ if (asnVat.getPercentage() != null){
+ vat.setPercentage(asnVat.getPercentage().intValue());
+ }
+ if (asnVat.getCountry() != null) {
+ vat.setCountry(asnVat.getCountry().intValue());
+ }
+ vat.setVatId(asnVat.getVatId());
+ return vat;
+ }
+
+
+
+
+
+
+
+ /**
+ * Convert compartment details.
+ *
+ * @param asnDetails the asn details
+ * @return the i compartment details
+ */
+ protected ICompartmentDetails convertCompartmentDetails(CompartmentDetailsType asnDetails) {
+
+ if (asnDetails == null) return null;
+
+ ICompartmentDetails details = factory.createCompartmentDetails();
+
+ if (asnDetails.getCompartmentType()!=null) {
+ details.setCompartmentType(asnDetails.getCompartmentType().intValue());
+ }
+
+ if (asnDetails.getCoachType()!=null){
+ details.setCoachType(asnDetails.getCoachType().intValue());
+ }
+
+ if (asnDetails.getSpecialAllocation()!=null) {
+ details.setSpecialAllocation(asnDetails.getSpecialAllocation().intValue());
+ }
+
+ details.setCoachTypeDescr(asnDetails.getCoachTypeDescr());
+ details.setCompartmentTypeDescr(asnDetails.getCompartmentTypeDescr());
+ details.setSpecialAllocationDescr(asnDetails.getSpecialAllocationDescr());
+
+ details.setPosition(ICompartmentPositionType.valueOf(asnDetails.getPosition().name()));
+
+ return details;
+ }
+
+ /**
+ * Convert places.
+ *
+ * @param asnPlaces the asn places
+ * @return the i places
+ */
+ protected IPlaces convertPlaces(PlacesType asnPlaces) {
+
+ if (asnPlaces == null) return null;
+
+ IPlaces places = factory.createPlaces();
+
+ places.setCoach(asnPlaces.getCoach());
+ places.setPlaceDescription(asnPlaces.getPlaceDescription());
+
+ if (asnPlaces.getPlaceNum()!=null && !asnPlaces.getPlaceNum().isEmpty()){
+ for (Long place: asnPlaces.getPlaceNum()){
+ places.addPlace(place.toString());
+ }
+ }
+
+ if (asnPlaces.getPlaceIA5()!=null && !asnPlaces.getPlaceIA5().isEmpty()){
+ for (String place: asnPlaces.getPlaceIA5()){
+ places.addPlace(place);
+ }
+ }
+
+ places.setPlaceString(asnPlaces.getPlaceString());
+
+ return places;
+ }
+
+ /**
+ * Convert berth.
+ *
+ * @param asnBerth the asn berth
+ * @return the i berth
+ */
+ protected IBerth convertBerth(BerthDetailData asnBerth) {
+
+ if (asnBerth == null) return null;
+
+ IBerth berth = factory.createBerth();
+ if (asnBerth.getGender()!= null) {
+ berth.setGender(ICompartmentGenderType.valueOf(asnBerth.getGender().name()));
+ }
+ if (asnBerth.getNumberOfBerths()!=null) {
+ berth.setNumberOfBerths(asnBerth.getNumberOfBerths().intValue());
+ }
+ if (asnBerth.getBerthType()!=null){
+ berth.setType(IBerthTypeType.valueOf(asnBerth.getBerthType().name()));
+ }
+
+ return berth;
+ }
+
+ /**
+ * Convert countermark.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @return the i counter mark
+ */
+ protected ICounterMark convertCountermark(CountermarkData asnDocument , Date issuingDate) {
+
+ ICounterMark document = factory.createCounterMark();
+
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+
+ if(asnDocument.getClassCode()!=null){
+ document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
+ }
+
+ document.setValidFrom(asnDocument.getValidFromDate(issuingDate));
+ document.setValidUntil(asnDocument.getValidUntilDate(issuingDate));
+
+ document.setValidFromUTCoffset(asnDocument.getValidFromUTCOffset());
+ if (asnDocument.getValidUntilUTCOffset() != null) {
+ document.setValidUntilUTCoffset(asnDocument.getValidUntilUTCOffset());
+ } else {
+ document.setValidUntilUTCoffset(asnDocument.getValidFromUTCOffset());
+ }
+
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+ document.setInfoText(asnDocument.getInfoText());
+
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+ document.setTicketReference(UicEncoderUtils.mapToString(asnDocument.getTicketReferenceNum(),asnDocument.getTicketReferenceIA5()));
+
+ document.setFromStation(UicEncoderUtils.mapToString(asnDocument.getFromStationNum(),asnDocument.getFromStationIA5()));
+ document.setToStation(UicEncoderUtils.mapToString(asnDocument.getToStationNum(),asnDocument.getToStationIA5()));
+
+ document.setFromStationName(asnDocument.getFromStationNameUTF8());
+ document.setToStationName(asnDocument.getToStationNameUTF8());
+ document.setValidRegionDesc(asnDocument.getValidRegionDesc());
+
+ if (asnDocument.getValidRegion()!= null && !asnDocument.getValidRegion().isEmpty()) {
+ for (RegionalValidityType validRegion :asnDocument.getValidRegion()){
+ document.addValidRegionList(convertValidRegion(validRegion, issuingDate));
+ }
+ }
+
+ document.setReturnDescription(convertReturnDescription(asnDocument.getReturnDescription(), issuingDate));
+
+
+ if(asnDocument.getReturnIncluded()!=null){
+ document.setReturnIncluded(asnDocument.getReturnIncluded());
+ } else {
+ document.setReturnIncluded(false);
+ }
+
+
+
+ document.setGroupName(asnDocument.getGroupName());
+
+ if (asnDocument.getNumberOfCountermark() != null) {
+ document.setNumberOfCountermark(asnDocument.getNumberOfCountermark().intValue());
+ }
+
+ if (asnDocument.getTotalOfCountermarks() != null) {
+ document.setTotalOfCountermarks(asnDocument.getTotalOfCountermarks().intValue());
+ }
+
+ return document;
+
+ }
+
+ /**
+ * Convert return description.
+ *
+ * @param asnReturnRoute the asn return route
+ * @param issuingDate the issuing date
+ * @return the i return route description
+ */
+ protected IReturnRouteDescription convertReturnDescription(ReturnRouteDescriptionType asnReturnRoute, Date issuingDate) {
+
+ if (asnReturnRoute == null) return null;
+
+ IReturnRouteDescription route = factory.createReturnRouteDescription();
+
+ route.setFromStation(UicEncoderUtils.mapToString(asnReturnRoute.getFromStationNum(),asnReturnRoute.getFromStationIA5()));
+ route.setToStation(UicEncoderUtils.mapToString(asnReturnRoute.getToStationNum(),asnReturnRoute.getToStationIA5()));
+
+ route.setFromStationName(asnReturnRoute.getFromStationNameUTF8());
+ route.setToStationName(asnReturnRoute.getToStationNameUTF8());
+ route.setValidRegionDesc(asnReturnRoute.getValidReturnRegionDesc());
+
+ if (asnReturnRoute.getValidReturnRegion()!= null && !asnReturnRoute.getValidReturnRegion().isEmpty()) {
+ for (RegionalValidityType validRegion :asnReturnRoute.getValidReturnRegion()){
+ route.addValidRegionList(convertValidRegion(validRegion, issuingDate));
+ }
+ }
+
+ return route;
+ }
+
+ /**
+ * Convert luggage restriction.
+ *
+ * @param asnLuggage the asn luggage
+ * @return the i luggage restriction
+ */
+ protected ILuggageRestriction convertLuggageRestriction(LuggageRestrictionType asnLuggage) {
+
+ if (asnLuggage == null) return null;
+
+ ILuggageRestriction luggage = factory.createLuggageRestriction();
+ if (asnLuggage.getMaxHandLuggagePieces()!=null){
+ luggage.setMaxHandLuggagePieces(asnLuggage.getMaxHandLuggagePieces().intValue());
+ }
+ if (asnLuggage.getMaxNonHandLuggagePieces()!=null){
+ luggage.setMaxNonHandLuggagePieces(asnLuggage.getMaxNonHandLuggagePieces().intValue());
+ }
+
+
+ if (asnLuggage.getRegisteredLuggage()!= null &&!asnLuggage.getRegisteredLuggage().isEmpty()){
+ for (RegisteredLuggageType rl: asnLuggage.getRegisteredLuggage()){
+ luggage.addRegisteredLuggage(convertRegisteredLuggage(rl));
+ }
+ }
+ return luggage;
+ }
+
+ /**
+ * Convert registered luggage.
+ *
+ * @param rl the rl
+ * @return the i registered luggage
+ */
+ protected IRegisteredLuggage convertRegisteredLuggage(RegisteredLuggageType rl) {
+
+ if (rl == null) return null;
+
+ IRegisteredLuggage luggage= factory.createRegisteredLuggage();
+ if (rl.getMaxSize()!=null){
+ if (rl.getMaxSize()!=null) {
+ luggage.setMaxSize(rl.getMaxSize().intValue());
+ }
+ }
+ if (rl.getMaxWeight()!=null){
+ if(rl.getMaxWeight()!=null){
+ luggage.setMaxWeight(rl.getMaxWeight().intValue());
+ }
+ }
+ luggage.setRegistrationId(rl.getRegistrationId());
+ return luggage;
+ }
+
+
+ /**
+ * Convert open ticket.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @return the i open ticket
+ */
+ protected IOpenTicket convertOpenTicket(OpenTicketData asnDocument , Date issuingDate) {
+
+ IOpenTicket document = factory.createOpenTicket();
+
+ if(asnDocument.getClassCode()!=null){
+ document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
+ }
+
+ document.setValidFrom(asnDocument.getValidFromDate(issuingDate));
+ document.setValidUntil(asnDocument.getValidUntilDate(issuingDate));
+
+ document.setValidFromUTCoffset(asnDocument.getValidFromUTCOffset());
+ if (asnDocument.getValidUntilUTCOffset() != null) {
+ document.setValidUntilUTCoffset(asnDocument.getValidUntilUTCOffset());
+ } else {
+ document.setValidUntilUTCoffset(asnDocument.getValidFromUTCOffset());
+ }
+
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+ document.setInfoText(asnDocument.getInfoText());
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+
+ if (asnDocument.getExcludedServiceBrands()!=null && !asnDocument.getExcludedServiceBrands().isEmpty()){
+ for(Long number :asnDocument.getExcludedServiceBrands()){
+ document.addExcludedServiceBrand(number.intValue());
+ }
+ }
+
+ 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.getTariffs()!=null && !asnDocument.getTariffs().isEmpty()){
+ for(TariffType asnTariff :asnDocument.getTariffs()){
+ document.addTariff(convertTariff(asnTariff));
+ }
+ }
+
+ 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()));
+ document.setFromStationName(asnDocument.getFromStationNameUTF8());
+ document.setToStationName(asnDocument.getToStationNameUTF8());
+ document.setValidRegionDesc(asnDocument.getValidRegionDesc());
+ if (asnDocument.getValidRegion()!= null && !asnDocument.getValidRegion().isEmpty()) {
+ for (RegionalValidityType validRegion :asnDocument.getValidRegion()){
+ document.addValidRegionList(convertValidRegion(validRegion, issuingDate));
+ }
+ }
+
+ if (asnDocument.getIssuerAutorizationId() != null) {
+ document.setAuthorizationCode(asnDocument.getIssuerAutorizationId().intValue());
+ }
+
+ if (asnDocument.getExtIssuerId() != null) {
+ document.setExternalIssuer(asnDocument.getExtIssuerId().intValue());
+ }
+
+ document.setLuggageRestriction(convertLuggageRestriction(asnDocument.getLuggage()));
+
+ document.setReturnDescription(convertReturnDescription(asnDocument.getReturnDescription(), issuingDate));
+ if(asnDocument.getReturnIncluded()!=null){
+ document.setReturnIncluded(asnDocument.getReturnIncluded());
+ }
+
+ if (asnDocument.getActivatedDay()!=null && !asnDocument.getActivatedDay().isEmpty()) {
+ document.getActivatedDays().addAll(asnDocument.getActivatedDays(issuingDate));
+ }
+
+ if (asnDocument.getIncludedAddOns()!= null && !asnDocument.getIncludedAddOns().isEmpty()) {
+
+ for (IncludedOpenTicketType asnAddOn :asnDocument.getIncludedAddOns()) {
+
+ IIncludedOpenTicket addOn = convertIncludedOpenTicket(asnAddOn, issuingDate, document.getClassCode());
+ if (addOn != null) {
+ document.addIncludedAddOn(addOn);
+ }
+ }
+
+
+
+ }
+
+ document.setPrice(asnDocument.getPrice());
+
+ if (asnDocument.getVatDetails() != null && !asnDocument.getVatDetails().isEmpty()){
+ for (VatDetailType vat : asnDocument.getVatDetails()) {
+ document.addVatDetail(decodeVatDetail(vat));
+ }
+ }
+
+ return document;
+
+ }
+
+
+
+ /**
+ * Convert included open ticket.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @param classCode the class code
+ * @return the simple included open ticket
+ */
+ private IIncludedOpenTicket convertIncludedOpenTicket( IncludedOpenTicketType asnDocument, Date issuingDate,ITravelClassType classCode) {
+
+ IIncludedOpenTicket document = factory.createIncludedOpenTicket();
+
+ if(asnDocument.getClassCode()!=null){
+ document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
+ } else {
+ document.setClassCode(classCode);
+ }
+
+ document.setValidFrom(asnDocument.getValidFromDate(issuingDate));
+ document.setValidUntil(asnDocument.getValidUntilDate(issuingDate));
+
+ document.setValidFromUTCoffset(asnDocument.getValidFromUTCOffset());
+ if (asnDocument.getValidUntilUTCOffset() != null) {
+ document.setValidUntilUTCoffset(asnDocument.getValidUntilUTCOffset());
+ } else {
+ document.setValidUntilUTCoffset(asnDocument.getValidFromUTCOffset());
+ }
+
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+ document.setInfoText(asnDocument.getInfoText());
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+
+ if (asnDocument.getExcludedServiceBrands()!=null && !asnDocument.getExcludedServiceBrands().isEmpty()){
+ for(Long number :asnDocument.getExcludedServiceBrands()){
+ document.addExcludedServiceBrand(number.intValue());
+ }
+ }
+ if (asnDocument.getIncludedCarriersNum()!=null && !asnDocument.getIncludedCarriersNum().isEmpty()){
+ for(Long carrier :asnDocument.getIncludedCarriersNum()){
+ document.addIncludedCarrier(carrier.toString());
+ }
+ }
+ if (asnDocument.getIncludedCarriersIA5()!=null && !asnDocument.getIncludedCarriersIA5().isEmpty()){
+ for(String carrier :asnDocument.getIncludedCarriersIA5()){
+ document.addIncludedCarrier(carrier);
+ }
+ }
+
+ if (asnDocument.getIncludedServiceBrands()!=null && !asnDocument.getIncludedServiceBrands().isEmpty()){
+ for(Long number :asnDocument.getIncludedServiceBrands()){
+ document.addIncludedServiceBrand(number.intValue());
+ }
+ }
+
+ if (asnDocument.getTariffs()!=null && !asnDocument.getTariffs().isEmpty()){
+ for(TariffType asnTariff :asnDocument.getTariffs()){
+ document.addTariff(convertTariff(asnTariff));
+ }
+ }
+
+ if (asnDocument.getStationCodeTable()!=null){
+ document.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
+ }
+
+ if (asnDocument.getValidRegion()!= null && !asnDocument.getValidRegion().isEmpty()) {
+ for (RegionalValidityType validRegion :asnDocument.getValidRegion()){
+ document.addValidRegionList(convertValidRegion(validRegion, issuingDate));
+ }
+ }
+
+ if (asnDocument.getIssuerAutorizationId()!=null){
+ document.setAuthorizationCode(asnDocument.getIssuerAutorizationId().intValue());
+ }
+ if (asnDocument.getExternalIssuerId()!=null){
+ document.setExternalIssuer(asnDocument.getExternalIssuerId().intValue());
+ }
+ return document;
+ }
+
+
+
+
+
+
+
+ /**
+ * Convert station passage.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @return the i station passage
+ */
+ protected IStationPassage convertStationPassage(StationPassageData asnDocument , Date issuingDate) {
+
+ IStationPassage document = factory.createStationPassage();
+
+ document.setValidFrom(asnDocument.getValidFromDate(issuingDate));
+ document.setValidUntil(asnDocument.getValidUntilDate(issuingDate));
+
+ document.setValidFromUTCoffset(asnDocument.getValidFromUTCOffset());
+ if (asnDocument.getValidUntilUTCOffset() != null) {
+ document.setValidUntilUTCoffset(asnDocument.getValidUntilUTCOffset());
+ } else {
+ document.setValidUntilUTCoffset(asnDocument.getValidFromUTCOffset());
+ }
+
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+
+ if (asnDocument.getNumberOfDaysValid()!=null) {
+ document.setNumberOfdaysAllowed(asnDocument.getNumberOfDaysValid().intValue());
+ }
+
+ if (asnDocument.getStationNum()!=null && !asnDocument.getStationNum().isEmpty()){
+ for (Long station : asnDocument.getStationNum()) {
+ if (station != null) {
+ document.addStation(station.toString());
+ }
+ }
+ }
+ if (asnDocument.getStationIA5()!=null && !asnDocument.getStationIA5().isEmpty()){
+ for (String station : asnDocument.getStationIA5()) {
+ document.addStation(station);
+ }
+ }
+
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+
+ document.setProductName(asnDocument.getProductName());
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+
+ if (asnDocument.getStationNameUTF8()!= null && asnDocument.getStationNameUTF8().isEmpty() ) {
+ for (String name : asnDocument.getStationNameUTF8()) {
+ document.addStation(name);
+ }
+ }
+
+ if (asnDocument.getStationCodeTable()!=null){
+ document.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
+ }
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+
+ if (asnDocument.getAreaCodeIA5() != null && !asnDocument.getAreaCodeIA5().isEmpty()) {
+ for (String code : asnDocument.getAreaCodeIA5()) {
+ document.addAreaCode(code);
+ }
+ }
+ if (asnDocument.getAreaCodeNum() != null && !asnDocument.getAreaCodeNum().isEmpty()) {
+ for (Long code : asnDocument.getAreaCodeNum()) {
+ if (code != null) {
+ document.addAreaCode(code.toString());
+ }
+ }
+ }
+
+ if (asnDocument.getAreaNameUTF8() != null && !asnDocument.getAreaNameUTF8().isEmpty()) {
+ for (String code : asnDocument.getAreaNameUTF8()) {
+ document.addAreaName(code);
+ }
+ }
+
+
+
+ return document;
+ }
+
+
+ /**
+ * Convert valid region.
+ *
+ * @param asnRegion the asn region
+ * @param issuingDate the issuing date
+ * @return the i regional validity
+ */
+ protected IRegionalValidity convertValidRegion(RegionalValidityType asnRegion, Date issuingDate) {
+
+ if (asnRegion == null) return null;
+
+ if (asnRegion.getLines()!=null){
+ return convertLine(asnRegion.getLines());
+ }
+ if (asnRegion.getPolygone()!=null){
+ return convertPolygone(asnRegion.getPolygone());
+ }
+ if (asnRegion.getTrainLink()!=null){
+ return convertTrainLink(asnRegion.getTrainLink(),issuingDate);
+ }
+ if (asnRegion.getViaStations()!=null){
+ return convertViaStation(asnRegion.getViaStations());
+ }
+ if (asnRegion.getZones()!=null){
+ return convertZone(asnRegion.getZones());
+ }
+ return null;
+ }
+
+
+ /**
+ * Convert parking ground.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @return the i parking ground
+ */
+ protected IParkingGround convertParkingGround(ParkingGroundData asnDocument , Date issuingDate) {
+
+ IParkingGround document = factory.createParkingGround();
+
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+
+
+ document.setAccessCode(asnDocument.getAccessCode());
+ document.setLocation(asnDocument.getLocation());
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+
+ document.setNumberPlate(asnDocument.getNumberPlate());
+ document.setEntryTrack(asnDocument.getEntryTrack());
+
+
+ document.setFromParkingDate(asnDocument.getFromParkingDate(issuingDate));
+ document.setToParkingDate(asnDocument.getToParkingDate(issuingDate));
+
+ document.setParkingGroundId(asnDocument.getParkingGroundId());
+
+ document.setSpecialInformation(asnDocument.getSpecialInformation());
+
+ if (asnDocument.getStationCodeTable()!=null){
+ document.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
+ }
+
+ document.setStation(UicEncoderUtils.mapToString(asnDocument.getStationNum(),asnDocument.getStationIA5()));
+
+ document.setPrice(asnDocument.getPrice());
+
+ if (asnDocument.getVatDetails() != null && !asnDocument.getVatDetails().isEmpty()){
+ for (VatDetailType vat : asnDocument.getVatDetails()) {
+ document.addVatDetail(decodeVatDetail(vat));
+ }
+ }
+
+ return document;
+ }
+
+ /**
+ * Convert via station.
+ *
+ * @param asnDocument the asn via
+ * @return the i via station
+ */
+ protected IViaStation convertViaStation(ViaStationType asnDocument) {
+
+ if (asnDocument == null) return null;
+
+ IViaStation via = factory.createViaStation();
+
+ if (asnDocument.getBorder()!=null) {
+ via.setBorder(asnDocument.getBorder());
+ }
+
+ if (asnDocument.getRouteId() != null) {
+ via.setRouteId(asnDocument.getRouteId().intValue());
+ }
+
+ if (asnDocument.getStationCodeTable()!=null){
+ via.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
+ }
+
+ if (asnDocument.getStationNum() != null) {
+ via.setStation(asnDocument.getStationNum().toString());
+ } else if (asnDocument.getStationIA5() != null) {
+ via.setStation(asnDocument.getStationIA5());
+ }
+
+ if (asnDocument.getCarriersNum()!=null && !asnDocument.getCarriersNum().isEmpty()){
+ for(Long carrier :asnDocument.getCarriersNum()){
+ via.addCarrier(carrier.toString());
+ }
+ }
+ if (asnDocument.getCarriersIA5()!=null && !asnDocument.getCarriersIA5().isEmpty()){
+ for(String carrier :asnDocument.getCarriersIA5()){
+ via.addCarrier(carrier);
+ }
+ }
+
+ if (asnDocument.getRoute()!= null && !asnDocument.getRoute().isEmpty()) {
+ for ( ViaStationType routeVia: asnDocument.getRoute()) {
+ via.addRouteStation(convertViaStation(routeVia));
+ }
+ }
+ if (asnDocument.getAlternativeRoutes()!= null && !asnDocument.getAlternativeRoutes().isEmpty()) {
+ for ( ViaStationType routeVia: asnDocument.getAlternativeRoutes()) {
+ via.addRouteStation(convertViaStation(routeVia));
+ }
+ }
+
+
+ return via;
+ }
+
+ /**
+ * Convert train link.
+ *
+ * @param asnTrainLink the asn train link
+ * @param issuingDate the issuing date
+ * @return the i regional validity
+ */
+ protected IRegionalValidity convertTrainLink(TrainLinkType asnTrainLink, Date issuingDate) {
+
+ ITrainLink trainLink = factory.createTrainLink();
+
+ trainLink.setTrain(UicEncoderUtils.mapToString(asnTrainLink.getTrainNum(), asnTrainLink.getTrainIA5()));
+
+ trainLink.setFromStation(UicEncoderUtils.mapToString(asnTrainLink.getFromStationNum(),asnTrainLink.getFromStationIA5()));
+ trainLink.setToStation(UicEncoderUtils.mapToString(asnTrainLink.getToStationNum(),asnTrainLink.getToStationIA5()));
+ trainLink.setFromStationName(asnTrainLink.getFromStationName());
+ trainLink.setToStationName(asnTrainLink.getToStationName());
+
+ trainLink.setDepartureDateTime(asnTrainLink.getDepartureDate(issuingDate));
+
+ return trainLink;
+ }
+
+ /**
+ * Convert zone.
+ *
+ * @param asnDocument the asn zone
+ * @return the i regional validity
+ */
+ protected IRegionalValidity convertZone(ZoneType asnDocument) {
+
+ if (asnDocument == null) return null;
+
+ IZone zone = factory.createZone();
+
+ zone.setBinaryZoneId(asnDocument.getBinaryZoneId());
+ zone.setCarrier(UicEncoderUtils.mapToString(asnDocument.getCarrierNum(),asnDocument.getCarrierIA5()));
+
+ if (asnDocument.getCity() != null) {
+ zone.setCity(asnDocument.getCity().intValue());
+ }
+ if (asnDocument.getStationCodeTable()!=null){
+ zone.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
+ }
+ zone.setEntryStation(UicEncoderUtils.mapToString(asnDocument.getEntryStationNum(),asnDocument.getEntryStationIA5()));
+ zone.setTerminatingStation(UicEncoderUtils.mapToString(asnDocument.getTerminatingStationNum(),asnDocument.getTerminatingStationIA5()));
+
+ zone.setNUTScode(asnDocument.getNutsCode());
+
+ return zone;
+ }
+
+ /**
+ * Convert polygone.
+ *
+ * @param asnPolygone the asn polygone
+ * @return the i regional validity
+ */
+ protected IRegionalValidity convertPolygone(PolygoneType asnPolygone) {
+
+ if (asnPolygone == null) return null;
+
+ IPolygone polygone = factory.createPolygone();
+
+ IGeoCoordinate firstEdge = convertGeoCoordinate(asnPolygone.getFirstEdge());
+
+ if (firstEdge == null) return null;
+
+ if (asnPolygone.getEdges()!=null && !asnPolygone.getEdges().isEmpty()) {
+ for (DeltaCoordinates asnEdge :asnPolygone.getEdges()){
+
+ IGeoCoordinate edge = firstEdge.clone();
+ try {
+ edge.addLongitude(asnEdge.getLongitude().longValue());
+ edge.addLatitude(asnEdge.getLatitude().longValue());
+ } catch (Exception e) {
+
+ }
+ polygone.addEdge(edge);
+ }
+ }
+ return polygone;
+ }
+
+ /**
+ * Convert line.
+ *
+ * @param asnDocument the asn line
+ * @return the i regional validity
+ */
+ protected IRegionalValidity convertLine(LineType asnDocument) {
+
+ if (asnDocument == null) return null;
+
+ ILine line = factory.createLine();
+
+ line.setBinaryZoneId(asnDocument.getBinaryZoneId());
+ line.setCarrier(UicEncoderUtils.mapToString(asnDocument.getCarrierNum(),asnDocument.getCarrierIA5()));
+ if (asnDocument.getCity()!=null) {
+ line.setCity(asnDocument.getCity().intValue());
+ }
+ if (asnDocument.getStationCodeTable()!=null){
+ line.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
+ }
+ line.setEntryStation(UicEncoderUtils.mapToString(asnDocument.getEntryStationNum(),asnDocument.getEntryStationIA5()));
+ line.setTerminatingStation(UicEncoderUtils.mapToString(asnDocument.getTerminatingStationNum(),asnDocument.getTerminatingStationIA5()));
+ if (asnDocument.getLineId()!=null && !asnDocument.getLineId().isEmpty()){
+ for (Long lineId : asnDocument.getLineId()) {
+ line.addLineId(lineId.intValue());
+ }
+ }
+ return line;
+ }
+
+ /**
+ * Convert tariff.
+ *
+ * @param asnTariff the asn tariff
+ * @return the i tariff
+ */
+ protected ITariff convertTariff(TariffType asnTariff) {
+
+ if (asnTariff== null) return null;
+
+ ITariff tariff = factory.createTariff();
+
+ if (asnTariff.getAgeAbove() != null) {
+ tariff.setAgeAbove(asnTariff.getAgeAbove().intValue());
+ }
+
+ if (asnTariff.getAgeBelow() != null) {
+ tariff.setAgeBelow(asnTariff.getAgeBelow().intValue());
+ }
+
+ if(asnTariff.getNumberOfPassengers()!=null){
+ tariff.setNumberOfPassengers(asnTariff.getNumberOfPassengers().intValue());
+ }
+
+ if (asnTariff.getSeriesDataDetails() != null) {
+ tariff.setSeriesDataDetails(convertSeriesDataDetails(asnTariff.getSeriesDataDetails()));
+ }
+
+
+ if (asnTariff.getPassengerType()!=null) {
+ tariff.setPassengerType(IPassengerType.valueOf(asnTariff.getPassengerType().name()));
+ }
+
+
+ if(asnTariff.getRestrictedToCountryOfResidence()!=null){
+ tariff.setRestrictedToCountryOfResidence(asnTariff.getRestrictedToCountryOfResidence());
+ }
+ if (asnTariff.getRestrictedToRouteSection()!=null){
+ tariff.setRestrictedToRouteSection(convertRouteSection(asnTariff.getRestrictedToRouteSection()));
+ }
+
+
+ tariff.setTariffDescription(asnTariff.getTariffDesc());
+ tariff.setTariffId(UicEncoderUtils.mapToString(asnTariff.getTariffIdNum(),asnTariff.getTariffIdIA5()));
+
+ if (asnTariff.getTraverlerid()!= null && !asnTariff.getTraverlerid().isEmpty() ) {
+ for (Long number : asnTariff.getTraverlerid()){
+ tariff.addTravelerId(number.intValue());
+ }
+ }
+
+ if (asnTariff.getReductionCard()!=null && !asnTariff.getReductionCard().isEmpty()){
+ for(CardReferenceType card : asnTariff.getReductionCard()){
+ tariff.addReductionCard(convertCardReference(card));
+ }
+ }
+
+ return tariff;
+ }
+
+ private ISeriesDataDetails convertSeriesDataDetails(SeriesDetailType asnDetails) {
+
+ if (asnDetails == null) return null;
+
+ ISeriesDataDetails details = factory.createSeriesDataDetails();
+
+ if (asnDetails.getSeries() != null) {
+ details.setSeries(asnDetails.getSeries().intValue());
+ }
+
+ if (asnDetails.getSupplyingCarrier() != null) {
+ details.setSupplyingCarrier(asnDetails.getSupplyingCarrier().intValue());
+ }
+
+ if (asnDetails.getOfferIdentification() != null) {
+ details.setOfferIdentification(asnDetails.getOfferIdentification().intValue());
+ }
+
+ return details;
+ }
+
+
+
+
+
+
+
+ /**
+ * Convert route section.
+ *
+ * @param asnDocument the asn document
+ * @return the i route section
+ */
+ protected IRouteSection convertRouteSection(RouteSectionType asnDocument) {
+
+ if (asnDocument == null) return null;
+
+ IRouteSection document = factory.createRouteSection();
+ 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()));
+ document.setFromStationName(asnDocument.getFromStationNameUTF8());
+ document.setToStationName(asnDocument.getToStationNameUTF8());
+ return document;
+ }
+
+ /**
+ * Convert fip ticket.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @return the i fip ticket
+ */
+ protected IFipTicket convertFipTicket(FIPTicketData asnDocument , Date issuingDate) {
+
+ if (asnDocument == null) return null;
+
+ IFipTicket document = factory.createFipTicket();
+ if(asnDocument.getClassCode()!=null){
+ document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
+ }
+
+ document.setValidFrom(asnDocument.getValidFromDate(issuingDate));
+ document.setValidUntil(asnDocument.getValidUntilDate(issuingDate));
+
+
+
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+
+ if (asnDocument.getActivatedDay()!=null && !asnDocument.getActivatedDay().isEmpty()) {
+ document.getActivatedDays().addAll(asnDocument.getActivatedDays(issuingDate));
+ }
+
+ if(asnDocument.getIncludesSupplements()!=null) {
+ document.setIncludesSupplements(asnDocument.getIncludesSupplements());
+ }
+ if(asnDocument.getNumberOfTravelDays()!=null){
+ document.setNumberOfTravelDates(asnDocument.getNumberOfTravelDays().intValue());
+ }
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+
+ return document;
+ }
+
+ /**
+ * Convert pass.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @return the i pass
+ */
+ protected IPass convertPass(PassData asnDocument, Date issuingDate) {
+
+ if (asnDocument == null) return null;
+
+ IPass document = factory.createPass();
+
+ if(asnDocument.getClassCode()!=null){
+ document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
+ }
+
+ document.setValidFrom(asnDocument.getValidFromDate(issuingDate));
+ document.setValidFromUTCoffset(asnDocument.getValidFromUTCOffset());
+
+ document.setValidUntil(asnDocument.getValidUntilDate(issuingDate));
+ document.setValidUntilUTCoffset(asnDocument.getValidUntilUTCOffset());
+
+ if (asnDocument.getActivatedDay()!=null && !asnDocument.getActivatedDay().isEmpty()) {
+ if (document.getValidFrom() != null) {
+ document.getActivatedDays().addAll(asnDocument.getActivatedDays(document.getValidFrom()));
+ } else {
+ document.getActivatedDays().addAll(asnDocument.getActivatedDays(issuingDate));
+ }
+ }
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+ document.setInfoText(asnDocument.getInfoText());
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+
+ if (asnDocument.getNumberOfDaysOfTravel() != null) {
+ document.setNumberOfDaysOfTravel(asnDocument.getNumberOfDaysOfTravel().intValue());
+ }
+ if (asnDocument.getNumberOfPossibleTrips() != null) {
+ document.setNumberOfPossibleTrips(asnDocument.getNumberOfPossibleTrips().intValue());
+ }
+
+ document.setPassDescription(asnDocument.getPassDescription());
+ if(asnDocument.getPassType()!=null){
+ document.setPassType(asnDocument.getPassType().intValue());
+ }
+
+
+
+ if (asnDocument.getCountries()!=null && !asnDocument.getCountries().isEmpty()){
+ for(Long number :asnDocument.getCountries()){
+ document.addCountry(number.intValue());
+ }
+ }
+ if (asnDocument.getExcludedServiceBrands()!=null && !asnDocument.getExcludedServiceBrands().isEmpty()){
+ for(Long number :asnDocument.getExcludedServiceBrands()){
+ document.addExcludedServiceBrand(number.intValue());
+ }
+ }
+
+ if (asnDocument.getIncludedCarriersNum()!=null && !asnDocument.getIncludedCarriersNum().isEmpty()){
+ for(Long carrier :asnDocument.getIncludedCarriersNum()){
+ document.addIncludedCarrier(carrier.toString());
+ }
+ }
+ if (asnDocument.getIncludedCarriersIA5()!=null && !asnDocument.getIncludedCarriersIA5().isEmpty()){
+ for(String carrier :asnDocument.getIncludedCarriersIA5()){
+ document.addIncludedCarrier(carrier);
+ }
+ }
+
+ if (asnDocument.getExcludedCarriersNum()!=null && !asnDocument.getExcludedCarriersNum().isEmpty()){
+ for(Long carrier :asnDocument.getExcludedCarriersNum()){
+ document.addExcludedCarrier(carrier.toString());
+ }
+ }
+ if (asnDocument.getExcludedCarriersIA5()!=null && !asnDocument.getExcludedCarriersIA5().isEmpty()){
+ for(String carrier :asnDocument.getExcludedCarriersIA5()){
+ document.addExcludedCarrier(carrier);
+ }
+ }
+
+
+ if (asnDocument.getIncludedServiceBrands()!=null && !asnDocument.getIncludedServiceBrands().isEmpty()){
+ for(Long number :asnDocument.getIncludedServiceBrands()){
+ document.addIncludedServiceBrand(number.intValue());
+ }
+ }
+
+ if (asnDocument.getTariffs()!=null && !asnDocument.getTariffs().isEmpty()){
+ for(TariffType asnTariff :asnDocument.getTariffs()){
+ document.addTariff(convertTariff(asnTariff));
+ }
+ }
+
+ if (asnDocument.getValidRegion()!=null && !asnDocument.getValidRegion().isEmpty()){
+ for(RegionalValidityType asnRegion :asnDocument.getValidRegion()){
+ document.addValidRegion(convertValidRegion(asnRegion, issuingDate));
+ }
+ }
+
+
+ if (asnDocument.getValidityPeriodDetails() != null) {
+ document.setValidityDetails(convertValidityDetails(asnDocument.getValidityPeriodDetails(), issuingDate));
+ }
+
+ document.setPrice(asnDocument.getPrice());
+
+ if (asnDocument.getVatDetails() != null && !asnDocument.getVatDetails().isEmpty()){
+ for (VatDetailType vat : asnDocument.getVatDetails()) {
+ document.addVatDetail(decodeVatDetail(vat));
+ }
+ }
+
+
+ return document;
+ }
+
+ private IValidityDetails convertValidityDetails(ValidityPeriodDetailType asnDetails, Date issuingDate) {
+
+ if (asnDetails == null) return null;
+
+ IValidityDetails details = factory.createValidityDetails();
+
+ if (asnDetails.getExcludedTimeRange()!= null && !asnDetails.getExcludedTimeRange().isEmpty()) {
+
+ ITimeRange range = factory.createTimeRange();
+
+ for (TimeRangeType asnRange : asnDetails.getExcludedTimeRange() ) {
+
+ if (asnRange.getFromTime() != null) {
+ range.setFromTime(asnRange.getFromTime().intValue());
+ }
+ if (asnRange.getUntilTime() != null) {
+ range.setUntilTime(asnRange.getUntilTime().intValue());
+ }
+
+ details.addTimeRanges(range);
+ }
+
+
+
+ }
+
+ if (asnDetails.getValidityPeriod()!= null && !asnDetails.getValidityPeriod().isEmpty()) {
+
+ IValidityRange range = factory.createValidityRange();
+
+ for (ValidityPeriodType asnRange : asnDetails.getValidityPeriod() ) {
+
+ range.setFromDate(asnRange.getValidFromDate(issuingDate));
+ range.setUntilDate(asnRange.getValidUntilDate(issuingDate));
+
+ range.setValidFromUTCoffset(asnRange.getValidFromUTCOffset());
+ if (asnRange.getValidUntilUTCOffset() != null) {
+ range.setValidUntilUTCoffset(asnRange.getValidUntilUTCOffset());
+ } else {
+ range.setValidUntilUTCoffset(asnRange.getValidFromUTCOffset());
+ }
+
+ details.addValidityRanges(range);
+ }
+
+ }
+
+ return details;
+ }
+
+
+
+
+
+
+
+ /**
+ * Convert voucher.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @return the i voucher
+ */
+ protected IVoucher convertVoucher(VoucherData asnDocument , Date issuingDate) {
+
+ if (asnDocument == null) return null;
+
+ IVoucher document = factory.createVoucher();
+
+ document.setValidFrom(asnDocument.getValidFrom());
+
+ document.setValidUntil(asnDocument.getValidUntil());
+
+ document.setInfoText(asnDocument.getInfoText());
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+
+ if (asnDocument.getValue()!=null) {
+ document.setAmount(asnDocument.getValue().intValue());
+ }
+
+ if (asnDocument.getType()!= null) {
+ document.setType(asnDocument.getType().intValue());
+ }
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+
+ return document;
+ }
+
+ /**
+ * Convert customer card.
+ *
+ * @param asnDocument the asn card
+ * @param issuingDate the issuing date
+ * @return the i customer card
+ */
+ protected ICustomerCard convertCustomerCard(CustomerCardData asnDocument, Date issuingDate ) {
+
+ if (asnDocument == null) return null;
+
+ ICustomerCard card = factory.createCustomerCard();
+
+ card.setCardId(UicEncoderUtils.mapToString(asnDocument.getCardIdNum(), asnDocument.getCardIdIA5()));
+ if (asnDocument.getCardType()!= null) {
+ card.setCardType(asnDocument.getCardType().intValue());
+ }
+ card.setCardTypeDescr(asnDocument.getCardTypeDescr());
+ if(asnDocument.getClassCode()!=null){
+ card.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
+ }
+ if(asnDocument.getCustomer()!=null) {
+ card.setCustomer(convertTraveler(asnDocument.getCustomer()));
+ }
+ if (asnDocument.getCustomerStatus()!=null) {
+ card.setCustomerStatus(asnDocument.getCustomerStatus().intValue());
+ }
+
+ card.setCustomerStatusDescr(asnDocument.getCustomerStatusDescr());
+
+ card.setValidFrom(asnDocument.getValidFromDate());
+
+ card.setValidUntil(asnDocument.getValidUntilDate());
+
+
+ if (asnDocument.getIncludedServices() != null && !asnDocument.getIncludedServices().isEmpty()){
+ for (Long service: asnDocument.getIncludedServices()){
+ card.addIncludedService(new Integer(service.intValue()));
+ }
+ }
+ return card;
+ }
+
+
+ /**
+ * Convert document extension.
+ *
+ * @param extension the extension
+ * @return the i document extension
+ */
+ protected IDocumentExtension convertDocumentExtension(ExtensionData asnExtension) {
+
+ if (asnExtension == null) return null;
+
+ IDocumentExtension documentExtension = factory.createDocumentExtension();
+ documentExtension.setId(asnExtension.getExtensionId());
+ documentExtension.setBinarydata(asnExtension.getExtensionData());
+ return documentExtension;
+ }
+
+
+ /**
+ * Populate traveler details.
+ *
+ * @param asnTravelerDetails the asn traveler details
+ * @param travelerDetails the traveler details
+ */
+ protected void populateTravelerDetails(TravelerData asnTravelerDetails,ITravelerDetail travelerDetails) {
+
+ if (asnTravelerDetails == null) return;
+
+ travelerDetails.setGroupName(asnTravelerDetails.getGroupName());
+
+ travelerDetails.setPreferredLanguage(asnTravelerDetails.getPreferedLanguage());
+
+ if (asnTravelerDetails.getTraveler() != null && !asnTravelerDetails.getTraveler().isEmpty() ) {
+ for ( TravelerType asnTraveler : asnTravelerDetails.getTraveler() ){
+ travelerDetails.addTraveler(convertTraveler(asnTraveler));
+ }
+ }
+ }
+
+ /**
+ * Convert traveler.
+ *
+ * @param asnTraveler the asn traveler
+ * @return the i traveler
+ */
+ protected ITraveler convertTraveler(TravelerType asnTraveler) {
+
+ if (asnTraveler == null) return null;
+
+ ITraveler traveler = factory.createTraveler();
+
+ if (asnTraveler.getCountryOfResidence() != null){
+ traveler.setCountryOfResidence(asnTraveler.getCountryOfResidence().intValue());
+ }
+ if (asnTraveler.getCountryOfPassport() != null) {
+ traveler.setPassportCountry(asnTraveler.getCountryOfPassport().intValue());
+ }
+
+ if (asnTraveler.getCountryOfIdCard() != null) {
+ traveler.setIDCardCountry(asnTraveler.getCountryOfIdCard().intValue());
+ }
+
+
+ traveler.setCustomerId(UicEncoderUtils.mapToString(asnTraveler.getCustomerIdNum(),asnTraveler.getCustomerIdIA5()));
+
+ traveler.setDateOfBirth(asnTraveler.getDateOfBirth());
+
+ traveler.setFirstName(asnTraveler.getFirstName());
+ if (asnTraveler.getGender()!= null) {
+ traveler.setGender(IGenderType.valueOf(asnTraveler.getGender().name()));
+ }
+ traveler.setIdCard(asnTraveler.getIdCard());
+ traveler.setLastName(asnTraveler.getLastName());
+
+ if (asnTraveler.getPassengerType()!= null) {
+ traveler.setPassengerType(IPassengerType.valueOf(asnTraveler.getPassengerType().name()));
+ }
+ if (asnTraveler.getPassengerWithReducedMobility()!= null) {
+ traveler.setPassengerWithReducedMobility(asnTraveler.getPassengerWithReducedMobility());
+ }
+
+ traveler.setPassportId(asnTraveler.getPassportId());
+ traveler.setSecondName(asnTraveler.getSecondName());
+
+ if (asnTraveler.getTicketHolder() != null) {
+ traveler.setTicketHolder(asnTraveler.getTicketHolder());
+ }
+
+ if (asnTraveler.getStatus()!= null && !asnTraveler.getStatus().isEmpty()) {
+
+ for (CustomerStatusType asnStatus : asnTraveler.getStatus()){
+
+ traveler.addStatusDescription( mapToStatusDescription(asnStatus) );
+
+ }
+
+ }
+
+ traveler.setTitle(asnTraveler.getTitle());
+
+ return traveler;
+ }
+
+ /**
+ * Map to status description.
+ *
+ * @param asnStatus the asn status
+ * @return the i customer status description
+ */
+ private ICustomerStatusDescription mapToStatusDescription( CustomerStatusType asnStatus) {
+
+ if (asnStatus == null) return null;
+
+ ICustomerStatusDescription status = factory.createCustomerStatusDescription();
+
+ status.setDescription(asnStatus.getCustomerStatusDescr());
+
+ if (asnStatus.getCustomerStatus()!=null) {
+ status.setStatus(asnStatus.getCustomerStatus().intValue());
+ }
+
+ status.setStatusProvider(UicEncoderUtils.mapToString(asnStatus.getStatusProviderNum(), asnStatus.getStatusProviderIA5()));
+
+ return status;
+ }
+
+
+
+
+
+
+
+ /**
+ * Populate control details.
+ *
+ * @param asnControlDetails the asn control details
+ * @param controlDetails the control details
+ */
+ protected void populateControlDetails(ControlData asnControlDetails, IControlDetail controlDetails) {
+
+ if (asnControlDetails == null || controlDetails==null ) return;
+
+ if (asnControlDetails.getAgeCheckRequired()!= null) {
+ controlDetails.setAgeCheckRequired(asnControlDetails.getAgeCheckRequired());
+ }
+
+ controlDetails.setExtension(convertExtension(asnControlDetails.getExtension()));
+
+ if (asnControlDetails.getIdentificationByIdCard()!=null){
+ controlDetails.setIdentificationByIdCard(asnControlDetails.getIdentificationByIdCard());
+ }
+
+ if (asnControlDetails.getIdentificationByPassportId()!= null){
+ controlDetails.setIdentificationByPassportId(asnControlDetails.getIdentificationByPassportId());
+ }
+
+ if(asnControlDetails.getIdentificationItem()!=null){
+ controlDetails.setIdentificationItem(asnControlDetails.getIdentificationItem().intValue());
+ }
+
+ controlDetails.setInfoText(asnControlDetails.getInfoText());
+
+ if (asnControlDetails.getOnlineValidationRequired()!=null){
+ controlDetails.setOnlineValidationRequired(asnControlDetails.getOnlineValidationRequired());
+ }
+
+ if (asnControlDetails.getRandomDetailedValidationRequired()!= null){
+ controlDetails.setRandomDetailedValidationRequired(asnControlDetails.getRandomDetailedValidationRequired().intValue());
+ }
+
+ if (asnControlDetails.getReductionCardCheckRequired() != null){
+ controlDetails.setReductionCardCheckRequired(asnControlDetails.getReductionCardCheckRequired());
+ }
+
+ if(asnControlDetails.getIdentificationByCardReference()!=null && !asnControlDetails.getIdentificationByCardReference().isEmpty()) {
+ for (CardReferenceType asnCardReference : asnControlDetails.getIdentificationByCardReference()){
+ controlDetails.addIdentificationByCardReference(convertCardReference(asnCardReference));
+ }
+ }
+
+ if (asnControlDetails.getIncludedTickets()!=null && !asnControlDetails.getIncludedTickets().isEmpty()) {
+ for (TicketLinkType asnTicketLink : asnControlDetails.getIncludedTickets()) {
+ controlDetails.addLinkedTicket(convertTicketLink(asnTicketLink));
+ }
+ }
+
+
+ }
+
+
+
+
+
+ /**
+ * Populate issuing detail.
+ *
+ * @param asnIssuingDetail the asn issuing detail
+ * @param issuingDetail the issuing detail
+ */
+ protected void populateIssuingDetail(IssuingData asnIssuingDetail,IIssuingDetail issuingDetail){
+
+ if (asnIssuingDetail== null || issuingDetail == null) return;
+
+ if (asnIssuingDetail.getActivated() != null) {
+ issuingDetail.setActivated(asnIssuingDetail.getActivated());
+ }
+
+ if (asnIssuingDetail.getSpecimen() != null) {
+ issuingDetail.setSpecimen(asnIssuingDetail.getSpecimen());
+ } else {
+ issuingDetail.setSpecimen(false);
+ }
+
+
+ if (asnIssuingDetail.getSecurePaperTicket() != null) {
+ issuingDetail.setSecurePaperTicket(asnIssuingDetail.getSecurePaperTicket());
+ } else {
+ issuingDetail.setSecurePaperTicket(false);
+ }
+
+ issuingDetail.setExtension(convertExtension(asnIssuingDetail.getExtension()));
+
+ if (asnIssuingDetail.getIssuedOnLine()!= null) {
+ issuingDetail.setIssuedOnLine(asnIssuingDetail.getIssuedOnLine().intValue());
+ }
+
+ if (asnIssuingDetail.getIssuedOnTrainIA5()!= null) {
+ issuingDetail.setIssuedOnTrain(asnIssuingDetail.getIssuedOnTrainIA5());
+ }
+ if (asnIssuingDetail.getIssuedOnTrainNum()!= null) {
+ issuingDetail.setIssuedOnTrain(asnIssuingDetail.getIssuedOnTrainNum().toString());
+ }
+
+ if (asnIssuingDetail.getIssuerNum() != null || asnIssuingDetail.getIssuerIA5() != null) {
+ issuingDetail.setIssuer(UicEncoderUtils.mapToString(asnIssuingDetail.getIssuerNum(), asnIssuingDetail.getIssuerIA5()));
+ }
+
+ issuingDetail.setIssuerName(asnIssuingDetail.getIssuerName());
+
+ issuingDetail.setIssuerPNR(asnIssuingDetail.getIssuerPNR());
+
+ issuingDetail.setSecurityProvider(UicEncoderUtils.mapToString(asnIssuingDetail.getSecurityProviderNum(),asnIssuingDetail.getSecurityProviderIA5()));
+
+
+ issuingDetail.setIssuingDate(asnIssuingDetail.getIssuingDate());
+
+
+ if (asnIssuingDetail.getPointOfSale() != null) {
+ issuingDetail.setPointOfSale(convertGeoCoordinate(asnIssuingDetail.getPointOfSale()));
+ }
+
+ }
+
+
+
+ /**
+ * Convert geo coordinate.
+ *
+ * @param asnCoordinate the asn coordinate
+ * @return the i geo coordinate
+ */
+ protected IGeoCoordinate convertGeoCoordinate(GeoCoordinateType asnCoordinate) {
+
+ if (asnCoordinate == null) return null;
+
+ IGeoCoordinate coordinate = factory.createGeoCoordinate();
+
+ if (asnCoordinate.getCoordinateSystem() != null) {
+ coordinate.setSystem(IGeoCoordinateSystemType.valueOf(asnCoordinate.getCoordinateSystem().name()));
+ }
+
+ if (asnCoordinate.getAccuracy() != null) {
+ coordinate.setAccuracy(IGeoUnitType.valueOf(asnCoordinate.getAccuracy().name()));
+ }
+
+ if (asnCoordinate.getGeoUnit() != null) {
+ coordinate.setUnit(IGeoUnitType.valueOf(asnCoordinate.getGeoUnit().name()));
+ }
+
+ if (asnCoordinate.getHemisphereLatitude() != null) {
+ coordinate.setHemisphereLatitude(IHemisphereLatitudeType.valueOf(asnCoordinate.getHemisphereLatitude().name()));
+ }
+
+ if (asnCoordinate.getHemisphereLongitude() != null) {
+ coordinate.setHemisphereLongitude(IHemisphereLongitudeType.valueOf(asnCoordinate.getHemisphereLongitude().name()));
+ }
+
+ coordinate.setLongitude (asnCoordinate.getLongitude());
+ coordinate.setLatitude (asnCoordinate.getLatitude());
+
+
+ return coordinate;
+ }
+
+
+ /**
+ * Convert extension.
+ *
+ * @param asnExtension the asn extension
+ * @return the i extension
+ */
+ protected IExtension convertExtension(ExtensionData asnExtension) {
+ if (asnExtension == null) return null;
+ IExtension extension = factory.createExtension();
+ extension.setId(asnExtension.getExtensionId());
+ extension.setBinarydata(asnExtension.getExtensionData());
+ return extension;
+ }
+
+
+ /**
+ * Convert ticket link.
+ *
+ * @param asnTicketLink the asn ticket link
+ * @return the i ticket link
+ */
+ protected ITicketLink convertTicketLink(TicketLinkType asnTicketLink) {
+
+ if (asnTicketLink == null) return null;
+
+ ITicketLink ticketLink = factory.createTicketLink();
+ ticketLink.setIssuer(asnTicketLink.getIssuerName());
+ ticketLink.setIssuerPNR(asnTicketLink.getIssuerPNR());
+ ticketLink.setProductOwner(UicEncoderUtils.mapToString(asnTicketLink.getProductOwnerNum(),asnTicketLink.getProductOwnerIA5()));
+ ticketLink.setReference(UicEncoderUtils.mapToString(asnTicketLink.getReferenceNum(),asnTicketLink.getReferenceIA5()));
+ if(asnTicketLink.getTicketType()!=null) {
+ ticketLink.setTicketType(ITicketType.valueOf(asnTicketLink.getTicketType().name()));
+ }
+ if(asnTicketLink.getLinkMode()!=null) {
+ ticketLink.setLinkMode(ILinkMode.valueOf(asnTicketLink.getLinkMode().name()));
+ }
+ return ticketLink;
+ }
+
+ /**
+ * Convert card reference.
+ *
+ * @param asnCardReference the asn card reference
+ * @return the card reference
+ */
+ protected ICardReference convertCardReference(CardReferenceType asnCardReference) {
+
+ if (asnCardReference == null) return null;
+
+ ICardReference cardReference = factory.createCardReference();
+ cardReference.setCardId(UicEncoderUtils.mapToString(asnCardReference.getCardIdNum(),asnCardReference.getCardIdIA5()));
+ cardReference.setCardIssuer(UicEncoderUtils.mapToString(asnCardReference.getCardIssuerNum(),asnCardReference.getCardIssuerIA5()));
+ cardReference.setCardName(asnCardReference.getCardName());
+
+ if(asnCardReference.getCardType()!=null) {
+ cardReference.setCardType(asnCardReference.getCardType().intValue());
+ }
+
+
+ cardReference.setLeadingCardId(UicEncoderUtils.mapToString(asnCardReference.getLeadingCardIdNum(),asnCardReference.getLeadingCardIdIA5()));
+ cardReference.setTrailingCardId(UicEncoderUtils.mapToString(asnCardReference.getTrailingCardIdNum(),asnCardReference.getTrailingCardIdIA5()));
+
+ return cardReference;
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java b/src/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java new file mode 100644 index 0000000..4aca9eb --- /dev/null +++ b/src/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java @@ -0,0 +1,2249 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.utils;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
+
+import org.uic.barcode.ticket.api.asn.omv2.BerthDetailData;
+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.CompartmentDetailsType;
+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.DeltaCoordinates;
+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.GeoCoordinateType;
+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.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.PlacesType;
+import org.uic.barcode.ticket.api.asn.omv2.PolygoneType;
+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.RouteSectionType;
+import org.uic.barcode.ticket.api.asn.omv2.SeriesDetailType;
+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.TicketLinkType;
+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.TravelerData;
+import org.uic.barcode.ticket.api.asn.omv2.TravelerType;
+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;
+import org.uic.barcode.ticket.api.impl.SimpleUicTicketObjectFactory;
+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.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;
+import org.uic.barcode.ticket.api.spec.ICustomerStatusDescription;
+import org.uic.barcode.ticket.api.spec.IDelayConfirmation;
+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.IGeoCoordinate;
+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.IIssuingDetail;
+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.ILuggageRestriction;
+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.IPlaces;
+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.IReturnRouteDescription;
+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.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.IToken;
+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.ITravelerDetail;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.api.spec.IUicTicketObjectFactory;
+import org.uic.barcode.ticket.api.spec.IValidityDetails;
+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;
+
+
+/**
+ * The Class OpenAsn2ApiDecoder.
+ */
+public class OpenAsn2ApiDecoderV2 {
+
+ IUicTicketObjectFactory factory = SimpleUicTicketObjectFactory.getInstance();
+
+ /**
+ * Decode from asn.1 unaligned PER encoded data.
+ *
+ * @param asnUicRailTicketData the asn uic rail ticket data
+ * @return the decoded uic rail ticket
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ public IUicRailTicket decodeFromAsn (UicRailTicketData asnUicRailTicketData) throws IOException{
+
+ IUicRailTicket uicRailTicket = factory.createUicRailTicket();
+
+ populateFromAsn1Model(uicRailTicket, asnUicRailTicketData);
+
+ return uicRailTicket;
+
+ }
+
+ /**
+ * Decode from asn.1 unaligned PER encoded data.
+ *
+ * @param data byte array of the asn.1 encoded FCB data
+ * @return the decoded uic rail ticket
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ public IUicRailTicket decodeFromAsn (byte[] data) throws IOException{
+
+ UicRailTicketData asnUicRailTicketData = UicRailTicketData.decode(data);
+
+ IUicRailTicket uicRailTicket = factory.createUicRailTicket();
+
+ populateFromAsn1Model(uicRailTicket, asnUicRailTicketData);
+
+ return uicRailTicket;
+
+ }
+
+
+
+
+
+
+
+ /**
+ * Populate from asn1 model.
+ *
+ * @param uicRailTicket the uic rail ticket
+ * @param asnUicRailTicketData the asn uic rail ticket data
+ */
+ protected void populateFromAsn1Model(IUicRailTicket uicRailTicket, UicRailTicketData asnUicRailTicketData) {
+
+ if (asnUicRailTicketData.getExtension()!= null && !asnUicRailTicketData.getExtension().isEmpty()) {
+ for (ExtensionData asnExtension : asnUicRailTicketData.getExtension()){
+ uicRailTicket.addExtension(convertExtension(asnExtension));
+ }
+ }
+
+ if (asnUicRailTicketData.getIssuingDetail() != null) {
+ populateIssuingDetail(asnUicRailTicketData.getIssuingDetail(), uicRailTicket.getIssuerDetails());
+ }
+
+ if (asnUicRailTicketData.getControlDetail() != null) {
+ populateControlDetails(asnUicRailTicketData.getControlDetail(),uicRailTicket.getControlDetails());
+ }
+
+ if (asnUicRailTicketData.getTravelerDetail() != null) {
+ populateTravelerDetails(asnUicRailTicketData.getTravelerDetail(),uicRailTicket.getTravelerDetails());
+ }
+
+ if (asnUicRailTicketData.getTransportDocument() != null && !asnUicRailTicketData.getTransportDocument().isEmpty()) {
+ populateTravelDocuments(asnUicRailTicketData.getTransportDocument(),uicRailTicket,uicRailTicket.getIssuerDetails().getIssuingDate() );
+ }
+
+
+ }
+
+
+
+
+
+
+ /**
+ * Populate travel documents.
+ *
+ * @param asnTransportDocuments the asn transport documents
+ * @param uicRailTicket the uic rail ticket
+ * @param issuingDate the issuing date
+ */
+ protected void populateTravelDocuments(List<DocumentData> asnTransportDocuments,IUicRailTicket uicRailTicket, Date issuingDate) {
+
+ for ( DocumentData asnDocument : asnTransportDocuments){
+
+ if (asnDocument.getTicket() == null) {
+ break;
+ }
+
+ if (asnDocument.getTicket().getExtension() != null) {
+ IDocumentExtension ticket = convertDocumentExtension(asnDocument.getTicket().getExtension());
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addDocumentExtension(ticket);
+ }
+
+ if (asnDocument.getTicket().getCarCarriageReservation() != null) {
+ ICarCarriageReservation ticket = convertCarCarriage(asnDocument.getTicket().getCarCarriageReservation(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addCarCarriageReservation(ticket);
+ }
+
+ if (asnDocument.getTicket().getCounterMark() != null) {
+ ICounterMark ticket = convertCountermark(asnDocument.getTicket().getCounterMark(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addCounterMark(ticket);
+ }
+
+ if (asnDocument.getTicket().getCustomerCard()!= null) {
+ ICustomerCard ticket = convertCustomerCard(asnDocument.getTicket().getCustomerCard(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addCustomerCard(ticket);
+ }
+
+ if (asnDocument.getTicket().getFipTicket()!= null) {
+ IFipTicket ticket = convertFipTicket(asnDocument.getTicket().getFipTicket(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addFipTicket(ticket);
+ }
+
+ if (asnDocument.getTicket().getOpenTicket()!= null) {
+ IOpenTicket ticket = convertOpenTicket(asnDocument.getTicket().getOpenTicket(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addOpenTicket(ticket);
+ }
+
+
+ if (asnDocument.getTicket().getParkingGround()!= null) {
+ IParkingGround ticket = convertParkingGround(asnDocument.getTicket().getParkingGround(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addParkingGround(ticket);
+ }
+
+ if (asnDocument.getTicket().getPass() != null) {
+ IPass ticket = convertPass(asnDocument.getTicket().getPass(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addPass(ticket);
+ }
+
+ if (asnDocument.getTicket().getStationPassage() != null) {
+ IStationPassage ticket = convertStationPassage(asnDocument.getTicket().getStationPassage(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addStationPassage(ticket);
+ }
+
+ if (asnDocument.getTicket().getReservation() != null) {
+ IReservation ticket = convertReservation(asnDocument.getTicket().getReservation(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addReservation(ticket);
+ }
+
+ if (asnDocument.getTicket().getVoucher()!= null) {
+ IVoucher ticket = convertVoucher(asnDocument.getTicket().getVoucher(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addVoucher(ticket);
+ }
+
+ if (asnDocument.getTicket().getDelayConfirmation()!= null) {
+ IDelayConfirmation ticket = convertDelayConfirmation(asnDocument.getTicket().getDelayConfirmation(),issuingDate);
+ if (asnDocument.getToken() != null) {
+ IToken token = convertToken(asnDocument.getToken());
+ ticket.setToken(token);
+ }
+ uicRailTicket.addDelayConfirmation(ticket);
+ }
+ }
+ }
+
+
+
+
+
+
+
+
+
+
+ private IToken convertToken(TokenType asnToken) {
+
+ if (asnToken == null) return null;
+
+ IToken token = factory.createToken();
+ token.setToken(asnToken.getToken());
+ token.setTokenProvider(UicEncoderUtils.mapToString(asnToken.getTokenProviderNum(), asnToken.getTokenProviderIA5()));
+ token.setTokenSpecification(asnToken.getTokenSpecification());
+ return token;
+ }
+
+
+
+ private IDelayConfirmation convertDelayConfirmation(DelayConfirmation asnDocument, Date issuingDate) {
+
+ IDelayConfirmation document = factory.createDelayConfirmation();
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum().longValue(),asnDocument.getReferenceIA5()));
+
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+ document.setInfoText(asnDocument.getInfoText());
+
+ if (asnDocument.getStationCodeTable()!=null){
+ 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());
+
+ if (asnDocument.getConfirmationType() != null) {
+ document.setConfirmationType(asnDocument.getConfirmationType().ordinal());
+ }
+
+ if (asnDocument.getDelay() != null) {
+ document.setDelay(asnDocument.getDelay().intValue());
+ }
+
+ if (asnDocument.getTrainCancelled() != null) {
+ document.setTrainCancelled(asnDocument.getTrainCancelled());
+ } else {
+ document.setTrainCancelled(false);
+ }
+
+ if (asnDocument.getAffectedTickets() !=null && !asnDocument.getAffectedTickets().isEmpty()) {
+ for (TicketLinkType asnTicketLink : asnDocument.getAffectedTickets()) {
+ document.addLinkedTicket(convertTicketLink(asnTicketLink));
+ }
+ }
+
+ return document;
+ }
+
+
+
+
+
+
+ /**
+ * Convert reservation.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @return the i reservation
+ */
+ protected IReservation convertReservation(ReservationData asnDocument, Date issuingDate) {
+
+ IReservation document = factory.createReservation();
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+ document.setInfoText(asnDocument.getInfoText());
+
+ 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()));
+ document.setFromStationName(asnDocument.getFromStationNameUTF8());
+ document.setToStationName(asnDocument.getToStationNameUTF8());
+
+ document.setDepartureDate(asnDocument.getDepartureDate(issuingDate));
+ document.setArrivalDate(asnDocument.getArrivalDate(issuingDate));
+
+ document.setDepartureUTCoffset(asnDocument.getDepartureUTCOffset());
+ if (asnDocument.getArrivalUTCOffset() != null) {
+ document.setArrivalUTCoffset(asnDocument.getArrivalUTCOffset());
+ } else {
+ document.setArrivalUTCoffset(asnDocument.getDepartureUTCOffset());
+ }
+
+ if(asnDocument.getClassCode()!=null){
+ document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
+ }
+
+ document.setCompartmentDetails(convertCompartmentDetails(asnDocument.getCompartmentDetails()));
+
+ document.setLuggageRestriction(convertLuggageRestriction(asnDocument.getLuggage()));
+
+ if (asnDocument.getNumberOfOverbooked() != null) {
+ document.setNumberOfOverbooked(asnDocument.getNumberOfOverbooked().intValue());
+ }
+
+ if (asnDocument.getNumberOfSupplements() != null) {
+ document.setNumberOfSupplements(asnDocument.getNumberOfSupplements().intValue());
+ }
+
+ if (asnDocument.getPlaces()!=null) {
+ document.setPlaces(convertPlaces(asnDocument.getPlaces()));
+ }
+
+ if (asnDocument.getBicyclePlaces()!=null) {
+ document.setBicyclePlaces(convertPlaces(asnDocument.getBicyclePlaces()));
+ }
+
+ document.setPriceType(IPriceTypeType.valueOf(asnDocument.getPriceType().name()));
+
+ IServiceBrand serviceBrand = factory.createServiceBrand();
+
+ if (asnDocument.getServiceBrand()!=null){
+ serviceBrand.setServiceBrand(asnDocument.getServiceBrand().intValue());
+ }
+ serviceBrand.setServiceBrandAbbreviation(asnDocument.getServiceBrandAbrUTF8());
+ serviceBrand.setServiceBrandDescription(asnDocument.getServiceBrandNameUTF8());
+
+ document.setServiceBrand(serviceBrand);
+
+ if (asnDocument.getServiceLevel()!=null && asnDocument.getServiceLevel().length() != 0) {
+ document.setServiceLevel(asnDocument.getServiceLevel());
+ }
+
+ document.setTrain(UicEncoderUtils.mapToString(asnDocument.getTrainNum(), asnDocument.getTrainIA5()));
+
+ if (asnDocument.getTypeOfSupplement()!=null) {
+ document.setTypeOfSupplement(asnDocument.getTypeOfSupplement().intValue());
+ }
+
+ if (asnDocument.getBerth()!=null && !asnDocument.getBerth().isEmpty()){
+ for (BerthDetailData asnBerth : asnDocument.getBerth()){
+ document.addBerth(convertBerth(asnBerth));
+ }
+ }
+
+ 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.getTariff()!=null && !asnDocument.getTariff().isEmpty()){
+ for (TariffType asnTariff : asnDocument.getTariff()) {
+ document.addTariff(convertTariff(asnTariff));
+ }
+ }
+
+ document.setPrice(asnDocument.getPrice());
+
+ if (asnDocument.getVatDetails() != null && !asnDocument.getVatDetails().isEmpty()){
+ for (VatDetailType vat : asnDocument.getVatDetails()) {
+ document.addVatDetail(decodeVatDetail(vat));
+ }
+ }
+
+ return document;
+ }
+
+
+
+
+
+
+
+
+
+ /**
+ * Convert car carriage.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @return the i car carriage reservation
+ */
+ protected ICarCarriageReservation convertCarCarriage(CarCarriageReservationData asnDocument , Date issuingDate) {
+
+ ICarCarriageReservation document = factory.createCarCarriageReservation();
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+ document.setInfoText(asnDocument.getInfoText());
+
+ 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()));
+ document.setFromStationName(asnDocument.getFromStationNameUTF8());
+ document.setToStationName(asnDocument.getToStationNameUTF8());
+
+ document.setBeginLoading(asnDocument.getBeginLoadingDate(issuingDate));
+ document.setEndLoading(asnDocument.getEndLoadingDate(issuingDate));
+
+ document.setLoadingTimeUTCoffset(asnDocument.getLoadingUTCOffset());
+
+
+ if(asnDocument.getAttachedBicycles()!=null){
+ document.setAttachedBicycles(asnDocument.getAttachedBicycles().intValue());
+ }
+
+ if (asnDocument.getAttachedBoats()!=null) {
+ document.setAttachedBoats(asnDocument.getAttachedBoats().intValue());
+ }
+
+ if(asnDocument.getAttachedSurfboards()!=null) {
+ document.setAttachedSurfboards(asnDocument.getAttachedSurfboards().intValue());
+ }
+
+ if (asnDocument.getBoatCategory()!=null){
+ document.setBoatCategory(asnDocument.getBoatCategory().intValue());
+ }
+
+ if(asnDocument.getCarCategory()!=null){
+ document.setCarCategory(asnDocument.getCarCategory().intValue());
+ }
+
+ if (asnDocument.getLoadingDeck()!=null){
+ document.setLoadingDeck(ILoadingDeckType.valueOf(asnDocument.getLoadingDeck().name()));
+ }
+
+ if(asnDocument.getLoadingListEntry()!=null){
+ document.setLoadingListEntry(asnDocument.getLoadingListEntry().intValue());
+ }
+
+ if (asnDocument.getRoofRackHeight()!=null){
+ document.setRoofRackHeight(asnDocument.getRoofRackHeight().intValue());
+ }
+
+ document.setNumberPlate(asnDocument.getNumberPlate());
+ document.setTrailerPlate(asnDocument.getTrailerPlate());
+
+ if(asnDocument.getRoofRackType()!=null){
+ document.setRoofRackType(IRoofRackType.valueOf(asnDocument.getRoofRackType().name()));
+ }
+
+ if(asnDocument.getTextileRoof()) {
+ document.setTextileRoof(asnDocument.getTextileRoof());
+ }
+
+
+ document.setCompartmentDetails(convertCompartmentDetails(asnDocument.getCompartmentDetails()));
+
+ 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.getCoach()!=null) {
+ document.setCoach(asnDocument.getCoach());
+ }
+ if (asnDocument.getPlace()!=null) {
+ document.setPlace(asnDocument.getPlace());
+ }
+
+
+ document.setPriceType(IPriceTypeType.valueOf(asnDocument.getPriceType().name()));
+
+ IServiceBrand serviceBrand = factory.createServiceBrand();
+
+ if (asnDocument.getServiceBrand()!=null){
+ serviceBrand.setServiceBrand(asnDocument.getServiceBrand().intValue());
+ }
+ serviceBrand.setServiceBrandAbbreviation(asnDocument.getServiceBrandAbrUTF8());
+ serviceBrand.setServiceBrandDescription(asnDocument.getServiceBrandNameUTF8());
+
+ document.setServiceBrand(serviceBrand);
+
+ document.setTrain(UicEncoderUtils.mapToString(asnDocument.getTrainNum(), asnDocument.getTrainIA5()));
+
+
+ if (asnDocument.getTariff()!=null){
+ document.setTariff(convertTariff(asnDocument.getTariff()));
+ }
+
+ document.setPrice(asnDocument.getPrice());
+
+ if (asnDocument.getVatDetails() != null && !asnDocument.getVatDetails().isEmpty()){
+ for (VatDetailType vat : asnDocument.getVatDetails()) {
+ document.addVatDetail(decodeVatDetail(vat));
+ }
+ }
+
+ return null;
+ }
+
+
+ private IVatDetail decodeVatDetail(VatDetailType asnVat) {
+
+ IVatDetail vat = factory.createVatDetail();
+
+ vat.setAmount(asnVat.getAmount());
+ if (asnVat.getPercentage() != null){
+ vat.setPercentage(asnVat.getPercentage().intValue());
+ }
+ if (asnVat.getCountry() != null) {
+ vat.setCountry(asnVat.getCountry().intValue());
+ }
+ vat.setVatId(asnVat.getVatId());
+ return vat;
+ }
+
+
+
+
+
+
+
+ /**
+ * Convert compartment details.
+ *
+ * @param asnDetails the asn details
+ * @return the i compartment details
+ */
+ protected ICompartmentDetails convertCompartmentDetails(CompartmentDetailsType asnDetails) {
+
+ if (asnDetails == null) return null;
+
+ ICompartmentDetails details = factory.createCompartmentDetails();
+
+ if (asnDetails.getCompartmentType()!=null) {
+ details.setCompartmentType(asnDetails.getCompartmentType().intValue());
+ }
+
+ if (asnDetails.getCoachType()!=null){
+ details.setCoachType(asnDetails.getCoachType().intValue());
+ }
+
+ if (asnDetails.getSpecialAllocation()!=null) {
+ details.setSpecialAllocation(asnDetails.getSpecialAllocation().intValue());
+ }
+
+ details.setCoachTypeDescr(asnDetails.getCoachTypeDescr());
+ details.setCompartmentTypeDescr(asnDetails.getCompartmentTypeDescr());
+ details.setSpecialAllocationDescr(asnDetails.getSpecialAllocationDescr());
+
+ details.setPosition(ICompartmentPositionType.valueOf(asnDetails.getPosition().name()));
+
+ return details;
+ }
+
+ /**
+ * Convert places.
+ *
+ * @param asnPlaces the asn places
+ * @return the i places
+ */
+ protected IPlaces convertPlaces(PlacesType asnPlaces) {
+
+ if (asnPlaces == null) return null;
+
+ IPlaces places = factory.createPlaces();
+
+ places.setCoach(asnPlaces.getCoach());
+ places.setPlaceDescription(asnPlaces.getPlaceDescription());
+
+ if (asnPlaces.getPlaceNum()!=null && !asnPlaces.getPlaceNum().isEmpty()){
+ for (Long place: asnPlaces.getPlaceNum()){
+ places.addPlace(place.toString());
+ }
+ }
+
+ if (asnPlaces.getPlaceIA5()!=null && !asnPlaces.getPlaceIA5().isEmpty()){
+ for (String place: asnPlaces.getPlaceIA5()){
+ places.addPlace(place);
+ }
+ }
+
+ places.setPlaceString(asnPlaces.getPlaceString());
+
+ return places;
+ }
+
+ /**
+ * Convert berth.
+ *
+ * @param asnBerth the asn berth
+ * @return the i berth
+ */
+ protected IBerth convertBerth(BerthDetailData asnBerth) {
+
+ if (asnBerth == null) return null;
+
+ IBerth berth = factory.createBerth();
+ if (asnBerth.getGender()!= null) {
+ berth.setGender(ICompartmentGenderType.valueOf(asnBerth.getGender().name()));
+ }
+ if (asnBerth.getNumberOfBerths()!=null) {
+ berth.setNumberOfBerths(asnBerth.getNumberOfBerths().intValue());
+ }
+ if (asnBerth.getBerthType()!=null){
+ berth.setType(IBerthTypeType.valueOf(asnBerth.getBerthType().name()));
+ }
+
+ return berth;
+ }
+
+ /**
+ * Convert countermark.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @return the i counter mark
+ */
+ protected ICounterMark convertCountermark(CountermarkData asnDocument , Date issuingDate) {
+
+ ICounterMark document = factory.createCounterMark();
+
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+
+ if(asnDocument.getClassCode()!=null){
+ document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
+ }
+
+ document.setValidFrom(asnDocument.getValidFromDate(issuingDate));
+ document.setValidUntil(asnDocument.getValidUntilDate(issuingDate));
+
+ document.setValidFromUTCoffset(asnDocument.getValidFromUTCOffset());
+ if (asnDocument.getValidUntilUTCOffset() != null) {
+ document.setValidUntilUTCoffset(asnDocument.getValidUntilUTCOffset());
+ } else {
+ document.setValidUntilUTCoffset(asnDocument.getValidFromUTCOffset());
+ }
+
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+ document.setInfoText(asnDocument.getInfoText());
+
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+ document.setTicketReference(UicEncoderUtils.mapToString(asnDocument.getTicketReferenceNum(),asnDocument.getTicketReferenceIA5()));
+
+ document.setFromStation(UicEncoderUtils.mapToString(asnDocument.getFromStationNum(),asnDocument.getFromStationIA5()));
+ document.setToStation(UicEncoderUtils.mapToString(asnDocument.getToStationNum(),asnDocument.getToStationIA5()));
+
+ document.setFromStationName(asnDocument.getFromStationNameUTF8());
+ document.setToStationName(asnDocument.getToStationNameUTF8());
+ document.setValidRegionDesc(asnDocument.getValidRegionDesc());
+
+ if (asnDocument.getValidRegion()!= null && !asnDocument.getValidRegion().isEmpty()) {
+ for (RegionalValidityType validRegion :asnDocument.getValidRegion()){
+ document.addValidRegionList(convertValidRegion(validRegion, issuingDate));
+ }
+ }
+
+ document.setReturnDescription(convertReturnDescription(asnDocument.getReturnDescription(), issuingDate));
+
+
+ if(asnDocument.getReturnIncluded()!=null){
+ document.setReturnIncluded(asnDocument.getReturnIncluded());
+ } else {
+ document.setReturnIncluded(false);
+ }
+
+
+
+ document.setGroupName(asnDocument.getGroupName());
+
+ if (asnDocument.getNumberOfCountermark() != null) {
+ document.setNumberOfCountermark(asnDocument.getNumberOfCountermark().intValue());
+ }
+
+ if (asnDocument.getTotalOfCountermarks() != null) {
+ document.setTotalOfCountermarks(asnDocument.getTotalOfCountermarks().intValue());
+ }
+
+ return document;
+
+ }
+
+ /**
+ * Convert return description.
+ *
+ * @param asnReturnRoute the asn return route
+ * @param issuingDate the issuing date
+ * @return the i return route description
+ */
+ protected IReturnRouteDescription convertReturnDescription(ReturnRouteDescriptionType asnReturnRoute, Date issuingDate) {
+
+ if (asnReturnRoute == null) return null;
+
+ IReturnRouteDescription route = factory.createReturnRouteDescription();
+
+ route.setFromStation(UicEncoderUtils.mapToString(asnReturnRoute.getFromStationNum(),asnReturnRoute.getFromStationIA5()));
+ route.setToStation(UicEncoderUtils.mapToString(asnReturnRoute.getToStationNum(),asnReturnRoute.getToStationIA5()));
+
+ route.setFromStationName(asnReturnRoute.getFromStationNameUTF8());
+ route.setToStationName(asnReturnRoute.getToStationNameUTF8());
+ route.setValidRegionDesc(asnReturnRoute.getValidReturnRegionDesc());
+
+ if (asnReturnRoute.getValidReturnRegion()!= null && !asnReturnRoute.getValidReturnRegion().isEmpty()) {
+ for (RegionalValidityType validRegion :asnReturnRoute.getValidReturnRegion()){
+ route.addValidRegionList(convertValidRegion(validRegion, issuingDate));
+ }
+ }
+
+ return route;
+ }
+
+ /**
+ * Convert luggage restriction.
+ *
+ * @param asnLuggage the asn luggage
+ * @return the i luggage restriction
+ */
+ protected ILuggageRestriction convertLuggageRestriction(LuggageRestrictionType asnLuggage) {
+
+ if (asnLuggage == null) return null;
+
+ ILuggageRestriction luggage = factory.createLuggageRestriction();
+ if (asnLuggage.getMaxHandLuggagePieces()!=null){
+ luggage.setMaxHandLuggagePieces(asnLuggage.getMaxHandLuggagePieces().intValue());
+ }
+ if (asnLuggage.getMaxNonHandLuggagePieces()!=null){
+ luggage.setMaxNonHandLuggagePieces(asnLuggage.getMaxNonHandLuggagePieces().intValue());
+ }
+
+
+ if (asnLuggage.getRegisteredLuggage()!= null &&!asnLuggage.getRegisteredLuggage().isEmpty()){
+ for (RegisteredLuggageType rl: asnLuggage.getRegisteredLuggage()){
+ luggage.addRegisteredLuggage(convertRegisteredLuggage(rl));
+ }
+ }
+ return luggage;
+ }
+
+ /**
+ * Convert registered luggage.
+ *
+ * @param rl the rl
+ * @return the i registered luggage
+ */
+ protected IRegisteredLuggage convertRegisteredLuggage(RegisteredLuggageType rl) {
+
+ if (rl == null) return null;
+
+ IRegisteredLuggage luggage= factory.createRegisteredLuggage();
+ if (rl.getMaxSize()!=null){
+ if (rl.getMaxSize()!=null) {
+ luggage.setMaxSize(rl.getMaxSize().intValue());
+ }
+ }
+ if (rl.getMaxWeight()!=null){
+ if(rl.getMaxWeight()!=null){
+ luggage.setMaxWeight(rl.getMaxWeight().intValue());
+ }
+ }
+ luggage.setRegistrationId(rl.getRegistrationId());
+ return luggage;
+ }
+
+
+ /**
+ * Convert open ticket.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @return the i open ticket
+ */
+ protected IOpenTicket convertOpenTicket(OpenTicketData asnDocument , Date issuingDate) {
+
+ IOpenTicket document = factory.createOpenTicket();
+
+ if(asnDocument.getClassCode()!=null){
+ document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
+ }
+
+ document.setValidFrom(asnDocument.getValidFromDate(issuingDate));
+ document.setValidUntil(asnDocument.getValidUntilDate(issuingDate));
+
+ document.setValidFromUTCoffset(asnDocument.getValidFromUTCOffset());
+ if (asnDocument.getValidUntilUTCOffset() != null) {
+ document.setValidUntilUTCoffset(asnDocument.getValidUntilUTCOffset());
+ } else {
+ document.setValidUntilUTCoffset(asnDocument.getValidFromUTCOffset());
+ }
+
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+ document.setInfoText(asnDocument.getInfoText());
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+
+ if (asnDocument.getExcludedServiceBrands()!=null && !asnDocument.getExcludedServiceBrands().isEmpty()){
+ for(Long number :asnDocument.getExcludedServiceBrands()){
+ document.addExcludedServiceBrand(number.intValue());
+ }
+ }
+
+ 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.getIncludedTransportTypes()!=null && !asnDocument.getIncludedTransportTypes().isEmpty()){
+ for(Long number :asnDocument.getIncludedTransportTypes()){
+ document.addInludedTransportType(number.intValue());
+ }
+ }
+
+ if (asnDocument.getExcludedTransportTypes()!=null && !asnDocument.getExcludedTransportTypes().isEmpty()){
+ for(Long number :asnDocument.getExcludedTransportTypes()){
+ document.addExcludedTransportType(number.intValue());
+ }
+ }
+
+
+
+ if (asnDocument.getTariffs()!=null && !asnDocument.getTariffs().isEmpty()){
+ for(TariffType asnTariff :asnDocument.getTariffs()){
+ document.addTariff(convertTariff(asnTariff));
+ }
+ }
+
+ 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()));
+ document.setFromStationName(asnDocument.getFromStationNameUTF8());
+ document.setToStationName(asnDocument.getToStationNameUTF8());
+ document.setValidRegionDesc(asnDocument.getValidRegionDesc());
+ if (asnDocument.getValidRegion()!= null && !asnDocument.getValidRegion().isEmpty()) {
+ for (RegionalValidityType validRegion :asnDocument.getValidRegion()){
+ document.addValidRegionList(convertValidRegion(validRegion, issuingDate));
+ }
+ }
+
+ if (asnDocument.getIssuerAutorizationId() != null) {
+ document.setAuthorizationCode(asnDocument.getIssuerAutorizationId().intValue());
+ }
+
+ if (asnDocument.getExtIssuerId() != null) {
+ document.setExternalIssuer(asnDocument.getExtIssuerId().intValue());
+ }
+
+ document.setLuggageRestriction(convertLuggageRestriction(asnDocument.getLuggage()));
+
+ document.setReturnDescription(convertReturnDescription(asnDocument.getReturnDescription(), issuingDate));
+ if(asnDocument.getReturnIncluded()!=null){
+ document.setReturnIncluded(asnDocument.getReturnIncluded());
+ }
+
+ if (asnDocument.getActivatedDay()!=null && !asnDocument.getActivatedDay().isEmpty()) {
+ document.getActivatedDays().addAll(asnDocument.getActivatedDays(issuingDate));
+ }
+
+ if (asnDocument.getIncludedAddOns()!= null && !asnDocument.getIncludedAddOns().isEmpty()) {
+
+ for (IncludedOpenTicketType asnAddOn :asnDocument.getIncludedAddOns()) {
+
+ IIncludedOpenTicket addOn = convertIncludedOpenTicket(asnAddOn, issuingDate, document.getClassCode());
+ if (addOn != null) {
+ document.addIncludedAddOn(addOn);
+ }
+ }
+
+
+
+ }
+
+ document.setPrice(asnDocument.getPrice());
+
+ if (asnDocument.getVatDetails() != null && !asnDocument.getVatDetails().isEmpty()){
+ for (VatDetailType vat : asnDocument.getVatDetails()) {
+ document.addVatDetail(decodeVatDetail(vat));
+ }
+ }
+
+ return document;
+
+ }
+
+
+
+ /**
+ * Convert included open ticket.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @param classCode the class code
+ * @return the simple included open ticket
+ */
+ private IIncludedOpenTicket convertIncludedOpenTicket( IncludedOpenTicketType asnDocument, Date issuingDate, ITravelClassType classCode) {
+
+ IIncludedOpenTicket document = factory.createIncludedOpenTicket();
+
+ if(asnDocument.getClassCode()!=null){
+ document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
+ } else {
+ document.setClassCode(classCode);
+ }
+
+ document.setValidFrom(asnDocument.getValidFromDate(issuingDate));
+ document.setValidUntil(asnDocument.getValidUntilDate(issuingDate));
+
+ document.setValidFromUTCoffset(asnDocument.getValidFromUTCOffset());
+ if (asnDocument.getValidUntilUTCOffset() != null) {
+ document.setValidUntilUTCoffset(asnDocument.getValidUntilUTCOffset());
+ } else {
+ document.setValidUntilUTCoffset(asnDocument.getValidFromUTCOffset());
+ }
+
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+ document.setInfoText(asnDocument.getInfoText());
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+
+ if (asnDocument.getExcludedServiceBrands()!=null && !asnDocument.getExcludedServiceBrands().isEmpty()){
+ for(Long number :asnDocument.getExcludedServiceBrands()){
+ document.addExcludedServiceBrand(number.intValue());
+ }
+ }
+ if (asnDocument.getIncludedCarriersNum()!=null && !asnDocument.getIncludedCarriersNum().isEmpty()){
+ for(Long carrier :asnDocument.getIncludedCarriersNum()){
+ document.addIncludedCarrier(carrier.toString());
+ }
+ }
+ if (asnDocument.getIncludedCarriersIA5()!=null && !asnDocument.getIncludedCarriersIA5().isEmpty()){
+ for(String carrier :asnDocument.getIncludedCarriersIA5()){
+ document.addIncludedCarrier(carrier);
+ }
+ }
+
+ if (asnDocument.getIncludedServiceBrands()!=null && !asnDocument.getIncludedServiceBrands().isEmpty()){
+ for(Long number :asnDocument.getIncludedServiceBrands()){
+ document.addIncludedServiceBrand(number.intValue());
+ }
+ }
+
+ if (asnDocument.getIncludedTransportTypes()!=null && !asnDocument.getIncludedTransportTypes().isEmpty()){
+ for(Long number :asnDocument.getIncludedTransportTypes()){
+ document.addInludedTransportType(number.intValue());
+ }
+ }
+
+ if (asnDocument.getExcludedTransportTypes()!=null && !asnDocument.getExcludedTransportTypes().isEmpty()){
+ for(Long number :asnDocument.getExcludedTransportTypes()){
+ document.addExcludedTransportType(number.intValue());
+ }
+ }
+
+ if (asnDocument.getTariffs()!=null && !asnDocument.getTariffs().isEmpty()){
+ for(TariffType asnTariff :asnDocument.getTariffs()){
+ document.addTariff(convertTariff(asnTariff));
+ }
+ }
+
+ if (asnDocument.getStationCodeTable()!=null){
+ document.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
+ }
+
+ if (asnDocument.getValidRegion()!= null && !asnDocument.getValidRegion().isEmpty()) {
+ for (RegionalValidityType validRegion :asnDocument.getValidRegion()){
+ document.addValidRegionList(convertValidRegion(validRegion, issuingDate));
+ }
+ }
+
+ if (asnDocument.getIssuerAutorizationId()!=null){
+ document.setAuthorizationCode(asnDocument.getIssuerAutorizationId().intValue());
+ }
+ if (asnDocument.getExternalIssuerId()!=null){
+ document.setExternalIssuer(asnDocument.getExternalIssuerId().intValue());
+ }
+ return document;
+ }
+
+
+
+
+
+
+
+ /**
+ * Convert station passage.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @return the i station passage
+ */
+ protected IStationPassage convertStationPassage(StationPassageData asnDocument , Date issuingDate) {
+
+ IStationPassage document = factory.createStationPassage();
+
+ document.setValidFrom(asnDocument.getValidFromDate(issuingDate));
+ document.setValidUntil(asnDocument.getValidUntilDate(issuingDate));
+
+ document.setValidFromUTCoffset(asnDocument.getValidFromUTCOffset());
+ if (asnDocument.getValidUntilUTCOffset() != null) {
+ document.setValidUntilUTCoffset(asnDocument.getValidUntilUTCOffset());
+ } else {
+ document.setValidUntilUTCoffset(asnDocument.getValidFromUTCOffset());
+ }
+
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+
+ if (asnDocument.getNumberOfDaysValid()!=null) {
+ document.setNumberOfdaysAllowed(asnDocument.getNumberOfDaysValid().intValue());
+ }
+
+ if (asnDocument.getStationNum()!=null && !asnDocument.getStationNum().isEmpty()){
+ for (Long station : asnDocument.getStationNum()) {
+ if (station != null) {
+ document.addStation(station.toString());
+ }
+ }
+ }
+ if (asnDocument.getStationIA5()!=null && !asnDocument.getStationIA5().isEmpty()){
+ for (String station : asnDocument.getStationIA5()) {
+ document.addStation(station);
+ }
+ }
+
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+
+ document.setProductName(asnDocument.getProductName());
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+
+ if (asnDocument.getStationNameUTF8()!= null && asnDocument.getStationNameUTF8().isEmpty() ) {
+ for (String name : asnDocument.getStationNameUTF8()) {
+ document.addStation(name);
+ }
+ }
+
+ if (asnDocument.getStationCodeTable()!=null){
+ document.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
+ }
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+
+ if (asnDocument.getAreaCodeIA5() != null && !asnDocument.getAreaCodeIA5().isEmpty()) {
+ for (String code : asnDocument.getAreaCodeIA5()) {
+ document.addAreaCode(code);
+ }
+ }
+ if (asnDocument.getAreaCodeNum() != null && !asnDocument.getAreaCodeNum().isEmpty()) {
+ for (Long code : asnDocument.getAreaCodeNum()) {
+ if (code != null) {
+ document.addAreaCode(code.toString());
+ }
+ }
+ }
+
+ if (asnDocument.getAreaNameUTF8() != null && !asnDocument.getAreaNameUTF8().isEmpty()) {
+ for (String code : asnDocument.getAreaNameUTF8()) {
+ document.addAreaName(code);
+ }
+ }
+
+
+
+ return document;
+ }
+
+
+ /**
+ * Convert valid region.
+ *
+ * @param asnRegion the asn region
+ * @param issuingDate the issuing date
+ * @return the i regional validity
+ */
+ protected IRegionalValidity convertValidRegion(RegionalValidityType asnRegion, Date issuingDate) {
+
+ if (asnRegion == null) return null;
+
+ if (asnRegion.getLines()!=null){
+ return convertLine(asnRegion.getLines());
+ }
+ if (asnRegion.getPolygone()!=null){
+ return convertPolygone(asnRegion.getPolygone());
+ }
+ if (asnRegion.getTrainLink()!=null){
+ return convertTrainLink(asnRegion.getTrainLink(),issuingDate);
+ }
+ if (asnRegion.getViaStations()!=null){
+ return convertViaStation(asnRegion.getViaStations());
+ }
+ if (asnRegion.getZones()!=null){
+ return convertZone(asnRegion.getZones());
+ }
+ return null;
+ }
+
+
+ /**
+ * Convert parking ground.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @return the i parking ground
+ */
+ protected IParkingGround convertParkingGround(ParkingGroundData asnDocument , Date issuingDate) {
+
+ IParkingGround document = factory.createParkingGround();
+
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+
+
+ document.setAccessCode(asnDocument.getAccessCode());
+ document.setLocation(asnDocument.getLocation());
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+
+ document.setNumberPlate(asnDocument.getNumberPlate());
+ document.setEntryTrack(asnDocument.getEntryTrack());
+
+
+ document.setFromParkingDate(asnDocument.getFromParkingDate(issuingDate));
+ document.setToParkingDate(asnDocument.getToParkingDate(issuingDate));
+
+ document.setParkingGroundId(asnDocument.getParkingGroundId());
+
+ document.setSpecialInformation(asnDocument.getSpecialInformation());
+
+ if (asnDocument.getStationCodeTable()!=null){
+ document.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
+ }
+
+ document.setStation(UicEncoderUtils.mapToString(asnDocument.getStationNum(),asnDocument.getStationIA5()));
+
+ document.setPrice(asnDocument.getPrice());
+
+ if (asnDocument.getVatDetails() != null && !asnDocument.getVatDetails().isEmpty()){
+ for (VatDetailType vat : asnDocument.getVatDetails()) {
+ document.addVatDetail(decodeVatDetail(vat));
+ }
+ }
+
+ return document;
+ }
+
+ /**
+ * Convert via station.
+ *
+ * @param asnDocument the asn via
+ * @return the i via station
+ */
+ protected IViaStation convertViaStation(ViaStationType asnDocument) {
+
+ if (asnDocument == null) return null;
+
+ IViaStation via = factory.createViaStation();
+
+ if (asnDocument.getBorder()!=null) {
+ via.setBorder(asnDocument.getBorder());
+ }
+
+ if (asnDocument.getRouteId() != null) {
+ via.setRouteId(asnDocument.getRouteId().intValue());
+ }
+
+ if (asnDocument.getStationCodeTable()!=null){
+ via.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
+ }
+
+ if (asnDocument.getStationNum() != null) {
+ via.setStation(asnDocument.getStationNum().toString());
+ } else if (asnDocument.getStationIA5() != null) {
+ via.setStation(asnDocument.getStationIA5());
+ }
+
+ if (asnDocument.getCarriersNum()!=null && !asnDocument.getCarriersNum().isEmpty()){
+ for(Long carrier :asnDocument.getCarriersNum()){
+ via.addCarrier(carrier.toString());
+ }
+ }
+ if (asnDocument.getCarriersIA5()!=null && !asnDocument.getCarriersIA5().isEmpty()){
+ for(String carrier :asnDocument.getCarriersIA5()){
+ via.addCarrier(carrier);
+ }
+ }
+
+ if (asnDocument.getRoute()!= null && !asnDocument.getRoute().isEmpty()) {
+ for ( ViaStationType routeVia: asnDocument.getRoute()) {
+ via.addRouteStation(convertViaStation(routeVia));
+ }
+ }
+ if (asnDocument.getAlternativeRoutes()!= null && !asnDocument.getAlternativeRoutes().isEmpty()) {
+ for ( ViaStationType routeVia: asnDocument.getAlternativeRoutes()) {
+ via.addRouteStation(convertViaStation(routeVia));
+ }
+ }
+
+
+ return via;
+ }
+
+ /**
+ * Convert train link.
+ *
+ * @param asnTrainLink the asn train link
+ * @param issuingDate the issuing date
+ * @return the i regional validity
+ */
+ protected IRegionalValidity convertTrainLink(TrainLinkType asnTrainLink, Date issuingDate) {
+
+ ITrainLink trainLink = factory.createTrainLink();
+
+ trainLink.setTrain(UicEncoderUtils.mapToString(asnTrainLink.getTrainNum(), asnTrainLink.getTrainIA5()));
+
+ trainLink.setFromStation(UicEncoderUtils.mapToString(asnTrainLink.getFromStationNum(),asnTrainLink.getFromStationIA5()));
+ trainLink.setToStation(UicEncoderUtils.mapToString(asnTrainLink.getToStationNum(),asnTrainLink.getToStationIA5()));
+ trainLink.setFromStationName(asnTrainLink.getFromStationName());
+ trainLink.setToStationName(asnTrainLink.getToStationName());
+
+ trainLink.setDepartureDateTime(asnTrainLink.getDepartureDate(issuingDate));
+
+ return trainLink;
+ }
+
+ /**
+ * Convert zone.
+ *
+ * @param asnDocument the asn zone
+ * @return the i regional validity
+ */
+ protected IRegionalValidity convertZone(ZoneType asnDocument) {
+
+ if (asnDocument == null) return null;
+
+ IZone zone = factory.createZone();
+
+ zone.setBinaryZoneId(asnDocument.getBinaryZoneId());
+ zone.setCarrier(UicEncoderUtils.mapToString(asnDocument.getCarrierNum(),asnDocument.getCarrierIA5()));
+
+ if (asnDocument.getCity() != null) {
+ zone.setCity(asnDocument.getCity().intValue());
+ }
+ if (asnDocument.getStationCodeTable()!=null){
+ zone.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
+ }
+ zone.setEntryStation(UicEncoderUtils.mapToString(asnDocument.getEntryStationNum(),asnDocument.getEntryStationIA5()));
+ zone.setTerminatingStation(UicEncoderUtils.mapToString(asnDocument.getTerminatingStationNum(),asnDocument.getTerminatingStationIA5()));
+
+ zone.setNUTScode(asnDocument.getNutsCode());
+
+ return zone;
+ }
+
+ /**
+ * Convert polygone.
+ *
+ * @param asnPolygone the asn polygone
+ * @return the i regional validity
+ */
+ protected IRegionalValidity convertPolygone(PolygoneType asnPolygone) {
+
+ if (asnPolygone == null) return null;
+
+ IPolygone polygone = factory.createPolygone();
+
+ IGeoCoordinate firstEdge = convertGeoCoordinate(asnPolygone.getFirstEdge());
+
+ if (firstEdge == null) return null;
+
+ if (asnPolygone.getEdges()!=null && !asnPolygone.getEdges().isEmpty()) {
+ for (DeltaCoordinates asnEdge :asnPolygone.getEdges()){
+
+ IGeoCoordinate edge = firstEdge.clone();
+ try {
+ edge.addLongitude(asnEdge.getLongitude().longValue());
+ edge.addLatitude(asnEdge.getLatitude().longValue());
+ } catch (Exception e) {
+
+ }
+ polygone.addEdge(edge);
+ }
+ }
+ return polygone;
+ }
+
+ /**
+ * Convert line.
+ *
+ * @param asnDocument the asn line
+ * @return the i regional validity
+ */
+ protected IRegionalValidity convertLine(LineType asnDocument) {
+
+ if (asnDocument == null) return null;
+
+ ILine line = factory.createLine();
+
+ line.setBinaryZoneId(asnDocument.getBinaryZoneId());
+ line.setCarrier(UicEncoderUtils.mapToString(asnDocument.getCarrierNum(),asnDocument.getCarrierIA5()));
+ if (asnDocument.getCity()!=null) {
+ line.setCity(asnDocument.getCity().intValue());
+ }
+ if (asnDocument.getStationCodeTable()!=null){
+ line.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
+ }
+ line.setEntryStation(UicEncoderUtils.mapToString(asnDocument.getEntryStationNum(),asnDocument.getEntryStationIA5()));
+ line.setTerminatingStation(UicEncoderUtils.mapToString(asnDocument.getTerminatingStationNum(),asnDocument.getTerminatingStationIA5()));
+ if (asnDocument.getLineId()!=null && !asnDocument.getLineId().isEmpty()){
+ for (Long lineId : asnDocument.getLineId()) {
+ line.addLineId(lineId.intValue());
+ }
+ }
+ return line;
+ }
+
+ /**
+ * Convert tariff.
+ *
+ * @param asnTariff the asn tariff
+ * @return the i tariff
+ */
+ protected ITariff convertTariff(TariffType asnTariff) {
+
+ if (asnTariff== null) return null;
+
+ ITariff tariff = factory.createTariff();
+
+ if (asnTariff.getAgeAbove() != null) {
+ tariff.setAgeAbove(asnTariff.getAgeAbove().intValue());
+ }
+
+ if (asnTariff.getAgeBelow() != null) {
+ tariff.setAgeBelow(asnTariff.getAgeBelow().intValue());
+ }
+
+ if(asnTariff.getNumberOfPassengers()!=null){
+ tariff.setNumberOfPassengers(asnTariff.getNumberOfPassengers().intValue());
+ }
+
+ if (asnTariff.getSeriesDataDetails() != null) {
+ tariff.setSeriesDataDetails(convertSeriesDataDetails(asnTariff.getSeriesDataDetails()));
+ }
+
+
+ if (asnTariff.getPassengerType()!=null) {
+ tariff.setPassengerType(IPassengerType.valueOf(asnTariff.getPassengerType().name()));
+ }
+
+
+ if(asnTariff.getRestrictedToCountryOfResidence()!=null){
+ tariff.setRestrictedToCountryOfResidence(asnTariff.getRestrictedToCountryOfResidence());
+ }
+ if (asnTariff.getRestrictedToRouteSection()!=null){
+ tariff.setRestrictedToRouteSection(convertRouteSection(asnTariff.getRestrictedToRouteSection()));
+ }
+
+
+ tariff.setTariffDescription(asnTariff.getTariffDesc());
+ tariff.setTariffId(UicEncoderUtils.mapToString(asnTariff.getTariffIdNum(),asnTariff.getTariffIdIA5()));
+
+ if (asnTariff.getTraverlerid()!= null && !asnTariff.getTraverlerid().isEmpty() ) {
+ for (Long number : asnTariff.getTraverlerid()){
+ tariff.addTravelerId(number.intValue());
+ }
+ }
+
+ if (asnTariff.getReductionCard()!=null && !asnTariff.getReductionCard().isEmpty()){
+ for(CardReferenceType card : asnTariff.getReductionCard()){
+ tariff.addReductionCard(convertCardReference(card));
+ }
+ }
+
+ return tariff;
+ }
+
+ private ISeriesDataDetails convertSeriesDataDetails(SeriesDetailType asnDetails) {
+
+ if (asnDetails == null) return null;
+
+ ISeriesDataDetails details = factory.createSeriesDataDetails();
+
+ if (asnDetails.getSeries() != null) {
+ details.setSeries(asnDetails.getSeries().intValue());
+ }
+
+ if (asnDetails.getSupplyingCarrier() != null) {
+ details.setSupplyingCarrier(asnDetails.getSupplyingCarrier().intValue());
+ }
+
+ if (asnDetails.getOfferIdentification() != null) {
+ details.setOfferIdentification(asnDetails.getOfferIdentification().intValue());
+ }
+
+ return details;
+ }
+
+
+
+
+
+
+
+ /**
+ * Convert route section.
+ *
+ * @param asnDocument the asn document
+ * @return the i route section
+ */
+ protected IRouteSection convertRouteSection(RouteSectionType asnDocument) {
+
+ if (asnDocument == null) return null;
+
+ IRouteSection document = factory.createRouteSection();
+ 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()));
+ document.setFromStationName(asnDocument.getFromStationNameUTF8());
+ document.setToStationName(asnDocument.getToStationNameUTF8());
+ return document;
+ }
+
+ /**
+ * Convert fip ticket.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @return the i fip ticket
+ */
+ protected IFipTicket convertFipTicket(FIPTicketData asnDocument , Date issuingDate) {
+
+ if (asnDocument == null) return null;
+
+ IFipTicket document = factory.createFipTicket();
+ if(asnDocument.getClassCode()!=null){
+ document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
+ }
+
+ document.setValidFrom(asnDocument.getValidFromDate(issuingDate));
+ document.setValidUntil(asnDocument.getValidUntilDate(issuingDate));
+
+
+
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+
+ if (asnDocument.getActivatedDay()!=null && !asnDocument.getActivatedDay().isEmpty()) {
+ document.getActivatedDays().addAll(asnDocument.getActivatedDays(issuingDate));
+ }
+
+ if(asnDocument.getIncludesSupplements()!=null) {
+ document.setIncludesSupplements(asnDocument.getIncludesSupplements());
+ }
+ if(asnDocument.getNumberOfTravelDays()!=null){
+ document.setNumberOfTravelDates(asnDocument.getNumberOfTravelDays().intValue());
+ }
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+
+ return document;
+ }
+
+ /**
+ * Convert pass.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @return the i pass
+ */
+ protected IPass convertPass(PassData asnDocument, Date issuingDate) {
+
+ if (asnDocument == null) return null;
+
+ IPass document = factory.createPass();
+
+ if(asnDocument.getClassCode()!=null){
+ document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
+ }
+
+ document.setValidFrom(asnDocument.getValidFromDate(issuingDate));
+ document.setValidFromUTCoffset(asnDocument.getValidFromUTCOffset());
+
+ document.setValidUntil(asnDocument.getValidUntilDate(issuingDate));
+ document.setValidUntilUTCoffset(asnDocument.getValidUntilUTCOffset());
+
+ if (asnDocument.getActivatedDay()!=null && !asnDocument.getActivatedDay().isEmpty()) {
+ if (document.getValidFrom() != null) {
+ document.getActivatedDays().addAll(asnDocument.getActivatedDays(document.getValidFrom()));
+ } else {
+ document.getActivatedDays().addAll(asnDocument.getActivatedDays(issuingDate));
+ }
+ }
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+ document.setInfoText(asnDocument.getInfoText());
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+
+ if (asnDocument.getNumberOfDaysOfTravel() != null) {
+ document.setNumberOfDaysOfTravel(asnDocument.getNumberOfDaysOfTravel().intValue());
+ }
+ if (asnDocument.getNumberOfPossibleTrips() != null) {
+ document.setNumberOfPossibleTrips(asnDocument.getNumberOfPossibleTrips().intValue());
+ }
+
+ document.setPassDescription(asnDocument.getPassDescription());
+ if(asnDocument.getPassType()!=null){
+ document.setPassType(asnDocument.getPassType().intValue());
+ }
+
+
+
+ if (asnDocument.getCountries()!=null && !asnDocument.getCountries().isEmpty()){
+ for(Long number :asnDocument.getCountries()){
+ document.addCountry(number.intValue());
+ }
+ }
+ if (asnDocument.getExcludedServiceBrands()!=null && !asnDocument.getExcludedServiceBrands().isEmpty()){
+ for(Long number :asnDocument.getExcludedServiceBrands()){
+ document.addExcludedServiceBrand(number.intValue());
+ }
+ }
+
+ if (asnDocument.getIncludedCarriersNum()!=null && !asnDocument.getIncludedCarriersNum().isEmpty()){
+ for(Long carrier :asnDocument.getIncludedCarriersNum()){
+ document.addIncludedCarrier(carrier.toString());
+ }
+ }
+ if (asnDocument.getIncludedCarriersIA5()!=null && !asnDocument.getIncludedCarriersIA5().isEmpty()){
+ for(String carrier :asnDocument.getIncludedCarriersIA5()){
+ document.addIncludedCarrier(carrier);
+ }
+ }
+
+ if (asnDocument.getExcludedCarriersNum()!=null && !asnDocument.getExcludedCarriersNum().isEmpty()){
+ for(Long carrier :asnDocument.getExcludedCarriersNum()){
+ document.addExcludedCarrier(carrier.toString());
+ }
+ }
+ if (asnDocument.getExcludedCarriersIA5()!=null && !asnDocument.getExcludedCarriersIA5().isEmpty()){
+ for(String carrier :asnDocument.getExcludedCarriersIA5()){
+ document.addExcludedCarrier(carrier);
+ }
+ }
+
+
+ if (asnDocument.getIncludedServiceBrands()!=null && !asnDocument.getIncludedServiceBrands().isEmpty()){
+ for(Long number :asnDocument.getIncludedServiceBrands()){
+ document.addIncludedServiceBrand(number.intValue());
+ }
+ }
+
+ if (asnDocument.getTariffs()!=null && !asnDocument.getTariffs().isEmpty()){
+ for(TariffType asnTariff :asnDocument.getTariffs()){
+ document.addTariff(convertTariff(asnTariff));
+ }
+ }
+
+ if (asnDocument.getValidRegion()!=null && !asnDocument.getValidRegion().isEmpty()){
+ for(RegionalValidityType asnRegion :asnDocument.getValidRegion()){
+ document.addValidRegion(convertValidRegion(asnRegion, issuingDate));
+ }
+ }
+
+
+ if (asnDocument.getValidityPeriodDetails() != null) {
+ document.setValidityDetails(convertValidityDetails(asnDocument.getValidityPeriodDetails(), issuingDate));
+ }
+
+ document.setPrice(asnDocument.getPrice());
+
+ if (asnDocument.getVatDetails() != null && !asnDocument.getVatDetails().isEmpty()){
+ for (VatDetailType vat : asnDocument.getVatDetails()) {
+ document.addVatDetail(decodeVatDetail(vat));
+ }
+ }
+
+
+ return document;
+ }
+
+ private IValidityDetails convertValidityDetails(ValidityPeriodDetailType asnDetails, Date issuingDate) {
+
+ if (asnDetails == null) return null;
+
+ IValidityDetails details = factory.createValidityDetails();
+
+ if (asnDetails.getExcludedTimeRange()!= null && !asnDetails.getExcludedTimeRange().isEmpty()) {
+
+ ITimeRange range = factory.createTimeRange();
+
+ for (TimeRangeType asnRange : asnDetails.getExcludedTimeRange() ) {
+
+ if (asnRange.getFromTime() != null) {
+ range.setFromTime(asnRange.getFromTime().intValue());
+ }
+ if (asnRange.getUntilTime() != null) {
+ range.setUntilTime(asnRange.getUntilTime().intValue());
+ }
+
+ details.addTimeRanges(range);
+ }
+
+
+
+ }
+
+ if (asnDetails.getValidityPeriod()!= null && !asnDetails.getValidityPeriod().isEmpty()) {
+
+ IValidityRange range = factory.createValidityRange();
+
+ for (ValidityPeriodType asnRange : asnDetails.getValidityPeriod() ) {
+
+ range.setFromDate(asnRange.getValidFromDate(issuingDate));
+ range.setUntilDate(asnRange.getValidUntilDate(issuingDate));
+
+ range.setValidFromUTCoffset(asnRange.getValidFromUTCOffset());
+ if (asnRange.getValidUntilUTCOffset() != null) {
+ range.setValidUntilUTCoffset(asnRange.getValidUntilUTCOffset());
+ } else {
+ range.setValidUntilUTCoffset(asnRange.getValidFromUTCOffset());
+ }
+
+ details.addValidityRanges(range);
+ }
+
+ }
+
+ return details;
+ }
+
+
+
+
+
+
+
+ /**
+ * Convert voucher.
+ *
+ * @param asnDocument the asn document
+ * @param issuingDate the issuing date
+ * @return the i voucher
+ */
+ protected IVoucher convertVoucher(VoucherData asnDocument , Date issuingDate) {
+
+ if (asnDocument == null) return null;
+
+ IVoucher document = factory.createVoucher();
+
+ document.setValidFrom(asnDocument.getValidFrom());
+
+ document.setValidUntil(asnDocument.getValidUntil());
+
+ document.setInfoText(asnDocument.getInfoText());
+ document.setProductId(UicEncoderUtils.mapToString(asnDocument.getProductIdNum(),asnDocument.getProductIdIA5()));
+ document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
+ document.setReference(UicEncoderUtils.mapToString(asnDocument.getReferenceNum(),asnDocument.getReferenceIA5()));
+
+ if (asnDocument.getValue()!=null) {
+ document.setAmount(asnDocument.getValue().intValue());
+ }
+
+ if (asnDocument.getType()!= null) {
+ document.setType(asnDocument.getType().intValue());
+ }
+
+ document.setExtension(convertExtension(asnDocument.getExtension()));
+
+ return document;
+ }
+
+ /**
+ * Convert customer card.
+ *
+ * @param asnDocument the asn card
+ * @param issuingDate the issuing date
+ * @return the i customer card
+ */
+ protected ICustomerCard convertCustomerCard(CustomerCardData asnDocument, Date issuingDate ) {
+
+ if (asnDocument == null) return null;
+
+ ICustomerCard card = factory.createCustomerCard();
+
+ card.setCardId(UicEncoderUtils.mapToString(asnDocument.getCardIdNum(), asnDocument.getCardIdIA5()));
+ if (asnDocument.getCardType()!= null) {
+ card.setCardType(asnDocument.getCardType().intValue());
+ }
+ card.setCardTypeDescr(asnDocument.getCardTypeDescr());
+ if(asnDocument.getClassCode()!=null){
+ card.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
+ }
+ if(asnDocument.getCustomer()!=null) {
+ card.setCustomer(convertTraveler(asnDocument.getCustomer()));
+ }
+ if (asnDocument.getCustomerStatus()!=null) {
+ card.setCustomerStatus(asnDocument.getCustomerStatus().intValue());
+ }
+
+ card.setCustomerStatusDescr(asnDocument.getCustomerStatusDescr());
+
+ card.setValidFrom(asnDocument.getValidFromDate());
+
+ card.setValidUntil(asnDocument.getValidUntilDate());
+
+
+ if (asnDocument.getIncludedServices() != null && !asnDocument.getIncludedServices().isEmpty()){
+ for (Long service: asnDocument.getIncludedServices()){
+ card.addIncludedService(new Integer(service.intValue()));
+ }
+ }
+ return card;
+ }
+
+
+ /**
+ * Convert document extension.
+ *
+ * @param extension the extension
+ * @return the i document extension
+ */
+ protected IDocumentExtension convertDocumentExtension(ExtensionData asnExtension) {
+
+ if (asnExtension == null) return null;
+
+ IDocumentExtension documentExtension = factory.createDocumentExtension();
+ documentExtension.setId(asnExtension.getExtensionId());
+ documentExtension.setBinarydata(asnExtension.getExtensionData());
+ return documentExtension;
+ }
+
+
+ /**
+ * Populate traveler details.
+ *
+ * @param asnTravelerDetails the asn traveler details
+ * @param travelerDetails the traveler details
+ */
+ protected void populateTravelerDetails(TravelerData asnTravelerDetails,ITravelerDetail travelerDetails) {
+
+ if (asnTravelerDetails == null) return;
+
+ travelerDetails.setGroupName(asnTravelerDetails.getGroupName());
+
+ travelerDetails.setPreferredLanguage(asnTravelerDetails.getPreferedLanguage());
+
+ if (asnTravelerDetails.getTraveler() != null && !asnTravelerDetails.getTraveler().isEmpty() ) {
+ for ( TravelerType asnTraveler : asnTravelerDetails.getTraveler() ){
+ travelerDetails.addTraveler(convertTraveler(asnTraveler));
+ }
+ }
+ }
+
+ /**
+ * Convert traveler.
+ *
+ * @param asnTraveler the asn traveler
+ * @return the i traveler
+ */
+ protected ITraveler convertTraveler(TravelerType asnTraveler) {
+
+ if (asnTraveler == null) return null;
+
+ ITraveler traveler = factory.createTraveler();
+
+ if (asnTraveler.getCountryOfResidence() != null){
+ traveler.setCountryOfResidence(asnTraveler.getCountryOfResidence().intValue());
+ }
+ if (asnTraveler.getCountryOfPassport() != null) {
+ traveler.setPassportCountry(asnTraveler.getCountryOfPassport().intValue());
+ }
+
+ if (asnTraveler.getCountryOfIdCard() != null) {
+ traveler.setIDCardCountry(asnTraveler.getCountryOfIdCard().intValue());
+ }
+
+
+ traveler.setCustomerId(UicEncoderUtils.mapToString(asnTraveler.getCustomerIdNum(),asnTraveler.getCustomerIdIA5()));
+
+ traveler.setDateOfBirth(asnTraveler.getDateOfBirth());
+
+ traveler.setFirstName(asnTraveler.getFirstName());
+ if (asnTraveler.getGender()!= null) {
+ traveler.setGender(IGenderType.valueOf(asnTraveler.getGender().name()));
+ }
+ traveler.setIdCard(asnTraveler.getIdCard());
+ traveler.setLastName(asnTraveler.getLastName());
+
+ if (asnTraveler.getPassengerType()!= null) {
+ traveler.setPassengerType(IPassengerType.valueOf(asnTraveler.getPassengerType().name()));
+ }
+ if (asnTraveler.getPassengerWithReducedMobility()!= null) {
+ traveler.setPassengerWithReducedMobility(asnTraveler.getPassengerWithReducedMobility());
+ }
+
+ traveler.setPassportId(asnTraveler.getPassportId());
+ traveler.setSecondName(asnTraveler.getSecondName());
+
+ if (asnTraveler.getTicketHolder() != null) {
+ traveler.setTicketHolder(asnTraveler.getTicketHolder());
+ }
+
+ if (asnTraveler.getStatus()!= null && !asnTraveler.getStatus().isEmpty()) {
+
+ for (CustomerStatusType asnStatus : asnTraveler.getStatus()){
+
+ traveler.addStatusDescription( mapToStatusDescription(asnStatus) );
+
+ }
+
+ }
+
+ traveler.setTitle(asnTraveler.getTitle());
+
+ return traveler;
+ }
+
+ /**
+ * Map to status description.
+ *
+ * @param asnStatus the asn status
+ * @return the i customer status description
+ */
+ private ICustomerStatusDescription mapToStatusDescription( CustomerStatusType asnStatus) {
+
+ if (asnStatus == null) return null;
+
+ ICustomerStatusDescription status = factory.createCustomerStatusDescription();
+
+ status.setDescription(asnStatus.getCustomerStatusDescr());
+
+ if (asnStatus.getCustomerStatus()!=null) {
+ status.setStatus(asnStatus.getCustomerStatus().intValue());
+ }
+
+ status.setStatusProvider(UicEncoderUtils.mapToString(asnStatus.getStatusProviderNum(), asnStatus.getStatusProviderIA5()));
+
+ return status;
+ }
+
+
+
+
+
+
+
+ /**
+ * Populate control details.
+ *
+ * @param asnControlDetails the asn control details
+ * @param controlDetails the control details
+ */
+ protected void populateControlDetails(ControlData asnControlDetails, IControlDetail controlDetails) {
+
+ if (asnControlDetails == null || controlDetails==null ) return;
+
+ if (asnControlDetails.getAgeCheckRequired()!= null) {
+ controlDetails.setAgeCheckRequired(asnControlDetails.getAgeCheckRequired());
+ }
+
+ controlDetails.setExtension(convertExtension(asnControlDetails.getExtension()));
+
+ if (asnControlDetails.getIdentificationByIdCard()!=null){
+ controlDetails.setIdentificationByIdCard(asnControlDetails.getIdentificationByIdCard());
+ }
+
+ if (asnControlDetails.getIdentificationByPassportId()!= null){
+ controlDetails.setIdentificationByPassportId(asnControlDetails.getIdentificationByPassportId());
+ }
+
+ if(asnControlDetails.getIdentificationItem()!=null){
+ controlDetails.setIdentificationItem(asnControlDetails.getIdentificationItem().intValue());
+ }
+
+ controlDetails.setInfoText(asnControlDetails.getInfoText());
+
+ if (asnControlDetails.getOnlineValidationRequired()!=null){
+ controlDetails.setOnlineValidationRequired(asnControlDetails.getOnlineValidationRequired());
+ }
+
+ if (asnControlDetails.getRandomDetailedValidationRequired()!= null){
+ controlDetails.setRandomDetailedValidationRequired(asnControlDetails.getRandomDetailedValidationRequired().intValue());
+ }
+
+ if (asnControlDetails.getReductionCardCheckRequired() != null){
+ controlDetails.setReductionCardCheckRequired(asnControlDetails.getReductionCardCheckRequired());
+ }
+
+ if(asnControlDetails.getIdentificationByCardReference()!=null && !asnControlDetails.getIdentificationByCardReference().isEmpty()) {
+ for (CardReferenceType asnCardReference : asnControlDetails.getIdentificationByCardReference()){
+ controlDetails.addIdentificationByCardReference(convertCardReference(asnCardReference));
+ }
+ }
+
+ if (asnControlDetails.getIncludedTickets()!=null && !asnControlDetails.getIncludedTickets().isEmpty()) {
+ for (TicketLinkType asnTicketLink : asnControlDetails.getIncludedTickets()) {
+ controlDetails.addLinkedTicket(convertTicketLink(asnTicketLink));
+ }
+ }
+
+
+ }
+
+
+
+
+
+ /**
+ * Populate issuing detail.
+ *
+ * @param asnIssuingDetail the asn issuing detail
+ * @param issuingDetail the issuing detail
+ */
+ protected void populateIssuingDetail(IssuingData asnIssuingDetail,IIssuingDetail issuingDetail){
+
+ if (asnIssuingDetail== null || issuingDetail == null) return;
+
+ if (asnIssuingDetail.getActivated() != null) {
+ issuingDetail.setActivated(asnIssuingDetail.getActivated());
+ }
+
+ if (asnIssuingDetail.getSpecimen() != null) {
+ issuingDetail.setSpecimen(asnIssuingDetail.getSpecimen());
+ } else {
+ issuingDetail.setSpecimen(false);
+ }
+
+
+ if (asnIssuingDetail.getSecurePaperTicket() != null) {
+ issuingDetail.setSecurePaperTicket(asnIssuingDetail.getSecurePaperTicket());
+ } else {
+ issuingDetail.setSecurePaperTicket(false);
+ }
+
+ issuingDetail.setExtension(convertExtension(asnIssuingDetail.getExtension()));
+
+ if (asnIssuingDetail.getIssuedOnLine()!= null) {
+ issuingDetail.setIssuedOnLine(asnIssuingDetail.getIssuedOnLine().intValue());
+ }
+
+ if (asnIssuingDetail.getIssuedOnTrainIA5()!= null) {
+ issuingDetail.setIssuedOnTrain(asnIssuingDetail.getIssuedOnTrainIA5());
+ }
+ if (asnIssuingDetail.getIssuedOnTrainNum()!= null) {
+ issuingDetail.setIssuedOnTrain(asnIssuingDetail.getIssuedOnTrainNum().toString());
+ }
+
+ if (asnIssuingDetail.getIssuerNum() != null || asnIssuingDetail.getIssuerIA5() != null) {
+ issuingDetail.setIssuer(UicEncoderUtils.mapToString(asnIssuingDetail.getIssuerNum(), asnIssuingDetail.getIssuerIA5()));
+ }
+
+ issuingDetail.setIssuerName(asnIssuingDetail.getIssuerName());
+
+ issuingDetail.setIssuerPNR(asnIssuingDetail.getIssuerPNR());
+
+ issuingDetail.setSecurityProvider(UicEncoderUtils.mapToString(asnIssuingDetail.getSecurityProviderNum(),asnIssuingDetail.getSecurityProviderIA5()));
+
+
+ issuingDetail.setIssuingDate(asnIssuingDetail.getIssuingDate());
+
+
+ if (asnIssuingDetail.getPointOfSale() != null) {
+ issuingDetail.setPointOfSale(convertGeoCoordinate(asnIssuingDetail.getPointOfSale()));
+ }
+
+ }
+
+
+
+ /**
+ * Convert geo coordinate.
+ *
+ * @param asnCoordinate the asn coordinate
+ * @return the i geo coordinate
+ */
+ protected IGeoCoordinate convertGeoCoordinate(GeoCoordinateType asnCoordinate) {
+
+ if (asnCoordinate == null) return null;
+
+ IGeoCoordinate coordinate = factory.createGeoCoordinate();
+
+ if (asnCoordinate.getCoordinateSystem() != null) {
+ coordinate.setSystem(IGeoCoordinateSystemType.valueOf(asnCoordinate.getCoordinateSystem().name()));
+ }
+
+ if (asnCoordinate.getAccuracy() != null) {
+ coordinate.setAccuracy(IGeoUnitType.valueOf(asnCoordinate.getAccuracy().name()));
+ }
+
+ if (asnCoordinate.getGeoUnit() != null) {
+ coordinate.setUnit(IGeoUnitType.valueOf(asnCoordinate.getGeoUnit().name()));
+ }
+
+ if (asnCoordinate.getHemisphereLatitude() != null) {
+ coordinate.setHemisphereLatitude(IHemisphereLatitudeType.valueOf(asnCoordinate.getHemisphereLatitude().name()));
+ }
+
+ if (asnCoordinate.getHemisphereLongitude() != null) {
+ coordinate.setHemisphereLongitude(IHemisphereLongitudeType.valueOf(asnCoordinate.getHemisphereLongitude().name()));
+ }
+
+ coordinate.setLongitude (asnCoordinate.getLongitude());
+ coordinate.setLatitude (asnCoordinate.getLatitude());
+
+
+ return coordinate;
+ }
+
+
+ /**
+ * Convert extension.
+ *
+ * @param asnExtension the asn extension
+ * @return the i extension
+ */
+ protected IExtension convertExtension(ExtensionData asnExtension) {
+ if (asnExtension == null) return null;
+ IExtension extension = factory.createExtension();
+ extension.setId(asnExtension.getExtensionId());
+ extension.setBinarydata(asnExtension.getExtensionData());
+ return extension;
+ }
+
+
+ /**
+ * Convert ticket link.
+ *
+ * @param asnTicketLink the asn ticket link
+ * @return the i ticket link
+ */
+ protected ITicketLink convertTicketLink(TicketLinkType asnTicketLink) {
+
+ if (asnTicketLink == null) return null;
+
+ ITicketLink ticketLink = factory.createTicketLink();
+ ticketLink.setIssuer(asnTicketLink.getIssuerName());
+ ticketLink.setIssuerPNR(asnTicketLink.getIssuerPNR());
+ ticketLink.setProductOwner(UicEncoderUtils.mapToString(asnTicketLink.getProductOwnerNum(),asnTicketLink.getProductOwnerIA5()));
+ ticketLink.setReference(UicEncoderUtils.mapToString(asnTicketLink.getReferenceNum(),asnTicketLink.getReferenceIA5()));
+ if(asnTicketLink.getTicketType()!=null) {
+ ticketLink.setTicketType(ITicketType.valueOf(asnTicketLink.getTicketType().name()));
+ }
+ if(asnTicketLink.getLinkMode()!=null) {
+ ticketLink.setLinkMode(ILinkMode.valueOf(asnTicketLink.getLinkMode().name()));
+ }
+ return ticketLink;
+ }
+
+ /**
+ * Convert card reference.
+ *
+ * @param asnCardReference the asn card reference
+ * @return the card reference
+ */
+ protected ICardReference convertCardReference(CardReferenceType asnCardReference) {
+
+ if (asnCardReference == null) return null;
+
+ ICardReference cardReference = factory.createCardReference();
+ cardReference.setCardId(UicEncoderUtils.mapToString(asnCardReference.getCardIdNum(),asnCardReference.getCardIdIA5()));
+ cardReference.setCardIssuer(UicEncoderUtils.mapToString(asnCardReference.getCardIssuerNum(),asnCardReference.getCardIssuerIA5()));
+ cardReference.setCardName(asnCardReference.getCardName());
+
+ if(asnCardReference.getCardType()!=null) {
+ cardReference.setCardType(asnCardReference.getCardType().intValue());
+ }
+
+
+ cardReference.setLeadingCardId(UicEncoderUtils.mapToString(asnCardReference.getLeadingCardIdNum(),asnCardReference.getLeadingCardIdIA5()));
+ cardReference.setTrailingCardId(UicEncoderUtils.mapToString(asnCardReference.getTrailingCardIdNum(),asnCardReference.getTrailingCardIdIA5()));
+
+ return cardReference;
+ }
+
+}
diff --git a/src/org/uic/barcode/ticket/api/utils/UicEncoderUtils.java b/src/org/uic/barcode/ticket/api/utils/UicEncoderUtils.java new file mode 100644 index 0000000..73f96f1 --- /dev/null +++ b/src/org/uic/barcode/ticket/api/utils/UicEncoderUtils.java @@ -0,0 +1,514 @@ +/*
+ *
+ */
+package org.uic.barcode.ticket.api.utils;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+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.ticket.EncodingFormatException;
+
+
+/**
+ * The Class UicEncoderUtils.
+ */
+public class UicEncoderUtils {
+
+
+
+ /**
+ * Map to int.
+ *
+ * @param o the object to be mapped to an integer
+ * @return the int
+ */
+ public static int mapToInt(Object o){
+
+ if (o == null){
+ return 0;
+ }
+
+ if (o instanceof Integer) {
+ return ((Integer)o).intValue();
+ }
+
+ if (o instanceof Long) {
+ return ((Long)o).intValue();
+ }
+
+ if (o instanceof String) {
+
+ int i = 0;
+
+ try {
+ i = Integer.parseInt((String)o);
+ } catch (NumberFormatException e) {
+ return 0;
+ }
+
+
+ return i;
+ }
+
+ int i = 0;
+
+ try {
+ i = Integer.parseInt(o.toString());
+ } catch (NumberFormatException e) {
+ return 0;
+ }
+
+
+ return i;
+
+ }
+
+ /**
+ * Map to string.
+ *
+ * @param number the number
+ * @param text the text
+ * @return the string
+ */
+ public static String mapToString(Asn1BigInteger number, String text) {
+ if (text != null && text.length() > 0) {
+ return text;
+ } else {
+ if (number != null){
+ return number.value().toString();
+ } else {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Map to string.
+ *
+ * @param number the number
+ * @param text the text
+ * @return the string
+ */
+ public static String mapToString(BigInteger number, String text) {
+ if (text != null && text.length() > 0) {
+ return text;
+ } else {
+ if (number != null){
+ return number.toString();
+ } else {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Map to string.
+ *
+ * @param number the number
+ * @param text the text
+ * @return the string
+ */
+ public static String mapToString(Integer number, String text) {
+
+ if (text != null && text.length() > 0) {
+ return text;
+ } else {
+ if (number != null){
+ return number.toString();
+ } else {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Map to string.
+ *
+ * @param number the number
+ * @param text the text
+ * @return the string
+ */
+ public static String mapToString(Long number, String text) {
+
+ if (text != null && text.length() > 0) {
+ return text;
+ } else {
+ if (number != null){
+ return number.toString();
+ } else {
+ return null;
+ }
+ }
+ }
+
+
+
+
+ /**
+ * Map to string.
+ *
+ * @param numbers the numbers
+ * @return the collection
+ */
+ public static Collection<String> mapToString(Collection<Long> numbers) {
+
+ Collection<String> list = new HashSet<String>();
+
+ if (numbers == null || numbers.isEmpty()) {
+ return list;
+ }
+
+ for (Long number : numbers){
+ list.add(number.toString());
+ }
+
+ return list;
+ }
+
+
+
+
+ /**
+ * Gets the num.
+ *
+ * @param text the text
+ * @return the num
+ */
+ public static Long getNum(String text) {
+
+ if (text == null || text.length() == 0) {
+ return null;
+ }
+
+ Long i;
+ try {
+ i = Long.parseLong(text);
+ } catch (NumberFormatException e) {
+ return null;
+ }
+ return i;
+ }
+
+ /**
+ * Gets the num.
+ *
+ * @param text the text
+ * @return the num
+ */
+ public static Asn1BigInteger getLargeNum(String text) {
+
+ if (text == null || text.length() == 0) {
+ return null;
+ }
+
+ BigInteger i;
+ try {
+ i = new BigInteger(text);
+ } catch (NumberFormatException e) {
+ return null;
+ }
+ return new Asn1BigInteger(i);
+ }
+
+ /**
+ * Gets the num list.
+ *
+ * @param list the list
+ * @return the num list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ public static List<Long> getNumList(Collection<String> list) throws EncodingFormatException {
+
+ if (list== null || list.isEmpty()) {
+ return null;
+ }
+ List<Long> numList = new ArrayList<Long>();
+
+ for (String text : list){
+ Long num = getNum (text);
+ if (num != null) {
+ numList.add(num);
+ }
+ }
+
+
+ if (numList.isEmpty()) {
+ return null;
+ }
+
+ return numList;
+ }
+
+ /**
+ * Gets the i a5 non num list.
+ *
+ * @param list the list
+ * @return the i a5 non num list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ public static SequenceOfStringIA5 getIA5NonNumList(Collection<String> list) throws EncodingFormatException {
+
+ if (list== null || list.isEmpty()) {
+ return null;
+ }
+ SequenceOfStringIA5 ia5List = new SequenceOfStringIA5();
+
+ for (String text : list){
+ String ia5 = getIA5NonNum (text);
+ if (ia5 != null && ia5.length() > 0) {
+ ia5List.add(ia5);
+ }
+ }
+
+
+ if (ia5List.isEmpty()) {
+ return null;
+ }
+
+ return ia5List;
+ }
+
+
+
+
+ /**
+ * Gets the i a5.
+ *
+ * @param text the text
+ * @return the i a5
+ * @throws EncodingFormatException the encoding format exception
+ */
+ public static String getIA5(String text) throws EncodingFormatException {
+
+ if (text == null || text.length() == 0) {
+ return null;
+ }
+
+ for (int i = 0; i < text.length(); i++){
+ int index = text.charAt(i);
+ if (index < 0 || index > 127) {
+ throw new EncodingFormatException("Wrong Characters in IA5 String encoding");
+ }
+ }
+
+ return text;
+
+ }
+
+ /**
+ * Gets the i a5 non num.
+ *
+ * @param text the text
+ * @return the i a5 non num
+ * @throws EncodingFormatException the encoding format exception
+ */
+ public static String getIA5NonNum(String text) throws EncodingFormatException {
+
+ if (text == null || text.length() == 0) {
+ return null;
+ }
+
+ for (int i = 0; i < text.length(); i++){
+ int index = text.charAt(i);
+ if (index < 0 || index > 127) {
+ throw new EncodingFormatException("Wrong Characters in IA5 String encoding");
+ }
+ }
+
+ try {
+ Long.parseLong(text);
+ return null;
+ } catch (NumberFormatException e) {
+ return text;
+ }
+
+ }
+
+ /**
+ * Gets the restricted int.
+ *
+ * @param value the value
+ * @param min the min
+ * @param max the max
+ * @return the restricted int
+ * @throws EncodingFormatException the encoding format exception
+ */
+ public static Long getRestrictedInt(int value, int min, int max) throws EncodingFormatException {
+ if (value == 0) return null;
+
+ if (value < min || value > max) {
+ throw new EncodingFormatException("Integer value exceeds boundaries");
+ }
+ return new Long(value);
+ }
+
+ /**
+ * Gets the restricted int with default.
+ *
+ * @param value the value
+ * @param min the min
+ * @param max the max
+ * @param defaultValue the default value
+ * @return the restricted int with default
+ * @throws EncodingFormatException the encoding format exception
+ */
+ public static Long getRestrictedIntWithDefault(int value, int min, int max, int defaultValue) throws EncodingFormatException {
+ if (value == defaultValue || value == 0) return null;
+
+ if (value < min || value > max) {
+ throw new EncodingFormatException("Integer value exceeds boundaries");
+ }
+ return new Long(value);
+ }
+
+
+ /**
+ * Gets the un restricted int.
+ *
+ * @param value the value
+ * @return the un restricted int
+ */
+ public static Long getUnRestrictedInt(int value) {
+ if (value == 0) return null;
+ return new Long(value);
+ }
+
+ /**
+ * Gets the un restricted int list.
+ *
+ * @param intList the int list
+ * @return the un restricted int list
+ */
+ public static List<Long> getUnRestrictedIntList( Collection<Integer> intList) {
+ if (intList == null || intList.isEmpty()) return null;
+
+ List<Long> list = new ArrayList<Long>();
+
+ for (Integer i : intList){
+ if (i != 0){
+ list.add(i.longValue());
+ }
+ }
+
+ if (list.isEmpty()) return null;
+ 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.
+ *
+ * @param collection the collection
+ * @param min the min
+ * @param max the max
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ public static List<Long> encodeRestrictedIntegerCollection(Collection<Integer> collection, int min, int max) throws EncodingFormatException {
+
+ if ( collection == null || collection.isEmpty()) {
+ return null;
+ }
+
+ List<Long> list = new ArrayList<Long>();
+ for (Integer item : collection){
+ Long listItem = getRestrictedInt(item, min, max);
+ if (listItem != null){
+ list.add(listItem);
+ }
+ }
+ if (list.isEmpty()){
+ return null;
+ }
+ return list;
+
+ }
+
+ /**
+ * Encode integer collection.
+ *
+ * @param collection the collection
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ public static SequenceOfStringUTF8 encodeStringCollection(Collection<String> collection) throws EncodingFormatException {
+
+ if ( collection == null || collection.isEmpty()) {
+ return null;
+ }
+
+ SequenceOfStringUTF8 list = new SequenceOfStringUTF8();
+ for (String item : collection){
+ if (item.length() > 0){
+ list.add(item);
+ }
+ }
+ if (list.isEmpty()){
+ return null;
+ }
+ return list;
+
+ }
+
+ /**
+ * Encode integer collection.
+ *
+ * @param collection the collection
+ * @return the list
+ * @throws EncodingFormatException the encoding format exception
+ */
+ public static List<Long> encodeIntegerCollection(Collection<Integer> collection) throws EncodingFormatException {
+
+ if ( collection == null || collection.isEmpty()) {
+ return null;
+ }
+
+ List<Long> list = new ArrayList<Long>();
+ for (Integer item : collection){
+ if (item != null){
+ list.add(item.longValue());
+ }
+ }
+ if (list.isEmpty()){
+ return null;
+ }
+ return list;
+
+ }
+
+
+}
diff --git a/src/org/uic/ticket/api/utils/package.html b/src/org/uic/barcode/ticket/api/utils/package.html index a926c2d..a926c2d 100644 --- a/src/org/uic/ticket/api/utils/package.html +++ b/src/org/uic/barcode/ticket/api/utils/package.html diff --git a/src/org/uic/barcode/ticket/package.html b/src/org/uic/barcode/ticket/package.html new file mode 100644 index 0000000..993e0c4 --- /dev/null +++ b/src/org/uic/barcode/ticket/package.html @@ -0,0 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>UIC ticket data API</head>
+<body>
+ This API provides a specification of ticket data as an interface and an implementation of an encoder/decoder to encode and decode ticket data to an asn.1 PER encoded byte stream according to the UIC specification.
+ <br/>
+ Any ticket data implementing the interface defined in package <b>spec</b> can be encoded/decoded. The package <b>impl</b> provides a simple implementation of the ticket.
+</body>
+</html>
\ No newline at end of file |