Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DateRange.java @ 5200:42bb6ff78d1b 2.9.11
Directly set the connectionInitSqls on the datasource
Somehow the factory fails to set the connectionInitSqls if
we add it to the dbcpProperties. So we now set it directly
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 08 Mar 2013 11:48:33 +0100 |
parents | 4a70525c5b0d |
children |
rev | line source |
---|---|
3210
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
3279
5a7b4f890d53
Delta W(t) chart subtitle fixed
Christian Lins <christian.lins@intevation.de>
parents:
3210
diff
changeset
|
3 import java.io.Serializable; |
3210
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 import java.util.Date; |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 public class DateRange |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 implements Serializable |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 { |
3279
5a7b4f890d53
Delta W(t) chart subtitle fixed
Christian Lins <christian.lins@intevation.de>
parents:
3210
diff
changeset
|
9 private static final long serialVersionUID = -2553914795388094818L; |
3280
4a70525c5b0d
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3279
diff
changeset
|
10 |
3210
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 protected Date from; |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 protected Date to; |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 public DateRange(Date from, Date to) { |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 this.from = from; |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 this.to = to; |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 } |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 public Date getFrom() { |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 return from; |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 } |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 public void setFrom(Date from) { |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 this.from = from; |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 } |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 public Date getTo() { |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 return to; |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 } |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 public void setTo(Date to) { |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 this.to = to; |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 } |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 private static final boolean equalDates(Date a, Date b) { |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 if (a == null && b != null) return false; |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 if (a != null && b == null) return false; |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 if (a == null) return true; |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 return a.equals(b); |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 } |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 @Override |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 public boolean equals(Object other) { |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 if (!(other instanceof DateRange)) { |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 return false; |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 } |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 DateRange o = (DateRange)other; |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 return equalDates(from, o.from) && equalDates(to, o.to); |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 } |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 } |
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |