1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.model.common;
|
11
|
|
12
|
import java.util.Calendar;
|
13
|
|
14
|
import javax.persistence.Embeddable;
|
15
|
import javax.persistence.Temporal;
|
16
|
import javax.persistence.TemporalType;
|
17
|
|
18
|
import org.apache.log4j.Logger;
|
19
|
|
20
|
/**
|
21
|
* @author m.doering
|
22
|
* @version 1.0
|
23
|
* @created 08-Nov-2007 13:07:00
|
24
|
*/
|
25
|
@Embeddable
|
26
|
public class TimePeriod {
|
27
|
private static final Logger logger = Logger.getLogger(TimePeriod.class);
|
28
|
|
29
|
|
30
|
private Calendar start;
|
31
|
private Calendar end;
|
32
|
|
33
|
|
34
|
/**
|
35
|
* Factory method
|
36
|
* @return
|
37
|
*/
|
38
|
public static TimePeriod NewInstance(){
|
39
|
return new TimePeriod();
|
40
|
}
|
41
|
|
42
|
|
43
|
/**
|
44
|
* Factory method
|
45
|
* @return
|
46
|
*/
|
47
|
public static TimePeriod NewInstance(Calendar startDate){
|
48
|
return new TimePeriod(startDate);
|
49
|
}
|
50
|
|
51
|
|
52
|
/**
|
53
|
* Factory method
|
54
|
* @return
|
55
|
*/
|
56
|
public static TimePeriod NewInstance(Calendar startDate, Calendar endDate){
|
57
|
return new TimePeriod(startDate, endDate);
|
58
|
}
|
59
|
|
60
|
/**
|
61
|
* Constructor
|
62
|
*/
|
63
|
protected TimePeriod() {
|
64
|
super();
|
65
|
}
|
66
|
public TimePeriod(Calendar startDate) {
|
67
|
start=startDate;
|
68
|
}
|
69
|
public TimePeriod(Calendar startDate, Calendar endDate) {
|
70
|
start=startDate;
|
71
|
end=endDate;
|
72
|
}
|
73
|
|
74
|
@Temporal(TemporalType.TIMESTAMP)
|
75
|
public Calendar getStart() {
|
76
|
return start;
|
77
|
}
|
78
|
public void setStart(Calendar start) {
|
79
|
this.start = start;
|
80
|
}
|
81
|
|
82
|
@Temporal(TemporalType.TIMESTAMP)
|
83
|
public Calendar getEnd() {
|
84
|
return end;
|
85
|
}
|
86
|
public void setEnd(Calendar end) {
|
87
|
this.end = end;
|
88
|
}
|
89
|
|
90
|
}
|