diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_30.java index 0c7858e21..90a361f9c 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_30.java @@ -418,7 +418,8 @@ public class VersionConvertor_10_30 { copyElement(src, tgt); if (src.hasStatus()) tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); + if (src.hasDiv()) + tgt.setDiv(src.getDiv()); return tgt; } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Account10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Account10_30.java index fd2d20062..37fbaf817 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Account10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Account10_30.java @@ -16,7 +16,7 @@ public class Account10_30 { if (src.hasType()) tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); if (src.hasStatus()) - tgt.setStatus(convertAccountStatus(src.getStatus())); + tgt.setStatusElement(convertAccountStatus(src.getStatusElement())); if (src.hasActive()) tgt.setActivePeriod(VersionConvertor_10_30.convertPeriod(src.getActive())); if (src.hasBalance()) @@ -41,7 +41,7 @@ public class Account10_30 { if (src.hasType()) tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); if (src.hasStatus()) - tgt.setStatus(convertAccountStatus(src.getStatus())); + tgt.setStatusElement(convertAccountStatus(src.getStatusElement())); if (src.hasActivePeriod()) tgt.setActive(VersionConvertor_10_30.convertPeriod(src.getActivePeriod())); if (src.hasBalance()) @@ -55,29 +55,41 @@ public class Account10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.Account.AccountStatus convertAccountStatus(org.hl7.fhir.dstu2.model.Account.AccountStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertAccountStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Account.AccountStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ACTIVE: - return org.hl7.fhir.dstu3.model.Account.AccountStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.Account.AccountStatus.ACTIVE); + break; case INACTIVE: - return org.hl7.fhir.dstu3.model.Account.AccountStatus.INACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.Account.AccountStatus.INACTIVE); + break; default: - return org.hl7.fhir.dstu3.model.Account.AccountStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Account.AccountStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Account.AccountStatus convertAccountStatus(org.hl7.fhir.dstu3.model.Account.AccountStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertAccountStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Account.AccountStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ACTIVE: - return org.hl7.fhir.dstu2.model.Account.AccountStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu2.model.Account.AccountStatus.ACTIVE); + break; case INACTIVE: - return org.hl7.fhir.dstu2.model.Account.AccountStatus.INACTIVE; + tgt.setValue(org.hl7.fhir.dstu2.model.Account.AccountStatus.INACTIVE); + break; default: - return org.hl7.fhir.dstu2.model.Account.AccountStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Account.AccountStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Appointment10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Appointment10_30.java index baea248a6..db9b32a2a 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Appointment10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Appointment10_30.java @@ -12,7 +12,7 @@ public class Appointment10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasStatus()) - tgt.setStatus(convertAppointmentStatus(src.getStatus())); + tgt.setStatusElement(convertAppointmentStatus(src.getStatusElement())); for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) tgt.setType(VersionConvertor_10_30.convertCodeableConcept(t)); if (src.hasPriorityElement()) tgt.setPriorityElement(VersionConvertor_10_30.convertUnsignedInt(src.getPriorityElement())); @@ -38,7 +38,7 @@ public class Appointment10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasStatus()) - tgt.setStatus(convertAppointmentStatus(src.getStatus())); + tgt.setStatusElement(convertAppointmentStatus(src.getStatusElement())); if (src.hasType()) tgt.addServiceType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); if (src.hasPriorityElement()) @@ -67,9 +67,9 @@ public class Appointment10_30 { if (src.hasActor()) tgt.setActor(VersionConvertor_10_30.convertReference(src.getActor())); if (src.hasRequired()) - tgt.setRequired(convertParticipantRequired(src.getRequired())); + tgt.setRequiredElement(convertParticipantRequired(src.getRequiredElement())); if (src.hasStatus()) - tgt.setStatus(convertParticipationStatus(src.getStatus())); + tgt.setStatusElement(convertParticipationStatus(src.getStatusElement())); return tgt; } @@ -82,119 +82,171 @@ public class Appointment10_30 { if (src.hasActor()) tgt.setActor(VersionConvertor_10_30.convertReference(src.getActor())); if (src.hasRequired()) - tgt.setRequired(convertParticipantRequired(src.getRequired())); + tgt.setRequiredElement(convertParticipantRequired(src.getRequiredElement())); if (src.hasStatus()) - tgt.setStatus(convertParticipationStatus(src.getStatus())); + tgt.setStatusElement(convertParticipationStatus(src.getStatusElement())); return tgt; } - public static org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertAppointmentStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Appointment.AppointmentStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PROPOSED: - return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.PROPOSED; + tgt.setValue(org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.PROPOSED); + break; case PENDING: - return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.PENDING; + tgt.setValue(org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.PENDING); + break; case BOOKED: - return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.BOOKED; + tgt.setValue(org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.BOOKED); + break; case ARRIVED: - return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.ARRIVED; + tgt.setValue(org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.ARRIVED); + break; case FULFILLED: - return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.FULFILLED; + tgt.setValue(org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.FULFILLED); + break; case CANCELLED: - return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.CANCELLED; + tgt.setValue(org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.CANCELLED); + break; case NOSHOW: - return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.NOSHOW; + tgt.setValue(org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.NOSHOW); + break; default: - return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertAppointmentStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Appointment.AppointmentStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PROPOSED: - return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PROPOSED; + tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PROPOSED); + break; case PENDING: - return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PENDING; + tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PENDING); + break; case BOOKED: - return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.BOOKED; + tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.BOOKED); + break; case ARRIVED: - return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ARRIVED; + tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ARRIVED); + break; case FULFILLED: - return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.FULFILLED; + tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.FULFILLED); + break; case CANCELLED: - return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.CANCELLED; + tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.CANCELLED); + break; case NOSHOW: - return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NOSHOW; + tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NOSHOW); + break; default: - return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertParticipantRequired(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Appointment.ParticipantRequiredEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case REQUIRED: - return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.REQUIRED; + tgt.setValue(org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.REQUIRED); + break; case OPTIONAL: - return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.OPTIONAL; + tgt.setValue(org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.OPTIONAL); + break; case INFORMATIONONLY: - return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.INFORMATIONONLY; + tgt.setValue(org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.INFORMATIONONLY); + break; default: - return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertParticipantRequired(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Appointment.ParticipantRequiredEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case REQUIRED: - return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.REQUIRED; + tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.REQUIRED); + break; case OPTIONAL: - return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.OPTIONAL; + tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.OPTIONAL); + break; case INFORMATIONONLY: - return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.INFORMATIONONLY; + tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.INFORMATIONONLY); + break; default: - return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertParticipationStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Appointment.ParticipationStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ACCEPTED: - return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.ACCEPTED; + tgt.setValue(org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.ACCEPTED); + break; case DECLINED: - return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.DECLINED; + tgt.setValue(org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.DECLINED); + break; case TENTATIVE: - return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.TENTATIVE; + tgt.setValue(org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.TENTATIVE); + break; case NEEDSACTION: - return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.NEEDSACTION; + tgt.setValue(org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.NEEDSACTION); + break; default: - return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertParticipationStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Appointment.ParticipationStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ACCEPTED: - return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.ACCEPTED; + tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.ACCEPTED); + break; case DECLINED: - return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.DECLINED; + tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.DECLINED); + break; case TENTATIVE: - return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.TENTATIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.TENTATIVE); + break; case NEEDSACTION: - return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NEEDSACTION; + tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NEEDSACTION); + break; default: - return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/AppointmentResponse10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/AppointmentResponse10_30.java index 7d1a89acc..de571a8b2 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/AppointmentResponse10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/AppointmentResponse10_30.java @@ -21,7 +21,7 @@ public class AppointmentResponse10_30 { if (src.hasActor()) tgt.setActor(VersionConvertor_10_30.convertReference(src.getActor())); if (src.hasParticipantStatus()) - tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + tgt.setParticipantStatusElement(convertParticipantStatus(src.getParticipantStatusElement())); if (src.hasCommentElement()) tgt.setCommentElement(VersionConvertor_10_30.convertString(src.getCommentElement())); return tgt; @@ -43,47 +43,65 @@ public class AppointmentResponse10_30 { if (src.hasActor()) tgt.setActor(VersionConvertor_10_30.convertReference(src.getActor())); if (src.hasParticipantStatus()) - tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + tgt.setParticipantStatusElement(convertParticipantStatus(src.getParticipantStatusElement())); if (src.hasCommentElement()) tgt.setCommentElement(VersionConvertor_10_30.convertString(src.getCommentElement())); return tgt; } - static public org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus src) { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertParticipantStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ACCEPTED: - return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + tgt.setValue(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED); + break; case DECLINED: - return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.DECLINED; + tgt.setValue(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.DECLINED); + break; case TENTATIVE: - return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.TENTATIVE); + break; case INPROCESS: - return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + tgt.setValue(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED); + break; case COMPLETED: - return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + tgt.setValue(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED); + break; case NEEDSACTION: - return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + tgt.setValue(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NEEDSACTION); + break; default: - return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NULL); + break; } + return tgt; } - static public org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus src) { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertParticipantStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ACCEPTED: - return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + tgt.setValue(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.ACCEPTED); + break; case DECLINED: - return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.DECLINED; + tgt.setValue(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.DECLINED); + break; case TENTATIVE: - return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + tgt.setValue(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.TENTATIVE); + break; case NEEDSACTION: - return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + tgt.setValue(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NEEDSACTION); + break; default: - return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/AuditEvent10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/AuditEvent10_30.java index 7b971aa37..02a3761a2 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/AuditEvent10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/AuditEvent10_30.java @@ -12,9 +12,9 @@ public class AuditEvent10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); tgt.getEvent().setType(VersionConvertor_10_30.convertCoding(src.getType())); for (org.hl7.fhir.dstu3.model.Coding t : src.getSubtype()) tgt.getEvent().addSubtype(VersionConvertor_10_30.convertCoding(t)); - tgt.getEvent().setAction(convertAuditEventAction(src.getAction())); + tgt.getEvent().setActionElement(convertAuditEventAction(src.getActionElement())); tgt.getEvent().setDateTime(src.getRecorded()); - tgt.getEvent().setOutcome(convertAuditEventOutcome(src.getOutcome())); + tgt.getEvent().setOutcomeElement(convertAuditEventOutcome(src.getOutcomeElement())); tgt.getEvent().setOutcomeDesc(src.getOutcomeDesc()); for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfEvent()) for (org.hl7.fhir.dstu3.model.Coding cc : t.getCoding()) tgt.getEvent().addPurposeOfEvent(VersionConvertor_10_30.convertCoding(cc)); for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) tgt.addParticipant(convertAuditEventAgentComponent(t)); @@ -33,9 +33,9 @@ public class AuditEvent10_30 { if (src.hasType()) tgt.setType(VersionConvertor_10_30.convertCoding(src.getEvent().getType())); for (org.hl7.fhir.dstu2.model.Coding t : src.getEvent().getSubtype()) tgt.addSubtype(VersionConvertor_10_30.convertCoding(t)); - tgt.setAction(convertAuditEventAction(src.getEvent().getAction())); + tgt.setActionElement(convertAuditEventAction(src.getEvent().getActionElement())); tgt.setRecorded(src.getEvent().getDateTime()); - tgt.setOutcome(convertAuditEventOutcome(src.getEvent().getOutcome())); + tgt.setOutcomeElement(convertAuditEventOutcome(src.getEvent().getOutcomeElement())); tgt.setOutcomeDesc(src.getEvent().getOutcomeDesc()); for (org.hl7.fhir.dstu2.model.Coding t : src.getEvent().getPurposeOfEvent()) tgt.addPurposeOfEvent().addCoding(VersionConvertor_10_30.convertCoding(t)); } @@ -46,42 +46,60 @@ public class AuditEvent10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertAuditEventAction(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventActionEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case C: - return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.C; + tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.C); + break; case R: - return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.R; + tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.R); + break; case U: - return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.U; + tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.U); + break; case D: - return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.D; + tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.D); + break; case E: - return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.E; + tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.E); + break; default: - return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertAuditEventAction(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventActionEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case C: - return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.C; + tgt.setValue(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.C); + break; case R: - return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.R; + tgt.setValue(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.R); + break; case U: - return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.U; + tgt.setValue(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.U); + break; case D: - return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.D; + tgt.setValue(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.D); + break; case E: - return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.E; + tgt.setValue(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.E); + break; default: - return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent src) throws FHIRException { @@ -146,7 +164,7 @@ public class AuditEvent10_30 { if (src.hasAddressElement()) tgt.setAddressElement(VersionConvertor_10_30.convertString(src.getAddressElement())); if (src.hasType()) - tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); + tgt.setTypeElement(convertAuditEventParticipantNetworkType(src.getTypeElement())); return tgt; } @@ -158,7 +176,7 @@ public class AuditEvent10_30 { if (src.hasAddressElement()) tgt.setAddressElement(VersionConvertor_10_30.convertString(src.getAddressElement())); if (src.hasType()) - tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); + tgt.setTypeElement(convertAuditEventParticipantNetworkType(src.getTypeElement())); return tgt; } @@ -238,76 +256,110 @@ public class AuditEvent10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertAuditEventOutcome(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcomeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case _0: - return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._0; + tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._0); + break; case _4: - return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._4; + tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._4); + break; case _8: - return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._8; + tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._8); + break; case _12: - return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._12; + tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._12); + break; default: - return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertAuditEventOutcome(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcomeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case _0: - return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._0; + tgt.setValue(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._0); + break; case _4: - return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._4; + tgt.setValue(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._4); + break; case _8: - return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._8; + tgt.setValue(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._8); + break; case _12: - return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._12; + tgt.setValue(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._12); + break; default: - return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertAuditEventParticipantNetworkType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case _1: - return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._1; + tgt.setValue(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._1); + break; case _2: - return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._2; + tgt.setValue(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._2); + break; case _3: - return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._3; + tgt.setValue(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._3); + break; case _4: - return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._4; + tgt.setValue(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._4); + break; case _5: - return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._5; + tgt.setValue(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._5); + break; default: - return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertAuditEventParticipantNetworkType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case _1: - return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._1; + tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._1); + break; case _2: - return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._2; + tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._2); + break; case _3: - return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._3; + tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._3); + break; case _4: - return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._4; + tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._4); + break; case _5: - return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._5; + tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._5); + break; default: - return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Bundle10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Bundle10_30.java index 61bcaf922..12b63fd7e 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Bundle10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Bundle10_30.java @@ -12,7 +12,7 @@ public class Bundle10_30 { org.hl7.fhir.dstu3.model.Bundle tgt = new org.hl7.fhir.dstu3.model.Bundle(); VersionConvertor_10_30.copyResource(src, tgt); if (src.hasType()) - tgt.setType(convertBundleType(src.getType())); + tgt.setTypeElement(convertBundleType(src.getTypeElement())); if (src.hasTotal()) tgt.setTotalElement(VersionConvertor_10_30.convertUnsignedInt(src.getTotalElement())); for (org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); @@ -28,7 +28,7 @@ public class Bundle10_30 { org.hl7.fhir.dstu2.model.Bundle tgt = new org.hl7.fhir.dstu2.model.Bundle(); VersionConvertor_10_30.copyResource(src, tgt); if (src.hasType()) - tgt.setType(convertBundleType(src.getType())); + tgt.setTypeElement(convertBundleType(src.getTypeElement())); if (src.hasTotal()) tgt.setTotalElement(VersionConvertor_10_30.convertUnsignedInt(src.getTotalElement())); for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); @@ -94,7 +94,7 @@ public class Bundle10_30 { org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasMethod()) - tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setMethodElement(convertHTTPVerb(src.getMethodElement())); if (src.hasUrlElement()) tgt.setUrlElement(VersionConvertor_10_30.convertUri(src.getUrlElement())); if (src.hasIfNoneMatchElement()) @@ -114,7 +114,7 @@ public class Bundle10_30 { org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasMethod()) - tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setMethodElement(convertHTTPVerb(src.getMethodElement())); if (src.hasUrlElement()) tgt.setUrlElement(VersionConvertor_10_30.convertUri(src.getUrlElement())); if (src.hasIfNoneMatchElement()) @@ -166,7 +166,7 @@ public class Bundle10_30 { org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasMode()) - tgt.setMode(convertSearchEntryMode(src.getMode())); + tgt.setModeElement(convertSearchEntryMode(src.getModeElement())); if (src.hasScoreElement()) tgt.setScoreElement(VersionConvertor_10_30.convertDecimal(src.getScoreElement())); return tgt; @@ -178,7 +178,7 @@ public class Bundle10_30 { org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasMode()) - tgt.setMode(convertSearchEntryMode(src.getMode())); + tgt.setModeElement(convertSearchEntryMode(src.getModeElement())); if (src.hasScoreElement()) tgt.setScoreElement(VersionConvertor_10_30.convertDecimal(src.getScoreElement())); return tgt; @@ -208,121 +208,177 @@ public class Bundle10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu2.model.Bundle.BundleType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertBundleType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Bundle.BundleTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case DOCUMENT: - return org.hl7.fhir.dstu3.model.Bundle.BundleType.DOCUMENT; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.BundleType.DOCUMENT); + break; case MESSAGE: - return org.hl7.fhir.dstu3.model.Bundle.BundleType.MESSAGE; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.BundleType.MESSAGE); + break; case TRANSACTION: - return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTION; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTION); + break; case TRANSACTIONRESPONSE: - return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTIONRESPONSE; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTIONRESPONSE); + break; case BATCH: - return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCH; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCH); + break; case BATCHRESPONSE: - return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCHRESPONSE; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCHRESPONSE); + break; case HISTORY: - return org.hl7.fhir.dstu3.model.Bundle.BundleType.HISTORY; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.BundleType.HISTORY); + break; case SEARCHSET: - return org.hl7.fhir.dstu3.model.Bundle.BundleType.SEARCHSET; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.BundleType.SEARCHSET); + break; case COLLECTION: - return org.hl7.fhir.dstu3.model.Bundle.BundleType.COLLECTION; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.BundleType.COLLECTION); + break; default: - return org.hl7.fhir.dstu3.model.Bundle.BundleType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.BundleType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu3.model.Bundle.BundleType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertBundleType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Bundle.BundleTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case DOCUMENT: - return org.hl7.fhir.dstu2.model.Bundle.BundleType.DOCUMENT; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.DOCUMENT); + break; case MESSAGE: - return org.hl7.fhir.dstu2.model.Bundle.BundleType.MESSAGE; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.MESSAGE); + break; case TRANSACTION: - return org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTION; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTION); + break; case TRANSACTIONRESPONSE: - return org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTIONRESPONSE; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTIONRESPONSE); + break; case BATCH: - return org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCH; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCH); + break; case BATCHRESPONSE: - return org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCHRESPONSE; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCHRESPONSE); + break; case HISTORY: - return org.hl7.fhir.dstu2.model.Bundle.BundleType.HISTORY; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.HISTORY); + break; case SEARCHSET: - return org.hl7.fhir.dstu2.model.Bundle.BundleType.SEARCHSET; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.SEARCHSET); + break; case COLLECTION: - return org.hl7.fhir.dstu2.model.Bundle.BundleType.COLLECTION; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.COLLECTION); + break; default: - return org.hl7.fhir.dstu2.model.Bundle.BundleType.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu2.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertHTTPVerb(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Bundle.HTTPVerbEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case GET: - return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.GET; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.GET); + break; case POST: - return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.POST; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.POST); + break; case PUT: - return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.PUT; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.PUT); + break; case DELETE: - return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.DELETE; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.DELETE); + break; default: - return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertHTTPVerb(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Bundle.HTTPVerbEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case GET: - return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.GET; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.GET); + break; case POST: - return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.POST; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.POST); + break; case PUT: - return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.PUT; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.PUT); + break; case DELETE: - return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.DELETE; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.DELETE); + break; default: - return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertSearchEntryMode(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Bundle.SearchEntryModeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case MATCH: - return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.MATCH; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.MATCH); + break; case INCLUDE: - return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.INCLUDE; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.INCLUDE); + break; case OUTCOME: - return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.OUTCOME; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.OUTCOME); + break; default: - return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertSearchEntryMode(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Bundle.SearchEntryModeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case MATCH: - return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.MATCH; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.MATCH); + break; case INCLUDE: - return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.INCLUDE; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.INCLUDE); + break; case OUTCOME: - return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.OUTCOME; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.OUTCOME); + break; default: - return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/CarePlan10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/CarePlan10_30.java index 1c5bd4aa2..380f82263 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/CarePlan10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/CarePlan10_30.java @@ -14,7 +14,7 @@ public class CarePlan10_30 { if (src.hasSubject()) tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); if (src.hasStatus()) - tgt.setStatus(convertCarePlanStatus(src.getStatus())); + tgt.setStatusElement(convertCarePlanStatus(src.getStatusElement())); if (src.hasContext()) tgt.setContext(VersionConvertor_10_30.convertReference(src.getContext())); if (src.hasPeriod()) @@ -38,7 +38,7 @@ public class CarePlan10_30 { if (src.hasSubject()) tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); if (src.hasStatus()) - tgt.setStatus(convertCarePlanStatus(src.getStatus())); + tgt.setStatusElement(convertCarePlanStatus(src.getStatusElement())); if (src.hasContext()) tgt.setContext(VersionConvertor_10_30.convertReference(src.getContext())); if (src.hasPeriod()) @@ -92,7 +92,7 @@ public class CarePlan10_30 { for (org.hl7.fhir.dstu2.model.Reference t : src.getReasonReference()) tgt.addReasonReference(VersionConvertor_10_30.convertReference(t)); for (org.hl7.fhir.dstu2.model.Reference t : src.getGoal()) tgt.addGoal(VersionConvertor_10_30.convertReference(t)); if (src.hasStatus()) - tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); + tgt.setStatusElement(convertCarePlanActivityStatus(src.getStatusElement())); if (src.hasProhibitedElement()) tgt.setProhibitedElement(VersionConvertor_10_30.convertBoolean(src.getProhibitedElement())); if (src.hasScheduled()) @@ -124,7 +124,7 @@ public class CarePlan10_30 { for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) tgt.addReasonReference(VersionConvertor_10_30.convertReference(t)); for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) tgt.addGoal(VersionConvertor_10_30.convertReference(t)); if (src.hasStatus()) - tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); + tgt.setStatusElement(convertCarePlanActivityStatus(src.getStatusElement())); if (src.hasProhibitedElement()) tgt.setProhibitedElement(VersionConvertor_10_30.convertBoolean(src.getProhibitedElement())); if (src.hasScheduled()) @@ -143,81 +143,118 @@ public class CarePlan10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertCarePlanActivityStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case NOTSTARTED: - return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; + tgt.setValue(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.NOTSTARTED); + break; case SCHEDULED: - return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.SCHEDULED; + tgt.setValue(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.SCHEDULED); + break; case INPROGRESS: - return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.INPROGRESS; + tgt.setValue(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.INPROGRESS); + break; case ONHOLD: - return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.ONHOLD; + tgt.setValue(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.ONHOLD); + break; case COMPLETED: - return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.COMPLETED); + break; case CANCELLED: - return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.CANCELLED; + tgt.setValue(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.CANCELLED); + break; default: - return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertCarePlanActivityStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case NOTSTARTED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; + tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NOTSTARTED); + break; case SCHEDULED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.SCHEDULED; + tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.SCHEDULED); + break; case INPROGRESS: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.INPROGRESS; + tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.INPROGRESS); + break; case ONHOLD: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.ONHOLD; + tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.ONHOLD); + break; case COMPLETED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.COMPLETED); + break; case CANCELLED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.CANCELLED; + tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.CANCELLED); + break; default: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertCarePlanStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case DRAFT: - return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.DRAFT; + tgt.setValue(org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.DRAFT); + break; case ACTIVE: - return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.ACTIVE); + break; case COMPLETED: - return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.COMPLETED); + break; case CANCELLED: - return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.CANCELLED; + tgt.setValue(org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.CANCELLED); + break; default: - return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertCarePlanStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PROPOSED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.DRAFT; + tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.DRAFT); + break; case DRAFT: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.DRAFT; + tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.DRAFT); + break; case ACTIVE: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.ACTIVE); + break; case COMPLETED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.COMPLETED); + break; case CANCELLED: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.CANCELLED; + tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.CANCELLED); + break; default: - return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ClinicalImpression10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ClinicalImpression10_30.java index b3e7ec23b..fefb5f5a1 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ClinicalImpression10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ClinicalImpression10_30.java @@ -16,7 +16,7 @@ public class ClinicalImpression10_30 { if (src.hasAssessor()) tgt.setAssessor(VersionConvertor_10_30.convertReference(src.getAssessor())); if (src.hasStatus()) - tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); + tgt.setStatusElement(convertClinicalImpressionStatus(src.getStatusElement())); if (src.hasDate()) tgt.setDateElement(VersionConvertor_10_30.convertDateTime(src.getDateElement())); if (src.hasDescriptionElement()) @@ -44,7 +44,7 @@ public class ClinicalImpression10_30 { if (src.hasAssessor()) tgt.setAssessor(VersionConvertor_10_30.convertReference(src.getAssessor())); if (src.hasStatus()) - tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); + tgt.setStatusElement(convertClinicalImpressionStatus(src.getStatusElement())); if (src.hasDate()) tgt.setDateElement(VersionConvertor_10_30.convertDateTime(src.getDateElement())); if (src.hasDescriptionElement()) @@ -86,33 +86,47 @@ public class ClinicalImpression10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertClinicalImpressionStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case INPROGRESS: - return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.DRAFT; + tgt.setValue(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.DRAFT); + break; case COMPLETED: - return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR); + break; default: - return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertClinicalImpressionStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case DRAFT: - return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.INPROGRESS; + tgt.setValue(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.INPROGRESS); + break; case COMPLETED: - return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR); + break; default: - return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Communication10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Communication10_30.java index e9b06a352..7b5e70bd6 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Communication10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Communication10_30.java @@ -19,7 +19,7 @@ public class Communication10_30 { for (org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationPayloadComponent(t)); for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_10_30.convertCodeableConcept(t)); if (src.hasStatus()) - tgt.setStatus(convertCommunicationStatus(src.getStatus())); + tgt.setStatusElement(convertCommunicationStatus(src.getStatusElement())); if (src.hasEncounter()) tgt.setContext(VersionConvertor_10_30.convertReference(src.getEncounter())); if (src.hasSentElement()) @@ -46,7 +46,7 @@ public class Communication10_30 { for (org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationPayloadComponent(t)); for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_10_30.convertCodeableConcept(t)); if (src.hasStatus()) - tgt.setStatus(convertCommunicationStatus(src.getStatus())); + tgt.setStatusElement(convertCommunicationStatus(src.getStatusElement())); if (src.hasContext()) tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getContext())); if (src.hasSentElement()) @@ -79,41 +79,59 @@ public class Communication10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.dstu2.model.Communication.CommunicationStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertCommunicationStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Communication.CommunicationStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case INPROGRESS: - return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.INPROGRESS; + tgt.setValue(org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.INPROGRESS); + break; case COMPLETED: - return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.COMPLETED); + break; case SUSPENDED: - return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.SUSPENDED; + tgt.setValue(org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.SUSPENDED); + break; case REJECTED: - return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ENTEREDINERROR); + break; case FAILED: - return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ABORTED; + tgt.setValue(org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ABORTED); + break; default: - return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.dstu3.model.Communication.CommunicationStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertCommunicationStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Communication.CommunicationStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case INPROGRESS: - return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.INPROGRESS; + tgt.setValue(org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.INPROGRESS); + break; case COMPLETED: - return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.COMPLETED); + break; case SUSPENDED: - return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.SUSPENDED; + tgt.setValue(org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.SUSPENDED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.REJECTED; + tgt.setValue(org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.REJECTED); + break; case ABORTED: - return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.FAILED; + tgt.setValue(org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.FAILED); + break; default: - return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/CommunicationRequest10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/CommunicationRequest10_30.java index 0910de9fc..57e8ca463 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/CommunicationRequest10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/CommunicationRequest10_30.java @@ -20,7 +20,7 @@ public class CommunicationRequest10_30 { for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_10_30.convertCodeableConcept(t)); tgt.setRequester(VersionConvertor_10_30.convertReference(src.getRequester().getAgent())); if (src.hasStatus()) - tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); + tgt.setStatusElement(convertCommunicationRequestStatus(src.getStatusElement())); if (src.hasContext()) tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getContext())); if (src.hasOccurrence()) @@ -50,7 +50,7 @@ public class CommunicationRequest10_30 { for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getMedium()) tgt.addMedium(VersionConvertor_10_30.convertCodeableConcept(t)); tgt.getRequester().setAgent(VersionConvertor_10_30.convertReference(src.getRequester())); if (src.hasStatus()) - tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); + tgt.setStatusElement(convertCommunicationRequestStatus(src.getStatusElement())); if (src.hasEncounter()) tgt.setContext(VersionConvertor_10_30.convertReference(src.getEncounter())); if (src.hasScheduled()) @@ -85,50 +85,72 @@ public class CommunicationRequest10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertCommunicationRequestStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PROPOSED: - return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.DRAFT; + tgt.setValue(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.DRAFT); + break; case PLANNED: - return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE); + break; case REQUESTED: - return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE); + break; case RECEIVED: - return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE); + break; case ACCEPTED: - return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE); + break; case INPROGRESS: - return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE); + break; case COMPLETED: - return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED); + break; case SUSPENDED: - return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.SUSPENDED; + tgt.setValue(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.SUSPENDED); + break; case REJECTED: - return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ENTEREDINERROR); + break; default: - return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertCommunicationRequestStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case DRAFT: - return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.PROPOSED; + tgt.setValue(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.PROPOSED); + break; case ACTIVE: - return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.INPROGRESS; + tgt.setValue(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.INPROGRESS); + break; case COMPLETED: - return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED); + break; case SUSPENDED: - return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.SUSPENDED; + tgt.setValue(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.SUSPENDED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.REJECTED; + tgt.setValue(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.REJECTED); + break; default: - return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.NULL); + break; } + return tgt; } static public org.hl7.fhir.dstu2.model.CodeableConcept convertPriorityCode(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority priority) { diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Composition10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Composition10_30.java index 812df54c1..26e544c52 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Composition10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Composition10_30.java @@ -3,6 +3,8 @@ package org.hl7.fhir.convertors.conv10_30; import org.hl7.fhir.convertors.VersionConvertor_10_30; import org.hl7.fhir.exceptions.FHIRException; +import java.util.stream.Collectors; + public class Composition10_30 { public static org.hl7.fhir.dstu3.model.Composition convertComposition(org.hl7.fhir.dstu2.model.Composition src) throws FHIRException { @@ -21,7 +23,7 @@ public class Composition10_30 { if (src.hasTitleElement()) tgt.setTitleElement(VersionConvertor_10_30.convertString(src.getTitleElement())); if (src.hasStatus()) - tgt.setStatus(convertCompositionStatus(src.getStatus())); + tgt.setStatusElement(convertCompositionStatus(src.getStatusElement())); try { if (src.hasConfidentiality()) tgt.setConfidentiality(org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.fromCode(src.getConfidentiality())); @@ -57,7 +59,7 @@ public class Composition10_30 { if (src.hasTitleElement()) tgt.setTitleElement(VersionConvertor_10_30.convertString(src.getTitleElement())); if (src.hasStatus()) - tgt.setStatus(convertCompositionStatus(src.getStatus())); + tgt.setStatusElement(convertCompositionStatus(src.getStatusElement())); tgt.setConfidentiality(src.getConfidentiality().toCode()); if (src.hasSubject()) tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); @@ -72,38 +74,54 @@ public class Composition10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertCompositionAttestationMode(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Composition.CompositionAttestationModeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PERSONAL: - return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PERSONAL; + tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PERSONAL); + break; case PROFESSIONAL: - return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PROFESSIONAL; + tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PROFESSIONAL); + break; case LEGAL: - return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.LEGAL; + tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.LEGAL); + break; case OFFICIAL: - return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.OFFICIAL; + tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.OFFICIAL); + break; default: - return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertCompositionAttestationMode(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Composition.CompositionAttestationModeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PERSONAL: - return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.PERSONAL; + tgt.setValue(org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.PERSONAL); + break; case PROFESSIONAL: - return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.PROFESSIONAL; + tgt.setValue(org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.PROFESSIONAL); + break; case LEGAL: - return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.LEGAL; + tgt.setValue(org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.LEGAL); + break; case OFFICIAL: - return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.OFFICIAL; + tgt.setValue(org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.OFFICIAL); + break; default: - return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent src) throws FHIRException { @@ -111,7 +129,9 @@ public class Composition10_30 { return null; org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent(); VersionConvertor_10_30.copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Enumeration t : src.getMode()) VersionConvertor_10_30.copyElement(t, tgt.addModeElement().setValue(convertCompositionAttestationMode(t.getValue()))); + tgt.setMode(src.getMode().stream() + .map(Composition10_30::convertCompositionAttestationMode) + .collect(Collectors.toList())); if (src.hasTimeElement()) tgt.setTimeElement(VersionConvertor_10_30.convertDateTime(src.getTimeElement())); if (src.hasParty()) @@ -124,7 +144,9 @@ public class Composition10_30 { return null; org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent(); VersionConvertor_10_30.copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getMode()) VersionConvertor_10_30.copyElement(t, tgt.addModeElement().setValue(convertCompositionAttestationMode(t.getValue()))); + tgt.setMode(src.getMode().stream() + .map(Composition10_30::convertCompositionAttestationMode) + .collect(Collectors.toList())); if (src.hasTimeElement()) tgt.setTimeElement(VersionConvertor_10_30.convertDateTime(src.getTimeElement())); if (src.hasParty()) @@ -156,38 +178,54 @@ public class Composition10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.dstu2.model.Composition.CompositionStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertCompositionStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Composition.CompositionStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PRELIMINARY: - return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.PRELIMINARY; + tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionStatus.PRELIMINARY); + break; case FINAL: - return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.FINAL; + tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionStatus.FINAL); + break; case AMENDED: - return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.AMENDED; + tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionStatus.AMENDED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionStatus.ENTEREDINERROR); + break; default: - return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.dstu3.model.Composition.CompositionStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertCompositionStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Composition.CompositionStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PRELIMINARY: - return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.PRELIMINARY; + tgt.setValue(org.hl7.fhir.dstu2.model.Composition.CompositionStatus.PRELIMINARY); + break; case FINAL: - return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.FINAL; + tgt.setValue(org.hl7.fhir.dstu2.model.Composition.CompositionStatus.FINAL); + break; case AMENDED: - return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.AMENDED; + tgt.setValue(org.hl7.fhir.dstu2.model.Composition.CompositionStatus.AMENDED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu2.model.Composition.CompositionStatus.ENTEREDINERROR); + break; default: - return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Composition.CompositionStatus.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu3.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.dstu2.model.Composition.SectionComponent src) throws FHIRException { diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ConceptMap10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ConceptMap10_30.java index 38668da5c..4d337a291 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ConceptMap10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ConceptMap10_30.java @@ -2,7 +2,6 @@ package org.hl7.fhir.convertors.conv10_30; import java.util.ArrayList; import java.util.List; - import org.hl7.fhir.convertors.VersionConvertor_10_30; import org.hl7.fhir.dstu3.model.ConceptMap; import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent; @@ -114,58 +113,84 @@ public class ConceptMap10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertConceptMapEquivalence(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalenceEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case EQUIVALENT: - return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUIVALENT); + break; case EQUAL: - return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUAL; + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUAL); + break; case WIDER: - return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.WIDER; + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.WIDER); + break; case SUBSUMES: - return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SUBSUMES); + break; case NARROWER: - return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NARROWER; + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NARROWER); + break; case SPECIALIZES: - return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SPECIALIZES); + break; case INEXACT: - return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.INEXACT; + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.INEXACT); + break; case UNMATCHED: - return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED); + break; case DISJOINT: - return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.DISJOINT; + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.DISJOINT); + break; default: - return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertConceptMapEquivalence(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalenceEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case EQUIVALENT: - return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.EQUIVALENT); + break; case EQUAL: - return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.EQUAL; + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.EQUAL); + break; case WIDER: - return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.WIDER; + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.WIDER); + break; case SUBSUMES: - return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.SUBSUMES); + break; case NARROWER: - return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.NARROWER; + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.NARROWER); + break; case SPECIALIZES: - return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.SPECIALIZES); + break; case INEXACT: - return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.INEXACT; + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.INEXACT); + break; case UNMATCHED: - return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.UNMATCHED); + break; case DISJOINT: - return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.DISJOINT; + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.DISJOINT); + break; default: - return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent src) throws FHIRException { @@ -231,7 +256,7 @@ public class ConceptMap10_30 { if (src.hasCodeElement()) tgt.setCodeElement(VersionConvertor_10_30.convertCode(src.getCodeElement())); if (src.hasEquivalence()) - tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + tgt.setEquivalenceElement(convertConceptMapEquivalence(src.getEquivalenceElement())); if (src.hasCommentElement()) tgt.setCommentsElement(VersionConvertor_10_30.convertString(src.getCommentElement())); for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t)); @@ -247,7 +272,7 @@ public class ConceptMap10_30 { if (src.hasCodeElement()) tgt.setCodeElement(VersionConvertor_10_30.convertCode(src.getCodeElement())); if (src.hasEquivalence()) - tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + tgt.setEquivalenceElement(convertConceptMapEquivalence(src.getEquivalenceElement())); if (src.hasCommentsElement()) tgt.setCommentElement(VersionConvertor_10_30.convertString(src.getCommentsElement())); for (org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t)); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Condition10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Condition10_30.java index 1756ae1d6..279922c11 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Condition10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Condition10_30.java @@ -30,7 +30,7 @@ public class Condition10_30 { throw new FHIRException(e); } if (src.hasVerificationStatus()) - tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); + tgt.setVerificationStatusElement(convertConditionVerificationStatus(src.getVerificationStatusElement())); if (src.hasSeverity()) tgt.setSeverity(VersionConvertor_10_30.convertCodeableConcept(src.getSeverity())); if (src.hasOnset()) @@ -63,7 +63,7 @@ public class Condition10_30 { for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(t)); tgt.setClinicalStatus(src.getClinicalStatus().toCode()); if (src.hasVerificationStatus()) - tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); + tgt.setVerificationStatusElement(convertConditionVerificationStatus(src.getVerificationStatusElement())); if (src.hasSeverity()) tgt.setSeverity(VersionConvertor_10_30.convertCodeableConcept(src.getSeverity())); if (src.hasOnset()) @@ -120,45 +120,65 @@ public class Condition10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertConditionVerificationStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PROVISIONAL: - return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.PROVISIONAL; + tgt.setValue(org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.PROVISIONAL); + break; case DIFFERENTIAL: - return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; + tgt.setValue(org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.DIFFERENTIAL); + break; case CONFIRMED: - return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.CONFIRMED; + tgt.setValue(org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.CONFIRMED); + break; case REFUTED: - return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.REFUTED; + tgt.setValue(org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.REFUTED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.ENTEREDINERROR); + break; case UNKNOWN: - return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.UNKNOWN; + tgt.setValue(org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.UNKNOWN); + break; default: - return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertConditionVerificationStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PROVISIONAL: - return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.PROVISIONAL; + tgt.setValue(org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.PROVISIONAL); + break; case DIFFERENTIAL: - return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; + tgt.setValue(org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.DIFFERENTIAL); + break; case CONFIRMED: - return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.CONFIRMED; + tgt.setValue(org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.CONFIRMED); + break; case REFUTED: - return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.REFUTED; + tgt.setValue(org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.REFUTED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.ENTEREDINERROR); + break; case UNKNOWN: - return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.UNKNOWN; + tgt.setValue(org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.UNKNOWN); + break; default: - return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Conformance10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Conformance10_30.java index 2aea69cd6..f443323bc 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Conformance10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Conformance10_30.java @@ -6,34 +6,48 @@ import org.hl7.fhir.exceptions.FHIRException; public class Conformance10_30 { - public static org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertConditionalDeleteStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case NOTSUPPORTED: - return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED); + break; case SINGLE: - return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.SINGLE; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.SINGLE); + break; case MULTIPLE: - return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.MULTIPLE; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.MULTIPLE); + break; default: - return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertConditionalDeleteStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case NOTSUPPORTED: - return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED); + break; case SINGLE: - return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE); + break; case MULTIPLE: - return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE); + break; default: - return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu2.model.Conformance convertConformance(org.hl7.fhir.dstu3.model.CapabilityStatement src) throws FHIRException { @@ -63,7 +77,7 @@ public class Conformance10_30 { if (src.hasCopyright()) tgt.setCopyright(src.getCopyright()); if (src.hasKind()) - tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setKindElement(convertConformanceStatementKind(src.getKindElement())); if (src.hasSoftware()) tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); if (src.hasImplementation()) @@ -71,7 +85,7 @@ public class Conformance10_30 { if (src.hasFhirVersionElement()) tgt.setFhirVersionElement(VersionConvertor_10_30.convertId(src.getFhirVersionElement())); if (src.hasAcceptUnknown()) - tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); + tgt.setAcceptUnknownElement(convertUnknownContentCode(src.getAcceptUnknownElement())); for (org.hl7.fhir.dstu3.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) tgt.addProfile(VersionConvertor_10_30.convertReference(t)); for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) tgt.addRest(convertConformanceRestComponent(t)); @@ -107,7 +121,7 @@ public class Conformance10_30 { if (src.hasCopyright()) tgt.setCopyright(src.getCopyright()); if (src.hasKind()) - tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setKindElement(convertConformanceStatementKind(src.getKindElement())); if (src.hasSoftware()) tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); if (src.hasImplementation()) @@ -115,7 +129,7 @@ public class Conformance10_30 { if (src.hasFhirVersionElement()) tgt.setFhirVersionElement(VersionConvertor_10_30.convertId(src.getFhirVersionElement())); if (src.hasAcceptUnknown()) - tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); + tgt.setAcceptUnknownElement(convertUnknownContentCode(src.getAcceptUnknownElement())); for (org.hl7.fhir.dstu2.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); for (org.hl7.fhir.dstu2.model.Reference t : src.getProfile()) tgt.addProfile(VersionConvertor_10_30.convertReference(t)); for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent t : src.getRest()) tgt.addRest(convertConformanceRestComponent(t)); @@ -152,7 +166,7 @@ public class Conformance10_30 { org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasMode()) - tgt.setMode(convertDocumentMode(src.getMode())); + tgt.setModeElement(convertDocumentMode(src.getModeElement())); if (src.hasDocumentationElement()) tgt.setDocumentationElement(VersionConvertor_10_30.convertString(src.getDocumentationElement())); if (src.hasProfile()) @@ -166,7 +180,7 @@ public class Conformance10_30 { org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasMode()) - tgt.setMode(convertDocumentMode(src.getMode())); + tgt.setModeElement(convertDocumentMode(src.getModeElement())); if (src.hasDocumentationElement()) tgt.setDocumentationElement(VersionConvertor_10_30.convertString(src.getDocumentationElement())); if (src.hasProfile()) @@ -174,30 +188,42 @@ public class Conformance10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertConformanceEventMode(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.ConformanceEventModeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case SENDER: - return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.SENDER; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.SENDER); + break; case RECEIVER: - return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.RECEIVER; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.RECEIVER); + break; default: - return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertConformanceEventMode(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityModeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case SENDER: - return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.SENDER; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.SENDER); + break; case RECEIVER: - return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.RECEIVER); + break; default: - return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { @@ -284,9 +310,9 @@ public class Conformance10_30 { if (src.hasCode()) tgt.setCode(VersionConvertor_10_30.convertCoding(src.getCode())); if (src.hasCategory()) - tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); + tgt.setCategoryElement(convertMessageSignificanceCategory(src.getCategoryElement())); if (src.hasMode()) - tgt.setMode(convertConformanceEventMode(src.getMode())); + tgt.setModeElement(convertConformanceEventMode(src.getModeElement())); if (src.hasFocusElement()) tgt.setFocusElement(VersionConvertor_10_30.convertCode(src.getFocusElement())); if (src.hasRequest()) @@ -306,9 +332,9 @@ public class Conformance10_30 { if (src.hasCode()) tgt.setCode(VersionConvertor_10_30.convertCoding(src.getCode())); if (src.hasCategory()) - tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); + tgt.setCategoryElement(convertMessageSignificanceCategory(src.getCategoryElement())); if (src.hasMode()) - tgt.setMode(convertConformanceEventMode(src.getMode())); + tgt.setModeElement(convertConformanceEventMode(src.getModeElement())); if (src.hasFocusElement()) tgt.setFocusElement(VersionConvertor_10_30.convertCode(src.getFocusElement())); if (src.hasRequest()) @@ -326,7 +352,7 @@ public class Conformance10_30 { org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasMode()) - tgt.setMode(convertRestfulConformanceMode(src.getMode())); + tgt.setModeElement(convertRestfulConformanceMode(src.getModeElement())); if (src.hasDocumentationElement()) tgt.setDocumentationElement(VersionConvertor_10_30.convertString(src.getDocumentationElement())); if (src.hasSecurity()) @@ -347,7 +373,7 @@ public class Conformance10_30 { org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasMode()) - tgt.setMode(convertRestfulConformanceMode(src.getMode())); + tgt.setModeElement(convertRestfulConformanceMode(src.getModeElement())); if (src.hasDocumentationElement()) tgt.setDocumentationElement(VersionConvertor_10_30.convertString(src.getDocumentationElement())); if (src.hasSecurity()) @@ -408,7 +434,7 @@ public class Conformance10_30 { tgt.setProfile(VersionConvertor_10_30.convertReference(src.getProfile())); for (org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertResourceInteractionComponent(t)); if (src.hasVersioning()) - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + tgt.setVersioningElement(convertResourceVersionPolicy(src.getVersioningElement())); if (src.hasReadHistoryElement()) tgt.setReadHistoryElement(VersionConvertor_10_30.convertBoolean(src.getReadHistoryElement())); if (src.hasUpdateCreateElement()) @@ -418,7 +444,7 @@ public class Conformance10_30 { if (src.hasConditionalUpdateElement()) tgt.setConditionalUpdateElement(VersionConvertor_10_30.convertBoolean(src.getConditionalUpdateElement())); if (src.hasConditionalDelete()) - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + tgt.setConditionalDeleteElement(convertConditionalDeleteStatus(src.getConditionalDeleteElement())); for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); @@ -436,7 +462,7 @@ public class Conformance10_30 { tgt.setProfile(VersionConvertor_10_30.convertReference(src.getProfile())); for (org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) tgt.addInteraction(convertResourceInteractionComponent(t)); if (src.hasVersioning()) - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + tgt.setVersioningElement(convertResourceVersionPolicy(src.getVersioningElement())); if (src.hasReadHistoryElement()) tgt.setReadHistoryElement(VersionConvertor_10_30.convertBoolean(src.getReadHistoryElement())); if (src.hasUpdateCreateElement()) @@ -446,7 +472,7 @@ public class Conformance10_30 { if (src.hasConditionalUpdateElement()) tgt.setConditionalUpdateElement(VersionConvertor_10_30.convertBoolean(src.getConditionalUpdateElement())); if (src.hasConditionalDelete()) - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + tgt.setConditionalDeleteElement(convertConditionalDeleteStatus(src.getConditionalDeleteElement())); for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); @@ -565,90 +591,130 @@ public class Conformance10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertConformanceStatementKind(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKindEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case INSTANCE: - return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.INSTANCE); + break; case CAPABILITY: - return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY); + break; case REQUIREMENTS: - return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS); + break; default: - return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertConformanceStatementKind(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKindEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case INSTANCE: - return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.INSTANCE; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.INSTANCE); + break; case CAPABILITY: - return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.CAPABILITY; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.CAPABILITY); + break; case REQUIREMENTS: - return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.REQUIREMENTS; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.REQUIREMENTS); + break; default: - return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu2.model.Conformance.DocumentMode src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertDocumentMode(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentModeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PRODUCER: - return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.PRODUCER; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.PRODUCER); + break; case CONSUMER: - return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.CONSUMER; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.CONSUMER); + break; default: - return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertDocumentMode(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.DocumentModeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PRODUCER: - return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.PRODUCER; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.DocumentMode.PRODUCER); + break; case CONSUMER: - return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.CONSUMER; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.DocumentMode.CONSUMER); + break; default: - return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.DocumentMode.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertMessageSignificanceCategory(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategoryEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case CONSEQUENCE: - return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CONSEQUENCE; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CONSEQUENCE); + break; case CURRENCY: - return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CURRENCY; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CURRENCY); + break; case NOTIFICATION: - return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NOTIFICATION; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NOTIFICATION); + break; default: - return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertMessageSignificanceCategory(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategoryEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case CONSEQUENCE: - return org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.CONSEQUENCE; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.CONSEQUENCE); + break; case CURRENCY: - return org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.CURRENCY; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.CURRENCY); + break; case NOTIFICATION: - return org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.NOTIFICATION; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.NOTIFICATION); + break; default: - return org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent src) throws FHIRException { @@ -657,7 +723,7 @@ public class Conformance10_30 { org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasCode()) - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + tgt.setCodeElement(convertTypeRestfulInteraction(src.getCodeElement())); if (src.hasDocumentationElement()) tgt.setDocumentationElement(VersionConvertor_10_30.convertString(src.getDocumentationElement())); return tgt; @@ -669,66 +735,92 @@ public class Conformance10_30 { org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasCode()) - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + tgt.setCodeElement(convertTypeRestfulInteraction(src.getCodeElement())); if (src.hasDocumentationElement()) tgt.setDocumentationElement(VersionConvertor_10_30.convertString(src.getDocumentationElement())); return tgt; } - public static org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertResourceVersionPolicy(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicyEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case NOVERSION: - return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NOVERSION; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NOVERSION); + break; case VERSIONED: - return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONED; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONED); + break; case VERSIONEDUPDATE: - return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE); + break; default: - return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertResourceVersionPolicy(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicyEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case NOVERSION: - return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION); + break; case VERSIONED: - return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED); + break; case VERSIONEDUPDATE: - return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE); + break; default: - return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertRestfulConformanceMode(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceModeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case CLIENT: - return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.CLIENT; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.CLIENT); + break; case SERVER: - return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.SERVER; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.SERVER); + break; default: - return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertRestfulConformanceMode(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityModeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case CLIENT: - return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.CLIENT); + break; case SERVER: - return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.SERVER; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.SERVER); + break; default: - return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { @@ -737,7 +829,7 @@ public class Conformance10_30 { org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasCode()) - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + tgt.setCodeElement(convertSystemRestfulInteraction(src.getCodeElement())); if (src.hasDocumentationElement()) tgt.setDocumentationElement(VersionConvertor_10_30.convertString(src.getDocumentationElement())); return tgt; @@ -749,123 +841,177 @@ public class Conformance10_30 { org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasCode()) - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + tgt.setCodeElement(convertSystemRestfulInteraction(src.getCodeElement())); if (src.hasDocumentationElement()) tgt.setDocumentationElement(VersionConvertor_10_30.convertString(src.getDocumentationElement())); return tgt; } - public static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertSystemRestfulInteraction(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteractionEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case TRANSACTION: - return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION); + break; case SEARCHSYSTEM: - return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM); + break; case HISTORYSYSTEM: - return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM); + break; default: - return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertSystemRestfulInteraction(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteractionEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case TRANSACTION: - return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.TRANSACTION; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.TRANSACTION); + break; case SEARCHSYSTEM: - return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM); + break; case HISTORYSYSTEM: - return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM); + break; default: - return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertTypeRestfulInteraction(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteractionEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case READ: - return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.READ; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.READ); + break; case VREAD: - return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.VREAD); + break; case UPDATE: - return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.UPDATE); + break; case DELETE: - return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.DELETE); + break; case HISTORYINSTANCE: - return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE); + break; case HISTORYTYPE: - return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE); + break; case CREATE: - return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.CREATE); + break; case SEARCHTYPE: - return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE); + break; default: - return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertTypeRestfulInteraction(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteractionEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case READ: - return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.READ; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.READ); + break; case VREAD: - return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.VREAD; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.VREAD); + break; case UPDATE: - return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.UPDATE; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.UPDATE); + break; case DELETE: - return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.DELETE; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.DELETE); + break; case HISTORYINSTANCE: - return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE); + break; case HISTORYTYPE: - return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYTYPE); + break; case CREATE: - return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.CREATE; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.CREATE); + break; case SEARCHTYPE: - return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.SEARCHTYPE); + break; default: - return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertUnknownContentCode(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCodeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case NO: - return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NO; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NO); + break; case EXTENSIONS: - return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.EXTENSIONS); + break; case ELEMENTS: - return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.ELEMENTS; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.ELEMENTS); + break; case BOTH: - return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.BOTH; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.BOTH); + break; default: - return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertUnknownContentCode(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.UnknownContentCodeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case NO: - return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.NO; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.NO); + break; case EXTENSIONS: - return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.EXTENSIONS; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.EXTENSIONS); + break; case ELEMENTS: - return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.ELEMENTS; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.ELEMENTS); + break; case BOTH: - return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.BOTH; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.BOTH); + break; default: - return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DataElement10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DataElement10_30.java index 5b08d83ac..16296ed65 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DataElement10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DataElement10_30.java @@ -2,7 +2,6 @@ package org.hl7.fhir.convertors.conv10_30; import java.util.ArrayList; import java.util.List; - import org.hl7.fhir.convertors.VersionConvertor_10_30; import org.hl7.fhir.exceptions.FHIRException; @@ -35,7 +34,7 @@ public class DataElement10_30 { if (src.hasCopyright()) tgt.setCopyright(src.getCopyright()); if (src.hasStringency()) - tgt.setStringency(convertDataElementStringency(src.getStringency())); + tgt.setStringencyElement(convertDataElementStringency(src.getStringencyElement())); for (org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent t : src.getMapping()) tgt.addMapping(convertDataElementMappingComponent(t)); for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) tgt.addElement(VersionConvertor_10_30.convertElementDefinition(t)); return tgt; @@ -69,7 +68,7 @@ public class DataElement10_30 { if (src.hasCopyright()) tgt.setCopyright(src.getCopyright()); if (src.hasStringency()) - tgt.setStringency(convertDataElementStringency(src.getStringency())); + tgt.setStringencyElement(convertDataElementStringency(src.getStringencyElement())); for (org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent t : src.getMapping()) tgt.addMapping(convertDataElementMappingComponent(t)); List slicePaths = new ArrayList(); for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { @@ -134,45 +133,65 @@ public class DataElement10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertDataElementStringency(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.DataElement.DataElementStringencyEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case COMPARABLE: - return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.COMPARABLE; + tgt.setValue(org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.COMPARABLE); + break; case FULLYSPECIFIED: - return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.FULLYSPECIFIED; + tgt.setValue(org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.FULLYSPECIFIED); + break; case EQUIVALENT: - return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.EQUIVALENT; + tgt.setValue(org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.EQUIVALENT); + break; case CONVERTABLE: - return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.CONVERTABLE; + tgt.setValue(org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.CONVERTABLE); + break; case SCALEABLE: - return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.SCALEABLE; + tgt.setValue(org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.SCALEABLE); + break; case FLEXIBLE: - return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.FLEXIBLE; + tgt.setValue(org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.FLEXIBLE); + break; default: - return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu2.model.DataElement.DataElementStringency src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertDataElementStringency(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.DataElement.DataElementStringencyEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case COMPARABLE: - return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.COMPARABLE; + tgt.setValue(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.COMPARABLE); + break; case FULLYSPECIFIED: - return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FULLYSPECIFIED; + tgt.setValue(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FULLYSPECIFIED); + break; case EQUIVALENT: - return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.EQUIVALENT; + tgt.setValue(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.EQUIVALENT); + break; case CONVERTABLE: - return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.CONVERTABLE; + tgt.setValue(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.CONVERTABLE); + break; case SCALEABLE: - return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.SCALEABLE; + tgt.setValue(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.SCALEABLE); + break; case FLEXIBLE: - return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FLEXIBLE; + tgt.setValue(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FLEXIBLE); + break; default: - return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DetectedIssue10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DetectedIssue10_30.java index 3b1f11b0b..df5fa7a63 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DetectedIssue10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DetectedIssue10_30.java @@ -15,7 +15,7 @@ public class DetectedIssue10_30 { if (src.hasCategory()) tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); if (src.hasSeverity()) - tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + tgt.setSeverityElement(convertDetectedIssueSeverity(src.getSeverityElement())); for (org.hl7.fhir.dstu3.model.Reference t : src.getImplicated()) tgt.addImplicated(VersionConvertor_10_30.convertReference(t)); if (src.hasDetailElement()) tgt.setDetailElement(VersionConvertor_10_30.convertString(src.getDetailElement())); @@ -41,7 +41,7 @@ public class DetectedIssue10_30 { if (src.hasCategory()) tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); if (src.hasSeverity()) - tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + tgt.setSeverityElement(convertDetectedIssueSeverity(src.getSeverityElement())); for (org.hl7.fhir.dstu2.model.Reference t : src.getImplicated()) tgt.addImplicated(VersionConvertor_10_30.convertReference(t)); if (src.hasDetailElement()) tgt.setDetailElement(VersionConvertor_10_30.convertString(src.getDetailElement())); @@ -85,33 +85,47 @@ public class DetectedIssue10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertDetectedIssueSeverity(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverityEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case HIGH: - return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.HIGH; + tgt.setValue(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.HIGH); + break; case MODERATE: - return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + tgt.setValue(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.MODERATE); + break; case LOW: - return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.LOW; + tgt.setValue(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.LOW); + break; default: - return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertDetectedIssueSeverity(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverityEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case HIGH: - return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.HIGH; + tgt.setValue(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.HIGH); + break; case MODERATE: - return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + tgt.setValue(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.MODERATE); + break; case LOW: - return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.LOW; + tgt.setValue(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.LOW); + break; default: - return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Device10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Device10_30.java index 66d676c24..0fca3a967 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Device10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Device10_30.java @@ -14,7 +14,7 @@ public class Device10_30 { if (src.hasUdi()) tgt.setUdi(src.getUdi().getDeviceIdentifier()); if (src.hasStatus()) - tgt.setStatus(convertDeviceStatus(src.getStatus())); + tgt.setStatusElement(convertDeviceStatus(src.getStatusElement())); if (src.hasType()) tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); if (src.hasLotNumberElement()) @@ -51,7 +51,7 @@ public class Device10_30 { if (src.hasUdi()) tgt.setUdi((new org.hl7.fhir.dstu3.model.Device.DeviceUdiComponent()).setDeviceIdentifier(src.getUdi())); if (src.hasStatus()) - tgt.setStatus(convertDeviceStatus(src.getStatus())); + tgt.setStatusElement(convertDeviceStatus(src.getStatusElement())); if (src.hasType()) tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); if (src.hasLotNumberElement()) @@ -79,33 +79,47 @@ public class Device10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus convertDeviceStatus(org.hl7.fhir.dstu2.model.Device.DeviceStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertDeviceStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case AVAILABLE: - return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ACTIVE); + break; case NOTAVAILABLE: - return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.INACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.INACTIVE); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ENTEREDINERROR); + break; default: - return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Device.DeviceStatus convertDeviceStatus(org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertDeviceStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Device.DeviceStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ACTIVE: - return org.hl7.fhir.dstu2.model.Device.DeviceStatus.AVAILABLE; + tgt.setValue(org.hl7.fhir.dstu2.model.Device.DeviceStatus.AVAILABLE); + break; case INACTIVE: - return org.hl7.fhir.dstu2.model.Device.DeviceStatus.NOTAVAILABLE; + tgt.setValue(org.hl7.fhir.dstu2.model.Device.DeviceStatus.NOTAVAILABLE); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu2.model.Device.DeviceStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu2.model.Device.DeviceStatus.ENTEREDINERROR); + break; default: - return org.hl7.fhir.dstu2.model.Device.DeviceStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Device.DeviceStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DeviceComponent10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DeviceComponent10_30.java index 9029adca4..86df92603 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DeviceComponent10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DeviceComponent10_30.java @@ -24,7 +24,7 @@ public class DeviceComponent10_30 { if (src.hasParameterGroup()) tgt.setParameterGroup(VersionConvertor_10_30.convertCodeableConcept(src.getParameterGroup())); if (src.hasMeasurementPrinciple()) - tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); + tgt.setMeasurementPrincipleElement(convertMeasmntPrinciple(src.getMeasurementPrincipleElement())); for (org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); if (src.hasLanguageCode()) tgt.setLanguageCode(VersionConvertor_10_30.convertCodeableConcept(src.getLanguageCode())); @@ -50,7 +50,7 @@ public class DeviceComponent10_30 { if (src.hasParameterGroup()) tgt.setParameterGroup(VersionConvertor_10_30.convertCodeableConcept(src.getParameterGroup())); if (src.hasMeasurementPrinciple()) - tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); + tgt.setMeasurementPrincipleElement(convertMeasmntPrinciple(src.getMeasurementPrincipleElement())); for (org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); if (src.hasLanguageCode()) tgt.setLanguageCode(VersionConvertor_10_30.convertCodeableConcept(src.getLanguageCode())); @@ -85,65 +85,95 @@ public class DeviceComponent10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertMeasmntPrinciple(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrincipleEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case OTHER: - return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OTHER; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OTHER); + break; case CHEMICAL: - return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.CHEMICAL); + break; case ELECTRICAL: - return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL); + break; case IMPEDANCE: - return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE); + break; case NUCLEAR: - return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NUCLEAR); + break; case OPTICAL: - return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OPTICAL; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OPTICAL); + break; case THERMAL: - return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.THERMAL; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.THERMAL); + break; case BIOLOGICAL: - return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL); + break; case MECHANICAL: - return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MECHANICAL); + break; case ACOUSTICAL: - return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL); + break; case MANUAL: - return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MANUAL; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MANUAL); + break; default: - return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertMeasmntPrinciple(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrincipleEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case OTHER: - return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.OTHER; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.OTHER); + break; case CHEMICAL: - return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.CHEMICAL); + break; case ELECTRICAL: - return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL); + break; case IMPEDANCE: - return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE); + break; case NUCLEAR: - return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.NUCLEAR); + break; case OPTICAL: - return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.OPTICAL; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.OPTICAL); + break; case THERMAL: - return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.THERMAL; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.THERMAL); + break; case BIOLOGICAL: - return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL); + break; case MECHANICAL: - return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.MECHANICAL); + break; case ACOUSTICAL: - return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL); + break; case MANUAL: - return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.MANUAL; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.MANUAL); + break; default: - return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DeviceMetric10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DeviceMetric10_30.java index 833adf92f..dd47fbde4 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DeviceMetric10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DeviceMetric10_30.java @@ -21,11 +21,11 @@ public class DeviceMetric10_30 { if (src.hasParent()) tgt.setParent(VersionConvertor_10_30.convertReference(src.getParent())); if (src.hasOperationalStatus()) - tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); + tgt.setOperationalStatusElement(convertDeviceMetricOperationalStatus(src.getOperationalStatusElement())); if (src.hasColor()) - tgt.setColor(convertDeviceMetricColor(src.getColor())); + tgt.setColorElement(convertDeviceMetricColor(src.getColorElement())); if (src.hasCategory()) - tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); + tgt.setCategoryElement(convertDeviceMetricCategory(src.getCategoryElement())); if (src.hasMeasurementPeriod()) tgt.setMeasurementPeriod(VersionConvertor_10_30.convertTiming(src.getMeasurementPeriod())); for (org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); @@ -48,11 +48,11 @@ public class DeviceMetric10_30 { if (src.hasParent()) tgt.setParent(VersionConvertor_10_30.convertReference(src.getParent())); if (src.hasOperationalStatus()) - tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); + tgt.setOperationalStatusElement(convertDeviceMetricOperationalStatus(src.getOperationalStatusElement())); if (src.hasColor()) - tgt.setColor(convertDeviceMetricColor(src.getColor())); + tgt.setColorElement(convertDeviceMetricColor(src.getColorElement())); if (src.hasCategory()) - tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); + tgt.setCategoryElement(convertDeviceMetricCategory(src.getCategoryElement())); if (src.hasMeasurementPeriod()) tgt.setMeasurementPeriod(VersionConvertor_10_30.convertTiming(src.getMeasurementPeriod())); for (org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); @@ -65,9 +65,9 @@ public class DeviceMetric10_30 { org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasType()) - tgt.setType(convertDeviceMetricCalibrationType(src.getType())); + tgt.setTypeElement(convertDeviceMetricCalibrationType(src.getTypeElement())); if (src.hasState()) - tgt.setState(convertDeviceMetricCalibrationState(src.getState())); + tgt.setStateElement(convertDeviceMetricCalibrationState(src.getStateElement())); if (src.hasTimeElement()) tgt.setTimeElement(VersionConvertor_10_30.convertInstant(src.getTimeElement())); return tgt; @@ -79,193 +79,279 @@ public class DeviceMetric10_30 { org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasType()) - tgt.setType(convertDeviceMetricCalibrationType(src.getType())); + tgt.setTypeElement(convertDeviceMetricCalibrationType(src.getTypeElement())); if (src.hasState()) - tgt.setState(convertDeviceMetricCalibrationState(src.getState())); + tgt.setStateElement(convertDeviceMetricCalibrationState(src.getStateElement())); if (src.hasTimeElement()) tgt.setTimeElement(VersionConvertor_10_30.convertInstant(src.getTimeElement())); return tgt; } - public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertDeviceMetricCalibrationState(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationStateEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case NOTCALIBRATED: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED); + break; case CALIBRATIONREQUIRED: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED); + break; case CALIBRATED: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED); + break; case UNSPECIFIED: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED); + break; default: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertDeviceMetricCalibrationState(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationStateEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case NOTCALIBRATED: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED); + break; case CALIBRATIONREQUIRED: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED); + break; case CALIBRATED: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED); + break; case UNSPECIFIED: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED); + break; default: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertDeviceMetricCalibrationType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case UNSPECIFIED: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED); + break; case OFFSET: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET); + break; case GAIN: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.GAIN); + break; case TWOPOINT: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT); + break; default: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertDeviceMetricCalibrationType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case UNSPECIFIED: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED); + break; case OFFSET: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET); + break; case GAIN: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.GAIN); + break; case TWOPOINT: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT); + break; default: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertDeviceMetricCategory(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategoryEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case MEASUREMENT: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT); + break; case SETTING: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.SETTING; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.SETTING); + break; case CALCULATION: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.CALCULATION; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.CALCULATION); + break; case UNSPECIFIED: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED); + break; default: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertDeviceMetricCategory(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategoryEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case MEASUREMENT: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT); + break; case SETTING: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.SETTING; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.SETTING); + break; case CALCULATION: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.CALCULATION; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.CALCULATION); + break; case UNSPECIFIED: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED); + break; default: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertDeviceMetricColor(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColorEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case BLACK: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.BLACK; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.BLACK); + break; case RED: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.RED; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.RED); + break; case GREEN: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.GREEN; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.GREEN); + break; case YELLOW: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.YELLOW; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.YELLOW); + break; case BLUE: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.BLUE; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.BLUE); + break; case MAGENTA: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.MAGENTA; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.MAGENTA); + break; case CYAN: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.CYAN; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.CYAN); + break; case WHITE: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.WHITE; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.WHITE); + break; default: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertDeviceMetricColor(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColorEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case BLACK: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.BLACK; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.BLACK); + break; case RED: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.RED; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.RED); + break; case GREEN: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.GREEN; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.GREEN); + break; case YELLOW: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.YELLOW; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.YELLOW); + break; case BLUE: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.BLUE; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.BLUE); + break; case MAGENTA: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.MAGENTA; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.MAGENTA); + break; case CYAN: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.CYAN; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.CYAN); + break; case WHITE: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.WHITE; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.WHITE); + break; default: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertDeviceMetricOperationalStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ON: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.ON; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.ON); + break; case OFF: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.OFF); + break; case STANDBY: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY); + break; default: - return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertDeviceMetricOperationalStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ON: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.ON; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.ON); + break; case OFF: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.OFF); + break; case STANDBY: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY); + break; default: - return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DiagnosticReport10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DiagnosticReport10_30.java index d1a66bd87..a6008bd3d 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DiagnosticReport10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DiagnosticReport10_30.java @@ -12,7 +12,7 @@ public class DiagnosticReport10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasStatus()) - tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + tgt.setStatusElement(convertDiagnosticReportStatus(src.getStatusElement())); if (src.hasCategory()) tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); if (src.hasCode()) @@ -44,7 +44,7 @@ public class DiagnosticReport10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasStatus()) - tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + tgt.setStatusElement(convertDiagnosticReportStatus(src.getStatusElement())); if (src.hasCategory()) tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); if (src.hasCode()) @@ -93,49 +93,71 @@ public class DiagnosticReport10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertDiagnosticReportStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case REGISTERED: - return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + tgt.setValue(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED); + break; case PARTIAL: - return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + tgt.setValue(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL); + break; case FINAL: - return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + tgt.setValue(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.FINAL); + break; case CORRECTED: - return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + tgt.setValue(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED); + break; case APPENDED: - return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + tgt.setValue(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.APPENDED); + break; case CANCELLED: - return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + tgt.setValue(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR); + break; default: - return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertDiagnosticReportStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case REGISTERED: - return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + tgt.setValue(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED); + break; case PARTIAL: - return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + tgt.setValue(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL); + break; case FINAL: - return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + tgt.setValue(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.FINAL); + break; case CORRECTED: - return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + tgt.setValue(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED); + break; case APPENDED: - return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + tgt.setValue(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.APPENDED); + break; case CANCELLED: - return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + tgt.setValue(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR); + break; default: - return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DocumentReference10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DocumentReference10_30.java index c7efb82ee..81193eb49 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DocumentReference10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/DocumentReference10_30.java @@ -207,7 +207,7 @@ public class DocumentReference10_30 { org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasCode()) - tgt.setCode(convertDocumentRelationshipType(src.getCode())); + tgt.setCodeElement(convertDocumentRelationshipType(src.getCodeElement())); if (src.hasTarget()) tgt.setTarget(VersionConvertor_10_30.convertReference(src.getTarget())); return tgt; @@ -219,43 +219,59 @@ public class DocumentReference10_30 { org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasCode()) - tgt.setCode(convertDocumentRelationshipType(src.getCode())); + tgt.setCodeElement(convertDocumentRelationshipType(src.getCodeElement())); if (src.hasTarget()) tgt.setTarget(VersionConvertor_10_30.convertReference(src.getTarget())); return tgt; } - public static org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertDocumentRelationshipType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case REPLACES: - return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.REPLACES; + tgt.setValue(org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.REPLACES); + break; case TRANSFORMS: - return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + tgt.setValue(org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.TRANSFORMS); + break; case SIGNS: - return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.SIGNS; + tgt.setValue(org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.SIGNS); + break; case APPENDS: - return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.APPENDS; + tgt.setValue(org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.APPENDS); + break; default: - return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertDocumentRelationshipType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case REPLACES: - return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.REPLACES; + tgt.setValue(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.REPLACES); + break; case TRANSFORMS: - return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + tgt.setValue(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.TRANSFORMS); + break; case SIGNS: - return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.SIGNS; + tgt.setValue(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.SIGNS); + break; case APPENDS: - return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.APPENDS; + tgt.setValue(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.APPENDS); + break; default: - return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Encounter10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Encounter10_30.java index 4672b965e..3afe06d42 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Encounter10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Encounter10_30.java @@ -12,7 +12,7 @@ public class Encounter10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasStatus()) - tgt.setStatus(convertEncounterState(src.getStatus())); + tgt.setStatusElement(convertEncounterState(src.getStatusElement())); if (src.hasClass_()) tgt.setClass_(convertEncounterClass(src.getClass_())); for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_30.convertCodeableConcept(t)); @@ -47,7 +47,7 @@ public class Encounter10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasStatus()) - tgt.setStatus(convertEncounterState(src.getStatus())); + tgt.setStatusElement(convertEncounterState(src.getStatusElement())); if (src.hasClass_()) tgt.setClass_(convertEncounterClass(src.getClass_())); for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_30.convertCodeableConcept(t)); @@ -176,7 +176,7 @@ public class Encounter10_30 { if (src.hasLocation()) tgt.setLocation(VersionConvertor_10_30.convertReference(src.getLocation())); if (src.hasStatus()) - tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + tgt.setStatusElement(convertEncounterLocationStatus(src.getStatusElement())); if (src.hasPeriod()) tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); return tgt; @@ -190,44 +190,60 @@ public class Encounter10_30 { if (src.hasLocation()) tgt.setLocation(VersionConvertor_10_30.convertReference(src.getLocation())); if (src.hasStatus()) - tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + tgt.setStatusElement(convertEncounterLocationStatus(src.getStatusElement())); if (src.hasPeriod()) tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); return tgt; } - public static org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertEncounterLocationStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PLANNED: - return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.PLANNED; + tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.PLANNED); + break; case ACTIVE: - return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.ACTIVE); + break; case RESERVED: - return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.RESERVED; + tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.RESERVED); + break; case COMPLETED: - return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.COMPLETED); + break; default: - return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertEncounterLocationStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PLANNED: - return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.PLANNED; + tgt.setValue(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.PLANNED); + break; case ACTIVE: - return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.ACTIVE); + break; case RESERVED: - return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.RESERVED; + tgt.setValue(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.RESERVED); + break; case COMPLETED: - return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.COMPLETED); + break; default: - return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent src) throws FHIRException { @@ -256,45 +272,65 @@ public class Encounter10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.Encounter.EncounterState convertEncounterState(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertEncounterState(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Encounter.EncounterStateEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PLANNED: - return org.hl7.fhir.dstu2.model.Encounter.EncounterState.PLANNED; + tgt.setValue(org.hl7.fhir.dstu2.model.Encounter.EncounterState.PLANNED); + break; case ARRIVED: - return org.hl7.fhir.dstu2.model.Encounter.EncounterState.ARRIVED; + tgt.setValue(org.hl7.fhir.dstu2.model.Encounter.EncounterState.ARRIVED); + break; case INPROGRESS: - return org.hl7.fhir.dstu2.model.Encounter.EncounterState.INPROGRESS; + tgt.setValue(org.hl7.fhir.dstu2.model.Encounter.EncounterState.INPROGRESS); + break; case ONLEAVE: - return org.hl7.fhir.dstu2.model.Encounter.EncounterState.ONLEAVE; + tgt.setValue(org.hl7.fhir.dstu2.model.Encounter.EncounterState.ONLEAVE); + break; case FINISHED: - return org.hl7.fhir.dstu2.model.Encounter.EncounterState.FINISHED; + tgt.setValue(org.hl7.fhir.dstu2.model.Encounter.EncounterState.FINISHED); + break; case CANCELLED: - return org.hl7.fhir.dstu2.model.Encounter.EncounterState.CANCELLED; + tgt.setValue(org.hl7.fhir.dstu2.model.Encounter.EncounterState.CANCELLED); + break; default: - return org.hl7.fhir.dstu2.model.Encounter.EncounterState.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Encounter.EncounterState.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.Encounter.EncounterStatus convertEncounterState(org.hl7.fhir.dstu2.model.Encounter.EncounterState src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertEncounterState(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Encounter.EncounterStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PLANNED: - return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.PLANNED; + tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.PLANNED); + break; case ARRIVED: - return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ARRIVED; + tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ARRIVED); + break; case INPROGRESS: - return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.INPROGRESS; + tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.INPROGRESS); + break; case ONLEAVE: - return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ONLEAVE; + tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ONLEAVE); + break; case FINISHED: - return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.FINISHED; + tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.FINISHED); + break; case CANCELLED: - return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.CANCELLED; + tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.CANCELLED); + break; default: - return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/EpisodeOfCare10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/EpisodeOfCare10_30.java index 7ac12c3bb..9e8f4e8ab 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/EpisodeOfCare10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/EpisodeOfCare10_30.java @@ -12,7 +12,7 @@ public class EpisodeOfCare10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasStatus()) - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + tgt.setStatusElement(convertEpisodeOfCareStatus(src.getStatusElement())); for (org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_30.convertCodeableConcept(t)); if (src.hasPatient()) @@ -34,7 +34,7 @@ public class EpisodeOfCare10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasStatus()) - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + tgt.setStatusElement(convertEpisodeOfCareStatus(src.getStatusElement())); for (org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) tgt.addType(VersionConvertor_10_30.convertCodeableConcept(t)); if (src.hasPatient()) @@ -49,46 +49,66 @@ public class EpisodeOfCare10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertEpisodeOfCareStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PLANNED: - return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + tgt.setValue(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED); + break; case WAITLIST: - return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + tgt.setValue(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST); + break; case ACTIVE: - return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE); + break; case ONHOLD: - return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + tgt.setValue(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD); + break; case FINISHED: - return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + tgt.setValue(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED); + break; case CANCELLED: - return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + tgt.setValue(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED); + break; default: - return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertEpisodeOfCareStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PLANNED: - return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + tgt.setValue(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED); + break; case WAITLIST: - return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + tgt.setValue(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST); + break; case ACTIVE: - return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE); + break; case ONHOLD: - return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + tgt.setValue(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD); + break; case FINISHED: - return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + tgt.setValue(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED); + break; case CANCELLED: - return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + tgt.setValue(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED); + break; default: - return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { @@ -97,7 +117,7 @@ public class EpisodeOfCare10_30 { org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasStatus()) - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + tgt.setStatusElement(convertEpisodeOfCareStatus(src.getStatusElement())); if (src.hasPeriod()) tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); return tgt; @@ -109,7 +129,7 @@ public class EpisodeOfCare10_30 { org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasStatus()) - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + tgt.setStatusElement(convertEpisodeOfCareStatus(src.getStatusElement())); if (src.hasPeriod()) tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); return tgt; diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/FamilyMemberHistory10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/FamilyMemberHistory10_30.java index de794746e..57e846c55 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/FamilyMemberHistory10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/FamilyMemberHistory10_30.java @@ -5,38 +5,54 @@ import org.hl7.fhir.exceptions.FHIRException; public class FamilyMemberHistory10_30 { - public static org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertFamilyHistoryStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PARTIAL: - return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + tgt.setValue(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL); + break; case COMPLETED: - return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR); + break; case HEALTHUNKNOWN: - return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + tgt.setValue(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN); + break; default: - return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertFamilyHistoryStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PARTIAL: - return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + tgt.setValue(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL); + break; case COMPLETED: - return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR); + break; case HEALTHUNKNOWN: - return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + tgt.setValue(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN); + break; default: - return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu3.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu2.model.FamilyMemberHistory src) throws FHIRException { @@ -50,7 +66,7 @@ public class FamilyMemberHistory10_30 { if (src.hasDate()) tgt.setDateElement(VersionConvertor_10_30.convertDateTime(src.getDateElement())); if (src.hasStatus()) - tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + tgt.setStatusElement(convertFamilyHistoryStatus(src.getStatusElement())); if (src.hasNameElement()) tgt.setNameElement(VersionConvertor_10_30.convertString(src.getNameElement())); if (src.hasRelationship()) @@ -78,7 +94,7 @@ public class FamilyMemberHistory10_30 { if (src.hasDate()) tgt.setDateElement(VersionConvertor_10_30.convertDateTime(src.getDateElement())); if (src.hasStatus()) - tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + tgt.setStatusElement(convertFamilyHistoryStatus(src.getStatusElement())); if (src.hasNameElement()) tgt.setNameElement(VersionConvertor_10_30.convertString(src.getNameElement())); if (src.hasRelationship()) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Flag10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Flag10_30.java index d53a3b70d..9c18d308e 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Flag10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Flag10_30.java @@ -14,7 +14,7 @@ public class Flag10_30 { if (src.hasCategory()) tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); if (src.hasStatus()) - tgt.setStatus(convertFlagStatus(src.getStatus())); + tgt.setStatusElement(convertFlagStatus(src.getStatusElement())); if (src.hasPeriod()) tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); if (src.hasSubject()) @@ -37,7 +37,7 @@ public class Flag10_30 { if (src.hasCategory()) tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); if (src.hasStatus()) - tgt.setStatus(convertFlagStatus(src.getStatus())); + tgt.setStatusElement(convertFlagStatus(src.getStatusElement())); if (src.hasPeriod()) tgt.setPeriod(VersionConvertor_10_30.convertPeriod(src.getPeriod())); if (src.hasSubject()) @@ -51,33 +51,47 @@ public class Flag10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.dstu2.model.Flag.FlagStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertFlagStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Flag.FlagStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ACTIVE: - return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.Flag.FlagStatus.ACTIVE); + break; case INACTIVE: - return org.hl7.fhir.dstu3.model.Flag.FlagStatus.INACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.Flag.FlagStatus.INACTIVE); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.Flag.FlagStatus.ENTEREDINERROR); + break; default: - return org.hl7.fhir.dstu3.model.Flag.FlagStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Flag.FlagStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.dstu3.model.Flag.FlagStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertFlagStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Flag.FlagStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ACTIVE: - return org.hl7.fhir.dstu2.model.Flag.FlagStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu2.model.Flag.FlagStatus.ACTIVE); + break; case INACTIVE: - return org.hl7.fhir.dstu2.model.Flag.FlagStatus.INACTIVE; + tgt.setValue(org.hl7.fhir.dstu2.model.Flag.FlagStatus.INACTIVE); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu2.model.Flag.FlagStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu2.model.Flag.FlagStatus.ENTEREDINERROR); + break; default: - return org.hl7.fhir.dstu2.model.Flag.FlagStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Flag.FlagStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Group10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Group10_30.java index 66e549699..483f45f33 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Group10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Group10_30.java @@ -12,7 +12,7 @@ public class Group10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasType()) - tgt.setType(convertGroupType(src.getType())); + tgt.setTypeElement(convertGroupType(src.getTypeElement())); if (src.hasActualElement()) tgt.setActualElement(VersionConvertor_10_30.convertBoolean(src.getActualElement())); if (src.hasCode()) @@ -33,7 +33,7 @@ public class Group10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasType()) - tgt.setType(convertGroupType(src.getType())); + tgt.setTypeElement(convertGroupType(src.getTypeElement())); if (src.hasActualElement()) tgt.setActualElement(VersionConvertor_10_30.convertBoolean(src.getActualElement())); if (src.hasCode()) @@ -107,45 +107,65 @@ public class Group10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.Group.GroupType convertGroupType(org.hl7.fhir.dstu3.model.Group.GroupType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertGroupType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Group.GroupTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PERSON: - return org.hl7.fhir.dstu2.model.Group.GroupType.PERSON; + tgt.setValue(org.hl7.fhir.dstu2.model.Group.GroupType.PERSON); + break; case ANIMAL: - return org.hl7.fhir.dstu2.model.Group.GroupType.ANIMAL; + tgt.setValue(org.hl7.fhir.dstu2.model.Group.GroupType.ANIMAL); + break; case PRACTITIONER: - return org.hl7.fhir.dstu2.model.Group.GroupType.PRACTITIONER; + tgt.setValue(org.hl7.fhir.dstu2.model.Group.GroupType.PRACTITIONER); + break; case DEVICE: - return org.hl7.fhir.dstu2.model.Group.GroupType.DEVICE; + tgt.setValue(org.hl7.fhir.dstu2.model.Group.GroupType.DEVICE); + break; case MEDICATION: - return org.hl7.fhir.dstu2.model.Group.GroupType.MEDICATION; + tgt.setValue(org.hl7.fhir.dstu2.model.Group.GroupType.MEDICATION); + break; case SUBSTANCE: - return org.hl7.fhir.dstu2.model.Group.GroupType.SUBSTANCE; + tgt.setValue(org.hl7.fhir.dstu2.model.Group.GroupType.SUBSTANCE); + break; default: - return org.hl7.fhir.dstu2.model.Group.GroupType.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Group.GroupType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.Group.GroupType convertGroupType(org.hl7.fhir.dstu2.model.Group.GroupType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertGroupType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Group.GroupTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PERSON: - return org.hl7.fhir.dstu3.model.Group.GroupType.PERSON; + tgt.setValue(org.hl7.fhir.dstu3.model.Group.GroupType.PERSON); + break; case ANIMAL: - return org.hl7.fhir.dstu3.model.Group.GroupType.ANIMAL; + tgt.setValue(org.hl7.fhir.dstu3.model.Group.GroupType.ANIMAL); + break; case PRACTITIONER: - return org.hl7.fhir.dstu3.model.Group.GroupType.PRACTITIONER; + tgt.setValue(org.hl7.fhir.dstu3.model.Group.GroupType.PRACTITIONER); + break; case DEVICE: - return org.hl7.fhir.dstu3.model.Group.GroupType.DEVICE; + tgt.setValue(org.hl7.fhir.dstu3.model.Group.GroupType.DEVICE); + break; case MEDICATION: - return org.hl7.fhir.dstu3.model.Group.GroupType.MEDICATION; + tgt.setValue(org.hl7.fhir.dstu3.model.Group.GroupType.MEDICATION); + break; case SUBSTANCE: - return org.hl7.fhir.dstu3.model.Group.GroupType.SUBSTANCE; + tgt.setValue(org.hl7.fhir.dstu3.model.Group.GroupType.SUBSTANCE); + break; default: - return org.hl7.fhir.dstu3.model.Group.GroupType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Group.GroupType.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/HealthcareService10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/HealthcareService10_30.java index 6283c6844..7d0fba5f8 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/HealthcareService10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/HealthcareService10_30.java @@ -3,52 +3,76 @@ package org.hl7.fhir.convertors.conv10_30; import org.hl7.fhir.convertors.VersionConvertor_10_30; import org.hl7.fhir.exceptions.FHIRException; +import java.util.stream.Collectors; + public class HealthcareService10_30 { - public static org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertDaysOfWeek(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeekEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case MON: - return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.MON; + tgt.setValue(org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.MON); + break; case TUE: - return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.TUE; + tgt.setValue(org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.TUE); + break; case WED: - return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.WED; + tgt.setValue(org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.WED); + break; case THU: - return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.THU; + tgt.setValue(org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.THU); + break; case FRI: - return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.FRI; + tgt.setValue(org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.FRI); + break; case SAT: - return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.SAT; + tgt.setValue(org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.SAT); + break; case SUN: - return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.SUN; + tgt.setValue(org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.SUN); + break; default: - return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertDaysOfWeek(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeekEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case MON: - return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.MON; + tgt.setValue(org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.MON); + break; case TUE: - return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.TUE; + tgt.setValue(org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.TUE); + break; case WED: - return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.WED; + tgt.setValue(org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.WED); + break; case THU: - return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.THU; + tgt.setValue(org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.THU); + break; case FRI: - return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.FRI; + tgt.setValue(org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.FRI); + break; case SAT: - return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SAT; + tgt.setValue(org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SAT); + break; case SUN: - return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SUN; + tgt.setValue(org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SUN); + break; default: - return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu2.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu3.model.HealthcareService src) throws FHIRException { @@ -133,7 +157,9 @@ public class HealthcareService10_30 { return null; org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); VersionConvertor_10_30.copyElement(src, tgt); - for (org.hl7.fhir.dstu2.model.Enumeration t : src.getDaysOfWeek()) VersionConvertor_10_30.copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); + tgt.setDaysOfWeek(src.getDaysOfWeek().stream() + .map(HealthcareService10_30::convertDaysOfWeek) + .collect(Collectors.toList())); if (src.hasAllDayElement()) tgt.setAllDayElement(VersionConvertor_10_30.convertBoolean(src.getAllDayElement())); if (src.hasAvailableStartTimeElement()) @@ -148,7 +174,9 @@ public class HealthcareService10_30 { return null; org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); VersionConvertor_10_30.copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDaysOfWeek()) VersionConvertor_10_30.copyElement(t, tgt.addDaysOfWeekElement().setValue(convertDaysOfWeek(t.getValue()))); + tgt.setDaysOfWeek(src.getDaysOfWeek().stream() + .map(HealthcareService10_30::convertDaysOfWeek) + .collect(Collectors.toList())); if (src.hasAllDayElement()) tgt.setAllDayElement(VersionConvertor_10_30.convertBoolean(src.getAllDayElement())); if (src.hasAvailableStartTimeElement()) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ImagingStudy10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ImagingStudy10_30.java index d98c81f2c..8f6c4638c 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ImagingStudy10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ImagingStudy10_30.java @@ -16,7 +16,7 @@ public class ImagingStudy10_30 { tgt.setAccession(VersionConvertor_10_30.convertIdentifier(src.getAccession())); for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasAvailability()) - tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); + tgt.setAvailabilityElement(convertInstanceAvailability(src.getAvailabilityElement())); for (org.hl7.fhir.dstu2.model.Coding t : src.getModalityList()) tgt.addModalityList(VersionConvertor_10_30.convertCoding(t)); if (src.hasPatient()) tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); @@ -48,7 +48,7 @@ public class ImagingStudy10_30 { tgt.setAccession(VersionConvertor_10_30.convertIdentifier(src.getAccession())); for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasAvailability()) - tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); + tgt.setAvailabilityElement(convertInstanceAvailability(src.getAvailabilityElement())); for (org.hl7.fhir.dstu3.model.Coding t : src.getModalityList()) tgt.addModalityList(VersionConvertor_10_30.convertCoding(t)); if (src.hasPatient()) tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); @@ -84,7 +84,7 @@ public class ImagingStudy10_30 { if (src.hasNumberOfInstancesElement()) tgt.setNumberOfInstancesElement(VersionConvertor_10_30.convertUnsignedInt(src.getNumberOfInstancesElement())); if (src.hasAvailability()) - tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); + tgt.setAvailabilityElement(convertInstanceAvailability(src.getAvailabilityElement())); if (src.hasBodySite()) tgt.setBodySite(VersionConvertor_10_30.convertCoding(src.getBodySite())); if (src.hasLaterality()) @@ -111,7 +111,7 @@ public class ImagingStudy10_30 { if (src.hasNumberOfInstancesElement()) tgt.setNumberOfInstancesElement(VersionConvertor_10_30.convertUnsignedInt(src.getNumberOfInstancesElement())); if (src.hasAvailability()) - tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); + tgt.setAvailabilityElement(convertInstanceAvailability(src.getAvailabilityElement())); if (src.hasBodySite()) tgt.setBodySite(VersionConvertor_10_30.convertCoding(src.getBodySite())); if (src.hasLaterality()) @@ -154,37 +154,53 @@ public class ImagingStudy10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability convertInstanceAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertInstanceAvailability(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailabilityEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ONLINE: - return org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.ONLINE; + tgt.setValue(org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.ONLINE); + break; case OFFLINE: - return org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.OFFLINE; + tgt.setValue(org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.OFFLINE); + break; case NEARLINE: - return org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.NEARLINE; + tgt.setValue(org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.NEARLINE); + break; case UNAVAILABLE: - return org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.UNAVAILABLE; + tgt.setValue(org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.UNAVAILABLE); + break; default: - return org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability convertInstanceAvailability(org.hl7.fhir.dstu2.model.ImagingStudy.InstanceAvailability src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertInstanceAvailability(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailabilityEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ONLINE: - return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.ONLINE; + tgt.setValue(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.ONLINE); + break; case OFFLINE: - return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.OFFLINE; + tgt.setValue(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.OFFLINE); + break; case NEARLINE: - return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.NEARLINE; + tgt.setValue(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.NEARLINE); + break; case UNAVAILABLE: - return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.UNAVAILABLE; + tgt.setValue(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.UNAVAILABLE); + break; default: - return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Immunization10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Immunization10_30.java index a2641ae44..8913d0d83 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Immunization10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Immunization10_30.java @@ -1,7 +1,6 @@ package org.hl7.fhir.convertors.conv10_30; import java.util.List; - import org.hl7.fhir.convertors.VersionConvertor_10_30; import org.hl7.fhir.dstu3.model.Coding; import org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent; diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ImplementationGuide10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ImplementationGuide10_30.java index 7dfd9ee2b..2aecec5fb 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ImplementationGuide10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ImplementationGuide10_30.java @@ -5,80 +5,116 @@ import org.hl7.fhir.exceptions.FHIRException; public class ImplementationGuide10_30 { - public static org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertGuideDependencyType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case REFERENCE: - return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.REFERENCE; + tgt.setValue(org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.REFERENCE); + break; case INCLUSION: - return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.INCLUSION; + tgt.setValue(org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.INCLUSION); + break; default: - return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertGuideDependencyType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case REFERENCE: - return org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType.REFERENCE; + tgt.setValue(org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType.REFERENCE); + break; case INCLUSION: - return org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType.INCLUSION; + tgt.setValue(org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType.INCLUSION); + break; default: - return org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertGuidePageKind(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKindEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PAGE: - return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.PAGE; + tgt.setValue(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.PAGE); + break; case EXAMPLE: - return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.EXAMPLE; + tgt.setValue(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.EXAMPLE); + break; case LIST: - return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.LIST; + tgt.setValue(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.LIST); + break; case INCLUDE: - return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.INCLUDE; + tgt.setValue(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.INCLUDE); + break; case DIRECTORY: - return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DIRECTORY; + tgt.setValue(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DIRECTORY); + break; case DICTIONARY: - return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DICTIONARY; + tgt.setValue(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DICTIONARY); + break; case TOC: - return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.TOC; + tgt.setValue(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.TOC); + break; case RESOURCE: - return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.RESOURCE; + tgt.setValue(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.RESOURCE); + break; default: - return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertGuidePageKind(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKindEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PAGE: - return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.PAGE; + tgt.setValue(org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.PAGE); + break; case EXAMPLE: - return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.EXAMPLE; + tgt.setValue(org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.EXAMPLE); + break; case LIST: - return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.LIST; + tgt.setValue(org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.LIST); + break; case INCLUDE: - return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.INCLUDE; + tgt.setValue(org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.INCLUDE); + break; case DIRECTORY: - return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.DIRECTORY; + tgt.setValue(org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.DIRECTORY); + break; case DICTIONARY: - return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.DICTIONARY; + tgt.setValue(org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.DICTIONARY); + break; case TOC: - return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.TOC; + tgt.setValue(org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.TOC); + break; case RESOURCE: - return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.RESOURCE; + tgt.setValue(org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.RESOURCE); + break; default: - return org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu3.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu2.model.ImplementationGuide src) throws FHIRException { @@ -186,7 +222,7 @@ public class ImplementationGuide10_30 { org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasType()) - tgt.setType(convertGuideDependencyType(src.getType())); + tgt.setTypeElement(convertGuideDependencyType(src.getTypeElement())); if (src.hasUriElement()) tgt.setUriElement(VersionConvertor_10_30.convertUri(src.getUriElement())); return tgt; @@ -198,7 +234,7 @@ public class ImplementationGuide10_30 { org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasType()) - tgt.setType(convertGuideDependencyType(src.getType())); + tgt.setTypeElement(convertGuideDependencyType(src.getTypeElement())); if (src.hasUriElement()) tgt.setUriElement(VersionConvertor_10_30.convertUri(src.getUriElement())); return tgt; @@ -305,7 +341,7 @@ public class ImplementationGuide10_30 { if (src.hasTitleElement()) tgt.setNameElement(VersionConvertor_10_30.convertString(src.getTitleElement())); if (src.hasKind()) - tgt.setKind(convertGuidePageKind(src.getKind())); + tgt.setKindElement(convertGuidePageKind(src.getKindElement())); for (org.hl7.fhir.dstu3.model.CodeType t : src.getType()) tgt.addType(t.getValue()); for (org.hl7.fhir.dstu3.model.StringType t : src.getPackage()) tgt.addPackage(t.getValue()); if (src.hasFormatElement()) @@ -324,7 +360,7 @@ public class ImplementationGuide10_30 { if (src.hasNameElement()) tgt.setTitleElement(VersionConvertor_10_30.convertString(src.getNameElement())); if (src.hasKind()) - tgt.setKind(convertGuidePageKind(src.getKind())); + tgt.setKindElement(convertGuidePageKind(src.getKindElement())); for (org.hl7.fhir.dstu2.model.CodeType t : src.getType()) tgt.addType(t.getValue()); for (org.hl7.fhir.dstu2.model.StringType t : src.getPackage()) tgt.addPackage(t.getValue()); if (src.hasFormatElement()) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/List10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/List10_30.java index d87b545c4..0ad8281bb 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/List10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/List10_30.java @@ -22,13 +22,13 @@ public class List10_30 { if (src.hasEncounter()) tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getEncounter())); if (src.hasStatus()) - tgt.setStatus(convertListStatus(src.getStatus())); + tgt.setStatusElement(convertListStatus(src.getStatusElement())); if (src.hasDate()) tgt.setDateElement(VersionConvertor_10_30.convertDateTime(src.getDateElement())); if (src.hasOrderedBy()) tgt.setOrderedBy(VersionConvertor_10_30.convertCodeableConcept(src.getOrderedBy())); if (src.hasMode()) - tgt.setMode(convertListMode(src.getMode())); + tgt.setModeElement(convertListMode(src.getModeElement())); for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.setNote(t.getText()); for (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent t : src.getEntry()) tgt.addEntry(convertListEntry(t)); return tgt; @@ -51,13 +51,13 @@ public class List10_30 { if (src.hasEncounter()) tgt.setEncounter(VersionConvertor_10_30.convertReference(src.getEncounter())); if (src.hasStatus()) - tgt.setStatus(convertListStatus(src.getStatus())); + tgt.setStatusElement(convertListStatus(src.getStatusElement())); if (src.hasDate()) tgt.setDateElement(VersionConvertor_10_30.convertDateTime(src.getDateElement())); if (src.hasOrderedBy()) tgt.setOrderedBy(VersionConvertor_10_30.convertCodeableConcept(src.getOrderedBy())); if (src.hasMode()) - tgt.setMode(convertListMode(src.getMode())); + tgt.setModeElement(convertListMode(src.getModeElement())); if (src.hasNote()) tgt.addNote(new org.hl7.fhir.dstu3.model.Annotation().setText(src.getNote())); for (org.hl7.fhir.dstu2.model.List_.ListEntryComponent t : src.getEntry()) tgt.addEntry(convertListEntry(t)); @@ -96,64 +96,92 @@ public class List10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.ListResource.ListMode convertListMode(org.hl7.fhir.dstu2.model.List_.ListMode src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertListMode(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ListResource.ListModeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case WORKING: - return org.hl7.fhir.dstu3.model.ListResource.ListMode.WORKING; + tgt.setValue(org.hl7.fhir.dstu3.model.ListResource.ListMode.WORKING); + break; case SNAPSHOT: - return org.hl7.fhir.dstu3.model.ListResource.ListMode.SNAPSHOT; + tgt.setValue(org.hl7.fhir.dstu3.model.ListResource.ListMode.SNAPSHOT); + break; case CHANGES: - return org.hl7.fhir.dstu3.model.ListResource.ListMode.CHANGES; + tgt.setValue(org.hl7.fhir.dstu3.model.ListResource.ListMode.CHANGES); + break; default: - return org.hl7.fhir.dstu3.model.ListResource.ListMode.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.ListResource.ListMode.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.List_.ListMode convertListMode(org.hl7.fhir.dstu3.model.ListResource.ListMode src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertListMode(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.List_.ListModeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case WORKING: - return org.hl7.fhir.dstu2.model.List_.ListMode.WORKING; + tgt.setValue(org.hl7.fhir.dstu2.model.List_.ListMode.WORKING); + break; case SNAPSHOT: - return org.hl7.fhir.dstu2.model.List_.ListMode.SNAPSHOT; + tgt.setValue(org.hl7.fhir.dstu2.model.List_.ListMode.SNAPSHOT); + break; case CHANGES: - return org.hl7.fhir.dstu2.model.List_.ListMode.CHANGES; + tgt.setValue(org.hl7.fhir.dstu2.model.List_.ListMode.CHANGES); + break; default: - return org.hl7.fhir.dstu2.model.List_.ListMode.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.List_.ListMode.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.List_.ListStatus convertListStatus(org.hl7.fhir.dstu3.model.ListResource.ListStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertListStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.List_.ListStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case CURRENT: - return org.hl7.fhir.dstu2.model.List_.ListStatus.CURRENT; + tgt.setValue(org.hl7.fhir.dstu2.model.List_.ListStatus.CURRENT); + break; case RETIRED: - return org.hl7.fhir.dstu2.model.List_.ListStatus.RETIRED; + tgt.setValue(org.hl7.fhir.dstu2.model.List_.ListStatus.RETIRED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu2.model.List_.ListStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu2.model.List_.ListStatus.ENTEREDINERROR); + break; default: - return org.hl7.fhir.dstu2.model.List_.ListStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.List_.ListStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.dstu2.model.List_.ListStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertListStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ListResource.ListStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case CURRENT: - return org.hl7.fhir.dstu3.model.ListResource.ListStatus.CURRENT; + tgt.setValue(org.hl7.fhir.dstu3.model.ListResource.ListStatus.CURRENT); + break; case RETIRED: - return org.hl7.fhir.dstu3.model.ListResource.ListStatus.RETIRED; + tgt.setValue(org.hl7.fhir.dstu3.model.ListResource.ListStatus.RETIRED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu3.model.ListResource.ListStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.ListResource.ListStatus.ENTEREDINERROR); + break; default: - return org.hl7.fhir.dstu3.model.ListResource.ListStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.ListResource.ListStatus.NULL); + break; } + return tgt; } public static void copyBackboneElement(org.hl7.fhir.dstu2.model.BackboneElement src, org.hl7.fhir.dstu3.model.BackboneElement tgt) throws FHIRException { diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Location10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Location10_30.java index 7f01fadb5..2fe83daca 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Location10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Location10_30.java @@ -12,13 +12,13 @@ public class Location10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasStatus()) - tgt.setStatus(convertLocationStatus(src.getStatus())); + tgt.setStatusElement(convertLocationStatus(src.getStatusElement())); if (src.hasNameElement()) tgt.setNameElement(VersionConvertor_10_30.convertString(src.getNameElement())); if (src.hasDescriptionElement()) tgt.setDescriptionElement(VersionConvertor_10_30.convertString(src.getDescriptionElement())); if (src.hasMode()) - tgt.setMode(convertLocationMode(src.getMode())); + tgt.setModeElement(convertLocationMode(src.getModeElement())); if (src.hasType()) tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); @@ -42,13 +42,13 @@ public class Location10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasStatus()) - tgt.setStatus(convertLocationStatus(src.getStatus())); + tgt.setStatusElement(convertLocationStatus(src.getStatusElement())); if (src.hasNameElement()) tgt.setNameElement(VersionConvertor_10_30.convertString(src.getNameElement())); if (src.hasDescriptionElement()) tgt.setDescriptionElement(VersionConvertor_10_30.convertString(src.getDescriptionElement())); if (src.hasMode()) - tgt.setMode(convertLocationMode(src.getMode())); + tgt.setModeElement(convertLocationMode(src.getModeElement())); if (src.hasType()) tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); @@ -65,30 +65,42 @@ public class Location10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.Location.LocationMode convertLocationMode(org.hl7.fhir.dstu3.model.Location.LocationMode src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertLocationMode(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Location.LocationModeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case INSTANCE: - return org.hl7.fhir.dstu2.model.Location.LocationMode.INSTANCE; + tgt.setValue(org.hl7.fhir.dstu2.model.Location.LocationMode.INSTANCE); + break; case KIND: - return org.hl7.fhir.dstu2.model.Location.LocationMode.KIND; + tgt.setValue(org.hl7.fhir.dstu2.model.Location.LocationMode.KIND); + break; default: - return org.hl7.fhir.dstu2.model.Location.LocationMode.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Location.LocationMode.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.Location.LocationMode convertLocationMode(org.hl7.fhir.dstu2.model.Location.LocationMode src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertLocationMode(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Location.LocationModeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case INSTANCE: - return org.hl7.fhir.dstu3.model.Location.LocationMode.INSTANCE; + tgt.setValue(org.hl7.fhir.dstu3.model.Location.LocationMode.INSTANCE); + break; case KIND: - return org.hl7.fhir.dstu3.model.Location.LocationMode.KIND; + tgt.setValue(org.hl7.fhir.dstu3.model.Location.LocationMode.KIND); + break; default: - return org.hl7.fhir.dstu3.model.Location.LocationMode.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Location.LocationMode.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu3.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.dstu2.model.Location.LocationPositionComponent src) throws FHIRException { @@ -119,33 +131,47 @@ public class Location10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.dstu3.model.Location.LocationStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertLocationStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Location.LocationStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ACTIVE: - return org.hl7.fhir.dstu2.model.Location.LocationStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu2.model.Location.LocationStatus.ACTIVE); + break; case SUSPENDED: - return org.hl7.fhir.dstu2.model.Location.LocationStatus.SUSPENDED; + tgt.setValue(org.hl7.fhir.dstu2.model.Location.LocationStatus.SUSPENDED); + break; case INACTIVE: - return org.hl7.fhir.dstu2.model.Location.LocationStatus.INACTIVE; + tgt.setValue(org.hl7.fhir.dstu2.model.Location.LocationStatus.INACTIVE); + break; default: - return org.hl7.fhir.dstu2.model.Location.LocationStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Location.LocationStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.dstu2.model.Location.LocationStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertLocationStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Location.LocationStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ACTIVE: - return org.hl7.fhir.dstu3.model.Location.LocationStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.Location.LocationStatus.ACTIVE); + break; case SUSPENDED: - return org.hl7.fhir.dstu3.model.Location.LocationStatus.SUSPENDED; + tgt.setValue(org.hl7.fhir.dstu3.model.Location.LocationStatus.SUSPENDED); + break; case INACTIVE: - return org.hl7.fhir.dstu3.model.Location.LocationStatus.INACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.Location.LocationStatus.INACTIVE); + break; default: - return org.hl7.fhir.dstu3.model.Location.LocationStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Location.LocationStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Media10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Media10_30.java index 5f7411dda..3cab6a938 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Media10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Media10_30.java @@ -5,34 +5,48 @@ import org.hl7.fhir.exceptions.FHIRException; public class Media10_30 { - public static org.hl7.fhir.dstu2.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.dstu3.model.Media.DigitalMediaType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertDigitalMediaType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Media.DigitalMediaTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PHOTO: - return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.PHOTO; + tgt.setValue(org.hl7.fhir.dstu2.model.Media.DigitalMediaType.PHOTO); + break; case VIDEO: - return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.VIDEO; + tgt.setValue(org.hl7.fhir.dstu2.model.Media.DigitalMediaType.VIDEO); + break; case AUDIO: - return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.AUDIO; + tgt.setValue(org.hl7.fhir.dstu2.model.Media.DigitalMediaType.AUDIO); + break; default: - return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Media.DigitalMediaType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.dstu2.model.Media.DigitalMediaType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertDigitalMediaType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Media.DigitalMediaTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PHOTO: - return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.PHOTO; + tgt.setValue(org.hl7.fhir.dstu3.model.Media.DigitalMediaType.PHOTO); + break; case VIDEO: - return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.VIDEO; + tgt.setValue(org.hl7.fhir.dstu3.model.Media.DigitalMediaType.VIDEO); + break; case AUDIO: - return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.AUDIO; + tgt.setValue(org.hl7.fhir.dstu3.model.Media.DigitalMediaType.AUDIO); + break; default: - return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Media.DigitalMediaType.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu2.model.Media convertMedia(org.hl7.fhir.dstu3.model.Media src) throws FHIRException { @@ -42,7 +56,7 @@ public class Media10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasType()) - tgt.setType(convertDigitalMediaType(src.getType())); + tgt.setTypeElement(convertDigitalMediaType(src.getTypeElement())); if (src.hasSubtype()) tgt.setSubtype(VersionConvertor_10_30.convertCodeableConcept(src.getSubtype())); if (src.hasView()) @@ -72,7 +86,7 @@ public class Media10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasType()) - tgt.setType(convertDigitalMediaType(src.getType())); + tgt.setTypeElement(convertDigitalMediaType(src.getTypeElement())); if (src.hasSubtype()) tgt.setSubtype(VersionConvertor_10_30.convertCodeableConcept(src.getSubtype())); if (src.hasView()) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MedicationDispense10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MedicationDispense10_30.java index 8580aa2d1..412ca37f6 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MedicationDispense10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MedicationDispense10_30.java @@ -14,7 +14,7 @@ public class MedicationDispense10_30 { if (src.hasIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); if (src.hasStatus()) - tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); + tgt.setStatusElement(convertMedicationDispenseStatus(src.getStatusElement())); if (src.hasMedication()) tgt.setMedication(VersionConvertor_10_30.convertType(src.getMedication())); if (src.hasPatient()) @@ -49,7 +49,7 @@ public class MedicationDispense10_30 { if (src.hasIdentifier()) tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifierFirstRep())); if (src.hasStatus()) - tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); + tgt.setStatusElement(convertMedicationDispenseStatus(src.getStatusElement())); if (src.hasMedication()) tgt.setMedication(VersionConvertor_10_30.convertType(src.getMedication())); if (src.hasSubject()) @@ -118,42 +118,60 @@ public class MedicationDispense10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertMedicationDispenseStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case INPROGRESS: - return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS; + tgt.setValue(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS); + break; case ONHOLD: - return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.ONHOLD; + tgt.setValue(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.ONHOLD); + break; case COMPLETED: - return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.COMPLETED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR); + break; case STOPPED: - return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.STOPPED; + tgt.setValue(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.STOPPED); + break; default: - return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertMedicationDispenseStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case INPROGRESS: - return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS; + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS); + break; case ONHOLD: - return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.ONHOLD; + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.ONHOLD); + break; case COMPLETED: - return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.COMPLETED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR); + break; case STOPPED: - return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.STOPPED; + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.STOPPED); + break; default: - return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MedicationStatement10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MedicationStatement10_30.java index d3cea9482..fc53431eb 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MedicationStatement10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MedicationStatement10_30.java @@ -12,7 +12,7 @@ public class MedicationStatement10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasStatus()) - tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + tgt.setStatusElement(convertMedicationStatementStatus(src.getStatusElement())); if (src.hasMedication()) tgt.setMedication(VersionConvertor_10_30.convertType(src.getMedication())); if (src.hasPatient()) @@ -38,7 +38,7 @@ public class MedicationStatement10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasStatus()) - tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + tgt.setStatusElement(convertMedicationStatementStatus(src.getStatusElement())); if (src.hasMedication()) tgt.setMedication(VersionConvertor_10_30.convertType(src.getMedication())); if (src.hasSubject()) @@ -104,37 +104,53 @@ public class MedicationStatement10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertMedicationStatementStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ACTIVE: - return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ACTIVE); + break; case COMPLETED: - return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.COMPLETED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR); + break; case INTENDED: - return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.INTENDED; + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.INTENDED); + break; default: - return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertMedicationStatementStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ACTIVE: - return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ACTIVE); + break; case COMPLETED: - return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.COMPLETED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR); + break; case INTENDED: - return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.INTENDED; + tgt.setValue(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.INTENDED); + break; default: - return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MessageHeader10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MessageHeader10_30.java index 0f21c1a83..3781a84f1 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MessageHeader10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/MessageHeader10_30.java @@ -97,7 +97,7 @@ public class MessageHeader10_30 { if (src.hasIdentifierElement()) tgt.setIdentifierElement(VersionConvertor_10_30.convertId(src.getIdentifierElement())); if (src.hasCode()) - tgt.setCode(convertResponseType(src.getCode())); + tgt.setCodeElement(convertResponseType(src.getCodeElement())); if (src.hasDetails()) tgt.setDetails(VersionConvertor_10_30.convertReference(src.getDetails())); return tgt; @@ -111,7 +111,7 @@ public class MessageHeader10_30 { if (src.hasIdentifierElement()) tgt.setIdentifierElement(VersionConvertor_10_30.convertId(src.getIdentifierElement())); if (src.hasCode()) - tgt.setCode(convertResponseType(src.getCode())); + tgt.setCodeElement(convertResponseType(src.getCodeElement())); if (src.hasDetails()) tgt.setDetails(VersionConvertor_10_30.convertReference(src.getDetails())); return tgt; @@ -153,33 +153,47 @@ public class MessageHeader10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.dstu2.model.MessageHeader.ResponseType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertResponseType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.MessageHeader.ResponseTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case OK: - return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.OK; + tgt.setValue(org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.OK); + break; case TRANSIENTERROR: - return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.TRANSIENTERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.TRANSIENTERROR); + break; case FATALERROR: - return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.FATALERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.FATALERROR); + break; default: - return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.dstu3.model.MessageHeader.ResponseType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertResponseType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.MessageHeader.ResponseTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case OK: - return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.OK; + tgt.setValue(org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.OK); + break; case TRANSIENTERROR: - return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.TRANSIENTERROR; + tgt.setValue(org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.TRANSIENTERROR); + break; case FATALERROR: - return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.FATALERROR; + tgt.setValue(org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.FATALERROR); + break; default: - return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/NamingSystem10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/NamingSystem10_30.java index 1812ff4f4..60cc6ed18 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/NamingSystem10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/NamingSystem10_30.java @@ -15,7 +15,7 @@ public class NamingSystem10_30 { if (src.hasStatus()) tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); if (src.hasKind()) - tgt.setKind(convertNamingSystemType(src.getKind())); + tgt.setKindElement(convertNamingSystemType(src.getKindElement())); if (src.hasDate()) tgt.setDateElement(VersionConvertor_10_30.convertDateTime(src.getDateElement())); if (src.hasPublisherElement()) @@ -49,7 +49,7 @@ public class NamingSystem10_30 { if (src.hasStatus()) tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); if (src.hasKind()) - tgt.setKind(convertNamingSystemType(src.getKind())); + tgt.setKindElement(convertNamingSystemType(src.getKindElement())); if (src.hasDate()) tgt.setDateElement(VersionConvertor_10_30.convertDateTime(src.getDateElement())); if (src.hasPublisherElement()) @@ -94,68 +94,98 @@ public class NamingSystem10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertNamingSystemIdentifierType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case OID: - return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.OID; + tgt.setValue(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.OID); + break; case UUID: - return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.UUID; + tgt.setValue(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.UUID); + break; case URI: - return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.URI; + tgt.setValue(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.URI); + break; case OTHER: - return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.OTHER; + tgt.setValue(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.OTHER); + break; default: - return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertNamingSystemIdentifierType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case OID: - return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OID; + tgt.setValue(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OID); + break; case UUID: - return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.UUID; + tgt.setValue(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.UUID); + break; case URI: - return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.URI; + tgt.setValue(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.URI); + break; case OTHER: - return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OTHER; + tgt.setValue(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OTHER); + break; default: - return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertNamingSystemType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case CODESYSTEM: - return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.CODESYSTEM; + tgt.setValue(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.CODESYSTEM); + break; case IDENTIFIER: - return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.IDENTIFIER; + tgt.setValue(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.IDENTIFIER); + break; case ROOT: - return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.ROOT; + tgt.setValue(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.ROOT); + break; default: - return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertNamingSystemType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case CODESYSTEM: - return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.CODESYSTEM; + tgt.setValue(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.CODESYSTEM); + break; case IDENTIFIER: - return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.IDENTIFIER; + tgt.setValue(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.IDENTIFIER); + break; case ROOT: - return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.ROOT; + tgt.setValue(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.ROOT); + break; default: - return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { @@ -164,7 +194,7 @@ public class NamingSystem10_30 { org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasType()) - tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setTypeElement(convertNamingSystemIdentifierType(src.getTypeElement())); if (src.hasValueElement()) tgt.setValueElement(VersionConvertor_10_30.convertString(src.getValueElement())); if (src.hasPreferredElement()) @@ -180,7 +210,7 @@ public class NamingSystem10_30 { org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasType()) - tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setTypeElement(convertNamingSystemIdentifierType(src.getTypeElement())); if (src.hasValueElement()) tgt.setValueElement(VersionConvertor_10_30.convertString(src.getValueElement())); if (src.hasPreferredElement()) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Observation10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Observation10_30.java index 06845326c..b57c98b2f 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Observation10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Observation10_30.java @@ -12,7 +12,7 @@ public class Observation10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasStatus()) - tgt.setStatus(convertObservationStatus(src.getStatus())); + tgt.setStatusElement(convertObservationStatus(src.getStatusElement())); if (src.hasCategory()) tgt.addCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); if (src.hasCode()) @@ -55,7 +55,7 @@ public class Observation10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasStatus()) - tgt.setStatus(convertObservationStatus(src.getStatus())); + tgt.setStatusElement(convertObservationStatus(src.getStatusElement())); for (org.hl7.fhir.dstu3.model.CodeableConcept c : src.getCategory()) tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(c)); if (src.hasCode()) tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getCode())); @@ -162,7 +162,7 @@ public class Observation10_30 { org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasType()) - tgt.setType(convertObservationRelationshipType(src.getType())); + tgt.setTypeElement(convertObservationRelationshipType(src.getTypeElement())); if (src.hasTarget()) tgt.setTarget(VersionConvertor_10_30.convertReference(src.getTarget())); return tgt; @@ -174,97 +174,139 @@ public class Observation10_30 { org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasType()) - tgt.setType(convertObservationRelationshipType(src.getType())); + tgt.setTypeElement(convertObservationRelationshipType(src.getTypeElement())); if (src.hasTarget()) tgt.setTarget(VersionConvertor_10_30.convertReference(src.getTarget())); return tgt; } - public static org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType convertObservationRelationshipType(org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertObservationRelationshipType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case HASMEMBER: - return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.HASMEMBER; + tgt.setValue(org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.HASMEMBER); + break; case DERIVEDFROM: - return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.DERIVEDFROM; + tgt.setValue(org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.DERIVEDFROM); + break; case SEQUELTO: - return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.SEQUELTO; + tgt.setValue(org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.SEQUELTO); + break; case REPLACES: - return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.REPLACES; + tgt.setValue(org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.REPLACES); + break; case QUALIFIEDBY: - return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.QUALIFIEDBY; + tgt.setValue(org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.QUALIFIEDBY); + break; case INTERFEREDBY: - return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.INTERFEREDBY; + tgt.setValue(org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.INTERFEREDBY); + break; default: - return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType convertObservationRelationshipType(org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertObservationRelationshipType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case HASMEMBER: - return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.HASMEMBER; + tgt.setValue(org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.HASMEMBER); + break; case DERIVEDFROM: - return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.DERIVEDFROM; + tgt.setValue(org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.DERIVEDFROM); + break; case SEQUELTO: - return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.SEQUELTO; + tgt.setValue(org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.SEQUELTO); + break; case REPLACES: - return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.REPLACES; + tgt.setValue(org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.REPLACES); + break; case QUALIFIEDBY: - return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.QUALIFIEDBY; + tgt.setValue(org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.QUALIFIEDBY); + break; case INTERFEREDBY: - return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.INTERFEREDBY; + tgt.setValue(org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.INTERFEREDBY); + break; default: - return org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.dstu3.model.Observation.ObservationStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertObservationStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Observation.ObservationStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case REGISTERED: - return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.REGISTERED; + tgt.setValue(org.hl7.fhir.dstu2.model.Observation.ObservationStatus.REGISTERED); + break; case PRELIMINARY: - return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.PRELIMINARY; + tgt.setValue(org.hl7.fhir.dstu2.model.Observation.ObservationStatus.PRELIMINARY); + break; case FINAL: - return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.FINAL; + tgt.setValue(org.hl7.fhir.dstu2.model.Observation.ObservationStatus.FINAL); + break; case AMENDED: - return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.AMENDED; + tgt.setValue(org.hl7.fhir.dstu2.model.Observation.ObservationStatus.AMENDED); + break; case CANCELLED: - return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.CANCELLED; + tgt.setValue(org.hl7.fhir.dstu2.model.Observation.ObservationStatus.CANCELLED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu2.model.Observation.ObservationStatus.ENTEREDINERROR); + break; case UNKNOWN: - return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.UNKNOWN; + tgt.setValue(org.hl7.fhir.dstu2.model.Observation.ObservationStatus.UNKNOWN); + break; default: - return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Observation.ObservationStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.dstu2.model.Observation.ObservationStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertObservationStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Observation.ObservationStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case REGISTERED: - return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.REGISTERED; + tgt.setValue(org.hl7.fhir.dstu3.model.Observation.ObservationStatus.REGISTERED); + break; case PRELIMINARY: - return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.PRELIMINARY; + tgt.setValue(org.hl7.fhir.dstu3.model.Observation.ObservationStatus.PRELIMINARY); + break; case FINAL: - return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.FINAL; + tgt.setValue(org.hl7.fhir.dstu3.model.Observation.ObservationStatus.FINAL); + break; case AMENDED: - return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.AMENDED; + tgt.setValue(org.hl7.fhir.dstu3.model.Observation.ObservationStatus.AMENDED); + break; case CANCELLED: - return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.CANCELLED; + tgt.setValue(org.hl7.fhir.dstu3.model.Observation.ObservationStatus.CANCELLED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.Observation.ObservationStatus.ENTEREDINERROR); + break; case UNKNOWN: - return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.UNKNOWN; + tgt.setValue(org.hl7.fhir.dstu3.model.Observation.ObservationStatus.UNKNOWN); + break; default: - return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Observation.ObservationStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/OperationDefinition10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/OperationDefinition10_30.java index 033fbc593..847205d4b 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/OperationDefinition10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/OperationDefinition10_30.java @@ -21,7 +21,7 @@ public class OperationDefinition10_30 { if (src.hasStatus()) tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); if (src.hasKind()) - tgt.setKind(convertOperationKind(src.getKind())); + tgt.setKindElement(convertOperationKind(src.getKindElement())); if (src.hasExperimental()) tgt.setExperimentalElement(VersionConvertor_10_30.convertBoolean(src.getExperimentalElement())); if (src.hasDate()) @@ -65,7 +65,7 @@ public class OperationDefinition10_30 { if (src.hasStatus()) tgt.setStatus(VersionConvertor_10_30.convertConformanceResourceStatus(src.getStatus())); if (src.hasKind()) - tgt.setKind(convertOperationKind(src.getKind())); + tgt.setKindElement(convertOperationKind(src.getKindElement())); if (src.hasExperimental()) tgt.setExperimentalElement(VersionConvertor_10_30.convertBoolean(src.getExperimentalElement())); if (src.hasDate()) @@ -149,7 +149,7 @@ public class OperationDefinition10_30 { if (src.hasNameElement()) tgt.setNameElement(VersionConvertor_10_30.convertCode(src.getNameElement())); if (src.hasUse()) - tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setUseElement(convertOperationParameterUse(src.getUseElement())); if (src.hasMinElement()) tgt.setMinElement(VersionConvertor_10_30.convertInteger(src.getMinElement())); if (src.hasMaxElement()) @@ -176,7 +176,7 @@ public class OperationDefinition10_30 { if (src.hasNameElement()) tgt.setNameElement(VersionConvertor_10_30.convertCode(src.getNameElement())); if (src.hasUse()) - tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setUseElement(convertOperationParameterUse(src.getUseElement())); if (src.hasMinElement()) tgt.setMinElement(VersionConvertor_10_30.convertInteger(src.getMinElement())); if (src.hasMaxElement()) @@ -199,55 +199,79 @@ public class OperationDefinition10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertOperationKind(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.OperationDefinition.OperationKindEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case OPERATION: - return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.OPERATION; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.OPERATION); + break; case QUERY: - return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.QUERY; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.QUERY); + break; default: - return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertOperationKind(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.OperationDefinition.OperationKindEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case OPERATION: - return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.OPERATION; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.OPERATION); + break; case QUERY: - return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.QUERY; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.QUERY); + break; default: - return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertOperationParameterUse(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUseEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case IN: - return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.IN; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.IN); + break; case OUT: - return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.OUT; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.OUT); + break; default: - return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertOperationParameterUse(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUseEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case IN: - return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.IN; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.IN); + break; case OUT: - return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.OUT; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.OUT); + break; default: - return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/OperationOutcome10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/OperationOutcome10_30.java index 647515dea..a10ffb6ef 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/OperationOutcome10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/OperationOutcome10_30.java @@ -5,172 +5,254 @@ import org.hl7.fhir.exceptions.FHIRException; public class OperationOutcome10_30 { - public static org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertIssueSeverity(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverityEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case FATAL: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.FATAL; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.FATAL); + break; case ERROR: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR); + break; case WARNING: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING); + break; case INFORMATION: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION); + break; default: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertIssueSeverity(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverityEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case FATAL: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.FATAL; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.FATAL); + break; case ERROR: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.ERROR; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.ERROR); + break; case WARNING: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.WARNING; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.WARNING); + break; case INFORMATION: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.INFORMATION; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.INFORMATION); + break; default: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertIssueType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.OperationOutcome.IssueTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case INVALID: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INVALID; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INVALID); + break; case STRUCTURE: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.STRUCTURE; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.STRUCTURE); + break; case REQUIRED: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.REQUIRED; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.REQUIRED); + break; case VALUE: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.VALUE; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.VALUE); + break; case INVARIANT: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INVARIANT; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INVARIANT); + break; case SECURITY: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.SECURITY; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.SECURITY); + break; case LOGIN: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.LOGIN; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.LOGIN); + break; case UNKNOWN: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.UNKNOWN; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.UNKNOWN); + break; case EXPIRED: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXPIRED; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXPIRED); + break; case FORBIDDEN: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.FORBIDDEN; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.FORBIDDEN); + break; case SUPPRESSED: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.SUPPRESSED; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.SUPPRESSED); + break; case PROCESSING: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.PROCESSING; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.PROCESSING); + break; case NOTSUPPORTED: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOTSUPPORTED; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOTSUPPORTED); + break; case DUPLICATE: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.DUPLICATE; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.DUPLICATE); + break; case NOTFOUND: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOTFOUND; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOTFOUND); + break; case TOOLONG: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TOOLONG; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TOOLONG); + break; case CODEINVALID: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.CODEINVALID; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.CODEINVALID); + break; case EXTENSION: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXTENSION; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXTENSION); + break; case TOOCOSTLY: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TOOCOSTLY; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TOOCOSTLY); + break; case BUSINESSRULE: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.BUSINESSRULE; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.BUSINESSRULE); + break; case CONFLICT: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.CONFLICT; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.CONFLICT); + break; case INCOMPLETE: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INCOMPLETE; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INCOMPLETE); + break; case TRANSIENT: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TRANSIENT; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TRANSIENT); + break; case LOCKERROR: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.LOCKERROR; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.LOCKERROR); + break; case NOSTORE: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOSTORE; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOSTORE); + break; case EXCEPTION: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXCEPTION; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXCEPTION); + break; case TIMEOUT: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TIMEOUT; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TIMEOUT); + break; case THROTTLED: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.THROTTLED; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.THROTTLED); + break; case INFORMATIONAL: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INFORMATIONAL; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INFORMATIONAL); + break; default: - return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertIssueType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.OperationOutcome.IssueTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case INVALID: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVALID; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVALID); + break; case STRUCTURE: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.STRUCTURE; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.STRUCTURE); + break; case REQUIRED: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.REQUIRED; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.REQUIRED); + break; case VALUE: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.VALUE; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.VALUE); + break; case INVARIANT: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVARIANT; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVARIANT); + break; case SECURITY: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SECURITY; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SECURITY); + break; case LOGIN: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOGIN; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOGIN); + break; case UNKNOWN: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.UNKNOWN; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.UNKNOWN); + break; case EXPIRED: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXPIRED; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXPIRED); + break; case FORBIDDEN: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.FORBIDDEN; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.FORBIDDEN); + break; case SUPPRESSED: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SUPPRESSED; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SUPPRESSED); + break; case PROCESSING: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.PROCESSING; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.PROCESSING); + break; case NOTSUPPORTED: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTSUPPORTED; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTSUPPORTED); + break; case DUPLICATE: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.DUPLICATE; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.DUPLICATE); + break; case NOTFOUND: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTFOUND; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTFOUND); + break; case TOOLONG: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOLONG; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOLONG); + break; case CODEINVALID: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CODEINVALID; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CODEINVALID); + break; case EXTENSION: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXTENSION; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXTENSION); + break; case TOOCOSTLY: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOCOSTLY; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOCOSTLY); + break; case BUSINESSRULE: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.BUSINESSRULE; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.BUSINESSRULE); + break; case CONFLICT: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CONFLICT; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CONFLICT); + break; case INCOMPLETE: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INCOMPLETE; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INCOMPLETE); + break; case TRANSIENT: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TRANSIENT; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TRANSIENT); + break; case LOCKERROR: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOCKERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOCKERROR); + break; case NOSTORE: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOSTORE; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOSTORE); + break; case EXCEPTION: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXCEPTION; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXCEPTION); + break; case TIMEOUT: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TIMEOUT; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TIMEOUT); + break; case THROTTLED: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.THROTTLED; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.THROTTLED); + break; case INFORMATIONAL: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INFORMATIONAL; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INFORMATIONAL); + break; default: - return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2.model.OperationOutcome src) throws FHIRException { @@ -197,9 +279,9 @@ public class OperationOutcome10_30 { org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasSeverity()) - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setSeverityElement(convertIssueSeverity(src.getSeverityElement())); if (src.hasCode()) - tgt.setCode(convertIssueType(src.getCode())); + tgt.setCodeElement(convertIssueType(src.getCodeElement())); if (src.hasDetails()) tgt.setDetails(VersionConvertor_10_30.convertCodeableConcept(src.getDetails())); if (src.hasDiagnosticsElement()) @@ -214,9 +296,9 @@ public class OperationOutcome10_30 { org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasSeverity()) - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setSeverityElement(convertIssueSeverity(src.getSeverityElement())); if (src.hasCode()) - tgt.setCode(convertIssueType(src.getCode())); + tgt.setCodeElement(convertIssueType(src.getCodeElement())); if (src.hasDetails()) tgt.setDetails(VersionConvertor_10_30.convertCodeableConcept(src.getDetails())); if (src.hasDiagnosticsElement()) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Patient10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Patient10_30.java index c2987805f..3fdf1e7b6 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Patient10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Patient10_30.java @@ -73,36 +73,51 @@ public class Patient10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.Patient.LinkType convertLinkType(org.hl7.fhir.dstu3.model.Patient.LinkType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertLinkType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Patient.LinkTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case REPLACEDBY: - return org.hl7.fhir.dstu2.model.Patient.LinkType.REPLACE; + tgt.setValue(org.hl7.fhir.dstu2.model.Patient.LinkType.REPLACE); + break; case REPLACES: - return org.hl7.fhir.dstu2.model.Patient.LinkType.REPLACE; + tgt.setValue(org.hl7.fhir.dstu2.model.Patient.LinkType.REPLACE); + break; case REFER: - return org.hl7.fhir.dstu2.model.Patient.LinkType.REFER; + tgt.setValue(org.hl7.fhir.dstu2.model.Patient.LinkType.REFER); + break; case SEEALSO: - return org.hl7.fhir.dstu2.model.Patient.LinkType.SEEALSO; + tgt.setValue(org.hl7.fhir.dstu2.model.Patient.LinkType.SEEALSO); + break; default: - return org.hl7.fhir.dstu2.model.Patient.LinkType.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Patient.LinkType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.Patient.LinkType convertLinkType(org.hl7.fhir.dstu2.model.Patient.LinkType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertLinkType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Patient.LinkTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case REPLACE: - return org.hl7.fhir.dstu3.model.Patient.LinkType.REPLACEDBY; + tgt.setValue(org.hl7.fhir.dstu3.model.Patient.LinkType.REPLACEDBY); + break; case REFER: - return org.hl7.fhir.dstu3.model.Patient.LinkType.REFER; + tgt.setValue(org.hl7.fhir.dstu3.model.Patient.LinkType.REFER); + break; case SEEALSO: - return org.hl7.fhir.dstu3.model.Patient.LinkType.SEEALSO; + tgt.setValue(org.hl7.fhir.dstu3.model.Patient.LinkType.SEEALSO); + break; default: - return org.hl7.fhir.dstu3.model.Patient.LinkType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Patient.LinkType.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu3.model.Patient convertPatient(org.hl7.fhir.dstu2.model.Patient src) throws FHIRException { @@ -203,7 +218,7 @@ public class Patient10_30 { if (src.hasOther()) tgt.setOther(VersionConvertor_10_30.convertReference(src.getOther())); if (src.hasType()) - tgt.setType(convertLinkType(src.getType())); + tgt.setTypeElement(convertLinkType(src.getTypeElement())); return tgt; } @@ -215,7 +230,7 @@ public class Patient10_30 { if (src.hasOther()) tgt.setOther(VersionConvertor_10_30.convertReference(src.getOther())); if (src.hasType()) - tgt.setType(convertLinkType(src.getType())); + tgt.setTypeElement(convertLinkType(src.getTypeElement())); return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Person10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Person10_30.java index 583634759..edad119ff 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Person10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Person10_30.java @@ -5,38 +5,54 @@ import org.hl7.fhir.exceptions.FHIRException; public class Person10_30 { - public static org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertIdentityAssuranceLevel(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevelEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case LEVEL1: - return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL1; + tgt.setValue(org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL1); + break; case LEVEL2: - return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL2; + tgt.setValue(org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL2); + break; case LEVEL3: - return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL3; + tgt.setValue(org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL3); + break; case LEVEL4: - return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL4; + tgt.setValue(org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL4); + break; default: - return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertIdentityAssuranceLevel(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevelEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case LEVEL1: - return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL1; + tgt.setValue(org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL1); + break; case LEVEL2: - return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL2; + tgt.setValue(org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL2); + break; case LEVEL3: - return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL3; + tgt.setValue(org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL3); + break; case LEVEL4: - return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL4; + tgt.setValue(org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL4); + break; default: - return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu3.model.Person convertPerson(org.hl7.fhir.dstu2.model.Person src) throws FHIRException { @@ -93,7 +109,7 @@ public class Person10_30 { if (src.hasTarget()) tgt.setTarget(VersionConvertor_10_30.convertReference(src.getTarget())); if (src.hasAssurance()) - tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + tgt.setAssuranceElement(convertIdentityAssuranceLevel(src.getAssuranceElement())); return tgt; } @@ -105,7 +121,7 @@ public class Person10_30 { if (src.hasTarget()) tgt.setTarget(VersionConvertor_10_30.convertReference(src.getTarget())); if (src.hasAssurance()) - tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + tgt.setAssuranceElement(convertIdentityAssuranceLevel(src.getAssuranceElement())); return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Procedure10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Procedure10_30.java index 88cb9a85d..9dd6ac963 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Procedure10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Procedure10_30.java @@ -14,7 +14,7 @@ public class Procedure10_30 { if (src.hasSubject()) tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); if (src.hasStatus()) - tgt.setStatus(convertProcedureStatus(src.getStatus())); + tgt.setStatusElement(convertProcedureStatus(src.getStatusElement())); if (src.hasCategory()) tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); if (src.hasCode()) @@ -53,7 +53,7 @@ public class Procedure10_30 { if (src.hasSubject()) tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); if (src.hasStatus()) - tgt.setStatus(convertProcedureStatus(src.getStatus())); + tgt.setStatusElement(convertProcedureStatus(src.getStatusElement())); if (src.hasCategory()) tgt.setCategory(VersionConvertor_10_30.convertCodeableConcept(src.getCategory())); if (src.hasCode()) @@ -131,37 +131,53 @@ public class Procedure10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertProcedureStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Procedure.ProcedureStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case INPROGRESS: - return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.INPROGRESS; + tgt.setValue(org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.INPROGRESS); + break; case ABORTED: - return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.ABORTED; + tgt.setValue(org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.ABORTED); + break; case COMPLETED: - return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.COMPLETED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.ENTEREDINERROR); + break; default: - return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertProcedureStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Procedure.ProcedureStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case INPROGRESS: - return org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.INPROGRESS; + tgt.setValue(org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.INPROGRESS); + break; case ABORTED: - return org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.ABORTED; + tgt.setValue(org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.ABORTED); + break; case COMPLETED: - return org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.COMPLETED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.ENTEREDINERROR); + break; default: - return org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Procedure.ProcedureStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ProcedureRequest10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ProcedureRequest10_30.java index 4f8219dd6..6e07b8585 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ProcedureRequest10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ProcedureRequest10_30.java @@ -25,13 +25,13 @@ public class ProcedureRequest10_30 { if (src.hasPerformer()) tgt.setPerformer(VersionConvertor_10_30.convertReference(src.getPerformer())); if (src.hasStatus()) - tgt.setStatus(convertProcedureRequestStatus(src.getStatus())); + tgt.setStatusElement(convertProcedureRequestStatus(src.getStatusElement())); if (src.hasAsNeeded()) tgt.setAsNeeded(VersionConvertor_10_30.convertType(src.getAsNeeded())); if (src.hasOrderedOnElement()) tgt.setAuthoredOnElement(VersionConvertor_10_30.convertDateTime(src.getOrderedOnElement())); if (src.hasPriority()) - tgt.setPriority(convertProcedureRequestPriority(src.getPriority())); + tgt.setPriorityElement(convertProcedureRequestPriority(src.getPriorityElement())); return tgt; } @@ -55,93 +55,131 @@ public class ProcedureRequest10_30 { if (src.hasPerformer()) tgt.setPerformer(VersionConvertor_10_30.convertReference(src.getPerformer())); if (src.hasStatus()) - tgt.setStatus(convertProcedureRequestStatus(src.getStatus())); + tgt.setStatusElement(convertProcedureRequestStatus(src.getStatusElement())); if (src.hasAsNeeded()) tgt.setAsNeeded(VersionConvertor_10_30.convertType(src.getAsNeeded())); if (src.hasAuthoredOnElement()) tgt.setOrderedOnElement(VersionConvertor_10_30.convertDateTime(src.getAuthoredOnElement())); if (src.hasPriority()) - tgt.setPriority(convertProcedureRequestPriority(src.getPriority())); + tgt.setPriorityElement(convertProcedureRequestPriority(src.getPriorityElement())); return tgt; } - public static org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertProcedureRequestPriority(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriorityEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ROUTINE: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE; + tgt.setValue(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE); + break; case URGENT: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.URGENT; + tgt.setValue(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.URGENT); + break; case STAT: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.STAT; + tgt.setValue(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.STAT); + break; case ASAP: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.ASAP; + tgt.setValue(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.ASAP); + break; default: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertProcedureRequestPriority(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriorityEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case ROUTINE: - return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE; + tgt.setValue(org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE); + break; case URGENT: - return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.URGENT; + tgt.setValue(org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.URGENT); + break; case STAT: - return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.STAT; + tgt.setValue(org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.STAT); + break; case ASAP: - return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.ASAP; + tgt.setValue(org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.ASAP); + break; default: - return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestPriority.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus convertProcedureRequestStatus(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertProcedureRequestStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case DRAFT: - return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.DRAFT; + tgt.setValue(org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.DRAFT); + break; case ACTIVE: - return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.INPROGRESS; + tgt.setValue(org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.INPROGRESS); + break; case COMPLETED: - return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.COMPLETED); + break; case SUSPENDED: - return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.SUSPENDED; + tgt.setValue(org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.SUSPENDED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.ABORTED; + tgt.setValue(org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.ABORTED); + break; default: - return org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus convertProcedureRequestStatus(org.hl7.fhir.dstu2.model.ProcedureRequest.ProcedureRequestStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertProcedureRequestStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PROPOSED: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.DRAFT; + tgt.setValue(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.DRAFT); + break; case DRAFT: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.DRAFT; + tgt.setValue(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.DRAFT); + break; case REQUESTED: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE); + break; case RECEIVED: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE); + break; case ACCEPTED: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE); + break; case INPROGRESS: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE); + break; case COMPLETED: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.COMPLETED); + break; case SUSPENDED: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.SUSPENDED; + tgt.setValue(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.SUSPENDED); + break; case ABORTED: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ENTEREDINERROR); + break; default: - return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Provenance10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Provenance10_30.java index 7f45bf398..ea7ee85b4 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Provenance10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Provenance10_30.java @@ -73,7 +73,7 @@ public class Provenance10_30 { org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasRole()) - tgt.setRole(convertProvenanceEntityRole(src.getRole())); + tgt.setRoleElement(convertProvenanceEntityRole(src.getRoleElement())); if (src.hasWhatReference() && src.getWhatReference().hasReference()) tgt.setReference(src.getWhatReference().getReference()); for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) tgt.setAgent(convertProvenanceAgentComponent(t)); @@ -86,7 +86,7 @@ public class Provenance10_30 { org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasRole()) - tgt.setRole(convertProvenanceEntityRole(src.getRole())); + tgt.setRoleElement(convertProvenanceEntityRole(src.getRoleElement())); if (src.hasReference()) tgt.setWhat(new org.hl7.fhir.dstu3.model.Reference().setReference(src.getReference())); if (src.hasAgent()) @@ -94,37 +94,53 @@ public class Provenance10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertProvenanceEntityRole(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRoleEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case DERIVATION: - return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.DERIVATION; + tgt.setValue(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.DERIVATION); + break; case REVISION: - return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.REVISION; + tgt.setValue(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.REVISION); + break; case QUOTATION: - return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.QUOTATION; + tgt.setValue(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.QUOTATION); + break; case SOURCE: - return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.SOURCE; + tgt.setValue(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.SOURCE); + break; default: - return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertProvenanceEntityRole(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRoleEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case DERIVATION: - return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.DERIVATION; + tgt.setValue(org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.DERIVATION); + break; case REVISION: - return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.REVISION; + tgt.setValue(org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.REVISION); + break; case QUOTATION: - return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.QUOTATION; + tgt.setValue(org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.QUOTATION); + break; case SOURCE: - return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.SOURCE; + tgt.setValue(org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.SOURCE); + break; default: - return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Questionnaire10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Questionnaire10_30.java index 22a61cdd0..b803d85ce 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Questionnaire10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Questionnaire10_30.java @@ -15,7 +15,7 @@ public class Questionnaire10_30 { if (src.hasVersionElement()) tgt.setVersionElement(VersionConvertor_10_30.convertString(src.getVersionElement())); if (src.hasStatus()) - tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + tgt.setStatusElement(convertQuestionnaireStatus(src.getStatusElement())); if (src.hasDate()) tgt.setDateElement(VersionConvertor_10_30.convertDateTime(src.getDateElement())); if (src.hasPublisherElement()) @@ -43,7 +43,7 @@ public class Questionnaire10_30 { if (src.hasVersionElement()) tgt.setVersionElement(VersionConvertor_10_30.convertString(src.getVersionElement())); if (src.hasStatus()) - tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + tgt.setStatusElement(convertQuestionnaireStatus(src.getStatusElement())); if (src.hasDate()) tgt.setDateElement(VersionConvertor_10_30.convertDateTime(src.getDateElement())); if (src.hasPublisherElement()) @@ -107,41 +107,59 @@ public class Questionnaire10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat convertQuestionnaireItemType(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertQuestionnaireItemType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormatEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case BOOLEAN: - return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.BOOLEAN; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.BOOLEAN); + break; case DECIMAL: - return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DECIMAL; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DECIMAL); + break; case INTEGER: - return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.INTEGER; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.INTEGER); + break; case DATE: - return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATE; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATE); + break; case DATETIME: - return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATETIME; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATETIME); + break; case TIME: - return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TIME; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TIME); + break; case STRING: - return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.STRING; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.STRING); + break; case TEXT: - return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TEXT; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TEXT); + break; case URL: - return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.URL; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.URL); + break; case CHOICE: - return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.CHOICE; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.CHOICE); + break; case OPENCHOICE: - return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.OPENCHOICE; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.OPENCHOICE); + break; case ATTACHMENT: - return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.ATTACHMENT; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.ATTACHMENT); + break; case REFERENCE: - return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.REFERENCE; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.REFERENCE); + break; case QUANTITY: - return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.QUANTITY; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.QUANTITY); + break; default: - return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent src) throws FHIRException { @@ -155,7 +173,7 @@ public class Questionnaire10_30 { if (src.hasTextElement()) tgt.setTextElement(VersionConvertor_10_30.convertString(src.getTextElement())); if (src.hasType()) - tgt.setType(convertQuestionnaireQuestionType(src.getType())); + tgt.setTypeElement(convertQuestionnaireQuestionType(src.getTypeElement())); if (src.hasRequiredElement()) tgt.setRequiredElement(VersionConvertor_10_30.convertBoolean(src.getRequiredElement())); if (src.hasRepeatsElement()) @@ -178,7 +196,7 @@ public class Questionnaire10_30 { if (src.hasTextElement()) tgt.setTextElement(VersionConvertor_10_30.convertString(src.getTextElement())); if (src.hasType()) - tgt.setType(convertQuestionnaireItemType(src.getType())); + tgt.setTypeElement(convertQuestionnaireItemType(src.getTypeElement())); if (src.hasRequiredElement()) tgt.setRequiredElement(VersionConvertor_10_30.convertBoolean(src.getRequiredElement())); if (src.hasRepeatsElement()) @@ -195,72 +213,105 @@ public class Questionnaire10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType convertQuestionnaireQuestionType(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertQuestionnaireQuestionType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case BOOLEAN: - return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.BOOLEAN); + break; case DECIMAL: - return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DECIMAL; + tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DECIMAL); + break; case INTEGER: - return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.INTEGER; + tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.INTEGER); + break; case DATE: - return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATE; + tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATE); + break; case DATETIME: - return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; + tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME); + break; case INSTANT: - return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; + tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME); + break; case TIME: - return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TIME; + tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TIME); + break; case STRING: - return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.STRING; + tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.STRING); + break; case TEXT: - return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TEXT; + tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TEXT); + break; case URL: - return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.URL; + tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.URL); + break; case CHOICE: - return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.CHOICE; + tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.CHOICE); + break; case OPENCHOICE: - return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.OPENCHOICE); + break; case ATTACHMENT: - return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.ATTACHMENT); + break; case REFERENCE: - return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.REFERENCE; + tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.REFERENCE); + break; case QUANTITY: - return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUANTITY; + tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUANTITY); + break; default: - return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL); + break; } + return tgt; } - static public org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertQuestionnaireStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case DRAFT: - return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.DRAFT; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.DRAFT); + break; case ACTIVE: - return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.PUBLISHED; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.PUBLISHED); + break; case RETIRED: - return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.RETIRED; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.RETIRED); + break; default: - return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.NULL); + break; } + return tgt; } - static public org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertQuestionnaireStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.PublicationStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case DRAFT: - return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT; + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT); + break; case PUBLISHED: - return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE); + break; case RETIRED: - return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED; + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED); + break; default: - return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/QuestionnaireResponse10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/QuestionnaireResponse10_30.java index 668d10688..e489516a0 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/QuestionnaireResponse10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/QuestionnaireResponse10_30.java @@ -46,7 +46,7 @@ public class QuestionnaireResponse10_30 { if (src.hasQuestionnaire()) tgt.setQuestionnaire(VersionConvertor_10_30.convertReference(src.getQuestionnaire())); if (src.hasStatus()) - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setStatusElement(convertQuestionnaireResponseStatus(src.getStatusElement())); if (src.hasSubject()) tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); if (src.hasAuthor()) @@ -73,7 +73,7 @@ public class QuestionnaireResponse10_30 { if (src.hasQuestionnaire()) tgt.setQuestionnaire(VersionConvertor_10_30.convertReference(src.getQuestionnaire())); if (src.hasStatus()) - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setStatusElement(convertQuestionnaireResponseStatus(src.getStatusElement())); if (src.hasSubject()) tgt.setSubject(VersionConvertor_10_30.convertReference(src.getSubject())); if (src.hasAuthor()) @@ -140,33 +140,47 @@ public class QuestionnaireResponse10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertQuestionnaireResponseStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case INPROGRESS: - return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + tgt.setValue(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS); + break; case COMPLETED: - return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED); + break; case AMENDED: - return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + tgt.setValue(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED); + break; default: - return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertQuestionnaireResponseStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case INPROGRESS: - return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + tgt.setValue(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS); + break; case COMPLETED: - return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED); + break; case AMENDED: - return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + tgt.setValue(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED); + break; default: - return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ReferralRequest10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ReferralRequest10_30.java index f0ac844af..a76d30a1c 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ReferralRequest10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ReferralRequest10_30.java @@ -49,7 +49,7 @@ public class ReferralRequest10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasStatus()) - tgt.setStatus(convertReferralStatus(src.getStatus())); + tgt.setStatusElement(convertReferralStatus(src.getStatusElement())); if (src.hasType()) tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); if (src.hasPriority()) @@ -77,7 +77,7 @@ public class ReferralRequest10_30 { VersionConvertor_10_30.copyDomainResource(src, tgt); for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t)); if (src.hasStatus()) - tgt.setStatus(convertReferralStatus(src.getStatus())); + tgt.setStatusElement(convertReferralStatus(src.getStatusElement())); if (src.hasType()) tgt.setType(VersionConvertor_10_30.convertCodeableConcept(src.getType())); if (src.hasPriority()) @@ -99,45 +99,65 @@ public class ReferralRequest10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus convertReferralStatus(org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertReferralStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case DRAFT: - return org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.DRAFT; + tgt.setValue(org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.DRAFT); + break; case ACTIVE: - return org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.ACTIVE); + break; case CANCELLED: - return org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.CANCELLED; + tgt.setValue(org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.CANCELLED); + break; case COMPLETED: - return org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.COMPLETED); + break; case ENTEREDINERROR: - return org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.REJECTED; + tgt.setValue(org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.REJECTED); + break; default: - return org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus convertReferralStatus(org.hl7.fhir.dstu2.model.ReferralRequest.ReferralStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertReferralStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case DRAFT: - return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.DRAFT; + tgt.setValue(org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.DRAFT); + break; case REQUESTED: - return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.DRAFT; + tgt.setValue(org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.DRAFT); + break; case ACTIVE: - return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.ACTIVE); + break; case CANCELLED: - return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.CANCELLED; + tgt.setValue(org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.CANCELLED); + break; case ACCEPTED: - return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.ACTIVE); + break; case REJECTED: - return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.ENTEREDINERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.ENTEREDINERROR); + break; case COMPLETED: - return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.COMPLETED); + break; default: - return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/SearchParameter10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/SearchParameter10_30.java index af7df000d..3ddb59bbc 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/SearchParameter10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/SearchParameter10_30.java @@ -37,7 +37,7 @@ public class SearchParameter10_30 { if (src.hasXpathElement()) tgt.setXpathElement(VersionConvertor_10_30.convertString(src.getXpathElement())); if (src.hasXpathUsage()) - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + tgt.setXpathUsageElement(convertXPathUsageType(src.getXpathUsageElement())); for (org.hl7.fhir.dstu3.model.CodeType t : src.getTarget()) tgt.addTarget(t.getValue()); return tgt; } @@ -73,7 +73,7 @@ public class SearchParameter10_30 { if (src.hasXpathElement()) tgt.setXpathElement(VersionConvertor_10_30.convertString(src.getXpathElement())); if (src.hasXpathUsage()) - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + tgt.setXpathUsageElement(convertXPathUsageType(src.getXpathUsageElement())); for (org.hl7.fhir.dstu2.model.CodeType t : src.getTarget()) tgt.addTarget(t.getValue()); return tgt; } @@ -100,41 +100,59 @@ public class SearchParameter10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertXPathUsageType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case NORMAL: - return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NORMAL; + tgt.setValue(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NORMAL); + break; case PHONETIC: - return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.PHONETIC; + tgt.setValue(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.PHONETIC); + break; case NEARBY: - return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NEARBY; + tgt.setValue(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NEARBY); + break; case DISTANCE: - return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.DISTANCE; + tgt.setValue(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.DISTANCE); + break; case OTHER: - return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.OTHER; + tgt.setValue(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.OTHER); + break; default: - return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertXPathUsageType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case NORMAL: - return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL; + tgt.setValue(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL); + break; case PHONETIC: - return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.PHONETIC; + tgt.setValue(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.PHONETIC); + break; case NEARBY: - return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NEARBY; + tgt.setValue(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NEARBY); + break; case DISTANCE: - return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.DISTANCE; + tgt.setValue(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.DISTANCE); + break; case OTHER: - return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.OTHER; + tgt.setValue(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.OTHER); + break; default: - return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/StructureDefinition10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/StructureDefinition10_30.java index f17abab51..e2e257fc2 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/StructureDefinition10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/StructureDefinition10_30.java @@ -2,7 +2,6 @@ package org.hl7.fhir.convertors.conv10_30; import java.util.ArrayList; import java.util.List; - import org.hl7.fhir.convertors.VersionConvertor_10_30; import org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule; @@ -11,34 +10,48 @@ import org.hl7.fhir.utilities.Utilities; public class StructureDefinition10_30 { - public static org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertExtensionContext(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContextEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case RESOURCE: - return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; + tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE); + break; case DATATYPE: - return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE; + tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE); + break; case EXTENSION: - return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION; + tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION); + break; default: - return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertExtensionContext(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContextEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case RESOURCE: - return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE; + tgt.setValue(org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE); + break; case DATATYPE: - return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.DATATYPE; + tgt.setValue(org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.DATATYPE); + break; case EXTENSION: - return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.EXTENSION; + tgt.setValue(org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.EXTENSION); + break; default: - return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu2.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException { @@ -78,11 +91,11 @@ public class StructureDefinition10_30 { tgt.setFhirVersionElement(VersionConvertor_10_30.convertId(src.getFhirVersionElement())); for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); if (src.hasKind()) - tgt.setKind(convertStructureDefinitionKind(src.getKind())); + tgt.setKindElement(convertStructureDefinitionKind(src.getKindElement())); if (src.hasAbstractElement()) tgt.setAbstractElement(VersionConvertor_10_30.convertBoolean(src.getAbstractElement())); if (src.hasContextType()) - tgt.setContextType(convertExtensionContext(src.getContextType())); + tgt.setContextTypeElement(convertExtensionContext(src.getContextTypeElement())); for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) tgt.addContext(t.getValue()); if (src.hasTypeElement()) tgt.setConstrainedTypeElement(VersionConvertor_10_30.convertCode(src.getTypeElement())); @@ -139,11 +152,11 @@ public class StructureDefinition10_30 { tgt.setFhirVersionElement(VersionConvertor_10_30.convertId(src.getFhirVersionElement())); for (org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); if (src.hasKind()) - tgt.setKind(convertStructureDefinitionKind(src.getKind(), tgt.getId())); + tgt.setKindElement(convertStructureDefinitionKind(src.getKindElement(), tgt.getId())); if (src.hasAbstractElement()) tgt.setAbstractElement(VersionConvertor_10_30.convertBoolean(src.getAbstractElement())); if (src.hasContextType()) - tgt.setContextType(convertExtensionContext(src.getContextType())); + tgt.setContextTypeElement(convertExtensionContext(src.getContextTypeElement())); for (org.hl7.fhir.dstu2.model.StringType t : src.getContext()) tgt.addContext(t.getValue()); if (src.hasConstrainedType()) tgt.setTypeElement(VersionConvertor_10_30.convertCode(src.getConstrainedTypeElement())); @@ -217,39 +230,56 @@ public class StructureDefinition10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKindEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case PRIMITIVETYPE: - return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + tgt.setValue(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE); + break; case COMPLEXTYPE: - return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + tgt.setValue(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE); + break; case RESOURCE: - return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + tgt.setValue(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.RESOURCE); + break; case LOGICAL: - return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + tgt.setValue(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.LOGICAL); + break; default: - return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind src, String dtName) throws FHIRException { - if (src == null) + public static org.hl7.fhir.dstu3.model.Enumeration convertStructureDefinitionKind(org.hl7.fhir.dstu2.model.Enumeration src, String dtName) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKindEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case DATATYPE: - if (Utilities.existsInList(dtName, "boolean", "integer", "decimal", "base64Binary", "instant", "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", "positiveInt", "markdown", "xhtml", "url", "canonical")) - return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; + if (Utilities.existsInList(dtName, "boolean", "integer", "decimal", "base64Binary", "instant", + "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", + "positiveInt", "markdown", "xhtml", "url", "canonical")) + tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE); else - return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE); + break; case RESOURCE: - return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.RESOURCE); + break; case LOGICAL: - return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.LOGICAL); + break; default: - return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Subscription10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Subscription10_30.java index d09a857d0..42dff4a14 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Subscription10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Subscription10_30.java @@ -16,7 +16,7 @@ public class Subscription10_30 { if (src.hasReasonElement()) tgt.setReasonElement(VersionConvertor_10_30.convertString(src.getReasonElement())); if (src.hasStatus()) - tgt.setStatus(convertSubscriptionStatus(src.getStatus())); + tgt.setStatusElement(convertSubscriptionStatus(src.getStatusElement())); if (src.hasErrorElement()) tgt.setErrorElement(VersionConvertor_10_30.convertString(src.getErrorElement())); if (src.hasChannel()) @@ -38,7 +38,7 @@ public class Subscription10_30 { if (src.hasReasonElement()) tgt.setReasonElement(VersionConvertor_10_30.convertString(src.getReasonElement())); if (src.hasStatus()) - tgt.setStatus(convertSubscriptionStatus(src.getStatus())); + tgt.setStatusElement(convertSubscriptionStatus(src.getStatusElement())); if (src.hasErrorElement()) tgt.setErrorElement(VersionConvertor_10_30.convertString(src.getErrorElement())); if (src.hasChannel()) @@ -55,7 +55,7 @@ public class Subscription10_30 { org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasType()) - tgt.setType(convertSubscriptionChannelType(src.getType())); + tgt.setTypeElement(convertSubscriptionChannelType(src.getTypeElement())); if (src.hasEndpointElement()) tgt.setEndpointElement(VersionConvertor_10_30.convertUri(src.getEndpointElement())); if (src.hasPayloadElement()) @@ -71,7 +71,7 @@ public class Subscription10_30 { org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasType()) - tgt.setType(convertSubscriptionChannelType(src.getType())); + tgt.setTypeElement(convertSubscriptionChannelType(src.getTypeElement())); if (src.hasEndpointElement()) tgt.setEndpointElement(VersionConvertor_10_30.convertUri(src.getEndpointElement())); if (src.hasPayloadElement()) @@ -80,75 +80,109 @@ public class Subscription10_30 { return tgt; } - public static org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertSubscriptionChannelType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case RESTHOOK: - return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.RESTHOOK; + tgt.setValue(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.RESTHOOK); + break; case WEBSOCKET: - return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.WEBSOCKET; + tgt.setValue(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.WEBSOCKET); + break; case EMAIL: - return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.EMAIL; + tgt.setValue(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.EMAIL); + break; case SMS: - return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.SMS; + tgt.setValue(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.SMS); + break; case MESSAGE: - return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.MESSAGE; + tgt.setValue(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.MESSAGE); + break; default: - return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertSubscriptionChannelType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case RESTHOOK: - return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK; + tgt.setValue(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK); + break; case WEBSOCKET: - return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET; + tgt.setValue(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET); + break; case EMAIL: - return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.EMAIL; + tgt.setValue(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.EMAIL); + break; case SMS: - return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.SMS; + tgt.setValue(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.SMS); + break; case MESSAGE: - return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.MESSAGE; + tgt.setValue(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.MESSAGE); + break; default: - return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertSubscriptionStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case REQUESTED: - return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.REQUESTED; + tgt.setValue(org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.REQUESTED); + break; case ACTIVE: - return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ACTIVE); + break; case ERROR: - return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ERROR; + tgt.setValue(org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ERROR); + break; case OFF: - return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.OFF; + tgt.setValue(org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.OFF); + break; default: - return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertSubscriptionStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case REQUESTED: - return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.REQUESTED; + tgt.setValue(org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.REQUESTED); + break; case ACTIVE: - return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.ACTIVE; + tgt.setValue(org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.ACTIVE); + break; case ERROR: - return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.ERROR; + tgt.setValue(org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.ERROR); + break; case OFF: - return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.OFF; + tgt.setValue(org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.OFF); + break; default: - return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/SupplyDelivery10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/SupplyDelivery10_30.java index 24f23a2a1..a597c0824 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/SupplyDelivery10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/SupplyDelivery10_30.java @@ -13,7 +13,7 @@ public class SupplyDelivery10_30 { if (src.hasIdentifier()) tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); if (src.hasStatus()) - tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + tgt.setStatusElement(convertSupplyDeliveryStatus(src.getStatusElement())); if (src.hasPatient()) tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); if (src.hasType()) @@ -34,7 +34,7 @@ public class SupplyDelivery10_30 { if (src.hasIdentifier()) tgt.setIdentifier(VersionConvertor_10_30.convertIdentifier(src.getIdentifier())); if (src.hasStatus()) - tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + tgt.setStatusElement(convertSupplyDeliveryStatus(src.getStatusElement())); if (src.hasPatient()) tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient())); if (src.hasType()) @@ -47,33 +47,47 @@ public class SupplyDelivery10_30 { return tgt; } - public static org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertSupplyDeliveryStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case INPROGRESS: - return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + tgt.setValue(org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS); + break; case COMPLETED: - return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED); + break; case ABANDONED: - return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + tgt.setValue(org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED); + break; default: - return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertSupplyDeliveryStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case INPROGRESS: - return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + tgt.setValue(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS); + break; case COMPLETED: - return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + tgt.setValue(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED); + break; case ABANDONED: - return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + tgt.setValue(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED); + break; default: - return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.NULL); + break; } + return tgt; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/TestScript10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/TestScript10_30.java index 64da3b306..5e571faab 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/TestScript10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/TestScript10_30.java @@ -5,180 +5,264 @@ import org.hl7.fhir.exceptions.FHIRException; public class TestScript10_30 { - public static org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertAssertionDirectionType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case RESPONSE: - return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.RESPONSE; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.RESPONSE); + break; case REQUEST: - return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.REQUEST; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.REQUEST); + break; default: - return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertAssertionDirectionType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case RESPONSE: - return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.RESPONSE; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.RESPONSE); + break; case REQUEST: - return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.REQUEST; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.REQUEST); + break; default: - return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertAssertionOperatorType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case EQUALS: - return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EQUALS; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EQUALS); + break; case NOTEQUALS: - return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEQUALS; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEQUALS); + break; case IN: - return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.IN; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.IN); + break; case NOTIN: - return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTIN; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTIN); + break; case GREATERTHAN: - return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.GREATERTHAN; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.GREATERTHAN); + break; case LESSTHAN: - return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.LESSTHAN; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.LESSTHAN); + break; case EMPTY: - return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EMPTY; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EMPTY); + break; case NOTEMPTY: - return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEMPTY; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEMPTY); + break; case CONTAINS: - return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.CONTAINS; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.CONTAINS); + break; case NOTCONTAINS: - return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTCONTAINS; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTCONTAINS); + break; default: - return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertAssertionOperatorType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case EQUALS: - return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EQUALS; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EQUALS); + break; case NOTEQUALS: - return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEQUALS; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEQUALS); + break; case IN: - return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.IN; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.IN); + break; case NOTIN: - return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTIN; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTIN); + break; case GREATERTHAN: - return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.GREATERTHAN; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.GREATERTHAN); + break; case LESSTHAN: - return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.LESSTHAN; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.LESSTHAN); + break; case EMPTY: - return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EMPTY; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EMPTY); + break; case NOTEMPTY: - return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEMPTY; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEMPTY); + break; case CONTAINS: - return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.CONTAINS; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.CONTAINS); + break; case NOTCONTAINS: - return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTCONTAINS; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTCONTAINS); + break; default: - return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertAssertionResponseTypes(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypesEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case OKAY: - return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.OKAY; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.OKAY); + break; case CREATED: - return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CREATED; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CREATED); + break; case NOCONTENT: - return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOCONTENT; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOCONTENT); + break; case NOTMODIFIED: - return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTMODIFIED); + break; case BAD: - return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.BAD; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.BAD); + break; case FORBIDDEN: - return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.FORBIDDEN; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.FORBIDDEN); + break; case NOTFOUND: - return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTFOUND; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTFOUND); + break; case METHODNOTALLOWED: - return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED); + break; case CONFLICT: - return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CONFLICT; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CONFLICT); + break; case GONE: - return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.GONE; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.GONE); + break; case PRECONDITIONFAILED: - return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED); + break; case UNPROCESSABLE: - return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.UNPROCESSABLE); + break; default: - return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertAssertionResponseTypes(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypesEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case OKAY: - return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.OKAY; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.OKAY); + break; case CREATED: - return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CREATED; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CREATED); + break; case NOCONTENT: - return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOCONTENT; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOCONTENT); + break; case NOTMODIFIED: - return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTMODIFIED); + break; case BAD: - return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.BAD; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.BAD); + break; case FORBIDDEN: - return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.FORBIDDEN; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.FORBIDDEN); + break; case NOTFOUND: - return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTFOUND; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTFOUND); + break; case METHODNOTALLOWED: - return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED); + break; case CONFLICT: - return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CONFLICT; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CONFLICT); + break; case GONE: - return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.GONE; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.GONE); + break; case PRECONDITIONFAILED: - return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED); + break; case UNPROCESSABLE: - return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.UNPROCESSABLE); + break; default: - return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.TestScript.ContentType convertContentType(org.hl7.fhir.dstu3.model.TestScript.ContentType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertContentType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.TestScript.ContentTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case XML: - return org.hl7.fhir.dstu2.model.TestScript.ContentType.XML; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.ContentType.XML); + break; case JSON: - return org.hl7.fhir.dstu2.model.TestScript.ContentType.JSON; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.ContentType.JSON); + break; default: - return org.hl7.fhir.dstu2.model.TestScript.ContentType.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.ContentType.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu3.model.TestScript.ContentType convertContentType(org.hl7.fhir.dstu2.model.TestScript.ContentType src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertContentType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.TestScript.ContentTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case XML: - return org.hl7.fhir.dstu3.model.TestScript.ContentType.XML; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.ContentType.XML); + break; case JSON: - return org.hl7.fhir.dstu3.model.TestScript.ContentType.JSON; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.ContentType.JSON); + break; default: - return org.hl7.fhir.dstu3.model.TestScript.ContentType.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.TestScript.ContentType.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent src) throws FHIRException { @@ -191,13 +275,13 @@ public class TestScript10_30 { if (src.hasDescriptionElement()) tgt.setDescriptionElement(VersionConvertor_10_30.convertString(src.getDescriptionElement())); if (src.hasDirection()) - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + tgt.setDirectionElement(convertAssertionDirectionType(src.getDirectionElement())); if (src.hasCompareToSourceIdElement()) tgt.setCompareToSourceIdElement(VersionConvertor_10_30.convertString(src.getCompareToSourceIdElement())); if (src.hasCompareToSourcePathElement()) tgt.setCompareToSourcePathElement(VersionConvertor_10_30.convertString(src.getCompareToSourcePathElement())); if (src.hasContentType()) - tgt.setContentType(convertContentType(src.getContentType())); + tgt.setContentTypeElement(convertContentType(src.getContentTypeElement())); if (src.hasHeaderFieldElement()) tgt.setHeaderFieldElement(VersionConvertor_10_30.convertString(src.getHeaderFieldElement())); if (src.hasMinimumIdElement()) @@ -205,13 +289,13 @@ public class TestScript10_30 { if (src.hasNavigationLinksElement()) tgt.setNavigationLinksElement(VersionConvertor_10_30.convertBoolean(src.getNavigationLinksElement())); if (src.hasOperator()) - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + tgt.setOperatorElement(convertAssertionOperatorType(src.getOperatorElement())); if (src.hasPathElement()) tgt.setPathElement(VersionConvertor_10_30.convertString(src.getPathElement())); if (src.hasResourceElement()) tgt.setResourceElement(VersionConvertor_10_30.convertCode(src.getResourceElement())); if (src.hasResponse()) - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + tgt.setResponseElement(convertAssertionResponseTypes(src.getResponseElement())); if (src.hasResponseCodeElement()) tgt.setResponseCodeElement(VersionConvertor_10_30.convertString(src.getResponseCodeElement())); if (src.hasSourceIdElement()) @@ -235,13 +319,13 @@ public class TestScript10_30 { if (src.hasDescriptionElement()) tgt.setDescriptionElement(VersionConvertor_10_30.convertString(src.getDescriptionElement())); if (src.hasDirection()) - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + tgt.setDirectionElement(convertAssertionDirectionType(src.getDirectionElement())); if (src.hasCompareToSourceIdElement()) tgt.setCompareToSourceIdElement(VersionConvertor_10_30.convertString(src.getCompareToSourceIdElement())); if (src.hasCompareToSourcePathElement()) tgt.setCompareToSourcePathElement(VersionConvertor_10_30.convertString(src.getCompareToSourcePathElement())); if (src.hasContentType()) - tgt.setContentType(convertContentType(src.getContentType())); + tgt.setContentTypeElement(convertContentType(src.getContentTypeElement())); if (src.hasHeaderFieldElement()) tgt.setHeaderFieldElement(VersionConvertor_10_30.convertString(src.getHeaderFieldElement())); if (src.hasMinimumIdElement()) @@ -249,13 +333,13 @@ public class TestScript10_30 { if (src.hasNavigationLinksElement()) tgt.setNavigationLinksElement(VersionConvertor_10_30.convertBoolean(src.getNavigationLinksElement())); if (src.hasOperator()) - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + tgt.setOperatorElement(convertAssertionOperatorType(src.getOperatorElement())); if (src.hasPathElement()) tgt.setPathElement(VersionConvertor_10_30.convertString(src.getPathElement())); if (src.hasResourceElement()) tgt.setResourceElement(VersionConvertor_10_30.convertCode(src.getResourceElement())); if (src.hasResponse()) - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + tgt.setResponseElement(convertAssertionResponseTypes(src.getResponseElement())); if (src.hasResponseCodeElement()) tgt.setResponseCodeElement(VersionConvertor_10_30.convertString(src.getResponseCodeElement())); if (src.hasSourceIdElement()) @@ -307,9 +391,9 @@ public class TestScript10_30 { if (src.hasDescriptionElement()) tgt.setDescriptionElement(VersionConvertor_10_30.convertString(src.getDescriptionElement())); if (src.hasAccept()) - tgt.setAccept(convertContentType(src.getAccept())); + tgt.setAcceptElement(convertContentType(src.getAcceptElement())); if (src.hasContentType()) - tgt.setContentType(convertContentType(src.getContentType())); + tgt.setContentTypeElement(convertContentType(src.getContentTypeElement())); if (src.hasDestinationElement()) tgt.setDestinationElement(VersionConvertor_10_30.convertInteger(src.getDestinationElement())); if (src.hasEncodeRequestUrlElement()) @@ -342,9 +426,9 @@ public class TestScript10_30 { if (src.hasDescriptionElement()) tgt.setDescriptionElement(VersionConvertor_10_30.convertString(src.getDescriptionElement())); if (src.hasAccept()) - tgt.setAccept(convertContentType(src.getAccept())); + tgt.setAcceptElement(convertContentType(src.getAcceptElement())); if (src.hasContentType()) - tgt.setContentType(convertContentType(src.getContentType())); + tgt.setContentTypeElement(convertContentType(src.getContentTypeElement())); if (src.hasDestinationElement()) tgt.setDestinationElement(VersionConvertor_10_30.convertInteger(src.getDestinationElement())); if (src.hasEncodeRequestUrlElement()) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ValueSet10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ValueSet10_30.java index c62ec2ebb..ffa6ac431 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ValueSet10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ValueSet10_30.java @@ -1,7 +1,6 @@ package org.hl7.fhir.convertors.conv10_30; import java.util.List; - import org.hl7.fhir.convertors.VersionConvertorAdvisor30; import org.hl7.fhir.convertors.VersionConvertor_10_30; import org.hl7.fhir.dstu2.model.ValueSet; @@ -103,7 +102,7 @@ public class ValueSet10_30 { if (src.hasPropertyElement()) tgt.setPropertyElement(VersionConvertor_10_30.convertCode(src.getPropertyElement())); if (src.hasOp()) - tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setOpElement(convertFilterOperator(src.getOpElement())); if (src.hasValueElement()) tgt.setValueElement(VersionConvertor_10_30.convertCode(src.getValueElement())); return tgt; @@ -117,52 +116,72 @@ public class ValueSet10_30 { if (src.hasPropertyElement()) tgt.setPropertyElement(VersionConvertor_10_30.convertCode(src.getPropertyElement())); if (src.hasOp()) - tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setOpElement(convertFilterOperator(src.getOpElement())); if (src.hasValueElement()) tgt.setValueElement(VersionConvertor_10_30.convertCode(src.getValueElement())); return tgt; } - public static org.hl7.fhir.dstu3.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu2.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu3.model.Enumeration convertFilterOperator(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ValueSet.FilterOperatorEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case EQUAL: - return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EQUAL; + tgt.setValue(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EQUAL); + break; case ISA: - return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISA; + tgt.setValue(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISA); + break; case ISNOTA: - return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISNOTA; + tgt.setValue(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISNOTA); + break; case REGEX: - return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.REGEX; + tgt.setValue(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.REGEX); + break; case IN: - return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.IN; + tgt.setValue(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.IN); + break; case NOTIN: - return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NOTIN; + tgt.setValue(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NOTIN); + break; default: - return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NULL; + tgt.setValue(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NULL); + break; } + return tgt; } - public static org.hl7.fhir.dstu2.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) + static public org.hl7.fhir.dstu2.model.Enumeration convertFilterOperator(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch(src) { + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ValueSet.FilterOperatorEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch(src.getValue()) { case EQUAL: - return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.EQUAL; + tgt.setValue(org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.EQUAL); + break; case ISA: - return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.ISA; + tgt.setValue(org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.ISA); + break; case ISNOTA: - return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.ISNOTA; + tgt.setValue(org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.ISNOTA); + break; case REGEX: - return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.REGEX; + tgt.setValue(org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.REGEX); + break; case IN: - return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.IN; + tgt.setValue(org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.IN); + break; case NOTIN: - return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.NOTIN; + tgt.setValue(org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.NOTIN); + break; default: - return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.NULL; + tgt.setValue(org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.NULL); + break; } + return tgt; } public static org.hl7.fhir.dstu3.model.ValueSet convertValueSet(org.hl7.fhir.dstu2.model.ValueSet src, VersionConvertorAdvisor30 advisor) throws FHIRException { diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/parser/ParserEnumeration.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/parser/ParserEnumeration.java new file mode 100644 index 000000000..fbfbc78d5 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/parser/ParserEnumeration.java @@ -0,0 +1,436 @@ +package org.hl7.fhir.convertors.parser; + +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.EnumDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.expr.MethodCallExpr; +import com.github.javaparser.ast.nodeTypes.NodeWithSimpleName; +import com.github.javaparser.ast.stmt.*; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import com.github.javaparser.ast.type.Type; +import com.github.javaparser.ast.visitor.ModifierVisitor; +import com.github.javaparser.ast.visitor.Visitable; +import com.github.javaparser.ast.visitor.VoidVisitor; +import com.github.javaparser.ast.visitor.VoidVisitorAdapter; +import com.github.javaparser.symbolsolver.JavaSymbolSolver; +import com.github.javaparser.symbolsolver.model.resolution.TypeSolver; +import com.github.javaparser.symbolsolver.model.typesystem.ReferenceTypeImpl; +import com.github.javaparser.symbolsolver.resolution.typesolvers.CombinedTypeSolver; +import com.github.javaparser.symbolsolver.resolution.typesolvers.JarTypeSolver; +import com.github.javaparser.symbolsolver.resolution.typesolvers.JavaParserTypeSolver; +import com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver; +import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.dstu3.model.MedicationRequest; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.Enumerations; + +import java.io.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class ParserEnumeration { + + public static final String ELEMENT = "Element"; + + private static final List VERSION_FILES = Arrays.asList("10_30", "10_40", "10_50", "14_30", "14_40", "14_50", "30_40", "30_50", "40_50"); + private static String MODEL_BASE_PATH = "/Users/markiantorno/Documents/Development/fhir/org.hl7.fhir.core/org.hl7.fhir.%1$s/src/main/java/"; + + public static HashMap> masterList = new HashMap<>(); + + public static final Set methodNames = new HashSet<>(); + + /* + * %1$s - dstu version src, example r5 + * %2$s - dstu version tgt, example dstu3 + * %3$s - src enum name, with enclosing class, if applicable, eg Account.AccountStatus + * %4$s - tgt enum name, with enclosing class, if applicable, eg Account.AccountStatus + * %5$s - version string, eg 10_30 + * %6$s - method name, eg convertAccountStatus + * %7$s - new switch statement body + */ + public static final String ENUM_TEMPLATE = "static public org.hl7.fhir.%2$s.model.Enumeration %6$s(org.hl7.fhir.%1$s.model.Enumeration src) throws FHIRException { " + + "if (src == null || src.isEmpty()) " + + "return null; " + + "org.hl7.fhir.%2$s.model.Enumeration tgt = new org.hl7.fhir.%2$s.model.Enumeration<>(new org.hl7.fhir.%2$s.model.%4$sEnumFactory()); " + + "VersionConvertor_%5$s.copyElement(src, tgt); " + + "%7$s" + + "return tgt;" + + "}"; + + /* + * %1$s - dstu version tgt, example dstu3 + * %2$s - tgt enum name, with enclosing class, if applicable, eg Account.AccountStatus + * %3$s - ENUM label, eg ACTIVE + */ + public static final String SWITCH_STATEMENT_TEMPLATE = "tgt.setValue(org.hl7.fhir.%1$s.model.%2$s.%3$s);"; + public static final String SWITCH_BREAK = " break;"; + +/** + * case ACTIVE: + * tgt.setValue(org.hl7.fhir.%2$s.model.%4$s.ACTIVE); + * break; + * case INACTIVE: + * tgt.setValue(org.hl7.fhir.%2$s.model.%4$s.INACTIVE); + * break; + * default: + * tgt.setValue(org.hl7.fhir.%2$s.model.%4$s.NULL); + * break; + */ + + public static void main(String[] args) { +// VERSION_FILES.forEach(version -> { + String version = "10_30"; + List filenames = listAllJavaFilesInDirectory(new File("").getAbsolutePath() + "/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv" + version + "/"); + //System.out.println("Checking the following files:"); + Collections.sort(filenames); + //filenames.forEach(System.out::println); + filenames.forEach(name -> { + try { + modifyEnumMethods("/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv" + version + "/", name, ".java", version); + modifyExpressionsCallingEnums("/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv" + version + "/", name, ".java", version); + methodNames.clear(); + } catch (Exception e) { + e.printStackTrace(); + } + }); +// }); + +// VERSION_FILES2.forEach(version -> { +// +// try { +// modifyEnumMethods("/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv" + "10_30" + "/", "Account10_30", ".java", "10_30"); +// modifyExpressionsCallingEnums("/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv" + "10_30" + "/", "Account10_30", ".java", "10_30"); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// +// }); + + } + + public static void modifyExpressionsCallingEnums(String srcdirectory, String filename, String extension, String version) { + String projectDirectory = new File("").getAbsolutePath(); + String filePathWithExtension = projectDirectory + srcdirectory + filename + extension; + CompilationUnit compilationUnit = getCompilationUnit(filePathWithExtension); + ClassOrInterfaceDeclaration classOrInterfaceDeclaration = initializeTypeSovlerAndParser(compilationUnit, + projectDirectory, srcdirectory, filename); + + List methods = classOrInterfaceDeclaration.getMethods(); + for (MethodDeclaration md : methods) { + md.accept(new ModifierVisitor() { + @Override + public Visitable visit(ExpressionStmt exp, Void arg) { + super.visit(exp, arg); + Optional methodNameOpt = methodNames.stream() + .filter(s -> exp.toString().contains(s + "(")) + .findFirst(); + if (methodNameOpt.isPresent()) { + try { + String outerName = ((MethodCallExpr) exp.getExpression()).getNameAsString(); + String innerName = ((MethodCallExpr) ((MethodCallExpr) ((MethodCallExpr) exp.getExpression()).getArgument(0)).getArgument(0)).getNameAsString(); + ((MethodCallExpr) exp.getExpression()).setName(outerName + ELEMENT); + ((MethodCallExpr) ((MethodCallExpr) ((MethodCallExpr) exp.getExpression()).getArgument(0)).getArgument(0)).setName(innerName + ELEMENT); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } + return exp; + } + }, null); + } + + try { + writeStringToFile(compilationUnit.toString(), filePathWithExtension); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void modifyEnumMethods(String srcdirectory, String filename, String extension, String version) { + String projectDirectory = new File("").getAbsolutePath(); + String filePathWithExtension = projectDirectory + srcdirectory + filename + extension; + CompilationUnit compilationUnit = getCompilationUnit(filePathWithExtension); + ClassOrInterfaceDeclaration classOrInterfaceDeclaration = initializeTypeSovlerAndParser(compilationUnit, + projectDirectory, srcdirectory, filename); + + classOrInterfaceDeclaration.accept(new ModifierVisitor() { + @Override + public Visitable visit(MethodDeclaration md, Void arg) { + super.visit(md, arg); + Optional src = md.getParameters().stream() + .filter(p -> p.getName().toString().equals("src")) + .findAny(); + + if ((md.getNameAsString().contains("convert")) && (src.isPresent()) && (md.getParameters().size() == 1)) { + + Type tgtType = md.getType(); + Type srcType = src.get().getType(); + + final EnumDeclaration toEnum = resolveEnumRefFromType(tgtType); + final EnumDeclaration fromEnum = resolveEnumRefFromType(srcType); + + if (toEnum != null && fromEnum != null) { + System.out.println("toEnum :: " + toEnum.getNameAsString()); + System.out.println("fromEnum :: " + fromEnum.getNameAsString()); + + String dstuVersionSrc = getVersionIdString(srcType.toString()); + String dstuVersionTgt = getVersionIdString(tgtType.toString()); + String classNameSrc = srcType.toString().substring(srcType.toString().indexOf("model.") + "model.".length()); + String classNameTgt = tgtType.toString().substring(tgtType.toString().indexOf("model.") + "model.".length()); + String methodName = md.getNameAsString(); + + methodNames.add(methodName); + + final String[] switchStatement = {"PARSING SWITCH DIDN'T WORK"}; + + md.accept(new VoidVisitorAdapter() { + @Override + public void visit(SwitchStmt n, Void arg) { + System.out.println(); + n.setSelector(StaticJavaParser.parseExpression("src.getValue()")); + for (SwitchEntry switchEntry : n.getEntries()) { + String enumLabel = switchEntry.getStatement(0).toString(); + enumLabel = enumLabel.substring(enumLabel.lastIndexOf('.') + 1, enumLabel.indexOf(';')); + + String switchStatement = String.format(SWITCH_STATEMENT_TEMPLATE, dstuVersionTgt, classNameTgt, enumLabel); + Statement statement = StaticJavaParser.parseStatement(switchStatement); + Statement breakStatement = StaticJavaParser.parseStatement(SWITCH_BREAK); + switchEntry.setStatement(0, statement); + switchEntry.addStatement(breakStatement); + } + switchStatement[0] = n.toString(); + } + }, null); + + String newMethodBody = String.format(ENUM_TEMPLATE, dstuVersionSrc, dstuVersionTgt, classNameSrc, classNameTgt, version, methodName, switchStatement[0]); + md = StaticJavaParser.parseMethodDeclaration(newMethodBody); + } + } + return md; + } + }, null); + + try { + writeStringToFile(compilationUnit.toString(), filePathWithExtension); + } catch (IOException e) { + e.printStackTrace(); + } + methodNames.forEach(System.out::println); + } + + public static EnumDeclaration resolveEnumRefFromType(Type type) { + if (!(type instanceof ClassOrInterfaceType)) { + return null; //throw new IllegalStateException("Type " + type.toString() + " is not instanceof ClassOrInterfaceType"); + } + + Optional optionalScope = ((ClassOrInterfaceType) type).getScope(); + try { + if (optionalScope.isPresent()) { + ClassOrInterfaceType classOrInterfaceType = optionalScope.get(); + EnumDeclaration classOrInterfaceDeclaration = qualifiedPathToEnum(classOrInterfaceType.toString() + "." + ((ClassOrInterfaceType) type).getNameAsString(), + ((ClassOrInterfaceType) type).getNameAsString()); + + if (classOrInterfaceDeclaration == null || !classOrInterfaceType.getNameAsString().equals("model")) { + classOrInterfaceDeclaration = qualifiedPathToEnum(classOrInterfaceType.toString(), ((ClassOrInterfaceType) type).getNameAsString()); + } + return classOrInterfaceDeclaration; + } + } catch (NullPointerException e) { + System.out.println(); + } + return null; + } + + public static EnumDeclaration qualifiedPathToEnum(String qualifiedPath, String enumName) { + String baseDir = importStatementToAbsoluteBasePath(qualifiedPath); + String plainName = qualifiedPath.substring(qualifiedPath.lastIndexOf('.') + 1); + String toReturn = baseDir + qualifiedPath.replace(".", "/") + ".java"; + CompilationUnit compilationUnit = null; + try { + compilationUnit = StaticJavaParser.parse(new File(toReturn)); + } catch (FileNotFoundException e) { + return null; + } + Optional classByName = compilationUnit.getClassByName(plainName); + if (classByName.isPresent()) { + Optional first = classByName.get().getChildNodes() + .stream() + .filter(node -> node instanceof EnumDeclaration) + .map(node -> (EnumDeclaration) node) + .filter(e -> e.getNameAsString().equals(enumName)) + .findFirst(); + return first.orElse(null); + } else { + return null; + } + } + + public static String getVersionIdString(String importStatement) { + + String placeholder = null; + if (importStatement.contains("dstu2016may")) { + placeholder = "dstu2016may"; + } else if (importStatement.contains("dstu2")) { + placeholder = "dstu2"; + } else if (importStatement.contains("dstu3")) { + placeholder = "dstu3"; + } else if (importStatement.contains("r4")) { + placeholder = "r4"; + } else if (importStatement.contains("r5")) { + placeholder = "r5"; + } + + return placeholder; + } + + public static String importStatementToAbsoluteBasePath(String importStatement) { + String placeholder = getVersionIdString(importStatement); + return String.format(MODEL_BASE_PATH, placeholder); + } + + /** + * Returns a list of all java files within the passed in directory path, without extension. + * + * @param path {@link String} filepath + * @return {@link List < String >} of all filenames + */ + protected static List listAllJavaFilesInDirectory(String path) { + List result = new ArrayList<>(); + try (Stream walk = Files.walk(Paths.get(path))) { + walk.map(Path::toString) + .filter(f -> f.endsWith(".java")) + .map(ParserEnumeration::pullFileNameFromPath) + .collect(Collectors.toCollection(() -> result)); + } catch (IOException e) { + e.printStackTrace(); + } + return result; + } + + private static CompilationUnit getCompilationUnit(String filePathWithExtension) { + Optional compilationUnit = initializeParser(filePathWithExtension); + if (!compilationUnit.isPresent()) { + System.out.println("\nNo compilation unit generated during class parsing...aborting."); + System.exit(0); + } + return compilationUnit.get(); + } + + /** + * Initializes the parser and runs it against the file located at the passed in path. + * + * @param path {@link String} path to the file. + * @return {@link Optional } + */ + public static Optional initializeParser(String path) { + CompilationUnit compilationUnit = null; + try { + compilationUnit = StaticJavaParser.parse(new File(path)); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + return Optional.ofNullable(compilationUnit); + } + + private static ClassOrInterfaceDeclaration initializeTypeSovlerAndParser(CompilationUnit compilationUnit, + String projectDirectory, + String codeDirectory, + String filename) { + try { + initializeResolver(projectDirectory, codeDirectory); + } catch (IOException e) { + System.out.println("Error initializing typesolver, exiting process..."); + e.printStackTrace(); + System.exit(0); + } + Optional classOrInterfaceDeclaration = loadClass(compilationUnit, filename); + if (!classOrInterfaceDeclaration.isPresent()) { + System.out.println("\nNo class or interface declaration loaded during parsing...aborting."); + System.exit(0); + } + return classOrInterfaceDeclaration.get(); + } + + /** + * The parser works by listing method calls within the individual resource conversion methods as + * {@link MethodCallExpr}. To extract the information we need to refactor the code, + * such as method body, references, signature, etc, we rely on the javaparser {@link TypeSolver} to parse the code + * library and convert the expressions to concrete {@link MethodDeclaration}. + *

+ * NB. The more source files in the directory you pass in (this will search recursively), the longer the + * MethodDeclaration lookups will take. Be smart, choose S-Mart. + * + * @param rootProjectDirectory + * @param projectDirectory {@link String} path to the directory that contains the souce files we want to be available for + */ + public static void initializeResolver(String rootProjectDirectory, String projectDirectory) throws IOException { + TypeSolver myTypeSolver = new CombinedTypeSolver( + new ReflectionTypeSolver(), + new JavaParserTypeSolver(new File(rootProjectDirectory + "/org.hl7.fhir.convertors/src/main/java/")), + new JavaParserTypeSolver(new File(rootProjectDirectory + "/org.hl7.fhir.utilities/src/main/java/")), + new JavaParserTypeSolver(new File(rootProjectDirectory + "/org.hl7.fhir.dstu2/src/main/java/")), + new JavaParserTypeSolver(new File(rootProjectDirectory + "/org.hl7.fhir.dstu3/src/main/java/")), + new JavaParserTypeSolver(new File(rootProjectDirectory + "/org.hl7.fhir.dstu2016may/src/main/java/")), + new JavaParserTypeSolver(new File(rootProjectDirectory + "/org.hl7.fhir.r4/src/main/java/")), + new JavaParserTypeSolver(new File(rootProjectDirectory + "/org.hl7.fhir.r5/src/main/java/")), + new JarTypeSolver("/Users/markiantorno/.m2/repository/ca/uhn/hapi/fhir/hapi-fhir-structures-r4/4.1.0/hapi-fhir-structures-r4-4.1.0.jar"), + new JarTypeSolver("/Users/markiantorno/.m2/repository/ca/uhn/hapi/fhir/hapi-fhir-base/4.1.0/hapi-fhir-base-4.1.0.jar") + ); + + JavaSymbolSolver symbolSolver = new JavaSymbolSolver(myTypeSolver); + StaticJavaParser.getConfiguration().setSymbolResolver(symbolSolver); + } + + /** + * Takes the passed in file path and extracts the filename without extension. + * + * @param path + * @return + */ + protected static String pullFileNameFromPath(String path) { + int lastSlashIndex = path.lastIndexOf('/'); + int lastPeriodIndex = path.lastIndexOf('.'); + return path.substring(lastSlashIndex + 1, lastPeriodIndex); + } + + /** + * Loads a class using the {@link CompilationUnit} passed in and returns the resulting declaration for parsing. This + * class must exist within the directory parsed originally in {@link #initializeParser(String)} + * + * @param cu {@link CompilationUnit} + * @param classname {@link String} The name of the class to load. + * @return {@link Optional } for the named class. + */ + protected static Optional loadClass(CompilationUnit cu, String classname) { + return cu.getClassByName(classname); + } + + /** + * Attempts to delete the file at the given path. + * + * @param path + */ + public static void deleteFile(String path) { + File file = new File(path); + if (file.delete()) { + System.out.println("File <" + path + "> deleted successfully"); + } else { + System.out.println("Failed to delete the file <" + path + ">"); + } + } + + public static void writeStringToFile(String string, String filepath) throws IOException { + BufferedWriter writer = new BufferedWriter(new FileWriter(filepath)); + writer.write(string); + writer.close(); + } + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/parser/ParserEnumerationBackup.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/parser/ParserEnumerationBackup.java new file mode 100644 index 000000000..a2eeec192 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/parser/ParserEnumerationBackup.java @@ -0,0 +1,567 @@ +package org.hl7.fhir.convertors.parser; + +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.EnumDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.expr.MethodCallExpr; +import com.github.javaparser.ast.nodeTypes.NodeWithSimpleName; +import com.github.javaparser.ast.stmt.ExpressionStmt; +import com.github.javaparser.ast.stmt.IfStmt; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import com.github.javaparser.ast.type.Type; +import com.github.javaparser.ast.visitor.ModifierVisitor; +import com.github.javaparser.ast.visitor.Visitable; +import com.github.javaparser.symbolsolver.JavaSymbolSolver; +import com.github.javaparser.symbolsolver.model.resolution.TypeSolver; +import com.github.javaparser.symbolsolver.model.typesystem.ReferenceTypeImpl; +import com.github.javaparser.symbolsolver.resolution.typesolvers.CombinedTypeSolver; +import com.github.javaparser.symbolsolver.resolution.typesolvers.JarTypeSolver; +import com.github.javaparser.symbolsolver.resolution.typesolvers.JavaParserTypeSolver; +import com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver; + +import java.io.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class ParserEnumerationBackup { + + public static final String ELEMENT = "Element"; + + private static final List VERSION_FILES = Arrays.asList("10_30", "10_40", "10_50", "14_30", "14_40", "14_50", "30_40", "30_50", "40_50"); + private static String MODEL_BASE_PATH = "/Users/markiantorno/Documents/Development/fhir/org.hl7.fhir.core/org.hl7.fhir.%1$s/src/main/java/"; + + public static HashMap> masterList = new HashMap<>(); + + /* + * %1$s - dstu version src, example r5 + * %2$s - dstu version tgt, example dstu3 + * %3$s - classname src including nested parents, example Enumerations.RequestPriority + * %4$s - classname tgt including nested parents, example MedicationRequest.MedicationRequestPriority + * %5$s - version conversion file title, eg 30_50 + * %6$s - enumName tgt without nested parents + */ + static public final String ENUM_TEMPLATE = "static public org.hl7.fhir.%2$s.model.%4$s convert%6$s(org.hl7.fhir.%1$s.model.%3$s src) throws FHIRException { " + + "if ((src == null)||(src.isEmpty()) " + + "return null;" + + "org.hl7.fhir.%2$s.model.Enumeration tgtEnum " + + "= new org.hl7.fhir.%2$s.model.Enumeration<>(new org.hl7.fhir.%2$s.model.%4$sEnumFactory());" + + "org.hl7.fhir.%1$s.model.Enumeration srcEnum " + + "= new org.hl7.fhir.%1$s.model.Enumeration<>(new org.hl7.fhir.%1$s.model.%3$sEnumFactory(), src); " + + "VersionConvertor_%5$s.copyElement(srcEnum, tgtEnum); " + + "tgtEnum.setValue(org.hl7.fhir.%2$s.model.%4$s.fromCode(srcEnum.getValueAsString())); " + + "return tgtEnum.getValue();" + + "}"; + + public static void main(String[] args) { + VERSION_FILES.forEach(version -> { + //String version = "10_30"; + List filenames = listAllJavaFilesInDirectory(new File("").getAbsolutePath() + "/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv" + version + "/"); + //System.out.println("Checking the following files:"); + Collections.sort(filenames); + //filenames.forEach(System.out::println); + filenames.forEach(name -> { + try { + modifyEnumMethods("/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv" + version + "/", name, ".java", version); + } catch (Exception e) { + e.printStackTrace(); + } + }); + }); + +// VERSION_FILES2.forEach(version -> { +// +// try { +// modifyEnumMethods("/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/", "MedicationRequest30_50", ".java", "30_50"); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// +// }); + + } + + public static void modifyEnumMethods(String srcdirectory, String filename, String extension, String version) { + String projectDirectory = new File("").getAbsolutePath(); + String filePathWithExtension = projectDirectory + srcdirectory + filename + extension; + CompilationUnit compilationUnit = getCompilationUnit(filePathWithExtension); + ClassOrInterfaceDeclaration classOrInterfaceDeclaration = initializeTypeSovlerAndParser(compilationUnit, + projectDirectory, srcdirectory, filename); + + classOrInterfaceDeclaration.accept(new ModifierVisitor() { + @Override + public Visitable visit(MethodDeclaration md, Void arg) { + super.visit(md, arg); + Optional src = md.getParameters().stream() + .filter(p -> p.getName().toString().equals("src")) + .findAny(); + + if ((md.getNameAsString().contains("convert")) && (src.isPresent()) && (md.getParameters().size() == 1)) { + + Type tgtType = md.getType(); + Type srcType = src.get().getType(); + + final EnumDeclaration toEnum = resolveEnumRefFromType(tgtType); + final EnumDeclaration fromEnum = resolveEnumRefFromType(srcType); + + if (toEnum != null && fromEnum != null) { + System.out.println("toEnum :: " + toEnum.getNameAsString()); + System.out.println("fromEnum :: " + fromEnum.getNameAsString()); + + String dstuVersionSrc = getVersionIdString(srcType.toString()); + String dstuVersionTgt = getVersionIdString(tgtType.toString()); + String classNameSrc = srcType.toString().substring(srcType.toString().indexOf("model.") + "model.".length()); + String classNameTgt = tgtType.toString().substring(tgtType.toString().indexOf("model.") + "model.".length()); + String methodName = fromEnum.getNameAsString(); + + String newMethodBody = String.format(ENUM_TEMPLATE, dstuVersionSrc, dstuVersionTgt, classNameSrc, classNameTgt, version, methodName); + md = StaticJavaParser.parseMethodDeclaration(newMethodBody); + } + } + return md; + } + }, null); + + deleteFile(filePathWithExtension); + + try { + writeStringToFile(compilationUnit.toString(), filePathWithExtension); + } catch (IOException e) { + e.printStackTrace(); + } + + } + + private static boolean methodWithNameExists(String methodName, ClassOrInterfaceDeclaration classType) { + return methodWithNameExists(methodName, classType, new HashSet<>()); + } + + private static boolean methodWithNameExists(String methodName, ClassOrInterfaceDeclaration classType, Set visited) { + if (classType == null) return false; + + List collect = classType.getMethods().stream() + .map(NodeWithSimpleName::getNameAsString) + .collect(Collectors.toList()); + + if (collect.contains(methodName)) { + return true; + } else if (classType.getExtendedTypes().isEmpty()) { + return false; + } else { + + System.out.println("searching class :: " + classType.getNameAsString() + ", for method name :: " + methodName); + ClassOrInterfaceType extendedType = classType.getExtendedTypes(0); + if (extendedType.getNameAsString().contains("PrimitiveType") || extendedType.getNameAsString().contains("BackboneElement")) { + return false; + } + String qualifiedName = ((ReferenceTypeImpl) extendedType.resolve()).getQualifiedName(); + ClassOrInterfaceDeclaration classOrInterfaceDeclaration = qualifiedPathToClassInterface(qualifiedName); + if (visited.contains(classOrInterfaceDeclaration.getNameAsString())) { + return false; + } else { + visited.add(classOrInterfaceDeclaration.getNameAsString()); + return methodWithNameExists(methodName, classOrInterfaceDeclaration, visited); + } + } + } + + private static Type getReturnType(String methodName, ClassOrInterfaceDeclaration classType) { + Optional first = classType.getMethods().stream() + .filter(md -> md.getNameAsString().equals(methodName)) + .findFirst(); + if (first.isPresent()) { + return first.get().getType(); + } else if (!classType.getExtendedTypes().isEmpty()) { + String qualifiedName = ((ReferenceTypeImpl) classType.getExtendedTypes(0).resolve()).getQualifiedName(); + ClassOrInterfaceDeclaration classOrInterfaceDeclaration = qualifiedPathToClassInterface(qualifiedName); + return getReturnType(methodName, classOrInterfaceDeclaration); + } else { + throw new IllegalArgumentException("Method requested, " + methodName + " doesn't exist in class type " + classType.getNameAsString()); + } + } + + private static Type getParameterType(String methodName, ClassOrInterfaceDeclaration classType) { + Optional first = classType.getMethods().stream() + .filter(md -> md.getNameAsString().equals(methodName)) + .findFirst(); + if (!first.isPresent()) { + if (!classType.getExtendedTypes().isEmpty()) { + System.out.println("Method Name :: " + methodName); + System.out.println("Class :: " + classType.getNameAsString()); + String qualifiedName = ((ReferenceTypeImpl) classType.getExtendedTypes(0).resolve()).getQualifiedName(); + ClassOrInterfaceDeclaration classOrInterfaceDeclaration = qualifiedPathToClassInterface(qualifiedName); + return getParameterType(methodName, classOrInterfaceDeclaration); + } else { + throw new IllegalArgumentException("Method requested, " + methodName + " doesn't exist in class type " + classType.getNameAsString()); + } + } else if (first.get().getParameters().isEmpty()) { + throw new IllegalArgumentException("Method requested, " + methodName + " doesn't have parameters"); + } else { + return first.get().getParameter(0).getType(); + } + } + + public static final String OLD_CONDITION_STATEMENT_TEMPLATE = "src.has%1$s()"; + public static final String NEW_CONDITION_STATEMENT_TEMPLATE = "src.has%1$sElement()"; + public static final String NEW_EXPR_STATEMENT_TEMPLATE = "tgt.set%1$sElement(convert%3$s(src.get%4$sElement()));"; + public static final String NEW_EXPR_STATEMENT_TEMPLATE_SUBFILE = "tgt.set%1$sElement(VersionConvertor_%2$s.convert%3$s(src.get%4$sElement()));"; + + private static Statement modifyElementAccess(ExpressionStmt n, ClassOrInterfaceDeclaration fromType, ClassOrInterfaceDeclaration toType, String version) throws Exception { + if (!canModifyElement(n, fromType, toType)) + throw new IllegalArgumentException("Cannot modify passed in elements."); + + MethodCallExpr methodCallExpr = (MethodCallExpr) n.getChildNodes().get(0); + String setMethodName = methodCallExpr.getNameAsString(); + String getMethodName = ((MethodCallExpr) ((MethodCallExpr) n.getExpression()).getArgument(0)).getNameAsString(); + + String paramTypeString = getParameterType(setMethodName + ELEMENT, toType).toString(); + String returnTypeName = getReturnType(getMethodName + ELEMENT, fromType).toString(); + + String expString = String.format(NEW_EXPR_STATEMENT_TEMPLATE, + setMethodName.replace("set", ""), + version, + returnTypeName.replace("Type", ""), + getMethodName.replace("get", "")); + return StaticJavaParser.parseStatement(expString); + } + + private static String generateNewIfStatement(ExpressionStmt n, ClassOrInterfaceDeclaration fromType, ClassOrInterfaceDeclaration toType, String version) { + if (!canModifyElement(n, fromType, toType)) + throw new IllegalArgumentException("Cannot modify passed in elements."); + + MethodCallExpr methodCallExpr = (MethodCallExpr) n.getChildNodes().get(0); + String setMethodName = methodCallExpr.getNameAsString(); + String getMethodName = ((MethodCallExpr) ((MethodCallExpr) n.getExpression()).getArgument(0)).getNameAsString(); + + String paramTypeString = getParameterType(setMethodName + ELEMENT, toType).toString(); + String returnTypeName = getReturnType(getMethodName + ELEMENT, fromType).toString(); + + String condition = String.format(NEW_CONDITION_STATEMENT_TEMPLATE, getMethodName.replaceFirst("get", "")); + + String expString = String.format(NEW_EXPR_STATEMENT_TEMPLATE_SUBFILE, + setMethodName.replaceFirst("set", ""), + version, + returnTypeName.replace("Type", ""), + getMethodName.replaceFirst("get", "")); + + if (n.getParentNode().get() instanceof IfStmt) { + return expString; + } else { + IfStmt ifStmt = new IfStmt(); + ifStmt.setCondition(StaticJavaParser.parseExpression(condition)); + ifStmt.setThenStmt(StaticJavaParser.parseStatement(expString)); + return ifStmt.toString(); + } + } + + private static String generateOldIfStatement(ExpressionStmt n, ClassOrInterfaceDeclaration fromType) { + if (n.getParentNode().get() instanceof IfStmt) { + return n.toString(); + } + String getMethodName = ((MethodCallExpr) ((MethodCallExpr) n.getExpression()).getArgument(0)).getNameAsString(); + if (((MethodCallExpr) n.getExpression()).getArgument(0) instanceof MethodCallExpr) { + try { + getMethodName = ((MethodCallExpr) ((MethodCallExpr) ((MethodCallExpr) n.getExpression()).getArgument(0)).getArgument(0)).getNameAsString(); + } catch (Exception e) { + getMethodName = ((MethodCallExpr) ((MethodCallExpr) n.getExpression()).getArgument(0)).getNameAsString(); + } + } + + getMethodName = getMethodName.replace("FirstRep", ""); + + if (methodWithNameExists("has" + getMethodName.replaceFirst("get", ""), fromType)) { + String condition = String.format(OLD_CONDITION_STATEMENT_TEMPLATE, getMethodName.replaceFirst("get", "")); + + IfStmt ifStmt = new IfStmt(); + ifStmt.setCondition(StaticJavaParser.parseExpression(condition)); + ifStmt.setThenStmt(n); + + return ifStmt.toString(); + } else { + return n.toString(); + } + } + + private static boolean canModifyElement(ExpressionStmt n, ClassOrInterfaceDeclaration fromClass, ClassOrInterfaceDeclaration toClass) { + MethodCallExpr methodCallExpr = (MethodCallExpr) n.getChildNodes().get(0); + String setMethodName = methodCallExpr.getNameAsString(); + String getMethodName = ((MethodCallExpr) ((MethodCallExpr) n.getExpression()).getArgument(0)).getNameAsString(); + System.out.println("Can modify element: n :: " + n.toString() + ", fromClass :: " + fromClass.getNameAsString() + ", toClass :: " + toClass.getNameAsString()); + return !getMethodName.contains("convert") && + methodWithNameExists(setMethodName + ELEMENT, toClass) + && methodWithNameExists(getMethodName + ELEMENT, fromClass) + && methodWithNameExists("has" + getMethodName.replace("get", "") + ELEMENT, fromClass) + && (getParameterType(setMethodName + ELEMENT, toClass).toString().equals(getReturnType(getMethodName + ELEMENT, fromClass).toString())); + } + + public static EnumDeclaration resolveEnumRefFromType(Type type) { + if (!(type instanceof ClassOrInterfaceType)) { + return null; //throw new IllegalStateException("Type " + type.toString() + " is not instanceof ClassOrInterfaceType"); + } + + Optional optionalScope = ((ClassOrInterfaceType) type).getScope(); + try { + if (optionalScope.isPresent()) { + ClassOrInterfaceType classOrInterfaceType = optionalScope.get(); + EnumDeclaration classOrInterfaceDeclaration = qualifiedPathToEnum(classOrInterfaceType.toString() + "." + ((ClassOrInterfaceType) type).getNameAsString(), + ((ClassOrInterfaceType) type).getNameAsString()); + + if (classOrInterfaceDeclaration == null || !classOrInterfaceType.getNameAsString().equals("model")) { + classOrInterfaceDeclaration = qualifiedPathToEnum(classOrInterfaceType.toString(), ((ClassOrInterfaceType) type).getNameAsString()); +// Optional any = classOrInterfaceDeclaration.getChildNodes().stream() +// .filter(node -> node instanceof EnumDeclaration) +// .map(node -> (EnumDeclaration) node) +// .filter(c -> c.getNameAsString().equals(((ClassOrInterfaceType) type).getNameAsString())) +// .findAny(); +// if (any.isPresent()) { +// return any.get(); +// } else { +// return null; +// } + } + return classOrInterfaceDeclaration; + } + } catch (NullPointerException e) { + System.out.println(); + } + return null; + } + + public static EnumDeclaration qualifiedPathToEnum(String qualifiedPath, String enumName) { + String baseDir = importStatementToAbsoluteBasePath(qualifiedPath); + String plainName = qualifiedPath.substring(qualifiedPath.lastIndexOf('.') + 1); + String toReturn = baseDir + qualifiedPath.replace(".", "/") + ".java"; + CompilationUnit compilationUnit = null; + try { + compilationUnit = StaticJavaParser.parse(new File(toReturn)); + } catch (FileNotFoundException e) { + return null; + } + Optional classByName = compilationUnit.getClassByName(plainName); + if (classByName.isPresent()) { + Optional first = classByName.get().getChildNodes() + .stream() + .filter(node -> node instanceof EnumDeclaration) + .map(node -> (EnumDeclaration) node) + .filter(e -> e.getNameAsString().equals(enumName)) + .findFirst(); + return first.orElse(null); + } else { + return null; + } + } + + public static ClassOrInterfaceDeclaration resolveClassRefFromType(Type type) { + if (!(type instanceof ClassOrInterfaceType)) { + return null; //throw new IllegalStateException("Type " + type.toString() + " is not instanceof ClassOrInterfaceType"); + } + + Optional optionalScope = ((ClassOrInterfaceType) type).getScope(); + try { + if (optionalScope.isPresent()) { + ClassOrInterfaceType classOrInterfaceType = optionalScope.get(); + ClassOrInterfaceDeclaration classOrInterfaceDeclaration = qualifiedPathToClassInterface(classOrInterfaceType.toString() + "." + ((ClassOrInterfaceType) type).getNameAsString()); + + if (classOrInterfaceDeclaration == null || !classOrInterfaceType.getNameAsString().equals("model")) { + classOrInterfaceDeclaration = qualifiedPathToClassInterface(classOrInterfaceType.toString()); + Optional any = classOrInterfaceDeclaration.getChildNodes().stream() + .filter(node -> node instanceof ClassOrInterfaceDeclaration) + .map(node -> (ClassOrInterfaceDeclaration) node) + .filter(c -> c.getNameAsString().equals(((ClassOrInterfaceType) type).getNameAsString())) + .findAny(); + if (any.isPresent()) { + return any.get(); + } else { + return null; + } + } + return classOrInterfaceDeclaration; + } + } catch (NullPointerException e) { + System.out.println(); + } + return null; + } + + public static ClassOrInterfaceDeclaration qualifiedPathToClassInterface(String qualifiedPath) { + String baseDir = importStatementToAbsoluteBasePath(qualifiedPath); + String plainName = qualifiedPath.substring(qualifiedPath.lastIndexOf('.') + 1); + String toReturn = baseDir + qualifiedPath.replace(".", "/") + ".java"; + CompilationUnit compilationUnit = null; + try { + compilationUnit = StaticJavaParser.parse(new File(toReturn)); + } catch (FileNotFoundException e) { + return null; + } + Optional optionalClass = compilationUnit.getClassByName(plainName); + return optionalClass.orElse(null); + } + + public static String getVersionIdString(String importStatement) { + + String placeholder = null; + if (importStatement.contains("dstu2016may")) { + placeholder = "dstu2016may"; + } else if (importStatement.contains("dstu2")) { + placeholder = "dstu2"; + } else if (importStatement.contains("dstu3")) { + placeholder = "dstu3"; + } else if (importStatement.contains("r4")) { + placeholder = "r4"; + } else if (importStatement.contains("r5")) { + placeholder = "r5"; + } + + return placeholder; + } + + public static String importStatementToAbsoluteBasePath(String importStatement) { + String placeholder = getVersionIdString(importStatement); + return String.format(MODEL_BASE_PATH, placeholder); + } + + /** + * Returns a list of all java files within the passed in directory path, without extension. + * + * @param path {@link String} filepath + * @return {@link List < String >} of all filenames + */ + protected static List listAllJavaFilesInDirectory(String path) { + List result = new ArrayList<>(); + try (Stream walk = Files.walk(Paths.get(path))) { + walk.map(Path::toString) + .filter(f -> f.endsWith(".java")) + .map(ParserEnumerationBackup::pullFileNameFromPath) + .collect(Collectors.toCollection(() -> result)); + } catch (IOException e) { + e.printStackTrace(); + } + return result; + } + + private static CompilationUnit getCompilationUnit(String filePathWithExtension) { + Optional compilationUnit = initializeParser(filePathWithExtension); + if (!compilationUnit.isPresent()) { + System.out.println("\nNo compilation unit generated during class parsing...aborting."); + System.exit(0); + } + return compilationUnit.get(); + } + + /** + * Initializes the parser and runs it against the file located at the passed in path. + * + * @param path {@link String} path to the file. + * @return {@link Optional } + */ + public static Optional initializeParser(String path) { + CompilationUnit compilationUnit = null; + try { + compilationUnit = StaticJavaParser.parse(new File(path)); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + return Optional.ofNullable(compilationUnit); + } + + private static ClassOrInterfaceDeclaration initializeTypeSovlerAndParser(CompilationUnit compilationUnit, + String projectDirectory, + String codeDirectory, + String filename) { + try { + initializeResolver(projectDirectory, codeDirectory); + } catch (IOException e) { + System.out.println("Error initializing typesolver, exiting process..."); + e.printStackTrace(); + System.exit(0); + } + Optional classOrInterfaceDeclaration = loadClass(compilationUnit, filename); + if (!classOrInterfaceDeclaration.isPresent()) { + System.out.println("\nNo class or interface declaration loaded during parsing...aborting."); + System.exit(0); + } + return classOrInterfaceDeclaration.get(); + } + + /** + * The parser works by listing method calls within the individual resource conversion methods as + * {@link MethodCallExpr}. To extract the information we need to refactor the code, + * such as method body, references, signature, etc, we rely on the javaparser {@link TypeSolver} to parse the code + * library and convert the expressions to concrete {@link MethodDeclaration}. + *

+ * NB. The more source files in the directory you pass in (this will search recursively), the longer the + * MethodDeclaration lookups will take. Be smart, choose S-Mart. + * + * @param rootProjectDirectory + * @param projectDirectory {@link String} path to the directory that contains the souce files we want to be available for + */ + public static void initializeResolver(String rootProjectDirectory, String projectDirectory) throws IOException { + TypeSolver myTypeSolver = new CombinedTypeSolver( + new ReflectionTypeSolver(), + new JavaParserTypeSolver(new File(rootProjectDirectory + "/org.hl7.fhir.convertors/src/main/java/")), + new JavaParserTypeSolver(new File(rootProjectDirectory + "/org.hl7.fhir.utilities/src/main/java/")), + new JavaParserTypeSolver(new File(rootProjectDirectory + "/org.hl7.fhir.dstu2/src/main/java/")), + new JavaParserTypeSolver(new File(rootProjectDirectory + "/org.hl7.fhir.dstu3/src/main/java/")), + new JavaParserTypeSolver(new File(rootProjectDirectory + "/org.hl7.fhir.dstu2016may/src/main/java/")), + new JavaParserTypeSolver(new File(rootProjectDirectory + "/org.hl7.fhir.r4/src/main/java/")), + new JavaParserTypeSolver(new File(rootProjectDirectory + "/org.hl7.fhir.r5/src/main/java/")), + new JarTypeSolver("/Users/markiantorno/.m2/repository/ca/uhn/hapi/fhir/hapi-fhir-structures-r4/4.1.0/hapi-fhir-structures-r4-4.1.0.jar"), + new JarTypeSolver("/Users/markiantorno/.m2/repository/ca/uhn/hapi/fhir/hapi-fhir-base/4.1.0/hapi-fhir-base-4.1.0.jar") + ); + + JavaSymbolSolver symbolSolver = new JavaSymbolSolver(myTypeSolver); + StaticJavaParser.getConfiguration().setSymbolResolver(symbolSolver); + } + + /** + * Takes the passed in file path and extracts the filename without extension. + * + * @param path + * @return + */ + protected static String pullFileNameFromPath(String path) { + int lastSlashIndex = path.lastIndexOf('/'); + int lastPeriodIndex = path.lastIndexOf('.'); + return path.substring(lastSlashIndex + 1, lastPeriodIndex); + } + + /** + * Loads a class using the {@link CompilationUnit} passed in and returns the resulting declaration for parsing. This + * class must exist within the directory parsed originally in {@link #initializeParser(String)} + * + * @param cu {@link CompilationUnit} + * @param classname {@link String} The name of the class to load. + * @return {@link Optional } for the named class. + */ + protected static Optional loadClass(CompilationUnit cu, String classname) { + return cu.getClassByName(classname); + } + + /** + * Attempts to delete the file at the given path. + * + * @param path + */ + public static void deleteFile(String path) { + File file = new File(path); + if (file.delete()) { + System.out.println("File <" + path + "> deleted successfully"); + } else { + System.out.println("Failed to delete the file <" + path + ">"); + } + } + + public static void writeStringToFile(String string, String filepath) throws IOException { + BufferedWriter writer = new BufferedWriter(new FileWriter(filepath)); + writer.write(string); + writer.close(); + } + +} diff --git a/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/model/Composition.java b/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/model/Composition.java index 9cee3bb71..7598ecb10 100644 --- a/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/model/Composition.java +++ b/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/model/Composition.java @@ -356,6 +356,14 @@ public class Composition extends DomainResource { return false; } + /** + * @return Returns a reference to this for easy method chaining + */ + public CompositionAttesterComponent setMode(List> mode) { + this.mode = mode; + return this; + } + /** * @return {@link #mode} (The type of attestation the authenticator offers.) */ diff --git a/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/model/HealthcareService.java b/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/model/HealthcareService.java index 2cb1e819f..03a735efc 100644 --- a/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/model/HealthcareService.java +++ b/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/model/HealthcareService.java @@ -459,6 +459,14 @@ public class HealthcareService extends DomainResource { return false; } + /** + * @return Returns a reference to this for easy method chaining + */ + public HealthcareServiceAvailableTimeComponent setDaysOfWeek(List> daysOfWeek) { + this.daysOfWeek = daysOfWeek; + return this; + } + /** * @return {@link #daysOfWeek} (Indicates which days of the week are available between the start and end Times.) */