All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.projecthusky.common.enums.CountryCode Maven / Gradle / Ivy

/*
 * This code is made available under the terms of the Eclipse Public License v1.0 
 * in the github project https://github.com/project-husky/husky there you also 
 * find a list of the contributors and the license information.
 * 
 * This project has been developed further and modified by the joined working group Husky 
 * on the basis of the eHealth Connector opensource project from June 28, 2021, 
 * whereas medshare GmbH is the initial and main contributor/author of the eHealth Connector.
 *
 */
package org.projecthusky.common.enums;

import org.apache.commons.lang3.EnumUtils;
import org.projecthusky.common.hl7cdar2.CS;
import org.projecthusky.common.model.Code;

/**
 * ISO 3166-1 alpha-3 Country Code
 */
public enum CountryCode {

	/**
	 * 
Austria
Österreich
*
Autriche
*/ AUSTRIA("AT", "AUT", "Austria"), /** *
Switzerland
Schweiz
*
Suisse
*/ SWITZERLAND("CH", "CHE", "Switzerland"); public static final String CODE_SYSTEM_NAME = "ISO 3166-1 alpha-3"; public static final String CODE_SYSTEM_OID = "1.0.3166.2.2.3"; /** *
Gets the Enum with a given code
*
Liefert den Enum anhand eines gegebenen codes
* * @param code *
*
code
* @return
the enum
*/ public static CountryCode getEnum(String code) { for (final CountryCode aLanguage : EnumUtils.getEnumList(CountryCode.class)) { if (aLanguage.getCodeAlpha3().equalsIgnoreCase(code)) { return aLanguage; } } return null; } /** *
Checks if a given enum is part of this value set.
*
Prüft, ob der gegebene enum Teil dieses Value Sets * ist.
* * @param enumName *
*
enumName
* @return true, if enum is in this value set */ public static boolean isEnumOfValueSet(String enumName) { return EnumUtils.isValidEnum(CountryCode.class, enumName); } /** *
Checks if a given code value is in this value set.
*
Prüft, ob der gegebene code in diesem Value Sets * vorhanden ist.
* * @param codeValue *
*
code
* @return true, if is in value set */ public static boolean isInValueSet(String codeValue) { for (final CountryCode aLang : EnumUtils.getEnumList(CountryCode.class)) { if (aLang.getCodeAlpha3().equals(codeValue)) { return true; } } return false; } private String codeAlpha2; private String codeAlpha3; private String displayName; /** *
Instantiates this Enum Object with a given Code and * Display Name
Instantiiert dieses Enum Object * mittels eines Codes und einem Display Name
. * * @param codeAlpha2 * the ISO county code alpha 2 * @param codeAlpha3 * the ISO county code alpha 2 * @param displayName * the displayName */ private CountryCode(String codeAlpha2, String codeAlpha3, String displayName) { this.codeAlpha2 = codeAlpha2; this.codeAlpha3 = codeAlpha3; this.displayName = displayName; } /** *
Gets the husky Code Object
*
Liefert das husky Code Objekt
* * @return
the code
*/ public Code getCode() { return new Code(codeAlpha3, CODE_SYSTEM_OID, displayName); } /** *
Gets the actual ISO Country Code Alpha 2 as string
* * @return
the code
*/ public String getCodeAlpha2() { return codeAlpha2; } /** *
Gets the actual ISO Country Code Alpha 3 as string
* * @return
the code
*/ public String getCodeAlpha3() { return codeAlpha3; } /** *
Gets the code system name.
Liefert * code system name.
* * @return
the code system name
*/ public String getCodeSystemName() { return CODE_SYSTEM_NAME; } /** *
Gets the code system id.
Liefert * die code system id.
* * @return
the code system id
*/ public String getCodeSystemOid() { return CODE_SYSTEM_OID; } /** *
Gets the Code of this Enum as MDHT Object.
*
Liefert den Code dieses Enum als MDHT Objekt.
* * @return
The MDHT Code
*/ public CS getCS() { final CS cs = new CS(); cs.setCode(codeAlpha3); return cs; } /** *
Gets the display name.
Liefert * display name.
* * @return
the display name
*/ public String getDisplayName() { return displayName; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy