diff options
author | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2020-06-29 13:25:49 +0200 |
---|---|---|
committer | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2020-06-29 13:25:49 +0200 |
commit | f644ffa214d93bfa0887cf78603b075310dc6191 (patch) | |
tree | b84eb35e608e8aaa34f3468f6ce04ae56d17ced8 /src/org/uic/ticket/api | |
parent | bug fix calculation of time (diff) | |
download | UIC-barcode-f644ffa214d93bfa0887cf78603b075310dc6191.tar UIC-barcode-f644ffa214d93bfa0887cf78603b075310dc6191.tar.gz UIC-barcode-f644ffa214d93bfa0887cf78603b075310dc6191.tar.bz2 UIC-barcode-f644ffa214d93bfa0887cf78603b075310dc6191.tar.lz UIC-barcode-f644ffa214d93bfa0887cf78603b075310dc6191.tar.xz UIC-barcode-f644ffa214d93bfa0887cf78603b075310dc6191.tar.zst UIC-barcode-f644ffa214d93bfa0887cf78603b075310dc6191.zip |
Diffstat (limited to 'src/org/uic/ticket/api')
-rw-r--r-- | src/org/uic/ticket/api/asn/omv1/FIPTicketData.java | 12 | ||||
-rw-r--r-- | src/org/uic/ticket/api/asn/omv1/OpenTicketData.java | 46 | ||||
-rw-r--r-- | src/org/uic/ticket/api/asn/omv1/PassData.java | 40 |
3 files changed, 63 insertions, 35 deletions
diff --git a/src/org/uic/ticket/api/asn/omv1/FIPTicketData.java b/src/org/uic/ticket/api/asn/omv1/FIPTicketData.java index 79eba9c..eac2ef3 100644 --- a/src/org/uic/ticket/api/asn/omv1/FIPTicketData.java +++ b/src/org/uic/ticket/api/asn/omv1/FIPTicketData.java @@ -261,7 +261,11 @@ public class FIPTicketData extends Object { public void setActivatedDays(Collection<Date> dates, Date issuingDate){
- this.activatedDay.clear();
+ if (this.activatedDay != null) {
+ this.activatedDay.clear();
+ } else {
+ this.activatedDay= new SequenceOfActivatedDays();
+ }
if (dates != null && !dates.isEmpty()) {
@@ -277,6 +281,10 @@ public class FIPTicketData extends Object { Long dayDiff = DateTimeUtils.getDateDifference(issuingDate, day);
+ if (this.activatedDay == null) {
+ this.activatedDay = new SequenceOfActivatedDays();
+ }
+
if (dayDiff != null) {
this.activatedDay.add(dayDiff);
}
@@ -285,6 +293,8 @@ public class FIPTicketData extends Object { public Collection<Date> getActivatedDays(Date issuingDate) {
+ if (this.activatedDay == null) return null;
+
ArrayList<Date> dates = new ArrayList<Date>();
for (Long diff: this.getActivatedDay()) {
diff --git a/src/org/uic/ticket/api/asn/omv1/OpenTicketData.java b/src/org/uic/ticket/api/asn/omv1/OpenTicketData.java index 8fe20f3..018241a 100644 --- a/src/org/uic/ticket/api/asn/omv1/OpenTicketData.java +++ b/src/org/uic/ticket/api/asn/omv1/OpenTicketData.java @@ -564,10 +564,34 @@ public class OpenTicketData extends Object { }
+
+
+ public void setActivatedDays(Collection<Date> dates, Date issuingDate){
+
+ if (this.activatedDay != null) {
+ this.activatedDay.clear();
+ } else {
+ this.activatedDay= new SequenceOfActivatedDays();
+ }
+
+ if (dates != null && !dates.isEmpty()) {
+
+ for (Date day : dates) {
+ this.addActivatedDay(issuingDate, day);
+ }
+
+ }
+
+ }
+
public void addActivatedDay(Date issuingDate, Date day){
Long dayDiff = DateTimeUtils.getDateDifference(issuingDate, day);
+ if (this.activatedDay == null) {
+ this.activatedDay = new SequenceOfActivatedDays();
+ }
+
if (dayDiff != null) {
this.activatedDay.add(dayDiff);
}
@@ -576,6 +600,8 @@ public class OpenTicketData extends Object { public Collection<Date> getActivatedDays(Date issuingDate) {
+ if (this.activatedDay == null) return null;
+
ArrayList<Date> dates = new ArrayList<Date>();
for (Long diff: this.getActivatedDay()) {
@@ -590,25 +616,7 @@ public class OpenTicketData extends Object { return dates;
- }
-
- public void setActivatedDays(Collection<Date> dates, Date issuingDate){
-
- if (dates == null || issuingDate == null || dates.isEmpty()) return;
-
-
- this.activatedDay.clear();
-
- if (dates != null && !dates.isEmpty()) {
-
- for (Date day : dates) {
- this.addActivatedDay(issuingDate, day);
- }
-
- }
-
- }
-
+ }
public Long getValidFromUTCOffset() {
return validFromUTCOffset;
}
diff --git a/src/org/uic/ticket/api/asn/omv1/PassData.java b/src/org/uic/ticket/api/asn/omv1/PassData.java index 491b8b7..fd700e0 100644 --- a/src/org/uic/ticket/api/asn/omv1/PassData.java +++ b/src/org/uic/ticket/api/asn/omv1/PassData.java @@ -482,10 +482,32 @@ public class PassData extends Object { }
+ public void setActivatedDays(Collection<Date> dates, Date issuingDate){
+
+ if (this.activatedDay != null) {
+ this.activatedDay.clear();
+ } else {
+ this.activatedDay= new SequenceOfActivatedDays();
+ }
+
+ if (dates != null && !dates.isEmpty()) {
+
+ for (Date day : dates) {
+ this.addActivatedDay(issuingDate, day);
+ }
+
+ }
+
+ }
+
public void addActivatedDay(Date issuingDate, Date day){
Long dayDiff = DateTimeUtils.getDateDifference(issuingDate, day);
+ if (this.activatedDay == null) {
+ this.activatedDay = new SequenceOfActivatedDays();
+ }
+
if (dayDiff != null) {
this.activatedDay.add(dayDiff);
}
@@ -494,6 +516,8 @@ public class PassData extends Object { public Collection<Date> getActivatedDays(Date issuingDate) {
+ if (this.activatedDay == null) return null;
+
ArrayList<Date> dates = new ArrayList<Date>();
for (Long diff: this.getActivatedDay()) {
@@ -508,21 +532,7 @@ public class PassData extends Object { return dates;
- }
-
- public void setActivatedDays(Collection<Date> dates, Date issuingDate){
-
- this.activatedDay.clear();
-
- if (dates != null && !dates.isEmpty()) {
-
- for (Date day : dates) {
- this.addActivatedDay(issuingDate, day);
- }
-
- }
-
- }
+ }
public Long getValidFromUTCOffset() {
return validFromUTCOffset;
|