diff options
Diffstat (limited to 'src')
35 files changed, 345 insertions, 116 deletions
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java index c3cc557..db13d89 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java @@ -361,12 +361,12 @@ public class IncludedOpenTicketType extends Object { public void setValidFromTimeZone(Date dateLocal, Date dateUTC ) {
// -- (UTC = local + offset * 15 Minutes)
- this.validFromUTCOffset = new Long(dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15);
+ this.validFromUTCOffset = Long.valueOf( (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);
+ this.validUntilUTCOffset = Long.valueOf( (dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15));
if (this.validFromUTCOffset.longValue() == this.validUntilUTCOffset.longValue()) {
this.validUntilUTCOffset = null;
@@ -393,19 +393,53 @@ public class IncludedOpenTicketType extends Object { return null;
}
+ if (this.validUntilTime == null) {
+ this.validUntilTime = 1439L;
+ }
+
return DateTimeUtils.getDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime);
}
public Date getUTCValidFromDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validUntilDay == null) {
+ return null;
+ }
+
+ if (this.validUntilTime == null) {
+ this.validUntilTime = 1439L;
+ }
+
return DateTimeUtils.getUTCDate(issuingDate, this.validFromDay, this.validFromTime, this.validFromUTCOffset);
}
public Date getUTCValidUntilDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validUntilDay == null) {
+ return null;
+ }
+
+ if (this.validUntilTime == null) {
+ this.validUntilTime = 1439L;
+ }
+
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);
+ return DateTimeUtils.getUTCDate(issuingDate, this.validFromDay + this.validUntilDay, this.validUntilTime, this.validFromUTCOffset);
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/CarCarriageReservationData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/CarCarriageReservationData.java index 97625e4..3abc50a 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/CarCarriageReservationData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/CarCarriageReservationData.java @@ -231,7 +231,7 @@ public class CarCarriageReservationData extends Object { public Long getBeginLoadingTime() {
- if (beginLoadingTime == null) return new Long(0);
+ if (beginLoadingTime == null) return 0L;
return beginLoadingTime;
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/CustomerCardData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/CustomerCardData.java index a7e7cfd..fcaf310 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/CustomerCardData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/CustomerCardData.java @@ -244,8 +244,8 @@ public class CustomerCardData extends Object { fromCal.clear();
fromCal.setTime(fromDate);
- this.validFromYear = new Long( fromCal.get(Calendar.YEAR));
- this.validFromDay = new Long (fromCal.get(Calendar.DAY_OF_YEAR));
+ this.validFromYear = Long.valueOf( fromCal.get(Calendar.YEAR));
+ this.validFromDay = Long.valueOf(fromCal.get(Calendar.DAY_OF_YEAR));
if (untilDate == null) return;
@@ -257,8 +257,8 @@ public class CustomerCardData extends Object { int yearDiff = untilCal.get(Calendar.YEAR) - fromCal.get(Calendar.YEAR);
- this.validUntilYear = new Long( yearDiff);
- this.validUntilDay = new Long (untildays);
+ this.validUntilYear = Long.valueOf( yearDiff);
+ this.validUntilDay = Long.valueOf(untildays);
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/DelayConfirmation.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/DelayConfirmation.java index daa9429..45d8d4b 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/DelayConfirmation.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/DelayConfirmation.java @@ -282,11 +282,11 @@ public class DelayConfirmation extends Object { 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));
+ this.plannedArrivalYear = Long.valueOf(cal.get(Calendar.YEAR));
+ this.plannedArrivalDay = Long.valueOf(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 );
+ this.plannedArrivalTime = Long.valueOf(time );
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/IncludedOpenTicketType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/IncludedOpenTicketType.java index ce46a94..4e9d294 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/IncludedOpenTicketType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/IncludedOpenTicketType.java @@ -385,12 +385,12 @@ public class IncludedOpenTicketType extends Object { public void setValidFromTimeZone(Date dateLocal, Date dateUTC ) {
// -- (UTC = local + offset * 15 Minutes)
- this.validFromUTCOffset = new Long(dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15);
+ this.validFromUTCOffset = Long.valueOf((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);
+ this.validUntilUTCOffset = Long.valueOf((dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15));
if (this.validFromUTCOffset.longValue() == this.validUntilUTCOffset.longValue()) {
this.validUntilUTCOffset = null;
@@ -401,6 +401,16 @@ public class IncludedOpenTicketType extends Object { public Date getValidFromDate(Date issuingDate){
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validFromTime == null) {
+ this.validFromTime = 0L;
+ }
+
return DateTimeUtils.getDate(issuingDate, this.validFromDay, this.validFromTime);
}
@@ -426,10 +436,40 @@ public class IncludedOpenTicketType extends Object { }
public Date getUTCValidFromDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validUntilDay == null) {
+ return null;
+ }
+
+ if (this.getValidUntilTime() == null) {
+ this.validUntilTime = 1439L;
+ }
+
return DateTimeUtils.getUTCDate(issuingDate, this.validFromDay, this.validFromTime, this.validFromUTCOffset);
}
public Date getUTCValidUntilDate(Date issuingDate){
+
+ if (issuingDate == null) return null;
+
+ if (this.validFromDay == null) {
+ this.validFromDay = 0L;
+ }
+
+ if (this.validUntilDay == null) {
+ return null;
+ }
+
+ if (this.getValidUntilTime() == null) {
+ this.validUntilTime = 1439L;
+ }
+
this.getValidUntilDate(issuingDate);
if (this.validUntilUTCOffset == null) {
return DateTimeUtils.getUTCDate(issuingDate, this.validFromDay + this.validUntilDay, this.validFromTime, this.validFromUTCOffset);
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/IssuingData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/IssuingData.java index f8e8477..78d5609 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/IssuingData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/IssuingData.java @@ -184,7 +184,7 @@ public class IssuingData extends Object { public Long getCurrencyFract() {
if (currencyFract == null) {
- return new Long(2);
+ return Long.valueOf(2L);
}
return this.currencyFract;
}
@@ -323,11 +323,11 @@ public class IssuingData extends Object { 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));
+ this.issuingYear = Long.valueOf(cal.get(Calendar.YEAR));
+ this.issuingDay = Long.valueOf(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 );
+ this.issuingTime = Long.valueOf(time );
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/LuggageRestrictionType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/LuggageRestrictionType.java index 684b762..04db732 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/LuggageRestrictionType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/LuggageRestrictionType.java @@ -54,7 +54,7 @@ public class LuggageRestrictionType extends Object { public Long getMaxHandLuggagePieces() {
if (maxHandLuggagePieces == null) {
- return new Long(3);
+ return 3L;
}
return this.maxHandLuggagePieces;
@@ -63,7 +63,7 @@ public class LuggageRestrictionType extends Object { public Long getMaxNonHandLuggagePieces() {
if (maxNonHandLuggagePieces == null) {
- return new Long(1);
+ return 1L;
}
return this.maxNonHandLuggagePieces;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/OpenTicketData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/OpenTicketData.java index b9bd214..c73b9cf 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/OpenTicketData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/OpenTicketData.java @@ -35,7 +35,6 @@ 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.omv3.SequenceOfActivatedDays;
import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@Sequence
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/PassData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/PassData.java index 9ef1acb..1a3dc63 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/PassData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/PassData.java @@ -34,7 +34,6 @@ 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.omv3.SequenceOfActivatedDays;
import org.uic.barcode.ticket.api.utils.DateTimeUtils;
@Sequence
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ReservationData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ReservationData.java index f841f91..c656f8a 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ReservationData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ReservationData.java @@ -314,7 +314,7 @@ public class ReservationData extends Object { public Long getArrivalDate() {
if (arrivalDate == null) {
- return new Long(0);
+ return Long.valueOf(0L);
}
return this.arrivalDate;
@@ -397,7 +397,7 @@ public class ReservationData extends Object { public Long getTypeOfSupplement() {
if (typeOfSupplement == null){
- return new Long(0);
+ return 0L;
}
@@ -407,7 +407,7 @@ public class ReservationData extends Object { public Long getNumberOfSupplements() {
if (numberOfSupplements == null) {
- return new Long(0);
+ return 0L;
}
return this.numberOfSupplements;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfActivatedDays.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfActivatedDays.java index 1166a20..7b80a93 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfActivatedDays.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfActivatedDays.java @@ -14,7 +14,7 @@ public class SequenceOfActivatedDays extends Asn1SequenceOf<Long> { public SequenceOfActivatedDays(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfCarrierNum.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfCarrierNum.java index 3447264..e292687 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfCarrierNum.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfCarrierNum.java @@ -15,7 +15,7 @@ public class SequenceOfCarrierNum extends Asn1SequenceOf<Long> { public SequenceOfCarrierNum(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
public static SequenceOfCarrierNum getSequence(List<Long> numList) {
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfCountries.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfCountries.java index 46c72e8..8bd0907 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfCountries.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfCountries.java @@ -15,7 +15,7 @@ public class SequenceOfCountries extends Asn1SequenceOf<Long> { public SequenceOfCountries(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfPlaceNum.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfPlaceNum.java index 1a6dbfc..33ee317 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfPlaceNum.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfPlaceNum.java @@ -16,7 +16,7 @@ public class SequenceOfPlaceNum extends Asn1SequenceOf<Long> { public SequenceOfPlaceNum(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfServiceBrands.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfServiceBrands.java index 3048235..2c7a596 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfServiceBrands.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfServiceBrands.java @@ -15,7 +15,7 @@ public class SequenceOfServiceBrands extends Asn1SequenceOf<Long> { public SequenceOfServiceBrands(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfTransportTypes.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfTransportTypes.java index edec045..b6dcf70 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfTransportTypes.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfTransportTypes.java @@ -15,7 +15,7 @@ public class SequenceOfTransportTypes extends Asn1SequenceOf<Long> { public SequenceOfTransportTypes(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfTravelerId.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfTravelerId.java index 6808104..e548211 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfTravelerId.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfTravelerId.java @@ -14,7 +14,7 @@ public class SequenceOfTravelerId extends Asn1SequenceOf<Long> { public SequenceOfTravelerId(List<Long> numbers) {
super();
for (Long number: numbers){
- this.add(new Long(number));
+ this.add(Long.valueOf(number));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TariffType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TariffType.java index 1159451..a04688f 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TariffType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TariffType.java @@ -81,7 +81,7 @@ public class TariffType extends Object { public Long getNumberOfPassengers() {
if (numberOfPassengers == null) {
- return new Long(1);
+ return 1L;
}
return this.numberOfPassengers;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TrainLinkType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TrainLinkType.java index 1f0d188..3bdfadd 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TrainLinkType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TrainLinkType.java @@ -178,7 +178,7 @@ public class TrainLinkType extends Object { public void setDepartureTimeZone(Date dateLocal, Date dateUTC ) {
// -- (UTC = local + offset * 15 Minutes)
- this.departureUTCOffset = new Long(dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15);
+ this.departureUTCOffset = Long.valueOf((dateLocal.getTime() - dateUTC.getTime()) / (1000 * 60 * 15));
}
public Date getDepartureDate(Date issuingDate){
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TrainValidityType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TrainValidityType.java index 4f1bd72..460f899 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TrainValidityType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TrainValidityType.java @@ -97,7 +97,7 @@ public class TrainValidityType extends Object { public Long getValidFromDay() {
if (validFromDay == null) {
- return new Long(0);
+ return 0L;
}
return this.validFromDay;
@@ -111,7 +111,7 @@ public class TrainValidityType extends Object { public Long getValidUntilDay() {
if (validUntilDay == null) {
- return new Long(0);
+ return 0L;
}
return this.validUntilDay;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TravelerType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TravelerType.java index e41f758..c22092d 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TravelerType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/TravelerType.java @@ -305,9 +305,9 @@ public class TravelerType extends Object { Calendar cal = Calendar.getInstance();
cal.setTime(date);
- this.yearOfBirth = new Long( cal.get(Calendar.YEAR));
- this.monthOfBirth = new Long(cal.get(Calendar.MONTH) + 1);
- this.dayOfBirth = new Long (cal.get(Calendar.DAY_OF_MONTH));
+ this.yearOfBirth = Long.valueOf( cal.get(Calendar.YEAR));
+ this.monthOfBirth = Long.valueOf(cal.get(Calendar.MONTH) + 1);
+ this.dayOfBirth = Long.valueOf(cal.get(Calendar.DAY_OF_MONTH));
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ValidityPeriodType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ValidityPeriodType.java index 79364a3..b932177 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ValidityPeriodType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/ValidityPeriodType.java @@ -62,7 +62,7 @@ public class ValidityPeriodType extends Object { public Long getValidFromDay() {
if (validFromDay == null) {
- return new Long(0);
+ return 0L;
}
return this.validFromDay;
@@ -76,7 +76,7 @@ public class ValidityPeriodType extends Object { public Long getValidUntilDay() {
if (validUntilDay == null) {
- return new Long(0);
+ return 0L;
}
return this.validUntilDay;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/VoucherData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/VoucherData.java index e139832..b7cbca2 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/VoucherData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/VoucherData.java @@ -241,8 +241,8 @@ public class VoucherData extends Object { fromCal.clear();
fromCal.setTime(fromDate);
- this.validFromYear = new Long( fromCal.get(Calendar.YEAR));
- this.validFromDay = new Long (fromCal.get(Calendar.DAY_OF_YEAR));
+ this.validFromYear = Long.valueOf( fromCal.get(Calendar.YEAR));
+ this.validFromDay = Long.valueOf(fromCal.get(Calendar.DAY_OF_YEAR));
if (untilDate == null) return;
@@ -250,8 +250,8 @@ public class VoucherData extends Object { untilCal.clear();
untilCal.setTime(untilDate);
- this.validUntilYear = new Long( untilCal.get(Calendar.YEAR));
- this.validUntilDay = new Long (untilCal.get(Calendar.DAY_OF_YEAR));
+ this.validUntilYear = Long.valueOf( untilCal.get(Calendar.YEAR));
+ this.validUntilDay = Long.valueOf(untilCal.get(Calendar.DAY_OF_YEAR));
}
@@ -264,8 +264,8 @@ public class VoucherData extends Object { fromCal.clear();
fromCal.setTime(fromDate);
- this.validFromYear = new Long( fromCal.get(Calendar.YEAR));
- this.validFromDay = new Long (fromCal.get(Calendar.DAY_OF_YEAR));
+ this.validFromYear = Long.valueOf( fromCal.get(Calendar.YEAR));
+ this.validFromDay = Long.valueOf(fromCal.get(Calendar.DAY_OF_YEAR));
}
@@ -277,8 +277,8 @@ public class VoucherData extends Object { untilCal.clear();
untilCal.setTime(untilDate);
- this.validUntilYear = new Long( untilCal.get(Calendar.YEAR));
- this.validUntilDay = new Long (untilCal.get(Calendar.DAY_OF_YEAR));
+ this.validUntilYear = Long.valueOf( untilCal.get(Calendar.YEAR));
+ this.validUntilDay = Long.valueOf(untilCal.get(Calendar.DAY_OF_YEAR));
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/impl/SimpleZone.java b/src/main/java/org/uic/barcode/ticket/api/impl/SimpleZone.java index 46c54ef..ccf0459 100644 --- a/src/main/java/org/uic/barcode/ticket/api/impl/SimpleZone.java +++ b/src/main/java/org/uic/barcode/ticket/api/impl/SimpleZone.java @@ -136,7 +136,7 @@ public class SimpleZone implements IZone { * @see org.uic.ticket.api.spec.IZone#addZoneId(int)
*/
public void addZoneId(int zoneId) {
- this.zoneIds.add(new Integer (zoneId));
+ this.zoneIds.add(Integer.valueOf(zoneId));
}
@Override
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/Api2AsnEncoder.java b/src/main/java/org/uic/barcode/ticket/api/utils/Api2AsnEncoder.java index 11052b0..7c06209 100644 --- a/src/main/java/org/uic/barcode/ticket/api/utils/Api2AsnEncoder.java +++ b/src/main/java/org/uic/barcode/ticket/api/utils/Api2AsnEncoder.java @@ -1,7 +1,6 @@ package org.uic.barcode.ticket.api.utils;
import org.uic.barcode.ticket.EncodingFormatException;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.IUicRailTicket;
public abstract interface Api2AsnEncoder {
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java index ada4c1a..615f646 100644 --- a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java +++ b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java @@ -317,7 +317,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { asnData.setConfirmationType(ConfirmationTypeType.values()[document.getConfirmationType()]);
- asnData.setDelay(new Long(document.getDelay()));
+ asnData.setDelay(Long.valueOf(document.getDelay()));
asnData.setTrainCancelled(document.isTrainCancelled());
@@ -758,11 +758,11 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { }
if (document.getExternalIssuer() > 0) {
- asnData.setExternalIssuerId(new Long(document.getExternalIssuer()));
+ asnData.setExternalIssuerId(Long.valueOf(document.getExternalIssuer()));
}
if (document.getAuthorizationCode() > 0) {
- asnData.setIssuerAutorizationId(new Long(document.getAuthorizationCode()));
+ asnData.setIssuerAutorizationId(Long.valueOf(document.getAuthorizationCode()));
}
if (document.getValidRegionList()!= null && document.getValidRegionList().size() > 0) {
@@ -936,11 +936,11 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { }
if (document.getExternalIssuer()>0) {
- asnData.setExtIssuerId(new Long(document.getExternalIssuer()));
+ asnData.setExtIssuerId(Long.valueOf(document.getExternalIssuer()));
}
if (document.getAuthorizationCode()>0) {
- asnData.setIssuerAutorizationId(new Long (document.getAuthorizationCode()));
+ asnData.setIssuerAutorizationId(Long.valueOf(document.getAuthorizationCode()));
}
if (document.getValidRegionList() != null && document.getValidRegionList().size() > 0) {
@@ -1031,8 +1031,8 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { }
asnData.setGroupName(document.getGroupName());
- asnData.setNumberOfCountermark(new Long(document.getNumberOfCountermark()));
- asnData.setTotalOfCountermarks(new Long(document.getTotalOfCountermarks()));
+ asnData.setNumberOfCountermark(Long.valueOf(document.getNumberOfCountermark()));
+ asnData.setTotalOfCountermarks(Long.valueOf(document.getTotalOfCountermarks()));
asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
@@ -1145,11 +1145,11 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { asnData.setRoute(encodeViaStationCollection(document.getRoute()));
if (document.getRouteId() > 0){
- asnData.setRouteId(new Long(document.getRouteId()));
+ asnData.setRouteId(Long.valueOf(document.getRouteId()));
}
if (document.getSeriesId() > 0) {
- asnData.setSeriesId(new Long(document.getSeriesId()));
+ asnData.setSeriesId(Long.valueOf(document.getSeriesId()));
}
return asnData;
@@ -1290,7 +1290,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { asnData.setTerminatingStationNum(UicEncoderUtils.getNum(data.getTerminatingStation()));
if (data.getCity() > 0) {
- asnData.setCity(new Long(data.getCity()));
+ asnData.setCity(Long.valueOf(data.getCity()));
}
asnData.setLineId(SequenceOfUnrestrictedLong.getSequence(UicEncoderUtils.encodeIntegerCollection(data.getLineIds())));
@@ -1650,7 +1650,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { asnData.setNumberOfValidityDays(UicEncoderUtils.getRestrictedInt(document.getNumberOfValidityDays(), 1, 370));
asnData.setPassDescription(document.getPassDescription());
if (document.getPassType() > 0 ){
- asnData.setPassType(new Long(document.getPassType()));
+ asnData.setPassType(Long.valueOf(document.getPassType()));
}
asnData.setTariffs(encodeTariffCollection(document.getTariffs()));
@@ -1702,8 +1702,8 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { }
TimeRangeType asnRange = new TimeRangeType();
- asnRange.setFromTime(new Long(range.getFromTime()));
- asnRange.setUntilTime(new Long(range.getUntilTime()));
+ asnRange.setFromTime(Long.valueOf(range.getFromTime()));
+ asnRange.setUntilTime(Long.valueOf(range.getUntilTime()));
asnData.getExcludedTimeRange().add(asnRange);
}
@@ -1811,7 +1811,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
if (document.getNumberOfdaysAllowed() > 0) {
- asnData.setNumberOfDaysValid(new Long(document.getNumberOfdaysAllowed()));
+ asnData.setNumberOfDaysValid(Long.valueOf(document.getNumberOfdaysAllowed()));
}
asnData.setProductName(document.getProductName());
@@ -2271,8 +2271,8 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { VatDetailType asnVatDetail = new VatDetailType();
asnVatDetail.setAmount(vatDetail.getAmount());
- asnVatDetail.setCountry(new Long(vatDetail.getCountry()));
- asnVatDetail.setPercentage(new Long(vatDetail.getPercentage()));
+ asnVatDetail.setCountry(Long.valueOf(vatDetail.getCountry()));
+ asnVatDetail.setPercentage(Long.valueOf(vatDetail.getPercentage()));
asnVatDetail.setVatId(vatDetail.getVatId());
return asnVatDetail;
@@ -2351,7 +2351,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { CustomerStatusType asnStatus = new CustomerStatusType();
if (status.getStatus() > 0) {
- asnStatus.setCustomerStatus(new Long(status.getStatus()));
+ asnStatus.setCustomerStatus(Long.valueOf(status.getStatus()));
}
asnStatus.setCustomerStatusDescr(status.getDescription());
asnStatus.setStatusProviderIA5(UicEncoderUtils.getIA5NonNum(status.getStatusProvider()));
@@ -2399,10 +2399,6 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { return TravelClassType.second;
}
-
-
-
-
return TravelClassType.valueOf(apiClass.name());
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java index 3468ec6..0656d49 100644 --- a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java +++ b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java @@ -314,7 +314,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { asnData.setConfirmationType(ConfirmationTypeType.values()[document.getConfirmationType()]);
- asnData.setDelay(new Long(document.getDelay()));
+ asnData.setDelay(Long.valueOf(document.getDelay()));
asnData.setTrainCancelled(document.isTrainCancelled());
@@ -758,11 +758,11 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { }
if (document.getExternalIssuer() > 0) {
- asnData.setExternalIssuerId(new Long(document.getExternalIssuer()));
+ asnData.setExternalIssuerId(Long.valueOf(document.getExternalIssuer()));
}
if (document.getAuthorizationCode() > 0) {
- asnData.setIssuerAutorizationId(new Long(document.getAuthorizationCode()));
+ asnData.setIssuerAutorizationId(Long.valueOf(document.getAuthorizationCode()));
}
if (document.getValidRegionList()!= null && document.getValidRegionList().size() > 0) {
@@ -938,11 +938,11 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { }
if (document.getExternalIssuer()>0) {
- asnData.setExtIssuerId(new Long(document.getExternalIssuer()));
+ asnData.setExtIssuerId(Long.valueOf(document.getExternalIssuer()));
}
if (document.getAuthorizationCode()>0) {
- asnData.setIssuerAutorizationId(new Long (document.getAuthorizationCode()));
+ asnData.setIssuerAutorizationId(Long.valueOf(document.getAuthorizationCode()));
}
if (document.getValidRegionList() != null && document.getValidRegionList().size() > 0) {
@@ -1032,8 +1032,8 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { }
asnData.setGroupName(document.getGroupName());
- asnData.setNumberOfCountermark(new Long(document.getNumberOfCountermark()));
- asnData.setTotalOfCountermarks(new Long(document.getTotalOfCountermarks()));
+ asnData.setNumberOfCountermark(Long.valueOf(document.getNumberOfCountermark()));
+ asnData.setTotalOfCountermarks(Long.valueOf(document.getTotalOfCountermarks()));
asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
@@ -1147,10 +1147,10 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { asnData.setRoute(encodeViaStationCollection(document.getRoute()));
if (document.getRouteId() > 0){
- asnData.setRouteId(new Long(document.getRouteId()));
+ asnData.setRouteId(Long.valueOf(document.getRouteId()));
}
if (document.getSeriesId() > 0){
- asnData.setSeriesId(new Long(document.getSeriesId()));
+ asnData.setSeriesId(Long.valueOf(document.getSeriesId()));
}
return asnData;
@@ -1294,7 +1294,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { asnData.setTerminatingStationNum(UicEncoderUtils.getNum(document.getTerminatingStation()));
if (document.getCity() > 0) {
- asnData.setCity(new Long(document.getCity()));
+ asnData.setCity(Long.valueOf(document.getCity()));
}
asnData.setLineId(SequenceOfUnrestrictedLong.getSequence(UicEncoderUtils.encodeIntegerCollection(document.getLineIds())));
@@ -1654,7 +1654,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { asnData.setNumberOfValidityDays(UicEncoderUtils.getRestrictedInt(document.getNumberOfValidityDays(), 1, 370));
asnData.setPassDescription(document.getPassDescription());
if (document.getPassType() > 0 ){
- asnData.setPassType(new Long(document.getPassType()));
+ asnData.setPassType(Long.valueOf(document.getPassType()));
}
asnData.setTariffs(encodeTariffCollection(document.getTariffs()));
@@ -1703,8 +1703,8 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { }
TimeRangeType asnRange = new TimeRangeType();
- asnRange.setFromTime(new Long(range.getFromTime()));
- asnRange.setUntilTime(new Long(range.getUntilTime()));
+ asnRange.setFromTime(Long.valueOf(range.getFromTime()));
+ asnRange.setUntilTime(Long.valueOf(range.getUntilTime()));
if (asnData.getExcludedTimeRange() == null) {
asnData.setExcludedTimeRange(new SequenceOfTimeRangeType());
@@ -1815,7 +1815,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
if (document.getNumberOfdaysAllowed() > 0) {
- asnData.setNumberOfDaysValid(new Long(document.getNumberOfdaysAllowed()));
+ asnData.setNumberOfDaysValid(Long.valueOf(document.getNumberOfdaysAllowed()));
}
asnData.setProductName(document.getProductName());
@@ -2277,8 +2277,8 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { VatDetailType asnVatDetail = new VatDetailType();
asnVatDetail.setAmount(vatDetail.getAmount());
- asnVatDetail.setCountry(new Long(vatDetail.getCountry()));
- asnVatDetail.setPercentage(new Long(vatDetail.getPercentage()));
+ asnVatDetail.setCountry(Long.valueOf(vatDetail.getCountry()));
+ asnVatDetail.setPercentage(Long.valueOf(vatDetail.getPercentage()));
asnVatDetail.setVatId(vatDetail.getVatId());
return asnVatDetail;
@@ -2357,7 +2357,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { CustomerStatusType asnStatus = new CustomerStatusType();
if (status.getStatus() > 0) {
- asnStatus.setCustomerStatus(new Long(status.getStatus()));
+ asnStatus.setCustomerStatus(Long.valueOf(status.getStatus()));
}
asnStatus.setCustomerStatusDescr(status.getDescription());
asnStatus.setStatusProviderIA5(UicEncoderUtils.getIA5NonNum(status.getStatusProvider()));
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV3.java b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV3.java index 01bc209..d97e7b7 100644 --- a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV3.java +++ b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV3.java @@ -317,7 +317,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { asnData.setConfirmationType(ConfirmationTypeType.values()[document.getConfirmationType()]);
- asnData.setDelay(new Long(document.getDelay()));
+ asnData.setDelay(Long.valueOf(document.getDelay()));
asnData.setTrainCancelled(document.isTrainCancelled());
@@ -762,11 +762,11 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { }
if (document.getExternalIssuer() > 0) {
- asnData.setExternalIssuerId(new Long(document.getExternalIssuer()));
+ asnData.setExternalIssuerId(Long.valueOf(document.getExternalIssuer()));
}
if (document.getAuthorizationCode() > 0) {
- asnData.setIssuerAutorizationId(new Long(document.getAuthorizationCode()));
+ asnData.setIssuerAutorizationId(Long.valueOf(document.getAuthorizationCode()));
}
if (document.getValidRegionList()!= null && document.getValidRegionList().size() > 0) {
@@ -945,11 +945,11 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { }
if (document.getExternalIssuer()>0) {
- asnData.setExtIssuerId(new Long(document.getExternalIssuer()));
+ asnData.setExtIssuerId(Long.valueOf(document.getExternalIssuer()));
}
if (document.getAuthorizationCode()>0) {
- asnData.setIssuerAutorizationId(new Long (document.getAuthorizationCode()));
+ asnData.setIssuerAutorizationId(Long.valueOf(document.getAuthorizationCode()));
}
if (document.getValidRegionList() != null && document.getValidRegionList().size() > 0) {
@@ -1040,8 +1040,8 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { }
asnData.setGroupName(document.getGroupName());
- asnData.setNumberOfCountermark(new Long(document.getNumberOfCountermark()));
- asnData.setTotalOfCountermarks(new Long(document.getTotalOfCountermarks()));
+ asnData.setNumberOfCountermark(Long.valueOf(document.getNumberOfCountermark()));
+ asnData.setTotalOfCountermarks(Long.valueOf(document.getTotalOfCountermarks()));
asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
@@ -1158,11 +1158,11 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { asnData.setRoute(encodeViaStationCollection(document.getRoute()));
if (document.getRouteId() > 0){
- asnData.setRouteId(new Long(document.getRouteId()));
+ asnData.setRouteId(Long.valueOf(document.getRouteId()));
}
if (document.getSeriesId() > 0) {
- asnData.setSeriesId(new Long(document.getSeriesId()));
+ asnData.setSeriesId(Long.valueOf(document.getSeriesId()));
}
return asnData;
@@ -1302,7 +1302,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { asnData.setTerminatingStationNum(UicEncoderUtils.getNum(document.getTerminatingStation()));
if (document.getCity() > 0) {
- asnData.setCity(new Long(document.getCity()));
+ asnData.setCity(Long.valueOf(document.getCity()));
}
asnData.setLineId(SequenceOfUnrestrictedLong.getSequence(UicEncoderUtils.encodeIntegerCollection(document.getLineIds())));
@@ -1663,7 +1663,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { asnData.setNumberOfValidityDays(UicEncoderUtils.getRestrictedInt(document.getNumberOfValidityDays(), 1, 500));
asnData.setPassDescription(document.getPassDescription());
if (document.getPassType() > 0 ){
- asnData.setPassType(new Long(document.getPassType()));
+ asnData.setPassType(Long.valueOf(document.getPassType()));
}
asnData.setTariffs(encodeTariffCollection(document.getTariffs()));
@@ -1750,8 +1750,8 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { }
TimeRangeType asnRange = new TimeRangeType();
- asnRange.setFromTime(new Long(range.getFromTime()));
- asnRange.setUntilTime(new Long(range.getUntilTime()));
+ asnRange.setFromTime(Long.valueOf(range.getFromTime()));
+ asnRange.setUntilTime(Long.valueOf(range.getUntilTime()));
asnData.getExcludedTimeRange().add(asnRange);
}
@@ -1860,7 +1860,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
if (document.getNumberOfdaysAllowed() > 0) {
- asnData.setNumberOfDaysValid(new Long(document.getNumberOfdaysAllowed()));
+ asnData.setNumberOfDaysValid(Long.valueOf(document.getNumberOfdaysAllowed()));
}
asnData.setProductName(document.getProductName());
@@ -2321,8 +2321,8 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { VatDetailType asnVatDetail = new VatDetailType();
asnVatDetail.setAmount(vatDetail.getAmount());
- asnVatDetail.setCountry(new Long(vatDetail.getCountry()));
- asnVatDetail.setPercentage(new Long(vatDetail.getPercentage()));
+ asnVatDetail.setCountry(Long.valueOf(vatDetail.getCountry()));
+ asnVatDetail.setPercentage(Long.valueOf(vatDetail.getPercentage()));
asnVatDetail.setVatId(vatDetail.getVatId());
return asnVatDetail;
@@ -2401,7 +2401,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { CustomerStatusType asnStatus = new CustomerStatusType();
if (status.getStatus() > 0) {
- asnStatus.setCustomerStatus(new Long(status.getStatus()));
+ asnStatus.setCustomerStatus(Long.valueOf(status.getStatus()));
}
asnStatus.setCustomerStatusDescr(status.getDescription());
asnStatus.setStatusProviderIA5(UicEncoderUtils.getIA5NonNum(status.getStatusProvider()));
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/DateTimeUtils.java b/src/main/java/org/uic/barcode/ticket/api/utils/DateTimeUtils.java index c8664a5..7fe5bca 100644 --- a/src/main/java/org/uic/barcode/ticket/api/utils/DateTimeUtils.java +++ b/src/main/java/org/uic/barcode/ticket/api/utils/DateTimeUtils.java @@ -37,7 +37,7 @@ public class DateTimeUtils { //long diff = localDate.getTime() - issuingDate.getTime();
//long dayDiff = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
- return new Long(diff);
+ return Long.valueOf(diff);
}
@@ -64,7 +64,7 @@ public class DateTimeUtils { long diff = localDate.getTime() - referenceDate.getTime();
long dayDiff = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
- return new Long(dayDiff);
+ return Long.valueOf(dayDiff);
}
@@ -110,7 +110,7 @@ public class DateTimeUtils { }
int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE);
- return new Long (time );
+ return Long.valueOf(time);
}
public static Long getTime (Date date) {
@@ -120,7 +120,7 @@ public class DateTimeUtils { cal.setTime(date);
int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE);
- return new Long (time );
+ return Long.valueOf(time );
}
public static Date getDate(Date issuingDate, Long date, Long time){
@@ -177,7 +177,7 @@ public class DateTimeUtils { */
int minuteOffset = - cal.getTimeZone().getRawOffset()/ ( 1000 * 60 * 15 );
- return new Long (minuteOffset);
+ return Long.valueOf(minuteOffset);
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoder.java b/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoder.java index f9c6b7e..2fd7b6e 100644 --- a/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoder.java +++ b/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoder.java @@ -1957,7 +1957,7 @@ public class OpenAsn2ApiDecoder implements Asn2ApiDecoder { if (asnDocument.getIncludedServices() != null && !asnDocument.getIncludedServices().isEmpty()){
for (Long service: asnDocument.getIncludedServices()){
- card.addIncludedService(new Integer(service.intValue()));
+ card.addIncludedService(Integer.valueOf(service.intValue()));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java b/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java index f21a592..828fa88 100644 --- a/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java +++ b/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java @@ -1975,7 +1975,7 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder { if (asnDocument.getIncludedServices() != null && !asnDocument.getIncludedServices().isEmpty()){
for (Long service: asnDocument.getIncludedServices()){
- card.addIncludedService(new Integer(service.intValue()));
+ card.addIncludedService(Integer.valueOf(service.intValue()));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV3.java b/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV3.java index 66a0d22..e951fb0 100644 --- a/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV3.java +++ b/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV3.java @@ -2051,7 +2051,7 @@ public class OpenAsn2ApiDecoderV3 implements Asn2ApiDecoder { if (asnDocument.getIncludedServices() != null && !asnDocument.getIncludedServices().isEmpty()){
for (Long service: asnDocument.getIncludedServices()){
- card.addIncludedService(new Integer(service.intValue()));
+ card.addIncludedService(Integer.valueOf(service.intValue()));
}
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/UicEncoderUtils.java b/src/main/java/org/uic/barcode/ticket/api/utils/UicEncoderUtils.java index 261b7ac..ab6932e 100644 --- a/src/main/java/org/uic/barcode/ticket/api/utils/UicEncoderUtils.java +++ b/src/main/java/org/uic/barcode/ticket/api/utils/UicEncoderUtils.java @@ -388,7 +388,7 @@ public class UicEncoderUtils { if (value < min || value > max) {
throw new EncodingFormatException("Integer value exceeds boundaries");
}
- return new Long(value);
+ return Long.valueOf(value);
}
/**
@@ -407,7 +407,7 @@ public class UicEncoderUtils { if (value < min || value > max) {
throw new EncodingFormatException("Integer value exceeds boundaries");
}
- return new Long(value);
+ return Long.valueOf(value);
}
@@ -419,7 +419,7 @@ public class UicEncoderUtils { */
public static Long getUnRestrictedInt(int value) {
if (value == 0) return null;
- return new Long(value);
+ return Long.valueOf(value);
}
/**
diff --git a/src/test/java/org/uic/barcode/ticketTestDB/EurailPassTest.java b/src/test/java/org/uic/barcode/ticketTestDB/EurailPassTest.java new file mode 100644 index 0000000..b75f248 --- /dev/null +++ b/src/test/java/org/uic/barcode/ticketTestDB/EurailPassTest.java @@ -0,0 +1,81 @@ +package org.uic.barcode.ticketTestDB; + + +import java.util.Base64; +import java.util.TimeZone; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.uic.barcode.Decoder; +import org.uic.barcode.logger.LoggerFactory; +import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout; +import org.uic.barcode.test.utils.TestUtils; +import org.uic.barcode.ticket.api.spec.IUicRailTicket; + +public class EurailPassTest { + + TimeZone defaulttimeZone = null; + + String ticketBase64 = "I1VUMDE5OTAxVFQwMDEwLAIUNSMMrRGIB8fL3UcWDUxGq2yI5YICFEtBKOXG+1" + + "iZAAHvKzvpQNsmkR4CAAAAADAzNzd4nFVSTWvDMAz9KzoHmkl2HKdHL3FpIHWK63T0VAYrbDB2" + + "2MZ+/yT3MyYJSJbee3rKdFx71yEhGr1cIsH9OGWXK7sgpQlJoUL+VuQDwHRMgztwU91gbBPf6I" + + "ZvuZ1fPrWfousHTnMKK0lVwW28kFxrmljC7qMoipw4J6lpx8128BsfkosH2LrdDimDNNJj23EK" + + "KTLzDYconH7fT9+fr19vPygqCbXU6rbfc1RzbLIAmQ6VgPEwMougw+Kp7xYhosqI+cIUD+dPaV" + + "RUcXktKMZ105CYQV1xzd4NfccZBlbCrLSmEqkULbCAe4D6Tq47lzyMK3juY1qjzuwCx+qpLAp+" + + "xEf2jvCcL7AmnEVXUUqf7YYxeLg4dLauNuaxo6ZZZG8RoZ0x2RmTnaHYGYoVFVhnkG0cu6lNsm" + + "jSxD3ayh7sGIYDZJfgpU9rlrj3EVzossjtGBPvgCpjL+bIChQ++nExkMythiqeeQS4rol/iOYiBJe3H/cfqY6d6Q=="; + + + + String ticketHex = "2355543031353231373030303031302D021500A7958EBB21072C93018BEF922A" + + "53F597AAE3B5E90214625157E0A477C8955BFC2F288B450F5AB8501592000000303233367" + + "8DA554F5D4BC33014FD2B795470E5DCDC246D1F675BF5414146ABEC6954565D5997413705" + + "FF9B6FFE316F52E8F042B83987F391349B876A598200CB56535ABEAFBF5F0AF56F9022D5D" + + "04C6083B252AAD9D48FCBB59858EB55516B32220265C2E490C9EFDADDB86FC77327B11A44" + + "81243CB5DEABD77E187AA1444C26D0A6AC1795DFEE3FFDB65BDC16A0E0C064916DEDEC7FE" + + "EC6D3D15F75FE1A1C25C10F139E06E7DCECD298EE3620B127F20127676690C872B1E7A2C9" + + "84C92E0C27314972A4405AF8FEF76738F71FEAEB7850313309C5EAAD3F45984D70F271CCE" + + "690C455B312ECE66493DF007F3C8154C0"; + + /** + * Prepare tickets. + */ + @Before public void prepare() { + + LoggerFactory.setActivateConsoleLog(true); + + defaulttimeZone = TimeZone.getDefault(); + //decode in local CET time zone + TimeZone.setDefault(TimeZone.getTimeZone("CET")); + } + + + /** + * clean up + */ + @After public void resetTimeZone() { + TimeZone.setDefault(defaulttimeZone); + } + + @Test + public void testDecoder() throws Exception { + + + //byte[] content = Base64.getDecoder().decode(ticketBase64); + + byte[] content = TestUtils.hexStringToByteArray(ticketHex); + + // try to decode + Decoder decoder = new Decoder(content); + TicketLayout layout = decoder.getLayout(); + IUicRailTicket ticket = decoder.getUicTicket(); + + Assert.assertNotNull(layout); + //Assert.assertNotNull(ticket); + + } + + +}
\ No newline at end of file diff --git a/src/test/java/org/uic/barcode/ticketTestDB/EurailPassTest2.java b/src/test/java/org/uic/barcode/ticketTestDB/EurailPassTest2.java new file mode 100644 index 0000000..d1db192 --- /dev/null +++ b/src/test/java/org/uic/barcode/ticketTestDB/EurailPassTest2.java @@ -0,0 +1,81 @@ +package org.uic.barcode.ticketTestDB; + + +import java.util.Base64; +import java.util.TimeZone; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.uic.barcode.Decoder; +import org.uic.barcode.logger.LoggerFactory; +import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout; +import org.uic.barcode.test.utils.TestUtils; +import org.uic.barcode.ticket.api.spec.IUicRailTicket; + +public class EurailPassTest2 { + + TimeZone defaulttimeZone = null; + + String ticketBase64 = "I1VUMDE5OTAxVFQwMDEwLAIUNSMMrRGIB8fL3UcWDUxGq2yI5YICFEtBKOXG+1" + + "iZAAHvKzvpQNsmkR4CAAAAADAzNzd4nFVSTWvDMAz9KzoHmkl2HKdHL3FpIHWK63T0VAYrbDB2" + + "2MZ+/yT3MyYJSJbee3rKdFx71yEhGr1cIsH9OGWXK7sgpQlJoUL+VuQDwHRMgztwU91gbBPf6I" + + "ZvuZ1fPrWfousHTnMKK0lVwW28kFxrmljC7qMoipw4J6lpx8128BsfkosH2LrdDimDNNJj23EK" + + "KTLzDYconH7fT9+fr19vPygqCbXU6rbfc1RzbLIAmQ6VgPEwMougw+Kp7xYhosqI+cIUD+dPaV" + + "RUcXktKMZ105CYQV1xzd4NfccZBlbCrLSmEqkULbCAe4D6Tq47lzyMK3juY1qjzuwCx+qpLAp+" + + "xEf2jvCcL7AmnEVXUUqf7YYxeLg4dLauNuaxo6ZZZG8RoZ0x2RmTnaHYGYoVFVhnkG0cu6lNsm" + + "jSxD3ayh7sGIYDZJfgpU9rlrj3EVzossjtGBPvgCpjL+bIChQ++nExkMythiqeeQS4rol/iOYiBJe3H/cfqY6d6Q=="; + + + + String ticketHex = "23555430323131383130303330314713bb51986a0c947ce7b06aeb53ef44b96c7cbab606cf" + + "ee61d19d56c352ffc1ace883e82b4edaada9fa715eb7d501fec6df3bc8bd8fc570f3cc37" + + "887f75482630323139789c0b8d77f3718d3030363032322e52625467bced17c0cb69aad3" + + "b0d1b05aa92435b72027b124352cb5a838333f4fc94ac9c8d8c852cf5ccf50494729bfb4" + + "a4a0b424a4b22015281ee0e2a654eb202adc2030e7d2b57b370ebd7ac6b7eed08d17174e" + + "3d99d17b412043f800038b4cc6fd33394fde78acd5ddb8746bebc5a5bd6ba75e68e68b68" + + "d4bc3a77eace090d0a5b1a6fee3db9996fe2d5994be74e3dd3180892bfc4662278f38398" + + "3a7f8a4f8e9e4f57ce3acd736b97b8bbb8b9b8b680043a755a801c35360848810876f9ac" + + "3b0951a5e2bf800100bac05beb"; + + /** + * Prepare tickets. + */ + @Before public void prepare() { + + LoggerFactory.setActivateConsoleLog(true); + + defaulttimeZone = TimeZone.getDefault(); + //decode in local CET time zone + TimeZone.setDefault(TimeZone.getTimeZone("CET")); + } + + + /** + * clean up + */ + @After public void resetTimeZone() { + TimeZone.setDefault(defaulttimeZone); + } + + @Test + public void testDecoder() throws Exception { + + + //byte[] content = Base64.getDecoder().decode(ticketBase64); + + byte[] content = TestUtils.hexStringToByteArray(ticketHex); + + // try to decode + Decoder decoder = new Decoder(content); + TicketLayout layout = decoder.getLayout(); + IUicRailTicket ticket = decoder.getUicTicket(); + + Assert.assertNotNull(layout); + //Assert.assertNotNull(ticket); + + } + + +}
\ No newline at end of file |