3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.store
.model
;
13 import java
.util
.SortedSet
;
15 import org
.apache
.log4j
.Logger
;
17 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationshipType
;
18 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCode
;
19 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
20 import eu
.etaxonomy
.taxeditor
.store
.preference
.PreferencesUtil
;
27 public class NameRelationsUtil
{
28 private static final Logger logger
= Logger
29 .getLogger(NameRelationsUtil
.class);
32 * Get the type's label out of the session's name relations vocabulary, not directly
38 public static String
getNameRelationTypeLabel(NameRelationshipType type
) {
39 boolean isZoological
=
40 PreferencesUtil
.getPreferredNomenclaturalCode()
41 == NomenclaturalCode
.ICZN ?
true : false;
42 return getNameRelationTypeLabel(type
, isZoological
);
45 public static String
getNameRelationTypeLabel(NameRelationshipType type
, boolean isZoological
) {
47 SortedSet
<NameRelationshipType
> vocab
=
48 CdmStore
.getDefault().getNameRelationshipTypes();
50 // SortedSet<NameRelationshipType> vocab =
51 // CdmSessionDataRepository.getDefault().getNameRelationshipTypes();
52 for (NameRelationshipType type1
: vocab
) {
53 if (type1
.equals(type
)) {
56 type1
.equals(NameRelationshipType
.BASIONYM())) {
57 return "original combination for";
59 return type1
.getLabel();
67 * Get the inverse representation of the type out of the session's
68 * name relations vocabulary, not directly from the object.
73 public static String
getNameRelationInverseTypeLabel(NameRelationshipType type
) {
74 boolean isZoological
=
75 PreferencesUtil
.getPreferredNomenclaturalCode()
76 == NomenclaturalCode
.ICZN ?
true : false;
77 return getNameRelationInverseTypeLabel(type
, isZoological
);
80 public static String
getNameRelationInverseTypeLabel(NameRelationshipType type
, boolean isZoological
) {
82 SortedSet
<NameRelationshipType
> vocab
=
83 CdmStore
.getDefault().getNameRelationshipTypes();
85 // SortedSet<NameRelationshipType> vocab =
86 // CdmSessionDataRepository.getDefault().getNameRelationshipTypes();
87 for (NameRelationshipType type1
: vocab
) {
88 if (type1
.equals(type
)) {
89 return type1
.getInverseLabel();