X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2FdbObjects%2FAssurance.java;h=07c3a39be3b721fc10287181aa591087e408a86b;hp=dbcc20b6c2f290c75b842e2e35c4784c37b6eb98;hb=3238dff5b3beca228359b370bc104f48d6247632;hpb=9def69bd08ea69eb27786d5b34f00e154e09e9f3 diff --git a/src/org/cacert/gigi/dbObjects/Assurance.java b/src/org/cacert/gigi/dbObjects/Assurance.java index dbcc20b6..07c3a39b 100644 --- a/src/org/cacert/gigi/dbObjects/Assurance.java +++ b/src/org/cacert/gigi/dbObjects/Assurance.java @@ -1,11 +1,14 @@ package org.cacert.gigi.dbObjects; +import java.util.Date; + +import org.cacert.gigi.database.DBEnum; import org.cacert.gigi.dbObjects.wrappers.DataContainer; @DataContainer public class Assurance { - public enum AssuranceType { + public enum AssuranceType implements DBEnum { FACE_TO_FACE("Face to Face Meeting"), TOPUP("TOPUP"), TTP_ASSISTED("TTP-Assisted"), NUCLEUS("Nucleus Bonus"); private final String description; @@ -17,6 +20,11 @@ public class Assurance { public String getDescription() { return description; } + + @Override + public String getDBName() { + return description; + } } private int id; @@ -33,7 +41,11 @@ public class Assurance { private String date; - public Assurance(int id, User from, Name to, String location, String method, int points, String date) { + private 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; @@ -41,7 +53,8 @@ public class Assurance { this.method = method; this.points = points; this.date = date; - + this.country = country; + this.expireDate = expireDate; } public User getFrom() { @@ -72,4 +85,22 @@ public class Assurance { return date; } + 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; + } }