changes for deleting polytomous key nodes
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / strategy / cache / TaggedText.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.cdm.strategy.cache;
11
12 import javax.persistence.Transient;
13
14 import org.apache.commons.lang.StringUtils;
15
16 import eu.etaxonomy.cdm.common.CdmUtils;
17
18
19
20 /**
21 *
22 * @author a.kohlbecker
23 * @author m.doering
24 * @version 1.0
25 * @created 11.12.2007 12:11:19
26 *
27 */
28 public class TaggedText {
29
30 private String text;
31 private TagEnum type;
32
33
34 public static TaggedText NewWhitespaceInstance(){
35 return new TaggedText(TagEnum.separator, " ");
36 }
37
38 public String getText() {
39 return text;
40 }
41 public void setText(String text) {
42 this.text = text;
43 }
44 public TagEnum getType() {
45 return type;
46 }
47 public void setType(TagEnum type) {
48 this.type = type;
49 }
50 public TaggedText() {
51 super();
52 }
53
54 public TaggedText(TagEnum type, String text) {
55 super();
56 this.text = text;
57 this.type = type;
58 }
59
60 // *************************** DELEGATES ************************************/
61
62 @Transient
63 public boolean isName() {
64 return type.isName();
65 }
66 @Transient
67 public boolean isRank() {
68 return type.isRank();
69 }
70 @Transient
71 public boolean isAuthors() {
72 return type.isAuthors();
73 }
74 @Transient
75 public boolean isAppendedPhrase() {
76 return type.isAppendedPhrase();
77 }
78 @Transient
79 public boolean isReference() {
80 return type.isReference();
81 }
82 @Transient
83 public boolean isYear() {
84 return type.isYear();
85 }
86 @Transient
87 public boolean isFullName() {
88 return type.isFullName();
89 }
90 @Transient
91 public boolean isNomStatus() {
92 return type.isNomStatus();
93 }
94 @Transient
95 public boolean isSeparator() {
96 return type.isSeparator();
97 }
98 @Transient
99 public boolean isHybridSign() {
100 return type.isHybridSign();
101 }
102
103
104 // ********************** toString() ***********************************************/
105
106 @Override
107 public String toString(){
108 String result = CdmUtils.concat(":", type.toString(), text);
109 if (StringUtils.isBlank(result)){
110 return super.toString();
111 }else{
112 return result;
113 }
114 }
115
116 }