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