001package org.hl7.fhir.dstu2.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
033import java.util.ArrayList;
034import java.util.List;
035
036import ca.uhn.fhir.model.api.annotation.Block;
037import ca.uhn.fhir.model.api.annotation.Child;
038import ca.uhn.fhir.model.api.annotation.Description;
039import ca.uhn.fhir.model.api.annotation.ResourceDef;
040import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
041import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
042import org.hl7.fhir.exceptions.FHIRException;
043import org.hl7.fhir.utilities.Utilities;
044
045/**
046 * Represents a defined collection of entities that may be discussed or acted
047 * upon collectively but which are not expected to act collectively and are not
048 * formally or legally recognized; i.e. a collection of entities that isn't an
049 * Organization.
050 */
051@ResourceDef(name = "Group", profile = "http://hl7.org/fhir/Profile/Group")
052public class Group extends DomainResource {
053
054  public enum GroupType {
055    /**
056     * Group contains "person" Patient resources
057     */
058    PERSON,
059    /**
060     * Group contains "animal" Patient resources
061     */
062    ANIMAL,
063    /**
064     * Group contains healthcare practitioner resources
065     */
066    PRACTITIONER,
067    /**
068     * Group contains Device resources
069     */
070    DEVICE,
071    /**
072     * Group contains Medication resources
073     */
074    MEDICATION,
075    /**
076     * Group contains Substance resources
077     */
078    SUBSTANCE,
079    /**
080     * added to help the parsers
081     */
082    NULL;
083
084    public static GroupType fromCode(String codeString) throws FHIRException {
085      if (codeString == null || "".equals(codeString))
086        return null;
087      if ("person".equals(codeString))
088        return PERSON;
089      if ("animal".equals(codeString))
090        return ANIMAL;
091      if ("practitioner".equals(codeString))
092        return PRACTITIONER;
093      if ("device".equals(codeString))
094        return DEVICE;
095      if ("medication".equals(codeString))
096        return MEDICATION;
097      if ("substance".equals(codeString))
098        return SUBSTANCE;
099      throw new FHIRException("Unknown GroupType code '" + codeString + "'");
100    }
101
102    public String toCode() {
103      switch (this) {
104      case PERSON:
105        return "person";
106      case ANIMAL:
107        return "animal";
108      case PRACTITIONER:
109        return "practitioner";
110      case DEVICE:
111        return "device";
112      case MEDICATION:
113        return "medication";
114      case SUBSTANCE:
115        return "substance";
116      case NULL:
117        return null;
118      default:
119        return "?";
120      }
121    }
122
123    public String getSystem() {
124      switch (this) {
125      case PERSON:
126        return "http://hl7.org/fhir/group-type";
127      case ANIMAL:
128        return "http://hl7.org/fhir/group-type";
129      case PRACTITIONER:
130        return "http://hl7.org/fhir/group-type";
131      case DEVICE:
132        return "http://hl7.org/fhir/group-type";
133      case MEDICATION:
134        return "http://hl7.org/fhir/group-type";
135      case SUBSTANCE:
136        return "http://hl7.org/fhir/group-type";
137      case NULL:
138        return null;
139      default:
140        return "?";
141      }
142    }
143
144    public String getDefinition() {
145      switch (this) {
146      case PERSON:
147        return "Group contains \"person\" Patient resources";
148      case ANIMAL:
149        return "Group contains \"animal\" Patient resources";
150      case PRACTITIONER:
151        return "Group contains healthcare practitioner resources";
152      case DEVICE:
153        return "Group contains Device resources";
154      case MEDICATION:
155        return "Group contains Medication resources";
156      case SUBSTANCE:
157        return "Group contains Substance resources";
158      case NULL:
159        return null;
160      default:
161        return "?";
162      }
163    }
164
165    public String getDisplay() {
166      switch (this) {
167      case PERSON:
168        return "Person";
169      case ANIMAL:
170        return "Animal";
171      case PRACTITIONER:
172        return "Practitioner";
173      case DEVICE:
174        return "Device";
175      case MEDICATION:
176        return "Medication";
177      case SUBSTANCE:
178        return "Substance";
179      case NULL:
180        return null;
181      default:
182        return "?";
183      }
184    }
185  }
186
187  public static class GroupTypeEnumFactory implements EnumFactory<GroupType> {
188    public GroupType fromCode(String codeString) throws IllegalArgumentException {
189      if (codeString == null || "".equals(codeString))
190        if (codeString == null || "".equals(codeString))
191          return null;
192      if ("person".equals(codeString))
193        return GroupType.PERSON;
194      if ("animal".equals(codeString))
195        return GroupType.ANIMAL;
196      if ("practitioner".equals(codeString))
197        return GroupType.PRACTITIONER;
198      if ("device".equals(codeString))
199        return GroupType.DEVICE;
200      if ("medication".equals(codeString))
201        return GroupType.MEDICATION;
202      if ("substance".equals(codeString))
203        return GroupType.SUBSTANCE;
204      throw new IllegalArgumentException("Unknown GroupType code '" + codeString + "'");
205    }
206
207    public Enumeration<GroupType> fromType(Base code) throws FHIRException {
208      if (code == null || code.isEmpty())
209        return null;
210      String codeString = ((PrimitiveType) code).asStringValue();
211      if (codeString == null || "".equals(codeString))
212        return null;
213      if ("person".equals(codeString))
214        return new Enumeration<GroupType>(this, GroupType.PERSON);
215      if ("animal".equals(codeString))
216        return new Enumeration<GroupType>(this, GroupType.ANIMAL);
217      if ("practitioner".equals(codeString))
218        return new Enumeration<GroupType>(this, GroupType.PRACTITIONER);
219      if ("device".equals(codeString))
220        return new Enumeration<GroupType>(this, GroupType.DEVICE);
221      if ("medication".equals(codeString))
222        return new Enumeration<GroupType>(this, GroupType.MEDICATION);
223      if ("substance".equals(codeString))
224        return new Enumeration<GroupType>(this, GroupType.SUBSTANCE);
225      throw new FHIRException("Unknown GroupType code '" + codeString + "'");
226    }
227
228    public String toCode(GroupType code) {
229      if (code == GroupType.PERSON)
230        return "person";
231      if (code == GroupType.ANIMAL)
232        return "animal";
233      if (code == GroupType.PRACTITIONER)
234        return "practitioner";
235      if (code == GroupType.DEVICE)
236        return "device";
237      if (code == GroupType.MEDICATION)
238        return "medication";
239      if (code == GroupType.SUBSTANCE)
240        return "substance";
241      return "?";
242    }
243  }
244
245  @Block()
246  public static class GroupCharacteristicComponent extends BackboneElement implements IBaseBackboneElement {
247    /**
248     * A code that identifies the kind of trait being asserted.
249     */
250    @Child(name = "code", type = {
251        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
252    @Description(shortDefinition = "Kind of characteristic", formalDefinition = "A code that identifies the kind of trait being asserted.")
253    protected CodeableConcept code;
254
255    /**
256     * The value of the trait that holds (or does not hold - see 'exclude') for
257     * members of the group.
258     */
259    @Child(name = "value", type = { CodeableConcept.class, BooleanType.class, Quantity.class,
260        Range.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
261    @Description(shortDefinition = "Value held by characteristic", formalDefinition = "The value of the trait that holds (or does not hold - see 'exclude') for members of the group.")
262    protected Type value;
263
264    /**
265     * If true, indicates the characteristic is one that is NOT held by members of
266     * the group.
267     */
268    @Child(name = "exclude", type = {
269        BooleanType.class }, order = 3, min = 1, max = 1, modifier = true, summary = false)
270    @Description(shortDefinition = "Group includes or excludes", formalDefinition = "If true, indicates the characteristic is one that is NOT held by members of the group.")
271    protected BooleanType exclude;
272
273    /**
274     * The period over which the characteristic is tested; e.g. the patient had an
275     * operation during the month of June.
276     */
277    @Child(name = "period", type = { Period.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
278    @Description(shortDefinition = "Period over which characteristic is tested", formalDefinition = "The period over which the characteristic is tested; e.g. the patient had an operation during the month of June.")
279    protected Period period;
280
281    private static final long serialVersionUID = -1000688967L;
282
283    /*
284     * Constructor
285     */
286    public GroupCharacteristicComponent() {
287      super();
288    }
289
290    /*
291     * Constructor
292     */
293    public GroupCharacteristicComponent(CodeableConcept code, Type value, BooleanType exclude) {
294      super();
295      this.code = code;
296      this.value = value;
297      this.exclude = exclude;
298    }
299
300    /**
301     * @return {@link #code} (A code that identifies the kind of trait being
302     *         asserted.)
303     */
304    public CodeableConcept getCode() {
305      if (this.code == null)
306        if (Configuration.errorOnAutoCreate())
307          throw new Error("Attempt to auto-create GroupCharacteristicComponent.code");
308        else if (Configuration.doAutoCreate())
309          this.code = new CodeableConcept(); // cc
310      return this.code;
311    }
312
313    public boolean hasCode() {
314      return this.code != null && !this.code.isEmpty();
315    }
316
317    /**
318     * @param value {@link #code} (A code that identifies the kind of trait being
319     *              asserted.)
320     */
321    public GroupCharacteristicComponent setCode(CodeableConcept value) {
322      this.code = value;
323      return this;
324    }
325
326    /**
327     * @return {@link #value} (The value of the trait that holds (or does not hold -
328     *         see 'exclude') for members of the group.)
329     */
330    public Type getValue() {
331      return this.value;
332    }
333
334    /**
335     * @return {@link #value} (The value of the trait that holds (or does not hold -
336     *         see 'exclude') for members of the group.)
337     */
338    public CodeableConcept getValueCodeableConcept() throws FHIRException {
339      if (!(this.value instanceof CodeableConcept))
340        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
341            + this.value.getClass().getName() + " was encountered");
342      return (CodeableConcept) this.value;
343    }
344
345    public boolean hasValueCodeableConcept() {
346      return this.value instanceof CodeableConcept;
347    }
348
349    /**
350     * @return {@link #value} (The value of the trait that holds (or does not hold -
351     *         see 'exclude') for members of the group.)
352     */
353    public BooleanType getValueBooleanType() throws FHIRException {
354      if (!(this.value instanceof BooleanType))
355        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
356            + this.value.getClass().getName() + " was encountered");
357      return (BooleanType) this.value;
358    }
359
360    public boolean hasValueBooleanType() {
361      return this.value instanceof BooleanType;
362    }
363
364    /**
365     * @return {@link #value} (The value of the trait that holds (or does not hold -
366     *         see 'exclude') for members of the group.)
367     */
368    public Quantity getValueQuantity() throws FHIRException {
369      if (!(this.value instanceof Quantity))
370        throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.value.getClass().getName()
371            + " was encountered");
372      return (Quantity) this.value;
373    }
374
375    public boolean hasValueQuantity() {
376      return this.value instanceof Quantity;
377    }
378
379    /**
380     * @return {@link #value} (The value of the trait that holds (or does not hold -
381     *         see 'exclude') for members of the group.)
382     */
383    public Range getValueRange() throws FHIRException {
384      if (!(this.value instanceof Range))
385        throw new FHIRException(
386            "Type mismatch: the type Range was expected, but " + this.value.getClass().getName() + " was encountered");
387      return (Range) this.value;
388    }
389
390    public boolean hasValueRange() {
391      return this.value instanceof Range;
392    }
393
394    public boolean hasValue() {
395      return this.value != null && !this.value.isEmpty();
396    }
397
398    /**
399     * @param value {@link #value} (The value of the trait that holds (or does not
400     *              hold - see 'exclude') for members of the group.)
401     */
402    public GroupCharacteristicComponent setValue(Type value) {
403      this.value = value;
404      return this;
405    }
406
407    /**
408     * @return {@link #exclude} (If true, indicates the characteristic is one that
409     *         is NOT held by members of the group.). This is the underlying object
410     *         with id, value and extensions. The accessor "getExclude" gives direct
411     *         access to the value
412     */
413    public BooleanType getExcludeElement() {
414      if (this.exclude == null)
415        if (Configuration.errorOnAutoCreate())
416          throw new Error("Attempt to auto-create GroupCharacteristicComponent.exclude");
417        else if (Configuration.doAutoCreate())
418          this.exclude = new BooleanType(); // bb
419      return this.exclude;
420    }
421
422    public boolean hasExcludeElement() {
423      return this.exclude != null && !this.exclude.isEmpty();
424    }
425
426    public boolean hasExclude() {
427      return this.exclude != null && !this.exclude.isEmpty();
428    }
429
430    /**
431     * @param value {@link #exclude} (If true, indicates the characteristic is one
432     *              that is NOT held by members of the group.). This is the
433     *              underlying object with id, value and extensions. The accessor
434     *              "getExclude" gives direct access to the value
435     */
436    public GroupCharacteristicComponent setExcludeElement(BooleanType value) {
437      this.exclude = value;
438      return this;
439    }
440
441    /**
442     * @return If true, indicates the characteristic is one that is NOT held by
443     *         members of the group.
444     */
445    public boolean getExclude() {
446      return this.exclude == null || this.exclude.isEmpty() ? false : this.exclude.getValue();
447    }
448
449    /**
450     * @param value If true, indicates the characteristic is one that is NOT held by
451     *              members of the group.
452     */
453    public GroupCharacteristicComponent setExclude(boolean value) {
454      if (this.exclude == null)
455        this.exclude = new BooleanType();
456      this.exclude.setValue(value);
457      return this;
458    }
459
460    /**
461     * @return {@link #period} (The period over which the characteristic is tested;
462     *         e.g. the patient had an operation during the month of June.)
463     */
464    public Period getPeriod() {
465      if (this.period == null)
466        if (Configuration.errorOnAutoCreate())
467          throw new Error("Attempt to auto-create GroupCharacteristicComponent.period");
468        else if (Configuration.doAutoCreate())
469          this.period = new Period(); // cc
470      return this.period;
471    }
472
473    public boolean hasPeriod() {
474      return this.period != null && !this.period.isEmpty();
475    }
476
477    /**
478     * @param value {@link #period} (The period over which the characteristic is
479     *              tested; e.g. the patient had an operation during the month of
480     *              June.)
481     */
482    public GroupCharacteristicComponent setPeriod(Period value) {
483      this.period = value;
484      return this;
485    }
486
487    protected void listChildren(List<Property> childrenList) {
488      super.listChildren(childrenList);
489      childrenList.add(new Property("code", "CodeableConcept",
490          "A code that identifies the kind of trait being asserted.", 0, java.lang.Integer.MAX_VALUE, code));
491      childrenList.add(new Property("value[x]", "CodeableConcept|boolean|Quantity|Range",
492          "The value of the trait that holds (or does not hold - see 'exclude') for members of the group.", 0,
493          java.lang.Integer.MAX_VALUE, value));
494      childrenList.add(new Property("exclude", "boolean",
495          "If true, indicates the characteristic is one that is NOT held by members of the group.", 0,
496          java.lang.Integer.MAX_VALUE, exclude));
497      childrenList.add(new Property("period", "Period",
498          "The period over which the characteristic is tested; e.g. the patient had an operation during the month of June.",
499          0, java.lang.Integer.MAX_VALUE, period));
500    }
501
502    @Override
503    public void setProperty(String name, Base value) throws FHIRException {
504      if (name.equals("code"))
505        this.code = castToCodeableConcept(value); // CodeableConcept
506      else if (name.equals("value[x]"))
507        this.value = (Type) value; // Type
508      else if (name.equals("exclude"))
509        this.exclude = castToBoolean(value); // BooleanType
510      else if (name.equals("period"))
511        this.period = castToPeriod(value); // Period
512      else
513        super.setProperty(name, value);
514    }
515
516    @Override
517    public Base addChild(String name) throws FHIRException {
518      if (name.equals("code")) {
519        this.code = new CodeableConcept();
520        return this.code;
521      } else if (name.equals("valueCodeableConcept")) {
522        this.value = new CodeableConcept();
523        return this.value;
524      } else if (name.equals("valueBoolean")) {
525        this.value = new BooleanType();
526        return this.value;
527      } else if (name.equals("valueQuantity")) {
528        this.value = new Quantity();
529        return this.value;
530      } else if (name.equals("valueRange")) {
531        this.value = new Range();
532        return this.value;
533      } else if (name.equals("exclude")) {
534        throw new FHIRException("Cannot call addChild on a singleton property Group.exclude");
535      } else if (name.equals("period")) {
536        this.period = new Period();
537        return this.period;
538      } else
539        return super.addChild(name);
540    }
541
542    public GroupCharacteristicComponent copy() {
543      GroupCharacteristicComponent dst = new GroupCharacteristicComponent();
544      copyValues(dst);
545      dst.code = code == null ? null : code.copy();
546      dst.value = value == null ? null : value.copy();
547      dst.exclude = exclude == null ? null : exclude.copy();
548      dst.period = period == null ? null : period.copy();
549      return dst;
550    }
551
552    @Override
553    public boolean equalsDeep(Base other) {
554      if (!super.equalsDeep(other))
555        return false;
556      if (!(other instanceof GroupCharacteristicComponent))
557        return false;
558      GroupCharacteristicComponent o = (GroupCharacteristicComponent) other;
559      return compareDeep(code, o.code, true) && compareDeep(value, o.value, true)
560          && compareDeep(exclude, o.exclude, true) && compareDeep(period, o.period, true);
561    }
562
563    @Override
564    public boolean equalsShallow(Base other) {
565      if (!super.equalsShallow(other))
566        return false;
567      if (!(other instanceof GroupCharacteristicComponent))
568        return false;
569      GroupCharacteristicComponent o = (GroupCharacteristicComponent) other;
570      return compareValues(exclude, o.exclude, true);
571    }
572
573    public boolean isEmpty() {
574      return super.isEmpty() && (code == null || code.isEmpty()) && (value == null || value.isEmpty())
575          && (exclude == null || exclude.isEmpty()) && (period == null || period.isEmpty());
576    }
577
578    public String fhirType() {
579      return "Group.characteristic";
580
581    }
582
583  }
584
585  @Block()
586  public static class GroupMemberComponent extends BackboneElement implements IBaseBackboneElement {
587    /**
588     * A reference to the entity that is a member of the group. Must be consistent
589     * with Group.type.
590     */
591    @Child(name = "entity", type = { Patient.class, Practitioner.class, Device.class, Medication.class,
592        Substance.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
593    @Description(shortDefinition = "Reference to the group member", formalDefinition = "A reference to the entity that is a member of the group. Must be consistent with Group.type.")
594    protected Reference entity;
595
596    /**
597     * The actual object that is the target of the reference (A reference to the
598     * entity that is a member of the group. Must be consistent with Group.type.)
599     */
600    protected Resource entityTarget;
601
602    /**
603     * The period that the member was in the group, if known.
604     */
605    @Child(name = "period", type = { Period.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
606    @Description(shortDefinition = "Period member belonged to the group", formalDefinition = "The period that the member was in the group, if known.")
607    protected Period period;
608
609    /**
610     * A flag to indicate that the member is no longer in the group, but previously
611     * may have been a member.
612     */
613    @Child(name = "inactive", type = {
614        BooleanType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
615    @Description(shortDefinition = "If member is no longer in group", formalDefinition = "A flag to indicate that the member is no longer in the group, but previously may have been a member.")
616    protected BooleanType inactive;
617
618    private static final long serialVersionUID = -333869055L;
619
620    /*
621     * Constructor
622     */
623    public GroupMemberComponent() {
624      super();
625    }
626
627    /*
628     * Constructor
629     */
630    public GroupMemberComponent(Reference entity) {
631      super();
632      this.entity = entity;
633    }
634
635    /**
636     * @return {@link #entity} (A reference to the entity that is a member of the
637     *         group. Must be consistent with Group.type.)
638     */
639    public Reference getEntity() {
640      if (this.entity == null)
641        if (Configuration.errorOnAutoCreate())
642          throw new Error("Attempt to auto-create GroupMemberComponent.entity");
643        else if (Configuration.doAutoCreate())
644          this.entity = new Reference(); // cc
645      return this.entity;
646    }
647
648    public boolean hasEntity() {
649      return this.entity != null && !this.entity.isEmpty();
650    }
651
652    /**
653     * @param value {@link #entity} (A reference to the entity that is a member of
654     *              the group. Must be consistent with Group.type.)
655     */
656    public GroupMemberComponent setEntity(Reference value) {
657      this.entity = value;
658      return this;
659    }
660
661    /**
662     * @return {@link #entity} The actual object that is the target of the
663     *         reference. The reference library doesn't populate this, but you can
664     *         use it to hold the resource if you resolve it. (A reference to the
665     *         entity that is a member of the group. Must be consistent with
666     *         Group.type.)
667     */
668    public Resource getEntityTarget() {
669      return this.entityTarget;
670    }
671
672    /**
673     * @param value {@link #entity} The actual object that is the target of the
674     *              reference. The reference library doesn't use these, but you can
675     *              use it to hold the resource if you resolve it. (A reference to
676     *              the entity that is a member of the group. Must be consistent
677     *              with Group.type.)
678     */
679    public GroupMemberComponent setEntityTarget(Resource value) {
680      this.entityTarget = value;
681      return this;
682    }
683
684    /**
685     * @return {@link #period} (The period that the member was in the group, if
686     *         known.)
687     */
688    public Period getPeriod() {
689      if (this.period == null)
690        if (Configuration.errorOnAutoCreate())
691          throw new Error("Attempt to auto-create GroupMemberComponent.period");
692        else if (Configuration.doAutoCreate())
693          this.period = new Period(); // cc
694      return this.period;
695    }
696
697    public boolean hasPeriod() {
698      return this.period != null && !this.period.isEmpty();
699    }
700
701    /**
702     * @param value {@link #period} (The period that the member was in the group, if
703     *              known.)
704     */
705    public GroupMemberComponent setPeriod(Period value) {
706      this.period = value;
707      return this;
708    }
709
710    /**
711     * @return {@link #inactive} (A flag to indicate that the member is no longer in
712     *         the group, but previously may have been a member.). This is the
713     *         underlying object with id, value and extensions. The accessor
714     *         "getInactive" gives direct access to the value
715     */
716    public BooleanType getInactiveElement() {
717      if (this.inactive == null)
718        if (Configuration.errorOnAutoCreate())
719          throw new Error("Attempt to auto-create GroupMemberComponent.inactive");
720        else if (Configuration.doAutoCreate())
721          this.inactive = new BooleanType(); // bb
722      return this.inactive;
723    }
724
725    public boolean hasInactiveElement() {
726      return this.inactive != null && !this.inactive.isEmpty();
727    }
728
729    public boolean hasInactive() {
730      return this.inactive != null && !this.inactive.isEmpty();
731    }
732
733    /**
734     * @param value {@link #inactive} (A flag to indicate that the member is no
735     *              longer in the group, but previously may have been a member.).
736     *              This is the underlying object with id, value and extensions. The
737     *              accessor "getInactive" gives direct access to the value
738     */
739    public GroupMemberComponent setInactiveElement(BooleanType value) {
740      this.inactive = value;
741      return this;
742    }
743
744    /**
745     * @return A flag to indicate that the member is no longer in the group, but
746     *         previously may have been a member.
747     */
748    public boolean getInactive() {
749      return this.inactive == null || this.inactive.isEmpty() ? false : this.inactive.getValue();
750    }
751
752    /**
753     * @param value A flag to indicate that the member is no longer in the group,
754     *              but previously may have been a member.
755     */
756    public GroupMemberComponent setInactive(boolean value) {
757      if (this.inactive == null)
758        this.inactive = new BooleanType();
759      this.inactive.setValue(value);
760      return this;
761    }
762
763    protected void listChildren(List<Property> childrenList) {
764      super.listChildren(childrenList);
765      childrenList.add(new Property("entity", "Reference(Patient|Practitioner|Device|Medication|Substance)",
766          "A reference to the entity that is a member of the group. Must be consistent with Group.type.", 0,
767          java.lang.Integer.MAX_VALUE, entity));
768      childrenList.add(new Property("period", "Period", "The period that the member was in the group, if known.", 0,
769          java.lang.Integer.MAX_VALUE, period));
770      childrenList.add(new Property("inactive", "boolean",
771          "A flag to indicate that the member is no longer in the group, but previously may have been a member.", 0,
772          java.lang.Integer.MAX_VALUE, inactive));
773    }
774
775    @Override
776    public void setProperty(String name, Base value) throws FHIRException {
777      if (name.equals("entity"))
778        this.entity = castToReference(value); // Reference
779      else if (name.equals("period"))
780        this.period = castToPeriod(value); // Period
781      else if (name.equals("inactive"))
782        this.inactive = castToBoolean(value); // BooleanType
783      else
784        super.setProperty(name, value);
785    }
786
787    @Override
788    public Base addChild(String name) throws FHIRException {
789      if (name.equals("entity")) {
790        this.entity = new Reference();
791        return this.entity;
792      } else if (name.equals("period")) {
793        this.period = new Period();
794        return this.period;
795      } else if (name.equals("inactive")) {
796        throw new FHIRException("Cannot call addChild on a singleton property Group.inactive");
797      } else
798        return super.addChild(name);
799    }
800
801    public GroupMemberComponent copy() {
802      GroupMemberComponent dst = new GroupMemberComponent();
803      copyValues(dst);
804      dst.entity = entity == null ? null : entity.copy();
805      dst.period = period == null ? null : period.copy();
806      dst.inactive = inactive == null ? null : inactive.copy();
807      return dst;
808    }
809
810    @Override
811    public boolean equalsDeep(Base other) {
812      if (!super.equalsDeep(other))
813        return false;
814      if (!(other instanceof GroupMemberComponent))
815        return false;
816      GroupMemberComponent o = (GroupMemberComponent) other;
817      return compareDeep(entity, o.entity, true) && compareDeep(period, o.period, true)
818          && compareDeep(inactive, o.inactive, true);
819    }
820
821    @Override
822    public boolean equalsShallow(Base other) {
823      if (!super.equalsShallow(other))
824        return false;
825      if (!(other instanceof GroupMemberComponent))
826        return false;
827      GroupMemberComponent o = (GroupMemberComponent) other;
828      return compareValues(inactive, o.inactive, true);
829    }
830
831    public boolean isEmpty() {
832      return super.isEmpty() && (entity == null || entity.isEmpty()) && (period == null || period.isEmpty())
833          && (inactive == null || inactive.isEmpty());
834    }
835
836    public String fhirType() {
837      return "Group.member";
838
839    }
840
841  }
842
843  /**
844   * A unique business identifier for this group.
845   */
846  @Child(name = "identifier", type = {
847      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
848  @Description(shortDefinition = "Unique id", formalDefinition = "A unique business identifier for this group.")
849  protected List<Identifier> identifier;
850
851  /**
852   * Identifies the broad classification of the kind of resources the group
853   * includes.
854   */
855  @Child(name = "type", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
856  @Description(shortDefinition = "person | animal | practitioner | device | medication | substance", formalDefinition = "Identifies the broad classification of the kind of resources the group includes.")
857  protected Enumeration<GroupType> type;
858
859  /**
860   * If true, indicates that the resource refers to a specific group of real
861   * individuals. If false, the group defines a set of intended individuals.
862   */
863  @Child(name = "actual", type = { BooleanType.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
864  @Description(shortDefinition = "Descriptive or actual", formalDefinition = "If true, indicates that the resource refers to a specific group of real individuals.  If false, the group defines a set of intended individuals.")
865  protected BooleanType actual;
866
867  /**
868   * Provides a specific type of resource the group includes; e.g. "cow",
869   * "syringe", etc.
870   */
871  @Child(name = "code", type = { CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
872  @Description(shortDefinition = "Kind of Group members", formalDefinition = "Provides a specific type of resource the group includes; e.g. \"cow\", \"syringe\", etc.")
873  protected CodeableConcept code;
874
875  /**
876   * A label assigned to the group for human identification and communication.
877   */
878  @Child(name = "name", type = { StringType.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
879  @Description(shortDefinition = "Label for Group", formalDefinition = "A label assigned to the group for human identification and communication.")
880  protected StringType name;
881
882  /**
883   * A count of the number of resource instances that are part of the group.
884   */
885  @Child(name = "quantity", type = {
886      UnsignedIntType.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
887  @Description(shortDefinition = "Number of members", formalDefinition = "A count of the number of resource instances that are part of the group.")
888  protected UnsignedIntType quantity;
889
890  /**
891   * Identifies the traits shared by members of the group.
892   */
893  @Child(name = "characteristic", type = {}, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
894  @Description(shortDefinition = "Trait of group members", formalDefinition = "Identifies the traits shared by members of the group.")
895  protected List<GroupCharacteristicComponent> characteristic;
896
897  /**
898   * Identifies the resource instances that are members of the group.
899   */
900  @Child(name = "member", type = {}, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
901  @Description(shortDefinition = "Who or what is in group", formalDefinition = "Identifies the resource instances that are members of the group.")
902  protected List<GroupMemberComponent> member;
903
904  private static final long serialVersionUID = 1401345819L;
905
906  /*
907   * Constructor
908   */
909  public Group() {
910    super();
911  }
912
913  /*
914   * Constructor
915   */
916  public Group(Enumeration<GroupType> type, BooleanType actual) {
917    super();
918    this.type = type;
919    this.actual = actual;
920  }
921
922  /**
923   * @return {@link #identifier} (A unique business identifier for this group.)
924   */
925  public List<Identifier> getIdentifier() {
926    if (this.identifier == null)
927      this.identifier = new ArrayList<Identifier>();
928    return this.identifier;
929  }
930
931  public boolean hasIdentifier() {
932    if (this.identifier == null)
933      return false;
934    for (Identifier item : this.identifier)
935      if (!item.isEmpty())
936        return true;
937    return false;
938  }
939
940  /**
941   * @return {@link #identifier} (A unique business identifier for this group.)
942   */
943  // syntactic sugar
944  public Identifier addIdentifier() { // 3
945    Identifier t = new Identifier();
946    if (this.identifier == null)
947      this.identifier = new ArrayList<Identifier>();
948    this.identifier.add(t);
949    return t;
950  }
951
952  // syntactic sugar
953  public Group addIdentifier(Identifier t) { // 3
954    if (t == null)
955      return this;
956    if (this.identifier == null)
957      this.identifier = new ArrayList<Identifier>();
958    this.identifier.add(t);
959    return this;
960  }
961
962  /**
963   * @return {@link #type} (Identifies the broad classification of the kind of
964   *         resources the group includes.). This is the underlying object with
965   *         id, value and extensions. The accessor "getType" gives direct access
966   *         to the value
967   */
968  public Enumeration<GroupType> getTypeElement() {
969    if (this.type == null)
970      if (Configuration.errorOnAutoCreate())
971        throw new Error("Attempt to auto-create Group.type");
972      else if (Configuration.doAutoCreate())
973        this.type = new Enumeration<GroupType>(new GroupTypeEnumFactory()); // bb
974    return this.type;
975  }
976
977  public boolean hasTypeElement() {
978    return this.type != null && !this.type.isEmpty();
979  }
980
981  public boolean hasType() {
982    return this.type != null && !this.type.isEmpty();
983  }
984
985  /**
986   * @param value {@link #type} (Identifies the broad classification of the kind
987   *              of resources the group includes.). This is the underlying object
988   *              with id, value and extensions. The accessor "getType" gives
989   *              direct access to the value
990   */
991  public Group setTypeElement(Enumeration<GroupType> value) {
992    this.type = value;
993    return this;
994  }
995
996  /**
997   * @return Identifies the broad classification of the kind of resources the
998   *         group includes.
999   */
1000  public GroupType getType() {
1001    return this.type == null ? null : this.type.getValue();
1002  }
1003
1004  /**
1005   * @param value Identifies the broad classification of the kind of resources the
1006   *              group includes.
1007   */
1008  public Group setType(GroupType value) {
1009    if (this.type == null)
1010      this.type = new Enumeration<GroupType>(new GroupTypeEnumFactory());
1011    this.type.setValue(value);
1012    return this;
1013  }
1014
1015  /**
1016   * @return {@link #actual} (If true, indicates that the resource refers to a
1017   *         specific group of real individuals. If false, the group defines a set
1018   *         of intended individuals.). This is the underlying object with id,
1019   *         value and extensions. The accessor "getActual" gives direct access to
1020   *         the value
1021   */
1022  public BooleanType getActualElement() {
1023    if (this.actual == null)
1024      if (Configuration.errorOnAutoCreate())
1025        throw new Error("Attempt to auto-create Group.actual");
1026      else if (Configuration.doAutoCreate())
1027        this.actual = new BooleanType(); // bb
1028    return this.actual;
1029  }
1030
1031  public boolean hasActualElement() {
1032    return this.actual != null && !this.actual.isEmpty();
1033  }
1034
1035  public boolean hasActual() {
1036    return this.actual != null && !this.actual.isEmpty();
1037  }
1038
1039  /**
1040   * @param value {@link #actual} (If true, indicates that the resource refers to
1041   *              a specific group of real individuals. If false, the group
1042   *              defines a set of intended individuals.). This is the underlying
1043   *              object with id, value and extensions. The accessor "getActual"
1044   *              gives direct access to the value
1045   */
1046  public Group setActualElement(BooleanType value) {
1047    this.actual = value;
1048    return this;
1049  }
1050
1051  /**
1052   * @return If true, indicates that the resource refers to a specific group of
1053   *         real individuals. If false, the group defines a set of intended
1054   *         individuals.
1055   */
1056  public boolean getActual() {
1057    return this.actual == null || this.actual.isEmpty() ? false : this.actual.getValue();
1058  }
1059
1060  /**
1061   * @param value If true, indicates that the resource refers to a specific group
1062   *              of real individuals. If false, the group defines a set of
1063   *              intended individuals.
1064   */
1065  public Group setActual(boolean value) {
1066    if (this.actual == null)
1067      this.actual = new BooleanType();
1068    this.actual.setValue(value);
1069    return this;
1070  }
1071
1072  /**
1073   * @return {@link #code} (Provides a specific type of resource the group
1074   *         includes; e.g. "cow", "syringe", etc.)
1075   */
1076  public CodeableConcept getCode() {
1077    if (this.code == null)
1078      if (Configuration.errorOnAutoCreate())
1079        throw new Error("Attempt to auto-create Group.code");
1080      else if (Configuration.doAutoCreate())
1081        this.code = new CodeableConcept(); // cc
1082    return this.code;
1083  }
1084
1085  public boolean hasCode() {
1086    return this.code != null && !this.code.isEmpty();
1087  }
1088
1089  /**
1090   * @param value {@link #code} (Provides a specific type of resource the group
1091   *              includes; e.g. "cow", "syringe", etc.)
1092   */
1093  public Group setCode(CodeableConcept value) {
1094    this.code = value;
1095    return this;
1096  }
1097
1098  /**
1099   * @return {@link #name} (A label assigned to the group for human identification
1100   *         and communication.). This is the underlying object with id, value and
1101   *         extensions. The accessor "getName" gives direct access to the value
1102   */
1103  public StringType getNameElement() {
1104    if (this.name == null)
1105      if (Configuration.errorOnAutoCreate())
1106        throw new Error("Attempt to auto-create Group.name");
1107      else if (Configuration.doAutoCreate())
1108        this.name = new StringType(); // bb
1109    return this.name;
1110  }
1111
1112  public boolean hasNameElement() {
1113    return this.name != null && !this.name.isEmpty();
1114  }
1115
1116  public boolean hasName() {
1117    return this.name != null && !this.name.isEmpty();
1118  }
1119
1120  /**
1121   * @param value {@link #name} (A label assigned to the group for human
1122   *              identification and communication.). This is the underlying
1123   *              object with id, value and extensions. The accessor "getName"
1124   *              gives direct access to the value
1125   */
1126  public Group setNameElement(StringType value) {
1127    this.name = value;
1128    return this;
1129  }
1130
1131  /**
1132   * @return A label assigned to the group for human identification and
1133   *         communication.
1134   */
1135  public String getName() {
1136    return this.name == null ? null : this.name.getValue();
1137  }
1138
1139  /**
1140   * @param value A label assigned to the group for human identification and
1141   *              communication.
1142   */
1143  public Group setName(String value) {
1144    if (Utilities.noString(value))
1145      this.name = null;
1146    else {
1147      if (this.name == null)
1148        this.name = new StringType();
1149      this.name.setValue(value);
1150    }
1151    return this;
1152  }
1153
1154  /**
1155   * @return {@link #quantity} (A count of the number of resource instances that
1156   *         are part of the group.). This is the underlying object with id, value
1157   *         and extensions. The accessor "getQuantity" gives direct access to the
1158   *         value
1159   */
1160  public UnsignedIntType getQuantityElement() {
1161    if (this.quantity == null)
1162      if (Configuration.errorOnAutoCreate())
1163        throw new Error("Attempt to auto-create Group.quantity");
1164      else if (Configuration.doAutoCreate())
1165        this.quantity = new UnsignedIntType(); // bb
1166    return this.quantity;
1167  }
1168
1169  public boolean hasQuantityElement() {
1170    return this.quantity != null && !this.quantity.isEmpty();
1171  }
1172
1173  public boolean hasQuantity() {
1174    return this.quantity != null && !this.quantity.isEmpty();
1175  }
1176
1177  /**
1178   * @param value {@link #quantity} (A count of the number of resource instances
1179   *              that are part of the group.). This is the underlying object with
1180   *              id, value and extensions. The accessor "getQuantity" gives
1181   *              direct access to the value
1182   */
1183  public Group setQuantityElement(UnsignedIntType value) {
1184    this.quantity = value;
1185    return this;
1186  }
1187
1188  /**
1189   * @return A count of the number of resource instances that are part of the
1190   *         group.
1191   */
1192  public int getQuantity() {
1193    return this.quantity == null || this.quantity.isEmpty() ? 0 : this.quantity.getValue();
1194  }
1195
1196  /**
1197   * @param value A count of the number of resource instances that are part of the
1198   *              group.
1199   */
1200  public Group setQuantity(int value) {
1201    if (this.quantity == null)
1202      this.quantity = new UnsignedIntType();
1203    this.quantity.setValue(value);
1204    return this;
1205  }
1206
1207  /**
1208   * @return {@link #characteristic} (Identifies the traits shared by members of
1209   *         the group.)
1210   */
1211  public List<GroupCharacteristicComponent> getCharacteristic() {
1212    if (this.characteristic == null)
1213      this.characteristic = new ArrayList<GroupCharacteristicComponent>();
1214    return this.characteristic;
1215  }
1216
1217  public boolean hasCharacteristic() {
1218    if (this.characteristic == null)
1219      return false;
1220    for (GroupCharacteristicComponent item : this.characteristic)
1221      if (!item.isEmpty())
1222        return true;
1223    return false;
1224  }
1225
1226  /**
1227   * @return {@link #characteristic} (Identifies the traits shared by members of
1228   *         the group.)
1229   */
1230  // syntactic sugar
1231  public GroupCharacteristicComponent addCharacteristic() { // 3
1232    GroupCharacteristicComponent t = new GroupCharacteristicComponent();
1233    if (this.characteristic == null)
1234      this.characteristic = new ArrayList<GroupCharacteristicComponent>();
1235    this.characteristic.add(t);
1236    return t;
1237  }
1238
1239  // syntactic sugar
1240  public Group addCharacteristic(GroupCharacteristicComponent t) { // 3
1241    if (t == null)
1242      return this;
1243    if (this.characteristic == null)
1244      this.characteristic = new ArrayList<GroupCharacteristicComponent>();
1245    this.characteristic.add(t);
1246    return this;
1247  }
1248
1249  /**
1250   * @return {@link #member} (Identifies the resource instances that are members
1251   *         of the group.)
1252   */
1253  public List<GroupMemberComponent> getMember() {
1254    if (this.member == null)
1255      this.member = new ArrayList<GroupMemberComponent>();
1256    return this.member;
1257  }
1258
1259  public boolean hasMember() {
1260    if (this.member == null)
1261      return false;
1262    for (GroupMemberComponent item : this.member)
1263      if (!item.isEmpty())
1264        return true;
1265    return false;
1266  }
1267
1268  /**
1269   * @return {@link #member} (Identifies the resource instances that are members
1270   *         of the group.)
1271   */
1272  // syntactic sugar
1273  public GroupMemberComponent addMember() { // 3
1274    GroupMemberComponent t = new GroupMemberComponent();
1275    if (this.member == null)
1276      this.member = new ArrayList<GroupMemberComponent>();
1277    this.member.add(t);
1278    return t;
1279  }
1280
1281  // syntactic sugar
1282  public Group addMember(GroupMemberComponent t) { // 3
1283    if (t == null)
1284      return this;
1285    if (this.member == null)
1286      this.member = new ArrayList<GroupMemberComponent>();
1287    this.member.add(t);
1288    return this;
1289  }
1290
1291  protected void listChildren(List<Property> childrenList) {
1292    super.listChildren(childrenList);
1293    childrenList.add(new Property("identifier", "Identifier", "A unique business identifier for this group.", 0,
1294        java.lang.Integer.MAX_VALUE, identifier));
1295    childrenList.add(
1296        new Property("type", "code", "Identifies the broad classification of the kind of resources the group includes.",
1297            0, java.lang.Integer.MAX_VALUE, type));
1298    childrenList.add(new Property("actual", "boolean",
1299        "If true, indicates that the resource refers to a specific group of real individuals.  If false, the group defines a set of intended individuals.",
1300        0, java.lang.Integer.MAX_VALUE, actual));
1301    childrenList.add(new Property("code", "CodeableConcept",
1302        "Provides a specific type of resource the group includes; e.g. \"cow\", \"syringe\", etc.", 0,
1303        java.lang.Integer.MAX_VALUE, code));
1304    childrenList
1305        .add(new Property("name", "string", "A label assigned to the group for human identification and communication.",
1306            0, java.lang.Integer.MAX_VALUE, name));
1307    childrenList.add(new Property("quantity", "unsignedInt",
1308        "A count of the number of resource instances that are part of the group.", 0, java.lang.Integer.MAX_VALUE,
1309        quantity));
1310    childrenList.add(new Property("characteristic", "", "Identifies the traits shared by members of the group.", 0,
1311        java.lang.Integer.MAX_VALUE, characteristic));
1312    childrenList.add(new Property("member", "", "Identifies the resource instances that are members of the group.", 0,
1313        java.lang.Integer.MAX_VALUE, member));
1314  }
1315
1316  @Override
1317  public void setProperty(String name, Base value) throws FHIRException {
1318    if (name.equals("identifier"))
1319      this.getIdentifier().add(castToIdentifier(value));
1320    else if (name.equals("type"))
1321      this.type = new GroupTypeEnumFactory().fromType(value); // Enumeration<GroupType>
1322    else if (name.equals("actual"))
1323      this.actual = castToBoolean(value); // BooleanType
1324    else if (name.equals("code"))
1325      this.code = castToCodeableConcept(value); // CodeableConcept
1326    else if (name.equals("name"))
1327      this.name = castToString(value); // StringType
1328    else if (name.equals("quantity"))
1329      this.quantity = castToUnsignedInt(value); // UnsignedIntType
1330    else if (name.equals("characteristic"))
1331      this.getCharacteristic().add((GroupCharacteristicComponent) value);
1332    else if (name.equals("member"))
1333      this.getMember().add((GroupMemberComponent) value);
1334    else
1335      super.setProperty(name, value);
1336  }
1337
1338  @Override
1339  public Base addChild(String name) throws FHIRException {
1340    if (name.equals("identifier")) {
1341      return addIdentifier();
1342    } else if (name.equals("type")) {
1343      throw new FHIRException("Cannot call addChild on a singleton property Group.type");
1344    } else if (name.equals("actual")) {
1345      throw new FHIRException("Cannot call addChild on a singleton property Group.actual");
1346    } else if (name.equals("code")) {
1347      this.code = new CodeableConcept();
1348      return this.code;
1349    } else if (name.equals("name")) {
1350      throw new FHIRException("Cannot call addChild on a singleton property Group.name");
1351    } else if (name.equals("quantity")) {
1352      throw new FHIRException("Cannot call addChild on a singleton property Group.quantity");
1353    } else if (name.equals("characteristic")) {
1354      return addCharacteristic();
1355    } else if (name.equals("member")) {
1356      return addMember();
1357    } else
1358      return super.addChild(name);
1359  }
1360
1361  public String fhirType() {
1362    return "Group";
1363
1364  }
1365
1366  public Group copy() {
1367    Group dst = new Group();
1368    copyValues(dst);
1369    if (identifier != null) {
1370      dst.identifier = new ArrayList<Identifier>();
1371      for (Identifier i : identifier)
1372        dst.identifier.add(i.copy());
1373    }
1374    ;
1375    dst.type = type == null ? null : type.copy();
1376    dst.actual = actual == null ? null : actual.copy();
1377    dst.code = code == null ? null : code.copy();
1378    dst.name = name == null ? null : name.copy();
1379    dst.quantity = quantity == null ? null : quantity.copy();
1380    if (characteristic != null) {
1381      dst.characteristic = new ArrayList<GroupCharacteristicComponent>();
1382      for (GroupCharacteristicComponent i : characteristic)
1383        dst.characteristic.add(i.copy());
1384    }
1385    ;
1386    if (member != null) {
1387      dst.member = new ArrayList<GroupMemberComponent>();
1388      for (GroupMemberComponent i : member)
1389        dst.member.add(i.copy());
1390    }
1391    ;
1392    return dst;
1393  }
1394
1395  protected Group typedCopy() {
1396    return copy();
1397  }
1398
1399  @Override
1400  public boolean equalsDeep(Base other) {
1401    if (!super.equalsDeep(other))
1402      return false;
1403    if (!(other instanceof Group))
1404      return false;
1405    Group o = (Group) other;
1406    return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true)
1407        && compareDeep(actual, o.actual, true) && compareDeep(code, o.code, true) && compareDeep(name, o.name, true)
1408        && compareDeep(quantity, o.quantity, true) && compareDeep(characteristic, o.characteristic, true)
1409        && compareDeep(member, o.member, true);
1410  }
1411
1412  @Override
1413  public boolean equalsShallow(Base other) {
1414    if (!super.equalsShallow(other))
1415      return false;
1416    if (!(other instanceof Group))
1417      return false;
1418    Group o = (Group) other;
1419    return compareValues(type, o.type, true) && compareValues(actual, o.actual, true)
1420        && compareValues(name, o.name, true) && compareValues(quantity, o.quantity, true);
1421  }
1422
1423  public boolean isEmpty() {
1424    return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (type == null || type.isEmpty())
1425        && (actual == null || actual.isEmpty()) && (code == null || code.isEmpty()) && (name == null || name.isEmpty())
1426        && (quantity == null || quantity.isEmpty()) && (characteristic == null || characteristic.isEmpty())
1427        && (member == null || member.isEmpty());
1428  }
1429
1430  @Override
1431  public ResourceType getResourceType() {
1432    return ResourceType.Group;
1433  }
1434
1435  @SearchParamDefinition(name = "actual", path = "Group.actual", description = "Descriptive or actual", type = "token")
1436  public static final String SP_ACTUAL = "actual";
1437  @SearchParamDefinition(name = "identifier", path = "Group.identifier", description = "Unique id", type = "token")
1438  public static final String SP_IDENTIFIER = "identifier";
1439  @SearchParamDefinition(name = "characteristic-value", path = "null", description = "A composite of both characteristic and value", type = "composite")
1440  public static final String SP_CHARACTERISTICVALUE = "characteristic-value";
1441  @SearchParamDefinition(name = "code", path = "Group.code", description = "The kind of resources contained", type = "token")
1442  public static final String SP_CODE = "code";
1443  @SearchParamDefinition(name = "member", path = "Group.member.entity", description = "Reference to the group member", type = "reference")
1444  public static final String SP_MEMBER = "member";
1445  @SearchParamDefinition(name = "exclude", path = "Group.characteristic.exclude", description = "Group includes or excludes", type = "token")
1446  public static final String SP_EXCLUDE = "exclude";
1447  @SearchParamDefinition(name = "type", path = "Group.type", description = "The type of resources the group contains", type = "token")
1448  public static final String SP_TYPE = "type";
1449  @SearchParamDefinition(name = "value", path = "Group.characteristic.value[x]", description = "Value held by characteristic", type = "token")
1450  public static final String SP_VALUE = "value";
1451  @SearchParamDefinition(name = "characteristic", path = "Group.characteristic.code", description = "Kind of characteristic", type = "token")
1452  public static final String SP_CHARACTERISTIC = "characteristic";
1453
1454}