
001package org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40; 002 003import org.hl7.fhir.convertors.context.ConversionContext30_40; 004import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.PositiveInt30_40; 005import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.String30_40; 006import org.hl7.fhir.exceptions.FHIRException; 007import org.hl7.fhir.r4.model.ContactPoint; 008 009public class ContactPoint30_40 { 010 public static org.hl7.fhir.r4.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu3.model.ContactPoint src) throws FHIRException { 011 if (src == null) return null; 012 org.hl7.fhir.r4.model.ContactPoint tgt = new org.hl7.fhir.r4.model.ContactPoint(); 013 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 014 if (src.hasSystem()) tgt.setSystemElement(convertContactPointSystem(src.getSystemElement())); 015 if (src.hasValue()) tgt.setValueElement(String30_40.convertString(src.getValueElement())); 016 if (src.hasUse()) tgt.setUseElement(convertContactPointUse(src.getUseElement())); 017 if (src.hasRank()) tgt.setRankElement(PositiveInt30_40.convertPositiveInt(src.getRankElement())); 018 if (src.hasPeriod()) tgt.setPeriod(Period30_40.convertPeriod(src.getPeriod())); 019 return tgt; 020 } 021 022 public static org.hl7.fhir.dstu3.model.ContactPoint convertContactPoint(org.hl7.fhir.r4.model.ContactPoint src) throws FHIRException { 023 if (src == null) return null; 024 org.hl7.fhir.dstu3.model.ContactPoint tgt = new org.hl7.fhir.dstu3.model.ContactPoint(); 025 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 026 if (src.hasSystem()) tgt.setSystemElement(convertContactPointSystem(src.getSystemElement())); 027 if (src.hasValue()) tgt.setValueElement(String30_40.convertString(src.getValueElement())); 028 if (src.hasUse()) tgt.setUseElement(convertContactPointUse(src.getUseElement())); 029 if (src.hasRank()) tgt.setRankElement(PositiveInt30_40.convertPositiveInt(src.getRankElement())); 030 if (src.hasPeriod()) tgt.setPeriod(Period30_40.convertPeriod(src.getPeriod())); 031 return tgt; 032 } 033 034 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem> convertContactPointSystem(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem> src) throws FHIRException { 035 if (src == null || src.isEmpty()) return null; 036 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.ContactPoint.ContactPointSystemEnumFactory()); 037 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 038 if (src.getValue() == null) { 039 tgt.setValue(null); 040} else { 041 switch(src.getValue()) { 042 case PHONE: 043 tgt.setValue(ContactPoint.ContactPointSystem.PHONE); 044 break; 045 case FAX: 046 tgt.setValue(ContactPoint.ContactPointSystem.FAX); 047 break; 048 case EMAIL: 049 tgt.setValue(ContactPoint.ContactPointSystem.EMAIL); 050 break; 051 case PAGER: 052 tgt.setValue(ContactPoint.ContactPointSystem.PAGER); 053 break; 054 case URL: 055 tgt.setValue(ContactPoint.ContactPointSystem.URL); 056 break; 057 case SMS: 058 tgt.setValue(ContactPoint.ContactPointSystem.SMS); 059 break; 060 case OTHER: 061 tgt.setValue(ContactPoint.ContactPointSystem.OTHER); 062 break; 063 default: 064 tgt.setValue(ContactPoint.ContactPointSystem.NULL); 065 break; 066 } 067} 068 return tgt; 069 } 070 071 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem> convertContactPointSystem(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem> src) throws FHIRException { 072 if (src == null || src.isEmpty()) return null; 073 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystemEnumFactory()); 074 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 075 if (src.getValue() == null) { 076 tgt.setValue(null); 077} else { 078 switch(src.getValue()) { 079 case PHONE: 080 tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PHONE); 081 break; 082 case FAX: 083 tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.FAX); 084 break; 085 case EMAIL: 086 tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.EMAIL); 087 break; 088 case PAGER: 089 tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PAGER); 090 break; 091 case URL: 092 tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.URL); 093 break; 094 case SMS: 095 tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.SMS); 096 break; 097 case OTHER: 098 tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.OTHER); 099 break; 100 default: 101 tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.NULL); 102 break; 103 } 104} 105 return tgt; 106 } 107 108 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ContactPoint.ContactPointUse> convertContactPointUse(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse> src) throws FHIRException { 109 if (src == null || src.isEmpty()) return null; 110 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ContactPoint.ContactPointUse> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.ContactPoint.ContactPointUseEnumFactory()); 111 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 112 if (src.getValue() == null) { 113 tgt.setValue(null); 114} else { 115 switch(src.getValue()) { 116 case HOME: 117 tgt.setValue(ContactPoint.ContactPointUse.HOME); 118 break; 119 case WORK: 120 tgt.setValue(ContactPoint.ContactPointUse.WORK); 121 break; 122 case TEMP: 123 tgt.setValue(ContactPoint.ContactPointUse.TEMP); 124 break; 125 case OLD: 126 tgt.setValue(ContactPoint.ContactPointUse.OLD); 127 break; 128 case MOBILE: 129 tgt.setValue(ContactPoint.ContactPointUse.MOBILE); 130 break; 131 default: 132 tgt.setValue(ContactPoint.ContactPointUse.NULL); 133 break; 134 } 135} 136 return tgt; 137 } 138 139 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse> convertContactPointUse(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ContactPoint.ContactPointUse> src) throws FHIRException { 140 if (src == null || src.isEmpty()) return null; 141 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUseEnumFactory()); 142 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 143 if (src.getValue() == null) { 144 tgt.setValue(null); 145} else { 146 switch(src.getValue()) { 147 case HOME: 148 tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.HOME); 149 break; 150 case WORK: 151 tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.WORK); 152 break; 153 case TEMP: 154 tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.TEMP); 155 break; 156 case OLD: 157 tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.OLD); 158 break; 159 case MOBILE: 160 tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.MOBILE); 161 break; 162 default: 163 tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.NULL); 164 break; 165 } 166} 167 return tgt; 168 } 169}