001package org.hl7.fhir.r4.model.codesystems; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Sun, May 6, 2018 17:51-0400 for FHIR v3.4.0 033 034 035import org.hl7.fhir.r4.model.EnumFactory; 036 037public class AdverseEventCategoryEnumFactory implements EnumFactory<AdverseEventCategory> { 038 039 public AdverseEventCategory fromCode(String codeString) throws IllegalArgumentException { 040 if (codeString == null || "".equals(codeString)) 041 return null; 042 if ("ProductProblem".equals(codeString)) 043 return AdverseEventCategory.PRODUCTPROBLEM; 044 if ("ProductQuality".equals(codeString)) 045 return AdverseEventCategory.PRODUCTQUALITY; 046 if ("ProductUseError".equals(codeString)) 047 return AdverseEventCategory.PRODUCTUSEERROR; 048 if ("WrongDose".equals(codeString)) 049 return AdverseEventCategory.WRONGDOSE; 050 if ("IncorrectPrescribingInformation".equals(codeString)) 051 return AdverseEventCategory.INCORRECTPRESCRIBINGINFORMATION; 052 if ("WrongTechnique".equals(codeString)) 053 return AdverseEventCategory.WRONGTECHNIQUE; 054 if ("WrongRouteOfAdministration".equals(codeString)) 055 return AdverseEventCategory.WRONGROUTEOFADMINISTRATION; 056 if ("WrongRate".equals(codeString)) 057 return AdverseEventCategory.WRONGRATE; 058 if ("WrongDuration".equals(codeString)) 059 return AdverseEventCategory.WRONGDURATION; 060 if ("WrongTime".equals(codeString)) 061 return AdverseEventCategory.WRONGTIME; 062 if ("ExpiredDrug".equals(codeString)) 063 return AdverseEventCategory.EXPIREDDRUG; 064 if ("MedicalDeviceUseError".equals(codeString)) 065 return AdverseEventCategory.MEDICALDEVICEUSEERROR; 066 if ("ProblemDifferentManufacturer".equals(codeString)) 067 return AdverseEventCategory.PROBLEMDIFFERENTMANUFACTURER; 068 if ("UnsafePhysicalEnvironment".equals(codeString)) 069 return AdverseEventCategory.UNSAFEPHYSICALENVIRONMENT; 070 throw new IllegalArgumentException("Unknown AdverseEventCategory code '"+codeString+"'"); 071 } 072 073 public String toCode(AdverseEventCategory code) { 074 if (code == AdverseEventCategory.PRODUCTPROBLEM) 075 return "ProductProblem"; 076 if (code == AdverseEventCategory.PRODUCTQUALITY) 077 return "ProductQuality"; 078 if (code == AdverseEventCategory.PRODUCTUSEERROR) 079 return "ProductUseError"; 080 if (code == AdverseEventCategory.WRONGDOSE) 081 return "WrongDose"; 082 if (code == AdverseEventCategory.INCORRECTPRESCRIBINGINFORMATION) 083 return "IncorrectPrescribingInformation"; 084 if (code == AdverseEventCategory.WRONGTECHNIQUE) 085 return "WrongTechnique"; 086 if (code == AdverseEventCategory.WRONGROUTEOFADMINISTRATION) 087 return "WrongRouteOfAdministration"; 088 if (code == AdverseEventCategory.WRONGRATE) 089 return "WrongRate"; 090 if (code == AdverseEventCategory.WRONGDURATION) 091 return "WrongDuration"; 092 if (code == AdverseEventCategory.WRONGTIME) 093 return "WrongTime"; 094 if (code == AdverseEventCategory.EXPIREDDRUG) 095 return "ExpiredDrug"; 096 if (code == AdverseEventCategory.MEDICALDEVICEUSEERROR) 097 return "MedicalDeviceUseError"; 098 if (code == AdverseEventCategory.PROBLEMDIFFERENTMANUFACTURER) 099 return "ProblemDifferentManufacturer"; 100 if (code == AdverseEventCategory.UNSAFEPHYSICALENVIRONMENT) 101 return "UnsafePhysicalEnvironment"; 102 return "?"; 103 } 104 105 public String toSystem(AdverseEventCategory code) { 106 return code.getSystem(); 107 } 108 109} 110