Project

General

Profile

Revision 2dca9610

ID2dca9610fad0944d3fc6771b708598e7ceaf11e0
Parent 1f088ad4
Child db183545

Added by Andreas Müller almost 3 years ago

ref #6630 unified all taxon name cache strategies except for ViralNameDefaultCacheStrategy

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TaxonName.java
83 83
import eu.etaxonomy.cdm.model.taxon.Taxon;
84 84
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
85 85
import eu.etaxonomy.cdm.strategy.cache.TaggedText;
86
import eu.etaxonomy.cdm.strategy.cache.name.BacterialNameDefaultCacheStrategy;
87
import eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy;
88 86
import eu.etaxonomy.cdm.strategy.cache.name.CacheUpdate;
89 87
import eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy;
90 88
import eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy;
91 89
import eu.etaxonomy.cdm.strategy.cache.name.ViralNameDefaultCacheStrategy;
92
import eu.etaxonomy.cdm.strategy.cache.name.ZooNameDefaultCacheStrategy;
93 90
import eu.etaxonomy.cdm.strategy.match.IMatchable;
94 91
import eu.etaxonomy.cdm.strategy.match.Match;
95 92
import eu.etaxonomy.cdm.strategy.match.Match.ReplaceMode;
......
684 681
        }else if (getNameType() == NomenclaturalCode.NonViral){
685 682
            this.cacheStrategy = (S)NonViralNameDefaultCacheStrategy.NewInstance();
686 683
        }else if (getNameType().isBotanical()){
687
            this.cacheStrategy = (S)BotanicNameDefaultCacheStrategy.NewInstance();
684
            this.cacheStrategy = (S)NonViralNameDefaultCacheStrategy.NewInstance();
688 685
        }else if (getNameType() == NomenclaturalCode.ICZN){
689
            this.cacheStrategy = (S)ZooNameDefaultCacheStrategy.NewInstance();
686
            this.cacheStrategy = (S)NonViralNameDefaultCacheStrategy.NewInstance();
690 687
        }else if (getNameType() == NomenclaturalCode.ICNB){
691
            this.cacheStrategy = (S)BacterialNameDefaultCacheStrategy.NewInstance();;
688
            this.cacheStrategy = (S)NonViralNameDefaultCacheStrategy.NewInstance();;
692 689
        }else if (getNameType() == NomenclaturalCode.ICVCN){
693 690
            this.cacheStrategy = (S) ViralNameDefaultCacheStrategy.NewInstance();
694 691
        }
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TaxonNameFactory.java
379 379
     * @param   fullNameString  the string to be parsed
380 380
     * @return                  the new zoological taxon name
381 381
     */
