From 1c986aed0cefed59cd6be49436217d5f524ed218 Mon Sep 17 00:00:00 2001 From: CGantert345 <57003061+CGantert345@users.noreply.github.com> Date: Thu, 5 Oct 2023 17:12:59 +0200 Subject: fix on productIdNum in includedOpenTickt productIdNum in includedOpenTicket fixed --- .../api/asn/omv1/IncludedOpenTicketType.java | 42 ++++++++++++++++++-- .../api/asn/omv3/CarCarriageReservationData.java | 2 +- .../ticket/api/asn/omv3/CustomerCardData.java | 8 ++-- .../ticket/api/asn/omv3/DelayConfirmation.java | 6 +-- .../api/asn/omv3/IncludedOpenTicketType.java | 46 ++++++++++++++++++++-- .../barcode/ticket/api/asn/omv3/IssuingData.java | 8 ++-- .../api/asn/omv3/LuggageRestrictionType.java | 4 +- .../ticket/api/asn/omv3/OpenTicketData.java | 1 - .../uic/barcode/ticket/api/asn/omv3/PassData.java | 1 - .../ticket/api/asn/omv3/ReservationData.java | 6 +-- .../api/asn/omv3/SequenceOfActivatedDays.java | 2 +- .../ticket/api/asn/omv3/SequenceOfCarrierNum.java | 2 +- .../ticket/api/asn/omv3/SequenceOfCountries.java | 2 +- .../ticket/api/asn/omv3/SequenceOfPlaceNum.java | 2 +- .../api/asn/omv3/SequenceOfServiceBrands.java | 2 +- .../api/asn/omv3/SequenceOfTransportTypes.java | 2 +- .../ticket/api/asn/omv3/SequenceOfTravelerId.java | 2 +- .../barcode/ticket/api/asn/omv3/TariffType.java | 2 +- .../barcode/ticket/api/asn/omv3/TrainLinkType.java | 2 +- .../ticket/api/asn/omv3/TrainValidityType.java | 4 +- .../barcode/ticket/api/asn/omv3/TravelerType.java | 6 +-- .../ticket/api/asn/omv3/ValidityPeriodType.java | 4 +- .../barcode/ticket/api/asn/omv3/VoucherData.java | 16 ++++---- .../uic/barcode/ticket/api/impl/SimpleZone.java | 2 +- .../barcode/ticket/api/utils/Api2AsnEncoder.java | 1 - .../ticket/api/utils/Api2OpenAsnEncoder.java | 38 ++++++++---------- .../ticket/api/utils/Api2OpenAsnEncoderV2.java | 34 ++++++++-------- .../ticket/api/utils/Api2OpenAsnEncoderV3.java | 34 ++++++++-------- .../barcode/ticket/api/utils/DateTimeUtils.java | 10 ++--- .../ticket/api/utils/OpenAsn2ApiDecoder.java | 2 +- .../ticket/api/utils/OpenAsn2ApiDecoderV2.java | 2 +- .../ticket/api/utils/OpenAsn2ApiDecoderV3.java | 2 +- .../barcode/ticket/api/utils/UicEncoderUtils.java | 6 +-- 33 files changed, 185 insertions(+), 118 deletions(-) (limited to 'src/main') 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..7a8e1fd 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 @@ -42,7 +42,7 @@ public class IncludedOpenTicketType extends Object { } @FieldOrder(order = 0) - @IntRange(minValue=1,maxValue=32000) + @IntRange(minValue=0,maxValue=32000) @Asn1Optional public Long productOwnerNum; @FieldOrder(order = 1) @@ -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..e9e0414 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 @@ -42,7 +42,7 @@ public class IncludedOpenTicketType extends Object { } @FieldOrder(order = 0) - @IntRange(minValue=1,maxValue=32000) + @IntRange(minValue=0,maxValue=32000) @Asn1Optional public Long productOwnerNum; @FieldOrder(order = 1) @@ -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 { public SequenceOfActivatedDays(List 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 { public SequenceOfCarrierNum(List numbers) { super(); for (Long number: numbers){ - this.add(new Long(number)); + this.add(Long.valueOf(number)); } } public static SequenceOfCarrierNum getSequence(List 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 { public SequenceOfCountries(List 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 { public SequenceOfPlaceNum(List 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 { public SequenceOfServiceBrands(List 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 { public SequenceOfTransportTypes(List 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 { public SequenceOfTravelerId(List 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); } /** -- cgit v1.2.3