001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017package ca.uhn.fhir.model.dstu2.composite;
018
019import java.net.URI;
020import java.math.BigDecimal;
021import org.apache.commons.lang3.StringUtils;
022import java.util.*;
023import ca.uhn.fhir.model.api.*;
024import ca.uhn.fhir.model.primitive.*;
025import ca.uhn.fhir.model.api.annotation.*;
026import ca.uhn.fhir.model.base.composite.*;
027
028import ca.uhn.fhir.model.dstu2.valueset.AddressTypeEnum;
029import ca.uhn.fhir.model.dstu2.valueset.AddressUseEnum;
030import ca.uhn.fhir.model.dstu2.valueset.AggregationModeEnum;
031import ca.uhn.fhir.model.dstu2.valueset.BindingStrengthEnum;
032import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
033import ca.uhn.fhir.model.dstu2.composite.CodingDt;
034import ca.uhn.fhir.model.dstu2.valueset.ConstraintSeverityEnum;
035import ca.uhn.fhir.model.dstu2.valueset.ContactPointSystemEnum;
036import ca.uhn.fhir.model.dstu2.valueset.ContactPointUseEnum;
037import ca.uhn.fhir.model.dstu2.resource.Device;
038import ca.uhn.fhir.model.dstu2.valueset.EventTimingEnum;
039import ca.uhn.fhir.model.dstu2.valueset.IdentifierTypeCodesEnum;
040import ca.uhn.fhir.model.dstu2.valueset.IdentifierUseEnum;
041import ca.uhn.fhir.model.dstu2.valueset.NameUseEnum;
042import ca.uhn.fhir.model.dstu2.resource.Organization;
043import ca.uhn.fhir.model.dstu2.resource.Patient;
044import ca.uhn.fhir.model.dstu2.composite.PeriodDt;
045import ca.uhn.fhir.model.dstu2.resource.Practitioner;
046import ca.uhn.fhir.model.dstu2.valueset.PropertyRepresentationEnum;
047import ca.uhn.fhir.model.dstu2.valueset.QuantityComparatorEnum;
048import ca.uhn.fhir.model.dstu2.composite.QuantityDt;
049import ca.uhn.fhir.model.dstu2.composite.RangeDt;
050import ca.uhn.fhir.model.dstu2.resource.RelatedPerson;
051import ca.uhn.fhir.model.dstu2.valueset.SignatureTypeCodesEnum;
052import ca.uhn.fhir.model.dstu2.valueset.SlicingRulesEnum;
053import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
054import ca.uhn.fhir.model.dstu2.valueset.TimingAbbreviationEnum;
055import ca.uhn.fhir.model.dstu2.valueset.UnitsOfTimeEnum;
056import ca.uhn.fhir.model.dstu2.resource.ValueSet;
057import ca.uhn.fhir.model.dstu2.composite.BoundCodeableConceptDt;
058import ca.uhn.fhir.model.dstu2.composite.DurationDt;
059import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt;
060import ca.uhn.fhir.model.dstu2.composite.SimpleQuantityDt;
061import ca.uhn.fhir.model.primitive.Base64BinaryDt;
062import ca.uhn.fhir.model.primitive.BooleanDt;
063import ca.uhn.fhir.model.primitive.BoundCodeDt;
064import ca.uhn.fhir.model.primitive.CodeDt;
065import ca.uhn.fhir.model.primitive.DateTimeDt;
066import ca.uhn.fhir.model.primitive.DecimalDt;
067import ca.uhn.fhir.model.primitive.IdDt;
068import ca.uhn.fhir.model.primitive.InstantDt;
069import ca.uhn.fhir.model.primitive.IntegerDt;
070import ca.uhn.fhir.model.primitive.MarkdownDt;
071import ca.uhn.fhir.model.primitive.PositiveIntDt;
072import ca.uhn.fhir.model.primitive.StringDt;
073import ca.uhn.fhir.model.primitive.UnsignedIntDt;
074import ca.uhn.fhir.model.primitive.UriDt;
075
076/**
077 * HAPI/FHIR <b>PeriodDt</b> Datatype
078 * ()
079 *
080 * <p>
081 * <b>Definition:</b>
082 * A time period defined by a start and end date and optionally time.
083 * </p> 
084 *
085 * <p>
086 * <b>Requirements:</b>
087 * 
088 * </p> 
089 */
090@DatatypeDef(name="Period") 
091public class PeriodDt
092        extends  BaseIdentifiableElement         implements ICompositeDatatype{
093
094        /**
095         * Constructor
096         */
097        public PeriodDt() {
098                // nothing
099        }
100
101
102        @Child(name="start", type=DateTimeDt.class, order=0, min=0, max=1, summary=true, modifier=false)        
103        @Description(
104                shortDefinition="",
105                formalDefinition="The start of the period. The boundary is inclusive."
106        )
107        private DateTimeDt myStart;
108        
109        @Child(name="end", type=DateTimeDt.class, order=1, min=0, max=1, summary=true, modifier=false)  
110        @Description(
111                shortDefinition="",
112                formalDefinition="The end of the period. If the end of the period is missing, it means that the period is ongoing. The start may be in the past, and the end date in the future, which means that period is expected/planned to end at that time"
113        )
114        private DateTimeDt myEnd;
115        
116
117        @Override
118        public boolean isEmpty() {
119                return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(  myStart,  myEnd);
120        }
121        
122        @Override
123        public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
124                return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myStart, myEnd);
125        }
126
127        /**
128         * Gets the value(s) for <b>start</b> ().
129         * creating it if it does
130         * not exist. Will not return <code>null</code>.
131         *
132     * <p>
133     * <b>Definition:</b>
134     * The start of the period. The boundary is inclusive.
135     * </p> 
136         */
137        public DateTimeDt getStartElement() {  
138                if (myStart == null) {
139                        myStart = new DateTimeDt();
140                }
141                return myStart;
142        }
143
144        
145        /**
146         * Gets the value(s) for <b>start</b> ().
147         * creating it if it does
148         * not exist. This method may return <code>null</code>.
149         *
150     * <p>
151     * <b>Definition:</b>
152     * The start of the period. The boundary is inclusive.
153     * </p> 
154         */
155        public Date getStart() {  
156                return getStartElement().getValue();
157        }
158
159        /**
160         * Sets the value(s) for <b>start</b> ()
161         *
162     * <p>
163     * <b>Definition:</b>
164     * The start of the period. The boundary is inclusive.
165     * </p> 
166         */
167        public PeriodDt setStart(DateTimeDt theValue) {
168                myStart = theValue;
169                return this;
170        }
171        
172        
173
174        /**
175         * Sets the value for <b>start</b> ()
176         *
177     * <p>
178     * <b>Definition:</b>
179     * The start of the period. The boundary is inclusive.
180     * </p> 
181         */
182        public PeriodDt setStart( Date theDate,  TemporalPrecisionEnum thePrecision) {
183                myStart = new DateTimeDt(theDate, thePrecision); 
184                return this; 
185        }
186
187        /**
188         * Sets the value for <b>start</b> ()
189         *
190     * <p>
191     * <b>Definition:</b>
192     * The start of the period. The boundary is inclusive.
193     * </p> 
194         */
195        public PeriodDt setStartWithSecondsPrecision( Date theDate) {
196                myStart = new DateTimeDt(theDate); 
197                return this; 
198        }
199
200 
201        /**
202         * Gets the value(s) for <b>end</b> ().
203         * creating it if it does
204         * not exist. Will not return <code>null</code>.
205         *
206     * <p>
207     * <b>Definition:</b>
208     * The end of the period. If the end of the period is missing, it means that the period is ongoing. The start may be in the past, and the end date in the future, which means that period is expected/planned to end at that time
209     * </p> 
210         */
211        public DateTimeDt getEndElement() {  
212                if (myEnd == null) {
213                        myEnd = new DateTimeDt();
214                }
215                return myEnd;
216        }
217
218        
219        /**
220         * Gets the value(s) for <b>end</b> ().
221         * creating it if it does
222         * not exist. This method may return <code>null</code>.
223         *
224     * <p>
225     * <b>Definition:</b>
226     * The end of the period. If the end of the period is missing, it means that the period is ongoing. The start may be in the past, and the end date in the future, which means that period is expected/planned to end at that time
227     * </p> 
228         */
229        public Date getEnd() {  
230                return getEndElement().getValue();
231        }
232
233        /**
234         * Sets the value(s) for <b>end</b> ()
235         *
236     * <p>
237     * <b>Definition:</b>
238     * The end of the period. If the end of the period is missing, it means that the period is ongoing. The start may be in the past, and the end date in the future, which means that period is expected/planned to end at that time
239     * </p> 
240         */
241        public PeriodDt setEnd(DateTimeDt theValue) {
242                myEnd = theValue;
243                return this;
244        }
245        
246        
247
248        /**
249         * Sets the value for <b>end</b> ()
250         *
251     * <p>
252     * <b>Definition:</b>
253     * The end of the period. If the end of the period is missing, it means that the period is ongoing. The start may be in the past, and the end date in the future, which means that period is expected/planned to end at that time
254     * </p> 
255         */
256        public PeriodDt setEnd( Date theDate,  TemporalPrecisionEnum thePrecision) {
257                myEnd = new DateTimeDt(theDate, thePrecision); 
258                return this; 
259        }
260
261        /**
262         * Sets the value for <b>end</b> ()
263         *
264     * <p>
265     * <b>Definition:</b>
266     * The end of the period. If the end of the period is missing, it means that the period is ongoing. The start may be in the past, and the end date in the future, which means that period is expected/planned to end at that time
267     * </p> 
268         */
269        public PeriodDt setEndWithSecondsPrecision( Date theDate) {
270                myEnd = new DateTimeDt(theDate); 
271                return this; 
272        }
273
274 
275
276
277}