001package org.hl7.fhir.dstu2016may.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
033import java.util.ArrayList;
034import java.util.List;
035
036import org.hl7.fhir.exceptions.FHIRException;
037
038import ca.uhn.fhir.model.api.annotation.Child;
039import ca.uhn.fhir.model.api.annotation.Description;
040import ca.uhn.fhir.model.api.annotation.ResourceDef;
041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
042/**
043 * The DecisionSupportServiceModule describes a unit of decision support functionality that is made available as a service, such as immunization modules or drug-drug interaction checking.
044 */
045@ResourceDef(name="DecisionSupportServiceModule", profile="http://hl7.org/fhir/Profile/DecisionSupportServiceModule")
046public class DecisionSupportServiceModule extends DomainResource {
047
048    /**
049     * The metadata for the decision support service module, including publishing, life-cycle, version, documentation, and supporting evidence.
050     */
051    @Child(name = "moduleMetadata", type = {ModuleMetadata.class}, order=0, min=0, max=1, modifier=false, summary=true)
052    @Description(shortDefinition="Metadata for the service module", formalDefinition="The metadata for the decision support service module, including publishing, life-cycle, version, documentation, and supporting evidence." )
053    protected ModuleMetadata moduleMetadata;
054
055    /**
056     * The trigger element defines when the rule should be invoked. This information is used by consumers of the rule to determine how to integrate the rule into a specific workflow.
057     */
058    @Child(name = "trigger", type = {TriggerDefinition.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
059    @Description(shortDefinition="\"when\" the module should be invoked", formalDefinition="The trigger element defines when the rule should be invoked. This information is used by consumers of the rule to determine how to integrate the rule into a specific workflow." )
060    protected List<TriggerDefinition> trigger;
061
062    /**
063     * The parameters to the module. This collection specifies both the input and output parameters. Input parameters are provided by the caller as part of the $evaluate operation. Output parameters are included in the GuidanceResponse.
064     */
065    @Child(name = "parameter", type = {ParameterDefinition.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
066    @Description(shortDefinition="Parameters to the module", formalDefinition="The parameters to the module. This collection specifies both the input and output parameters. Input parameters are provided by the caller as part of the $evaluate operation. Output parameters are included in the GuidanceResponse." )
067    protected List<ParameterDefinition> parameter;
068
069    /**
070     * Data requirements are a machine processable description of the data required by the module in order to perform a successful evaluation.
071     */
072    @Child(name = "dataRequirement", type = {DataRequirement.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
073    @Description(shortDefinition="Data requirements for the module", formalDefinition="Data requirements are a machine processable description of the data required by the module in order to perform a successful evaluation." )
074    protected List<DataRequirement> dataRequirement;
075
076    private static final long serialVersionUID = 1154664442L;
077
078  /**
079   * Constructor
080   */
081    public DecisionSupportServiceModule() {
082      super();
083    }
084
085    /**
086     * @return {@link #moduleMetadata} (The metadata for the decision support service module, including publishing, life-cycle, version, documentation, and supporting evidence.)
087     */
088    public ModuleMetadata getModuleMetadata() { 
089      if (this.moduleMetadata == null)
090        if (Configuration.errorOnAutoCreate())
091          throw new Error("Attempt to auto-create DecisionSupportServiceModule.moduleMetadata");
092        else if (Configuration.doAutoCreate())
093          this.moduleMetadata = new ModuleMetadata(); // cc
094      return this.moduleMetadata;
095    }
096
097    public boolean hasModuleMetadata() { 
098      return this.moduleMetadata != null && !this.moduleMetadata.isEmpty();
099    }
100
101    /**
102     * @param value {@link #moduleMetadata} (The metadata for the decision support service module, including publishing, life-cycle, version, documentation, and supporting evidence.)
103     */
104    public DecisionSupportServiceModule setModuleMetadata(ModuleMetadata value) { 
105      this.moduleMetadata = value;
106      return this;
107    }
108
109    /**
110     * @return {@link #trigger} (The trigger element defines when the rule should be invoked. This information is used by consumers of the rule to determine how to integrate the rule into a specific workflow.)
111     */
112    public List<TriggerDefinition> getTrigger() { 
113      if (this.trigger == null)
114        this.trigger = new ArrayList<TriggerDefinition>();
115      return this.trigger;
116    }
117
118    public boolean hasTrigger() { 
119      if (this.trigger == null)
120        return false;
121      for (TriggerDefinition item : this.trigger)
122        if (!item.isEmpty())
123          return true;
124      return false;
125    }
126
127    /**
128     * @return {@link #trigger} (The trigger element defines when the rule should be invoked. This information is used by consumers of the rule to determine how to integrate the rule into a specific workflow.)
129     */
130    // syntactic sugar
131    public TriggerDefinition addTrigger() { //3
132      TriggerDefinition t = new TriggerDefinition();
133      if (this.trigger == null)
134        this.trigger = new ArrayList<TriggerDefinition>();
135      this.trigger.add(t);
136      return t;
137    }
138
139    // syntactic sugar
140    public DecisionSupportServiceModule addTrigger(TriggerDefinition t) { //3
141      if (t == null)
142        return this;
143      if (this.trigger == null)
144        this.trigger = new ArrayList<TriggerDefinition>();
145      this.trigger.add(t);
146      return this;
147    }
148
149    /**
150     * @return {@link #parameter} (The parameters to the module. This collection specifies both the input and output parameters. Input parameters are provided by the caller as part of the $evaluate operation. Output parameters are included in the GuidanceResponse.)
151     */
152    public List<ParameterDefinition> getParameter() { 
153      if (this.parameter == null)
154        this.parameter = new ArrayList<ParameterDefinition>();
155      return this.parameter;
156    }
157
158    public boolean hasParameter() { 
159      if (this.parameter == null)
160        return false;
161      for (ParameterDefinition item : this.parameter)
162        if (!item.isEmpty())
163          return true;
164      return false;
165    }
166
167    /**
168     * @return {@link #parameter} (The parameters to the module. This collection specifies both the input and output parameters. Input parameters are provided by the caller as part of the $evaluate operation. Output parameters are included in the GuidanceResponse.)
169     */
170    // syntactic sugar
171    public ParameterDefinition addParameter() { //3
172      ParameterDefinition t = new ParameterDefinition();
173      if (this.parameter == null)
174        this.parameter = new ArrayList<ParameterDefinition>();
175      this.parameter.add(t);
176      return t;
177    }
178
179    // syntactic sugar
180    public DecisionSupportServiceModule addParameter(ParameterDefinition t) { //3
181      if (t == null)
182        return this;
183      if (this.parameter == null)
184        this.parameter = new ArrayList<ParameterDefinition>();
185      this.parameter.add(t);
186      return this;
187    }
188
189    /**
190     * @return {@link #dataRequirement} (Data requirements are a machine processable description of the data required by the module in order to perform a successful evaluation.)
191     */
192    public List<DataRequirement> getDataRequirement() { 
193      if (this.dataRequirement == null)
194        this.dataRequirement = new ArrayList<DataRequirement>();
195      return this.dataRequirement;
196    }
197
198    public boolean hasDataRequirement() { 
199      if (this.dataRequirement == null)
200        return false;
201      for (DataRequirement item : this.dataRequirement)
202        if (!item.isEmpty())
203          return true;
204      return false;
205    }
206
207    /**
208     * @return {@link #dataRequirement} (Data requirements are a machine processable description of the data required by the module in order to perform a successful evaluation.)
209     */
210    // syntactic sugar
211    public DataRequirement addDataRequirement() { //3
212      DataRequirement t = new DataRequirement();
213      if (this.dataRequirement == null)
214        this.dataRequirement = new ArrayList<DataRequirement>();
215      this.dataRequirement.add(t);
216      return t;
217    }
218
219    // syntactic sugar
220    public DecisionSupportServiceModule addDataRequirement(DataRequirement t) { //3
221      if (t == null)
222        return this;
223      if (this.dataRequirement == null)
224        this.dataRequirement = new ArrayList<DataRequirement>();
225      this.dataRequirement.add(t);
226      return this;
227    }
228
229      protected void listChildren(List<Property> childrenList) {
230        super.listChildren(childrenList);
231        childrenList.add(new Property("moduleMetadata", "ModuleMetadata", "The metadata for the decision support service module, including publishing, life-cycle, version, documentation, and supporting evidence.", 0, java.lang.Integer.MAX_VALUE, moduleMetadata));
232        childrenList.add(new Property("trigger", "TriggerDefinition", "The trigger element defines when the rule should be invoked. This information is used by consumers of the rule to determine how to integrate the rule into a specific workflow.", 0, java.lang.Integer.MAX_VALUE, trigger));
233        childrenList.add(new Property("parameter", "ParameterDefinition", "The parameters to the module. This collection specifies both the input and output parameters. Input parameters are provided by the caller as part of the $evaluate operation. Output parameters are included in the GuidanceResponse.", 0, java.lang.Integer.MAX_VALUE, parameter));
234        childrenList.add(new Property("dataRequirement", "DataRequirement", "Data requirements are a machine processable description of the data required by the module in order to perform a successful evaluation.", 0, java.lang.Integer.MAX_VALUE, dataRequirement));
235      }
236
237      @Override
238      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
239        switch (hash) {
240        case 455891387: /*moduleMetadata*/ return this.moduleMetadata == null ? new Base[0] : new Base[] {this.moduleMetadata}; // ModuleMetadata
241        case -1059891784: /*trigger*/ return this.trigger == null ? new Base[0] : this.trigger.toArray(new Base[this.trigger.size()]); // TriggerDefinition
242        case 1954460585: /*parameter*/ return this.parameter == null ? new Base[0] : this.parameter.toArray(new Base[this.parameter.size()]); // ParameterDefinition
243        case 629147193: /*dataRequirement*/ return this.dataRequirement == null ? new Base[0] : this.dataRequirement.toArray(new Base[this.dataRequirement.size()]); // DataRequirement
244        default: return super.getProperty(hash, name, checkValid);
245        }
246
247      }
248
249      @Override
250      public void setProperty(int hash, String name, Base value) throws FHIRException {
251        switch (hash) {
252        case 455891387: // moduleMetadata
253          this.moduleMetadata = castToModuleMetadata(value); // ModuleMetadata
254          break;
255        case -1059891784: // trigger
256          this.getTrigger().add(castToTriggerDefinition(value)); // TriggerDefinition
257          break;
258        case 1954460585: // parameter
259          this.getParameter().add(castToParameterDefinition(value)); // ParameterDefinition
260          break;
261        case 629147193: // dataRequirement
262          this.getDataRequirement().add(castToDataRequirement(value)); // DataRequirement
263          break;
264        default: super.setProperty(hash, name, value);
265        }
266
267      }
268
269      @Override
270      public void setProperty(String name, Base value) throws FHIRException {
271        if (name.equals("moduleMetadata"))
272          this.moduleMetadata = castToModuleMetadata(value); // ModuleMetadata
273        else if (name.equals("trigger"))
274          this.getTrigger().add(castToTriggerDefinition(value));
275        else if (name.equals("parameter"))
276          this.getParameter().add(castToParameterDefinition(value));
277        else if (name.equals("dataRequirement"))
278          this.getDataRequirement().add(castToDataRequirement(value));
279        else
280          super.setProperty(name, value);
281      }
282
283      @Override
284      public Base makeProperty(int hash, String name) throws FHIRException {
285        switch (hash) {
286        case 455891387:  return getModuleMetadata(); // ModuleMetadata
287        case -1059891784:  return addTrigger(); // TriggerDefinition
288        case 1954460585:  return addParameter(); // ParameterDefinition
289        case 629147193:  return addDataRequirement(); // DataRequirement
290        default: return super.makeProperty(hash, name);
291        }
292
293      }
294
295      @Override
296      public Base addChild(String name) throws FHIRException {
297        if (name.equals("moduleMetadata")) {
298          this.moduleMetadata = new ModuleMetadata();
299          return this.moduleMetadata;
300        }
301        else if (name.equals("trigger")) {
302          return addTrigger();
303        }
304        else if (name.equals("parameter")) {
305          return addParameter();
306        }
307        else if (name.equals("dataRequirement")) {
308          return addDataRequirement();
309        }
310        else
311          return super.addChild(name);
312      }
313
314  public String fhirType() {
315    return "DecisionSupportServiceModule";
316
317  }
318
319      public DecisionSupportServiceModule copy() {
320        DecisionSupportServiceModule dst = new DecisionSupportServiceModule();
321        copyValues(dst);
322        dst.moduleMetadata = moduleMetadata == null ? null : moduleMetadata.copy();
323        if (trigger != null) {
324          dst.trigger = new ArrayList<TriggerDefinition>();
325          for (TriggerDefinition i : trigger)
326            dst.trigger.add(i.copy());
327        };
328        if (parameter != null) {
329          dst.parameter = new ArrayList<ParameterDefinition>();
330          for (ParameterDefinition i : parameter)
331            dst.parameter.add(i.copy());
332        };
333        if (dataRequirement != null) {
334          dst.dataRequirement = new ArrayList<DataRequirement>();
335          for (DataRequirement i : dataRequirement)
336            dst.dataRequirement.add(i.copy());
337        };
338        return dst;
339      }
340
341      protected DecisionSupportServiceModule typedCopy() {
342        return copy();
343      }
344
345      @Override
346      public boolean equalsDeep(Base other) {
347        if (!super.equalsDeep(other))
348          return false;
349        if (!(other instanceof DecisionSupportServiceModule))
350          return false;
351        DecisionSupportServiceModule o = (DecisionSupportServiceModule) other;
352        return compareDeep(moduleMetadata, o.moduleMetadata, true) && compareDeep(trigger, o.trigger, true)
353           && compareDeep(parameter, o.parameter, true) && compareDeep(dataRequirement, o.dataRequirement, true)
354          ;
355      }
356
357      @Override
358      public boolean equalsShallow(Base other) {
359        if (!super.equalsShallow(other))
360          return false;
361        if (!(other instanceof DecisionSupportServiceModule))
362          return false;
363        DecisionSupportServiceModule o = (DecisionSupportServiceModule) other;
364        return true;
365      }
366
367      public boolean isEmpty() {
368        return super.isEmpty() && (moduleMetadata == null || moduleMetadata.isEmpty()) && (trigger == null || trigger.isEmpty())
369           && (parameter == null || parameter.isEmpty()) && (dataRequirement == null || dataRequirement.isEmpty())
370          ;
371      }
372
373  @Override
374  public ResourceType getResourceType() {
375    return ResourceType.DecisionSupportServiceModule;
376   }
377
378 /**
379   * Search parameter: <b>topic</b>
380   * <p>
381   * Description: <b>Topics associated with the module</b><br>
382   * Type: <b>token</b><br>
383   * Path: <b>DecisionSupportServiceModule.moduleMetadata.topic</b><br>
384   * </p>
385   */
386  @SearchParamDefinition(name="topic", path="DecisionSupportServiceModule.moduleMetadata.topic", description="Topics associated with the module", type="token" )
387  public static final String SP_TOPIC = "topic";
388 /**
389   * <b>Fluent Client</b> search parameter constant for <b>topic</b>
390   * <p>
391   * Description: <b>Topics associated with the module</b><br>
392   * Type: <b>token</b><br>
393   * Path: <b>DecisionSupportServiceModule.moduleMetadata.topic</b><br>
394   * </p>
395   */
396  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TOPIC = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TOPIC);
397
398 /**
399   * Search parameter: <b>title</b>
400   * <p>
401   * Description: <b>Text search against the title</b><br>
402   * Type: <b>string</b><br>
403   * Path: <b>DecisionSupportServiceModule.moduleMetadata.title</b><br>
404   * </p>
405   */
406  @SearchParamDefinition(name="title", path="DecisionSupportServiceModule.moduleMetadata.title", description="Text search against the title", type="string" )
407  public static final String SP_TITLE = "title";
408 /**
409   * <b>Fluent Client</b> search parameter constant for <b>title</b>
410   * <p>
411   * Description: <b>Text search against the title</b><br>
412   * Type: <b>string</b><br>
413   * Path: <b>DecisionSupportServiceModule.moduleMetadata.title</b><br>
414   * </p>
415   */
416  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
417
418 /**
419   * Search parameter: <b>status</b>
420   * <p>
421   * Description: <b>Status of the module</b><br>
422   * Type: <b>token</b><br>
423   * Path: <b>DecisionSupportServiceModule.moduleMetadata.status</b><br>
424   * </p>
425   */
426  @SearchParamDefinition(name="status", path="DecisionSupportServiceModule.moduleMetadata.status", description="Status of the module", type="token" )
427  public static final String SP_STATUS = "status";
428 /**
429   * <b>Fluent Client</b> search parameter constant for <b>status</b>
430   * <p>
431   * Description: <b>Status of the module</b><br>
432   * Type: <b>token</b><br>
433   * Path: <b>DecisionSupportServiceModule.moduleMetadata.status</b><br>
434   * </p>
435   */
436  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
437
438 /**
439   * Search parameter: <b>description</b>
440   * <p>
441   * Description: <b>Text search against the description</b><br>
442   * Type: <b>string</b><br>
443   * Path: <b>DecisionSupportServiceModule.moduleMetadata.description</b><br>
444   * </p>
445   */
446  @SearchParamDefinition(name="description", path="DecisionSupportServiceModule.moduleMetadata.description", description="Text search against the description", type="string" )
447  public static final String SP_DESCRIPTION = "description";
448 /**
449   * <b>Fluent Client</b> search parameter constant for <b>description</b>
450   * <p>
451   * Description: <b>Text search against the description</b><br>
452   * Type: <b>string</b><br>
453   * Path: <b>DecisionSupportServiceModule.moduleMetadata.description</b><br>
454   * </p>
455   */
456  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DESCRIPTION);
457
458 /**
459   * Search parameter: <b>identifier</b>
460   * <p>
461   * Description: <b>Logical identifier for the module (e.g. CMS-143)</b><br>
462   * Type: <b>token</b><br>
463   * Path: <b>DecisionSupportServiceModule.moduleMetadata.identifier</b><br>
464   * </p>
465   */
466  @SearchParamDefinition(name="identifier", path="DecisionSupportServiceModule.moduleMetadata.identifier", description="Logical identifier for the module (e.g. CMS-143)", type="token" )
467  public static final String SP_IDENTIFIER = "identifier";
468 /**
469   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
470   * <p>
471   * Description: <b>Logical identifier for the module (e.g. CMS-143)</b><br>
472   * Type: <b>token</b><br>
473   * Path: <b>DecisionSupportServiceModule.moduleMetadata.identifier</b><br>
474   * </p>
475   */
476  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
477
478 /**
479   * Search parameter: <b>version</b>
480   * <p>
481   * Description: <b>Version of the module (e.g. 1.0.0)</b><br>
482   * Type: <b>string</b><br>
483   * Path: <b>DecisionSupportServiceModule.moduleMetadata.version</b><br>
484   * </p>
485   */
486  @SearchParamDefinition(name="version", path="DecisionSupportServiceModule.moduleMetadata.version", description="Version of the module (e.g. 1.0.0)", type="string" )
487  public static final String SP_VERSION = "version";
488 /**
489   * <b>Fluent Client</b> search parameter constant for <b>version</b>
490   * <p>
491   * Description: <b>Version of the module (e.g. 1.0.0)</b><br>
492   * Type: <b>string</b><br>
493   * Path: <b>DecisionSupportServiceModule.moduleMetadata.version</b><br>
494   * </p>
495   */
496  public static final ca.uhn.fhir.rest.gclient.StringClientParam VERSION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_VERSION);
497
498
499}
500