001package ca.cdr.api.model.enm; 002 003/* 004 * #%L 005 * Smile CDR - CDR 006 * %% 007 * Copyright (C) 2016 - 2024 Smile CDR, Inc. 008 * %% 009 * All rights reserved. 010 * #L% 011 */ 012 013import java.util.Collections; 014import java.util.HashMap; 015import java.util.Map; 016 017/** 018 * Simple enum for the available demographics relevant to mapping from Source to Smile CDR and Target, 019 * and from Smile CDR to Source and Target. 020 */ 021public enum DemographicEnum { 022 /** 023 * Sorting agnostic. 024 */ 025 026 /** 027 * Administrative Sex 028 */ 029 ADMINISTRATIVE_SEX("administrative_sex"), 030 031 /** 032 * County / Parish Code 033 */ 034 COUNTY_PARISH_CODE("county_parish_code"), 035 036 /** 037 * Ethnic Group 038 */ 039 ETHNIC_GROUP("ethnic_group"), 040 041 /** 042 * Marital Status 043 */ 044 MARITAL_STATUS("marital_status"), 045 046 /** 047 * Military Rank / Grade 048 */ 049 MILITARY_RANK_GRADE("military_rank_grade"), 050 051 /** 052 * Military Service 053 */ 054 MILITARY_SERVICE("military_service"), 055 056 /** 057 * Military Status 058 */ 059 MILITARY_STATUS("military_status"), 060 061 /** 062 * Nationality 063 */ 064 NATIONALITY("nationality"), 065 066 /** 067 * Primary Language 068 */ 069 PRIMARY_LANGUAGE("primary_language"), 070 071 /** 072 * Race 073 */ 074 RACE("race"), 075 076 /** 077 * Relationship 078 */ 079 RELATIONSHIP("relationship"), 080 081 /** 082 * Religion 083 */ 084 RELIGION("religion"), 085 086 /** 087 * Veterans Military Status 088 */ 089 VETERANS_MILITARY_STATUS("veterans_military_status"); 090 091 private static Map<String, DemographicEnum> ourValues; 092 private String myCode; 093 094 private DemographicEnum(String theCode) { 095 myCode = theCode; 096 } 097 098 public String getCode() { 099 return myCode; 100 } 101 102 public static DemographicEnum fromCode(String theCode) { 103 if (ourValues == null) { 104 HashMap<String, DemographicEnum> values = new HashMap<String, DemographicEnum>(); 105 for (DemographicEnum next : values()) { 106 values.put(next.getCode(), next); 107 } 108 ourValues = Collections.unmodifiableMap(values); 109 } 110 return ourValues.get(theCode); 111 } 112}