001package org.hl7.fhir.convertors.conv43_50.resources43_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext43_50;
004import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Attachment43_50;
005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.CodeableConcept43_50;
006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Identifier43_50;
007import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Period43_50;
008import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.ContactDetail43_50;
009import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.DataRequirement43_50;
010import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.ParameterDefinition43_50;
011import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.RelatedArtifact43_50;
012import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.UsageContext43_50;
013import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43_50;
014import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Date43_50;
015import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.DateTime43_50;
016import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.MarkDown43_50;
017import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
018import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
019import org.hl7.fhir.exceptions.FHIRException;
020
021/*
022  Copyright (c) 2011+, HL7, Inc.
023  All rights reserved.
024  
025  Redistribution and use in source and binary forms, with or without modification, 
026  are permitted provided that the following conditions are met:
027  
028   * Redistributions of source code must retain the above copyright notice, this 
029     list of conditions and the following disclaimer.
030   * Redistributions in binary form must reproduce the above copyright notice, 
031     this list of conditions and the following disclaimer in the documentation 
032     and/or other materials provided with the distribution.
033   * Neither the name of HL7 nor the names of its contributors may be used to 
034     endorse or promote products derived from this software without specific 
035     prior written permission.
036  
037  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
038  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
039  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
040  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
041  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
042  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
043  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
044  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
045  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
046  POSSIBILITY OF SUCH DAMAGE.
047  
048*/
049// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
050public class Library43_50 {
051
052  public static org.hl7.fhir.r5.model.Library convertLibrary(org.hl7.fhir.r4b.model.Library src) throws FHIRException {
053    if (src == null)
054      return null;
055    org.hl7.fhir.r5.model.Library tgt = new org.hl7.fhir.r5.model.Library();
056    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
057    if (src.hasUrl())
058      tgt.setUrlElement(Uri43_50.convertUri(src.getUrlElement()));
059    for (org.hl7.fhir.r4b.model.Identifier t : src.getIdentifier())
060      tgt.addIdentifier(Identifier43_50.convertIdentifier(t));
061    if (src.hasVersion())
062      tgt.setVersionElement(String43_50.convertString(src.getVersionElement()));
063    if (src.hasName())
064      tgt.setNameElement(String43_50.convertString(src.getNameElement()));
065    if (src.hasTitle())
066      tgt.setTitleElement(String43_50.convertString(src.getTitleElement()));
067    if (src.hasSubtitle())
068      tgt.setSubtitleElement(String43_50.convertString(src.getSubtitleElement()));
069    if (src.hasStatus())
070      tgt.setStatusElement(Enumerations43_50.convertPublicationStatus(src.getStatusElement()));
071    if (src.hasExperimental())
072      tgt.setExperimentalElement(Boolean43_50.convertBoolean(src.getExperimentalElement()));
073    if (src.hasType())
074      tgt.setType(CodeableConcept43_50.convertCodeableConcept(src.getType()));
075    if (src.hasSubject())
076      tgt.setSubject(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getSubject()));
077    if (src.hasDate())
078      tgt.setDateElement(DateTime43_50.convertDateTime(src.getDateElement()));
079    if (src.hasPublisher())
080      tgt.setPublisherElement(String43_50.convertString(src.getPublisherElement()));
081    for (org.hl7.fhir.r4b.model.ContactDetail t : src.getContact())
082      tgt.addContact(ContactDetail43_50.convertContactDetail(t));
083    if (src.hasDescription())
084      tgt.setDescriptionElement(MarkDown43_50.convertMarkdown(src.getDescriptionElement()));
085    for (org.hl7.fhir.r4b.model.UsageContext t : src.getUseContext())
086      tgt.addUseContext(UsageContext43_50.convertUsageContext(t));
087    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getJurisdiction())
088      tgt.addJurisdiction(CodeableConcept43_50.convertCodeableConcept(t));
089    if (src.hasPurpose())
090      tgt.setPurposeElement(MarkDown43_50.convertMarkdown(src.getPurposeElement()));
091    if (src.hasUsage())
092      tgt.setUsageElement(String43_50.convertStringToMarkdown(src.getUsageElement()));
093    if (src.hasCopyright())
094      tgt.setCopyrightElement(MarkDown43_50.convertMarkdown(src.getCopyrightElement()));
095    if (src.hasApprovalDate())
096      tgt.setApprovalDateElement(Date43_50.convertDate(src.getApprovalDateElement()));
097    if (src.hasLastReviewDate())
098      tgt.setLastReviewDateElement(Date43_50.convertDate(src.getLastReviewDateElement()));
099    if (src.hasEffectivePeriod())
100      tgt.setEffectivePeriod(Period43_50.convertPeriod(src.getEffectivePeriod()));
101    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getTopic())
102      tgt.addTopic(CodeableConcept43_50.convertCodeableConcept(t));
103    for (org.hl7.fhir.r4b.model.ContactDetail t : src.getAuthor())
104      tgt.addAuthor(ContactDetail43_50.convertContactDetail(t));
105    for (org.hl7.fhir.r4b.model.ContactDetail t : src.getEditor())
106      tgt.addEditor(ContactDetail43_50.convertContactDetail(t));
107    for (org.hl7.fhir.r4b.model.ContactDetail t : src.getReviewer())
108      tgt.addReviewer(ContactDetail43_50.convertContactDetail(t));
109    for (org.hl7.fhir.r4b.model.ContactDetail t : src.getEndorser())
110      tgt.addEndorser(ContactDetail43_50.convertContactDetail(t));
111    for (org.hl7.fhir.r4b.model.RelatedArtifact t : src.getRelatedArtifact())
112      tgt.addRelatedArtifact(RelatedArtifact43_50.convertRelatedArtifact(t));
113    for (org.hl7.fhir.r4b.model.ParameterDefinition t : src.getParameter())
114      tgt.addParameter(ParameterDefinition43_50.convertParameterDefinition(t));
115    for (org.hl7.fhir.r4b.model.DataRequirement t : src.getDataRequirement())
116      tgt.addDataRequirement(DataRequirement43_50.convertDataRequirement(t));
117    for (org.hl7.fhir.r4b.model.Attachment t : src.getContent()) tgt.addContent(Attachment43_50.convertAttachment(t));
118    return tgt;
119  }
120
121  public static org.hl7.fhir.r4b.model.Library convertLibrary(org.hl7.fhir.r5.model.Library src) throws FHIRException {
122    if (src == null)
123      return null;
124    org.hl7.fhir.r4b.model.Library tgt = new org.hl7.fhir.r4b.model.Library();
125    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
126    if (src.hasUrl())
127      tgt.setUrlElement(Uri43_50.convertUri(src.getUrlElement()));
128    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
129      tgt.addIdentifier(Identifier43_50.convertIdentifier(t));
130    if (src.hasVersion())
131      tgt.setVersionElement(String43_50.convertString(src.getVersionElement()));
132    if (src.hasName())
133      tgt.setNameElement(String43_50.convertString(src.getNameElement()));
134    if (src.hasTitle())
135      tgt.setTitleElement(String43_50.convertString(src.getTitleElement()));
136    if (src.hasSubtitle())
137      tgt.setSubtitleElement(String43_50.convertString(src.getSubtitleElement()));
138    if (src.hasStatus())
139      tgt.setStatusElement(Enumerations43_50.convertPublicationStatus(src.getStatusElement()));
140    if (src.hasExperimental())
141      tgt.setExperimentalElement(Boolean43_50.convertBoolean(src.getExperimentalElement()));
142    if (src.hasType())
143      tgt.setType(CodeableConcept43_50.convertCodeableConcept(src.getType()));
144    if (src.hasSubject())
145      tgt.setSubject(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getSubject()));
146    if (src.hasDate())
147      tgt.setDateElement(DateTime43_50.convertDateTime(src.getDateElement()));
148    if (src.hasPublisher())
149      tgt.setPublisherElement(String43_50.convertString(src.getPublisherElement()));
150    for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact())
151      tgt.addContact(ContactDetail43_50.convertContactDetail(t));
152    if (src.hasDescription())
153      tgt.setDescriptionElement(MarkDown43_50.convertMarkdown(src.getDescriptionElement()));
154    for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext())
155      tgt.addUseContext(UsageContext43_50.convertUsageContext(t));
156    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction())
157      tgt.addJurisdiction(CodeableConcept43_50.convertCodeableConcept(t));
158    if (src.hasPurpose())
159      tgt.setPurposeElement(MarkDown43_50.convertMarkdown(src.getPurposeElement()));
160    if (src.hasUsage())
161      tgt.setUsageElement(String43_50.convertString(src.getUsageElement()));
162    if (src.hasCopyright())
163      tgt.setCopyrightElement(MarkDown43_50.convertMarkdown(src.getCopyrightElement()));
164    if (src.hasApprovalDate())
165      tgt.setApprovalDateElement(Date43_50.convertDate(src.getApprovalDateElement()));
166    if (src.hasLastReviewDate())
167      tgt.setLastReviewDateElement(Date43_50.convertDate(src.getLastReviewDateElement()));
168    if (src.hasEffectivePeriod())
169      tgt.setEffectivePeriod(Period43_50.convertPeriod(src.getEffectivePeriod()));
170    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic())
171      tgt.addTopic(CodeableConcept43_50.convertCodeableConcept(t));
172    for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor())
173      tgt.addAuthor(ContactDetail43_50.convertContactDetail(t));
174    for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor())
175      tgt.addEditor(ContactDetail43_50.convertContactDetail(t));
176    for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer())
177      tgt.addReviewer(ContactDetail43_50.convertContactDetail(t));
178    for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser())
179      tgt.addEndorser(ContactDetail43_50.convertContactDetail(t));
180    for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact())
181      tgt.addRelatedArtifact(RelatedArtifact43_50.convertRelatedArtifact(t));
182    for (org.hl7.fhir.r5.model.ParameterDefinition t : src.getParameter())
183      tgt.addParameter(ParameterDefinition43_50.convertParameterDefinition(t));
184    for (org.hl7.fhir.r5.model.DataRequirement t : src.getDataRequirement())
185      tgt.addDataRequirement(DataRequirement43_50.convertDataRequirement(t));
186    for (org.hl7.fhir.r5.model.Attachment t : src.getContent()) tgt.addContent(Attachment43_50.convertAttachment(t));
187    return tgt;
188  }
189}