summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/uic/barcode/dynamicFrame/v2/DynamicFrame.java52
-rw-r--r--src/main/java/org/uic/barcode/dynamicFrame/v2/Level2DataType.java44
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfPlaceNum.java1
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfServiceBrands.java1
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfTransportTypes.java1
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfTravelerId.java1
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java16
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java16
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV3.java17
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoder.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java2
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV3.java2
12 files changed, 28 insertions, 127 deletions
diff --git a/src/main/java/org/uic/barcode/dynamicFrame/v2/DynamicFrame.java b/src/main/java/org/uic/barcode/dynamicFrame/v2/DynamicFrame.java
index 30043c0..cb5c37a 100644
--- a/src/main/java/org/uic/barcode/dynamicFrame/v2/DynamicFrame.java
+++ b/src/main/java/org/uic/barcode/dynamicFrame/v2/DynamicFrame.java
@@ -1,8 +1,5 @@
package org.uic.barcode.dynamicFrame.v2;
-import java.security.PrivateKey;
-import java.security.Provider;
-import java.security.Signature;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
import org.uic.barcode.asn1.datatypes.CharacterRestriction;
import org.uic.barcode.asn1.datatypes.FieldOrder;
@@ -14,7 +11,6 @@ import org.uic.barcode.dynamicContent.api.DynamicContentCoder;
import org.uic.barcode.dynamicContent.api.IUicDynamicContent;
import org.uic.barcode.dynamicContent.fdc1.UicDynamicContentDataFDC1;
import org.uic.barcode.ticket.EncodingFormatException;
-import org.uic.barcode.utils.AlgorithmNameResolver;
/**
@@ -122,53 +118,5 @@ public class DynamicFrame extends Object{
return UperEncoder.decode(bytes, DynamicFrame.class);
}
-
-
- /**
- * Adds the dynamic content and encodes it. (API level)
- *
- * @param content the dynamic content
- * @throws EncodingFormatException the encoding format exception
- */
- public void addDynamicContent(IUicDynamicContent content) throws EncodingFormatException {
-
-
- this.getLevel2SignedData().setLevel2Data(new DataType());
-
- this.getLevel2SignedData().getLevel2Data().setFormat(DynamicContentCoder.dynamicContentDataFDC1);
-
- this.getLevel2SignedData().getLevel2Data().setByteData(DynamicContentCoder.encode(content, DynamicContentCoder.dynamicContentDataFDC1));
-
- }
-
- /**
- * Adds the level 2 dynamic data. (ASN level)
- *
- * @param dynamicData the dynamic data
- */
- public void addLevel2DynamicData(UicDynamicContentDataFDC1 dynamicData) {
- DataType dt = new DataType();
- dt.setByteData(dynamicData.getDataType().getByteData());
- dt.setFormat(dynamicData.getDataType().getFormat());
- level2SignedData.setLevel2Data(dt);
- }
-
- /**
- * Gets the dynamic content.
- *
- * @return the dynamic content
- */
- public IUicDynamicContent getDynamicContent() {
-
- if (this.getLevel2SignedData() == null ||
- this.getLevel2SignedData().getLevel2Data() == null){
- return null;
- }
-
- return DynamicContentCoder.decode(this.getLevel2SignedData().getLevel2Data().getByteData());
-
- }
-
-
}
diff --git a/src/main/java/org/uic/barcode/dynamicFrame/v2/Level2DataType.java b/src/main/java/org/uic/barcode/dynamicFrame/v2/Level2DataType.java
index cd0800e..262fa2f 100644
--- a/src/main/java/org/uic/barcode/dynamicFrame/v2/Level2DataType.java
+++ b/src/main/java/org/uic/barcode/dynamicFrame/v2/Level2DataType.java
@@ -1,15 +1,10 @@
package org.uic.barcode.dynamicFrame.v2;
-import java.security.PrivateKey;
-import java.security.Provider;
-import java.security.Signature;
-
import org.uic.barcode.asn1.datatypes.Asn1Optional;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypesimpl.OctetString;
import org.uic.barcode.asn1.uper.UperEncoder;
-import org.uic.barcode.utils.AlgorithmNameResolver;
/**
* The Class DataType.
@@ -76,46 +71,7 @@ public class Level2DataType {
return UperEncoder.encode(this);
}
- /**
- * Sign the contained data block.
- *
- * Note: an appropriate security provider (e.g. BC) must be registered before
- *
- * @param key the key
- * @return
- * @return the byte[]
- * @throws Exception
- */
- public void signLevel1(PrivateKey key) throws Exception {
- //find the algorithm name for the signature OID
- String algo = AlgorithmNameResolver.getSignatureAlgorithmName(getLevel1Data().level1SigningAlg);
- Signature sig = Signature.getInstance(algo);
- sig.initSign(key);
- byte[] data = level1Data.encode();
- sig.update(data);
- this.level1Signature = new OctetString(sig.sign());
- }
- /**
- * Sign the contained data block.
- *
- * Note: an appropriate security provider (e.g. BC) must be registered before
- *
- * @param key the key
- * @param security provider - security provider that must be sued to create the signature
- * @return
- * @return the byte[]
- * @throws Exception
- */
- public void signLevel1(PrivateKey key, Provider prov) throws Exception {
- //find the algorithm name for the signature OID
- String algo = AlgorithmNameResolver.getSignatureAlgorithmName(getLevel1Data().level1SigningAlg);
- Signature sig = Signature.getInstance(algo, prov);
- sig.initSign(key);
- byte[] data = level1Data.encode();
- sig.update(data);
- this.level1Signature = new OctetString(sig.sign());
- }
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfPlaceNum.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfPlaceNum.java
index 3780dc3..1a6dbfc 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfPlaceNum.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfPlaceNum.java
@@ -20,7 +20,6 @@ public class SequenceOfPlaceNum extends Asn1SequenceOf<Long> {
}
}
- @Deprecated
public static SequenceOfPlaceNum getSequence(List<Long> numList) {
if (numList == null || numList.isEmpty()) return null;
return new SequenceOfPlaceNum(numList);
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfServiceBrands.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfServiceBrands.java
index 388392b..3048235 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfServiceBrands.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfServiceBrands.java
@@ -19,7 +19,6 @@ public class SequenceOfServiceBrands extends Asn1SequenceOf<Long> {
}
}
- @Deprecated
public static SequenceOfServiceBrands getSequence(List<Long> numList) {
if (numList == null || numList.isEmpty()) return null;
return new SequenceOfServiceBrands(numList);
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfTransportTypes.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfTransportTypes.java
index 934b5c9..edec045 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfTransportTypes.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfTransportTypes.java
@@ -19,7 +19,6 @@ public class SequenceOfTransportTypes extends Asn1SequenceOf<Long> {
}
}
- @Deprecated
public static SequenceOfTransportTypes getSequence(List<Long> numList) {
if (numList == null || numList.isEmpty()) return null;
return new SequenceOfTransportTypes(numList);
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfTravelerId.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfTravelerId.java
index b04fcfa..6808104 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfTravelerId.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv3/SequenceOfTravelerId.java
@@ -18,7 +18,6 @@ public class SequenceOfTravelerId extends Asn1SequenceOf<Long> {
}
}
- @Deprecated
public static SequenceOfTravelerId getSequence(List<Long> numList) {
if (numList == null || numList.isEmpty()) return null;
return new SequenceOfTravelerId(numList);
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java
index f4b9569..633f2d7 100644
--- a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java
+++ b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java
@@ -359,6 +359,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
+ asnData.setInfoText(document.getInfoText());
asnData.setExtension(encodeExtension(document.getExtension()));
asnData.setCompartmentDetails(encodeCompartmentDetails(document.getCompartmentDetails()));
@@ -389,21 +390,20 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
asnData.setToStationNameUTF8(document.getToStationName());
- asnData.setAttachedBicycles(UicEncoderUtils.getRestrictedInt(document.getAttachedBicycles(),1,5));
- asnData.setAttachedBoats(UicEncoderUtils.getRestrictedInt(document.getAttachedBoats(),1,2));
- asnData.setAttachedSurfboards(UicEncoderUtils.getRestrictedInt(document.getAttachedSurfboards(),1,5));
+ asnData.setAttachedBicycles(UicEncoderUtils.getRestrictedInt(document.getAttachedBicycles(),0,4));
+ asnData.setAttachedBoats(UicEncoderUtils.getRestrictedInt(document.getAttachedBoats(),0,2));
+ asnData.setAttachedSurfboards(UicEncoderUtils.getRestrictedInt(document.getAttachedSurfboards(),0,5));
if (document.getLoadingDeck() != ILoadingDeckType.upper && document.getLoadingDeck() != null){
asnData.setLoadingDeck(LoadingDeckType.valueOf(document.getLoadingDeck().name()));
}
- asnData.setLoadingListEntry(UicEncoderUtils.getRestrictedInt(document.getAttachedSurfboards(),1,200));
-
- asnData.setBoatCategory(UicEncoderUtils.getRestrictedInt(document.getBoatCategory(),1,6));
- asnData.setCarCategory(UicEncoderUtils.getRestrictedInt(document.getCarCategory(),1,9));
+ asnData.setLoadingListEntry(UicEncoderUtils.getRestrictedInt(document.getLoadingListEntry(),0,999));
+ asnData.setBoatCategory(UicEncoderUtils.getRestrictedInt(document.getBoatCategory(),0,6));
+ asnData.setCarCategory(UicEncoderUtils.getRestrictedInt(document.getCarCategory(),0,9));
asnData.setCoach(UicEncoderUtils.getIA5(document.getCoach()));
- asnData.setRoofRackHeight(UicEncoderUtils.getRestrictedInt(document.getRoofRackHeight(),1,99));
+ asnData.setRoofRackHeight(UicEncoderUtils.getRestrictedInt(document.getRoofRackHeight(),0,99));
if (document.getRoofRackType()!= IRoofRackType.norack && document.getRoofRackType() != null ) {
asnData.setRoofRackType(RoofRackType.valueOf(document.getRoofRackType().name()));
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java
index 6bffddc..00c0ce3 100644
--- a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java
+++ b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV2.java
@@ -386,21 +386,21 @@ public class Api2OpenAsnEncoderV2 implements Api2AsnEncoder {
asnData.setToStationNameUTF8(document.getToStationName());
- asnData.setAttachedBicycles(UicEncoderUtils.getRestrictedInt(document.getAttachedBicycles(),1,5));
- asnData.setAttachedBoats(UicEncoderUtils.getRestrictedInt(document.getAttachedBoats(),1,2));
- asnData.setAttachedSurfboards(UicEncoderUtils.getRestrictedInt(document.getAttachedSurfboards(),1,5));
-
+ asnData.setAttachedBicycles(UicEncoderUtils.getRestrictedInt(document.getAttachedBicycles(),0,4));
+ asnData.setAttachedBoats(UicEncoderUtils.getRestrictedInt(document.getAttachedBoats(),0,2));
+ asnData.setAttachedSurfboards(UicEncoderUtils.getRestrictedInt(document.getAttachedSurfboards(),0,5));
+
if (document.getLoadingDeck() != ILoadingDeckType.upper && document.getLoadingDeck() != null){
asnData.setLoadingDeck(LoadingDeckType.valueOf(document.getLoadingDeck().name()));
}
- asnData.setLoadingListEntry(UicEncoderUtils.getRestrictedInt(document.getAttachedSurfboards(),1,200));
+ asnData.setLoadingListEntry(UicEncoderUtils.getRestrictedInt(document.getAttachedSurfboards(),0,999));
- asnData.setBoatCategory(UicEncoderUtils.getRestrictedInt(document.getBoatCategory(),1,6));
- asnData.setCarCategory(UicEncoderUtils.getRestrictedInt(document.getCarCategory(),1,9));
+ asnData.setBoatCategory(UicEncoderUtils.getRestrictedInt(document.getBoatCategory(),0,6));
+ asnData.setCarCategory(UicEncoderUtils.getRestrictedInt(document.getCarCategory(),0,9));
asnData.setCoach(UicEncoderUtils.getIA5(document.getCoach()));
- asnData.setRoofRackHeight(UicEncoderUtils.getRestrictedInt(document.getRoofRackHeight(),1,99));
+ asnData.setRoofRackHeight(UicEncoderUtils.getRestrictedInt(document.getRoofRackHeight(),0,99));
if (document.getRoofRackType()!= IRoofRackType.norack && document.getRoofRackType() != null) {
asnData.setRoofRackType(RoofRackType.valueOf(document.getRoofRackType().name()));
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV3.java b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV3.java
index 0ead754..c586da0 100644
--- a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV3.java
+++ b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoderV3.java
@@ -360,6 +360,7 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
asnData.setCarrierNum(SequenceOfCarrierNum.getSequence(UicEncoderUtils.getNumList(document.getCarriers())));
asnData.setCarrierIA5(UicEncoderUtils.getIA5NonNumList(document.getCarriers()));
+ asnData.setInfoText(document.getInfoText());
asnData.setExtension(encodeExtension(document.getExtension()));
asnData.setCompartmentDetails(encodeCompartmentDetails(document.getCompartmentDetails()));
@@ -390,21 +391,21 @@ public class Api2OpenAsnEncoderV3 implements Api2AsnEncoder {
asnData.setToStationNameUTF8(document.getToStationName());
- asnData.setAttachedBicycles(UicEncoderUtils.getRestrictedInt(document.getAttachedBicycles(),1,5));
- asnData.setAttachedBoats(UicEncoderUtils.getRestrictedInt(document.getAttachedBoats(),1,2));
- asnData.setAttachedSurfboards(UicEncoderUtils.getRestrictedInt(document.getAttachedSurfboards(),1,5));
+ asnData.setAttachedBicycles(UicEncoderUtils.getRestrictedInt(document.getAttachedBicycles(),0,4));
+ asnData.setAttachedBoats(UicEncoderUtils.getRestrictedInt(document.getAttachedBoats(),0,2));
+ asnData.setAttachedSurfboards(UicEncoderUtils.getRestrictedInt(document.getAttachedSurfboards(),0,5));
if (document.getLoadingDeck() != ILoadingDeckType.upper && document.getLoadingDeck() != null){
asnData.setLoadingDeck(LoadingDeckType.valueOf(document.getLoadingDeck().name()));
}
- asnData.setLoadingListEntry(UicEncoderUtils.getRestrictedInt(document.getAttachedSurfboards(),1,200));
-
- asnData.setBoatCategory(UicEncoderUtils.getRestrictedInt(document.getBoatCategory(),1,6));
- asnData.setCarCategory(UicEncoderUtils.getRestrictedInt(document.getCarCategory(),1,9));
+ asnData.setLoadingListEntry(UicEncoderUtils.getRestrictedInt(document.getLoadingListEntry(),0,999));
+ asnData.setBoatCategory(UicEncoderUtils.getRestrictedInt(document.getBoatCategory(),0,6));
+ asnData.setCarCategory(UicEncoderUtils.getRestrictedInt(document.getCarCategory(),0,9));
+ asnData.setRoofRackHeight(UicEncoderUtils.getRestrictedInt(document.getRoofRackHeight(),0,99));
+
asnData.setCoach(UicEncoderUtils.getIA5(document.getCoach()));
- asnData.setRoofRackHeight(UicEncoderUtils.getRestrictedInt(document.getRoofRackHeight(),1,99));
if (document.getRoofRackType()!= IRoofRackType.norack && document.getRoofRackType() != null) {
asnData.setRoofRackType(RoofRackType.valueOf(document.getRoofRackType().name()));
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoder.java b/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoder.java
index f4e041f..f62e1f9 100644
--- a/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoder.java
+++ b/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoder.java
@@ -648,7 +648,7 @@ public class OpenAsn2ApiDecoder implements Asn2ApiDecoder {
}
}
- return null;
+ return document;
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java b/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java
index 57d2366..1f8e25b 100644
--- a/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java
+++ b/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV2.java
@@ -650,7 +650,7 @@ public class OpenAsn2ApiDecoderV2 implements Asn2ApiDecoder {
}
}
- return null;
+ return document;
}
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV3.java b/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV3.java
index 9521858..b656d3c 100644
--- a/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV3.java
+++ b/src/main/java/org/uic/barcode/ticket/api/utils/OpenAsn2ApiDecoderV3.java
@@ -653,7 +653,7 @@ public class OpenAsn2ApiDecoderV3 implements Asn2ApiDecoder {
}
}
- return null;
+ return document;
}