001package org.hl7.fhir.convertors.conv30_50.resources30_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext30_50;
004import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50;
005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50;
006import org.hl7.fhir.exceptions.FHIRException;
007
008public class OperationOutcome30_50 {
009
010  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity> convertIssueSeverity(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity> src) throws FHIRException {
011    if (src == null || src.isEmpty())
012      return null;
013    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverityEnumFactory());
014    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
015    switch (src.getValue()) {
016      case FATAL:
017        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.FATAL);
018        break;
019      case ERROR:
020        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR);
021        break;
022      case WARNING:
023        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING);
024        break;
025      case INFORMATION:
026        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION);
027        break;
028      default:
029        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.NULL);
030        break;
031    }
032    return tgt;
033  }
034
035  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity> convertIssueSeverity(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity> src) throws FHIRException {
036    if (src == null || src.isEmpty())
037      return null;
038    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.OperationOutcome.IssueSeverityEnumFactory());
039    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
040    switch (src.getValue()) {
041      case FATAL:
042        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.FATAL);
043        break;
044      case ERROR:
045        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.ERROR);
046        break;
047      case WARNING:
048        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.WARNING);
049        break;
050      case INFORMATION:
051        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.INFORMATION);
052        break;
053      default:
054        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.NULL);
055        break;
056    }
057    return tgt;
058  }
059
060  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.OperationOutcome.IssueType> convertIssueType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.OperationOutcome.IssueType> src) throws FHIRException {
061    if (src == null || src.isEmpty())
062      return null;
063    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.OperationOutcome.IssueType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.OperationOutcome.IssueTypeEnumFactory());
064    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
065    switch (src.getValue()) {
066      case INVALID:
067        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVALID);
068        break;
069      case STRUCTURE:
070        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.STRUCTURE);
071        break;
072      case REQUIRED:
073        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.REQUIRED);
074        break;
075      case VALUE:
076        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.VALUE);
077        break;
078      case INVARIANT:
079        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVARIANT);
080        break;
081      case SECURITY:
082        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.SECURITY);
083        break;
084      case LOGIN:
085        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOGIN);
086        break;
087      case UNKNOWN:
088        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.UNKNOWN);
089        break;
090      case EXPIRED:
091        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXPIRED);
092        break;
093      case FORBIDDEN:
094        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.FORBIDDEN);
095        break;
096      case SUPPRESSED:
097        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.SUPPRESSED);
098        break;
099      case PROCESSING:
100        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.PROCESSING);
101        break;
102      case NOTSUPPORTED:
103        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTSUPPORTED);
104        break;
105      case DUPLICATE:
106        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.DUPLICATE);
107        break;
108      case NOTFOUND:
109        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTFOUND);
110        break;
111      case TOOLONG:
112        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOLONG);
113        break;
114      case CODEINVALID:
115        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.CODEINVALID);
116        break;
117      case EXTENSION:
118        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXTENSION);
119        break;
120      case TOOCOSTLY:
121        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOCOSTLY);
122        break;
123      case BUSINESSRULE:
124        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.BUSINESSRULE);
125        break;
126      case CONFLICT:
127        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.CONFLICT);
128        break;
129      case INCOMPLETE:
130        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.INCOMPLETE);
131        break;
132      case TRANSIENT:
133        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.TRANSIENT);
134        break;
135      case LOCKERROR:
136        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOCKERROR);
137        break;
138      case NOSTORE:
139        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOSTORE);
140        break;
141      case EXCEPTION:
142        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXCEPTION);
143        break;
144      case TIMEOUT:
145        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.TIMEOUT);
146        break;
147      case THROTTLED:
148        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.THROTTLED);
149        break;
150      case INFORMATIONAL:
151        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.INFORMATIONAL);
152        break;
153      default:
154        tgt.setValue(org.hl7.fhir.r5.model.OperationOutcome.IssueType.NULL);
155        break;
156    }
157    return tgt;
158  }
159
160  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.OperationOutcome.IssueType> convertIssueType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.OperationOutcome.IssueType> src) throws FHIRException {
161    if (src == null || src.isEmpty())
162      return null;
163    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.OperationOutcome.IssueType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.OperationOutcome.IssueTypeEnumFactory());
164    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
165    switch (src.getValue()) {
166      case INVALID:
167        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVALID);
168        break;
169      case STRUCTURE:
170        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.STRUCTURE);
171        break;
172      case REQUIRED:
173        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.REQUIRED);
174        break;
175      case VALUE:
176        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.VALUE);
177        break;
178      case INVARIANT:
179        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVARIANT);
180        break;
181      case SECURITY:
182        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SECURITY);
183        break;
184      case LOGIN:
185        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOGIN);
186        break;
187      case UNKNOWN:
188        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.UNKNOWN);
189        break;
190      case EXPIRED:
191        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXPIRED);
192        break;
193      case FORBIDDEN:
194        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.FORBIDDEN);
195        break;
196      case SUPPRESSED:
197        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SUPPRESSED);
198        break;
199      case PROCESSING:
200        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.PROCESSING);
201        break;
202      case NOTSUPPORTED:
203        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTSUPPORTED);
204        break;
205      case DUPLICATE:
206        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.DUPLICATE);
207        break;
208      case NOTFOUND:
209        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTFOUND);
210        break;
211      case TOOLONG:
212        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOLONG);
213        break;
214      case CODEINVALID:
215        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CODEINVALID);
216        break;
217      case EXTENSION:
218        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXTENSION);
219        break;
220      case TOOCOSTLY:
221        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOCOSTLY);
222        break;
223      case BUSINESSRULE:
224        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.BUSINESSRULE);
225        break;
226      case CONFLICT:
227        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CONFLICT);
228        break;
229      case INCOMPLETE:
230        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INCOMPLETE);
231        break;
232      case TRANSIENT:
233        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TRANSIENT);
234        break;
235      case LOCKERROR:
236        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOCKERROR);
237        break;
238      case NOSTORE:
239        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOSTORE);
240        break;
241      case EXCEPTION:
242        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXCEPTION);
243        break;
244      case TIMEOUT:
245        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TIMEOUT);
246        break;
247      case THROTTLED:
248        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.THROTTLED);
249        break;
250      case INFORMATIONAL:
251        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INFORMATIONAL);
252        break;
253      default:
254        tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NULL);
255        break;
256    }
257    return tgt;
258  }
259
260  public static org.hl7.fhir.r5.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome src) throws FHIRException {
261    if (src == null)
262      return null;
263    org.hl7.fhir.r5.model.OperationOutcome tgt = new org.hl7.fhir.r5.model.OperationOutcome();
264    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
265    for (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue())
266      tgt.addIssue(convertOperationOutcomeIssueComponent(t));
267    return tgt;
268  }
269
270  public static org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r5.model.OperationOutcome src) throws FHIRException {
271    if (src == null)
272      return null;
273    org.hl7.fhir.dstu3.model.OperationOutcome tgt = new org.hl7.fhir.dstu3.model.OperationOutcome();
274    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
275    for (org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue())
276      tgt.addIssue(convertOperationOutcomeIssueComponent(t));
277    return tgt;
278  }
279
280  public static org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException {
281    if (src == null)
282      return null;
283    org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent();
284    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
285    if (src.hasSeverity())
286      tgt.setSeverityElement(convertIssueSeverity(src.getSeverityElement()));
287    if (src.hasCode())
288      tgt.setCodeElement(convertIssueType(src.getCodeElement()));
289    if (src.hasDetails())
290      tgt.setDetails(CodeableConcept30_50.convertCodeableConcept(src.getDetails()));
291    if (src.hasDiagnostics())
292      tgt.setDiagnosticsElement(String30_50.convertString(src.getDiagnosticsElement()));
293    for (org.hl7.fhir.dstu3.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue());
294    for (org.hl7.fhir.dstu3.model.StringType t : src.getExpression()) tgt.addExpression(t.getValue());
295    return tgt;
296  }
297
298  public static org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException {
299    if (src == null)
300      return null;
301    org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent();
302    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
303    if (src.hasSeverity())
304      tgt.setSeverityElement(convertIssueSeverity(src.getSeverityElement()));
305    if (src.hasCode())
306      tgt.setCodeElement(convertIssueType(src.getCodeElement()));
307    if (src.hasDetails())
308      tgt.setDetails(CodeableConcept30_50.convertCodeableConcept(src.getDetails()));
309    if (src.hasDiagnostics())
310      tgt.setDiagnosticsElement(String30_50.convertString(src.getDiagnosticsElement()));
311    for (org.hl7.fhir.r5.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue());
312    for (org.hl7.fhir.r5.model.StringType t : src.getExpression()) tgt.addExpression(t.getValue());
313    return tgt;
314  }
315}