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
.model
;
13 import java
.util
.SortedSet
;
15 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationshipType
;
16 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCode
;
17 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
18 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
25 public class NameRelationsUtil
{
28 * Get the type's label out of the session's name relations vocabulary, not directly
34 public static String
getNameRelationTypeLabel(NameRelationshipType type
) {
35 boolean isZoological
=
36 PreferencesUtil
.getPreferredNomenclaturalCode()
37 == NomenclaturalCode
.ICZN ?
true : false;
38 return getNameRelationTypeLabel(type
, isZoological
);
41 public static String
getNameRelationTypeLabel(NameRelationshipType type
, boolean isZoological
) {
43 SortedSet
<NameRelationshipType
> vocab
=
44 CdmStore
.getDefault().getNameRelationshipTypes();
46 // SortedSet<NameRelationshipType> vocab =
47 // CdmSessionDataRepository.getDefault().getNameRelationshipTypes();
48 for (NameRelationshipType type1
: vocab
) {
49 if (type1
.equals(type
)) {
52 type1
.equals(NameRelationshipType
.BASIONYM())) {
53 return "original combination for";
55 return type1
.getLabel();
63 * Get the inverse representation of the type out of the session's
64 * name relations vocabulary, not directly from the object.
69 public static String
getNameRelationInverseTypeLabel(NameRelationshipType type
) {
70 boolean isZoological
=
71 PreferencesUtil
.getPreferredNomenclaturalCode()
72 == NomenclaturalCode
.ICZN ?
true : false;
73 return getNameRelationInverseTypeLabel(type
, isZoological
);
76 public static String
getNameRelationInverseTypeLabel(NameRelationshipType type
, boolean isZoological
) {
78 SortedSet
<NameRelationshipType
> vocab
=
79 CdmStore
.getDefault().getNameRelationshipTypes();
81 // SortedSet<NameRelationshipType> vocab =
82 // CdmSessionDataRepository.getDefault().getNameRelationshipTypes();
83 for (NameRelationshipType type1
: vocab
) {
84 if (type1
.equals(type
)) {
85 return type1
.getInverseLabel();