Aligning Editor with 3.3 model changes. First phase commit which updates only the...
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / model / NomenclaturalCodeHelper.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.taxeditor.model;
12
13 import java.util.ArrayList;
14 import java.util.Arrays;
15 import java.util.List;
16
17 import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
18
19 /**
20 * <p>NomenclaturalCodeHelper class.</p>
21 *
22 * @author p.ciardelli
23 * @created 11.09.2009
24 * @version 1.0
25 */
26 public class NomenclaturalCodeHelper {
27
28 /**
29 * <p>getAllCodes</p>
30 *
31 * @return a {@link java.util.List} object.
32 */
33 public static List<NomenclaturalCode> getAllCodes() {
34 return Arrays.asList(NomenclaturalCode.values());
35 }
36
37
38 /**
39 * <p>getSupportedCodes</p>
40 *
41 * @return a {@link java.util.List} object.
42 */
43 public static List<NomenclaturalCode> getSupportedCodes() {
44 List<NomenclaturalCode> supportedCodes = new ArrayList<NomenclaturalCode>();
45 for (NomenclaturalCode code : getAllCodes()) {
46 if (isSupported(code)) {
47 supportedCodes.add(code);
48 }
49 }
50 return supportedCodes;
51 }
52
53 /**
54 * @param code
55 * @return
56 */
57 private static boolean isSupported(NomenclaturalCode code) {
58 if (code.equals(NomenclaturalCode.ICNAFP ) || code.equals(NomenclaturalCode.ICZN)) {
59 return true;
60 } else {
61 return false;
62 }
63 }
64
65
66 /**
67 * <p>getDescription</p>
68 *
69 * @param code a {@link eu.etaxonomy.cdm.model.name.NomenclaturalCode} object.
70 * @return a {@link java.lang.String} object.
71 */
72 public static String getDescription(NomenclaturalCode code) {
73 if (code.equals(NomenclaturalCode.ICNB)) {
74 return "International Code of Nomenclature of Bacteria (ICNB)";
75 }
76 if (code.equals(NomenclaturalCode.ICNAFP )) {
77 return "International Code of Botanical Nomenclature (ICNAFP )";
78 }
79 if (code.equals(NomenclaturalCode.ICNCP)) {
80 return "International Code of Cultivated Plants (ICNCP)";
81 }
82 if (code.equals(NomenclaturalCode.ICZN)) {
83 return "International Code of Zoological Nomenclature (ICZN)";
84 }
85 if (code.equals(NomenclaturalCode.ICVCN)) {
86 return "International Code for Virus Classification and Nomenclature (ICVCN)";
87 }
88 return code.name();
89 }
90
91 /**
92 * <p>getDefaultCode</p>
93 *
94 * @return a {@link eu.etaxonomy.cdm.model.name.NomenclaturalCode} object.
95 */
96 public static NomenclaturalCode getDefaultCode() {
97 return NomenclaturalCode.ICNAFP ;
98 }
99 }