X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2FdbObjects%2FAssurance.java;h=07c3a39be3b721fc10287181aa591087e408a86b;hp=33dbf1ed5e26fcfbcf593214906b3332467aff7f;hb=3238dff5b3beca228359b370bc104f48d6247632;hpb=670f26bd938db4c3e67fbe1e5a88cb56c792a27a diff --git a/src/org/cacert/gigi/dbObjects/Assurance.java b/src/org/cacert/gigi/dbObjects/Assurance.java index 33dbf1ed..07c3a39b 100644 --- a/src/org/cacert/gigi/dbObjects/Assurance.java +++ b/src/org/cacert/gigi/dbObjects/Assurance.java @@ -1,5 +1,7 @@ package org.cacert.gigi.dbObjects; +import java.util.Date; + import org.cacert.gigi.database.DBEnum; import org.cacert.gigi.dbObjects.wrappers.DataContainer; @@ -41,7 +43,9 @@ public class Assurance { private Country country; - public Assurance(int id, User from, Name to, String location, String method, int points, String date, Country country) { + private Date expireDate; + + public Assurance(int id, User from, Name to, String location, String method, int points, String date, Country country, Date expireDate) { this.id = id; this.from = from; this.to = to; @@ -50,7 +54,7 @@ public class Assurance { this.points = points; this.date = date; this.country = country; - + this.expireDate = expireDate; } public User getFrom() { @@ -84,4 +88,19 @@ public class Assurance { public Country getCountry() { return country; } + + public Date getExpireDate() { + return expireDate; + } + + public boolean isExpired() { + boolean expired = false; + if (expireDate == null) { + expired = false; + } else { + Date now = new Date(); + expired = expireDate.before(now); + } + return expired; + } }