382
    public static IZoologicalName PARSED_ZOOLOGICAL(String fullNameString){
382
    public static TaxonName PARSED_ZOOLOGICAL(String fullNameString){
383 383
        return PARSED_ZOOLOGICAL(fullNameString, Rank.GENUS());
384 384
    }
385 385

  
......
393 393
     * @param   rank            the rank of the taxon name
394 394
     * @return                  the new zoological taxon name
395 395
     */
396
    public static IZoologicalName PARSED_ZOOLOGICAL(String fullNameString, Rank rank){
396
    public static TaxonName PARSED_ZOOLOGICAL(String fullNameString, Rank rank){
397 397
        if (nameParser == null){
398 398
            nameParser  = new NonViralNameParserImpl();
399 399
        }
400
        return (IZoologicalName)nameParser.parseFullName(fullNameString, NomenclaturalCode.ICZN, rank);
400
        return (TaxonName)nameParser.parseFullName(fullNameString, NomenclaturalCode.ICZN, rank);
401 401
    }
402 402

  
403 403

  
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/name/BacterialNameDefaultCacheStrategy.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
package eu.etaxonomy.cdm.strategy.cache.name;
10

  
11
import java.util.UUID;
12

  
13
import org.apache.log4j.Logger;
14

  
15
import eu.etaxonomy.cdm.model.name.IBacterialName;
16

  
17
/**
18
 * The bacterial name default cache strategy.
19
 *
20
 * @author a.mueller
21
 *
22
 */
23
public class BacterialNameDefaultCacheStrategy
24
            extends NonViralNameDefaultCacheStrategy<IBacterialName>
25
            implements  INonViralNameCacheStrategy<IBacterialName> {
26
	private static final long serialVersionUID = 7369285557176649585L;
27
	private static final Logger logger = Logger.getLogger(BacterialNameDefaultCacheStrategy.class);
28
	final static UUID uuid = UUID.fromString("b97cf0af-2f97-487e-8d06-cbe924f3222a");
29

  
30
	static {
31
		logger.info("BacterialNameDefaultCacheStrategy not yet really implemented. Its just a copy of BotanicalNameDefaultCacheStrategy right now !!");
32
	}
33

  
34
	@Override
35
	public  UUID getUuid(){
36
		return uuid;
37
	}
38

  
39

  
40
	public static BacterialNameDefaultCacheStrategy NewInstance(){
41
		return new BacterialNameDefaultCacheStrategy();
42
	}
43

  
44
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/name/BotanicNameDefaultCacheStrategy.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
package eu.etaxonomy.cdm.strategy.cache.name;
10

  
11
import java.util.UUID;
12

  
13
import org.apache.log4j.Logger;
14

  
15
import eu.etaxonomy.cdm.common.CdmUtils;
16
import eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor;
17
import eu.etaxonomy.cdm.model.name.IBotanicalName;
18

  
19
/**
20
 * T
21
 * @author a.mueller
22
 *
23
 */
24
public class BotanicNameDefaultCacheStrategy<T extends IBotanicalName>
25
            extends NonViralNameDefaultCacheStrategy<T>
26
            implements  INonViralNameCacheStrategy<T> {
27

  
28
    @SuppressWarnings("unused")
29
	private static final Logger logger = Logger.getLogger(BotanicNameDefaultCacheStrategy.class);
30
	private static final long serialVersionUID = 2679554971446197111L;
31

  
32
	final static UUID uuid = UUID.fromString("1cdda0d1-d5bc-480f-bf08-40a510a2f223");
33

  
34
	@Override
35
	public  UUID getUuid(){
36
		return uuid;
37
	}
38

  
39

  
40
	public static BotanicNameDefaultCacheStrategy NewInstance(){
41
		return new BotanicNameDefaultCacheStrategy();
42
	}
43

  
44
	/**
45
	 * Returns the AuthorCache part for a combination of an author and an ex author. This applies on combination authors
46
	 * as well as on basionym/orginal combination authors.
47
	 * The correct order is exAuthor ex author though some botanist do not know about and do it the
48
	 * other way round. (see 46.4-46.6 ICBN (Vienna Code, 2006))
49
	 * @param author the author
50
	 * @param exAuthor the ex-author
51
	 * @return
52
	 */
53
	@Override
54
	protected String getAuthorAndExAuthor(INomenclaturalAuthor author, INomenclaturalAuthor exAuthor){
55
		String result = "";
56
		String authorString = "";
57
		String exAuthorString = "";
58

  
59
		if (author != null){
60
			authorString = CdmUtils.Nz(author.getNomenclaturalTitle());
61
		}
62
		if (exAuthor != null){
63
			exAuthorString = CdmUtils.Nz(exAuthor.getNomenclaturalTitle());
64
			exAuthorString += ExAuthorSeperator;
65
		}
66

  
67
		result = exAuthorString + authorString;
68
		return result;
69

  
70
	}
71

  
72
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/name/INameCacheStrategy.java
10 10

  
11 11
import java.util.List;
12 12

  
13
import eu.etaxonomy.cdm.model.name.ITaxonNameBase;
14 13
import eu.etaxonomy.cdm.model.name.TaxonName;
15 14
import eu.etaxonomy.cdm.strategy.cache.HTMLTagRules;
16 15
import eu.etaxonomy.cdm.strategy.cache.TagEnum;
......
25 24
 *
26 25
 * @param <T> The concrete TaxonName class this strategy applies for
27 26
 */
28
public interface INameCacheStrategy<T extends ITaxonNameBase> extends IIdentifiableEntityCacheStrategy<T> {
27
public interface INameCacheStrategy extends IIdentifiableEntityCacheStrategy<TaxonName> {
29 28

  
30 29
    /**
31 30
     * Returns a list of name typified tokens that together make up the name (including authorship etc.).
......
39 38
     * @param taxonName
40 39
     * @return the tagged list, <code>null</code> if taxonName is <code>null</code>
41 40
     */
42
    public List<TaggedText> getTaggedTitle(T taxonName);
41
    public List<TaggedText> getTaggedTitle(TaxonName taxonName);
43 42

  
44 43
    /**
45 44
     * Same as {@link #getTaggedTitle(TaxonName)} but also includes the reference and
......
47 46
     * @param taxonName
48 47
     * @return
49 48
     */
50
    public List<TaggedText> getTaggedFullTitle(T taxonName);
49
    public List<TaggedText> getTaggedFullTitle(TaxonName taxonName);
51 50

  
52 51

  
53 52
    /**
......
58 57
     *  should be added after
59 58
     * @return
60 59
     */
61
    public List<TaggedText> getNomStatusTags(T taxonName, boolean includeSeparatorBefore,
60
    public List<TaggedText> getNomStatusTags(TaxonName taxonName, boolean includeSeparatorBefore,
62 61
            boolean includePostSeparator);
63 62

  
64 63
    /**
......
68 67
     * @param taxonName
69 68
     * @return
70 69
     */
71
    public String getFullTitleCache(T taxonName);
70
    public String getFullTitleCache(TaxonName taxonName);
72 71

  
73 72
	/**
74 73
	 * Returns the full title cache tagged by html tags according to tag rules.
......
76 75
	 * @param htmlTagRules
77 76
	 * @return
78 77
	 */
79
	public String getFullTitleCache(T nonViralName, HTMLTagRules htmlTagRules);
78
	public String getFullTitleCache(TaxonName nonViralName, HTMLTagRules htmlTagRules);
80 79

  
81 80

  
82 81
	/**
......
85 84
	 * @param htmlTagRules
86 85
	 * @return
87 86
	 */
88
	public String getTitleCache(T nonViralName, HTMLTagRules htmlTagRules);
87
	public String getTitleCache(TaxonName nonViralName, HTMLTagRules htmlTagRules);
89 88

  
90 89
	/**
91 90
     * Returns the composed scientific taxon name string without authors nor year.
......
96 95
     * @param object
97 96
     * @return
98 97
     */
99
    public String getNameCache(T taxonName);
98
    public String getNameCache(TaxonName taxonName);
100 99

  
101 100

  
102 101

  
......
105 104
     * @param taxonName
106 105
     * @return
107 106
     */
108
    public List<TaggedText> getTaggedName(T taxonName);
107
    public List<TaggedText> getTaggedName(TaxonName taxonName);
109 108

  
110 109
    /**
111 110
     * Returns the composed author string. Returns null for viral names.
112 111
     * @param object
113 112
     * @return
114 113
     */
115
    public String getAuthorshipCache(T nonViralName);
114
    public String getAuthorshipCache(TaxonName nonViralName);
116 115

  
117 116
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/name/INonViralNameCacheStrategy.java
8 8
*/
9 9
package eu.etaxonomy.cdm.strategy.cache.name;
10 10

  
11
import eu.etaxonomy.cdm.model.name.INonViralName;
11
import eu.etaxonomy.cdm.model.name.TaxonName;
12 12

  
13 13
/**
14 14
 * A name cache rendering strategy for all TaxonName subclasses.
......
17 17
 *
18 18
 * @param <T> The concrete TaxonName class this strategy applies for
19 19
 */
20
public interface INonViralNameCacheStrategy<T extends INonViralName> extends INameCacheStrategy<T> {
20
public interface INonViralNameCacheStrategy extends INameCacheStrategy {
21 21

  
22 22
	/**
23 23
	 * Returns the last epithet of the name (i.e. uninomial if generic or above, infrageneric epithet if infrageneric,
......
30 30
	 * @param object
31 31
	 * @return
32 32
	 */
33
	public String getLastEpithet(T taxonName);
33
	public String getLastEpithet(TaxonName taxonName);
34 34

  
35 35

  
36 36

  
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/name/IViralNameCacheStrategy.java
8 8
*/
9 9
package eu.etaxonomy.cdm.strategy.cache.name;
10 10

  
11
import eu.etaxonomy.cdm.model.name.IViralName;
12

  
13 11
/**
14 12
 * A name cache rendering strategy for all TaxonName subclasses.
15 13
 * Different TaxonName subclasses could have different strategies.
......
17 15
 *
18 16
 * @param <T> The concrete TaxonName class this strategy applies for
19 17
 */
20
public interface IViralNameCacheStrategy<T extends IViralName> extends INameCacheStrategy<T> {
18
public interface IViralNameCacheStrategy extends INameCacheStrategy {
21 19

  
22 20

  
23 21
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/name/NameCacheStrategyBase.java
41 41
/**
42 42
 * @author AM
43 43
 */
44
public abstract class NameCacheStrategyBase<T extends ITaxonNameBase>
44
public abstract class NameCacheStrategyBase
45 45
        extends StrategyBase
46
        implements INameCacheStrategy<T> {
46
        implements INameCacheStrategy {
47 47
    private static final long serialVersionUID = -2322348388258675517L;
48 48

  
49 49
    private static final Logger logger = Logger.getLogger(NameCacheStrategyBase.class);
......
57 57
        super();
58 58
    }
59 59

  
60
//    @Override
61
//    public abstract String getFullTitleCache(T name);
62
//
63
//    @Override
64
//    public abstract String getFullTitleCache(T name, HTMLTagRules rules);
65

  
66 60

  
67 61
    @Override
68
    public String getFullTitleCache(T taxonName, HTMLTagRules htmlTagRules) {
62
    public String getFullTitleCache(TaxonName taxonName, HTMLTagRules htmlTagRules) {
69 63
        List<TaggedText> tags = getTaggedFullTitle(taxonName);
70 64
        if (tags == null){
71 65
            return null;
......
76 70
    }
77 71

  
78 72
    @Override
79
    public String getFullTitleCache(T taxonName) {
73
    public String getFullTitleCache(TaxonName taxonName) {
80 74
        return getFullTitleCache(taxonName, null);
81 75
    }
82 76

  
......
87 81
     * @return
88 82
     */
89 83
    @Override
90
    public List<TaggedText> getNomStatusTags(T nonViralName, boolean includeSeparatorBefore,
84
    public List<TaggedText> getNomStatusTags(TaxonName nonViralName, boolean includeSeparatorBefore,
91 85
            boolean includeSeparatorAfter) {
92 86

  
93 87
        Set<NomenclaturalStatus> ncStati = nonViralName.getStatus();
......
130 124
     * @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy#getNameCache(eu.etaxonomy.cdm.model.name.TaxonName)
131 125
     */
132 126
    @Override
133
    public String getNameCache(T nonViralName) {
127
    public String getNameCache(TaxonName nonViralName) {
134 128
        List<TaggedText> tags = getTaggedName(nonViralName);
135 129
        if (tags == null){
136 130
            return null;
......
149 143
     * @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy#getTitleCache(eu.etaxonomy.cdm.model.common.IdentifiableEntity)
150 144
     */
151 145
    @Override
152
    public String getTitleCache(T nonViralName) {
146
    public String getTitleCache(TaxonName nonViralName) {
153 147
        return getTitleCache(nonViralName, null);
154 148
    }
155 149

  
156 150
    @Override
157
    public String getTitleCache(T nonViralName, HTMLTagRules htmlTagRules) {
151
    public String getTitleCache(TaxonName nonViralName, HTMLTagRules htmlTagRules) {
158 152
        List<TaggedText> tags = getTaggedTitle(nonViralName);
159 153
        if (tags == null){
160 154
            return null;
......
165 159
    }
166 160

  
167 161
    @Override
168
    public List<TaggedText> getTaggedTitle(T taxonName) {
162
    public List<TaggedText> getTaggedTitle(TaxonName taxonName) {
169 163
        if (taxonName == null){
170 164
            return null;
171 165
        }
......
182 176

  
183 177
    }
184 178

  
185
    protected abstract List<TaggedText> doGetTaggedTitle(T taxonName);
179
    protected abstract List<TaggedText> doGetTaggedTitle(TaxonName taxonName);
186 180

  
187 181
    @Override
188
    public List<TaggedText> getTaggedFullTitle(T nonViralName) {
182
    public List<TaggedText> getTaggedFullTitle(TaxonName nonViralName) {
189 183
        List<TaggedText> tags = new ArrayList<>();
190 184

  
191 185
        //null
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/name/NonViralNameDefaultCacheStrategy.java
49 49
 * existing methods, e.g. a CacheStrategy for zoological names should overwrite getAuthorAndExAuthor
50 50
 * @author a.mueller
51 51
 */
52
public class NonViralNameDefaultCacheStrategy<T extends INonViralName>
53
        extends NameCacheStrategyBase<T>
54
        implements INonViralNameCacheStrategy<T> {
52
public class NonViralNameDefaultCacheStrategy
53
        extends NameCacheStrategyBase
54
        implements INonViralNameCacheStrategy {
55 55

  
56 56
    private static final Logger logger = Logger.getLogger(NonViralNameDefaultCacheStrategy.class);
57 57
	private static final long serialVersionUID = -6577757501563212669L;
58 58

  
59 59
    final static UUID uuid = UUID.fromString("1cdda0d1-d5bc-480f-bf08-40a510a2f223");
60 60

  
61
    protected String NameAuthorSeperator = " ";
62
    protected String BasionymStart = "(";
63
    protected String BasionymEnd = ")";
64
    protected String ExAuthorSeperator = " ex ";
61
    protected String nameAuthorSeperator = " ";
62
    protected String basionymStart = "(";
63
    protected String basionymEnd = ")";
64
    protected String exAuthorSeperator = " ex ";
65 65
    private static String NOTHO = "notho";
66
    protected CharSequence BasionymAuthorCombinationAuthorSeperator = " ";
66
    protected CharSequence basionymAuthorCombinationAuthorSeperator = " ";
67

  
68
    protected String zooAuthorYearSeperator = ", ";
69

  
70

  
67 71

  
68 72
    @Override
69 73
    public  UUID getUuid(){
70 74
        return uuid;
71 75
    }
72 76

  
77
// ************************** FACTORY  ******************************/
73 78

  
74
    /**
75
     * Factory method
76
     * @return NonViralNameDefaultCacheStrategy A new instance of  NonViralNameDefaultCacheStrategy
77
     */
78 79
    public static NonViralNameDefaultCacheStrategy NewInstance(){
79 80
        return new NonViralNameDefaultCacheStrategy();
80 81
    }
81 82

  
82
    /**
83
     * Factory method
84
     * @return NonViralNameDefaultCacheStrategy A new instance of  NonViralNameDefaultCacheStrategy
85
     */
86
    public static <T extends INonViralName> NonViralNameDefaultCacheStrategy<T> NewInstance(Class<T> clazz){
87
        return new NonViralNameDefaultCacheStrategy<T>();
88
    }
89 83

  
90
    /**
91
     * Constructor
92
     */
84
// ************ CONSTRUCTOR *******************/
85

  
93 86
    protected NonViralNameDefaultCacheStrategy(){
94 87
        super();
95 88
    }
......
101 94
     * @return
102 95
     */
103 96
    public String getNameAuthorSeperator() {
104
        return NameAuthorSeperator;
97
        return nameAuthorSeperator;
105 98
    }
106

  
107

  
108 99
    public void setNameAuthorSeperator(String nameAuthorSeperator) {
109
        NameAuthorSeperator = nameAuthorSeperator;
100
        this.nameAuthorSeperator = nameAuthorSeperator;
110 101
    }
111 102

  
112 103

  
......
116 107
     * @return
117 108
     */
118 109
    public String getBasionymStart() {
119
        return BasionymStart;
110
        return basionymStart;
120 111
    }
121

  
122

  
123 112
    public void setBasionymStart(String basionymStart) {
124
        BasionymStart = basionymStart;
113
        this.basionymStart = basionymStart;
125 114
    }
126 115

  
127

  
128 116
    /**
129 117
     * String the basionym author part ends with e.g. ')'.
130 118
     * This should correspond with the {@link NonViralNameDefaultCacheStrategy#getBasionymStart() basionymStart} attribute
131 119
     * @return
132 120
     */
133 121
    public String getBasionymEnd() {
134
        return BasionymEnd;
122
        return basionymEnd;
135 123
    }
136

  
137

  
138 124
    public void setBasionymEnd(String basionymEnd) {
139
        BasionymEnd = basionymEnd;
125
        this.basionymEnd = basionymEnd;
140 126
    }
141 127

  
142 128

  
......
145 131
     * @return
146 132
     */
147 133
    public String getExAuthorSeperator() {
148
        return ExAuthorSeperator;
134
        return exAuthorSeperator;
149 135
    }
150

  
151

  
152 136
    public void setExAuthorSeperator(String exAuthorSeperator) {
153
        ExAuthorSeperator = exAuthorSeperator;
137
        this.exAuthorSeperator = exAuthorSeperator;
154 138
    }
155 139

  
156 140

  
......
159 143
     * @return
160 144
     */
161 145
    public CharSequence getBasionymAuthorCombinationAuthorSeperator() {
162
        return BasionymAuthorCombinationAuthorSeperator;
146
        return basionymAuthorCombinationAuthorSeperator;
163 147
    }
164 148

  
165 149

  
166 150
    public void setBasionymAuthorCombinationAuthorSeperator( CharSequence basionymAuthorCombinationAuthorSeperator) {
167
        BasionymAuthorCombinationAuthorSeperator = basionymAuthorCombinationAuthorSeperator;
151
        this.basionymAuthorCombinationAuthorSeperator = basionymAuthorCombinationAuthorSeperator;
152
    }
153

  
154
    public String getZooAuthorYearSeperator() {
155
        return zooAuthorYearSeperator;
156
    }
157
    public void setZooAuthorYearSeperator(String authorYearSeperator) {
158
        this.zooAuthorYearSeperator = authorYearSeperator;
168 159
    }
169 160

  
170 161

  
......
176 167
// ******************* Authorship ******************************/
177 168

  
178 169
    @Override
179
    public String getAuthorshipCache(T taxonName) {
170
    public String getAuthorshipCache(TaxonName taxonName) {
180 171
        if (taxonName == null){
181 172
            return null;
182 173
        }
......
193 184
     * @param nonViralName
194 185
     * @return
195 186
     */
196
    protected String getNonCacheAuthorshipCache(T nonViralName){
187
    protected String getNonCacheAuthorshipCache(TaxonName nonViralName){
188
        if (nonViralName.getNameType().isZoological()){
189
            return this.getZoologicalNonCacheAuthorshipCache(nonViralName);
190
        }else{
191
            String result = "";
192
            INomenclaturalAuthor combinationAuthor = nonViralName.getCombinationAuthorship();
193
            INomenclaturalAuthor exCombinationAuthor = nonViralName.getExCombinationAuthorship();
194
            INomenclaturalAuthor basionymAuthor = nonViralName.getBasionymAuthorship();
195
            INomenclaturalAuthor exBasionymAuthor = nonViralName.getExBasionymAuthorship();
196
            String basionymPart = "";
197
            String authorPart = "";
198
            //basionym
199
            if (basionymAuthor != null || exBasionymAuthor != null){
200
                basionymPart = basionymStart + getAuthorAndExAuthor(basionymAuthor, exBasionymAuthor) + basionymEnd;
201
            }
202
            if (combinationAuthor != null || exCombinationAuthor != null){
203
                authorPart = getAuthorAndExAuthor(combinationAuthor, exCombinationAuthor);
204
            }
205
            result = CdmUtils.concat(basionymAuthorCombinationAuthorSeperator, basionymPart, authorPart);
206
//        if ("".equals(result)){
207
//        	result = null;
208
//        }
209
            return result;
210
        }
211
    }
212

  
213
    protected String getZoologicalNonCacheAuthorshipCache(TaxonName nonViralName) {
214
        if (nonViralName == null){
215
            return null;
216
        }
197 217
        String result = "";
198 218
        INomenclaturalAuthor combinationAuthor = nonViralName.getCombinationAuthorship();
199 219
        INomenclaturalAuthor exCombinationAuthor = nonViralName.getExCombinationAuthorship();
200 220
        INomenclaturalAuthor basionymAuthor = nonViralName.getBasionymAuthorship();
201 221
        INomenclaturalAuthor exBasionymAuthor = nonViralName.getExBasionymAuthorship();
222
        Integer publicationYear = nonViralName.getPublicationYear();
223
        Integer originalPublicationYear = nonViralName.getOriginalPublicationYear();
224

  
202 225
        String basionymPart = "";
203 226
        String authorPart = "";
204 227
        //basionym
205
        if (basionymAuthor != null || exBasionymAuthor != null){
206
            basionymPart = BasionymStart + getAuthorAndExAuthor(basionymAuthor, exBasionymAuthor) + BasionymEnd;
228
        if (basionymAuthor != null || exBasionymAuthor != null || originalPublicationYear != null ){
229
            String authorAndEx = getAuthorAndExAuthor(basionymAuthor, exBasionymAuthor);
230
            String originalPublicationYearString = originalPublicationYear == null ? null : String.valueOf(originalPublicationYear);
231
            String authorAndExAndYear = CdmUtils.concat(zooAuthorYearSeperator, authorAndEx, originalPublicationYearString );
232
            basionymPart = basionymStart + authorAndExAndYear + basionymEnd;
207 233
        }
208 234
        if (combinationAuthor != null || exCombinationAuthor != null){
209
            authorPart = getAuthorAndExAuthor(combinationAuthor, exCombinationAuthor);
235
            String authorAndEx = getAuthorAndExAuthor(combinationAuthor, exCombinationAuthor);
236
            String publicationYearString = publicationYear == null ? null : String.valueOf(publicationYear);
237
            authorPart = CdmUtils.concat(zooAuthorYearSeperator, authorAndEx, publicationYearString);
238
        }
239
        result = CdmUtils.concat(basionymAuthorCombinationAuthorSeperator, basionymPart, authorPart);
240
        if (result == null){
241
            result = "";
210 242
        }
211
        result = CdmUtils.concat(BasionymAuthorCombinationAuthorSeperator, basionymPart, authorPart);
212
//        if ("".equals(result)){
213
//        	result = null;
214
//        }
215 243
        return result;
216 244
    }
217 245

  
246

  
218 247
    /**
219
     * Returns the AuthorCache part for a combination of an author and an ex author. This applies on combination authors
220
     * as well as on basionym/orginal combination authors.
248
     * Returns the AuthorCache part for a combination of an author and an ex author. This applies on
249
     * combination authors as well as on basionym/orginal combination authors.
250
     * The correct order is exAuthor ex author though some botanist do not know about and do it the
251
     * other way round. (see 46.4-46.6 ICBN (Vienna Code, 2006))
252
     *
221 253
     * @param author the author
222 254
     * @param exAuthor the ex-author
223 255
     * @return
224 256
     */
225 257
    protected String getAuthorAndExAuthor(INomenclaturalAuthor author, INomenclaturalAuthor exAuthor){
226
        String result = "";
227 258
        String authorString = "";
228 259
        String exAuthorString = "";
229 260
        if (author != null){
......
231 262
        }
232 263
        if (exAuthor != null){
233 264
            exAuthorString = CdmUtils.Nz(exAuthor.getNomenclaturalTitle());
265
            exAuthorString += exAuthorSeperator;
234 266
        }
235
        if (exAuthorString.length() > 0 ){
236
            exAuthorString = exAuthorString + ExAuthorSeperator;
237
        }
238
        result = exAuthorString + authorString;
267
        String result = exAuthorString + authorString;
239 268
        return result;
240 269
    }
241 270

  
242 271

  
272

  
243 273
    /**
244 274
     * Checks if the given name should include the author in it's cached version.<BR>
245 275
     * This is usually the case but not for <i>species aggregates</i>.
......
258 288
// ************* TAGGED NAME ***************************************/
259 289

  
260 290
    @Override
261
    public List<TaggedText> getTaggedFullTitle(T nonViralName) {
291
    public List<TaggedText> getTaggedFullTitle(TaxonName nonViralName) {
262 292
        List<TaggedText> tags = new ArrayList<>();
263 293

  
264 294
        //null
......
309 339
     * @return
310 340
     */
311 341
    @Override
312
    public List<TaggedText> getNomStatusTags(T nonViralName, boolean includeSeparatorBefore,
342
    public List<TaggedText> getNomStatusTags(TaxonName nonViralName, boolean includeSeparatorBefore,
313 343
            boolean includeSeparatorAfter) {
314 344

  
315 345
        Set<NomenclaturalStatus> ncStati = nonViralName.getStatus();
......
347 377
    }
348 378

  
349 379
    @Override
350
    public List<TaggedText> getTaggedTitle(T nonViralName) {
380
    public List<TaggedText> getTaggedTitle(TaxonName nonViralName) {
351 381
        if (nonViralName == null){
352 382
            return null;
353 383
        }
......
370 400
                    tags.add(new TaggedText(TagEnum.hybridSign, hybridSeparator));
371 401
                }
372 402
                isFirst = false;
373
                tags.addAll(getTaggedTitle((T)rel.getParentName()));
403
                tags.addAll(getTaggedTitle(rel.getParentName()));
374 404
            }
375 405
            return tags;
376 406
        }else if (nonViralName.isAutonym()){
......
396 426
     * @return
397 427
     */
398 428
    @Override
399
    public List<TaggedText> getTaggedName(T nonViralName) {
429
    public List<TaggedText> getTaggedName(TaxonName nonViralName) {
400 430
        if (nonViralName == null){
401 431
            return null;
402 432
        }
......
415 445
                    tags.add(new TaggedText(TagEnum.hybridSign, hybridSeparator));
416 446
                }
417 447
                isFirst = false;
418
                tags.addAll(getTaggedName((T)rel.getParentName()));
448
                tags.addAll(getTaggedName(rel.getParentName()));
419 449
            }
420 450
            return tags;
421 451

  
......
449 479
//***************************** PRIVATES ***************************************/
450 480

  
451 481

  
452
    private boolean isAggregateWithAuthorship(T nonViralName, Rank rank) {
482
    private boolean isAggregateWithAuthorship(TaxonName nonViralName, Rank rank) {
453 483
		if (rank == null){
454 484
			return false;
455 485
		}else{
......
466 496
     * @param nonViralName
467 497
     * @return
468 498
     */
469
    private List<TaggedText> handleTaggedAutonym(T nonViralName) {
499
    private List<TaggedText> handleTaggedAutonym(TaxonName nonViralName) {
470 500
    	List<TaggedText> tags = null;
471 501
    	if (nonViralName.isInfraSpecific()){
472 502
	        //species part
......
705 735
     * @param nonViralName
706 736
     * @return
707 737
     */
708
    protected List<TaggedText> getInfraSpeciesTaggedNameCache(T nonViralName){
709
        return getInfraSpeciesTaggedNameCache(nonViralName, true);
738
    protected List<TaggedText> getInfraSpeciesTaggedNameCache(TaxonName nonViralName){
739
        if (nonViralName.getNameType().isZoological()){
740
            boolean includeMarker = ! (nonViralName.isAutonym());
741
            return getInfraSpeciesTaggedNameCache(nonViralName, includeMarker);
742
        }else{
743
            return getInfraSpeciesTaggedNameCache(nonViralName, true);
744
        }
710 745
    }
711 746

  
712 747
    /**
......
874 909

  
875 910

  
876 911
	@Override
877
    public String getLastEpithet(T taxonName) {
912
    public String getLastEpithet(TaxonName taxonName) {
878 913
        Rank rank = taxonName.getRank();
879 914
        if(rank.isGenus() || rank.isSupraGeneric()) {
880 915
            return taxonName.getGenusOrUninomial();
......
892 927
     * {@inheritDoc}
893 928
     */
894 929
    @Override
895
    protected List<TaggedText> doGetTaggedTitle(T nonViralName) {
930
    protected List<TaggedText> doGetTaggedTitle(TaxonName nonViralName) {
896 931
        List<TaggedText> tags = new ArrayList<>();
897 932
        if (nonViralName.isHybridFormula()){
898 933
            //hybrid formula
......
904 939
                    tags.add(new TaggedText(TagEnum.hybridSign, hybridSeparator));
905 940
                }
906 941
                isFirst = false;
907
                tags.addAll(getTaggedTitle((T)rel.getParentName()));
942
                tags.addAll(getTaggedTitle(rel.getParentName()));
908 943
            }
909 944
            return tags;
910 945
        }else if (nonViralName.isAutonym()){
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/name/ViralNameDefaultCacheStrategy.java
14 14

  
15 15
import org.apache.log4j.Logger;
16 16

  
17
import eu.etaxonomy.cdm.model.name.IViralName;
17
import eu.etaxonomy.cdm.model.name.TaxonName;
18 18
import eu.etaxonomy.cdm.strategy.cache.TagEnum;
19 19
import eu.etaxonomy.cdm.strategy.cache.TaggedText;
20 20

  
......
24 24
 *
25 25
 */
26 26
public class ViralNameDefaultCacheStrategy
27
        extends NameCacheStrategyBase<IViralName>
28
        implements IViralNameCacheStrategy<IViralName> {
27
        extends NameCacheStrategyBase
28
        implements IViralNameCacheStrategy {
29 29

  
30 30
    private static final long serialVersionUID = 2732652334900146554L;
31 31
    @SuppressWarnings("unused")
......
52 52
     * {@inheritDoc}
53 53
     */
54 54
    @Override
55
    protected List<TaggedText> doGetTaggedTitle(IViralName viralName) {
55
    protected List<TaggedText> doGetTaggedTitle(TaxonName viralName) {
56 56
        List<TaggedText> tags = new ArrayList<>();
57 57
        String acronym = viralName.getAcronym();
58 58
        tags.add(new TaggedText(TagEnum.name, acronym));
......
63 63
     * {@inheritDoc}
64 64
     */
65 65
    @Override
66
    public List<TaggedText> getTaggedName(IViralName taxonName) {
66
    public List<TaggedText> getTaggedName(TaxonName taxonName) {
67 67
        return null /*this.getTaggedTitle(taxonName)*/;
68 68
    }
69 69

  
......
71 71
     * {@inheritDoc}
72 72
     */
73 73
    @Override
74
    public String getAuthorshipCache(IViralName nonViralName) {
74
    public String getAuthorshipCache(TaxonName nonViralName) {
75 75
        return null;
76 76
    }
77 77

  
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/name/ZooNameDefaultCacheStrategy.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.name;
11

  
12
import java.util.List;
13
import java.util.UUID;
14

  
15
import org.apache.log4j.Logger;
16

  
17
import eu.etaxonomy.cdm.common.CdmUtils;
18
import eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor;
19
import eu.etaxonomy.cdm.model.name.IZoologicalName;
20
import eu.etaxonomy.cdm.strategy.cache.TaggedText;
21

  
22
public class ZooNameDefaultCacheStrategy
23
            extends NonViralNameDefaultCacheStrategy<IZoologicalName> {
24

  
25
	@SuppressWarnings("unused")
26
	private static final Logger logger = Logger.getLogger(ZooNameDefaultCacheStrategy.class);
27
	private static final long serialVersionUID = 6640953957903705560L;
28

  
29
	final static UUID uuid = UUID.fromString("950c4236-8156-4675-b866-785df33bc4d9");
30

  
31
	protected String AuthorYearSeperator = ", ";
32

  
33
	@Override
34
	public UUID getUuid(){
35
		return uuid;
36
	}
37

  
38

  
39
	/**
40
	 * Factory method
41
	 * @return
42
	 */
43
	public static ZooNameDefaultCacheStrategy NewInstance(){
44
		return new ZooNameDefaultCacheStrategy();
45
	}
46

  
47
	/**
48
	 * Constructor
49
	 */
50
	protected ZooNameDefaultCacheStrategy(){
51
		super();
52
	}
53

  
54

  
55

  
56
	/**
57
	 * @return Strings that separates the author part and the year part
58
	 * @return
59
	 */
60
	public String getAuthorYearSeperator() {
61
		return AuthorYearSeperator;
62
	}
63

  
64

  
65
	public void setAuthorYearSeperator(String authorYearSeperator) {
66
		AuthorYearSeperator = authorYearSeperator;
67
	}
68

  
69
	@Override
70
	protected String getNonCacheAuthorshipCache(IZoologicalName nonViralName) {
71
		if (nonViralName == null){
72
			return null;
73
		}
74
		String result = "";
75
		INomenclaturalAuthor combinationAuthor = nonViralName.getCombinationAuthorship();
76
		INomenclaturalAuthor exCombinationAuthor = nonViralName.getExCombinationAuthorship();
77
		INomenclaturalAuthor basionymAuthor = nonViralName.getBasionymAuthorship();
78
		INomenclaturalAuthor exBasionymAuthor = nonViralName.getExBasionymAuthorship();
79
		Integer publicationYear = nonViralName.getPublicationYear();
80
		Integer originalPublicationYear = nonViralName.getOriginalPublicationYear();
81

  
82
		String basionymPart = "";
83
		String authorPart = "";
84
		//basionym
85
		if (basionymAuthor != null || exBasionymAuthor != null || originalPublicationYear != null ){
86
			String authorAndEx = getAuthorAndExAuthor(basionymAuthor, exBasionymAuthor);
87
			String originalPublicationYearString = originalPublicationYear == null ? null : String.valueOf(originalPublicationYear);
88
			String authorAndExAndYear = CdmUtils.concat(AuthorYearSeperator, authorAndEx, originalPublicationYearString );
89
			basionymPart = BasionymStart + authorAndExAndYear +BasionymEnd;
90
		}
91
		if (combinationAuthor != null || exCombinationAuthor != null){
92
			String authorAndEx = getAuthorAndExAuthor(combinationAuthor, exCombinationAuthor);
93
			String publicationYearString = publicationYear == null ? null : String.valueOf(publicationYear);
94
			authorPart = CdmUtils.concat(AuthorYearSeperator, authorAndEx, publicationYearString);
95
		}
96
		result = CdmUtils.concat(BasionymAuthorCombinationAuthorSeperator, basionymPart, authorPart);
97
		if (result == null){
98
			result = "";
99
		}
100
		return result;
101
	}
102

  
103

  
104
	@Override
105
	protected List<TaggedText> getInfraSpeciesTaggedNameCache(IZoologicalName nonViralName){
106
		boolean includeMarker = ! (nonViralName.isAutonym());
107
		return getInfraSpeciesTaggedNameCache(nonViralName, includeMarker);
108
	}
109

  
110
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/name/ZooNameNoMarkerCacheStrategy.java
16 16
import org.apache.log4j.Logger;
17 17

  
18 18
import eu.etaxonomy.cdm.model.name.INonViralName;
19
import eu.etaxonomy.cdm.model.name.IZoologicalName;
19
import eu.etaxonomy.cdm.model.name.TaxonName;
20 20
import eu.etaxonomy.cdm.strategy.cache.TagEnum;
21 21
import eu.etaxonomy.cdm.strategy.cache.TaggedText;
22 22

  
23
public class ZooNameNoMarkerCacheStrategy extends ZooNameDefaultCacheStrategy {
24
	@SuppressWarnings("unused")
23
public class ZooNameNoMarkerCacheStrategy
24
                extends NonViralNameDefaultCacheStrategy {
25

  
26
    @SuppressWarnings("unused")
25 27
	private static final Logger logger = Logger.getLogger(ZooNameNoMarkerCacheStrategy.class);
26 28
	private static final long serialVersionUID = 2821727191810867550L;
27 29

  
......
51 53

  
52 54

  
53 55
	@Override
54
	protected List<TaggedText> getInfraSpeciesTaggedNameCache(IZoologicalName nonViralName){
56
	protected List<TaggedText> getInfraSpeciesTaggedNameCache(TaxonName nonViralName){
55 57
		boolean includeMarker = false;
56 58
		return getInfraSpeciesTaggedNameCache(nonViralName, includeMarker);
57 59
	}
......
64 66
	        tags.add(new TaggedText(TagEnum.name, "(" + infraGenEpi + ")"));
65 67
        }
66 68
	}
67

  
68

  
69 69
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/taxon/TaxonBaseDefaultCacheStrategy.java
17 17

  
18 18
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
19 19
import eu.etaxonomy.cdm.model.common.CdmBase;
20
import eu.etaxonomy.cdm.model.name.INonViralName;
21 20
import eu.etaxonomy.cdm.model.name.ITaxonNameBase;
22 21
import eu.etaxonomy.cdm.model.name.TaxonName;
23 22
import eu.etaxonomy.cdm.model.reference.Reference;
......
97 96
        TaxonName<?, INameCacheStrategy> name = CdmBase.deproxy(taxonBase.getName());
98 97

  
99 98
        if (name != null){
100
            INameCacheStrategy<ITaxonNameBase> nameCacheStrategy = name.getCacheStrategy();
101
            if (taxonBase.isUseNameCache() && name.isNonViral() && nameCacheStrategy instanceof INonViralNameCacheStrategy<?>){
102
                INonViralNameCacheStrategy<INonViralName> nvnCacheStrategy = (INonViralNameCacheStrategy)nameCacheStrategy;
99
            INameCacheStrategy nameCacheStrategy = name.getCacheStrategy();
100
            if (taxonBase.isUseNameCache() && name.isNonViral() && nameCacheStrategy instanceof INonViralNameCacheStrategy){
101
                INonViralNameCacheStrategy nvnCacheStrategy = (INonViralNameCacheStrategy)nameCacheStrategy;
103 102
                List<TaggedText> nameCacheTags = nvnCacheStrategy.getTaggedName(name);
104 103
                tags.addAll(nameCacheTags);
105 104
            }else{
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/taxon/TaxonBaseShortSecCacheStrategy.java
27 27
import eu.etaxonomy.cdm.strategy.cache.TagEnum;
28 28
import eu.etaxonomy.cdm.strategy.cache.TaggedCacheHelper;
29 29
import eu.etaxonomy.cdm.strategy.cache.TaggedText;
30
import eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy;
31 30

  
32 31
public class TaxonBaseShortSecCacheStrategy<T extends TaxonBase>
33 32
        extends StrategyBase
......
158 157
            return tags;
159 158
        }else{
160 159
            //name
161
            TaxonName<?,INameCacheStrategy<TaxonName>> name = taxonBase.getName();
160
            TaxonName name = taxonBase.getName();
162 161
            if (name != null){
163 162
                //TODO
164 163
                List<TaggedText> nameTags = name.getCacheStrategy().getTaggedTitle(name);
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/name/TaxonNameTest.java
61 61
	}
62 62

  
63 63

  
64
	private class TaxonNameTestClass extends TaxonName<TaxonNameTestClass, INameCacheStrategy<TaxonNameTestClass>>{
64
	private class TaxonNameTestClass extends TaxonName<TaxonNameTestClass, INameCacheStrategy>{
65 65
		public TaxonNameTestClass(Rank rank, HomotypicalGroup hg){super(null, rank, hg);}
66 66
		@Override
67 67
		public void setCacheStrategy(INameCacheStrategy strategy){}
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/name/BotanicNameCacheStrategyTest.java
25 25
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
26 26
import eu.etaxonomy.cdm.model.common.DefaultTermInitializer;
27 27
import eu.etaxonomy.cdm.model.common.TimePeriod;
28
import eu.etaxonomy.cdm.model.name.IBotanicalName;
29 28
import eu.etaxonomy.cdm.model.name.INonViralName;
30 29
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
31 30
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
32 31
import eu.etaxonomy.cdm.model.name.Rank;
32
import eu.etaxonomy.cdm.model.name.TaxonName;
33 33
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
34 34
import eu.etaxonomy.cdm.model.reference.Reference;
35 35
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
......
52 52
	private static final String basAuthorString = "Basio, A.";
53 53
	private static final String exBasAuthorString = "ExBas. N.";
54 54

  
55
	private BotanicNameDefaultCacheStrategy strategy;
56
	private IBotanicalName familyName;
57
	private IBotanicalName genusName;
58
	private IBotanicalName subGenusName;
59
	private IBotanicalName speciesName;
60
	private IBotanicalName subSpeciesName;
55
	private NonViralNameDefaultCacheStrategy strategy;
56
	private TaxonName familyName;
57
	private TaxonName genusName;
58
	private TaxonName subGenusName;
59
	private TaxonName speciesName;
60
	private TaxonName subSpeciesName;
61 61
	private TeamOrPersonBase<?> author;
62 62
	private TeamOrPersonBase<?> exAuthor;
63 63
	private TeamOrPersonBase<?> basAuthor;
......
79 79
	 */
80 80
	@Before
81 81
	public void setUp() throws Exception {
82
		strategy = BotanicNameDefaultCacheStrategy.NewInstance();
82
		strategy = NonViralNameDefaultCacheStrategy.NewInstance();
83 83
		familyName = TaxonNameFactory.PARSED_BOTANICAL(familyNameString, Rank.FAMILY());
84 84
		genusName = TaxonNameFactory.PARSED_BOTANICAL(genusNameString, Rank.GENUS());
85 85

  
......
132 132
	 */
133 133
	@Test
134 134
	public final void testNewInstance() {
135
		BotanicNameDefaultCacheStrategy<?> cacheStrategy = BotanicNameDefaultCacheStrategy.NewInstance();
135
	    NonViralNameDefaultCacheStrategy cacheStrategy = NonViralNameDefaultCacheStrategy.NewInstance();
136 136
		assertNotNull(cacheStrategy);
137 137
	}
138 138

  
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/name/NonViralNameDefaultCacheStrategyTest.java
52 52
    @SuppressWarnings("unused")
53 53
	private static final Logger logger = Logger.getLogger(NonViralNameDefaultCacheStrategyTest.class);
54 54

  
55
    private NonViralNameDefaultCacheStrategy<INonViralName> strategy;
55
    private NonViralNameDefaultCacheStrategy strategy;
56 56

  
57 57
    private static final String familyNameString = "Familia";
58 58
    private static final String genusNameString = "Genus";
......
69 69
    private IBotanicalName familyName;
70 70
    private IBotanicalName genusName;
71 71
    private IBotanicalName subGenusName;
72
    private IBotanicalName speciesName;
73
    private IBotanicalName subSpeciesName;
72
    private TaxonName speciesName;
73
    private TaxonName subSpeciesName;
74 74
    private TeamOrPersonBase<?> author;
75 75
    private TeamOrPersonBase<?> exAuthor;
76 76
    private TeamOrPersonBase<?> basAuthor;
......
170 170

  
171 171
        //unranked taxa
172 172
        String unrankedCache;
173
        IBotanicalName unrankedName = TaxonNameFactory.NewBotanicalInstance(Rank.INFRASPECIFICTAXON());
173
        TaxonName unrankedName = TaxonNameFactory.NewBotanicalInstance(Rank.INFRASPECIFICTAXON());
174 174
        unrankedName.setGenusOrUninomial("Genus");
175
        NonViralNameDefaultCacheStrategy<IBotanicalName> strategy = NonViralNameDefaultCacheStrategy.NewInstance();
175
        NonViralNameDefaultCacheStrategy strategy = NonViralNameDefaultCacheStrategy.NewInstance();
176 176
            //infraspecific
177 177
        unrankedName.setInfraSpecificEpithet("infraspecific");
178 178
        unrankedName.setSpecificEpithet("species");
......
555 555
    @Test
556 556
    public void testGetInfraGenericNames(){
557 557
        String author = "Anyauthor";
558
        INonViralName nonViralName = TaxonNameFactory.NewNonViralInstance(Rank.SUBGENUS());
558
        TaxonName nonViralName = TaxonNameFactory.NewNonViralInstance(Rank.SUBGENUS());
559 559
        nonViralName.setGenusOrUninomial("Genus");
560 560
        nonViralName.setInfraGenericEpithet("subgenus");
561 561
        nonViralName.setAuthorshipCache(author);
......
620 620
     */
621 621
    @Test
622 622
    public void testGetTaggedNameSpeciesAggregate() {
623
        IBotanicalName speciesAggregate = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIESAGGREGATE());
623
        TaxonName speciesAggregate = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIESAGGREGATE());
624 624
        speciesAggregate.setGenusOrUninomial("Mygenus");
625 625
        speciesAggregate.setSpecificEpithet("myspecies");
626 626
        List<TaggedText> taggedName = strategy.getTaggedName(speciesAggregate);
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/name/ZooNameNoMarkerCacheStrategyTest.java
23 23
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
24 24
import eu.etaxonomy.cdm.model.common.DefaultTermInitializer;
25 25
import eu.etaxonomy.cdm.model.name.INonViralName;
26
import eu.etaxonomy.cdm.model.name.IZoologicalName;
27 26
import eu.etaxonomy.cdm.model.name.Rank;
28 27
import eu.etaxonomy.cdm.model.name.TaxonName;
29 28
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
......
36 35
	@SuppressWarnings("unused")
37 36
	private static final Logger logger = Logger.getLogger(ZooNameNoMarkerCacheStrategyTest.class);
38 37

  
39
	private ZooNameDefaultCacheStrategy strategy;
40
	private IZoologicalName familyName;
41
	private IZoologicalName subGenusName;
42
	private IZoologicalName speciesName;
43
	private TaxonName<?,ZooNameDefaultCacheStrategy> subSpeciesName;
38
	private NonViralNameDefaultCacheStrategy strategy;
39
	private TaxonName familyName;
40
	private TaxonName subGenusName;
41
	private TaxonName speciesName;
42
	private TaxonName subSpeciesName;
44 43
	private TeamOrPersonBase<?> author;
45 44
	private TeamOrPersonBase<?> exAuthor;
46 45
	private TeamOrPersonBase<?> basAuthor;
......
84 83
		subGenusName.setInfraGenericEpithet("InfraGenericPart");
85 84

  
86 85
		speciesName = TaxonNameFactory.PARSED_ZOOLOGICAL(speciesNameString);
87
		subSpeciesName =(TaxonName) TaxonNameFactory.PARSED_ZOOLOGICAL(subSpeciesNameStringToParse);
86
		subSpeciesName =TaxonNameFactory.PARSED_ZOOLOGICAL(subSpeciesNameStringToParse);
88 87
		subSpeciesName.setCacheStrategy(strategy);
89 88

  
90 89
		author = Person.NewInstance();
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/name/ZoologicalNameCacheStrategyTest.java
27 27
import eu.etaxonomy.cdm.model.name.INonViralName;
28 28
import eu.etaxonomy.cdm.model.name.IZoologicalName;
29 29
import eu.etaxonomy.cdm.model.name.Rank;
30
import eu.etaxonomy.cdm.model.name.TaxonName;
30 31
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
31 32

  
32 33
/**
......
37 38
	@SuppressWarnings("unused")
38 39
	private static final Logger logger = Logger.getLogger(ZoologicalNameCacheStrategyTest.class);
39 40

  
40
	private ZooNameDefaultCacheStrategy strategy;
41
	private IZoologicalName familyName;
41
	private NonViralNameDefaultCacheStrategy strategy;
42
	private TaxonName familyName;
42 43
	private IZoologicalName genusName;
43
	private IZoologicalName subGenusName;
44
	private IZoologicalName speciesName;
45
	private IZoologicalName subSpeciesName;
46
	private IZoologicalName speciesNameWithInfrGenEpi;
44
	private TaxonName subGenusName;
45
	private TaxonName speciesName;
46
	private TaxonName subSpeciesName;
47
	private TaxonName speciesNameWithInfrGenEpi;
47 48
	private TeamOrPersonBase<?> author;
48 49
	private TeamOrPersonBase<?> exAuthor;
49 50
	private TeamOrPersonBase<?> basAuthor;
......
79 80
	 */
80 81
	@Before
81 82
	public void setUp() throws Exception {
82
		strategy = ZooNameDefaultCacheStrategy.NewInstance();
83
		strategy = NonViralNameDefaultCacheStrategy.NewInstance();
83 84
		familyName = TaxonNameFactory.PARSED_ZOOLOGICAL(familyNameString, Rank.FAMILY());
84 85
		genusName = TaxonNameFactory.PARSED_ZOOLOGICAL(genusNameString, Rank.GENUS());
85 86

  
cdmlib-persistence/src/test/java/eu/etaxonomy/cdm/persistence/dao/hibernate/name/TestingBotanicalNameCacheStrategy.java
11 11

  
12 12
import java.util.List;
13 13

  
14
import eu.etaxonomy.cdm.model.name.IBotanicalName;
14
import eu.etaxonomy.cdm.model.name.TaxonName;
15 15
import eu.etaxonomy.cdm.strategy.cache.HTMLTagRules;
16 16
import eu.etaxonomy.cdm.strategy.cache.TaggedText;
17 17
import eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy;
18 18

  
19
public class TestingBotanicalNameCacheStrategy implements INonViralNameCacheStrategy<IBotanicalName> {
19
public class TestingBotanicalNameCacheStrategy implements INonViralNameCacheStrategy {
20 20

  
21 21
    @Override
22
    public String getAuthorshipCache(IBotanicalName nonViralName) {
22
    public String getAuthorshipCache(TaxonName nonViralName) {
23 23
        return "test.botanical.authorshipCache"+ nonViralName.getId();
24 24
    }
25 25

  
26 26
    @Override
27
    public String getLastEpithet(IBotanicalName taxonName) {
27
    public String getLastEpithet(TaxonName taxonName) {
28 28
        return "test.botanical.lastEpithet"+ taxonName.getId();
29 29
    }
30 30

  
31 31
    @Override
32
    public String getNameCache(IBotanicalName taxonName) {
32
    public String getNameCache(TaxonName taxonName) {
33 33
        return "test.botanical.nameCache"+ taxonName.getId();
34 34
    }
35 35

  
36 36
    @Override
37
    public String getFullTitleCache(IBotanicalName taxonName) {
37
    public String getFullTitleCache(TaxonName taxonName) {
38 38
        return "test.botanical.fullTitleCache"+ taxonName.getId();
39 39
    }
40 40

  
41 41
    @Override
42
    public String getTitleCache(IBotanicalName object) {
42
    public String getTitleCache(TaxonName object) {
43 43
        return "test.botanical.titleCache"+ object.getId();
44 44
    }
45 45

  
46 46
    @Override
47
    public List<TaggedText> getTaggedTitle(IBotanicalName taxonName) {
47
    public List<TaggedText> getTaggedTitle(TaxonName taxonName) {
48 48
        // TODO Auto-generated method stub
49 49
        return null;
50 50
    }
51 51

  
52 52
    @Override
53
    public List<TaggedText> getTaggedFullTitle(IBotanicalName taxonName) {
53
    public List<TaggedText> getTaggedFullTitle(TaxonName taxonName) {
54 54
        // TODO Auto-generated method stub
55 55
        return null;
56 56
    }
57 57

  
58 58
    @Override
59
    public List<TaggedText> getTaggedName(IBotanicalName taxonName) {
59
    public List<TaggedText> getTaggedName(TaxonName taxonName) {
60 60
        // TODO Auto-generated method stub
61 61
        return null;
62 62
    }
63 63

  
64 64
	@Override
65
	public String getTitleCache(IBotanicalName nonViralName, HTMLTagRules htmlTagRules) {
65
	public String getTitleCache(TaxonName nonViralName, HTMLTagRules htmlTagRules) {
66 66
		// TODO Auto-generated method stub
67 67
		return null;
68 68
	}
69 69

  
70 70
	@Override
71
	public String getFullTitleCache(IBotanicalName nonViralName,
71
	public String getFullTitleCache(TaxonName nonViralName,
72 72
			HTMLTagRules htmlTagRules) {
73 73
		// TODO Auto-generated method stub
74 74
		return null;
75 75
	}
76 76

  
77 77
    @Override
78
    public List<TaggedText> getNomStatusTags(IBotanicalName taxonName, boolean includeSeparatorBefore,
78
    public List<TaggedText> getNomStatusTags(TaxonName taxonName, boolean includeSeparatorBefore,
79 79
            boolean includeSeparatorAfter) {
80 80
        // TODO Auto-generated method stub
81 81
        return null;
cdmlib-persistence/src/test/java/eu/etaxonomy/cdm/persistence/dao/hibernate/name/TestingZoologicalNameCacheStrategy.java
11 11

  
12 12
import java.util.List;
13 13

  
14
import eu.etaxonomy.cdm.model.name.IZoologicalName;
14
import eu.etaxonomy.cdm.model.name.TaxonName;
15 15
import eu.etaxonomy.cdm.strategy.cache.HTMLTagRules;
16 16
import eu.etaxonomy.cdm.strategy.cache.TaggedText;
17 17
import eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy;
18 18

  
19
public class TestingZoologicalNameCacheStrategy implements INonViralNameCacheStrategy<IZoologicalName> {
19
public class TestingZoologicalNameCacheStrategy implements INonViralNameCacheStrategy {
20 20

  
21 21
    @Override
22
    public String getAuthorshipCache(IZoologicalName nonViralName) {
22
    public String getAuthorshipCache(TaxonName nonViralName) {
23 23
        return "test.zoological.authorshipCache"+ nonViralName.getId();
24 24
    }
25 25

  
26 26
    @Override
27
    public String getLastEpithet(IZoologicalName taxonName) {
27
    public String getLastEpithet(TaxonName taxonName) {
28 28
        return "test.zoological.lastEpithet"+ taxonName.getId();
29 29
    }
30 30

  
31 31
    @Override
32
    public String getNameCache(IZoologicalName taxonName) {
32
    public String getNameCache(TaxonName taxonName) {
33 33
        return "test.zoological.nameCache"+ taxonName.getId();
34 34
    }
35 35

  
36 36
    @Override
37
    public String getFullTitleCache(IZoologicalName taxonName) {
37
    public String getFullTitleCache(TaxonName taxonName) {
38 38
        return "test.zoological.fullTitleCache"+ taxonName.getId();
39 39
    }
40 40

  
41 41

  
42 42
    @Override
43
    public String getTitleCache(IZoologicalName object) {
43
    public String getTitleCache(TaxonName object) {
44 44
        return "test.zoological.titleCache"+ object.getId();
45 45
    }
46 46

  
47 47
    @Override
48
    public List<TaggedText> getTaggedTitle(IZoologicalName taxonName) {
48
    public List<TaggedText> getTaggedTitle(TaxonName taxonName) {
49 49
        // TODO Auto-generated method stub
50 50
        return null;
51 51
    }
52 52

  
53 53
    @Override
54
    public List<TaggedText> getTaggedFullTitle(IZoologicalName taxonName) {
54
    public List<TaggedText> getTaggedFullTitle(TaxonName taxonName) {
55 55
        // TODO Auto-generated method stub
56 56
        return null;
57 57
    }
58 58

  
59 59
    @Override
60
    public List<TaggedText> getTaggedName(IZoologicalName taxonName) {
60
    public List<TaggedText> getTaggedName(TaxonName taxonName) {
61 61
        // TODO Auto-generated method stub
62 62
        return null;
63 63
    }
64 64

  
65 65
	@Override
66
	public String getTitleCache(IZoologicalName nonViralName, HTMLTagRules htmlTagRules) {
66
	public String getTitleCache(TaxonName nonViralName, HTMLTagRules htmlTagRules) {
67 67
		// TODO Auto-generated method stub
68 68
		return null;
69 69
	}
70 70

  
71 71
	@Override
72
	public String getFullTitleCache(IZoologicalName nonViralName,
72
	public String getFullTitleCache(TaxonName nonViralName,
73 73
			HTMLTagRules htmlTagRules) {
74 74
		// TODO Auto-generated method stub
75 75
		return null;
76 76
	}
77 77

  
78 78
    @Override
79
    public List<TaggedText> getNomStatusTags(IZoologicalName taxonName, boolean includeSeparatorBefore,
79
    public List<TaggedText> getNomStatusTags(TaxonName taxonName, boolean includeSeparatorBefore,
80 80
            boolean includeSeparatorAfter) {
81 81
        // TODO Auto-generated method stub
82 82
        return null;

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)