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>SignatureDt</b> Datatype
078 * ()
079 *
080 * <p>
081 * <b>Definition:</b>
082 * A digital signature along with supporting context. The signature may be electronic/cryptographic in nature, or a graphical image representing a hand-written signature, or a signature process. Different Signature approaches have different utilities
083 * </p> 
084 *
085 * <p>
086 * <b>Requirements:</b>
087 * There are a number of places where content must be signed in healthcare
088 * </p> 
089 */
090@DatatypeDef(name="Signature") 
091public class SignatureDt
092        extends  BaseIdentifiableElement         implements ICompositeDatatype{
093
094        /**
095         * Constructor
096         */
097        public SignatureDt() {
098                // nothing
099        }
100
101
102        @Child(name="type", type=CodingDt.class, order=0, min=1, max=Child.MAX_UNLIMITED, summary=true, modifier=false) 
103        @Description(
104                shortDefinition="",
105                formalDefinition="An indication of the reason that the entity signed this document. This may be explicitly included as part of the signature information and can be used when determining accountability for various actions concerning the document."
106        )
107        @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/valueset-signature-type")
108        private java.util.List<CodingDt> myType;
109        
110        @Child(name="when", type=InstantDt.class, order=1, min=1, max=1, summary=true, modifier=false)  
111        @Description(
112                shortDefinition="",
113                formalDefinition="When the digital signature was signed."
114        )
115        private InstantDt myWhen;
116        
117        @Child(name="who", order=2, min=1, max=1, summary=true, modifier=false, type={
118                UriDt.class,            Practitioner.class,             RelatedPerson.class,            Patient.class,          Device.class,           Organization.class      })
119        @Description(
120                shortDefinition="",
121                formalDefinition="A reference to an application-usable description of the person that signed the certificate (e.g. the signature used their private key)"
122        )
123        private IDatatype myWho;
124        
125        @Child(name="contentType", type=CodeDt.class, order=3, min=1, max=1, summary=true, modifier=false)      
126        @Description(
127                shortDefinition="",
128                formalDefinition="A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jwt for JWT, and image/* for a graphical image of a signature"
129        )
130        private CodeDt myContentType;
131        
132        @Child(name="blob", type=Base64BinaryDt.class, order=4, min=1, max=1, summary=true, modifier=false)     
133        @Description(
134                shortDefinition="",
135                formalDefinition="The base64 encoding of the Signature content"
136        )
137        private Base64BinaryDt myBlob;
138        
139
140        @Override
141        public boolean isEmpty() {
142                return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(  myType,  myWhen,  myWho,  myContentType,  myBlob);
143        }
144        
145        @Override
146        public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
147                return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myType, myWhen, myWho, myContentType, myBlob);
148        }
149
150        /**
151         * Gets the value(s) for <b>type</b> ().
152         * creating it if it does
153         * not exist. Will not return <code>null</code>.
154         *
155     * <p>
156     * <b>Definition:</b>
157     * An indication of the reason that the entity signed this document. This may be explicitly included as part of the signature information and can be used when determining accountability for various actions concerning the document.
158     * </p> 
159         */
160        public java.util.List<CodingDt> getType() {  
161                if (myType == null) {
162                        myType = new java.util.ArrayList<CodingDt>();
163                }
164                return myType;
165        }
166
167        /**
168         * Sets the value(s) for <b>type</b> ()
169         *
170     * <p>
171     * <b>Definition:</b>
172     * An indication of the reason that the entity signed this document. This may be explicitly included as part of the signature information and can be used when determining accountability for various actions concerning the document.
173     * </p> 
174         */
175        public SignatureDt setType(java.util.List<CodingDt> theValue) {
176                myType = theValue;
177                return this;
178        }
179        
180        
181
182        /**
183         * Adds and returns a new value for <b>type</b> ()
184         *
185     * <p>
186     * <b>Definition:</b>
187     * An indication of the reason that the entity signed this document. This may be explicitly included as part of the signature information and can be used when determining accountability for various actions concerning the document.
188     * </p> 
189         */
190        public CodingDt addType() {
191                CodingDt newType = new CodingDt();
192                getType().add(newType);
193                return newType; 
194        }
195
196        /**
197         * Adds a given new value for <b>type</b> ()
198         *
199         * <p>
200         * <b>Definition:</b>
201         * An indication of the reason that the entity signed this document. This may be explicitly included as part of the signature information and can be used when determining accountability for various actions concerning the document.
202         * </p>
203         * @param theValue The type to add (must not be <code>null</code>)
204         */
205        public SignatureDt addType(CodingDt theValue) {
206                if (theValue == null) {
207                        throw new NullPointerException("theValue must not be null");
208                }
209                getType().add(theValue);
210                return this;
211        }
212
213        /**
214         * Gets the first repetition for <b>type</b> (),
215         * creating it if it does not already exist.
216         *
217     * <p>
218     * <b>Definition:</b>
219     * An indication of the reason that the entity signed this document. This may be explicitly included as part of the signature information and can be used when determining accountability for various actions concerning the document.
220     * </p> 
221         */
222        public CodingDt getTypeFirstRep() {
223                if (getType().isEmpty()) {
224                        return addType();
225                }
226                return getType().get(0); 
227        }
228  
229        /**
230         * Gets the value(s) for <b>when</b> ().
231         * creating it if it does
232         * not exist. Will not return <code>null</code>.
233         *
234     * <p>
235     * <b>Definition:</b>
236     * When the digital signature was signed.
237     * </p> 
238         */
239        public InstantDt getWhenElement() {  
240                if (myWhen == null) {
241                        myWhen = new InstantDt();
242                }
243                return myWhen;
244        }
245
246        
247        /**
248         * Gets the value(s) for <b>when</b> ().
249         * creating it if it does
250         * not exist. This method may return <code>null</code>.
251         *
252     * <p>
253     * <b>Definition:</b>
254     * When the digital signature was signed.
255     * </p> 
256         */
257        public Date getWhen() {  
258                return getWhenElement().getValue();
259        }
260
261        /**
262         * Sets the value(s) for <b>when</b> ()
263         *
264     * <p>
265     * <b>Definition:</b>
266     * When the digital signature was signed.
267     * </p> 
268         */
269        public SignatureDt setWhen(InstantDt theValue) {
270                myWhen = theValue;
271                return this;
272        }
273        
274        
275
276        /**
277         * Sets the value for <b>when</b> ()
278         *
279     * <p>
280     * <b>Definition:</b>
281     * When the digital signature was signed.
282     * </p> 
283         */
284        public SignatureDt setWhenWithMillisPrecision( Date theDate) {
285                myWhen = new InstantDt(theDate); 
286                return this; 
287        }
288
289        /**
290         * Sets the value for <b>when</b> ()
291         *
292     * <p>
293     * <b>Definition:</b>
294     * When the digital signature was signed.
295     * </p> 
296         */
297        public SignatureDt setWhen( Date theDate,  TemporalPrecisionEnum thePrecision) {
298                myWhen = new InstantDt(theDate, thePrecision); 
299                return this; 
300        }
301
302 
303        /**
304         * Gets the value(s) for <b>who[x]</b> ().
305         * creating it if it does
306         * not exist. Will not return <code>null</code>.
307         *
308     * <p>
309     * <b>Definition:</b>
310     * A reference to an application-usable description of the person that signed the certificate (e.g. the signature used their private key)
311     * </p> 
312         */
313        public IDatatype getWho() {  
314                return myWho;
315        }
316
317        /**
318         * Sets the value(s) for <b>who[x]</b> ()
319         *
320     * <p>
321     * <b>Definition:</b>
322     * A reference to an application-usable description of the person that signed the certificate (e.g. the signature used their private key)
323     * </p> 
324         */
325        public SignatureDt setWho(IDatatype theValue) {
326                myWho = theValue;
327                return this;
328        }
329        
330        
331
332  
333        /**
334         * Gets the value(s) for <b>contentType</b> ().
335         * creating it if it does
336         * not exist. Will not return <code>null</code>.
337         *
338     * <p>
339     * <b>Definition:</b>
340     * A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jwt for JWT, and image/* for a graphical image of a signature
341     * </p> 
342         */
343        public CodeDt getContentTypeElement() {  
344                if (myContentType == null) {
345                        myContentType = new CodeDt();
346                }
347                return myContentType;
348        }
349
350        
351        /**
352         * Gets the value(s) for <b>contentType</b> ().
353         * creating it if it does
354         * not exist. This method may return <code>null</code>.
355         *
356     * <p>
357     * <b>Definition:</b>
358     * A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jwt for JWT, and image/* for a graphical image of a signature
359     * </p> 
360         */
361        public String getContentType() {  
362                return getContentTypeElement().getValue();
363        }
364
365        /**
366         * Sets the value(s) for <b>contentType</b> ()
367         *
368     * <p>
369     * <b>Definition:</b>
370     * A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jwt for JWT, and image/* for a graphical image of a signature
371     * </p> 
372         */
373        public SignatureDt setContentType(CodeDt theValue) {
374                myContentType = theValue;
375                return this;
376        }
377        
378        
379
380        /**
381         * Sets the value for <b>contentType</b> ()
382         *
383     * <p>
384     * <b>Definition:</b>
385     * A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jwt for JWT, and image/* for a graphical image of a signature
386     * </p> 
387         */
388        public SignatureDt setContentType( String theCode) {
389                myContentType = new CodeDt(theCode); 
390                return this; 
391        }
392
393 
394        /**
395         * Gets the value(s) for <b>blob</b> ().
396         * creating it if it does
397         * not exist. Will not return <code>null</code>.
398         *
399     * <p>
400     * <b>Definition:</b>
401     * The base64 encoding of the Signature content
402     * </p> 
403         */
404        public Base64BinaryDt getBlobElement() {  
405                if (myBlob == null) {
406                        myBlob = new Base64BinaryDt();
407                }
408                return myBlob;
409        }
410
411        
412        /**
413         * Gets the value(s) for <b>blob</b> ().
414         * creating it if it does
415         * not exist. This method may return <code>null</code>.
416         *
417     * <p>
418     * <b>Definition:</b>
419     * The base64 encoding of the Signature content
420     * </p> 
421         */
422        public byte[] getBlob() {  
423                return getBlobElement().getValue();
424        }
425
426        /**
427         * Sets the value(s) for <b>blob</b> ()
428         *
429     * <p>
430     * <b>Definition:</b>
431     * The base64 encoding of the Signature content
432     * </p> 
433         */
434        public SignatureDt setBlob(Base64BinaryDt theValue) {
435                myBlob = theValue;
436                return this;
437        }
438        
439        
440
441        /**
442         * Sets the value for <b>blob</b> ()
443         *
444     * <p>
445     * <b>Definition:</b>
446     * The base64 encoding of the Signature content
447     * </p> 
448         */
449        public SignatureDt setBlob( byte[] theBytes) {
450                myBlob = new Base64BinaryDt(theBytes); 
451                return this; 
452        }
453
454 
455
456
457}