diff options
Diffstat (limited to 'src/org/uic/barcode/ticket/api/asn')
27 files changed, 526 insertions, 478 deletions
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/CarCarriageReservationData.java b/src/org/uic/barcode/ticket/api/asn/omv1/CarCarriageReservationData.java index 97ac3d5..1eb0533 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv1/CarCarriageReservationData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv1/CarCarriageReservationData.java @@ -34,6 +34,7 @@ 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;
+import org.uic.barcode.ticket.api.utils.DateTimeUtils;
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/CountermarkData.java b/src/org/uic/barcode/ticket/api/asn/omv1/CountermarkData.java index c223900..76625d4 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv1/CountermarkData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv1/CountermarkData.java @@ -32,6 +32,7 @@ import org.uic.barcode.asn1.datatypes.IntRange; import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@Sequence
@HasExtensionMarker
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/DateTimeUtils.java b/src/org/uic/barcode/ticket/api/asn/omv1/DateTimeUtils.java deleted file mode 100644 index 6e62a4a..0000000 --- a/src/org/uic/barcode/ticket/api/asn/omv1/DateTimeUtils.java +++ /dev/null @@ -1,198 +0,0 @@ -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/FIPTicketData.java b/src/org/uic/barcode/ticket/api/asn/omv1/FIPTicketData.java index 47e4959..0171ecf 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv1/FIPTicketData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv1/FIPTicketData.java @@ -32,6 +32,7 @@ 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;
+import org.uic.barcode.ticket.api.utils.DateTimeUtils;
public class FIPTicketData extends Object {
public FIPTicketData() {
@@ -275,20 +276,17 @@ public class FIPTicketData extends Object { }
- public void setActivatedDays(Collection<Date> dates, Date issuingDate){
+
+ public void addActivatedDays(Collection<Long> days) {
+
+ if (days == null || days.isEmpty()) return;
- if (this.activatedDay != null) {
- this.activatedDay.clear();
- } else {
- this.activatedDay= new SequenceOfActivatedDays();
+ if (this.activatedDay == null) {
+ this.activatedDay = new SequenceOfActivatedDays();
}
- if (dates != null && !dates.isEmpty()) {
-
- for (Date day : dates) {
- this.addActivatedDay(issuingDate, day);
- }
-
+ for (Long l : days) {
+ this.activatedDay.add(l);
}
}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java b/src/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java index 6b6c538..a4b4049 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java +++ b/src/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java @@ -31,6 +31,7 @@ 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;
+import org.uic.barcode.ticket.api.utils.DateTimeUtils;
public class IncludedOpenTicketType extends Object {
public IncludedOpenTicketType() {
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/IssuingData.java b/src/org/uic/barcode/ticket/api/asn/omv1/IssuingData.java index cb2d126..5f0e345 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv1/IssuingData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv1/IssuingData.java @@ -351,7 +351,8 @@ public class IssuingData extends Object { }
- return cal.getTime();
+ Date d = cal.getTime();
+ return d;
}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/OpenTicketData.java b/src/org/uic/barcode/ticket/api/asn/omv1/OpenTicketData.java index 13ceb84..0e7a044 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv1/OpenTicketData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv1/OpenTicketData.java @@ -35,6 +35,7 @@ import org.uic.barcode.asn1.datatypes.RestrictedString; import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypes.SizeRange;
import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@Sequence
@HasExtensionMarker
@@ -605,25 +606,21 @@ public class OpenTicketData extends Object { }
-
- public void setActivatedDays(Collection<Date> dates, Date issuingDate){
+ public void addActivatedDays(Collection<Long> days) {
+
+ if (days == null || days.isEmpty()) return;
- if (this.activatedDay != null) {
- this.activatedDay.clear();
- } else {
- this.activatedDay= new SequenceOfActivatedDays();
+ if (this.activatedDay == null) {
+ this.activatedDay = new SequenceOfActivatedDays();
}
- if (dates != null && !dates.isEmpty()) {
-
- for (Date day : dates) {
- this.addActivatedDay(issuingDate, day);
- }
-
+ for (Long l : days) {
+ this.activatedDay.add(l);
}
}
+
public void addActivatedDay(Date issuingDate, Date day){
Long dayDiff = DateTimeUtils.getDateDifference(issuingDate, day);
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/ParkingGroundData.java b/src/org/uic/barcode/ticket/api/asn/omv1/ParkingGroundData.java index b6be1a4..8119502 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv1/ParkingGroundData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv1/ParkingGroundData.java @@ -30,6 +30,7 @@ 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.ticket.api.utils.DateTimeUtils;
@Sequence
@HasExtensionMarker
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/PassData.java b/src/org/uic/barcode/ticket/api/asn/omv1/PassData.java index 6a56a40..1139a80 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv1/PassData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv1/PassData.java @@ -34,127 +34,169 @@ 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.utils.DateTimeUtils;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class PassData.
+ */
@Sequence
@HasExtensionMarker
public class PassData extends Object {
+
+ /**
+ * Instantiates a new pass data.
+ */
public PassData() {
}
+ /** The reference num. */
@FieldOrder(order = 0)
@Asn1Optional public Asn1BigInteger referenceNum;
+ /** The reference IA 5. */
@FieldOrder(order = 1)
@RestrictedString(CharacterRestriction.IA5String)
@Asn1Optional public String referenceIA5;
+ /** The product owner num. */
@FieldOrder(order = 2)
@IntRange(minValue=1,maxValue=32000)
@Asn1Optional public Long productOwnerNum;
+ /** The product owner IA 5. */
@FieldOrder(order = 3)
@RestrictedString(CharacterRestriction.IA5String)
@Asn1Optional public String productOwnerIA5;
+ /** The product id num. */
@FieldOrder(order = 4)
@IntRange(minValue=1,maxValue=32000)
@Asn1Optional public Long productIdNum;
+ /** The product id IA 5. */
@FieldOrder(order = 5)
@RestrictedString(CharacterRestriction.IA5String)
@Asn1Optional public String productIdIA5;
+ /** The pass type. */
@FieldOrder(order = 6)
@IntRange(minValue=1,maxValue=250)
@Asn1Optional public Long passType;
+ /** The pass description. */
@FieldOrder(order = 7)
@RestrictedString(CharacterRestriction.UTF8String)
@Asn1Optional public String passDescription;
+ /** The class code. */
@FieldOrder(order = 8)
@Asn1Default (value="second")
@Asn1Optional public TravelClassType classCode;
+ /** The valid from day. */
@FieldOrder(order = 9)
@IntRange(minValue=-1,maxValue=700)
@Asn1Optional public Long validFromDay;
+ /** The valid from time. */
@FieldOrder(order = 10)
@IntRange(minValue=0,maxValue=1440)
@Asn1Optional public Long validFromTime;
+ /** The valid from UTC offset. */
@FieldOrder(order = 11)
@IntRange(minValue=-60, maxValue=60)
@Asn1Optional public Long validFromUTCOffset;
+ /** The valid until day. */
@FieldOrder(order = 12)
@IntRange(minValue=0,maxValue=370)
@Asn1Optional public Long validUntilDay;
+ /** The valid until time. */
@FieldOrder(order = 13)
@IntRange(minValue=0,maxValue=1440)
@Asn1Optional public Long validUntilTime;
+ /** The valid until UTC offset. */
@FieldOrder(order = 14)
@IntRange(minValue=-60, maxValue=60)
@Asn1Optional public Long validUntilUTCOffset;
+ /** The validity period details. */
@FieldOrder(order = 15)
@Asn1Optional public ValidityPeriodDetailType validityPeriodDetails;
+ /** The number of validity days. */
@FieldOrder(order = 16)
@IntRange(minValue=0,maxValue=370)
@Asn1Optional public Long numberOfValidityDays;
+ /** The number of possible trips. */
@FieldOrder(order = 17)
@IntRange(minValue=1,maxValue=250)
@Asn1Optional public Long numberOfPossibleTrips;
+ /** The number of days of travel. */
@FieldOrder(order = 18)
@IntRange(minValue=1,maxValue=250)
@Asn1Optional public Long numberOfDaysOfTravel;
+ /** The activated day. */
@FieldOrder(order = 19)
@Asn1Optional public SequenceOfActivatedDays activatedDay;
+ /** The countries. */
@FieldOrder(order = 20)
@Asn1Optional public SequenceOfCountries countries;
+ /** The included carriers num. */
@FieldOrder(order = 21)
@Asn1Optional public SequenceOfCarrierNum includedCarriersNum;
+ /** The included carriers IA 5. */
@FieldOrder(order = 22)
@Asn1Optional public SequenceOfStringIA5 includedCarriersIA5;
+ /** The excluded carriers num. */
@FieldOrder(order = 23)
@Asn1Optional public SequenceOfCarrierNum excludedCarriersNum;
+ /** The excluded carriers IA 5. */
@FieldOrder(order = 24)
@Asn1Optional public SequenceOfStringIA5 excludedCarriersIA5;
+ /** The included service brands. */
@FieldOrder(order = 25)
@Asn1Optional public SequenceOfServiceBrands includedServiceBrands;
+ /** The excluded service brands. */
@FieldOrder(order = 26)
@Asn1Optional public SequenceOfServiceBrands excludedServiceBrands;
+ /** The valid region. */
@FieldOrder(order = 27)
@Asn1Optional public SequenceOfRegionalValidityType validRegion;
+ /** The tariffs. */
@FieldOrder(order = 28)
@Asn1Optional public SequenceOfTariffType tariffs;
+ /** The price. */
@FieldOrder(order = 29)
@Asn1Optional Asn1BigInteger price;
+ /** The vat details. */
@FieldOrder(order = 30)
@Asn1Optional SequenceOfVatDetail vatDetails;
+ /** The info text. */
@FieldOrder(order = 31)
@RestrictedString(CharacterRestriction.UTF8String)
@Asn1Optional public String infoText;
+ /** The extension. */
@FieldOrder(order = 32)
@Asn1Optional public ExtensionData extension;
@@ -162,46 +204,91 @@ public class PassData extends Object { + /**
+ * Gets the reference num.
+ *
+ * @return the reference num
+ */
public Asn1BigInteger getReferenceNum() {
return this.referenceNum;
}
+ /**
+ * Gets the reference IA 5.
+ *
+ * @return the reference IA 5
+ */
public String getReferenceIA5() {
return this.referenceIA5;
}
+ /**
+ * Gets the product owner num.
+ *
+ * @return the product owner num
+ */
public Long getProductOwnerNum() {
return this.productOwnerNum;
}
+ /**
+ * Gets the product owner IA 5.
+ *
+ * @return the product owner IA 5
+ */
public String getProductOwnerIA5() {
return this.productOwnerIA5;
}
+ /**
+ * Gets the product id num.
+ *
+ * @return the product id num
+ */
public Long getProductIdNum() {
return this.productIdNum;
}
+ /**
+ * Gets the product id IA 5.
+ *
+ * @return the product id IA 5
+ */
public String getProductIdIA5() {
return this.productIdIA5;
}
+ /**
+ * Gets the pass type.
+ *
+ * @return the pass type
+ */
public Long getPassType() {
return this.passType;
}
+ /**
+ * Gets the pass description.
+ *
+ * @return the pass description
+ */
public String getPassDescription() {
return this.passDescription;
}
+ /**
+ * Gets the class code.
+ *
+ * @return the class code
+ */
public TravelClassType getClassCode() {
if (classCode == null){
@@ -211,267 +298,537 @@ public class PassData extends Object { return this.classCode;
}
+ /**
+ * Gets the valid from day.
+ *
+ * @return the valid from day
+ */
public Long getValidFromDay() {
return this.validFromDay;
}
+ /**
+ * Gets the valid from time.
+ *
+ * @return the valid from time
+ */
public Long getValidFromTime() {
return this.validFromTime;
}
+ /**
+ * Gets the valid until day.
+ *
+ * @return the valid until day
+ */
public Long getValidUntilDay() {
return this.validUntilDay;
}
+ /**
+ * Gets the valid until time.
+ *
+ * @return the valid until time
+ */
public Long getValidUntilTime() {
return this.validUntilTime;
}
+ /**
+ * Gets the validity period details.
+ *
+ * @return the validity period details
+ */
public ValidityPeriodDetailType getValidityPeriodDetails() {
return this.validityPeriodDetails;
}
+ /**
+ * Gets the number of validity days.
+ *
+ * @return the number of validity days
+ */
public Long getNumberOfValidityDays() {
return this.numberOfValidityDays;
}
+ /**
+ * Gets the number of possible trips.
+ *
+ * @return the number of possible trips
+ */
public Long getNumberOfPossibleTrips() {
return this.numberOfPossibleTrips;
}
+ /**
+ * Gets the number of days of travel.
+ *
+ * @return the number of days of travel
+ */
public Long getNumberOfDaysOfTravel() {
return this.numberOfDaysOfTravel;
}
+ /**
+ * Gets the activated day.
+ *
+ * @return the activated day
+ */
public List<Long> getActivatedDay() {
return this.activatedDay;
}
+ /**
+ * Gets the countries.
+ *
+ * @return the countries
+ */
public List<Long> getCountries() {
return this.countries;
}
+ /**
+ * Gets the included carriers num.
+ *
+ * @return the included carriers num
+ */
public List<Long> getIncludedCarriersNum() {
return this.includedCarriersNum;
}
+ /**
+ * Gets the included carriers IA 5.
+ *
+ * @return the included carriers IA 5
+ */
public List<String> getIncludedCarriersIA5() {
return this.includedCarriersIA5;
}
+ /**
+ * Gets the excluded carriers num.
+ *
+ * @return the excluded carriers num
+ */
public List<Long> getExcludedCarriersNum() {
return this.excludedCarriersNum;
}
+ /**
+ * Gets the excluded carriers IA 5.
+ *
+ * @return the excluded carriers IA 5
+ */
public SequenceOfStringIA5 getExcludedCarriersIA5() {
return this.excludedCarriersIA5;
}
+ /**
+ * Gets the included service brands.
+ *
+ * @return the included service brands
+ */
public SequenceOfServiceBrands getIncludedServiceBrands() {
return this.includedServiceBrands;
}
+ /**
+ * Gets the excluded service brands.
+ *
+ * @return the excluded service brands
+ */
public SequenceOfServiceBrands getExcludedServiceBrands() {
return this.excludedServiceBrands;
}
+ /**
+ * Gets the valid region.
+ *
+ * @return the valid region
+ */
public List<RegionalValidityType> getValidRegion() {
return this.validRegion;
}
+ /**
+ * Gets the tariffs.
+ *
+ * @return the tariffs
+ */
public List<TariffType> getTariffs() {
return this.tariffs;
}
+ /**
+ * Gets the info text.
+ *
+ * @return the info text
+ */
public String getInfoText() {
return this.infoText;
}
+ /**
+ * Gets the extension.
+ *
+ * @return the extension
+ */
public ExtensionData getExtension() {
return this.extension;
}
+ /**
+ * Sets the reference num.
+ *
+ * @param referenceNum the new reference num
+ */
public void setReferenceNum(Asn1BigInteger referenceNum) {
this.referenceNum = referenceNum;
}
+ /**
+ * Sets the reference IA 5.
+ *
+ * @param referenceIA5 the new reference IA 5
+ */
public void setReferenceIA5(String referenceIA5) {
this.referenceIA5 = referenceIA5;
}
+ /**
+ * Sets the product owner num.
+ *
+ * @param productOwnerNum the new product owner num
+ */
public void setProductOwnerNum(Long productOwnerNum) {
this.productOwnerNum = productOwnerNum;
}
+ /**
+ * Sets the product owner IA 5.
+ *
+ * @param productOwnerIA5 the new product owner IA 5
+ */
public void setProductOwnerIA5(String productOwnerIA5) {
this.productOwnerIA5 = productOwnerIA5;
}
+ /**
+ * Sets the product id num.
+ *
+ * @param productIdNum the new product id num
+ */
public void setProductIdNum(Long productIdNum) {
this.productIdNum = productIdNum;
}
+ /**
+ * Sets the product id IA 5.
+ *
+ * @param productIdIA5 the new product id IA 5
+ */
public void setProductIdIA5(String productIdIA5) {
this.productIdIA5 = productIdIA5;
}
+ /**
+ * Sets the pass type.
+ *
+ * @param passType the new pass type
+ */
public void setPassType(Long passType) {
this.passType = passType;
}
+ /**
+ * Sets the pass description.
+ *
+ * @param passDescription the new pass description
+ */
public void setPassDescription(String passDescription) {
this.passDescription = passDescription;
}
+ /**
+ * Sets the class code.
+ *
+ * @param classCode the new class code
+ */
public void setClassCode(TravelClassType classCode) {
this.classCode = classCode;
}
+ /**
+ * Sets the valid from day.
+ *
+ * @param validFromDay the new valid from day
+ */
public void setValidFromDay(Long validFromDay) {
this.validFromDay = validFromDay;
}
+ /**
+ * Sets the valid from time.
+ *
+ * @param validFromTime the new valid from time
+ */
public void setValidFromTime(Long validFromTime) {
this.validFromTime = validFromTime;
}
+ /**
+ * Sets the valid until day.
+ *
+ * @param validUntilDay the new valid until day
+ */
public void setValidUntilDay(Long validUntilDay) {
this.validUntilDay = validUntilDay;
}
+ /**
+ * Sets the valid until time.
+ *
+ * @param validUntilTime the new valid until time
+ */
public void setValidUntilTime(Long validUntilTime) {
this.validUntilTime = validUntilTime;
}
+ /**
+ * Sets the validity period details.
+ *
+ * @param validityPeriodDetails the new validity period details
+ */
public void setValidityPeriodDetails(ValidityPeriodDetailType validityPeriodDetails) {
this.validityPeriodDetails = validityPeriodDetails;
}
+ /**
+ * Sets the number of validity days.
+ *
+ * @param numberOfValidityDays the new number of validity days
+ */
public void setNumberOfValidityDays(Long numberOfValidityDays) {
this.numberOfValidityDays = numberOfValidityDays;
}
+ /**
+ * Sets the number of possible trips.
+ *
+ * @param numberOfPossibleTrips the new number of possible trips
+ */
public void setNumberOfPossibleTrips(Long numberOfPossibleTrips) {
this.numberOfPossibleTrips = numberOfPossibleTrips;
}
+ /**
+ * Sets the number of days of travel.
+ *
+ * @param numberOfDaysOfTravel the new number of days of travel
+ */
public void setNumberOfDaysOfTravel(Long numberOfDaysOfTravel) {
this.numberOfDaysOfTravel = numberOfDaysOfTravel;
}
+ /**
+ * Sets the activated day.
+ *
+ * @param activatedDay the new activated day
+ */
public void setActivatedDay(SequenceOfActivatedDays activatedDay) {
this.activatedDay = activatedDay;
}
+ /**
+ * Sets the countries.
+ *
+ * @param countries the new countries
+ */
public void setCountries(SequenceOfCountries countries) {
this.countries = countries;
}
+ /**
+ * Sets the included carriers num.
+ *
+ * @param includedCarriersNum the new included carriers num
+ */
public void setIncludedCarriersNum(SequenceOfCarrierNum includedCarriersNum) {
this.includedCarriersNum = includedCarriersNum;
}
+ /**
+ * Sets the included carriers IA 5.
+ *
+ * @param includedCarriersIA5 the new included carriers IA 5
+ */
public void setIncludedCarriersIA5(SequenceOfStringIA5 includedCarriersIA5) {
this.includedCarriersIA5 = includedCarriersIA5;
}
+ /**
+ * Sets the excluded carriers num.
+ *
+ * @param excludedCarriersNum the new excluded carriers num
+ */
public void setExcludedCarriersNum(SequenceOfCarrierNum excludedCarriersNum) {
this.excludedCarriersNum = excludedCarriersNum;
}
+ /**
+ * Sets the excluded carriers IA 5.
+ *
+ * @param excludedCarriersIA5 the new excluded carriers IA 5
+ */
public void setExcludedCarriersIA5(SequenceOfStringIA5 excludedCarriersIA5) {
this.excludedCarriersIA5 = excludedCarriersIA5;
}
+ /**
+ * Sets the included service brands.
+ *
+ * @param includedServiceBrands the new included service brands
+ */
public void setIncludedServiceBrands(SequenceOfServiceBrands includedServiceBrands) {
this.includedServiceBrands = includedServiceBrands;
}
+ /**
+ * Sets the excluded service brands.
+ *
+ * @param excludedServiceBrands the new excluded service brands
+ */
public void setExcludedServiceBrands(SequenceOfServiceBrands excludedServiceBrands) {
this.excludedServiceBrands = excludedServiceBrands;
}
+ /**
+ * Sets the valid region.
+ *
+ * @param validRegion the new valid region
+ */
public void setValidRegion(SequenceOfRegionalValidityType validRegion) {
this.validRegion = validRegion;
}
+ /**
+ * Sets the tariffs.
+ *
+ * @param tariffs the new tariffs
+ */
public void setTariffs(SequenceOfTariffType tariffs) {
this.tariffs = tariffs;
}
+ /**
+ * Sets the info text.
+ *
+ * @param infoText the new info text
+ */
public void setInfoText(String infoText) {
this.infoText = infoText;
}
+ /**
+ * Sets the extension.
+ *
+ * @param extension the new extension
+ */
public void setExtension(ExtensionData extension) {
this.extension = extension;
}
+ /**
+ * Gets the price.
+ *
+ * @return the price
+ */
public Long getPrice() {
return Asn1BigInteger.toLong(price);
}
+ /**
+ * Sets the price.
+ *
+ * @param price the new price
+ */
public void setPrice(Long price) {
this.price = Asn1BigInteger.toAsn1(price);
}
+ /**
+ * Gets the vat details.
+ *
+ * @return the vat details
+ */
public SequenceOfVatDetail getVatDetails() {
return vatDetails;
}
+ /**
+ * Sets the vat details.
+ *
+ * @param vatDetails the new vat details
+ */
public void setVatDetails(SequenceOfVatDetail vatDetails) {
this.vatDetails = vatDetails;
}
+ /**
+ * Adds the vat detail.
+ *
+ * @param vatDetail the vat detail
+ */
public void addVatDetail(VatDetailType vatDetail) {
if (this.vatDetails == null) {
this.vatDetails = new SequenceOfVatDetail();
@@ -479,6 +836,13 @@ public class PassData extends Object { this.vatDetails.add(vatDetail);
}
+ /**
+ * Sets the validity dates.
+ *
+ * @param fromDate the from date
+ * @param untilDate the until date
+ * @param issuingDate the issuing date
+ */
public void setValidityDates (Date fromDate, Date untilDate, Date issuingDate){
if (issuingDate == null || fromDate == null) return;
@@ -493,12 +857,24 @@ public class PassData extends Object { }
+ /**
+ * Gets the valid from date.
+ *
+ * @param issuingDate the issuing date
+ * @return the valid from date
+ */
public Date getValidFromDate(Date issuingDate){
return DateTimeUtils.getDate(issuingDate, this.validFromDay, this.validFromTime);
}
+ /**
+ * Gets the valid until date.
+ *
+ * @param issuingDate the issuing date
+ * @return the valid until date
+ */
public Date getValidUntilDate(Date issuingDate){
if (issuingDate == null) return null;
@@ -516,7 +892,29 @@ public class PassData extends Object { }
- public void setActivatedDays(Collection<Date> dates, Date issuingDate){
+
+ public void addActivatedDays(Collection<Long> days) {
+
+ if (days == null || days.isEmpty()) return;
+
+ if (this.activatedDay == null) {
+ this.activatedDay = new SequenceOfActivatedDays();
+ }
+
+ for (Long l : days) {
+ this.activatedDay.add(l);
+ }
+
+ }
+
+ /**
+ * Sets the activated days.
+ *
+ * @param dates the dates
+ * @param issuingDate the issuing date
+ * @param validFromDate the valid from date
+ */
+ public void setActivatedDays(Collection<Date> dates, Date issuingDate, Date validFromDate){
if (this.activatedDay != null) {
this.activatedDay.clear();
@@ -524,30 +922,50 @@ public class PassData extends Object { this.activatedDay= new SequenceOfActivatedDays();
}
+ long dateDif = 0L;
+ if (validFromDate != null) {
+ dateDif = DateTimeUtils.getDateDifference(issuingDate,validFromDate);
+ }
+
if (dates != null && !dates.isEmpty()) {
for (Date day : dates) {
- this.addActivatedDay(issuingDate, day);
+ this.addActivatedDay(issuingDate, dateDif, day);
}
}
}
- public void addActivatedDay(Date issuingDate, Date day){
+ /**
+ * Adds the activated day.
+ *
+ * @param issuingDate the issuing date in UTC
+ * @param dateOffset the date offset to be added to the issuing date
+ * @param day the day to be added
+ */
+ public void addActivatedDay(Date issuingDate, long dateOffset, Date day){
+
+ Long dayDiff = DateTimeUtils.getDateDifferenceLocal(issuingDate, day);
- Long dayDiff = DateTimeUtils.getDateDifference(issuingDate, day);
+ Long vDiff = DateTimeUtils.getDateDifferenceLocal(this.getValidFromDate(issuingDate), day);
if (this.activatedDay == null) {
this.activatedDay = new SequenceOfActivatedDays();
}
if (dayDiff != null) {
- this.activatedDay.add(dayDiff);
+ this.activatedDay.add(vDiff);
}
}
+ /**
+ * Gets the activated days.
+ *
+ * @param issuingDate the issuing date
+ * @return the activated days
+ */
public Collection<Date> getActivatedDays(Date issuingDate) {
if (this.activatedDay == null) return null;
@@ -556,7 +974,7 @@ public class PassData extends Object { for (Long diff: this.getActivatedDay()) {
- Date day = DateTimeUtils.getDate(issuingDate, diff, null);
+ Date day = DateTimeUtils.getDate(this.getValidFromDate(issuingDate), diff, null);
if (day != null) {
dates.add(day);
@@ -568,18 +986,38 @@ public class PassData extends Object { }
+ /**
+ * Gets the valid from UTC offset.
+ *
+ * @return the valid from UTC offset
+ */
public Long getValidFromUTCOffset() {
return validFromUTCOffset;
}
+ /**
+ * Sets the valid from UTC offset.
+ *
+ * @param validFromUTCOffset the new valid from UTC offset
+ */
public void setValidFromUTCOffset(Long validFromUTCOffset) {
this.validFromUTCOffset = validFromUTCOffset;
}
+ /**
+ * Gets the valid until UTC offset.
+ *
+ * @return the valid until UTC offset
+ */
public Long getValidUntilUTCOffset() {
return validUntilUTCOffset;
}
+ /**
+ * Sets the valid until UTC offset.
+ *
+ * @param validUntilUTCOffset the new valid until UTC offset
+ */
public void setValidUntilUTCOffset(Long validUntilUTCOffset) {
this.validUntilUTCOffset = validUntilUTCOffset;
}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/ReservationData.java b/src/org/uic/barcode/ticket/api/asn/omv1/ReservationData.java index 73fa5aa..adc5f71 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv1/ReservationData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv1/ReservationData.java @@ -33,6 +33,7 @@ import org.uic.barcode.asn1.datatypes.RestrictedString; import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypes.SizeRange;
import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@Sequence
@HasExtensionMarker
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/StationPassageData.java b/src/org/uic/barcode/ticket/api/asn/omv1/StationPassageData.java index a8718d7..36dc6bf 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv1/StationPassageData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv1/StationPassageData.java @@ -34,6 +34,7 @@ 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;
+import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@Sequence
@HasExtensionMarker
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/TrainLinkType.java b/src/org/uic/barcode/ticket/api/asn/omv1/TrainLinkType.java index 3eb0871..5469c2f 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv1/TrainLinkType.java +++ b/src/org/uic/barcode/ticket/api/asn/omv1/TrainLinkType.java @@ -28,6 +28,7 @@ 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.ticket.api.utils.DateTimeUtils;
@Sequence
public class TrainLinkType extends Object {
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodType.java b/src/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodType.java index a41fa03..5667ad9 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodType.java +++ b/src/org/uic/barcode/ticket/api/asn/omv1/ValidityPeriodType.java @@ -26,6 +26,7 @@ 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;
+import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@Sequence
public class ValidityPeriodType extends Object {
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 index 24df140..fb19462 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv1/uicBarcodeV1finalDelayConfirmation1.3.asn +++ b/src/org/uic/barcode/ticket/api/asn/omv1/uicBarcodeV1finalDelayConfirmation1.3.asn @@ -81,7 +81,7 @@ ASN-Module DEFINITIONS AUTOMATIC TAGS ::= BEGIN -- # 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. +-- # the day difference could become -1 although this can happen for locations in America or New Zeeland only. -- # -- # implementation example: -- # @@ -97,6 +97,7 @@ ASN-Module DEFINITIONS AUTOMATIC TAGS ::= BEGIN -- # issuingCal.set(Calendar.MINUTE, 0); -- # issuingCal.set(Calendar.SECOND, 0); -- # issuingCal.set(Calendar.MILLISECOND, 0); +-- # Date start = startCal.getTime(); -- # -- # Calendar fromCal = Calendar.getInstance(); -- # fromCal.clear(); @@ -106,11 +107,11 @@ ASN-Module DEFINITIONS AUTOMATIC TAGS ::= BEGIN -- # fromCal.set(Calendar.MINUTE, 0); -- # fromCal.set(Calendar.SECOND, 0); -- # fromCal.set(Calendar.MILLISECOND, 0); +-- # Date end = endCal.getTime(); -- # --- # long diff = localDate.getTime() - issuingDate.getTime(); --- # long dayDiff = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS); +-- # long diff = TimeUnit.DAYS.convert(end.getTime() - start.getTime(), TimeUnit.MILLISECONDS ); -- # --- # return new Long(dayDiff); +-- # return new Long(diff); -- # -- # } -- # @@ -843,7 +844,7 @@ ASN-Module DEFINITIONS AUTOMATIC TAGS ::= BEGIN productIdIA5 IA5String OPTIONAL, -- type of the pass, code list provided by the product owner - -- in case of Eurail: + -- in case of Eurail: -- 1 = Interrail -- 2 = Eurail -- 3 = Eurail Global (all countries) @@ -858,16 +859,16 @@ ASN-Module DEFINITIONS AUTOMATIC TAGS ::= BEGIN -- 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) + 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 + 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 depature @@ -883,21 +884,21 @@ ASN-Module DEFINITIONS AUTOMATIC TAGS ::= BEGIN -- 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 + -- 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, + countries SEQUENCE OF INTEGER (1..250) OPTIONAL, -- included carriers (RICS codes) - includedCarrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL, - includedCarrierIA5 SEQUENCE OF IA5String OPTIONAL, + 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, + excludedCarrierNum SEQUENCE OF INTEGER (1..32000) OPTIONAL, + excludedCarrierIA5 SEQUENCE OF IA5String OPTIONAL, - -- service brand: code list https://uic.org/service-brand-code-list + -- 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, diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/CarCarriageReservationData.java b/src/org/uic/barcode/ticket/api/asn/omv2/CarCarriageReservationData.java index 9bab332..6b2beb4 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv2/CarCarriageReservationData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv2/CarCarriageReservationData.java @@ -34,6 +34,7 @@ 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;
+import org.uic.barcode.ticket.api.utils.DateTimeUtils;
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/CountermarkData.java b/src/org/uic/barcode/ticket/api/asn/omv2/CountermarkData.java index 41c73b5..435c6ef 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv2/CountermarkData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv2/CountermarkData.java @@ -32,6 +32,7 @@ import org.uic.barcode.asn1.datatypes.IntRange; import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@Sequence
@HasExtensionMarker
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/DateTimeUtils.java b/src/org/uic/barcode/ticket/api/asn/omv2/DateTimeUtils.java deleted file mode 100644 index 04b1c2e..0000000 --- a/src/org/uic/barcode/ticket/api/asn/omv2/DateTimeUtils.java +++ /dev/null @@ -1,198 +0,0 @@ -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/FIPTicketData.java b/src/org/uic/barcode/ticket/api/asn/omv2/FIPTicketData.java index e11a66f..dbf35e2 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv2/FIPTicketData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv2/FIPTicketData.java @@ -32,6 +32,8 @@ 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;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfActivatedDays;
+import org.uic.barcode.ticket.api.utils.DateTimeUtils;
public class FIPTicketData extends Object {
public FIPTicketData() {
@@ -275,20 +277,16 @@ public class FIPTicketData extends Object { }
- public void setActivatedDays(Collection<Date> dates, Date issuingDate){
+ public void addActivatedDays(Collection<Long> days) {
- if (this.activatedDay != null) {
- this.activatedDay.clear();
- } else {
- this.activatedDay= new SequenceOfActivatedDays();
+ if (days == null || days.isEmpty()) return;
+
+ if (this.activatedDay == null) {
+ this.activatedDay = new SequenceOfActivatedDays();
}
- if (dates != null && !dates.isEmpty()) {
-
- for (Date day : dates) {
- this.addActivatedDay(issuingDate, day);
- }
-
+ for (Long l : days) {
+ this.activatedDay.add(l);
}
}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java b/src/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java index dc43d75..cef0b02 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java +++ b/src/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java @@ -31,6 +31,7 @@ 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;
+import org.uic.barcode.ticket.api.utils.DateTimeUtils;
public class IncludedOpenTicketType extends Object {
public IncludedOpenTicketType() {
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java b/src/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java index 402323e..c0dac70 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java @@ -35,6 +35,8 @@ import org.uic.barcode.asn1.datatypes.RestrictedString; import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypes.SizeRange;
import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfActivatedDays;
+import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@Sequence
@HasExtensionMarker
@@ -601,21 +603,16 @@ public class OpenTicketData extends Object { }
-
- public void setActivatedDays(Collection<Date> dates, Date issuingDate){
+ public void addActivatedDays(Collection<Long> days) {
+
+ if (days == null || days.isEmpty()) return;
- if (this.activatedDay != null) {
- this.activatedDay.clear();
- } else {
- this.activatedDay= new SequenceOfActivatedDays();
+ if (this.activatedDay == null) {
+ this.activatedDay = new SequenceOfActivatedDays();
}
- if (dates != null && !dates.isEmpty()) {
-
- for (Date day : dates) {
- this.addActivatedDay(issuingDate, day);
- }
-
+ for (Long l : days) {
+ this.activatedDay.add(l);
}
}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/ParkingGroundData.java b/src/org/uic/barcode/ticket/api/asn/omv2/ParkingGroundData.java index 1e14394..4f6f6d8 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv2/ParkingGroundData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv2/ParkingGroundData.java @@ -30,6 +30,7 @@ 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.ticket.api.utils.DateTimeUtils;
@Sequence
@HasExtensionMarker
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/PassData.java b/src/org/uic/barcode/ticket/api/asn/omv2/PassData.java index b3b02e7..b5c8429 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv2/PassData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv2/PassData.java @@ -34,6 +34,8 @@ 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.SequenceOfActivatedDays;
+import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@Sequence
@HasExtensionMarker
@@ -516,20 +518,16 @@ public class PassData extends Object { }
- public void setActivatedDays(Collection<Date> dates, Date issuingDate){
+ public void addActivatedDays(Collection<Long> days) {
- if (this.activatedDay != null) {
- this.activatedDay.clear();
- } else {
- this.activatedDay= new SequenceOfActivatedDays();
+ if (days == null || days.isEmpty()) return;
+
+ if (this.activatedDay == null) {
+ this.activatedDay = new SequenceOfActivatedDays();
}
- if (dates != null && !dates.isEmpty()) {
-
- for (Date day : dates) {
- this.addActivatedDay(issuingDate, day);
- }
-
+ for (Long l : days) {
+ this.activatedDay.add(l);
}
}
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/ReservationData.java b/src/org/uic/barcode/ticket/api/asn/omv2/ReservationData.java index a474e7d..31b3fa8 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv2/ReservationData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv2/ReservationData.java @@ -33,6 +33,7 @@ import org.uic.barcode.asn1.datatypes.RestrictedString; import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypes.SizeRange;
import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@Sequence
@HasExtensionMarker
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/StationPassageData.java b/src/org/uic/barcode/ticket/api/asn/omv2/StationPassageData.java index 6c6d36d..a378bb7 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv2/StationPassageData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv2/StationPassageData.java @@ -34,6 +34,7 @@ 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;
+import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@Sequence
@HasExtensionMarker
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java b/src/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java index 7c3de46..f269497 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java +++ b/src/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java @@ -28,6 +28,7 @@ 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.ticket.api.utils.DateTimeUtils;
@Sequence
public class TrainLinkType extends Object {
diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java b/src/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java index 6c36c97..7b08f73 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java +++ b/src/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java @@ -26,6 +26,7 @@ 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;
+import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@Sequence
public class ValidityPeriodType extends Object {
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 index b67ac06..2c2eda7 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv2/uicBarcodeFCBv2.0.asn +++ b/src/org/uic/barcode/ticket/api/asn/omv2/uicBarcodeFCBv2.0.asn @@ -535,7 +535,7 @@ ASN-Module DEFINITIONS AUTOMATIC TAGS ::= BEGIN vatDetail SEQUENCE OF VatDetailType OPTIONAL,
- -- type of supplement - code list from 018.1
+ -- type of supplement - code list from 918.1
typeOfSupplement INTEGER (0..9) DEFAULT 0,
numberOfSupplements INTEGER (0..200) DEFAULT 0,
|