diff options
Diffstat (limited to 'src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java')
-rw-r--r-- | src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java | 45 |
1 files changed, 22 insertions, 23 deletions
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");
}
|