1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package ca.uhn.fhir.model.dstu.composite;
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 import java.util.Date;
40 import java.util.List;
41
42 import ca.uhn.fhir.model.api.BaseIdentifiableElement;
43 import ca.uhn.fhir.model.api.ICompositeDatatype;
44 import ca.uhn.fhir.model.api.IElement;
45 import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
46 import ca.uhn.fhir.model.api.annotation.Child;
47 import ca.uhn.fhir.model.api.annotation.DatatypeDef;
48 import ca.uhn.fhir.model.api.annotation.Description;
49 import ca.uhn.fhir.model.primitive.DateTimeDt;
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65 @DatatypeDef(name="PeriodDt")
66 public class PeriodDt
67 extends BaseIdentifiableElement implements ICompositeDatatype
68 {
69
70
71
72
73 public PeriodDt() {
74
75 }
76
77
78 @Child(name="start", type=DateTimeDt.class, order=0, min=0, max=1)
79 @Description(
80 shortDefinition="Starting time with inclusive boundary",
81 formalDefinition="The start of the period. The boundary is inclusive."
82 )
83 private DateTimeDt myStart;
84
85 @Child(name="end", type=DateTimeDt.class, order=1, min=0, max=1)
86 @Description(
87 shortDefinition="End time with inclusive boundary, if not ongoing",
88 formalDefinition="The end of the period. If the end of the period is missing, it means that the period is ongoing"
89 )
90 private DateTimeDt myEnd;
91
92
93 @Override
94 public boolean isEmpty() {
95 return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myStart, myEnd);
96 }
97
98 @Override
99 public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
100 return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myStart, myEnd);
101 }
102
103
104
105
106
107
108
109
110
111
112
113 public DateTimeDt getStart() {
114 if (myStart == null) {
115 myStart = new DateTimeDt();
116 }
117 return myStart;
118 }
119
120
121
122
123
124
125
126
127
128 public PeriodDt setStart(DateTimeDt theValue) {
129 myStart = theValue;
130 return this;
131 }
132
133
134
135
136
137
138
139
140
141 public PeriodDt setStartWithSecondsPrecision( Date theDate) {
142 myStart = new DateTimeDt(theDate);
143 return this;
144 }
145
146
147
148
149
150
151
152
153
154 public PeriodDt setStart( Date theDate, TemporalPrecisionEnum thePrecision) {
155 myStart = new DateTimeDt(theDate, thePrecision);
156 return this;
157 }
158
159
160
161
162
163
164
165
166
167
168
169
170 public DateTimeDt getEnd() {
171 if (myEnd == null) {
172 myEnd = new DateTimeDt();
173 }
174 return myEnd;
175 }
176
177
178
179
180
181
182
183
184
185 public PeriodDt setEnd(DateTimeDt theValue) {
186 myEnd = theValue;
187 return this;
188 }
189
190
191
192
193
194
195
196
197
198 public PeriodDt setEndWithSecondsPrecision( Date theDate) {
199 myEnd = new DateTimeDt(theDate);
200 return this;
201 }
202
203
204
205
206
207
208
209
210
211 public PeriodDt setEnd( Date theDate, TemporalPrecisionEnum thePrecision) {
212 myEnd = new DateTimeDt(theDate, thePrecision);
213 return this;
214 }
215
216
217
218
219 }