]>
jfr.im git - irc/rizon/acid.git/blob - vizon/src/main/java/net/rizon/acid/plugins/vizon/db/VizonUser.java
2 * Copyright (c) 2017, orillion <orillion@rizon.net>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright notice, this
9 * list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
26 package net
.rizon
.acid
.plugins
.vizon
.db
;
28 import java
.sql
.ResultSet
;
29 import java
.sql
.SQLException
;
30 import java
.sql
.Timestamp
;
31 import java
.time
.LocalDateTime
;
32 import org
.slf4j
.Logger
;
33 import org
.slf4j
.LoggerFactory
;
37 * @author orillion <orillion@rizon.net>
39 public class VizonUser
41 private static final Logger logger
= LoggerFactory
.getLogger(VizonUser
.class);
44 private final String nick
;
46 private boolean eligible
;
48 private LocalDateTime obtained
;
49 private int obtainedId
;
51 private int multiplier
;
52 private boolean jackpot
;
53 private boolean permanent
;
56 public static VizonUser
fromResultSet(ResultSet rs
)
60 int id
= rs
.getInt("id");
61 String nick
= rs
.getString("nick");
62 String vhost
= rs
.getString("vhost");
63 boolean eligible
= rs
.getBoolean("eligible");
64 boolean bold
= rs
.getBoolean("bold");
65 int expires
= rs
.getInt("expires");
66 Timestamp obtained
= rs
.getTimestamp("obtained");
67 int obtainedId
= rs
.getInt("obtained_id");
68 int multiplier
= rs
.getInt("multiplier");
69 boolean jackpot
= rs
.getBoolean("jackpot");
70 boolean permanent
= rs
.getBoolean("permanent");
71 int days
= rs
.getInt("days");
73 LocalDateTime date
= null;
77 date
= obtained
.toLocalDateTime();
94 catch (SQLException ex
)
96 logger
.warn("Unable to construct VizonUser from ResultSet", ex
);
108 LocalDateTime obtained
,
119 this.eligible
= eligible
;
121 this.obtained
= obtained
;
122 this.obtainedId
= obtainedId
;
123 this.expires
= expires
;
124 this.multiplier
= multiplier
;
125 this.jackpot
= jackpot
;
126 this.permanent
= permanent
;
135 public String
getNick()
140 public String
getVhost()
145 public boolean isEligible()
150 public boolean isBold()
155 public LocalDateTime
getObtained()
160 public int getExpires()
165 public boolean isJackpot()
170 public boolean isPermanent()
180 public void addDays(int days
)
185 public int getMultiplier()
190 public void incrementMultiplier()
195 public void resetMultiplier()
200 public void setBold(boolean bold
)
205 public void setVhost(String vhost
)
210 public void setEligible(boolean eligible
)
212 this.eligible
= eligible
;
215 public void setObtained(LocalDateTime obtained
)
217 this.obtained
= obtained
;
220 public void setExpires(int expires
)
222 this.expires
= expires
;
225 public void setJackpot(boolean jackpot
)
227 this.jackpot
= jackpot
;
230 public void setPermanent(boolean permanent
)
232 this.permanent
= permanent
;
235 public int getObtainedId()
237 return this.obtainedId
;
240 public void setObtainedId(int drawingId
)
242 this.obtainedId
= drawingId
;