diff options
Diffstat (limited to 'src/org')
51 files changed, 761 insertions, 772 deletions
diff --git a/src/org/uic/ticket/api/EncodingFormatException.java b/src/org/uic/ticket/EncodingFormatException.java index 2d80598..e6651ba 100644 --- a/src/org/uic/ticket/api/EncodingFormatException.java +++ b/src/org/uic/ticket/EncodingFormatException.java @@ -1,7 +1,7 @@ /*
*
*/
-package org.uic.ticket.api;
+package org.uic.ticket;
/**
diff --git a/src/org/uic/ticket/api/UicRailTicketCoder.java b/src/org/uic/ticket/UicRailTicketCoder.java index 0221526..82a546f 100644 --- a/src/org/uic/ticket/api/UicRailTicketCoder.java +++ b/src/org/uic/ticket/UicRailTicketCoder.java @@ -1,16 +1,18 @@ /*
*
*/
-package org.uic.ticket.api;
+package org.uic.ticket;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import org.uic.ticket.api.asn.omv1.UicRailTicketData;
+
import org.uic.ticket.api.spec.IUicRailTicket;
import org.uic.ticket.api.utils.Api2OpenAsnEncoder;
+import org.uic.ticket.api.utils.Api2OpenAsnEncoderV2;
import org.uic.ticket.api.utils.OpenAsn2ApiDecoder;
+import org.uic.ticket.api.utils.OpenAsn2ApiDecoderV2;
/**
@@ -69,16 +71,25 @@ public class UicRailTicketCoder { * @throws EncodingFormatException signals that a format rule of the asn.1 specification was violated.
*/
public byte[] encode (IUicRailTicket uicRailTicket, int version) throws IOException, EncodingFormatException{
+
+
+ if (version == 1) {
+
+ Api2OpenAsnEncoder uicEncoder = new Api2OpenAsnEncoder();
+
+ return uicEncoder.encode(uicRailTicket);
+
+
+ } else if (version == 2) {
+
+ Api2OpenAsnEncoderV2 uicEncoder = new Api2OpenAsnEncoderV2();
+
+ return uicEncoder.encode(uicRailTicket);
- if (version != 1) {
- throw new EncodingFormatException(String.format("Encoding version %d not supported", version));
}
- Api2OpenAsnEncoder uicEncoder = new Api2OpenAsnEncoder();
-
- UicRailTicketData asnUicRailTicketData = uicEncoder.populateToAsn1Model(uicRailTicket);
-
- return asnUicRailTicketData.encode();
+ throw new EncodingFormatException(String.format("Encoding version %d not supported", version));
+
}
@@ -94,17 +105,32 @@ public class UicRailTicketCoder { */
public void encode ( ByteArrayOutputStream outputStream, IUicRailTicket uicRailTicket, int version) throws IOException, EncodingFormatException{
- if (version != 1) {
- throw new EncodingFormatException(String.format("Encoding version %d not supported", version));
- }
+
- Api2OpenAsnEncoder uicEncoder = new Api2OpenAsnEncoder();
+ if (version == 1) {
- UicRailTicketData asnUicRailTicketData = uicEncoder.populateToAsn1Model(uicRailTicket);
+ Api2OpenAsnEncoder uicEncoder = new Api2OpenAsnEncoder();
- outputStream.write(asnUicRailTicketData.encode());
+ org.uic.ticket.api.asn.omv1.UicRailTicketData asnUicRailTicketData = uicEncoder.populateToAsn1Model(uicRailTicket);
- return;
+ outputStream.write(asnUicRailTicketData.encode());
+
+ return;
+
+
+ } else if (version == 2) {
+
+ Api2OpenAsnEncoderV2 uicEncoder = new Api2OpenAsnEncoderV2();
+
+ org.uic.ticket.api.asn.omv2.UicRailTicketData asnUicRailTicketData = uicEncoder.populateToAsn1Model(uicRailTicket);
+
+ outputStream.write(asnUicRailTicketData.encode());
+
+ return;
+
+ }
+
+ throw new EncodingFormatException(String.format("Encoding version %d not supported", version));
}
@@ -118,17 +144,25 @@ public class UicRailTicketCoder { */
public IUicRailTicket decodeFromAsn (byte[] byteData, int version) throws IOException, EncodingFormatException{
- if (version != 1) {
- throw new EncodingFormatException(String.format("Encoding version %d not supported", version));
- }
-
- UicRailTicketData asnUicRailTicketData = UicRailTicketData.decode(byteData);
+ if (version == 1) {
+
+ OpenAsn2ApiDecoder uicDecoder = new OpenAsn2ApiDecoder();
+
+ IUicRailTicket uicRailTicket = uicDecoder.decodeFromAsn(byteData);
+
+ return uicRailTicket;
- OpenAsn2ApiDecoder uicDecoder = new OpenAsn2ApiDecoder();
+ } else if (version == 2) {
- IUicRailTicket uicRailTicket = uicDecoder.decodeFromAsn(asnUicRailTicketData);
+ OpenAsn2ApiDecoderV2 uicDecoder = new OpenAsn2ApiDecoderV2();
+
+ IUicRailTicket uicRailTicket = uicDecoder.decodeFromAsn(byteData);
+
+ return uicRailTicket;
+
+ }
- return uicRailTicket;
+ throw new EncodingFormatException(String.format("Encoding version %d not supported", version));
}
diff --git a/src/org/uic/ticket/api/UnsuportedFeatureException.java b/src/org/uic/ticket/UnsuportedFeatureException.java index ba5abae..e98c3da 100644 --- a/src/org/uic/ticket/api/UnsuportedFeatureException.java +++ b/src/org/uic/ticket/UnsuportedFeatureException.java @@ -1,7 +1,7 @@ /*
*
*/
-package org.uic.ticket.api;
+package org.uic.ticket;
/**
* The Class EncodingFormatException.
diff --git a/src/org/uic/ticket/api/impl/SimpleBerth.java b/src/org/uic/ticket/api/impl/SimpleBerth.java index 7bae1d3..f70a8b6 100644 --- a/src/org/uic/ticket/api/impl/SimpleBerth.java +++ b/src/org/uic/ticket/api/impl/SimpleBerth.java @@ -3,11 +3,10 @@ */
package org.uic.ticket.api.impl;
-import org.uic.ticket.api.asn.omv1.BerthTypeType;
-import org.uic.ticket.api.asn.omv1.CompartmentGenderType;
+import org.uic.ticket.api.spec.IBerthTypeType;
+import org.uic.ticket.api.spec.ICompartmentGenderType;
import org.uic.ticket.api.spec.IBerth;
-// TODO: Auto-generated Javadoc
/**
* The Class SimpleBerth.
*/
@@ -15,25 +14,25 @@ public class SimpleBerth implements IBerth { /** The type. */
- protected BerthTypeType type;
+ protected IBerthTypeType type;
/** The number of berths. */
protected int numberOfBerths;
/** The gender. */
- protected CompartmentGenderType gender = CompartmentGenderType.family;
+ protected ICompartmentGenderType gender = ICompartmentGenderType.family;
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IBerth#getType()
*/
- public BerthTypeType getType() {
+ public IBerthTypeType getType() {
return type;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IBerth#setType(org.uic.ticket.api.asn.om.BerthTypeType)
*/
- public void setType(BerthTypeType type) {
+ public void setType(IBerthTypeType type) {
this.type = type;
}
@@ -54,14 +53,14 @@ public class SimpleBerth implements IBerth { /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IBerth#getGender()
*/
- public CompartmentGenderType getGender() {
+ public ICompartmentGenderType getGender() {
return gender;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IBerth#setGender(org.uic.ticket.api.asn.om.CompartmentGenderType)
*/
- public void setGender(CompartmentGenderType gender) {
+ public void setGender(ICompartmentGenderType gender) {
this.gender = gender;
}
diff --git a/src/org/uic/ticket/api/impl/SimpleCarCarriageReservation.java b/src/org/uic/ticket/api/impl/SimpleCarCarriageReservation.java index 9fff600..a0f84cd 100644 --- a/src/org/uic/ticket/api/impl/SimpleCarCarriageReservation.java +++ b/src/org/uic/ticket/api/impl/SimpleCarCarriageReservation.java @@ -7,18 +7,18 @@ import java.util.Collection; import java.util.Date;
import java.util.LinkedHashSet;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
-import org.uic.ticket.api.asn.omv1.LoadingDeckType;
-import org.uic.ticket.api.asn.omv1.PriceTypeType;
-import org.uic.ticket.api.asn.omv1.RoofRackType;
+
import org.uic.ticket.api.spec.ICarCarriageReservation;
import org.uic.ticket.api.spec.ICompartmentDetails;
import org.uic.ticket.api.spec.IExtension;
import org.uic.ticket.api.spec.IServiceBrand;
import org.uic.ticket.api.spec.ITariff;
import org.uic.ticket.api.spec.IVatDetail;
+import org.uic.ticket.api.spec.ILoadingDeckType;
+import org.uic.ticket.api.spec.IPriceTypeType;
+import org.uic.ticket.api.spec.IRoofRackType;
+import org.uic.ticket.api.spec.IStationCodeTable;
-// TODO: Auto-generated Javadoc
/**
* The Class SimpleCarCarriageReservation.
*/
@@ -42,7 +42,7 @@ public class SimpleCarCarriageReservation extends SimpleDocumentData implements /** The station code table. */
- protected CodeTableType stationCodeTable = CodeTableType.stationUICReservation;
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUICReservation;
/** The from station. */
protected String fromStation;
@@ -91,7 +91,7 @@ public class SimpleCarCarriageReservation extends SimpleDocumentData implements protected boolean textileRoof = false;
/** The roof rack type. */
- protected RoofRackType roofRackType = RoofRackType.norack;
+ protected IRoofRackType roofRackType = IRoofRackType.norack;
/** The roof rack height. */
protected int roofRackHeight;
@@ -116,10 +116,10 @@ public class SimpleCarCarriageReservation extends SimpleDocumentData implements protected int loadingListEntry;
/** The loading deck. */
- protected LoadingDeckType loadingDeck = LoadingDeckType.upper;
+ protected ILoadingDeckType loadingDeck = ILoadingDeckType.upper;
/** The price type. */
- protected PriceTypeType priceType = PriceTypeType.travelPrice;
+ protected IPriceTypeType priceType = IPriceTypeType.travelPrice;
/** The VAT details. */
protected Collection<IVatDetail>vatDetails = new LinkedHashSet<IVatDetail>();
@@ -198,14 +198,14 @@ public class SimpleCarCarriageReservation extends SimpleDocumentData implements /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ICarCarriageReservation#getStationCodeTable()
*/
- public CodeTableType getStationCodeTable() {
+ public IStationCodeTable getStationCodeTable() {
return stationCodeTable;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ICarCarriageReservation#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
*/
- public void setStationCodeTable(CodeTableType stationCodeTable) {
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
this.stationCodeTable = stationCodeTable;
}
@@ -312,14 +312,14 @@ public class SimpleCarCarriageReservation extends SimpleDocumentData implements /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ICarCarriageReservation#getPriceType()
*/
- public PriceTypeType getPriceType() {
+ public IPriceTypeType getPriceType() {
return priceType;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ICarCarriageReservation#setPriceType(org.uic.ticket.api.asn.om.PriceTypeType)
*/
- public void setPriceType(PriceTypeType priceType) {
+ public void setPriceType(IPriceTypeType priceType) {
this.priceType = priceType;
}
@@ -467,14 +467,14 @@ public class SimpleCarCarriageReservation extends SimpleDocumentData implements /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ICarCarriageReservation#getRoofRackType()
*/
- public RoofRackType getRoofRackType() {
+ public IRoofRackType getRoofRackType() {
return roofRackType;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ICarCarriageReservation#setRoofRackType(org.uic.ticket.api.asn.om.RoofRackType)
*/
- public void setRoofRackType(RoofRackType roofRackType) {
+ public void setRoofRackType(IRoofRackType roofRackType) {
this.roofRackType = roofRackType;
}
@@ -579,14 +579,14 @@ public class SimpleCarCarriageReservation extends SimpleDocumentData implements /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ICarCarriageReservation#getLoadingDeck()
*/
- public LoadingDeckType getLoadingDeck() {
+ public ILoadingDeckType getLoadingDeck() {
return loadingDeck;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ICarCarriageReservation#setLoadingDeck(org.uic.ticket.api.asn.om.LoadingDeckType)
*/
- public void setLoadingDeck(LoadingDeckType loadingDeck) {
+ public void setLoadingDeck(ILoadingDeckType loadingDeck) {
this.loadingDeck = loadingDeck;
}
diff --git a/src/org/uic/ticket/api/impl/SimpleCompartmentDetails.java b/src/org/uic/ticket/api/impl/SimpleCompartmentDetails.java index 35a2add..bf59055 100644 --- a/src/org/uic/ticket/api/impl/SimpleCompartmentDetails.java +++ b/src/org/uic/ticket/api/impl/SimpleCompartmentDetails.java @@ -3,10 +3,9 @@ */
package org.uic.ticket.api.impl;
-import org.uic.ticket.api.asn.omv1.CompartmentPositionType;
import org.uic.ticket.api.spec.ICompartmentDetails;
+import org.uic.ticket.api.spec.ICompartmentPositionType;
-// TODO: Auto-generated Javadoc
/**
* The Class SimpleCompartmentDetails.
*/
@@ -32,7 +31,7 @@ public class SimpleCompartmentDetails implements ICompartmentDetails { protected String specialAllocationDescr;
/** The position. */
- protected CompartmentPositionType position = CompartmentPositionType.unspecified;
+ protected ICompartmentPositionType position = ICompartmentPositionType.unspecified;
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ICompartmentDetails#getCoachType()
@@ -121,14 +120,14 @@ public class SimpleCompartmentDetails implements ICompartmentDetails { /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ICompartmentDetails#getPosition()
*/
- public CompartmentPositionType getPosition() {
+ public ICompartmentPositionType getPosition() {
return position;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ICompartmentDetails#setPosition(org.uic.ticket.api.asn.om.CompartmentPositionType)
*/
- public void setPosition(CompartmentPositionType position) {
+ public void setPosition(ICompartmentPositionType position) {
this.position = position;
}
diff --git a/src/org/uic/ticket/api/impl/SimpleCounterMark.java b/src/org/uic/ticket/api/impl/SimpleCounterMark.java index ce0ecd5..219a505 100644 --- a/src/org/uic/ticket/api/impl/SimpleCounterMark.java +++ b/src/org/uic/ticket/api/impl/SimpleCounterMark.java @@ -7,14 +7,14 @@ import java.util.Collection; import java.util.Date;
import java.util.LinkedHashSet;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
-import org.uic.ticket.api.asn.omv1.TravelClassType;
import org.uic.ticket.api.spec.ICounterMark;
import org.uic.ticket.api.spec.IExtension;
import org.uic.ticket.api.spec.IRegionalValidity;
import org.uic.ticket.api.spec.IReturnRouteDescription;
+import org.uic.ticket.api.spec.IStationCodeTable;
+import org.uic.ticket.api.spec.ITravelClassType;
+
-// TODO: Auto-generated Javadoc
/**
* The Class SimpleCounterMark.
*/
@@ -49,7 +49,7 @@ public class SimpleCounterMark extends SimpleDocumentData implements ICounterMar protected boolean returnIncluded = false;
/** The station code table. */
- protected CodeTableType stationCodeTable = CodeTableType.stationUIC;
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUIC;
/** The from station. */
protected String fromStation;
@@ -79,7 +79,7 @@ public class SimpleCounterMark extends SimpleDocumentData implements ICounterMar protected Date validUntil;
/** The class code. */
- protected TravelClassType classCode = TravelClassType.second;
+ protected ITravelClassType classCode = ITravelClassType.second;
/** The included carriers. */
protected Collection<String>includedCarriers = new LinkedHashSet<String>();
@@ -133,14 +133,14 @@ public class SimpleCounterMark extends SimpleDocumentData implements ICounterMar /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ICounterMark#getStationCodeTable()
*/
- public CodeTableType getStationCodeTable() {
+ public IStationCodeTable getStationCodeTable() {
return stationCodeTable;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ICounterMark#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
*/
- public void setStationCodeTable(CodeTableType stationCodeTable) {
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
this.stationCodeTable = stationCodeTable;
}
@@ -273,14 +273,14 @@ public class SimpleCounterMark extends SimpleDocumentData implements ICounterMar /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ICounterMark#getClassCode()
*/
- public TravelClassType getClassCode() {
+ public ITravelClassType getClassCode() {
return classCode;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ICounterMark#setClassCode(org.uic.ticket.api.asn.om.TravelClassType)
*/
- public void setClassCode(TravelClassType classCode) {
+ public void setClassCode(ITravelClassType classCode) {
this.classCode = classCode;
}
diff --git a/src/org/uic/ticket/api/impl/SimpleCustomerCard.java b/src/org/uic/ticket/api/impl/SimpleCustomerCard.java index 9d6db3d..2e948bf 100644 --- a/src/org/uic/ticket/api/impl/SimpleCustomerCard.java +++ b/src/org/uic/ticket/api/impl/SimpleCustomerCard.java @@ -7,10 +7,10 @@ import java.util.Collection; import java.util.Date;
import java.util.LinkedHashSet;
-import org.uic.ticket.api.asn.omv1.TravelClassType;
import org.uic.ticket.api.spec.ICustomerCard;
import org.uic.ticket.api.spec.IExtension;
import org.uic.ticket.api.spec.ITraveler;
+import org.uic.ticket.api.spec.ITravelClassType;
// TODO: Auto-generated Javadoc
/**
@@ -31,7 +31,7 @@ public class SimpleCustomerCard extends SimpleDocumentData implements ICustomer protected Date validUntil;
/** The class code. */
- protected TravelClassType classCode;
+ protected ITravelClassType classCode;
/** The extension. */
protected IExtension extension;
@@ -111,14 +111,14 @@ public class SimpleCustomerCard extends SimpleDocumentData implements ICustomer /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ICustomerCard#getClassCode()
*/
- public TravelClassType getClassCode() {
+ public ITravelClassType getClassCode() {
return classCode;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ICustomerCard#setClassCode(org.uic.ticket.api.asn.om.TravelClassType)
*/
- public void setClassCode(TravelClassType classCode) {
+ public void setClassCode(ITravelClassType classCode) {
this.classCode = classCode;
}
diff --git a/src/org/uic/ticket/api/impl/SimpleDelayConfirmation.java b/src/org/uic/ticket/api/impl/SimpleDelayConfirmation.java index 3171072..9763d15 100644 --- a/src/org/uic/ticket/api/impl/SimpleDelayConfirmation.java +++ b/src/org/uic/ticket/api/impl/SimpleDelayConfirmation.java @@ -4,12 +4,11 @@ import java.util.Collection; import java.util.Date;
import java.util.HashSet;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
import org.uic.ticket.api.spec.IDelayConfirmation;
import org.uic.ticket.api.spec.IExtension;
import org.uic.ticket.api.spec.ITicketLink;
+import org.uic.ticket.api.spec.IStationCodeTable;
-// TODO: Auto-generated Javadoc
/**
* The Class SimpleDelayConfirmation.
*/
@@ -22,7 +21,7 @@ public class SimpleDelayConfirmation extends SimpleDocumentData implements IDel protected String reference;
/** The station code table. */
- protected CodeTableType stationCodeTable = CodeTableType.stationUICReservation;
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUICReservation;
/** The station. */
protected String station;
@@ -94,7 +93,7 @@ public class SimpleDelayConfirmation extends SimpleDocumentData implements IDel * @see org.uic.ticket.api.spec.IDelayConfirmation#getStationCodeTable()
*/
@Override
- public CodeTableType getStationCodeTable() {
+ public IStationCodeTable getStationCodeTable() {
return stationCodeTable;
}
@@ -102,7 +101,7 @@ public class SimpleDelayConfirmation extends SimpleDocumentData implements IDel * @see org.uic.ticket.api.spec.IDelayConfirmation#setStationCodeTable(org.uic.ticket.api.asn.omv1.CodeTableType)
*/
@Override
- public void setStationCodeTable(CodeTableType stationCodeTable) {
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
this.stationCodeTable = stationCodeTable;
}
diff --git a/src/org/uic/ticket/api/impl/SimpleFipTicket.java b/src/org/uic/ticket/api/impl/SimpleFipTicket.java index 6bd5f99..42cb25b 100644 --- a/src/org/uic/ticket/api/impl/SimpleFipTicket.java +++ b/src/org/uic/ticket/api/impl/SimpleFipTicket.java @@ -8,9 +8,9 @@ import java.util.Date; import java.util.LinkedHashSet;
-import org.uic.ticket.api.asn.omv1.TravelClassType;
import org.uic.ticket.api.spec.IExtension;
import org.uic.ticket.api.spec.IFipTicket;
+import org.uic.ticket.api.spec.ITravelClassType;
// TODO: Auto-generated Javadoc
@@ -30,7 +30,7 @@ public class SimpleFipTicket extends SimpleDocumentData implements IFipTicket { protected String productOwner;
/** The class code. */
- protected TravelClassType classCode = TravelClassType.second;
+ protected ITravelClassType classCode = ITravelClassType.second;
/** The valid from. */
protected Date validFrom;
@@ -140,14 +140,14 @@ public class SimpleFipTicket extends SimpleDocumentData implements IFipTicket { /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IFipTicket#getClassCode()
*/
- public TravelClassType getClassCode() {
+ public ITravelClassType getClassCode() {
return classCode;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IFipTicket#setClassCode(org.uic.ticket.api.asn.om.TravelClassType)
*/
- public void setClassCode(TravelClassType classCode) {
+ public void setClassCode(ITravelClassType classCode) {
this.classCode = classCode;
}
diff --git a/src/org/uic/ticket/api/impl/SimpleGeoCoordinate.java b/src/org/uic/ticket/api/impl/SimpleGeoCoordinate.java index a591e29..4bec5a1 100644 --- a/src/org/uic/ticket/api/impl/SimpleGeoCoordinate.java +++ b/src/org/uic/ticket/api/impl/SimpleGeoCoordinate.java @@ -3,32 +3,33 @@ */
package org.uic.ticket.api.impl;
-import org.uic.ticket.api.asn.omv1.GeoCoordinateSystemType;
-import org.uic.ticket.api.asn.omv1.GeoUnitType;
-import org.uic.ticket.api.asn.omv1.HemisphereLatitudeType;
-import org.uic.ticket.api.asn.omv1.HemisphereLongitudeType;
+
+import org.uic.ticket.api.spec.IGeoCoordinateSystemType;
+import org.uic.ticket.api.spec.IGeoUnitType;
+import org.uic.ticket.api.spec.IHemisphereLatitudeType;
+import org.uic.ticket.api.spec.IHemisphereLongitudeType;
import org.uic.ticket.api.spec.IGeoCoordinate;
-// TODO: Auto-generated Javadoc
+
/**
* The Class SimpleGeoCoordinate.
*/
public class SimpleGeoCoordinate implements IGeoCoordinate {
/** The unit. */
- protected GeoUnitType unit = GeoUnitType.milliDegree;
+ protected IGeoUnitType unit = IGeoUnitType.milliDegree;
/** The accuracy. */
- protected GeoUnitType accuracy;
+ protected IGeoUnitType accuracy;
/** The system. */
- protected GeoCoordinateSystemType system = GeoCoordinateSystemType.wgs84;
+ protected IGeoCoordinateSystemType system = IGeoCoordinateSystemType.wgs84;
/** The hemispher longiture. */
- protected HemisphereLongitudeType hemispherLongiture = HemisphereLongitudeType.north;
+ protected IHemisphereLongitudeType hemispherLongiture = IHemisphereLongitudeType.north;
/** The hemisphere latitude. */
- protected HemisphereLatitudeType hemisphereLatitude = HemisphereLatitudeType.east;
+ protected IHemisphereLatitudeType hemisphereLatitude = IHemisphereLatitudeType.east;
/** The longitude. */
protected Long longitude;
@@ -39,70 +40,70 @@ public class SimpleGeoCoordinate implements IGeoCoordinate { /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IGeoCoordinate#getUnit()
*/
- public GeoUnitType getUnit() {
+ public IGeoUnitType getUnit() {
return unit;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IGeoCoordinate#setUnit(org.uic.ticket.api.asn.om.GeoUnitType)
*/
- public void setUnit(GeoUnitType unit) {
+ public void setUnit(IGeoUnitType unit) {
this.unit = unit;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IGeoCoordinate#getAccuracy()
*/
- public GeoUnitType getAccuracy() {
+ public IGeoUnitType getAccuracy() {
return accuracy;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IGeoCoordinate#setAccuracy(org.uic.ticket.api.asn.om.GeoUnitType)
*/
- public void setAccuracy(GeoUnitType accuracy) {
+ public void setAccuracy(IGeoUnitType accuracy) {
this.accuracy = accuracy;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IGeoCoordinate#getSystem()
*/
- public GeoCoordinateSystemType getSystem() {
+ public IGeoCoordinateSystemType getSystem() {
return system;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IGeoCoordinate#setSystem(org.uic.ticket.api.asn.om.GeoCoordinateSystemType)
*/
- public void setSystem(GeoCoordinateSystemType system) {
+ public void setSystem(IGeoCoordinateSystemType system) {
this.system = system;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IGeoCoordinate#getHemispherLongitude()
*/
- public HemisphereLongitudeType getHemisphereLongitude() {
+ public IHemisphereLongitudeType getHemisphereLongitude() {
return hemispherLongiture;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IGeoCoordinate#setHemispherLongitude(org.uic.ticket.api.asn.om.HemisphereLongitudeType)
*/
- public void setHemisphereLongitude(HemisphereLongitudeType hemispherLongiture) {
+ public void setHemisphereLongitude(IHemisphereLongitudeType hemispherLongiture) {
this.hemispherLongiture = hemispherLongiture;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IGeoCoordinate#getHemisphereLatitude()
*/
- public HemisphereLatitudeType getHemisphereLatitude() {
+ public IHemisphereLatitudeType getHemisphereLatitude() {
return hemisphereLatitude;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IGeoCoordinate#setHemisphereLatitude(org.uic.ticket.api.asn.om.HemisphereLatitudeType)
*/
- public void setHemisphereLatitude(HemisphereLatitudeType hemisphereLatitude) {
+ public void setHemisphereLatitude(IHemisphereLatitudeType hemisphereLatitude) {
this.hemisphereLatitude = hemisphereLatitude;
}
@@ -146,15 +147,15 @@ public class SimpleGeoCoordinate implements IGeoCoordinate { }
public long getFullCircle(){
- if (unit == GeoUnitType.centiDegree) {
+ if (unit == IGeoUnitType.centiDegree) {
return 100 * 360;
- } else if (unit == GeoUnitType.deciDegree) {
+ } else if (unit == IGeoUnitType.deciDegree) {
return 10 * 360;
- } else if (unit == GeoUnitType.milliDegree) {
+ } else if (unit == IGeoUnitType.milliDegree) {
return 1000 * 360;
- } else if (unit == GeoUnitType.tenthmilliDegree) {
+ } else if (unit == IGeoUnitType.tenthmilliDegree) {
return 10000 * 360;
- } else if (unit == GeoUnitType.milliDegree) {
+ } else if (unit == IGeoUnitType.milliDegree) {
return 100000 * 360;
} else {
return 360;
diff --git a/src/org/uic/ticket/api/impl/SimpleIncludedOpenTicket.java b/src/org/uic/ticket/api/impl/SimpleIncludedOpenTicket.java index 601e818..c0b2680 100644 --- a/src/org/uic/ticket/api/impl/SimpleIncludedOpenTicket.java +++ b/src/org/uic/ticket/api/impl/SimpleIncludedOpenTicket.java @@ -7,14 +7,13 @@ import java.util.Collection; import java.util.Date;
import java.util.LinkedHashSet;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
-import org.uic.ticket.api.asn.omv1.TravelClassType;
import org.uic.ticket.api.spec.IExtension;
import org.uic.ticket.api.spec.IIncludedOpenTicket;
import org.uic.ticket.api.spec.IRegionalValidity;
import org.uic.ticket.api.spec.ITariff;
+import org.uic.ticket.api.spec.IStationCodeTable;
+import org.uic.ticket.api.spec.ITravelClassType;
-// TODO: Auto-generated Javadoc
/**
* The Class SimpleIncludedOpenTicket.
*/
@@ -39,7 +38,7 @@ public class SimpleIncludedOpenTicket implements IIncludedOpenTicket { protected int authorizationCode;
/** The station code table. */
- protected CodeTableType stationCodeTable = CodeTableType.stationUIC;
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUIC;
/** The from station. */
protected String fromStation;
@@ -66,7 +65,7 @@ public class SimpleIncludedOpenTicket implements IIncludedOpenTicket { protected Date validUntil;
/** The class code. */
- protected TravelClassType classCode = TravelClassType.second;
+ protected ITravelClassType classCode = ITravelClassType.second;
/** The included carriers. */
protected Collection<String>includedCarriers = new LinkedHashSet<String>();
@@ -175,14 +174,14 @@ public class SimpleIncludedOpenTicket implements IIncludedOpenTicket { /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IIncludedOpenTicket#getStationCodeTable()
*/
- public CodeTableType getStationCodeTable() {
+ public IStationCodeTable getStationCodeTable() {
return stationCodeTable;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IIncludedOpenTicket#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
*/
- public void setStationCodeTable(CodeTableType stationCodeTable) {
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
this.stationCodeTable = stationCodeTable;
}
@@ -301,14 +300,14 @@ public class SimpleIncludedOpenTicket implements IIncludedOpenTicket { /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IIncludedOpenTicket#getClassCode()
*/
- public TravelClassType getClassCode() {
+ public ITravelClassType getClassCode() {
return classCode;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IIncludedOpenTicket#setClassCode(org.uic.ticket.api.asn.om.TravelClassType)
*/
- public void setClassCode(TravelClassType classCode) {
+ public void setClassCode(ITravelClassType classCode) {
this.classCode = classCode;
}
@@ -436,4 +435,28 @@ public class SimpleIncludedOpenTicket implements IIncludedOpenTicket { this.validUntil = date;
}
+ @Override
+ public Collection<Integer> getExcludedTransportTypes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addExcludedTransportType(Integer excludedTransportType) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Collection<Integer> getIncludedTransportTypes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addInludedTransportType(Integer includedTransportType) {
+ // TODO Auto-generated method stub
+
+ }
+
}
diff --git a/src/org/uic/ticket/api/impl/SimpleLine.java b/src/org/uic/ticket/api/impl/SimpleLine.java index 620dc65..f460c3f 100644 --- a/src/org/uic/ticket/api/impl/SimpleLine.java +++ b/src/org/uic/ticket/api/impl/SimpleLine.java @@ -5,10 +5,9 @@ package org.uic.ticket.api.impl; import java.util.HashSet;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
import org.uic.ticket.api.spec.ILine;
+import org.uic.ticket.api.spec.IStationCodeTable;
-// TODO: Auto-generated Javadoc
/**
* The Class SimpleLine.
*/
@@ -21,7 +20,7 @@ public class SimpleLine implements ILine { protected HashSet<Integer> lineIds = new HashSet<Integer>();
/** The station code table. */
- protected CodeTableType stationCodeTable = CodeTableType.stationUIC;
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUIC;
/** The entry station. */
protected String entryStation;
@@ -66,14 +65,14 @@ public class SimpleLine implements ILine { /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ILine#getStationCodeTable()
*/
- public CodeTableType getStationCodeTable() {
+ public IStationCodeTable getStationCodeTable() {
return stationCodeTable;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ILine#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
*/
- public void setStationCodeTable(CodeTableType stationCodeTable) {
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
this.stationCodeTable = stationCodeTable;
}
diff --git a/src/org/uic/ticket/api/impl/SimpleOpenTicket.java b/src/org/uic/ticket/api/impl/SimpleOpenTicket.java index 24b887b..5e2a7ed 100644 --- a/src/org/uic/ticket/api/impl/SimpleOpenTicket.java +++ b/src/org/uic/ticket/api/impl/SimpleOpenTicket.java @@ -7,8 +7,6 @@ import java.util.Collection; import java.util.Date;
import java.util.LinkedHashSet;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
-import org.uic.ticket.api.asn.omv1.TravelClassType;
import org.uic.ticket.api.spec.IExtension;
import org.uic.ticket.api.spec.IIncludedOpenTicket;
import org.uic.ticket.api.spec.ILuggageRestriction;
@@ -17,8 +15,10 @@ import org.uic.ticket.api.spec.IRegionalValidity; import org.uic.ticket.api.spec.IReturnRouteDescription;
import org.uic.ticket.api.spec.ITariff;
import org.uic.ticket.api.spec.IVatDetail;
+import org.uic.ticket.api.spec.IStationCodeTable;
+import org.uic.ticket.api.spec.ITravelClassType;
+
-// TODO: Auto-generated Javadoc
/**
* The Class SimpleOpenTicket.
*/
@@ -63,7 +63,7 @@ public class SimpleOpenTicket extends SimpleDocumentData implements IOpenTicket protected boolean returnIncluded = false;
/** The station code table. */
- protected CodeTableType stationCodeTable = CodeTableType.stationUIC;
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUIC;
/** The from station. */
protected String fromStation;
@@ -91,7 +91,7 @@ public class SimpleOpenTicket extends SimpleDocumentData implements IOpenTicket protected Collection<Date> activatedDays = new LinkedHashSet<Date>();
/** The class code. */
- protected TravelClassType classCode = TravelClassType.second;
+ protected ITravelClassType classCode = ITravelClassType.second;
/** The service level. */
@@ -106,6 +106,12 @@ public class SimpleOpenTicket extends SimpleDocumentData implements IOpenTicket /** The excluded service brands. */
protected Collection<Integer>excludedServiceBrands = new LinkedHashSet<Integer>();
+ /** The included service brands. */
+ protected Collection<Integer>includedTransportTypes = new LinkedHashSet<Integer>();
+
+ /** The excluded service brands. */
+ protected Collection<Integer>excludedTransportTypes = new LinkedHashSet<Integer>();
+
/** The tariffs. */
protected Collection<ITariff> tariffs = new LinkedHashSet<ITariff>();
@@ -169,14 +175,14 @@ public class SimpleOpenTicket extends SimpleDocumentData implements IOpenTicket /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IOpenTicket#getStationCodeTable()
*/
- public CodeTableType getStationCodeTable() {
+ public IStationCodeTable getStationCodeTable() {
return stationCodeTable;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IOpenTicket#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
*/
- public void setStationCodeTable(CodeTableType stationCodeTable) {
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
this.stationCodeTable = stationCodeTable;
}
@@ -479,14 +485,14 @@ public class SimpleOpenTicket extends SimpleDocumentData implements IOpenTicket /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IOpenTicket#getClassCode()
*/
- public TravelClassType getClassCode() {
+ public ITravelClassType getClassCode() {
return classCode;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IOpenTicket#setClassCode(org.uic.ticket.api.asn.om.TravelClassType)
*/
- public void setClassCode(TravelClassType classCode) {
+ public void setClassCode(ITravelClassType classCode) {
this.classCode = classCode;
}
@@ -574,4 +580,24 @@ public class SimpleOpenTicket extends SimpleDocumentData implements IOpenTicket this.validUntilUTCoffset = validUntilUTCoffset;
}
+ @Override
+ public Collection<Integer> getExcludedTransportTypes() {
+ return excludedTransportTypes;
+ }
+
+ @Override
+ public void addExcludedTransportType(Integer excludedTransportType) {
+ excludedTransportTypes.add(excludedTransportType);
+ }
+
+ @Override
+ public Collection<Integer> getIncludedTransportTypes() {
+ return includedTransportTypes;
+ }
+
+ @Override
+ public void addInludedTransportType(Integer includedTransportType) {
+ includedTransportTypes.add(includedTransportType);
+ }
+
}
diff --git a/src/org/uic/ticket/api/impl/SimpleParkingGround.java b/src/org/uic/ticket/api/impl/SimpleParkingGround.java index 9e77989..2ded400 100644 --- a/src/org/uic/ticket/api/impl/SimpleParkingGround.java +++ b/src/org/uic/ticket/api/impl/SimpleParkingGround.java @@ -7,10 +7,10 @@ import java.util.Collection; import java.util.Date;
import java.util.LinkedHashSet;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
import org.uic.ticket.api.spec.IExtension;
import org.uic.ticket.api.spec.IParkingGround;
import org.uic.ticket.api.spec.IVatDetail;
+import org.uic.ticket.api.spec.IStationCodeTable;
/**
@@ -55,7 +55,7 @@ public class SimpleParkingGround extends SimpleDocumentData implements IParkingG protected String numberPlate;
/** The station code table. */
- protected CodeTableType stationCodeTable = CodeTableType.stationUIC;
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUIC;
/** The extension data. */
protected IExtension extensionData;
@@ -227,14 +227,14 @@ public class SimpleParkingGround extends SimpleDocumentData implements IParkingG /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IParkingGround#getStationCodeTable()
*/
- public CodeTableType getStationCodeTable() {
+ public IStationCodeTable getStationCodeTable() {
return stationCodeTable;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IParkingGround#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
*/
- public void setStationCodeTable(CodeTableType stationCodeTable) {
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
this.stationCodeTable = stationCodeTable;
}
diff --git a/src/org/uic/ticket/api/impl/SimplePass.java b/src/org/uic/ticket/api/impl/SimplePass.java index d1704ac..9b00e2d 100644 --- a/src/org/uic/ticket/api/impl/SimplePass.java +++ b/src/org/uic/ticket/api/impl/SimplePass.java @@ -7,16 +7,15 @@ import java.util.Collection; import java.util.Date;
import java.util.LinkedHashSet;
-import org.uic.ticket.api.asn.omv1.*;
import org.uic.ticket.api.spec.IExtension;
import org.uic.ticket.api.spec.IPass;
import org.uic.ticket.api.spec.IRegionalValidity;
import org.uic.ticket.api.spec.ITariff;
import org.uic.ticket.api.spec.IValidityDetails;
import org.uic.ticket.api.spec.IVatDetail;
+import org.uic.ticket.api.spec.ITravelClassType;
-// TODO: Auto-generated Javadoc
/**
* The Class SimplePass.
*/
@@ -32,7 +31,7 @@ public class SimplePass extends SimpleDocumentData implements IPass { protected String productOwner;
/** The class code. */
- protected TravelClassType classCode = TravelClassType.second;
+ protected ITravelClassType classCode = ITravelClassType.second;
/** The valid from. */
protected Date validFrom;
@@ -329,14 +328,14 @@ public class SimplePass extends SimpleDocumentData implements IPass { /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IPass#getClassCode()
*/
- public TravelClassType getClassCode() {
+ public ITravelClassType getClassCode() {
return classCode;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IPass#setClassCode(org.uic.ticket.api.asn.om.TravelClassType)
*/
- public void setClassCode(TravelClassType classCode) {
+ public void setClassCode(ITravelClassType classCode) {
this.classCode = classCode;
}
diff --git a/src/org/uic/ticket/api/impl/SimpleReservation.java b/src/org/uic/ticket/api/impl/SimpleReservation.java index 2aa22de..aff30dc 100644 --- a/src/org/uic/ticket/api/impl/SimpleReservation.java +++ b/src/org/uic/ticket/api/impl/SimpleReservation.java @@ -7,10 +7,7 @@ import java.util.Collection; import java.util.Date;
import java.util.LinkedHashSet;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
-import org.uic.ticket.api.asn.omv1.PriceTypeType;
-import org.uic.ticket.api.asn.omv1.ServiceType;
-import org.uic.ticket.api.asn.omv1.TravelClassType;
+
import org.uic.ticket.api.spec.IBerth;
import org.uic.ticket.api.spec.ICompartmentDetails;
import org.uic.ticket.api.spec.IExtension;
@@ -20,8 +17,12 @@ import org.uic.ticket.api.spec.IReservation; import org.uic.ticket.api.spec.IServiceBrand;
import org.uic.ticket.api.spec.ITariff;
import org.uic.ticket.api.spec.IVatDetail;
+import org.uic.ticket.api.spec.IPriceTypeType;
+import org.uic.ticket.api.spec.IServiceType;
+import org.uic.ticket.api.spec.IStationCodeTable;
+import org.uic.ticket.api.spec.ITravelClassType;
+
-// TODO: Auto-generated Javadoc
/**
* The Class SimpleReservation.
*/
@@ -49,7 +50,7 @@ public class SimpleReservation extends SimpleDocumentData implements IReservatio protected IServiceBrand serviceBrand;
/** The service. */
- protected ServiceType service = ServiceType.seat;
+ protected IServiceType service = IServiceType.seat;
/** The service brand description. */
protected String serviceBrandDescription;
@@ -59,7 +60,7 @@ public class SimpleReservation extends SimpleDocumentData implements IReservatio /** The station code table. */
- protected CodeTableType stationCodeTable = CodeTableType.stationUICReservation;
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUICReservation;
/** The from station. */
protected String fromStation;
@@ -83,7 +84,7 @@ public class SimpleReservation extends SimpleDocumentData implements IReservatio protected Collection<ITariff> tariffs = new LinkedHashSet<ITariff>();
/** The class code. */
- protected TravelClassType classCode = TravelClassType.second;
+ protected ITravelClassType classCode = ITravelClassType.second;
/** The service level. */
protected String serviceLevel;
@@ -106,7 +107,7 @@ public class SimpleReservation extends SimpleDocumentData implements IReservatio /** The price type. */
- protected PriceTypeType priceType = PriceTypeType.travelPrice;
+ protected IPriceTypeType priceType = IPriceTypeType.travelPrice;
/** The type of supplement. */
protected int typeOfSupplement;
@@ -222,28 +223,28 @@ public class SimpleReservation extends SimpleDocumentData implements IReservatio /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IReservation#getService()
*/
- public ServiceType getService() {
+ public IServiceType getService() {
return service;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IReservation#setService(org.uic.ticket.api.asn.om.ServiceType)
*/
- public void setService(ServiceType service) {
+ public void setService(IServiceType service) {
this.service = service;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IReservation#getStationCodeTable()
*/
- public CodeTableType getStationCodeTable() {
+ public IStationCodeTable getStationCodeTable() {
return stationCodeTable;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IReservation#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
*/
- public void setStationCodeTable(CodeTableType stationCodeTable) {
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
this.stationCodeTable = stationCodeTable;
}
@@ -320,14 +321,14 @@ public class SimpleReservation extends SimpleDocumentData implements IReservatio /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IReservation#getClassCode()
*/
- public TravelClassType getClassCode() {
+ public ITravelClassType getClassCode() {
return classCode;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IReservation#setClassCode(org.uic.ticket.api.asn.om.TravelClassType)
*/
- public void setClassCode(TravelClassType classCode) {
+ public void setClassCode(ITravelClassType classCode) {
this.classCode = classCode;
}
@@ -449,14 +450,14 @@ public class SimpleReservation extends SimpleDocumentData implements IReservatio /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IReservation#getPriceType()
*/
- public PriceTypeType getPriceType() {
+ public IPriceTypeType getPriceType() {
return priceType;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IReservation#setPriceType(org.uic.ticket.api.asn.om.PriceTypeType)
*/
- public void setPriceType(PriceTypeType priceType) {
+ public void setPriceType(IPriceTypeType priceType) {
this.priceType = priceType;
}
diff --git a/src/org/uic/ticket/api/impl/SimpleRouteSection.java b/src/org/uic/ticket/api/impl/SimpleRouteSection.java index 079ae61..0354e4c 100644 --- a/src/org/uic/ticket/api/impl/SimpleRouteSection.java +++ b/src/org/uic/ticket/api/impl/SimpleRouteSection.java @@ -3,10 +3,11 @@ */
package org.uic.ticket.api.impl;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
+
import org.uic.ticket.api.spec.IRouteSection;
+import org.uic.ticket.api.spec.IStationCodeTable;
+
-// TODO: Auto-generated Javadoc
/**
* The Class SimpleRouteSection.
*/
@@ -14,7 +15,7 @@ public class SimpleRouteSection implements IRouteSection { /** The station code table. */
- protected CodeTableType stationCodeTable = CodeTableType.stationUIC;
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUIC;
/** The from station. */
protected String fromStation;
@@ -31,14 +32,14 @@ public class SimpleRouteSection implements IRouteSection { /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IRouteSection#getStationCodeTable()
*/
- public CodeTableType getStationCodeTable() {
+ public IStationCodeTable getStationCodeTable() {
return stationCodeTable;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IRouteSection#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
*/
- public void setStationCodeTable(CodeTableType stationCodeTable) {
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
this.stationCodeTable = stationCodeTable;
}
diff --git a/src/org/uic/ticket/api/impl/SimpleStationPassage.java b/src/org/uic/ticket/api/impl/SimpleStationPassage.java index 334d528..7624086 100644 --- a/src/org/uic/ticket/api/impl/SimpleStationPassage.java +++ b/src/org/uic/ticket/api/impl/SimpleStationPassage.java @@ -7,11 +7,11 @@ import java.util.Collection; import java.util.Date;
import java.util.LinkedHashSet;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
import org.uic.ticket.api.spec.IExtension;
import org.uic.ticket.api.spec.IStationPassage;
+import org.uic.ticket.api.spec.IStationCodeTable;
+
-// TODO: Auto-generated Javadoc
/**
* The Class SimpleStationPassage.
*/
@@ -36,7 +36,7 @@ public class SimpleStationPassage extends SimpleDocumentData implements IStation protected Date validUntil;
/** The station code table. */
- protected CodeTableType stationCodeTable = CodeTableType.stationUIC;
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUIC;
/** The station name. */
protected String stationName;
@@ -148,14 +148,14 @@ public class SimpleStationPassage extends SimpleDocumentData implements IStation /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IStationPassage#getStationCodeTable()
*/
- public CodeTableType getStationCodeTable() {
+ public IStationCodeTable getStationCodeTable() {
return stationCodeTable;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IStationPassage#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
*/
- public void setStationCodeTable(CodeTableType stationCodeTable) {
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
this.stationCodeTable = stationCodeTable;
}
diff --git a/src/org/uic/ticket/api/impl/SimpleTariff.java b/src/org/uic/ticket/api/impl/SimpleTariff.java index e7fe371..c051a70 100644 --- a/src/org/uic/ticket/api/impl/SimpleTariff.java +++ b/src/org/uic/ticket/api/impl/SimpleTariff.java @@ -6,13 +6,13 @@ package org.uic.ticket.api.impl; import java.util.Collection;
import java.util.LinkedHashSet;
-import org.uic.ticket.api.asn.omv1.PassengerType;
import org.uic.ticket.api.spec.ICardReference;
import org.uic.ticket.api.spec.IRouteSection;
import org.uic.ticket.api.spec.ISeriesDataDetails;
import org.uic.ticket.api.spec.ITariff;
+import org.uic.ticket.api.spec.IPassengerType;
+
-// TODO: Auto-generated Javadoc
/**
* The Class SimpleTariff.
*/
@@ -22,7 +22,7 @@ public class SimpleTariff implements ITariff { protected int numberOfPassengers = 1;
/** The passenger type. */
- protected PassengerType passengerType ;
+ protected IPassengerType passengerType ;
/** The age below. */
@@ -77,7 +77,7 @@ public class SimpleTariff implements ITariff { /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ITariff#getPassengerType()
*/
- public PassengerType getPassengerType() {
+ public IPassengerType getPassengerType() {
return passengerType;
}
@@ -85,7 +85,7 @@ public class SimpleTariff implements ITariff { /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ITariff#setPassengerType(org.uic.ticket.api.asn.om.PassengerType)
*/
- public void setPassengerType(PassengerType passengerType) {
+ public void setPassengerType(IPassengerType passengerType) {
this.passengerType = passengerType;
}
diff --git a/src/org/uic/ticket/api/impl/SimpleTicketLink.java b/src/org/uic/ticket/api/impl/SimpleTicketLink.java index 3262caa..b28d8d5 100644 --- a/src/org/uic/ticket/api/impl/SimpleTicketLink.java +++ b/src/org/uic/ticket/api/impl/SimpleTicketLink.java @@ -3,11 +3,12 @@ */
package org.uic.ticket.api.impl;
-import org.uic.ticket.api.asn.omv1.LinkMode;
-import org.uic.ticket.api.asn.omv1.TicketType;
+
import org.uic.ticket.api.spec.ITicketLink;
+import org.uic.ticket.api.spec.ILinkMode;
+import org.uic.ticket.api.spec.ITicketType;
+
-// TODO: Auto-generated Javadoc
/**
* The Class SimpleTicketLink.
*/
@@ -26,10 +27,10 @@ public class SimpleTicketLink implements ITicketLink { protected String productOwner;
/** The ticket type. */
- protected TicketType ticketType = TicketType.openTicket;
+ protected ITicketType ticketType = ITicketType.openTicket;
/** The link mode. */
- protected LinkMode linkMode = LinkMode.issuedTogether;
+ protected ILinkMode linkMode = ILinkMode.issuedTogether;
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ITicketLink#getReference()
@@ -76,28 +77,28 @@ public class SimpleTicketLink implements ITicketLink { /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ITicketLink#getTicketType()
*/
- public TicketType getTicketType() {
+ public ITicketType getTicketType() {
return ticketType;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ITicketLink#setTicketType(org.uic.ticket.api.asn.om.TicketType)
*/
- public void setTicketType(TicketType ticketType) {
+ public void setTicketType(ITicketType ticketType) {
this.ticketType = ticketType;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ITicketLink#getLinkMode()
*/
- public LinkMode getLinkMode() {
+ public ILinkMode getLinkMode() {
return linkMode;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ITicketLink#setLinkMode(org.uic.ticket.api.asn.om.LinkMode)
*/
- public void setLinkMode(LinkMode linkMode) {
+ public void setLinkMode(ILinkMode linkMode) {
this.linkMode = linkMode;
}
diff --git a/src/org/uic/ticket/api/impl/SimpleTraveler.java b/src/org/uic/ticket/api/impl/SimpleTraveler.java index 50c322c..ef60dd7 100644 --- a/src/org/uic/ticket/api/impl/SimpleTraveler.java +++ b/src/org/uic/ticket/api/impl/SimpleTraveler.java @@ -7,13 +7,12 @@ import java.util.Collection; import java.util.Date;
import java.util.HashSet;
-import org.uic.ticket.api.asn.omv1.GenderType;
-import org.uic.ticket.api.asn.omv1.PassengerType;
+import org.uic.ticket.api.spec.IGenderType;
import org.uic.ticket.api.spec.ICustomerStatusDescription;
import org.uic.ticket.api.spec.ITraveler;
+import org.uic.ticket.api.spec.IPassengerType;
-// TODO: Auto-generated Javadoc
/**
* The Class SimpleTraveler.
*/
@@ -39,7 +38,7 @@ public class SimpleTraveler implements ITraveler { protected String title;
/** The gender. */
- protected GenderType gender;
+ protected IGenderType gender;
/** The customer id. */
protected String customerId;
@@ -51,7 +50,7 @@ public class SimpleTraveler implements ITraveler { protected boolean ticketHolder = true;
/** The passenger type. */
- protected PassengerType passengerType;
+ protected IPassengerType passengerType;
/** The passenger with reduced mobility. */
protected boolean passengerWithReducedMobility = false;
@@ -156,14 +155,14 @@ public class SimpleTraveler implements ITraveler { /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ITraveler#getGender()
*/
- public GenderType getGender() {
+ public IGenderType getGender() {
return gender;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ITraveler#setGender(org.uic.ticket.api.asn.om.GenderType)
*/
- public void setGender(GenderType gender) {
+ public void setGender(IGenderType gender) {
this.gender = gender;
}
@@ -212,14 +211,14 @@ public class SimpleTraveler implements ITraveler { /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ITraveler#getPassengerType()
*/
- public PassengerType getPassengerType() {
+ public IPassengerType getPassengerType() {
return passengerType;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.ITraveler#setPassengerType(org.uic.ticket.api.asn.om.PassengerType)
*/
- public void setPassengerType(PassengerType passengerType) {
+ public void setPassengerType(IPassengerType passengerType) {
this.passengerType = passengerType;
}
diff --git a/src/org/uic/ticket/api/impl/SimpleViaStation.java b/src/org/uic/ticket/api/impl/SimpleViaStation.java index a60ff8b..8af7c30 100644 --- a/src/org/uic/ticket/api/impl/SimpleViaStation.java +++ b/src/org/uic/ticket/api/impl/SimpleViaStation.java @@ -6,17 +6,18 @@ package org.uic.ticket.api.impl; import java.util.Collection;
import java.util.LinkedHashSet;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
+
import org.uic.ticket.api.spec.IViaStation;
+import org.uic.ticket.api.spec.IStationCodeTable;
+
-// TODO: Auto-generated Javadoc
/**
* The Class SimpleViaStation.
*/
public class SimpleViaStation implements IViaStation {
/** The station code table. */
- protected CodeTableType stationCodeTable = CodeTableType.stationUIC;
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUIC;
/** The station. */
protected String station;
@@ -42,14 +43,14 @@ public class SimpleViaStation implements IViaStation { /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IViaStation#getStationCodeTable()
*/
- public CodeTableType getStationCodeTable() {
+ public IStationCodeTable getStationCodeTable() {
return stationCodeTable;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IViaStation#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
*/
- public void setStationCodeTable(CodeTableType stationCodeTable) {
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
this.stationCodeTable = stationCodeTable;
}
diff --git a/src/org/uic/ticket/api/impl/SimpleZone.java b/src/org/uic/ticket/api/impl/SimpleZone.java index d48a5d9..68d6b72 100644 --- a/src/org/uic/ticket/api/impl/SimpleZone.java +++ b/src/org/uic/ticket/api/impl/SimpleZone.java @@ -6,10 +6,10 @@ package org.uic.ticket.api.impl; import java.util.Collection;
import java.util.HashSet;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
import org.uic.ticket.api.spec.IZone;
+import org.uic.ticket.api.spec.IStationCodeTable;
+
-// TODO: Auto-generated Javadoc
/**
* The Class SimpleZone.
*/
@@ -20,7 +20,7 @@ public class SimpleZone implements IZone { /** The station code table. */
- protected CodeTableType stationCodeTable = CodeTableType.stationUIC;
+ protected IStationCodeTable stationCodeTable = IStationCodeTable.stationUIC;
/** The entry station. */
protected String entryStation;
@@ -58,14 +58,14 @@ public class SimpleZone implements IZone { /* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IZone#getStationCodeTable()
*/
- public CodeTableType getStationCodeTable() {
+ public IStationCodeTable getStationCodeTable() {
return stationCodeTable;
}
/* (nicht-Javadoc)
* @see org.uic.ticket.api.spec.IZone#setStationCodeTable(org.uic.ticket.api.asn.om.CodeTableType)
*/
- public void setStationCodeTable(CodeTableType stationCodeTable) {
+ public void setStationCodeTable(IStationCodeTable stationCodeTable) {
this.stationCodeTable = stationCodeTable;
}
diff --git a/src/org/uic/ticket/api/spec/IBerth.java b/src/org/uic/ticket/api/spec/IBerth.java index 78a9780..a1051b7 100644 --- a/src/org/uic/ticket/api/spec/IBerth.java +++ b/src/org/uic/ticket/api/spec/IBerth.java @@ -3,9 +3,8 @@ */
package org.uic.ticket.api.spec;
-import org.uic.ticket.api.EncodingFormatException;
-import org.uic.ticket.api.asn.omv1.BerthTypeType;
-import org.uic.ticket.api.asn.omv1.CompartmentGenderType;
+import org.uic.ticket.EncodingFormatException;
+
/**
@@ -19,7 +18,7 @@ public interface IBerth { *
* @return the type
*/
- public BerthTypeType getType() ;
+ public IBerthTypeType getType() ;
/**
* Sets the type of the Berth.
@@ -27,7 +26,7 @@ public interface IBerth { *
* @param type the new berth type
*/
- public void setType(BerthTypeType type);
+ public void setType(IBerthTypeType type);
/**
* Gets the number of berths.
@@ -49,13 +48,13 @@ public interface IBerth { *
* @return the gender
*/
- public CompartmentGenderType getGender();
+ public ICompartmentGenderType getGender();
/**
* Sets the gender information of the compartment reserved (family, male, female, mixed,..).
*
* @param gender the new gender
*/
- public void setGender(CompartmentGenderType gender) ;
+ public void setGender(ICompartmentGenderType gender) ;
}
diff --git a/src/org/uic/ticket/api/spec/ICarCarriageReservation.java b/src/org/uic/ticket/api/spec/ICarCarriageReservation.java index 6465e29..c77b3aa 100644 --- a/src/org/uic/ticket/api/spec/ICarCarriageReservation.java +++ b/src/org/uic/ticket/api/spec/ICarCarriageReservation.java @@ -6,10 +6,6 @@ package org.uic.ticket.api.spec; import java.util.Collection;
import java.util.Date;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
-import org.uic.ticket.api.asn.omv1.LoadingDeckType;
-import org.uic.ticket.api.asn.omv1.PriceTypeType;
-import org.uic.ticket.api.asn.omv1.RoofRackType;
/**
* The Interface ICarCarriageReservation.
@@ -111,7 +107,7 @@ public interface ICarCarriageReservation extends IDocumentData { *
* @return the station code table
*/
- public CodeTableType getStationCodeTable();
+ public IStationCodeTable getStationCodeTable();
/**
* Sets the station code table.
@@ -121,7 +117,7 @@ public interface ICarCarriageReservation extends IDocumentData { *
* @param stationCodeTable the new station code table
*/
- public void setStationCodeTable(CodeTableType stationCodeTable);
+ public void setStationCodeTable(IStationCodeTable stationCodeTable);
/**
* Gets the from station code
@@ -246,7 +242,7 @@ public interface ICarCarriageReservation extends IDocumentData { *
* @return the price type
*/
- public PriceTypeType getPriceType();
+ public IPriceTypeType getPriceType();
/**
* Sets the price type.
@@ -255,7 +251,7 @@ public interface ICarCarriageReservation extends IDocumentData { *
* @param priceType the new price type
*/
- public void setPriceType(PriceTypeType priceType) ;
+ public void setPriceType(IPriceTypeType priceType) ;
/**
* Gets the info text for the control staff
@@ -412,7 +408,7 @@ public interface ICarCarriageReservation extends IDocumentData { *
* @return the roof rack type
*/
- public RoofRackType getRoofRackType();
+ public IRoofRackType getRoofRackType();
/**
* Sets the roof rack type.
@@ -421,7 +417,7 @@ public interface ICarCarriageReservation extends IDocumentData { *
* @param roofRackType the new roof rack type
*/
- public void setRoofRackType(RoofRackType roofRackType);
+ public void setRoofRackType(IRoofRackType roofRackType);
/**
* Gets the roof rack height in cm
@@ -526,14 +522,14 @@ public interface ICarCarriageReservation extends IDocumentData { *
* @return the loading deck
*/
- public LoadingDeckType getLoadingDeck();
+ public ILoadingDeckType getLoadingDeck();
/**
* Sets the loading deck.
*
* @param loadingDeck the new loading deck
*/
- public void setLoadingDeck(LoadingDeckType loadingDeck);
+ public void setLoadingDeck(ILoadingDeckType loadingDeck);
/**
diff --git a/src/org/uic/ticket/api/spec/ICompartmentDetails.java b/src/org/uic/ticket/api/spec/ICompartmentDetails.java index 4e05801..b46bdcb 100644 --- a/src/org/uic/ticket/api/spec/ICompartmentDetails.java +++ b/src/org/uic/ticket/api/spec/ICompartmentDetails.java @@ -3,8 +3,6 @@ */
package org.uic.ticket.api.spec;
-import org.uic.ticket.api.asn.omv1.CompartmentPositionType;
-
/**
* The Interface ICompartmentDetails.
*
@@ -116,13 +114,13 @@ public interface ICompartmentDetails { *
* @return the position
*/
- public CompartmentPositionType getPosition();
+ public ICompartmentPositionType getPosition();
/**
* Sets the position of the compartment in trains with different decks
*
* @param position the new position
*/
- public void setPosition(CompartmentPositionType position);
+ public void setPosition(ICompartmentPositionType position);
}
diff --git a/src/org/uic/ticket/api/spec/ICounterMark.java b/src/org/uic/ticket/api/spec/ICounterMark.java index c6b5744..9ccf920 100644 --- a/src/org/uic/ticket/api/spec/ICounterMark.java +++ b/src/org/uic/ticket/api/spec/ICounterMark.java @@ -6,9 +6,6 @@ package org.uic.ticket.api.spec; import java.util.Collection;
import java.util.Date;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
-import org.uic.ticket.api.asn.omv1.TravelClassType;
-
/**
* The Interface ICounterMark.
*
@@ -98,7 +95,7 @@ public interface ICounterMark extends IDocumentData { *
* @return the station code table
*/
- public CodeTableType getStationCodeTable();
+ public IStationCodeTable getStationCodeTable();
/**
* Sets the station code table.
@@ -109,7 +106,7 @@ public interface ICounterMark extends IDocumentData { *
* @param stationCodeTable the new station code table
*/
- public void setStationCodeTable(CodeTableType stationCodeTable);
+ public void setStationCodeTable(IStationCodeTable stationCodeTable);
/**
* Gets the from station.
@@ -242,14 +239,14 @@ public interface ICounterMark extends IDocumentData { *
* @return the class code
*/
- public TravelClassType getClassCode();
+ public ITravelClassType getClassCode();
/**
* Sets the class code.
*
* @param classCode the new class code
*/
- public void setClassCode(TravelClassType classCode);
+ public void setClassCode(ITravelClassType classCode);
/**
* Gets the included carriers.
diff --git a/src/org/uic/ticket/api/spec/ICustomerCard.java b/src/org/uic/ticket/api/spec/ICustomerCard.java index a5be24a..5aaad4b 100644 --- a/src/org/uic/ticket/api/spec/ICustomerCard.java +++ b/src/org/uic/ticket/api/spec/ICustomerCard.java @@ -6,9 +6,8 @@ package org.uic.ticket.api.spec; import java.util.Collection;
import java.util.Date;
-import org.uic.ticket.api.asn.omv1.TravelClassType;
-// TODO: Auto-generated Javadoc
+
/**
* The Interface ICustomerCard.
*/
@@ -76,14 +75,14 @@ public interface ICustomerCard extends IDocumentData { *
* @return the class code
*/
- public TravelClassType getClassCode();
+ public ITravelClassType getClassCode();
/**
* Sets the class code.
*
* @param classCode the new class code
*/
- public void setClassCode(TravelClassType classCode);
+ public void setClassCode(ITravelClassType classCode);
/**
* Gets the card type.
diff --git a/src/org/uic/ticket/api/spec/IDelayConfirmation.java b/src/org/uic/ticket/api/spec/IDelayConfirmation.java index aa9b418..bbf46f9 100644 --- a/src/org/uic/ticket/api/spec/IDelayConfirmation.java +++ b/src/org/uic/ticket/api/spec/IDelayConfirmation.java @@ -6,10 +6,7 @@ package org.uic.ticket.api.spec; import java.util.Collection;
import java.util.Date;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
-
-// TODO: Auto-generated Javadoc
/**
* The Interface IDelayConfirmation implements
* a confirmation of delay given to a traveler to prove to another carrier he want tu use to continue the journey
@@ -55,7 +52,7 @@ public interface IDelayConfirmation extends IDocumentData { *
* @return the station code table
*/
- public CodeTableType getStationCodeTable();
+ public IStationCodeTable getStationCodeTable();
/**
* Sets the station code table.
@@ -66,7 +63,7 @@ public interface IDelayConfirmation extends IDocumentData { *
* @param stationCodeTable the new station code table
*/
- public void setStationCodeTable(CodeTableType stationCodeTable);
+ public void setStationCodeTable(IStationCodeTable stationCodeTable);
/**
* Gets the from station code where the delay was final (usually the station where the traveler left the train).
diff --git a/src/org/uic/ticket/api/spec/IFipTicket.java b/src/org/uic/ticket/api/spec/IFipTicket.java index 73cbc0e..a63c1d1 100644 --- a/src/org/uic/ticket/api/spec/IFipTicket.java +++ b/src/org/uic/ticket/api/spec/IFipTicket.java @@ -6,9 +6,7 @@ package org.uic.ticket.api.spec; import java.util.Collection;
import java.util.Date;
-import org.uic.ticket.api.asn.omv1.TravelClassType;
-// TODO: Auto-generated Javadoc
/**
* The Interface IFipTicket.
*
@@ -66,14 +64,14 @@ public interface IFipTicket extends IDocumentData { *
* @return the travel class code
*/
- public TravelClassType getClassCode();
+ public ITravelClassType getClassCode();
/**
* Sets the class code.
*
* @param classCode the new class code
*/
- public void setClassCode(TravelClassType classCode);
+ public void setClassCode(ITravelClassType classCode);
/**
* Gets the valid from date.
diff --git a/src/org/uic/ticket/api/spec/IGeoCoordinate.java b/src/org/uic/ticket/api/spec/IGeoCoordinate.java index 9fa1ba5..1bcfb90 100644 --- a/src/org/uic/ticket/api/spec/IGeoCoordinate.java +++ b/src/org/uic/ticket/api/spec/IGeoCoordinate.java @@ -3,10 +3,7 @@ */
package org.uic.ticket.api.spec;
-import org.uic.ticket.api.asn.omv1.GeoCoordinateSystemType;
-import org.uic.ticket.api.asn.omv1.GeoUnitType;
-import org.uic.ticket.api.asn.omv1.HemisphereLatitudeType;
-import org.uic.ticket.api.asn.omv1.HemisphereLongitudeType;
+
/**
* The Interface IGeoCoordinate.
@@ -23,7 +20,7 @@ public interface IGeoCoordinate { *
* @return the unit
*/
- public GeoUnitType getUnit();
+ public IGeoUnitType getUnit();
/**
* Sets the unit.
@@ -32,21 +29,21 @@ public interface IGeoCoordinate { *
* @param unit the new unit
*/
- public void setUnit(GeoUnitType unit);
+ public void setUnit(IGeoUnitType unit);
/**
* Gets the accuracy.
*
* @return the accuracy
*/
- public GeoUnitType getAccuracy();
+ public IGeoUnitType getAccuracy();
/**
* Sets the accuracy.
*
* @param accuracy the new accuracy
*/
- public void setAccuracy(GeoUnitType accuracy);
+ public void setAccuracy(IGeoUnitType accuracy);
/**
* Gets the geo coordinate system.
@@ -55,7 +52,7 @@ public interface IGeoCoordinate { *
* @return the geo coordinate
*/
- public GeoCoordinateSystemType getSystem();
+ public IGeoCoordinateSystemType getSystem();
/**
* Sets the geo coordinate
@@ -64,14 +61,14 @@ public interface IGeoCoordinate { *
* @param system the new geo coordinate
*/
- public void setSystem(GeoCoordinateSystemType system);
+ public void setSystem(IGeoCoordinateSystemType system);
/**
* Gets the longitude hemisphere.
*
* @return the longitude hemisphere
*/
- public HemisphereLongitudeType getHemisphereLongitude() ;
+ public IHemisphereLongitudeType getHemisphereLongitude() ;
/**
* Sets the longitude hemisphere.
@@ -80,7 +77,7 @@ public interface IGeoCoordinate { *
* @param hemispherLongiture the new longitude hemisphere.
*/
- public void setHemisphereLongitude(HemisphereLongitudeType hemispherLongiture);
+ public void setHemisphereLongitude(IHemisphereLongitudeType hemispherLongiture);
/**
* Gets the latitude hemisphere.
@@ -89,7 +86,7 @@ public interface IGeoCoordinate { *
* @return the latitude hemisphere.
*/
- public HemisphereLatitudeType getHemisphereLatitude();
+ public IHemisphereLatitudeType getHemisphereLatitude();
/**
* Sets the latitude hemisphere.
@@ -98,7 +95,7 @@ public interface IGeoCoordinate { *
* @param hemisphereLatitude the new latitude hemisphere.
*/
- public void setHemisphereLatitude(HemisphereLatitudeType hemisphereLatitude);
+ public void setHemisphereLatitude(IHemisphereLatitudeType hemisphereLatitude);
/**
* Gets the longitude.
diff --git a/src/org/uic/ticket/api/spec/IIncludedOpenTicket.java b/src/org/uic/ticket/api/spec/IIncludedOpenTicket.java index ab9ee81..359a7e7 100644 --- a/src/org/uic/ticket/api/spec/IIncludedOpenTicket.java +++ b/src/org/uic/ticket/api/spec/IIncludedOpenTicket.java @@ -6,8 +6,6 @@ package org.uic.ticket.api.spec; import java.util.Collection;
import java.util.Date;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
-import org.uic.ticket.api.asn.omv1.TravelClassType;
/**
* The Interface IIncludedOpenTicket.
@@ -118,7 +116,7 @@ public interface IIncludedOpenTicket { *
* @return the station code table
*/
- public CodeTableType getStationCodeTable();
+ public IStationCodeTable getStationCodeTable();
/**
* Sets the station code table.
@@ -129,7 +127,7 @@ public interface IIncludedOpenTicket { *
* @param stationCodeTable the new station code table
*/
- public void setStationCodeTable(CodeTableType stationCodeTable);
+ public void setStationCodeTable(IStationCodeTable stationCodeTable);
/**
* Gets the from station code.
@@ -248,14 +246,14 @@ public interface IIncludedOpenTicket { *
* @return the travel class code
*/
- public TravelClassType getClassCode();
+ public ITravelClassType getClassCode();
/**
* Sets the travel class code.
*
* @param classCode the new travel class code
*/
- public void setClassCode(TravelClassType classCode);
+ public void setClassCode(ITravelClassType classCode);
/**
* Gets the carriers included in the transport contract.
@@ -311,6 +309,47 @@ public interface IIncludedOpenTicket { */
public void addExcludedServiceBrand(Integer excludedServiceBrand);
+
+ /**
+ * Gets the list of excluded Transport Types.
+ *
+ * The list should be omitted in case a complete
+ * list of included transport types is provided.
+ *
+ * @return the list of excluded transport types
+ */
+ public Collection<Integer> getExcludedTransportTypes();
+
+ /**
+ * Adds an excluded service brand.
+ *
+ * The list should be omitted in case a complete
+ * list of included TransportTypes is provided.
+ *
+ * @param excluded TransportType the excluded TransportTypes
+ */
+ public void addExcludedTransportType(Integer excludedTransportType);
+
+
+ /**
+ * Gets the list of excluded Transport Types.
+ *
+ * The list should be omitted in case a complete
+ * list of included transport types is provided.
+ *
+ * @return the list of included transport types
+ */
+ public Collection<Integer> getIncludedTransportTypes();
+
+ /**
+ * Adds an excluded service brand.
+ *
+ * The list should be omitted in case a complete
+ * list of included TransportTypes is provided.
+ *
+ * @param excluded TransportType the excluded TransportTypes
+ */
+ public void addInludedTransportType(Integer includedTransportType);
/**
* Gets the tariffs.
diff --git a/src/org/uic/ticket/api/spec/IIssuingDetail.java b/src/org/uic/ticket/api/spec/IIssuingDetail.java index afe309d..1baaaae 100644 --- a/src/org/uic/ticket/api/spec/IIssuingDetail.java +++ b/src/org/uic/ticket/api/spec/IIssuingDetail.java @@ -5,7 +5,7 @@ package org.uic.ticket.api.spec; import java.util.Date;
-// TODO: Auto-generated Javadoc
+
/**
* The Interface IIssuerDetails.
*/
diff --git a/src/org/uic/ticket/api/spec/ILine.java b/src/org/uic/ticket/api/spec/ILine.java index f1066f2..266d781 100644 --- a/src/org/uic/ticket/api/spec/ILine.java +++ b/src/org/uic/ticket/api/spec/ILine.java @@ -5,9 +5,8 @@ package org.uic.ticket.api.spec; import java.util.HashSet;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
-// TODO: Auto-generated Javadoc
+
/**
* The Interface ILine.
*/
@@ -46,14 +45,14 @@ public interface ILine extends IRegionalValidity{ *
* @return the station code table
*/
- public CodeTableType getStationCodeTable();
+ public IStationCodeTable getStationCodeTable();
/**
* Sets the station code table.
*
* @param stationCodeTable the new station code table
*/
- public void setStationCodeTable(CodeTableType stationCodeTable);
+ public void setStationCodeTable( IStationCodeTable stationCodeTable);
/**
* Gets the entry station.
diff --git a/src/org/uic/ticket/api/spec/IOpenTicket.java b/src/org/uic/ticket/api/spec/IOpenTicket.java index f5bb7d2..ea16dce 100644 --- a/src/org/uic/ticket/api/spec/IOpenTicket.java +++ b/src/org/uic/ticket/api/spec/IOpenTicket.java @@ -6,8 +6,6 @@ package org.uic.ticket.api.spec; import java.util.Collection;
import java.util.Date;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
-import org.uic.ticket.api.asn.omv1.TravelClassType;
// TODO: Auto-generated Javadoc
/**
@@ -123,7 +121,7 @@ public interface IOpenTicket extends IDocumentData { *
* @return the station code table
*/
- public CodeTableType getStationCodeTable();
+ public IStationCodeTable getStationCodeTable();
/**
* Sets the station code table.
@@ -134,7 +132,7 @@ public interface IOpenTicket extends IDocumentData { *
* @param stationCodeTable the new station code table
*/
- public void setStationCodeTable(CodeTableType stationCodeTable);
+ public void setStationCodeTable( IStationCodeTable stationCodeTable);
/**
* Gets the from station code.
@@ -287,14 +285,14 @@ public interface IOpenTicket extends IDocumentData { *
* @return the travel class code
*/
- public TravelClassType getClassCode();
+ public ITravelClassType getClassCode();
/**
* Sets the travel class code.
*
* @param classCode the new travel class code
*/
- public void setClassCode(TravelClassType classCode);
+ public void setClassCode(ITravelClassType classCode);
/**
* Gets the carriers included in the transport contract.
@@ -350,6 +348,51 @@ public interface IOpenTicket extends IDocumentData { */
public void addExcludedServiceBrand(Integer excludedServiceBrand);
+
+
+
+ /**
+ * Gets the list of excluded Transport Types.
+ *
+ * The list should be omitted in case a complete
+ * list of included transport types is provided.
+ *
+ * @return the list of excluded transport types
+ */
+ public Collection<Integer> getExcludedTransportTypes();
+
+ /**
+ * Adds an excluded service brand.
+ *
+ * The list should be omitted in case a complete
+ * list of included TransportTypes is provided.
+ *
+ * @param excluded TransportType the excluded TransportTypes
+ */
+ public void addExcludedTransportType(Integer excludedTransportType);
+
+
+ /**
+ * Gets the list of excluded Transport Types.
+ *
+ * The list should be omitted in case a complete
+ * list of included transport types is provided.
+ *
+ * @return the list of included transport types
+ */
+ public Collection<Integer> getIncludedTransportTypes();
+
+ /**
+ * Adds an excluded service brand.
+ *
+ * The list should be omitted in case a complete
+ * list of included TransportTypes is provided.
+ *
+ * @param excluded TransportType the excluded TransportTypes
+ */
+ public void addInludedTransportType(Integer includedTransportType);
+
+
/**
* Gets the tariffs.
*
diff --git a/src/org/uic/ticket/api/spec/IParkingGround.java b/src/org/uic/ticket/api/spec/IParkingGround.java index 55cd55b..ae5c8cf 100644 --- a/src/org/uic/ticket/api/spec/IParkingGround.java +++ b/src/org/uic/ticket/api/spec/IParkingGround.java @@ -6,7 +6,6 @@ package org.uic.ticket.api.spec; import java.util.Collection;
import java.util.Date;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
/**
@@ -175,14 +174,14 @@ public interface IParkingGround extends IDocumentData { *
* @return the station code table
*/
- public CodeTableType getStationCodeTable();
+ public IStationCodeTable getStationCodeTable();
/**
* Sets the station code table.
*
* @param stationCodeTable the new station code table
*/
- public void setStationCodeTable(CodeTableType stationCodeTable);
+ public void setStationCodeTable( IStationCodeTable stationCodeTable);
/**
* Gets the product owner.
diff --git a/src/org/uic/ticket/api/spec/IPass.java b/src/org/uic/ticket/api/spec/IPass.java index 339b842..bcbcda7 100644 --- a/src/org/uic/ticket/api/spec/IPass.java +++ b/src/org/uic/ticket/api/spec/IPass.java @@ -6,9 +6,6 @@ package org.uic.ticket.api.spec; import java.util.Collection;
import java.util.Date;
-import org.uic.ticket.api.asn.omv1.TravelClassType;
-
-// TODO: Auto-generated Javadoc
/**
* The Interface IPass.
*
@@ -100,14 +97,14 @@ public interface IPass extends IDocumentData { *
* @return the class code
*/
- public TravelClassType getClassCode();
+ public ITravelClassType getClassCode();
/**
* Sets the travel class code.
*
* @param classCode the new travel class code
*/
- public void setClassCode(TravelClassType classCode);
+ public void setClassCode(ITravelClassType classCode);
/**
* Gets the valid from date and time.
diff --git a/src/org/uic/ticket/api/spec/IReservation.java b/src/org/uic/ticket/api/spec/IReservation.java index 3ec90da..ae68051 100644 --- a/src/org/uic/ticket/api/spec/IReservation.java +++ b/src/org/uic/ticket/api/spec/IReservation.java @@ -6,11 +6,6 @@ package org.uic.ticket.api.spec; import java.util.Collection;
import java.util.Date;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
-import org.uic.ticket.api.asn.omv1.PriceTypeType;
-import org.uic.ticket.api.asn.omv1.ServiceType;
-import org.uic.ticket.api.asn.omv1.TravelClassType;
-
/**
* The Interface IReservation.
@@ -136,7 +131,7 @@ public interface IReservation extends IDocumentData { *
* @return the service
*/
- public ServiceType getService();
+ public IServiceType getService();
/**
* Sets the service.
@@ -145,7 +140,7 @@ public interface IReservation extends IDocumentData { *
* @param service the new service
*/
- public void setService(ServiceType service);
+ public void setService(IServiceType service);
/**
@@ -153,7 +148,7 @@ public interface IReservation extends IDocumentData { *
* @return the station code table
*/
- public CodeTableType getStationCodeTable();
+ public IStationCodeTable getStationCodeTable();
/**
* Gets the station code table.
@@ -163,7 +158,7 @@ public interface IReservation extends IDocumentData { *
* @return the station code table
*/
- public void setStationCodeTable(CodeTableType stationCodeTable);
+ public void setStationCodeTable(IStationCodeTable stationCodeTable);
/**
* Gets the from station code.
@@ -240,14 +235,14 @@ public interface IReservation extends IDocumentData { *
* @return the travel class code
*/
- public TravelClassType getClassCode();
+ public ITravelClassType getClassCode();
/**
* Sets the travel class code.
*
* @param classCode the new travel class code
*/
- public void setClassCode(TravelClassType classCode);
+ public void setClassCode(ITravelClassType classCode);
/**
* Gets the service level.
@@ -371,14 +366,14 @@ public interface IReservation extends IDocumentData { *
* @return the price type
*/
- public PriceTypeType getPriceType();
+ public IPriceTypeType getPriceType();
/**
* Sets the price type.
*
* @param priceType the new price type
*/
- public void setPriceType(PriceTypeType priceType) ;
+ public void setPriceType(IPriceTypeType priceType) ;
/**
* Gets the type of supplement.
diff --git a/src/org/uic/ticket/api/spec/IRouteSection.java b/src/org/uic/ticket/api/spec/IRouteSection.java index ef93426..2768072 100644 --- a/src/org/uic/ticket/api/spec/IRouteSection.java +++ b/src/org/uic/ticket/api/spec/IRouteSection.java @@ -3,7 +3,6 @@ */
package org.uic.ticket.api.spec;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
/**
* The Interface IRouteSection.
@@ -17,14 +16,14 @@ public interface IRouteSection { *
* @return the station code table
*/
- public CodeTableType getStationCodeTable();
+ public IStationCodeTable getStationCodeTable();
/**
* Sets the station code table.
*
* @param stationCodeTable the new station code table
*/
- public void setStationCodeTable(CodeTableType stationCodeTable);
+ public void setStationCodeTable(IStationCodeTable stationCodeTable);
/**
* Gets the from station code.
diff --git a/src/org/uic/ticket/api/spec/IStationPassage.java b/src/org/uic/ticket/api/spec/IStationPassage.java index c98b83d..21113a9 100644 --- a/src/org/uic/ticket/api/spec/IStationPassage.java +++ b/src/org/uic/ticket/api/spec/IStationPassage.java @@ -6,9 +6,7 @@ package org.uic.ticket.api.spec; import java.util.Collection;
import java.util.Date;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
-// TODO: Auto-generated Javadoc
/**
* The Interface IStationPassage.
*
@@ -92,14 +90,14 @@ public interface IStationPassage extends IDocumentData { *
* @return the station code table
*/
- public CodeTableType getStationCodeTable();
+ public IStationCodeTable getStationCodeTable();
/**
* Sets the station code table.
*
* @param stationCodeTable the new station code table
*/
- public void setStationCodeTable(CodeTableType stationCodeTable);
+ public void setStationCodeTable(IStationCodeTable stationCodeTable);
/**
* Gets the list of station codes of all stations where the passage is allowed.
diff --git a/src/org/uic/ticket/api/spec/ITariff.java b/src/org/uic/ticket/api/spec/ITariff.java index 5bd4a15..fa69624 100644 --- a/src/org/uic/ticket/api/spec/ITariff.java +++ b/src/org/uic/ticket/api/spec/ITariff.java @@ -5,9 +5,6 @@ package org.uic.ticket.api.spec; import java.util.Collection;
-import org.uic.ticket.api.asn.omv1.PassengerType;
-
-// TODO: Auto-generated Javadoc
/**
* The Interface ITariff.
*
@@ -38,7 +35,7 @@ public interface ITariff { *
* @return the passenger type
*/
- public PassengerType getPassengerType();
+ public IPassengerType getPassengerType();
/**
@@ -46,7 +43,7 @@ public interface ITariff { *
* @param passengerType the new passenger type
*/
- public void setPassengerType(PassengerType passengerType);
+ public void setPassengerType(IPassengerType passengerType);
/**
* Gets the upper limit of the age of the passenger to qualify for that tariff.
diff --git a/src/org/uic/ticket/api/spec/ITicketLink.java b/src/org/uic/ticket/api/spec/ITicketLink.java index 2c180c4..563f189 100644 --- a/src/org/uic/ticket/api/spec/ITicketLink.java +++ b/src/org/uic/ticket/api/spec/ITicketLink.java @@ -3,8 +3,6 @@ */
package org.uic.ticket.api.spec;
-import org.uic.ticket.api.asn.omv1.LinkMode;
-import org.uic.ticket.api.asn.omv1.TicketType;
/**
* The Interface ITicketLink.
@@ -60,28 +58,28 @@ public interface ITicketLink { *
* @return the ticket type
*/
- public TicketType getTicketType();
+ public ITicketType getTicketType();
/**
* Sets the ticket type.
*
* @param ticketType the new ticket type
*/
- public void setTicketType(TicketType ticketType);
+ public void setTicketType(ITicketType ticketType);
/**
* Gets the link mode.
*
* @return the link mode
*/
- public LinkMode getLinkMode();
+ public ILinkMode getLinkMode();
/**
* Sets the link mode.
*
* @param linkMode the new link mode
*/
- public void setLinkMode(LinkMode linkMode);
+ public void setLinkMode(ILinkMode linkMode);
/**
* Gets the issuer PNR.
diff --git a/src/org/uic/ticket/api/spec/ITraveler.java b/src/org/uic/ticket/api/spec/ITraveler.java index b3d6480..498a7e3 100644 --- a/src/org/uic/ticket/api/spec/ITraveler.java +++ b/src/org/uic/ticket/api/spec/ITraveler.java @@ -6,10 +6,7 @@ package org.uic.ticket.api.spec; import java.util.Collection;
import java.util.Date;
-import org.uic.ticket.api.asn.omv1.GenderType;
-import org.uic.ticket.api.asn.omv1.PassengerType;
-// TODO: Auto-generated Javadoc
/**
* The Interface ITravelerData.
*
@@ -107,14 +104,14 @@ public interface ITraveler { *
* @return the gender
*/
- public GenderType getGender();
+ public IGenderType getGender();
/**
* Sets the gender.
*
* @param gender the new gender
*/
- public void setGender(GenderType gender);
+ public void setGender(IGenderType gender);
/**
* Gets the customer id.
@@ -163,14 +160,14 @@ public interface ITraveler { *
* @return the passenger type
*/
- public PassengerType getPassengerType();
+ public IPassengerType getPassengerType();
/**
* Sets the passenger type.
*
* @param passengerType the new passenger type
*/
- public void setPassengerType(PassengerType passengerType);
+ public void setPassengerType(IPassengerType passengerType);
/**
* Checks if is passenger with reduced mobility.
diff --git a/src/org/uic/ticket/api/spec/IViaStation.java b/src/org/uic/ticket/api/spec/IViaStation.java index 71ffbbc..aa10a01 100644 --- a/src/org/uic/ticket/api/spec/IViaStation.java +++ b/src/org/uic/ticket/api/spec/IViaStation.java @@ -5,9 +5,7 @@ package org.uic.ticket.api.spec; import java.util.Collection;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
-// TODO: Auto-generated Javadoc
/**
* The Interface IViaStation.
*
@@ -42,7 +40,7 @@ public interface IViaStation extends IRegionalValidity { *
* @return the station code table
*/
- public CodeTableType getStationCodeTable();
+ public IStationCodeTable getStationCodeTable();
/**
* Sets the station code table.
@@ -56,7 +54,7 @@ public interface IViaStation extends IRegionalValidity { *
* @param stationCodeTable the new station code table
*/
- public void setStationCodeTable(CodeTableType stationCodeTable);
+ public void setStationCodeTable(IStationCodeTable stationCodeTable);
/**
* Gets the station code.
diff --git a/src/org/uic/ticket/api/spec/IZone.java b/src/org/uic/ticket/api/spec/IZone.java index 296ecbb..3da96c4 100644 --- a/src/org/uic/ticket/api/spec/IZone.java +++ b/src/org/uic/ticket/api/spec/IZone.java @@ -5,9 +5,6 @@ package org.uic.ticket.api.spec; import java.util.Collection;
-import org.uic.ticket.api.asn.omv1.CodeTableType;
-
-// TODO: Auto-generated Javadoc
/**
* The Interface IZone.
*
@@ -36,14 +33,14 @@ public interface IZone extends IRegionalValidity{ *
* @return the station code table
*/
- public CodeTableType getStationCodeTable();
+ public IStationCodeTable getStationCodeTable();
/**
* Sets the station code table.
*
* @param stationCodeTable the new station code table
*/
- public void setStationCodeTable(CodeTableType stationCodeTable);
+ public void setStationCodeTable(IStationCodeTable stationCodeTable);
/**
* Gets the entry station in case the journey in the zone has to start at a specific station in the zone
diff --git a/src/org/uic/ticket/api/test/UperEncodeTicketTestV1.java b/src/org/uic/ticket/api/test/UperEncodeTicketTestV1.java index 9fed854..621dedb 100644 --- a/src/org/uic/ticket/api/test/UperEncodeTicketTestV1.java +++ b/src/org/uic/ticket/api/test/UperEncodeTicketTestV1.java @@ -205,8 +205,7 @@ DA016405 07B4 @Test public void testEncodeTicket() throws IllegalArgumentException, IllegalAccessException { - UicRailTicketData ticket = new UicRailTicketData(); - populateTicket(ticket); + UicRailTicketData ticket = SimpleUicTestTicket.getUicTestTicket(); byte[] encoded = UperEncoder.encode(ticket); String hex = UperEncoder.hexStringFromBytes(encoded); UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); @@ -219,8 +218,7 @@ DA016405 07B4 } @Test public void testDecodeTicket() throws IllegalArgumentException, IllegalAccessException { - UicRailTicketData ticket = new UicRailTicketData(); - populateTicket(ticket); + UicRailTicketData ticket = SimpleUicTestTicket.getUicTestTicket(); byte[] encoded = UperEncoder.encode(ticket); String hex = UperEncoder.hexStringFromBytes(encoded); UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); @@ -232,219 +230,6 @@ DA016405 07B4 assertEquals(decodedTicket.controlDetail.getInfoText() , "cd" ); assertEquals(decodedTicket.controlDetail.getIncludedTickets().get(0).getProductOwnerIA5() , "test" ); assert(decodedTicket.controlDetail.getIdentificationByCardReference().get(0).getTrailingCardIdNum() == 100L ); - } - - private void populateTicket(UicRailTicketData ticket) { - - ticket.setControlDetail(new ControlData()); - populate(ticket.getControlDetail()); - - - ticket.setIssuingDetail(new IssuingData()); - populateIssuingData(ticket.getIssuingDetail()); - - TravelerData td = new TravelerData(); - populateTravelerData(td); - ticket.setTravelerDetail(td); - - SequenceOfDocumentData ds = new SequenceOfDocumentData(); - - - //OpenTicket - DocumentData do1 = new DocumentData(); - addOpenTicketData(do1); - ds.add(do1); - - //StationPassage - DocumentData do2 = new DocumentData(); - addStationPassage(do2); - ds.add(do2); - - ticket.setTransportDocument(ds); - - SequenceOfExtensionData ed = new SequenceOfExtensionData(); - populateExtensionSequence(ed); - ticket.setExtension(ed); - - } - - /* - ticket stationPassage : { - productName "passage" - ,stationNameUTF8 { "Amsterdam" } - ,validFromDay 0 - ,numberOfDaysValid 123 - } - */ - private void addStationPassage(DocumentData dd) { - TicketDetailData tdd = new TicketDetailData(); - StationPassageData sp = new StationPassageData(); - sp.setProductName("passage"); - sp.setValidFromDay(0L); - sp.setNumberOfDaysValid(123L); - SequenceOfStringUTF8 ss = new SequenceOfStringUTF8(); - ss.add("Amsterdam"); - sp.setStationNameUTF8(ss); - tdd.setStationPassage(sp); - dd.setTicket(tdd); - } - - /* - { - token {tokenProviderIA5 "VDV", token '82DA'H } - ,ticket openTicket : { - returnIncluded FALSE - infoText "openTicketInfo" - } - } - */ - - private void addOpenTicketData(DocumentData dd) { - TokenType to = new TokenType(); - to.setTokenProviderIA5("VDV"); - byte[] ba = { (byte) 0x82, (byte) 0xDA }; - to.setToken(ba); - dd.setToken(to); - - TicketDetailData tdd = new TicketDetailData(); - OpenTicketData otd = new OpenTicketData(); - otd.setInfoText("openTicketInfo"); - otd.setReturnIncluded(false); - tdd.setOpenTicket(otd); - dd.setTicket(tdd); - } - - - /* - ,travelerDetail{ - traveler { - { - firstName "John" - ,secondName "Dow" - ,idCard "12345" - ,ticketHolder TRUE - ,status {{customerStatusDescr "senior" }} - } - } - ,groupName "myGroup" - } - */ - - private void populateTravelerData(TravelerData td) { - td.setGroupName("myGroup"); - SequenceOfTravelerType trs = new SequenceOfTravelerType(); - TravelerType tr = new TravelerType(); - tr.setIdCard("12345"); - tr.setFirstName("John"); - tr.setSecondName("Dow"); - tr.setTicketHolder(true); - SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType(); - CustomerStatusType cst = new CustomerStatusType(); - cst.setCustomerStatusDescr("senior"); - ts.add(cst); - tr.setStatus(ts); - trs.add(tr); - td.setTraveler(trs); - } - - /* - ,issuingDetail { - issuingYear 2018 - issuingDay 1 - specimen TRUE, - securePaperTicket FALSE, - activated TRUE, - issuerPNR "issuerTestPNR", - issuedOnLine 12 - } - */ - private void populateIssuingData(IssuingData issuingDetail) { - issuingDetail.setIssuingYear(2018L); - issuingDetail.setIssuingDay(1L); - issuingDetail.setIssuerPNR("issuerTestPNR"); - issuingDetail.setSpecimen(true); - issuingDetail.setSecurePaperTicket(false); - issuingDetail.setActivated(true); - issuingDetail.setIssuedOnLine(12L); - } - - /* - ,extension { - { extensionId "1", extensionData '82DA'H } - ,{ extensionId "2", extensionData '83DA'H } - } - */ - private void populateExtensionSequence(SequenceOfExtensionData ed) { - ExtensionData ed1 = new ExtensionData(); - ed1.setExtensionId("1"); - byte[] ba1 = { (byte) 0x82, (byte) 0xDA }; - ed1.setExtensionData(ba1); - ExtensionData ed2 = new ExtensionData(); - ed2.setExtensionId("2"); - byte[] ba2 = { (byte) 0x83, (byte) 0xDA }; - ed2.setExtensionData(ba2); - ed.add(ed1); - ed.add(ed2); - } - - /* - ,controlDetail { - identificationByCardReference { - { trailingCardIdNum 100 } - } - ,identificationByIdCard FALSE - ,identificationByPassportId FALSE - ,passportValidationRequired FALSE - ,onlineValidationRequired FALSE - ,ageCheckRequired FALSE - ,reductionCardCheckRequired FALSE - ,infoText "cd" - ,includedTickets { - { productOwnerIA5 "test" } - } - } - */ - private void populate(ControlData controlDetail) { - controlDetail.infoText = "cd"; - controlDetail.setAgeCheckRequired(false); - controlDetail.setIdentificationByIdCard(false); - controlDetail.setIdentificationByPassportId(false); - controlDetail.setOnlineValidationRequired(false); - controlDetail.setPassportValidationRequired(false); - controlDetail.setReductionCardCheckRequired(false); - controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType()); - controlDetail.getIdentificationByCardReference().add(populateCardRefrence()); - SequenceOfTicketLinkType sit = new SequenceOfTicketLinkType(); - populateIncludedTickets(sit); - controlDetail.setIncludedTickets(sit); - } - - - /* - * - */ - private void populateIncludedTickets(SequenceOfTicketLinkType sequenceOfTicketLinkType) { - TicketLinkType tlt = new TicketLinkType(); - tlt.productOwnerIA5="test"; - sequenceOfTicketLinkType.add(tlt); - } - - /* - { - trailingCardIdNum 100 - } - */ - private CardReferenceType populateCardRefrence() { - CardReferenceType cr = new CardReferenceType(); - cr.setTrailingCardIdNum(100L); - return cr; - } - - - - - - - + } } diff --git a/src/org/uic/ticket/api/utils/Api2OpenAsnEncoder.java b/src/org/uic/ticket/api/utils/Api2OpenAsnEncoder.java index cb274c1..ba2f13a 100644 --- a/src/org/uic/ticket/api/utils/Api2OpenAsnEncoder.java +++ b/src/org/uic/ticket/api/utils/Api2OpenAsnEncoder.java @@ -10,7 +10,7 @@ import net.gcdc.asn1.datatypesimpl.SequenceOfStringIA5; import net.gcdc.asn1.datatypesimpl.SequenceOfStringUTF8;
import net.gcdc.asn1.datatypesimpl.SequenceOfUnrestrictedLong;
-import org.uic.ticket.api.EncodingFormatException;
+import org.uic.ticket.EncodingFormatException;
import org.uic.ticket.api.asn.omv1.BerthDetailData;
import org.uic.ticket.api.asn.omv1.CarCarriageReservationData;
import org.uic.ticket.api.asn.omv1.CardReferenceType;
@@ -90,10 +90,12 @@ import org.uic.ticket.api.asn.omv1.VatDetailType; import org.uic.ticket.api.asn.omv1.ViaStationType;
import org.uic.ticket.api.asn.omv1.VoucherData;
import org.uic.ticket.api.asn.omv1.ZoneType;
+import org.uic.ticket.api.asn.omv1.BerthTypeType;
import org.uic.ticket.api.spec.IBerth;
import org.uic.ticket.api.spec.ICarCarriageReservation;
import org.uic.ticket.api.spec.ICardReference;
import org.uic.ticket.api.spec.ICompartmentDetails;
+import org.uic.ticket.api.spec.ICompartmentGenderType;
import org.uic.ticket.api.spec.IControlDetail;
import org.uic.ticket.api.spec.ICounterMark;
import org.uic.ticket.api.spec.ICustomerCard;
@@ -103,27 +105,38 @@ import org.uic.ticket.api.spec.IDocumentData; import org.uic.ticket.api.spec.IExtension;
import org.uic.ticket.api.spec.IFipTicket;
import org.uic.ticket.api.spec.IGeoCoordinate;
+import org.uic.ticket.api.spec.IGeoCoordinateSystemType;
+import org.uic.ticket.api.spec.IGeoUnitType;
+import org.uic.ticket.api.spec.IHemisphereLatitudeType;
+import org.uic.ticket.api.spec.IHemisphereLongitudeType;
import org.uic.ticket.api.spec.IIncludedOpenTicket;
import org.uic.ticket.api.spec.IIssuingDetail;
import org.uic.ticket.api.spec.ILine;
+import org.uic.ticket.api.spec.ILinkMode;
+import org.uic.ticket.api.spec.ILoadingDeckType;
import org.uic.ticket.api.spec.ILuggageRestriction;
import org.uic.ticket.api.spec.IOpenTicket;
import org.uic.ticket.api.spec.IParkingGround;
import org.uic.ticket.api.spec.IPass;
import org.uic.ticket.api.spec.IPlaces;
import org.uic.ticket.api.spec.IPolygone;
+import org.uic.ticket.api.spec.IPriceTypeType;
import org.uic.ticket.api.spec.IRegionalValidity;
import org.uic.ticket.api.spec.IRegisteredLuggage;
import org.uic.ticket.api.spec.IReservation;
import org.uic.ticket.api.spec.IReturnRouteDescription;
+import org.uic.ticket.api.spec.IRoofRackType;
import org.uic.ticket.api.spec.IRouteSection;
import org.uic.ticket.api.spec.ISeriesDataDetails;
+import org.uic.ticket.api.spec.IServiceType;
import org.uic.ticket.api.spec.IStationPassage;
import org.uic.ticket.api.spec.ITariff;
import org.uic.ticket.api.spec.ITicketLink;
+import org.uic.ticket.api.spec.ITicketType;
import org.uic.ticket.api.spec.ITimeRange;
import org.uic.ticket.api.spec.IToken;
import org.uic.ticket.api.spec.ITrainLink;
+import org.uic.ticket.api.spec.ITravelClassType;
import org.uic.ticket.api.spec.ITraveler;
import org.uic.ticket.api.spec.ITravelerDetail;
import org.uic.ticket.api.spec.IUicRailTicket;
@@ -133,6 +146,7 @@ import org.uic.ticket.api.spec.IVatDetail; import org.uic.ticket.api.spec.IViaStation;
import org.uic.ticket.api.spec.IVoucher;
import org.uic.ticket.api.spec.IZone;
+import org.uic.ticket.api.spec.IStationCodeTable;
/**
* The Class Api2OpenAsnEncoder.
@@ -141,6 +155,23 @@ public class Api2OpenAsnEncoder { /**
+ * encode to asn1 model.
+ *
+ * @param uicTicket the uic ticket
+ * @return the encoded byte array
+ * @throws EncodingFormatException the encoding format exception
+ */
+ public byte[] encode(IUicRailTicket uicTicket) throws EncodingFormatException {
+
+ UicRailTicketData asnUicRailTicketData = populateToAsn1Model(uicTicket);
+
+ return asnUicRailTicketData.encode();
+
+ }
+
+
+
+ /**
* Populate asn1 model.
*
* @param uicTicket the uic ticket
@@ -251,6 +282,8 @@ public class Api2OpenAsnEncoder { return asnTicket;
}
+
+
private DocumentData encodeDelayConfirmation(IDelayConfirmation document, Date issuingDate) throws EncodingFormatException {
DocumentData asnDocument = new DocumentData();
@@ -266,8 +299,8 @@ public class Api2OpenAsnEncoder { asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
- if (document.getStationCodeTable() != CodeTableType.stationUICReservation){
- asnData.setStationCodeTable(document.getStationCodeTable());
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
}
asnData.setStationIA5(UicEncoderUtils.getIA5NonNum(document.getStation()));
asnData.setStationNum(UicEncoderUtils.getNum(document.getStation()));
@@ -321,8 +354,8 @@ public class Api2OpenAsnEncoder { asnData.setReferenceNum(UicEncoderUtils.getNum(document.getReference()));
asnData.setReferenceIA5(UicEncoderUtils.getIA5NonNum(document.getReference()));
- if (document.getStationCodeTable() != CodeTableType.stationUICReservation){
- asnData.setStationCodeTable(document.getStationCodeTable());
+ if (document.getStationCodeTable() != IStationCodeTable.stationUICReservation && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
}
asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
@@ -333,8 +366,8 @@ public class Api2OpenAsnEncoder { asnData.setCompartmentDetails(encodeCompartmentDetails(document.getCompartmentDetails()));
- if (document.getPriceType()!= PriceTypeType.travelPrice){
- asnData.setPriceType(document.getPriceType());
+ if (document.getPriceType()!= IPriceTypeType.travelPrice && document.getPriceType() != null ){
+ asnData.setPriceType(PriceTypeType.valueOf(document.getPriceType().name()));
}
@@ -344,8 +377,8 @@ public class Api2OpenAsnEncoder { asnData.setServiceBrandNameUTF8(document.getServiceBrand().getServiceBrandDescription());
}
- if (document.getStationCodeTable() != CodeTableType.stationUICReservation){
- asnData.setStationCodeTable(document.getStationCodeTable());
+ if (document.getStationCodeTable() != IStationCodeTable.stationUICReservation && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
}
asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(document.getFromStation()));
@@ -362,8 +395,8 @@ public class Api2OpenAsnEncoder { asnData.setAttachedBoats(UicEncoderUtils.getRestrictedInt(document.getAttachedBoats(),1,2));
asnData.setAttachedSurfboards(UicEncoderUtils.getRestrictedInt(document.getAttachedSurfboards(),1,5));
- if (document.getLoadingDeck() != LoadingDeckType.upper){
- asnData.setLoadingDeck(document.getLoadingDeck());
+ if (document.getLoadingDeck() != ILoadingDeckType.upper && document.getLoadingDeck() != null){
+ asnData.setLoadingDeck(LoadingDeckType.valueOf(document.getLoadingDeck().name()));
}
asnData.setLoadingListEntry(UicEncoderUtils.getRestrictedInt(document.getAttachedSurfboards(),1,200));
@@ -374,8 +407,8 @@ public class Api2OpenAsnEncoder { asnData.setRoofRackHeight(UicEncoderUtils.getRestrictedInt(document.getRoofRackHeight(),1,99));
- if (document.getRoofRackType()!= RoofRackType.norack) {
- asnData.setRoofRackType(document.getRoofRackType());
+ if (document.getRoofRackType()!= IRoofRackType.norack && document.getRoofRackType() != null ) {
+ asnData.setRoofRackType(RoofRackType.valueOf(document.getRoofRackType().name()));
}
if (document.getTariff() != null) {
@@ -475,10 +508,12 @@ public class Api2OpenAsnEncoder { for ( IBerth berth : berths){
BerthDetailData asnBerth = new BerthDetailData();
- asnBerth.setBerthType(berth.getType());
+ if (berth.getType() != null) {
+ asnBerth.setBerthType(BerthTypeType.valueOf(berth.getType().name()));
+ }
- if (berth.getGender()!= CompartmentGenderType.family) {
- asnBerth.setGender(berth.getGender());
+ if (berth.getGender()!= ICompartmentGenderType.family && berth.getGender() != null) {
+ asnBerth.setGender(CompartmentGenderType.valueOf(berth.getGender().name()));
}
asnBerth.setNumberOfBerths(UicEncoderUtils.getRestrictedInt(berth.getNumberOfBerths(), 1 , 999 ));
@@ -521,8 +556,8 @@ public class Api2OpenAsnEncoder { asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
- if (document.getStationCodeTable() != CodeTableType.stationUICReservation){
- asnData.setStationCodeTable(document.getStationCodeTable());
+ if (document.getStationCodeTable() != IStationCodeTable.stationUICReservation && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
}
asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(document.getFromStation()));
@@ -550,8 +585,8 @@ public class Api2OpenAsnEncoder { - if (document.getClassCode() != TravelClassType.second){
- asnData.setClassCode(document.getClassCode());
+ if (document.getClassCode() != ITravelClassType.second){
+ asnData.setClassCode(convertTravelClass(document.getClassCode()));
}
asnData.setBerth(encodeBerths(document.getBerths()));
@@ -563,8 +598,8 @@ public class Api2OpenAsnEncoder { asnData.setNumberOfOverbooked(UicEncoderUtils.getRestrictedInt(document.getNumberOfOverbooked(), 1, 200));
asnData.setNumberOfSupplements(UicEncoderUtils.getRestrictedInt(document.getNumberOfSupplements(), 1, 200));
- if (document.getPriceType()!=PriceTypeType.travelPrice){
- asnData.setPriceType(document.getPriceType());
+ if (document.getPriceType()!= IPriceTypeType.travelPrice && document.getPriceType() != null){
+ asnData.setPriceType(PriceTypeType.valueOf(document.getPriceType().name()));
}
asnData.setTypeOfSupplement(UicEncoderUtils.getRestrictedInt(document.getTypeOfSupplement(), 1, 9));
@@ -572,8 +607,8 @@ public class Api2OpenAsnEncoder { asnData.setBicyclePlaces(encodePlaces(document.getBicyclePlaces()));
- if (document.getService() != ServiceType.seat) {
- asnData.setService(document.getService());
+ if (document.getService() != IServiceType.seat && document.getService() != null) {
+ asnData.setService(ServiceType.valueOf(document.getService().name()));
}
if (document.getServiceBrand()!= null) {
@@ -604,11 +639,11 @@ public class Api2OpenAsnEncoder { *
* @param tickets the tickets
* @param issuingDate the issuing date
- * @param classCode the class code
+ * @param travelClassType the class code
* @return the list
* @throws EncodingFormatException the encoding format exception
*/
- private SequenceOfIncludedOpenTicketType encodeIncludedAddons(Collection<IIncludedOpenTicket> tickets, Date issuingDate, TravelClassType classCode) throws EncodingFormatException {
+ private SequenceOfIncludedOpenTicketType encodeIncludedAddons(Collection<IIncludedOpenTicket> tickets, Date issuingDate, ITravelClassType travelClassType) throws EncodingFormatException {
if (tickets == null || tickets.isEmpty()) {
return null;
@@ -617,7 +652,7 @@ public class Api2OpenAsnEncoder { for ( IIncludedOpenTicket ticket : tickets){
- IncludedOpenTicketType asnTicket = encodeIncludedOpenTicket(ticket,issuingDate,classCode);
+ IncludedOpenTicketType asnTicket = encodeIncludedOpenTicket(ticket,issuingDate,travelClassType);
if (asnTicket!=null) {
asnList.add(asnTicket);
}
@@ -639,7 +674,7 @@ public class Api2OpenAsnEncoder { * @return the included open ticket type
* @throws EncodingFormatException the encoding format exception
*/
- private IncludedOpenTicketType encodeIncludedOpenTicket(IIncludedOpenTicket document, Date issuingDate, TravelClassType classCode) throws EncodingFormatException {
+ private IncludedOpenTicketType encodeIncludedOpenTicket(IIncludedOpenTicket document, Date issuingDate, ITravelClassType classCode) throws EncodingFormatException {
if (document == null) return null;
@@ -655,8 +690,8 @@ public class Api2OpenAsnEncoder { asnData.setInfoText(document.getInfoText());
asnData.setExtension(encodeExtension(document.getExtension()));
- if (document.getStationCodeTable() != CodeTableType.stationUIC){
- asnData.setStationCodeTable(document.getStationCodeTable());
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
}
asnData.setIncludedCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getIncludedCarriers())));
@@ -680,7 +715,7 @@ public class Api2OpenAsnEncoder { }
if (document.getClassCode() != classCode){
- asnData.setClassCode(document.getClassCode());
+ asnData.setClassCode(convertTravelClass(document.getClassCode()));
}
if (document.getExternalIssuer() > 0) {
asnData.setExternalIssuerId(new Long(document.getExternalIssuer()));
@@ -815,8 +850,8 @@ public class Api2OpenAsnEncoder { asnData.setInfoText(document.getInfoText());
asnData.setExtension(encodeExtension(document.getExtension()));
- if (document.getStationCodeTable() != CodeTableType.stationUIC){
- asnData.setStationCodeTable(document.getStationCodeTable());
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
}
asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(document.getFromStation()));
@@ -848,8 +883,8 @@ public class Api2OpenAsnEncoder { asnData.setActivatedDays(document.getActivatedDays(),document.getValidFrom());
- if (document.getClassCode() != TravelClassType.second){
- asnData.setClassCode(document.getClassCode());
+ if (document.getClassCode() != ITravelClassType.second){
+ asnData.setClassCode(convertTravelClass(document.getClassCode()));
}
if (document.getExternalIssuer()>0) {
asnData.setExtIssuerId(new Long(document.getExternalIssuer()));
@@ -918,8 +953,8 @@ public class Api2OpenAsnEncoder { asnData.setInfoText(document.getInfoText());
asnData.setExtension(encodeExtension(document.getExtension()));
- if (document.getStationCodeTable() != CodeTableType.stationUIC){
- asnData.setStationCodeTable(document.getStationCodeTable());
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
}
asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(document.getFromStation()));
@@ -948,8 +983,8 @@ public class Api2OpenAsnEncoder { asnData.setInfoText(document.getInfoText());
asnData.setExtension(encodeExtension(document.getExtension()));
- if (document.getStationCodeTable() != CodeTableType.stationUIC){
- asnData.setStationCodeTable(document.getStationCodeTable());
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
}
asnData.setFromStationIA5(UicEncoderUtils.getIA5NonNum(document.getFromStation()));
@@ -972,8 +1007,8 @@ public class Api2OpenAsnEncoder { }
asnData.setValidRegionDesc(document.getValidRegionDesc());
- if (document.getClassCode() != TravelClassType.second){
- asnData.setClassCode(document.getClassCode());
+ if (document.getClassCode() != ITravelClassType.second){
+ asnData.setClassCode(convertTravelClass(document.getClassCode()));
}
@@ -1022,37 +1057,37 @@ public class Api2OpenAsnEncoder { /**
* Encode via station.
*
- * @param data the data
+ * @param document the data
* @return the via station type
* @throws EncodingFormatException the encoding format exception
*/
- private ViaStationType encodeViaStation(IViaStation data) throws EncodingFormatException {
- if (data == null) return null;
+ private ViaStationType encodeViaStation(IViaStation document) throws EncodingFormatException {
+ if (document == null) return null;
ViaStationType asnData =new ViaStationType();
- if (data.getStationCodeTable() != CodeTableType.stationUIC){
- asnData.setStationCodeTable(data.getStationCodeTable());
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
}
- asnData.setStationIA5(UicEncoderUtils.getIA5NonNum(data.getStation()));
- asnData.setStationNum(UicEncoderUtils.getNum(data.getStation()));
+ asnData.setStationIA5(UicEncoderUtils.getIA5NonNum(document.getStation()));
+ asnData.setStationNum(UicEncoderUtils.getNum(document.getStation()));
- asnData.setAlternativeRoutes(encodeViaStationCollection(data.getAlternativeRoutes()));
+ asnData.setAlternativeRoutes(encodeViaStationCollection(document.getAlternativeRoutes()));
- if (data.isBorder()) {
+ if (document.isBorder()) {
asnData.setBorder(true);
} else {
asnData.setBorder(false);
}
- asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(data.getCarriers())));
- asnData.setCarriersIA5(UicEncoderUtils.getIA5NonNumList(data.getCarriers()));
+ asnData.setCarriersNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
+ asnData.setCarriersIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
- asnData.setRoute(encodeViaStationCollection(data.getRoute()));
+ asnData.setRoute(encodeViaStationCollection(document.getRoute()));
- if (data.getRouteId() > 0){
- asnData.setSeriesId(new Long(data.getRouteId()));
+ if (document.getRouteId() > 0){
+ asnData.setSeriesId(new Long(document.getRouteId()));
}
return asnData;
}
@@ -1075,8 +1110,8 @@ public class Api2OpenAsnEncoder { asnData.setCarrierNum(UicEncoderUtils.getNum(data.getCarrier()));
asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNum(data.getCarrier()));
- if (data.getStationCodeTable() != CodeTableType.stationUIC){
- asnData.setStationCodeTable(data.getStationCodeTable());
+ if (data.getStationCodeTable() != IStationCodeTable.stationUIC && data.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(data.getStationCodeTable().name()));
}
asnData.setEntryStationIA5(UicEncoderUtils.getIA5NonNum(data.getEntryStation()));
asnData.setEntryStationNum(UicEncoderUtils.getNum(data.getEntryStation()));
@@ -1181,8 +1216,8 @@ public class Api2OpenAsnEncoder { asnData.setBinaryZoneId(data.getBinaryZoneId());
asnData.setCarrierNum(UicEncoderUtils.getNum(data.getCarrier()));
asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNum(data.getCarrier()));
- if (data.getStationCodeTable() != CodeTableType.stationUIC){
- asnData.setStationCodeTable(data.getStationCodeTable());
+ if (data.getStationCodeTable() != IStationCodeTable.stationUIC && data.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(data.getStationCodeTable().name()));
}
asnData.setEntryStationIA5(UicEncoderUtils.getIA5NonNum(data.getEntryStation()));
asnData.setEntryStationNum(UicEncoderUtils.getNum(data.getEntryStation()));
@@ -1292,8 +1327,8 @@ public class Api2OpenAsnEncoder { asnData.setExtension(encodeExtension(document.getExtension()));
- if (document.getStationCodeTable() != CodeTableType.stationUIC){
- asnData.setStationCodeTable(document.getStationCodeTable());
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
}
asnData.setStationIA5(UicEncoderUtils.getIA5NonNum(document.getStation()));
@@ -1326,29 +1361,29 @@ public class Api2OpenAsnEncoder { /**
* Encode route section.
*
- * @param route the route
+ * @param document the route
* @return the route section type
* @throws EncodingFormatException the encoding format exception
*/
- private RouteSectionType encodeRouteSection(IRouteSection route) throws EncodingFormatException {
+ private RouteSectionType encodeRouteSection(IRouteSection document) throws EncodingFormatException {
- if (route == null) return null;
+ if (document == null) return null;
RouteSectionType asnRoute = new RouteSectionType();
- if (route.getStationCodeTable() != CodeTableType.stationUIC){
- asnRoute.setStationCodeTable(route.getStationCodeTable());
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnRoute.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
}
- asnRoute.setFromStationIA5(UicEncoderUtils.getIA5NonNum(route.getFromStation()));
- asnRoute.setFromStationNum(UicEncoderUtils.getNum(route.getFromStation()));
+ asnRoute.setFromStationIA5(UicEncoderUtils.getIA5NonNum(document.getFromStation()));
+ asnRoute.setFromStationNum(UicEncoderUtils.getNum(document.getFromStation()));
- asnRoute.setToStationIA5(UicEncoderUtils.getIA5NonNum(route.getToStation()));
- asnRoute.setToStationNum(UicEncoderUtils.getNum(route.getToStation()));
+ asnRoute.setToStationIA5(UicEncoderUtils.getIA5NonNum(document.getToStation()));
+ asnRoute.setToStationNum(UicEncoderUtils.getNum(document.getToStation()));
- asnRoute.setFromStationNameUTF8(route.getFromStationName());
- asnRoute.setToStationNameUTF8(route.getToStationName());
+ asnRoute.setFromStationNameUTF8(document.getFromStationName());
+ asnRoute.setToStationNameUTF8(document.getToStationName());
return asnRoute;
@@ -1407,8 +1442,9 @@ public class Api2OpenAsnEncoder { try {
- PassengerType passengerType = PassengerType.valueOf(tariff.getPassengerType().name());
- asnTariff.setPassengerType(passengerType);
+ if (tariff.getPassengerType() != null) {
+ asnTariff.setPassengerType(PassengerType.valueOf(tariff.getPassengerType().name()));
+ }
} catch (Exception e){
//no value found
}
@@ -1530,7 +1566,7 @@ public class Api2OpenAsnEncoder { }
}
- asnData.setClassCode(document.getClassCode());
+ asnData.setClassCode(convertTravelClass(document.getClassCode()));
if (document.getCountries() != null && document.getCountries().size() > 0){
asnData.setCountries(SequenceOfCountries.getSequence(UicEncoderUtils.encodeRestrictedIntegerCollection(document.getCountries(),1,250)));
@@ -1652,7 +1688,7 @@ public class Api2OpenAsnEncoder { asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
- asnData.setClassCode(document.getClassCode());
+ asnData.setClassCode(convertTravelClass(document.getClassCode()));
if (!document.isIncludesSupplements()){
asnData.setIncludesSupplements(false);
@@ -1702,8 +1738,8 @@ public class Api2OpenAsnEncoder { asnData.setProductName(document.getProductName());
- if (document.getStationCodeTable() != CodeTableType.stationUIC){
- asnData.setStationCodeTable(document.getStationCodeTable());
+ if (document.getStationCodeTable() != IStationCodeTable.stationUIC && document.getStationCodeTable() != null){
+ asnData.setStationCodeTable(CodeTableType.valueOf(document.getStationCodeTable().name()));
}
@@ -1908,12 +1944,12 @@ public class Api2OpenAsnEncoder { asnTicket.setReferenceNum(UicEncoderUtils.getNum(ticket.getReference()));
asnTicket.setReferenceIA5(UicEncoderUtils.getIA5NonNum(ticket.getReference()));
- if (ticket.getTicketType() != TicketType.openTicket){
- asnTicket.setTicketType(ticket.getTicketType());
+ if (ticket.getTicketType() != ITicketType.openTicket && ticket.getTicketType() != null){
+ asnTicket.setTicketType(TicketType.valueOf(ticket.getTicketType().name()));
}
- if (ticket.getLinkMode() != LinkMode.issuedTogether){
- asnTicket.setLinkMode(ticket.getLinkMode());
+ if (ticket.getLinkMode() != ILinkMode.issuedTogether && ticket.getLinkMode() != null){
+ asnTicket.setLinkMode(LinkMode.valueOf(ticket.getLinkMode().name()));
}
asnList.add(asnTicket);
@@ -1999,9 +2035,12 @@ public class Api2OpenAsnEncoder { asnData.setIssuedOnTrainNum(UicEncoderUtils.getNum(data.getIssuedOnTrain()));
asnData.setIssuedOnTrainIA5(UicEncoderUtils.getIA5NonNum(data.getIssuedOnTrain()));
-
- asnData.setSecurityProviderNum(UicEncoderUtils.getNum(data.getSecurityProvider()));
-
+ if (data.getSecurityProvider() != null) {
+ asnData.setSecurityProviderNum(UicEncoderUtils.getNum(data.getSecurityProvider()));
+ data.setSecurityProvider(data.getIssuer());
+ } else {
+ asnData.setSecurityProviderNum(UicEncoderUtils.getNum(data.getIssuer()));
+ }
if (data.getIssuer()!= null && !data.getIssuer().equals(data.getSecurityProvider()) ){
asnData.setIssuerNum(UicEncoderUtils.getNum(data.getIssuer()));
@@ -2042,22 +2081,24 @@ public class Api2OpenAsnEncoder { asnPoint.setLatitude(point.getLatitude());
asnPoint.setLongitude(point.getLongitude());
- if (point.getUnit() != GeoUnitType.milliDegree){
- asnPoint.setGeoUnit(point.getUnit());
+ if (point.getUnit() != IGeoUnitType.milliDegree && point.getUnit() != null){
+ asnPoint.setGeoUnit(GeoUnitType.valueOf(point.getUnit().name()));
}
- asnPoint.setAccuracy(point.getAccuracy());
+ if (point.getAccuracy() != null) {
+ asnPoint.setAccuracy(GeoUnitType.valueOf(point.getAccuracy().name()));
+ }
- if (point.getHemisphereLatitude() != HemisphereLatitudeType.east) {
- asnPoint.setHemisphereLatitude(point.getHemisphereLatitude());
+ if (point.getHemisphereLatitude() != IHemisphereLatitudeType.east && point.getHemisphereLatitude() != null) {
+ asnPoint.setHemisphereLatitude(HemisphereLatitudeType.valueOf(point.getHemisphereLatitude().name()));
}
- if (point.getHemisphereLongitude() != HemisphereLongitudeType.north) {
- asnPoint.setHemisphereLongitude(point.getHemisphereLongitude());
+ if (point.getHemisphereLongitude() != IHemisphereLongitudeType.north && point.getHemisphereLongitude() != null) {
+ asnPoint.setHemisphereLongitude(HemisphereLongitudeType.valueOf(point.getHemisphereLongitude().name()));
}
- if (point.getSystem() != GeoCoordinateSystemType.wgs84){
- asnPoint.setCoordinateSystem(point.getSystem());
+ if (point.getSystem() != IGeoCoordinateSystemType.wgs84 && point.getSystem() != null){
+ asnPoint.setCoordinateSystem(GeoCoordinateSystemType.valueOf(point.getSystem().name()));
}
return asnPoint;
@@ -2066,51 +2107,51 @@ public class Api2OpenAsnEncoder { /**
* Encode customer card.
*
- * @param customerCard the customer card
+ * @param document the customer card
* @param issuingDate the issuing date
* @return the document data
* @throws EncodingFormatException the encoding format exception
*/
- private DocumentData encodeCustomerCard(ICustomerCard customerCard,Date issuingDate) throws EncodingFormatException {
+ private DocumentData encodeCustomerCard(ICustomerCard document,Date issuingDate) throws EncodingFormatException {
DocumentData asnDocument = new DocumentData();
TicketDetailData asnTicket = new TicketDetailData();
asnDocument.setTicket(asnTicket);
- CustomerCardData asnCustomerCard = new CustomerCardData();
- asnDocument.getTicket().setCustomerCard(asnCustomerCard);
+ CustomerCardData asnData = new CustomerCardData();
+ asnDocument.getTicket().setCustomerCard(asnData);
- if (customerCard.getCardId() != null && customerCard.getCardId().length() > 0){
+ if (document.getCardId() != null && document.getCardId().length() > 0){
//only longs allowed
try {
- long num = Long.parseLong(customerCard.getCardId());
- asnCustomerCard.setCardIdNum(num);
+ long num = Long.parseLong(document.getCardId());
+ asnData.setCardIdNum(num);
} catch (Exception e ){
- asnCustomerCard.setCardIdIA5(customerCard.getCardId());
+ asnData.setCardIdIA5(document.getCardId());
}
}
- asnCustomerCard.setCardType(UicEncoderUtils.getRestrictedInt(customerCard.getCardType(),1,1000));
+ asnData.setCardType(UicEncoderUtils.getRestrictedInt(document.getCardType(),1,1000));
- asnCustomerCard.setCardTypeDescr(customerCard.getCardTypeDescr());
+ asnData.setCardTypeDescr(document.getCardTypeDescr());
- asnCustomerCard.setClassCode(customerCard.getClassCode());
+ asnData.setClassCode(convertTravelClass(document.getClassCode()));
- if (customerCard.getCustomer()!=null){
- asnCustomerCard.setCustomer(encodeTraveler(customerCard.getCustomer()));
+ if (document.getCustomer()!=null){
+ asnData.setCustomer(encodeTraveler(document.getCustomer()));
}
- asnCustomerCard.setCustomerStatus(UicEncoderUtils.getUnRestrictedInt(customerCard.getCustomerStatus()));
+ asnData.setCustomerStatus(UicEncoderUtils.getUnRestrictedInt(document.getCustomerStatus()));
- asnCustomerCard.setCustomerStatusDescr(customerCard.getCustomerStatusDescr());
+ asnData.setCustomerStatusDescr(document.getCustomerStatusDescr());
- asnCustomerCard.setExtension(encodeExtension(customerCard.getExtension()));
+ asnData.setExtension(encodeExtension(document.getExtension()));
- asnCustomerCard.setIncludedServices(SequenceOfUnrestrictedLong.getSequence(UicEncoderUtils.getUnRestrictedIntList(customerCard.getIncludedServices())));
+ asnData.setIncludedServices(SequenceOfUnrestrictedLong.getSequence(UicEncoderUtils.getUnRestrictedIntList(document.getIncludedServices())));
- asnCustomerCard.setValidity(customerCard.getValidFrom(), customerCard.getValidUntil());
+ asnData.setValidity(document.getValidFrom(), document.getValidUntil());
return asnDocument;
}
@@ -2168,18 +2209,16 @@ public class Api2OpenAsnEncoder { asnTraveler.setFirstName(traveler.getFirstName());
asnTraveler.setSecondName(traveler.getSecondName());
asnTraveler.setLastName(traveler.getLastName());
- asnTraveler.setGender(GenderType.valueOf(traveler.getGender().toString()));
+ if (traveler.getGender() != null) {
+ asnTraveler.setGender(GenderType.valueOf(traveler.getGender().name()));
+ }
asnTraveler.setIdCard(UicEncoderUtils.getIA5(traveler.getIdCard()));
asnTraveler.setPassportId(UicEncoderUtils.getIA5(traveler.getPassportId()));
asnTraveler.setTitle(UicEncoderUtils.getIA5(traveler.getTitle()));
- try {
- PassengerType passengerType = PassengerType.valueOf(traveler.getPassengerType().name());
- asnTraveler.setPassengerType(passengerType);
- } catch (Exception e){
- //no value found
+ if (traveler.getPassengerType() != null) {
+ asnTraveler.setPassengerType(PassengerType.valueOf(traveler.getPassengerType().name()));
}
-
asnTraveler.setPassengerWithReducedMobility(traveler.isPassengerWithReducedMobility());
if (traveler.isTicketHolder()){
@@ -2252,5 +2291,23 @@ public class Api2OpenAsnEncoder { return asnExtension;
}
+ private TravelClassType convertTravelClass(ITravelClassType apiClass){
+
+ if (apiClass == null) return null;
+
+ if (apiClass == ITravelClassType.premiumFirst || apiClass == ITravelClassType.standardFirst){
+ return TravelClassType.first;
+ }
+
+ if (apiClass == ITravelClassType.premiumSecond || apiClass == ITravelClassType.standardSecond){
+ return TravelClassType.second;
+ }
+
+
+ return TravelClassType.valueOf(apiClass.name());
+
+
+ }
+
}
diff --git a/src/org/uic/ticket/api/utils/OpenAsn2ApiDecoder.java b/src/org/uic/ticket/api/utils/OpenAsn2ApiDecoder.java index 4a5848d..61dfe6b 100644 --- a/src/org/uic/ticket/api/utils/OpenAsn2ApiDecoder.java +++ b/src/org/uic/ticket/api/utils/OpenAsn2ApiDecoder.java @@ -7,8 +7,6 @@ import java.io.IOException; import java.util.Date;
import java.util.List;
-import net.gcdc.asn1.datatypes.Asn1BigInteger;
-
import org.uic.ticket.api.asn.omv1.BerthDetailData;
import org.uic.ticket.api.asn.omv1.CarCarriageReservationData;
import org.uic.ticket.api.asn.omv1.CardReferenceType;
@@ -44,7 +42,6 @@ import org.uic.ticket.api.asn.omv1.TicketLinkType; import org.uic.ticket.api.asn.omv1.TimeRangeType;
import org.uic.ticket.api.asn.omv1.TokenType;
import org.uic.ticket.api.asn.omv1.TrainLinkType;
-import org.uic.ticket.api.asn.omv1.TravelClassType;
import org.uic.ticket.api.asn.omv1.TravelerData;
import org.uic.ticket.api.asn.omv1.TravelerType;
import org.uic.ticket.api.asn.omv1.UicRailTicketData;
@@ -56,9 +53,12 @@ import org.uic.ticket.api.asn.omv1.VoucherData; import org.uic.ticket.api.asn.omv1.ZoneType;
import org.uic.ticket.api.impl.SimpleUicTicketObjectFactory;
import org.uic.ticket.api.spec.IBerth;
+import org.uic.ticket.api.spec.IBerthTypeType;
import org.uic.ticket.api.spec.ICarCarriageReservation;
import org.uic.ticket.api.spec.ICardReference;
import org.uic.ticket.api.spec.ICompartmentDetails;
+import org.uic.ticket.api.spec.ICompartmentGenderType;
+import org.uic.ticket.api.spec.ICompartmentPositionType;
import org.uic.ticket.api.spec.IControlDetail;
import org.uic.ticket.api.spec.ICounterMark;
import org.uic.ticket.api.spec.ICustomerCard;
@@ -67,29 +67,42 @@ import org.uic.ticket.api.spec.IDelayConfirmation; import org.uic.ticket.api.spec.IDocumentExtension;
import org.uic.ticket.api.spec.IExtension;
import org.uic.ticket.api.spec.IFipTicket;
+import org.uic.ticket.api.spec.IGenderType;
import org.uic.ticket.api.spec.IGeoCoordinate;
+import org.uic.ticket.api.spec.IGeoCoordinateSystemType;
+import org.uic.ticket.api.spec.IGeoUnitType;
+import org.uic.ticket.api.spec.IHemisphereLatitudeType;
+import org.uic.ticket.api.spec.IHemisphereLongitudeType;
import org.uic.ticket.api.spec.IIncludedOpenTicket;
import org.uic.ticket.api.spec.IIssuingDetail;
import org.uic.ticket.api.spec.ILine;
+import org.uic.ticket.api.spec.ILinkMode;
+import org.uic.ticket.api.spec.ILoadingDeckType;
import org.uic.ticket.api.spec.ILuggageRestriction;
import org.uic.ticket.api.spec.IOpenTicket;
import org.uic.ticket.api.spec.IParkingGround;
import org.uic.ticket.api.spec.IPass;
+import org.uic.ticket.api.spec.IPassengerType;
import org.uic.ticket.api.spec.IPlaces;
import org.uic.ticket.api.spec.IPolygone;
+import org.uic.ticket.api.spec.IPriceTypeType;
import org.uic.ticket.api.spec.IRegionalValidity;
import org.uic.ticket.api.spec.IRegisteredLuggage;
import org.uic.ticket.api.spec.IReservation;
import org.uic.ticket.api.spec.IReturnRouteDescription;
+import org.uic.ticket.api.spec.IRoofRackType;
import org.uic.ticket.api.spec.IRouteSection;
import org.uic.ticket.api.spec.ISeriesDataDetails;
import org.uic.ticket.api.spec.IServiceBrand;
+import org.uic.ticket.api.spec.IStationCodeTable;
import org.uic.ticket.api.spec.IStationPassage;
import org.uic.ticket.api.spec.ITariff;
import org.uic.ticket.api.spec.ITicketLink;
+import org.uic.ticket.api.spec.ITicketType;
import org.uic.ticket.api.spec.ITimeRange;
import org.uic.ticket.api.spec.IToken;
import org.uic.ticket.api.spec.ITrainLink;
+import org.uic.ticket.api.spec.ITravelClassType;
import org.uic.ticket.api.spec.ITraveler;
import org.uic.ticket.api.spec.ITravelerDetail;
import org.uic.ticket.api.spec.IUicRailTicket;
@@ -126,7 +139,24 @@ public class OpenAsn2ApiDecoder { }
-
+ /**
+ * Decode from asn.1 unaligned PER encoded data.
+ *
+ * @param data byte array of the asn.1 encoded FCB data
+ * @return the decoded uic rail ticket
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ public IUicRailTicket decodeFromAsn (byte[] data) throws IOException{
+
+ UicRailTicketData asnUicRailTicketData = UicRailTicketData.decode(data);
+
+ IUicRailTicket uicRailTicket = factory.createUicRailTicket();
+
+ populateFromAsn1Model(uicRailTicket, asnUicRailTicketData);
+
+ return uicRailTicket;
+
+ }
@@ -328,7 +358,7 @@ public class OpenAsn2ApiDecoder { document.setInfoText(asnDocument.getInfoText());
if (asnDocument.getStationCodeTable()!=null){
- document.setStationCodeTable(asnDocument.getStationCodeTable());
+ document.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
}
document.setStation(UicEncoderUtils.mapToString(asnDocument.getStationNum(),asnDocument.getStationIA5()));
@@ -384,7 +414,7 @@ public class OpenAsn2ApiDecoder { document.setInfoText(asnDocument.getInfoText());
if (asnDocument.getStationCodeTable()!=null){
- document.setStationCodeTable(asnDocument.getStationCodeTable());
+ document.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
}
document.setFromStation(UicEncoderUtils.mapToString(asnDocument.getFromStationNum(),asnDocument.getFromStationIA5()));
document.setToStation(UicEncoderUtils.mapToString(asnDocument.getToStationNum(),asnDocument.getToStationIA5()));
@@ -402,7 +432,7 @@ public class OpenAsn2ApiDecoder { }
if(asnDocument.getClassCode()!=null){
- document.setClassCode(asnDocument.getClassCode());
+ document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
}
document.setCompartmentDetails(convertCompartmentDetails(asnDocument.getCompartmentDetails()));
@@ -425,7 +455,7 @@ public class OpenAsn2ApiDecoder { document.setBicyclePlaces(convertPlaces(asnDocument.getBicyclePlaces()));
}
- document.setPriceType(asnDocument.getPriceType());
+ document.setPriceType(IPriceTypeType.valueOf(asnDocument.getPriceType().name()));
IServiceBrand serviceBrand = factory.createServiceBrand();
@@ -508,7 +538,7 @@ public class OpenAsn2ApiDecoder { document.setInfoText(asnDocument.getInfoText());
if (asnDocument.getStationCodeTable()!=null){
- document.setStationCodeTable(asnDocument.getStationCodeTable());
+ document.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
}
document.setFromStation(UicEncoderUtils.mapToString(asnDocument.getFromStationNum(),asnDocument.getFromStationIA5()));
document.setToStation(UicEncoderUtils.mapToString(asnDocument.getToStationNum(),asnDocument.getToStationIA5()));
@@ -542,7 +572,7 @@ public class OpenAsn2ApiDecoder { }
if (asnDocument.getLoadingDeck()!=null){
- document.setLoadingDeck(asnDocument.getLoadingDeck());
+ document.setLoadingDeck(ILoadingDeckType.valueOf(asnDocument.getLoadingDeck().name()));
}
if(asnDocument.getLoadingListEntry()!=null){
@@ -557,7 +587,7 @@ public class OpenAsn2ApiDecoder { document.setTrailerPlate(asnDocument.getTrailerPlate());
if(asnDocument.getRoofRackType()!=null){
- document.setRoofRackType(asnDocument.getRoofRackType());
+ document.setRoofRackType(IRoofRackType.valueOf(asnDocument.getRoofRackType().name()));
}
if(asnDocument.getTextileRoof()) {
@@ -586,7 +616,7 @@ public class OpenAsn2ApiDecoder { }
- document.setPriceType(asnDocument.getPriceType());
+ document.setPriceType(IPriceTypeType.valueOf(asnDocument.getPriceType().name()));
IServiceBrand serviceBrand = factory.createServiceBrand();
@@ -666,7 +696,7 @@ public class OpenAsn2ApiDecoder { details.setCompartmentTypeDescr(asnDetails.getCompartmentTypeDescr());
details.setSpecialAllocationDescr(asnDetails.getSpecialAllocationDescr());
- details.setPosition(asnDetails.getPosition());
+ details.setPosition(ICompartmentPositionType.valueOf(asnDetails.getPosition().name()));
return details;
}
@@ -715,13 +745,13 @@ public class OpenAsn2ApiDecoder { IBerth berth = factory.createBerth();
if (asnBerth.getGender()!= null) {
- berth.setGender(asnBerth.getGender());
+ berth.setGender(ICompartmentGenderType.valueOf(asnBerth.getGender().name()));
}
if (asnBerth.getNumberOfBerths()!=null) {
berth.setNumberOfBerths(asnBerth.getNumberOfBerths().intValue());
}
if (asnBerth.getBerthType()!=null){
- berth.setType(asnBerth.getBerthType());
+ berth.setType(IBerthTypeType.valueOf(asnBerth.getBerthType().name()));
}
return berth;
@@ -742,7 +772,7 @@ public class OpenAsn2ApiDecoder { document.setProductOwner(UicEncoderUtils.mapToString(asnDocument.getProductOwnerNum(),asnDocument.getProductOwnerIA5()));
if(asnDocument.getClassCode()!=null){
- document.setClassCode(asnDocument.getClassCode());
+ document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
}
document.setValidFrom(asnDocument.getValidFromDate(issuingDate));
@@ -894,7 +924,7 @@ public class OpenAsn2ApiDecoder { IOpenTicket document = factory.createOpenTicket();
if(asnDocument.getClassCode()!=null){
- document.setClassCode(asnDocument.getClassCode());
+ document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
}
document.setValidFrom(asnDocument.getValidFromDate(issuingDate));
@@ -945,7 +975,7 @@ public class OpenAsn2ApiDecoder { }
if (asnDocument.getStationCodeTable()!=null){
- document.setStationCodeTable(asnDocument.getStationCodeTable());
+ document.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
}
document.setFromStation(UicEncoderUtils.mapToString(asnDocument.getFromStationNum(),asnDocument.getFromStationIA5()));
document.setToStation(UicEncoderUtils.mapToString(asnDocument.getToStationNum(),asnDocument.getToStationIA5()));
@@ -1013,12 +1043,12 @@ public class OpenAsn2ApiDecoder { * @param classCode the class code
* @return the simple included open ticket
*/
- private IIncludedOpenTicket convertIncludedOpenTicket( IncludedOpenTicketType asnDocument, Date issuingDate, TravelClassType classCode) {
+ private IIncludedOpenTicket convertIncludedOpenTicket( IncludedOpenTicketType asnDocument, Date issuingDate,ITravelClassType classCode) {
IIncludedOpenTicket document = factory.createIncludedOpenTicket();
if(asnDocument.getClassCode()!=null){
- document.setClassCode(asnDocument.getClassCode());
+ document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
} else {
document.setClassCode(classCode);
}
@@ -1068,7 +1098,7 @@ public class OpenAsn2ApiDecoder { }
if (asnDocument.getStationCodeTable()!=null){
- document.setStationCodeTable(asnDocument.getStationCodeTable());
+ document.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
}
if (asnDocument.getValidRegion()!= null && !asnDocument.getValidRegion().isEmpty()) {
@@ -1120,9 +1150,9 @@ public class OpenAsn2ApiDecoder { }
if (asnDocument.getStationNum()!=null && !asnDocument.getStationNum().isEmpty()){
- for (Asn1BigInteger station : asnDocument.getStationNum()) {
- if (station.value() != null) {
- document.addStation(station.value().toString());
+ for (Long station : asnDocument.getStationNum()) {
+ if (station != null) {
+ document.addStation(station.toString());
}
}
}
@@ -1145,7 +1175,7 @@ public class OpenAsn2ApiDecoder { }
if (asnDocument.getStationCodeTable()!=null){
- document.setStationCodeTable(asnDocument.getStationCodeTable());
+ document.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
}
document.setExtension(convertExtension(asnDocument.getExtension()));
@@ -1156,9 +1186,9 @@ public class OpenAsn2ApiDecoder { }
}
if (asnDocument.getAreaCodeNum() != null && !asnDocument.getAreaCodeNum().isEmpty()) {
- for (Asn1BigInteger code : asnDocument.getAreaCodeNum()) {
- if (code.value() != null) {
- document.addAreaCode(code.value().toString());
+ for (Long code : asnDocument.getAreaCodeNum()) {
+ if (code != null) {
+ document.addAreaCode(code.toString());
}
}
}
@@ -1239,7 +1269,7 @@ public class OpenAsn2ApiDecoder { document.setSpecialInformation(asnDocument.getSpecialInformation());
if (asnDocument.getStationCodeTable()!=null){
- document.setStationCodeTable(asnDocument.getStationCodeTable());
+ document.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
}
document.setStation(UicEncoderUtils.mapToString(asnDocument.getStationNum(),asnDocument.getStationIA5()));
@@ -1258,51 +1288,51 @@ public class OpenAsn2ApiDecoder { /**
* Convert via station.
*
- * @param asnVia the asn via
+ * @param asnDocument the asn via
* @return the i via station
*/
- protected IViaStation convertViaStation(ViaStationType asnVia) {
+ protected IViaStation convertViaStation(ViaStationType asnDocument) {
- if (asnVia == null) return null;
+ if (asnDocument == null) return null;
IViaStation via = factory.createViaStation();
- if (asnVia.getBorder()!=null) {
- via.setBorder(asnVia.getBorder());
+ if (asnDocument.getBorder()!=null) {
+ via.setBorder(asnDocument.getBorder());
}
- if (asnVia.getRouteId() != null) {
- via.setRouteId(asnVia.getRouteId().intValue());
+ if (asnDocument.getRouteId() != null) {
+ via.setRouteId(asnDocument.getRouteId().intValue());
}
- if (asnVia.getStationCodeTable()!=null){
- via.setStationCodeTable(asnVia.getStationCodeTable());
+ if (asnDocument.getStationCodeTable()!=null){
+ via.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
}
- if (asnVia.getStationNum() != null) {
- via.setStation(asnVia.getStationNum().toString());
- } else if (asnVia.getStationIA5() != null) {
- via.setStation(asnVia.getStationIA5());
+ if (asnDocument.getStationNum() != null) {
+ via.setStation(asnDocument.getStationNum().toString());
+ } else if (asnDocument.getStationIA5() != null) {
+ via.setStation(asnDocument.getStationIA5());
}
- if (asnVia.getCarriersNum()!=null && !asnVia.getCarriersNum().isEmpty()){
- for(Long carrier :asnVia.getCarriersNum()){
+ if (asnDocument.getCarriersNum()!=null && !asnDocument.getCarriersNum().isEmpty()){
+ for(Long carrier :asnDocument.getCarriersNum()){
via.addCarrier(carrier.toString());
}
}
- if (asnVia.getCarriersIA5()!=null && !asnVia.getCarriersIA5().isEmpty()){
- for(String carrier :asnVia.getCarriersIA5()){
+ if (asnDocument.getCarriersIA5()!=null && !asnDocument.getCarriersIA5().isEmpty()){
+ for(String carrier :asnDocument.getCarriersIA5()){
via.addCarrier(carrier);
}
}
- if (asnVia.getRoute()!= null && !asnVia.getRoute().isEmpty()) {
- for ( ViaStationType routeVia: asnVia.getRoute()) {
+ if (asnDocument.getRoute()!= null && !asnDocument.getRoute().isEmpty()) {
+ for ( ViaStationType routeVia: asnDocument.getRoute()) {
via.addRouteStation(convertViaStation(routeVia));
}
}
- if (asnVia.getAlternativeRoutes()!= null && !asnVia.getAlternativeRoutes().isEmpty()) {
- for ( ViaStationType routeVia: asnVia.getAlternativeRoutes()) {
+ if (asnDocument.getAlternativeRoutes()!= null && !asnDocument.getAlternativeRoutes().isEmpty()) {
+ for ( ViaStationType routeVia: asnDocument.getAlternativeRoutes()) {
via.addRouteStation(convertViaStation(routeVia));
}
}
@@ -1337,28 +1367,28 @@ public class OpenAsn2ApiDecoder { /**
* Convert zone.
*
- * @param asnZone the asn zone
+ * @param asnDocument the asn zone
* @return the i regional validity
*/
- protected IRegionalValidity convertZone(ZoneType asnZone) {
+ protected IRegionalValidity convertZone(ZoneType asnDocument) {
- if (asnZone == null) return null;
+ if (asnDocument == null) return null;
IZone zone = factory.createZone();
- zone.setBinaryZoneId(asnZone.getBinaryZoneId());
- zone.setCarrier(UicEncoderUtils.mapToString(asnZone.getCarrierNum(),asnZone.getCarrierIA5()));
+ zone.setBinaryZoneId(asnDocument.getBinaryZoneId());
+ zone.setCarrier(UicEncoderUtils.mapToString(asnDocument.getCarrierNum(),asnDocument.getCarrierIA5()));
- if (asnZone.getCity() != null) {
- zone.setCity(asnZone.getCity().intValue());
+ if (asnDocument.getCity() != null) {
+ zone.setCity(asnDocument.getCity().intValue());
}
- if (asnZone.getStationCodeTable()!=null){
- zone.setStationCodeTable(asnZone.getStationCodeTable());
+ if (asnDocument.getStationCodeTable()!=null){
+ zone.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
}
- zone.setEntryStation(UicEncoderUtils.mapToString(asnZone.getEntryStationNum(),asnZone.getEntryStationIA5()));
- zone.setTerminatingStation(UicEncoderUtils.mapToString(asnZone.getTerminatingStationNum(),asnZone.getTerminatingStationIA5()));
+ zone.setEntryStation(UicEncoderUtils.mapToString(asnDocument.getEntryStationNum(),asnDocument.getEntryStationIA5()));
+ zone.setTerminatingStation(UicEncoderUtils.mapToString(asnDocument.getTerminatingStationNum(),asnDocument.getTerminatingStationIA5()));
- zone.setNUTScode(asnZone.getNutsCode());
+ zone.setNUTScode(asnDocument.getNutsCode());
return zone;
}
@@ -1398,27 +1428,27 @@ public class OpenAsn2ApiDecoder { /**
* Convert line.
*
- * @param asnLine the asn line
+ * @param asnDocument the asn line
* @return the i regional validity
*/
- protected IRegionalValidity convertLine(LineType asnLine) {
+ protected IRegionalValidity convertLine(LineType asnDocument) {
- if (asnLine == null) return null;
+ if (asnDocument == null) return null;
ILine line = factory.createLine();
- line.setBinaryZoneId(asnLine.getBinaryZoneId());
- line.setCarrier(UicEncoderUtils.mapToString(asnLine.getCarrierNum(),asnLine.getCarrierIA5()));
- if (asnLine.getCity()!=null) {
- line.setCity(asnLine.getCity().intValue());
+ line.setBinaryZoneId(asnDocument.getBinaryZoneId());
+ line.setCarrier(UicEncoderUtils.mapToString(asnDocument.getCarrierNum(),asnDocument.getCarrierIA5()));
+ if (asnDocument.getCity()!=null) {
+ line.setCity(asnDocument.getCity().intValue());
}
- if (asnLine.getStationCodeTable()!=null){
- line.setStationCodeTable(asnLine.getStationCodeTable());
+ if (asnDocument.getStationCodeTable()!=null){
+ line.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
}
- line.setEntryStation(UicEncoderUtils.mapToString(asnLine.getEntryStationNum(),asnLine.getEntryStationIA5()));
- line.setTerminatingStation(UicEncoderUtils.mapToString(asnLine.getTerminatingStationNum(),asnLine.getTerminatingStationIA5()));
- if (asnLine.getLineId()!=null && !asnLine.getLineId().isEmpty()){
- for (Asn1BigInteger lineId : asnLine.getLineId()) {
+ line.setEntryStation(UicEncoderUtils.mapToString(asnDocument.getEntryStationNum(),asnDocument.getEntryStationIA5()));
+ line.setTerminatingStation(UicEncoderUtils.mapToString(asnDocument.getTerminatingStationNum(),asnDocument.getTerminatingStationIA5()));
+ if (asnDocument.getLineId()!=null && !asnDocument.getLineId().isEmpty()){
+ for (Long lineId : asnDocument.getLineId()) {
line.addLineId(lineId.intValue());
}
}
@@ -1455,7 +1485,7 @@ public class OpenAsn2ApiDecoder { if (asnTariff.getPassengerType()!=null) {
- tariff.setPassengerType(asnTariff.getPassengerType());
+ tariff.setPassengerType(IPassengerType.valueOf(asnTariff.getPassengerType().name()));
}
@@ -1524,7 +1554,7 @@ public class OpenAsn2ApiDecoder { IRouteSection document = factory.createRouteSection();
if (asnDocument.getStationCodeTable()!=null){
- document.setStationCodeTable(asnDocument.getStationCodeTable());
+ document.setStationCodeTable(IStationCodeTable.valueOf(asnDocument.getStationCodeTable().name()));
}
document.setFromStation(UicEncoderUtils.mapToString(asnDocument.getFromStationNum(),asnDocument.getFromStationIA5()));
document.setToStation(UicEncoderUtils.mapToString(asnDocument.getToStationNum(),asnDocument.getToStationIA5()));
@@ -1546,7 +1576,7 @@ public class OpenAsn2ApiDecoder { IFipTicket document = factory.createFipTicket();
if(asnDocument.getClassCode()!=null){
- document.setClassCode(asnDocument.getClassCode());
+ document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
}
document.setValidFrom(asnDocument.getValidFromDate(issuingDate));
@@ -1588,7 +1618,7 @@ public class OpenAsn2ApiDecoder { IPass document = factory.createPass();
if(asnDocument.getClassCode()!=null){
- document.setClassCode(asnDocument.getClassCode());
+ document.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
}
document.setValidFrom(asnDocument.getValidFromDate(issuingDate));
@@ -1785,40 +1815,40 @@ public class OpenAsn2ApiDecoder { /**
* Convert customer card.
*
- * @param asnCard the asn card
+ * @param asnDocument the asn card
* @param issuingDate the issuing date
* @return the i customer card
*/
- protected ICustomerCard convertCustomerCard(CustomerCardData asnCard, Date issuingDate ) {
+ protected ICustomerCard convertCustomerCard(CustomerCardData asnDocument, Date issuingDate ) {
- if (asnCard == null) return null;
+ if (asnDocument == null) return null;
ICustomerCard card = factory.createCustomerCard();
- card.setCardId(UicEncoderUtils.mapToString(asnCard.getCardIdNum(), asnCard.getCardIdIA5()));
- if (asnCard.getCardType()!= null) {
- card.setCardType(asnCard.getCardType().intValue());
+ card.setCardId(UicEncoderUtils.mapToString(asnDocument.getCardIdNum(), asnDocument.getCardIdIA5()));
+ if (asnDocument.getCardType()!= null) {
+ card.setCardType(asnDocument.getCardType().intValue());
}
- card.setCardTypeDescr(asnCard.getCardTypeDescr());
- if(asnCard.getClassCode()!=null){
- card.setClassCode(asnCard.getClassCode());
+ card.setCardTypeDescr(asnDocument.getCardTypeDescr());
+ if(asnDocument.getClassCode()!=null){
+ card.setClassCode(ITravelClassType.valueOf(asnDocument.getClassCode().name()));
}
- if(asnCard.getCustomer()!=null) {
- card.setCustomer(convertTraveler(asnCard.getCustomer()));
+ if(asnDocument.getCustomer()!=null) {
+ card.setCustomer(convertTraveler(asnDocument.getCustomer()));
}
- if (asnCard.getCustomerStatus()!=null) {
- card.setCustomerStatus(asnCard.getCustomerStatus().intValue());
+ if (asnDocument.getCustomerStatus()!=null) {
+ card.setCustomerStatus(asnDocument.getCustomerStatus().intValue());
}
- card.setCustomerStatusDescr(asnCard.getCustomerStatusDescr());
+ card.setCustomerStatusDescr(asnDocument.getCustomerStatusDescr());
- card.setValidFrom(asnCard.getValidFromDate());
+ card.setValidFrom(asnDocument.getValidFromDate());
- card.setValidUntil(asnCard.getValidUntilDate());
+ card.setValidUntil(asnDocument.getValidUntilDate());
- if (asnCard.getIncludedServices() != null && !asnCard.getIncludedServices().isEmpty()){
- for (Asn1BigInteger service: asnCard.getIncludedServices()){
+ if (asnDocument.getIncludedServices() != null && !asnDocument.getIncludedServices().isEmpty()){
+ for (Long service: asnDocument.getIncludedServices()){
card.addIncludedService(new Integer(service.intValue()));
}
}
@@ -1894,13 +1924,13 @@ public class OpenAsn2ApiDecoder { traveler.setFirstName(asnTraveler.getFirstName());
if (asnTraveler.getGender()!= null) {
- traveler.setGender(asnTraveler.getGender());
+ traveler.setGender(IGenderType.valueOf(asnTraveler.getGender().name()));
}
traveler.setIdCard(asnTraveler.getIdCard());
traveler.setLastName(asnTraveler.getLastName());
if (asnTraveler.getPassengerType()!= null) {
- traveler.setPassengerType(asnTraveler.getPassengerType());
+ traveler.setPassengerType(IPassengerType.valueOf(asnTraveler.getPassengerType().name()));
}
if (asnTraveler.getPassengerWithReducedMobility()!= null) {
traveler.setPassengerWithReducedMobility(asnTraveler.getPassengerWithReducedMobility());
@@ -2093,24 +2123,24 @@ public class OpenAsn2ApiDecoder { IGeoCoordinate coordinate = factory.createGeoCoordinate();
if (asnCoordinate.getCoordinateSystem() != null) {
- coordinate.setSystem(asnCoordinate.getCoordinateSystem());
+ coordinate.setSystem(IGeoCoordinateSystemType.valueOf(asnCoordinate.getCoordinateSystem().name()));
}
if (asnCoordinate.getAccuracy() != null) {
- coordinate.setAccuracy(asnCoordinate.getAccuracy());
+ coordinate.setAccuracy(IGeoUnitType.valueOf(asnCoordinate.getAccuracy().name()));
}
if (asnCoordinate.getGeoUnit() != null) {
- coordinate.setUnit(asnCoordinate.getGeoUnit());
+ coordinate.setUnit(IGeoUnitType.valueOf(asnCoordinate.getGeoUnit().name()));
}
if (asnCoordinate.getHemisphereLatitude() != null) {
- coordinate.setHemisphereLatitude(asnCoordinate.getHemisphereLatitude());
+ coordinate.setHemisphereLatitude(IHemisphereLatitudeType.valueOf(asnCoordinate.getHemisphereLatitude().name()));
}
if (asnCoordinate.getHemisphereLongitude() != null) {
- coordinate.setHemisphereLongitude(asnCoordinate.getHemisphereLongitude());
- }
+ coordinate.setHemisphereLongitude(IHemisphereLongitudeType.valueOf(asnCoordinate.getHemisphereLongitude().name()));
+ }
coordinate.setLongitude (asnCoordinate.getLongitude());
coordinate.setLatitude (asnCoordinate.getLatitude());
@@ -2151,10 +2181,10 @@ public class OpenAsn2ApiDecoder { ticketLink.setProductOwner(UicEncoderUtils.mapToString(asnTicketLink.getProductOwnerNum(),asnTicketLink.getProductOwnerIA5()));
ticketLink.setReference(UicEncoderUtils.mapToString(asnTicketLink.getReferenceNum(),asnTicketLink.getReferenceIA5()));
if(asnTicketLink.getTicketType()!=null) {
- ticketLink.setTicketType(asnTicketLink.getTicketType());
+ ticketLink.setTicketType(ITicketType.valueOf(asnTicketLink.getTicketType().name()));
}
if(asnTicketLink.getLinkMode()!=null) {
- ticketLink.setLinkMode(asnTicketLink.getLinkMode());
+ ticketLink.setLinkMode(ILinkMode.valueOf(asnTicketLink.getLinkMode().name()));
}
return ticketLink;
}
diff --git a/src/org/uic/ticket/api/utils/UicEncoderUtils.java b/src/org/uic/ticket/api/utils/UicEncoderUtils.java index 0f3a5b4..f4c9f89 100644 --- a/src/org/uic/ticket/api/utils/UicEncoderUtils.java +++ b/src/org/uic/ticket/api/utils/UicEncoderUtils.java @@ -9,14 +9,12 @@ import java.util.Collection; import java.util.HashSet;
import java.util.List;
-
+import org.uic.ticket.EncodingFormatException;
import net.gcdc.asn1.datatypes.Asn1BigInteger;
import net.gcdc.asn1.datatypesimpl.SequenceOfStringIA5;
import net.gcdc.asn1.datatypesimpl.SequenceOfStringUTF8;
-import org.uic.ticket.api.EncodingFormatException;
-
/**
* The Class UicEncoderUtils.
diff --git a/src/org/uic/ticket/api/package.html b/src/org/uic/ticket/package.html index c7b3611..c7b3611 100644 --- a/src/org/uic/ticket/api/package.html +++ b/src/org/uic/ticket/package.html |