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