diff options
author | Karsten <karsten.budaeus@sbb.ch> | 2024-10-22 13:20:42 +0200 |
---|---|---|
committer | Karsten <karsten.budaeus@sbb.ch> | 2024-10-22 13:20:42 +0200 |
commit | a2f4bf1c6e2b5eea946d65acb208f7e7848f6015 (patch) | |
tree | 6a9c9e4a3ecc4772aa85ae11f91d685293834e4b /src/main/java/org/uic/barcode/ticket | |
parent | Update pom version to 1.4.8. to match latest release tag 1.4.8. (diff) | |
download | UIC-barcode-a2f4bf1c6e2b5eea946d65acb208f7e7848f6015.tar UIC-barcode-a2f4bf1c6e2b5eea946d65acb208f7e7848f6015.tar.gz UIC-barcode-a2f4bf1c6e2b5eea946d65acb208f7e7848f6015.tar.bz2 UIC-barcode-a2f4bf1c6e2b5eea946d65acb208f7e7848f6015.tar.lz UIC-barcode-a2f4bf1c6e2b5eea946d65acb208f7e7848f6015.tar.xz UIC-barcode-a2f4bf1c6e2b5eea946d65acb208f7e7848f6015.tar.zst UIC-barcode-a2f4bf1c6e2b5eea946d65acb208f7e7848f6015.zip |
Diffstat (limited to 'src/main/java/org/uic/barcode/ticket')
6 files changed, 74 insertions, 77 deletions
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/package.html b/src/main/java/org/uic/barcode/ticket/api/asn/package.html index 214572b..4d59caa 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/package.html +++ b/src/main/java/org/uic/barcode/ticket/api/asn/package.html @@ -1,9 +1,9 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
+<html lang="en">
<head>asn
</head>
<body>Provides code generated from the asn.1 specification using
- the openAsn compiler to implement the asn.1 encoduing and decoding
+ the openAsn compiler to implement the asn.1 encoding and decoding
using unaligned PER encoding.
</body>
</html>
\ No newline at end of file diff --git a/src/main/java/org/uic/barcode/ticket/api/impl/package.html b/src/main/java/org/uic/barcode/ticket/api/impl/package.html index f2ef54e..9c0cffe 100644 --- a/src/main/java/org/uic/barcode/ticket/api/impl/package.html +++ b/src/main/java/org/uic/barcode/ticket/api/impl/package.html @@ -1,5 +1,5 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
+<html lang="en">
<head>Ticket Data Implementation
</head>
<body>
diff --git a/src/main/java/org/uic/barcode/ticket/api/spec/package.html b/src/main/java/org/uic/barcode/ticket/api/spec/package.html index f3961b8..7105cd9 100644 --- a/src/main/java/org/uic/barcode/ticket/api/spec/package.html +++ b/src/main/java/org/uic/barcode/ticket/api/spec/package.html @@ -1,13 +1,12 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
+<html lang="en">
<head>UIC ticket interface
</head>
<body>
Provides the interface specification of the ticket data. Any ticket
data implementation which wants to use the provided encoder / decoder
function must implement this interface. A simple implementation is
- provided in package
- <b>impl
- </p>.
+ provided in the package
+ <b>impl</b>.
</body>
</html>
\ No newline at end of file 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 615f646..da8092b 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 @@ -69,8 +69,10 @@ import org.uic.barcode.ticket.api.asn.omv1.SequenceOfRegisteredLuggageType; import org.uic.barcode.ticket.api.asn.omv1.SequenceOfServiceBrands;
import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTariffType;
import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTicketLinkType;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTimeRangeType;
import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerId;
import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfValidityPeriodType;
import org.uic.barcode.ticket.api.asn.omv1.SequenceOfViaStationType;
import org.uic.barcode.ticket.api.asn.omv1.SeriesDetailType;
import org.uic.barcode.ticket.api.asn.omv1.ServiceType;
@@ -92,8 +94,6 @@ import org.uic.barcode.ticket.api.asn.omv1.VatDetailType; import org.uic.barcode.ticket.api.asn.omv1.ViaStationType;
import org.uic.barcode.ticket.api.asn.omv1.VoucherData;
import org.uic.barcode.ticket.api.asn.omv1.ZoneType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfValidityPeriodType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTimeRangeType;
import org.uic.barcode.ticket.api.spec.IBerth;
import org.uic.barcode.ticket.api.spec.ICarCarriageReservation;
import org.uic.barcode.ticket.api.spec.ICardReference;
@@ -745,7 +745,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { }
- if (document.getTariffs() != null && document.getTariffs().size() > 0){
+ if (document.getTariffs() != null && !document.getTariffs().isEmpty()){
asnData.setTariffs(encodeTariffCollection(document.getTariffs()));
}
@@ -753,7 +753,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { asnData.setClassCode(convertTravelClass(document.getClassCode()));
}
- if (document.getServiceLevel() != null && document.getServiceLevel().length() > 0) {
+ if (document.getServiceLevel() != null && !document.getServiceLevel().isEmpty()) {
asnData.setServiceLevel(document.getServiceLevel());
}
@@ -765,7 +765,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { asnData.setIssuerAutorizationId(Long.valueOf(document.getAuthorizationCode()));
}
- if (document.getValidRegionList()!= null && document.getValidRegionList().size() > 0) {
+ if (document.getValidRegionList()!= null && !document.getValidRegionList().isEmpty()) {
asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
}
@@ -795,11 +795,11 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { asnData.setFromStationNameUTF8(route.getFromStationName());
asnData.setToStationNameUTF8(route.getToStationName());
- if (route.getValidRegionList()!= null && route.getValidRegionList().size() > 0) {
+ if (route.getValidRegionList()!= null && !route.getValidRegionList().isEmpty()) {
asnData.setValidReturnRegion(encodeRegionCollection(route.getValidRegionList(), issuingDate));
}
- if (route.getValidRegionDesc() != null && route.getValidRegionDesc().length() > 0){
+ if (route.getValidRegionDesc() != null && !route.getValidRegionDesc().isEmpty()){
asnData.setValidReturnRegionDesc(route.getValidRegionDesc());
}
@@ -823,7 +823,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { asnData.setMaxNonHandLuggagePieces(UicEncoderUtils.getRestrictedIntWithDefault(luggageRestriction.getMaxNonHandLuggagePieces(),1,99,1));
- if (luggageRestriction.getRegisteredLuggage() != null && luggageRestriction.getRegisteredLuggage().size() > 0) {
+ if (luggageRestriction.getRegisteredLuggage() != null && !luggageRestriction.getRegisteredLuggage().isEmpty()) {
asnData.setRegisteredLuggage(encodeRegisteredLuggage(luggageRestriction.getRegisteredLuggage()));
}
@@ -931,7 +931,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { asnData.setClassCode(convertTravelClass(document.getClassCode()));
}
- if (document.getServiceLevel() != null && document.getServiceLevel().length() > 0) {
+ if (document.getServiceLevel() != null && !document.getServiceLevel().isEmpty()) {
asnData.setServiceLevel(document.getServiceLevel());
}
@@ -943,12 +943,12 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { asnData.setIssuerAutorizationId(Long.valueOf(document.getAuthorizationCode()));
}
- if (document.getValidRegionList() != null && document.getValidRegionList().size() > 0) {
+ if (document.getValidRegionList() != null && !document.getValidRegionList().isEmpty()) {
asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
}
asnData.setValidRegionDesc(document.getValidRegionDesc());
- if (document.getIncludedAddOns() != null && document.getIncludedAddOns().size() > 0) {
+ if (document.getIncludedAddOns() != null && !document.getIncludedAddOns().isEmpty()) {
asnData.setIncludedAddOns(encodeIncludedAddons(document.getIncludedAddOns(),issuingDate, document.getClassCode()));
}
@@ -1060,7 +1060,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,32000)));
asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,32000)));
- if (document.getValidRegionList() != null && document.getValidRegionList().size() > 0) {
+ if (document.getValidRegionList() != null && !document.getValidRegionList().isEmpty()) {
asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
}
asnData.setValidRegionDesc(document.getValidRegionDesc());
@@ -1188,7 +1188,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { asnData.setCity(Asn1BigInteger.toAsn1(data.getCity()));
}
- if (data.getNUTScode() != null && data.getNUTScode().length() > 0) {
+ if (data.getNUTScode() != null && !data.getNUTScode().isEmpty()) {
asnData.setNutsCode(data.getNUTScode());
}
@@ -1236,7 +1236,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { * @return the polygone type
* @throws EncodingFormatException the encoding format exception
*/
- private PolygoneType encodePolygone(IPolygone data) throws EncodingFormatException {
+ private PolygoneType encodePolygone(IPolygone data) {
if (data == null) return null;
if (data.getEdges() == null || data.getEdges().isEmpty()) {
return null;
@@ -1638,7 +1638,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { asnData.setClassCode(convertTravelClass(document.getClassCode()));
- if (document.getCountries() != null && document.getCountries().size() > 0){
+ if (document.getCountries() != null && !document.getCountries().isEmpty()){
asnData.setCountries(SequenceOfCountries.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getCountries(),1,250)));
}
@@ -1657,7 +1657,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { - if(document.getValidRegionList()!= null && document.getValidRegionList().size() > 0) {
+ if(document.getValidRegionList()!= null && !document.getValidRegionList().isEmpty()) {
asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
}
@@ -1680,7 +1680,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { }
- private ValidityPeriodDetailType encodeValidityDetails( IValidityDetails validityDetails, Date referenceDate) throws EncodingFormatException {
+ private ValidityPeriodDetailType encodeValidityDetails(IValidityDetails validityDetails, Date referenceDate) {
if ( (validityDetails.getTimeRanges() == null || validityDetails.getTimeRanges().isEmpty())
||
@@ -1828,7 +1828,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { for (String station : document.getStations()) {
String ia5 = UicEncoderUtils.getIA5NonNum(station);
Long num = UicEncoderUtils.getNum(station);
- if (ia5 != null && ia5.length() > 0) {
+ if (ia5 != null && !ia5.isEmpty()) {
stationsIA5.add(ia5);
}
if (num != null && num > 0){
@@ -1847,7 +1847,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { SequenceOfStringUTF8 asnList = new SequenceOfStringUTF8();
for ( String text :document.getStationNames()){
- if (text.length() > 0) {
+ if (!text.isEmpty()) {
asnList.add(text);
}
}
@@ -1963,7 +1963,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { CardReferenceType asnCard = new CardReferenceType();
- if (card.getCardId() != null && card.getCardId().length() > 0){
+ if (card.getCardId() != null && !card.getCardId().isEmpty()){
//only longs allowed
try {
long num = Long.parseLong(card.getCardId());
@@ -2100,7 +2100,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { private IssuingData encodeIssuingDetails(IIssuingDetail data) throws EncodingFormatException {
if (data == null){
- throw new EncodingFormatException("Issuind data missing");
+ throw new EncodingFormatException("Issuing data missing");
}
IssuingData asnData = new IssuingData();
@@ -2218,7 +2218,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { asnDocument.getTicket().setCustomerCard(asnData);
- if (document.getCardId() != null && document.getCardId().length() > 0){
+ if (document.getCardId() != null && !document.getCardId().isEmpty()){
//only longs allowed
try {
long num = Long.parseLong(document.getCardId());
@@ -2375,7 +2375,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder { throw new EncodingFormatException("Extension does not include data");
}
- if (extension.getId() == null || extension.getId().length() == 0) {
+ if (extension.getId() == null || extension.getId().isEmpty()) {
throw new EncodingFormatException("Extension does not include id");
}
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 0656d49..41a70a0 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 @@ -18,6 +18,7 @@ import org.uic.barcode.ticket.api.asn.omv2.CardReferenceType; import org.uic.barcode.ticket.api.asn.omv2.CodeTableType;
import org.uic.barcode.ticket.api.asn.omv2.CompartmentDetailsType;
import org.uic.barcode.ticket.api.asn.omv2.CompartmentGenderType;
+import org.uic.barcode.ticket.api.asn.omv2.CompartmentPositionType;
import org.uic.barcode.ticket.api.asn.omv2.ConfirmationTypeType;
import org.uic.barcode.ticket.api.asn.omv2.ControlData;
import org.uic.barcode.ticket.api.asn.omv2.CountermarkData;
@@ -94,7 +95,6 @@ import org.uic.barcode.ticket.api.asn.omv2.VatDetailType; import org.uic.barcode.ticket.api.asn.omv2.ViaStationType;
import org.uic.barcode.ticket.api.asn.omv2.VoucherData;
import org.uic.barcode.ticket.api.asn.omv2.ZoneType;
-import org.uic.barcode.ticket.api.asn.omv2.CompartmentPositionType;
import org.uic.barcode.ticket.api.spec.IBerth;
import org.uic.barcode.ticket.api.spec.ICarCarriageReservation;
import org.uic.barcode.ticket.api.spec.ICardReference;
@@ -745,7 +745,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { }
- if (document.getTariffs() != null && document.getTariffs().size() > 0){
+ if (document.getTariffs() != null && !document.getTariffs().isEmpty()){
asnData.setTariffs(encodeTariffCollection(document.getTariffs()));
}
@@ -753,7 +753,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { asnData.setClassCode(TravelClassType.valueOf(document.getClassCode().name()));
}
- if (document.getServiceLevel() != null && document.getServiceLevel().length() > 0) {
+ if (document.getServiceLevel() != null && !document.getServiceLevel().isEmpty()) {
asnData.setServiceLevel(document.getServiceLevel());
}
@@ -765,7 +765,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { asnData.setIssuerAutorizationId(Long.valueOf(document.getAuthorizationCode()));
}
- if (document.getValidRegionList()!= null && document.getValidRegionList().size() > 0) {
+ if (document.getValidRegionList()!= null && !document.getValidRegionList().isEmpty()) {
asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
}
@@ -795,11 +795,11 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { asnData.setFromStationNameUTF8(route.getFromStationName());
asnData.setToStationNameUTF8(route.getToStationName());
- if (route.getValidRegionList()!= null && route.getValidRegionList().size() > 0) {
+ if (route.getValidRegionList()!= null && !route.getValidRegionList().isEmpty()) {
asnData.setValidReturnRegion(encodeRegionCollection(route.getValidRegionList(), issuingDate));
}
- if (route.getValidRegionDesc() != null && route.getValidRegionDesc().length() > 0){
+ if (route.getValidRegionDesc() != null && !route.getValidRegionDesc().isEmpty()){
asnData.setValidReturnRegionDesc(route.getValidRegionDesc());
}
@@ -823,7 +823,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { asnData.setMaxNonHandLuggagePieces(UicEncoderUtils.getRestrictedIntWithDefault(luggageRestriction.getMaxNonHandLuggagePieces(),1,99,1));
- if (luggageRestriction.getRegisteredLuggage() != null && luggageRestriction.getRegisteredLuggage().size() > 0) {
+ if (luggageRestriction.getRegisteredLuggage() != null && !luggageRestriction.getRegisteredLuggage().isEmpty()) {
asnData.setRegisteredLuggage(encodeRegisteredLuggage(luggageRestriction.getRegisteredLuggage()));
}
@@ -933,7 +933,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { asnData.setClassCode(TravelClassType.valueOf(document.getClassCode().name()));
}
- if (document.getServiceLevel() != null && document.getServiceLevel().length() > 0) {
+ if (document.getServiceLevel() != null && !document.getServiceLevel().isEmpty()) {
asnData.setServiceLevel(document.getServiceLevel());
}
@@ -945,12 +945,12 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { asnData.setIssuerAutorizationId(Long.valueOf(document.getAuthorizationCode()));
}
- if (document.getValidRegionList() != null && document.getValidRegionList().size() > 0) {
+ if (document.getValidRegionList() != null && !document.getValidRegionList().isEmpty()) {
asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
}
asnData.setValidRegionDesc(document.getValidRegionDesc());
- if (document.getIncludedAddOns() != null && document.getIncludedAddOns().size() > 0) {
+ if (document.getIncludedAddOns() != null && !document.getIncludedAddOns().isEmpty()) {
asnData.setIncludedAddOns(encodeIncludedAddons(document.getIncludedAddOns(),issuingDate, document.getClassCode()));
}
@@ -1061,7 +1061,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,32000)));
asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,32000)));
- if (document.getValidRegionList() != null && document.getValidRegionList().size() > 0) {
+ if (document.getValidRegionList() != null && !document.getValidRegionList().isEmpty()) {
asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
}
asnData.setValidRegionDesc(document.getValidRegionDesc());
@@ -1189,7 +1189,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { asnData.setCity(Asn1BigInteger.toAsn1(document.getCity()));
}
- if (document.getNUTScode() != null && document.getNUTScode().length() > 0) {
+ if (document.getNUTScode() != null && !document.getNUTScode().isEmpty()) {
asnData.setNutsCode(document.getNUTScode());
}
@@ -1235,9 +1235,8 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { *
* @param data the data
* @return the polygone type
- * @throws EncodingFormatException the encoding format exception
*/
- private PolygoneType encodePolygone(IPolygone data) throws EncodingFormatException {
+ private PolygoneType encodePolygone(IPolygone data) {
if (data == null) return null;
if (data.getEdges() == null || data.getEdges().isEmpty()) {
return null;
@@ -1642,7 +1641,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { if (document.getClassCode() != null) {
asnData.setClassCode(TravelClassType.valueOf(document.getClassCode().name()));
}
- if (document.getCountries() != null && document.getCountries().size() > 0){
+ if (document.getCountries() != null && !document.getCountries().isEmpty()){
asnData.setCountries(SequenceOfCountries.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getCountries(),1,250)));
}
@@ -1661,7 +1660,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { - if(document.getValidRegionList()!= null && document.getValidRegionList().size() > 0) {
+ if(document.getValidRegionList()!= null && !document.getValidRegionList().isEmpty()) {
asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
}
@@ -1684,7 +1683,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { }
- private ValidityPeriodDetailType encodeValidityDetails( IValidityDetails validityDetails, Date referenceDate) throws EncodingFormatException {
+ private ValidityPeriodDetailType encodeValidityDetails(IValidityDetails validityDetails, Date referenceDate) {
if ( (validityDetails.getTimeRanges() == null || validityDetails.getTimeRanges().isEmpty())
||
@@ -1832,7 +1831,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { for (String station : document.getStations()) {
String ia5 = UicEncoderUtils.getIA5NonNum(station);
Long num = UicEncoderUtils.getNum(station);
- if (ia5 != null && ia5.length() > 0) {
+ if (ia5 != null && !ia5.isEmpty()) {
stationsIA5.add(ia5);
}
if (num != null && num > 0){
@@ -1851,7 +1850,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { SequenceOfStringUTF8 asnList = new SequenceOfStringUTF8();
for ( String text :document.getStationNames()){
- if (text.length() > 0) {
+ if (!text.isEmpty()) {
asnList.add(text);
}
}
@@ -1967,7 +1966,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { CardReferenceType asnCard = new CardReferenceType();
- if (card.getCardId() != null && card.getCardId().length() > 0){
+ if (card.getCardId() != null && !card.getCardId().isEmpty()){
//only longs allowed
try {
long num = Long.parseLong(card.getCardId());
@@ -2104,7 +2103,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { private IssuingData encodeIssuingDetails(IIssuingDetail data) throws EncodingFormatException {
if (data == null){
- throw new EncodingFormatException("Issuind data missing");
+ throw new EncodingFormatException("Issuing data missing");
}
IssuingData asnData = new IssuingData();
@@ -2220,7 +2219,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { asnDocument.getTicket().setCustomerCard(asnCustomerCard);
- if (document.getCardId() != null && document.getCardId().length() > 0){
+ if (document.getCardId() != null && !document.getCardId().isEmpty()){
//only longs allowed
try {
long num = Long.parseLong(document.getCardId());
@@ -2381,7 +2380,7 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder { throw new EncodingFormatException("Extension does not include data");
}
- if (extension.getId() == null || extension.getId().length() == 0) {
+ if (extension.getId() == null || extension.getId().isEmpty()) {
throw new EncodingFormatException("Extension does not include id");
}
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 d97e7b7..3224336 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 @@ -11,7 +11,6 @@ import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5; import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8;
import org.uic.barcode.asn1.datatypesimpl.SequenceOfUnrestrictedLong;
import org.uic.barcode.ticket.EncodingFormatException;
-import org.uic.barcode.ticket.api.asn.omv3.CompartmentPositionType;
import org.uic.barcode.ticket.api.asn.omv3.BerthDetailData;
import org.uic.barcode.ticket.api.asn.omv3.BerthTypeType;
import org.uic.barcode.ticket.api.asn.omv3.BoardingOrArrivalType;
@@ -20,6 +19,7 @@ import org.uic.barcode.ticket.api.asn.omv3.CardReferenceType; import org.uic.barcode.ticket.api.asn.omv3.CodeTableType;
import org.uic.barcode.ticket.api.asn.omv3.CompartmentDetailsType;
import org.uic.barcode.ticket.api.asn.omv3.CompartmentGenderType;
+import org.uic.barcode.ticket.api.asn.omv3.CompartmentPositionType;
import org.uic.barcode.ticket.api.asn.omv3.ConfirmationTypeType;
import org.uic.barcode.ticket.api.asn.omv3.ControlData;
import org.uic.barcode.ticket.api.asn.omv3.CountermarkData;
@@ -749,7 +749,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { }
- if (document.getTariffs() != null && document.getTariffs().size() > 0){
+ if (document.getTariffs() != null && !document.getTariffs().isEmpty()){
asnData.setTariffs(encodeTariffCollection(document.getTariffs()));
}
@@ -757,7 +757,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { asnData.setClassCode(TravelClassType.valueOf(document.getClassCode().name()));
}
- if (document.getServiceLevel() != null && document.getServiceLevel().length() > 0) {
+ if (document.getServiceLevel() != null && !document.getServiceLevel().isEmpty()) {
asnData.setServiceLevel(document.getServiceLevel());
}
@@ -769,7 +769,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { asnData.setIssuerAutorizationId(Long.valueOf(document.getAuthorizationCode()));
}
- if (document.getValidRegionList()!= null && document.getValidRegionList().size() > 0) {
+ if (document.getValidRegionList()!= null && !document.getValidRegionList().isEmpty()) {
asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
}
@@ -801,11 +801,11 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { asnData.setFromStationNameUTF8(route.getFromStationName());
asnData.setToStationNameUTF8(route.getToStationName());
- if (route.getValidRegionList()!= null && route.getValidRegionList().size() > 0) {
+ if (route.getValidRegionList()!= null && !route.getValidRegionList().isEmpty()) {
asnData.setValidReturnRegion(encodeRegionCollection(route.getValidRegionList(), issuingDate));
}
- if (route.getValidRegionDesc() != null && route.getValidRegionDesc().length() > 0){
+ if (route.getValidRegionDesc() != null && !route.getValidRegionDesc().isEmpty()){
asnData.setValidReturnRegionDesc(route.getValidRegionDesc());
}
@@ -829,7 +829,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { asnData.setMaxNonHandLuggagePieces(UicEncoderUtils.getRestrictedIntWithDefault(luggageRestriction.getMaxNonHandLuggagePieces(),1,99,1));
- if (luggageRestriction.getRegisteredLuggage() != null && luggageRestriction.getRegisteredLuggage().size() > 0) {
+ if (luggageRestriction.getRegisteredLuggage() != null && !luggageRestriction.getRegisteredLuggage().isEmpty()) {
asnData.setRegisteredLuggage(encodeRegisteredLuggage(luggageRestriction.getRegisteredLuggage()));
}
@@ -940,7 +940,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { asnData.setClassCode(TravelClassType.valueOf(document.getClassCode().name()));
}
- if (document.getServiceLevel() != null && document.getServiceLevel().length() > 0) {
+ if (document.getServiceLevel() != null && !document.getServiceLevel().isEmpty()) {
asnData.setServiceLevel(document.getServiceLevel());
}
@@ -952,12 +952,12 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { asnData.setIssuerAutorizationId(Long.valueOf(document.getAuthorizationCode()));
}
- if (document.getValidRegionList() != null && document.getValidRegionList().size() > 0) {
+ if (document.getValidRegionList() != null && !document.getValidRegionList().isEmpty()) {
asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
}
asnData.setValidRegionDesc(document.getValidRegionDesc());
- if (document.getIncludedAddOns() != null && document.getIncludedAddOns().size() > 0) {
+ if (document.getIncludedAddOns() != null && !document.getIncludedAddOns().isEmpty()) {
asnData.setIncludedAddOns(encodeIncludedAddons(document.getIncludedAddOns(),issuingDate, document.getClassCode()));
}
@@ -1070,7 +1070,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { asnData.setExcludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getExcludedServiceBrands(),1,32000)));
asnData.setIncludedServiceBrands(SequenceOfServiceBrands.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getIncludedServiceBrands(),1,32000)));
- if (document.getValidRegionList() != null && document.getValidRegionList().size() > 0) {
+ if (document.getValidRegionList() != null && !document.getValidRegionList().isEmpty()) {
asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
}
asnData.setValidRegionDesc(document.getValidRegionDesc());
@@ -1201,7 +1201,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { asnData.setCity(Asn1BigInteger.toAsn1(document.getCity()));
}
- if (document.getNUTScode() != null && document.getNUTScode().length() > 0) {
+ if (document.getNUTScode() != null && !document.getNUTScode().isEmpty()) {
asnData.setNutsCode(document.getNUTScode());
}
@@ -1247,9 +1247,8 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { *
* @param data the data
* @return the polygone type
- * @throws EncodingFormatException the encoding format exception
- */
- private PolygoneType encodePolygone(IPolygone data) throws EncodingFormatException {
+ */
+ private PolygoneType encodePolygone(IPolygone data) {
if (data == null) return null;
if (data.getEdges() == null || data.getEdges().isEmpty()) {
return null;
@@ -1651,7 +1650,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { if (document.getClassCode() != null) {
asnData.setClassCode(TravelClassType.valueOf(document.getClassCode().name()));
}
- if (document.getCountries() != null && document.getCountries().size() > 0){
+ if (document.getCountries() != null && !document.getCountries().isEmpty()){
asnData.setCountries(SequenceOfCountries.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getCountries(),1,250)));
}
@@ -1670,7 +1669,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { - if(document.getValidRegionList()!= null && document.getValidRegionList().size() > 0) {
+ if(document.getValidRegionList()!= null && !document.getValidRegionList().isEmpty()) {
asnData.setValidRegion(encodeRegionCollection(document.getValidRegionList(), issuingDate));
}
@@ -1729,7 +1728,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { }
- private ValidityPeriodDetailType encodeValidityDetails( IValidityDetails validityDetails, Date referenceDate) throws EncodingFormatException {
+ private ValidityPeriodDetailType encodeValidityDetails(IValidityDetails validityDetails, Date referenceDate) {
if ( (validityDetails.getTimeRanges() == null || validityDetails.getTimeRanges().isEmpty())
||
@@ -1877,7 +1876,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { for (String station : document.getStations()) {
String ia5 = UicEncoderUtils.getIA5NonNum(station);
Long num = UicEncoderUtils.getNum(station);
- if (ia5 != null && ia5.length() > 0) {
+ if (ia5 != null && !ia5.isEmpty()) {
stationsIA5.add(ia5);
}
if (num != null && num > 0){
@@ -1896,7 +1895,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { SequenceOfStringUTF8 asnList = new SequenceOfStringUTF8();
for ( String text :document.getStationNames()){
- if (text.length() > 0) {
+ if (!text.isEmpty()) {
asnList.add(text);
}
}
@@ -2012,7 +2011,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { CardReferenceType asnCard = new CardReferenceType();
- if (card.getCardId() != null && card.getCardId().length() > 0){
+ if (card.getCardId() != null && !card.getCardId().isEmpty()){
//only longs allowed
try {
long num = Long.parseLong(card.getCardId());
@@ -2150,7 +2149,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { private IssuingData encodeIssuingDetails(IIssuingDetail data) throws EncodingFormatException {
if (data == null){
- throw new EncodingFormatException("Issuind data missing");
+ throw new EncodingFormatException("Issuing data missing");
}
IssuingData asnData = new IssuingData();
@@ -2266,7 +2265,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { asnDocument.getTicket().setCustomerCard(asnCustomerCard);
- if (document.getCardId() != null && document.getCardId().length() > 0){
+ if (document.getCardId() != null && !document.getCardId().isEmpty()){
//only longs allowed
try {
long num = Long.parseLong(document.getCardId());
@@ -2425,7 +2424,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder { throw new EncodingFormatException("Extension does not include data");
}
- if (extension.getId() == null || extension.getId().length() == 0) {
+ if (extension.getId() == null || extension.getId().isEmpty()) {
throw new EncodingFormatException("Extension does not include id");
}
|