001package org.hl7.fhir.r4.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 Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
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;
041
042/**
043 * The manufactured item as contained in the packaged medicinal product.
044 */
045@ResourceDef(name = "MedicinalProductManufactured", profile = "http://hl7.org/fhir/StructureDefinition/MedicinalProductManufactured")
046public class MedicinalProductManufactured extends DomainResource {
047
048  /**
049   * Dose form as manufactured and before any transformation into the
050   * pharmaceutical product.
051   */
052  @Child(name = "manufacturedDoseForm", type = {
053      CodeableConcept.class }, order = 0, min = 1, max = 1, modifier = false, summary = true)
054  @Description(shortDefinition = "Dose form as manufactured and before any transformation into the pharmaceutical product", formalDefinition = "Dose form as manufactured and before any transformation into the pharmaceutical product.")
055  protected CodeableConcept manufacturedDoseForm;
056
057  /**
058   * The ?real world? units in which the quantity of the manufactured item is
059   * described.
060   */
061  @Child(name = "unitOfPresentation", type = {
062      CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
063  @Description(shortDefinition = "The ?real world? units in which the quantity of the manufactured item is described", formalDefinition = "The ?real world? units in which the quantity of the manufactured item is described.")
064  protected CodeableConcept unitOfPresentation;
065
066  /**
067   * The quantity or "count number" of the manufactured item.
068   */
069  @Child(name = "quantity", type = { Quantity.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
070  @Description(shortDefinition = "The quantity or \"count number\" of the manufactured item", formalDefinition = "The quantity or \"count number\" of the manufactured item.")
071  protected Quantity quantity;
072
073  /**
074   * Manufacturer of the item (Note that this should be named "manufacturer" but
075   * it currently causes technical issues).
076   */
077  @Child(name = "manufacturer", type = {
078      Organization.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
079  @Description(shortDefinition = "Manufacturer of the item (Note that this should be named \"manufacturer\" but it currently causes technical issues)", formalDefinition = "Manufacturer of the item (Note that this should be named \"manufacturer\" but it currently causes technical issues).")
080  protected List<Reference> manufacturer;
081  /**
082   * The actual objects that are the target of the reference (Manufacturer of the
083   * item (Note that this should be named "manufacturer" but it currently causes
084   * technical issues).)
085   */
086  protected List<Organization> manufacturerTarget;
087
088  /**
089   * Ingredient.
090   */
091  @Child(name = "ingredient", type = {
092      MedicinalProductIngredient.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
093  @Description(shortDefinition = "Ingredient", formalDefinition = "Ingredient.")
094  protected List<Reference> ingredient;
095  /**
096   * The actual objects that are the target of the reference (Ingredient.)
097   */
098  protected List<MedicinalProductIngredient> ingredientTarget;
099
100  /**
101   * Dimensions, color etc.
102   */
103  @Child(name = "physicalCharacteristics", type = {
104      ProdCharacteristic.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
105  @Description(shortDefinition = "Dimensions, color etc.", formalDefinition = "Dimensions, color etc.")
106  protected ProdCharacteristic physicalCharacteristics;
107
108  /**
109   * Other codeable characteristics.
110   */
111  @Child(name = "otherCharacteristics", type = {
112      CodeableConcept.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
113  @Description(shortDefinition = "Other codeable characteristics", formalDefinition = "Other codeable characteristics.")
114  protected List<CodeableConcept> otherCharacteristics;
115
116  private static final long serialVersionUID = 623073384L;
117
118  /**
119   * Constructor
120   */
121  public MedicinalProductManufactured() {
122    super();
123  }
124
125  /**
126   * Constructor
127   */
128  public MedicinalProductManufactured(CodeableConcept manufacturedDoseForm, Quantity quantity) {
129    super();
130    this.manufacturedDoseForm = manufacturedDoseForm;
131    this.quantity = quantity;
132  }
133
134  /**
135   * @return {@link #manufacturedDoseForm} (Dose form as manufactured and before
136   *         any transformation into the pharmaceutical product.)
137   */
138  public CodeableConcept getManufacturedDoseForm() {
139    if (this.manufacturedDoseForm == null)
140      if (Configuration.errorOnAutoCreate())
141        throw new Error("Attempt to auto-create MedicinalProductManufactured.manufacturedDoseForm");
142      else if (Configuration.doAutoCreate())
143        this.manufacturedDoseForm = new CodeableConcept(); // cc
144    return this.manufacturedDoseForm;
145  }
146
147  public boolean hasManufacturedDoseForm() {
148    return this.manufacturedDoseForm != null && !this.manufacturedDoseForm.isEmpty();
149  }
150
151  /**
152   * @param value {@link #manufacturedDoseForm} (Dose form as manufactured and
153   *              before any transformation into the pharmaceutical product.)
154   */
155  public MedicinalProductManufactured setManufacturedDoseForm(CodeableConcept value) {
156    this.manufacturedDoseForm = value;
157    return this;
158  }
159
160  /**
161   * @return {@link #unitOfPresentation} (The ?real world? units in which the
162   *         quantity of the manufactured item is described.)
163   */
164  public CodeableConcept getUnitOfPresentation() {
165    if (this.unitOfPresentation == null)
166      if (Configuration.errorOnAutoCreate())
167        throw new Error("Attempt to auto-create MedicinalProductManufactured.unitOfPresentation");
168      else if (Configuration.doAutoCreate())
169        this.unitOfPresentation = new CodeableConcept(); // cc
170    return this.unitOfPresentation;
171  }
172
173  public boolean hasUnitOfPresentation() {
174    return this.unitOfPresentation != null && !this.unitOfPresentation.isEmpty();
175  }
176
177  /**
178   * @param value {@link #unitOfPresentation} (The ?real world? units in which the
179   *              quantity of the manufactured item is described.)
180   */
181  public MedicinalProductManufactured setUnitOfPresentation(CodeableConcept value) {
182    this.unitOfPresentation = value;
183    return this;
184  }
185
186  /**
187   * @return {@link #quantity} (The quantity or "count number" of the manufactured
188   *         item.)
189   */
190  public Quantity getQuantity() {
191    if (this.quantity == null)
192      if (Configuration.errorOnAutoCreate())
193        throw new Error("Attempt to auto-create MedicinalProductManufactured.quantity");
194      else if (Configuration.doAutoCreate())
195        this.quantity = new Quantity(); // cc
196    return this.quantity;
197  }
198
199  public boolean hasQuantity() {
200    return this.quantity != null && !this.quantity.isEmpty();
201  }
202
203  /**
204   * @param value {@link #quantity} (The quantity or "count number" of the
205   *              manufactured item.)
206   */
207  public MedicinalProductManufactured setQuantity(Quantity value) {
208    this.quantity = value;
209    return this;
210  }
211
212  /**
213   * @return {@link #manufacturer} (Manufacturer of the item (Note that this
214   *         should be named "manufacturer" but it currently causes technical
215   *         issues).)
216   */
217  public List<Reference> getManufacturer() {
218    if (this.manufacturer == null)
219      this.manufacturer = new ArrayList<Reference>();
220    return this.manufacturer;
221  }
222
223  /**
224   * @return Returns a reference to <code>this</code> for easy method chaining
225   */
226  public MedicinalProductManufactured setManufacturer(List<Reference> theManufacturer) {
227    this.manufacturer = theManufacturer;
228    return this;
229  }
230
231  public boolean hasManufacturer() {
232    if (this.manufacturer == null)
233      return false;
234    for (Reference item : this.manufacturer)
235      if (!item.isEmpty())
236        return true;
237    return false;
238  }
239
240  public Reference addManufacturer() { // 3
241    Reference t = new Reference();
242    if (this.manufacturer == null)
243      this.manufacturer = new ArrayList<Reference>();
244    this.manufacturer.add(t);
245    return t;
246  }
247
248  public MedicinalProductManufactured addManufacturer(Reference t) { // 3
249    if (t == null)
250      return this;
251    if (this.manufacturer == null)
252      this.manufacturer = new ArrayList<Reference>();
253    this.manufacturer.add(t);
254    return this;
255  }
256
257  /**
258   * @return The first repetition of repeating field {@link #manufacturer},
259   *         creating it if it does not already exist
260   */
261  public Reference getManufacturerFirstRep() {
262    if (getManufacturer().isEmpty()) {
263      addManufacturer();
264    }
265    return getManufacturer().get(0);
266  }
267
268  /**
269   * @return {@link #ingredient} (Ingredient.)
270   */
271  public List<Reference> getIngredient() {
272    if (this.ingredient == null)
273      this.ingredient = new ArrayList<Reference>();
274    return this.ingredient;
275  }
276
277  /**
278   * @return Returns a reference to <code>this</code> for easy method chaining
279   */
280  public MedicinalProductManufactured setIngredient(List<Reference> theIngredient) {
281    this.ingredient = theIngredient;
282    return this;
283  }
284
285  public boolean hasIngredient() {
286    if (this.ingredient == null)
287      return false;
288    for (Reference item : this.ingredient)
289      if (!item.isEmpty())
290        return true;
291    return false;
292  }
293
294  public Reference addIngredient() { // 3
295    Reference t = new Reference();
296    if (this.ingredient == null)
297      this.ingredient = new ArrayList<Reference>();
298    this.ingredient.add(t);
299    return t;
300  }
301
302  public MedicinalProductManufactured addIngredient(Reference t) { // 3
303    if (t == null)
304      return this;
305    if (this.ingredient == null)
306      this.ingredient = new ArrayList<Reference>();
307    this.ingredient.add(t);
308    return this;
309  }
310
311  /**
312   * @return The first repetition of repeating field {@link #ingredient}, creating
313   *         it if it does not already exist
314   */
315  public Reference getIngredientFirstRep() {
316    if (getIngredient().isEmpty()) {
317      addIngredient();
318    }
319    return getIngredient().get(0);
320  }
321
322  /**
323   * @return {@link #physicalCharacteristics} (Dimensions, color etc.)
324   */
325  public ProdCharacteristic getPhysicalCharacteristics() {
326    if (this.physicalCharacteristics == null)
327      if (Configuration.errorOnAutoCreate())
328        throw new Error("Attempt to auto-create MedicinalProductManufactured.physicalCharacteristics");
329      else if (Configuration.doAutoCreate())
330        this.physicalCharacteristics = new ProdCharacteristic(); // cc
331    return this.physicalCharacteristics;
332  }
333
334  public boolean hasPhysicalCharacteristics() {
335    return this.physicalCharacteristics != null && !this.physicalCharacteristics.isEmpty();
336  }
337
338  /**
339   * @param value {@link #physicalCharacteristics} (Dimensions, color etc.)
340   */
341  public MedicinalProductManufactured setPhysicalCharacteristics(ProdCharacteristic value) {
342    this.physicalCharacteristics = value;
343    return this;
344  }
345
346  /**
347   * @return {@link #otherCharacteristics} (Other codeable characteristics.)
348   */
349  public List<CodeableConcept> getOtherCharacteristics() {
350    if (this.otherCharacteristics == null)
351      this.otherCharacteristics = new ArrayList<CodeableConcept>();
352    return this.otherCharacteristics;
353  }
354
355  /**
356   * @return Returns a reference to <code>this</code> for easy method chaining
357   */
358  public MedicinalProductManufactured setOtherCharacteristics(List<CodeableConcept> theOtherCharacteristics) {
359    this.otherCharacteristics = theOtherCharacteristics;
360    return this;
361  }
362
363  public boolean hasOtherCharacteristics() {
364    if (this.otherCharacteristics == null)
365      return false;
366    for (CodeableConcept item : this.otherCharacteristics)
367      if (!item.isEmpty())
368        return true;
369    return false;
370  }
371
372  public CodeableConcept addOtherCharacteristics() { // 3
373    CodeableConcept t = new CodeableConcept();
374    if (this.otherCharacteristics == null)
375      this.otherCharacteristics = new ArrayList<CodeableConcept>();
376    this.otherCharacteristics.add(t);
377    return t;
378  }
379
380  public MedicinalProductManufactured addOtherCharacteristics(CodeableConcept t) { // 3
381    if (t == null)
382      return this;
383    if (this.otherCharacteristics == null)
384      this.otherCharacteristics = new ArrayList<CodeableConcept>();
385    this.otherCharacteristics.add(t);
386    return this;
387  }
388
389  /**
390   * @return The first repetition of repeating field
391   *         {@link #otherCharacteristics}, creating it if it does not already
392   *         exist
393   */
394  public CodeableConcept getOtherCharacteristicsFirstRep() {
395    if (getOtherCharacteristics().isEmpty()) {
396      addOtherCharacteristics();
397    }
398    return getOtherCharacteristics().get(0);
399  }
400
401  protected void listChildren(List<Property> children) {
402    super.listChildren(children);
403    children.add(new Property("manufacturedDoseForm", "CodeableConcept",
404        "Dose form as manufactured and before any transformation into the pharmaceutical product.", 0, 1,
405        manufacturedDoseForm));
406    children.add(new Property("unitOfPresentation", "CodeableConcept",
407        "The ?real world? units in which the quantity of the manufactured item is described.", 0, 1,
408        unitOfPresentation));
409    children.add(new Property("quantity", "Quantity", "The quantity or \"count number\" of the manufactured item.", 0,
410        1, quantity));
411    children.add(new Property("manufacturer", "Reference(Organization)",
412        "Manufacturer of the item (Note that this should be named \"manufacturer\" but it currently causes technical issues).",
413        0, java.lang.Integer.MAX_VALUE, manufacturer));
414    children.add(new Property("ingredient", "Reference(MedicinalProductIngredient)", "Ingredient.", 0,
415        java.lang.Integer.MAX_VALUE, ingredient));
416    children.add(new Property("physicalCharacteristics", "ProdCharacteristic", "Dimensions, color etc.", 0, 1,
417        physicalCharacteristics));
418    children.add(new Property("otherCharacteristics", "CodeableConcept", "Other codeable characteristics.", 0,
419        java.lang.Integer.MAX_VALUE, otherCharacteristics));
420  }
421
422  @Override
423  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
424    switch (_hash) {
425    case -1451400348:
426      /* manufacturedDoseForm */ return new Property("manufacturedDoseForm", "CodeableConcept",
427          "Dose form as manufactured and before any transformation into the pharmaceutical product.", 0, 1,
428          manufacturedDoseForm);
429    case -1427765963:
430      /* unitOfPresentation */ return new Property("unitOfPresentation", "CodeableConcept",
431          "The ?real world? units in which the quantity of the manufactured item is described.", 0, 1,
432          unitOfPresentation);
433    case -1285004149:
434      /* quantity */ return new Property("quantity", "Quantity",
435          "The quantity or \"count number\" of the manufactured item.", 0, 1, quantity);
436    case -1969347631:
437      /* manufacturer */ return new Property("manufacturer", "Reference(Organization)",
438          "Manufacturer of the item (Note that this should be named \"manufacturer\" but it currently causes technical issues).",
439          0, java.lang.Integer.MAX_VALUE, manufacturer);
440    case -206409263:
441      /* ingredient */ return new Property("ingredient", "Reference(MedicinalProductIngredient)", "Ingredient.", 0,
442          java.lang.Integer.MAX_VALUE, ingredient);
443    case -1599676319:
444      /* physicalCharacteristics */ return new Property("physicalCharacteristics", "ProdCharacteristic",
445          "Dimensions, color etc.", 0, 1, physicalCharacteristics);
446    case 722135304:
447      /* otherCharacteristics */ return new Property("otherCharacteristics", "CodeableConcept",
448          "Other codeable characteristics.", 0, java.lang.Integer.MAX_VALUE, otherCharacteristics);
449    default:
450      return super.getNamedProperty(_hash, _name, _checkValid);
451    }
452
453  }
454
455  @Override
456  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
457    switch (hash) {
458    case -1451400348:
459      /* manufacturedDoseForm */ return this.manufacturedDoseForm == null ? new Base[0]
460          : new Base[] { this.manufacturedDoseForm }; // CodeableConcept
461    case -1427765963:
462      /* unitOfPresentation */ return this.unitOfPresentation == null ? new Base[0]
463          : new Base[] { this.unitOfPresentation }; // CodeableConcept
464    case -1285004149:
465      /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
466    case -1969347631:
467      /* manufacturer */ return this.manufacturer == null ? new Base[0]
468          : this.manufacturer.toArray(new Base[this.manufacturer.size()]); // Reference
469    case -206409263:
470      /* ingredient */ return this.ingredient == null ? new Base[0]
471          : this.ingredient.toArray(new Base[this.ingredient.size()]); // Reference
472    case -1599676319:
473      /* physicalCharacteristics */ return this.physicalCharacteristics == null ? new Base[0]
474          : new Base[] { this.physicalCharacteristics }; // ProdCharacteristic
475    case 722135304:
476      /* otherCharacteristics */ return this.otherCharacteristics == null ? new Base[0]
477          : this.otherCharacteristics.toArray(new Base[this.otherCharacteristics.size()]); // CodeableConcept
478    default:
479      return super.getProperty(hash, name, checkValid);
480    }
481
482  }
483
484  @Override
485  public Base setProperty(int hash, String name, Base value) throws FHIRException {
486    switch (hash) {
487    case -1451400348: // manufacturedDoseForm
488      this.manufacturedDoseForm = castToCodeableConcept(value); // CodeableConcept
489      return value;
490    case -1427765963: // unitOfPresentation
491      this.unitOfPresentation = castToCodeableConcept(value); // CodeableConcept
492      return value;
493    case -1285004149: // quantity
494      this.quantity = castToQuantity(value); // Quantity
495      return value;
496    case -1969347631: // manufacturer
497      this.getManufacturer().add(castToReference(value)); // Reference
498      return value;
499    case -206409263: // ingredient
500      this.getIngredient().add(castToReference(value)); // Reference
501      return value;
502    case -1599676319: // physicalCharacteristics
503      this.physicalCharacteristics = castToProdCharacteristic(value); // ProdCharacteristic
504      return value;
505    case 722135304: // otherCharacteristics
506      this.getOtherCharacteristics().add(castToCodeableConcept(value)); // CodeableConcept
507      return value;
508    default:
509      return super.setProperty(hash, name, value);
510    }
511
512  }
513
514  @Override
515  public Base setProperty(String name, Base value) throws FHIRException {
516    if (name.equals("manufacturedDoseForm")) {
517      this.manufacturedDoseForm = castToCodeableConcept(value); // CodeableConcept
518    } else if (name.equals("unitOfPresentation")) {
519      this.unitOfPresentation = castToCodeableConcept(value); // CodeableConcept
520    } else if (name.equals("quantity")) {
521      this.quantity = castToQuantity(value); // Quantity
522    } else if (name.equals("manufacturer")) {
523      this.getManufacturer().add(castToReference(value));
524    } else if (name.equals("ingredient")) {
525      this.getIngredient().add(castToReference(value));
526    } else if (name.equals("physicalCharacteristics")) {
527      this.physicalCharacteristics = castToProdCharacteristic(value); // ProdCharacteristic
528    } else if (name.equals("otherCharacteristics")) {
529      this.getOtherCharacteristics().add(castToCodeableConcept(value));
530    } else
531      return super.setProperty(name, value);
532    return value;
533  }
534
535  @Override
536  public void removeChild(String name, Base value) throws FHIRException {
537    if (name.equals("manufacturedDoseForm")) {
538      this.manufacturedDoseForm = null;
539    } else if (name.equals("unitOfPresentation")) {
540      this.unitOfPresentation = null;
541    } else if (name.equals("quantity")) {
542      this.quantity = null;
543    } else if (name.equals("manufacturer")) {
544      this.getManufacturer().remove(castToReference(value));
545    } else if (name.equals("ingredient")) {
546      this.getIngredient().remove(castToReference(value));
547    } else if (name.equals("physicalCharacteristics")) {
548      this.physicalCharacteristics = null;
549    } else if (name.equals("otherCharacteristics")) {
550      this.getOtherCharacteristics().remove(castToCodeableConcept(value));
551    } else
552      super.removeChild(name, value);
553    
554  }
555
556  @Override
557  public Base makeProperty(int hash, String name) throws FHIRException {
558    switch (hash) {
559    case -1451400348:
560      return getManufacturedDoseForm();
561    case -1427765963:
562      return getUnitOfPresentation();
563    case -1285004149:
564      return getQuantity();
565    case -1969347631:
566      return addManufacturer();
567    case -206409263:
568      return addIngredient();
569    case -1599676319:
570      return getPhysicalCharacteristics();
571    case 722135304:
572      return addOtherCharacteristics();
573    default:
574      return super.makeProperty(hash, name);
575    }
576
577  }
578
579  @Override
580  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
581    switch (hash) {
582    case -1451400348:
583      /* manufacturedDoseForm */ return new String[] { "CodeableConcept" };
584    case -1427765963:
585      /* unitOfPresentation */ return new String[] { "CodeableConcept" };
586    case -1285004149:
587      /* quantity */ return new String[] { "Quantity" };
588    case -1969347631:
589      /* manufacturer */ return new String[] { "Reference" };
590    case -206409263:
591      /* ingredient */ return new String[] { "Reference" };
592    case -1599676319:
593      /* physicalCharacteristics */ return new String[] { "ProdCharacteristic" };
594    case 722135304:
595      /* otherCharacteristics */ return new String[] { "CodeableConcept" };
596    default:
597      return super.getTypesForProperty(hash, name);
598    }
599
600  }
601
602  @Override
603  public Base addChild(String name) throws FHIRException {
604    if (name.equals("manufacturedDoseForm")) {
605      this.manufacturedDoseForm = new CodeableConcept();
606      return this.manufacturedDoseForm;
607    } else if (name.equals("unitOfPresentation")) {
608      this.unitOfPresentation = new CodeableConcept();
609      return this.unitOfPresentation;
610    } else if (name.equals("quantity")) {
611      this.quantity = new Quantity();
612      return this.quantity;
613    } else if (name.equals("manufacturer")) {
614      return addManufacturer();
615    } else if (name.equals("ingredient")) {
616      return addIngredient();
617    } else if (name.equals("physicalCharacteristics")) {
618      this.physicalCharacteristics = new ProdCharacteristic();
619      return this.physicalCharacteristics;
620    } else if (name.equals("otherCharacteristics")) {
621      return addOtherCharacteristics();
622    } else
623      return super.addChild(name);
624  }
625
626  public String fhirType() {
627    return "MedicinalProductManufactured";
628
629  }
630
631  public MedicinalProductManufactured copy() {
632    MedicinalProductManufactured dst = new MedicinalProductManufactured();
633    copyValues(dst);
634    return dst;
635  }
636
637  public void copyValues(MedicinalProductManufactured dst) {
638    super.copyValues(dst);
639    dst.manufacturedDoseForm = manufacturedDoseForm == null ? null : manufacturedDoseForm.copy();
640    dst.unitOfPresentation = unitOfPresentation == null ? null : unitOfPresentation.copy();
641    dst.quantity = quantity == null ? null : quantity.copy();
642    if (manufacturer != null) {
643      dst.manufacturer = new ArrayList<Reference>();
644      for (Reference i : manufacturer)
645        dst.manufacturer.add(i.copy());
646    }
647    ;
648    if (ingredient != null) {
649      dst.ingredient = new ArrayList<Reference>();
650      for (Reference i : ingredient)
651        dst.ingredient.add(i.copy());
652    }
653    ;
654    dst.physicalCharacteristics = physicalCharacteristics == null ? null : physicalCharacteristics.copy();
655    if (otherCharacteristics != null) {
656      dst.otherCharacteristics = new ArrayList<CodeableConcept>();
657      for (CodeableConcept i : otherCharacteristics)
658        dst.otherCharacteristics.add(i.copy());
659    }
660    ;
661  }
662
663  protected MedicinalProductManufactured typedCopy() {
664    return copy();
665  }
666
667  @Override
668  public boolean equalsDeep(Base other_) {
669    if (!super.equalsDeep(other_))
670      return false;
671    if (!(other_ instanceof MedicinalProductManufactured))
672      return false;
673    MedicinalProductManufactured o = (MedicinalProductManufactured) other_;
674    return compareDeep(manufacturedDoseForm, o.manufacturedDoseForm, true)
675        && compareDeep(unitOfPresentation, o.unitOfPresentation, true) && compareDeep(quantity, o.quantity, true)
676        && compareDeep(manufacturer, o.manufacturer, true) && compareDeep(ingredient, o.ingredient, true)
677        && compareDeep(physicalCharacteristics, o.physicalCharacteristics, true)
678        && compareDeep(otherCharacteristics, o.otherCharacteristics, true);
679  }
680
681  @Override
682  public boolean equalsShallow(Base other_) {
683    if (!super.equalsShallow(other_))
684      return false;
685    if (!(other_ instanceof MedicinalProductManufactured))
686      return false;
687    MedicinalProductManufactured o = (MedicinalProductManufactured) other_;
688    return true;
689  }
690
691  public boolean isEmpty() {
692    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(manufacturedDoseForm, unitOfPresentation, quantity,
693        manufacturer, ingredient, physicalCharacteristics, otherCharacteristics);
694  }
695
696  @Override
697  public ResourceType getResourceType() {
698    return ResourceType.MedicinalProductManufactured;
699  }
700
701}