Project

General

Profile

Revision 55dd353b

ID55dd353becb297c0c484c5e5bc09212ec292dfd1
Parent f540b139
Child 5d6b7e01

Added by Andreas Müller over 3 years ago

ref #6362 remove further occurrences of NonViralName

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/CacheUpdaterConfigurator.java
106 106
//	private boolean doSequence = true;
107 107
//
108 108
//	//Names
109
//	private boolean doViralName = true;
110
//	private boolean doNonViralName = true;
111
//	private boolean doBotanicalName = true;
112
//	private boolean doZoologicalName = true;
113
//	private boolean doCultivarPlantName = true;
109
//	private boolean doTaxonName = true;
114 110
//
115 111
//	private boolean doClassification = true;
116 112
//
......
159 155
//			doSequence = false;
160 156
//
161 157
//			//Names
162
//			doViralName = false;
163
//			doNonViralName = false;
164
//			doBotanicalName = false;
165
//			doZoologicalName = false;
166
//			doCultivarPlantName = false;
158
//			doTaxonName = false;
167 159
//
168 160
//			doClassification = false;
169 161
//
......
291 283
//	public boolean isDoSequence() {
292 284
//		return doSequence;
293 285
//	}
294
//	public void setDoViralName(boolean doViralName) {
295
//		this.doViralName = doViralName;
296
//	}
297
//	public boolean isDoViralName() {
298
//		return doViralName;
299
//	}
300
//	public void setDoNonViralName(boolean doNonViralName) {
301
//		this.doNonViralName = doNonViralName;
302
//	}
303
//	public boolean isDoNonViralName() {
304
//		return doNonViralName;
305
//	}
306
//	public void setDoBotanicalName(boolean doBotanicalName) {
307
//		this.doBotanicalName = doBotanicalName;
308
//	}
309
//	public boolean isDoBotanicalName() {
310
//		return doBotanicalName;
311
//	}
312
//	public void setDoZoologicalName(boolean doZoologicalName) {
313
//		this.doZoologicalName = doZoologicalName;
314
//	}
315
//	public boolean isDoZoologicalName() {
316
//		return doZoologicalName;
317
//	}
318
//	public void setDoCultivarPlantName(boolean doCultivarPlantName) {
319
//		this.doCultivarPlantName = doCultivarPlantName;
320
//	}
321
//	public boolean isDoCultivarPlantName() {
322
//		return doCultivarPlantName;
323
//	}
324 286
//	public void setDoClassification(boolean doClassification) {
325 287
//		this.doClassification = doClassification;
326 288
//	}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/taxa/NormalExplicitImport.java
46 46
import eu.etaxonomy.cdm.model.description.TextData;
47 47
import eu.etaxonomy.cdm.model.location.NamedArea;
48 48
import eu.etaxonomy.cdm.model.media.Media;
49
import eu.etaxonomy.cdm.model.name.INonViralName;
49 50
import eu.etaxonomy.cdm.model.name.ITaxonNameBase;
50 51
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
51 52
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
52 53
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
53
import eu.etaxonomy.cdm.model.name.NonViralName;
54 54
import eu.etaxonomy.cdm.model.name.Rank;
55 55
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
56 56
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
......
761 761
	private TaxonBase<?> createTaxon(TaxonExcelImportState state, Rank rank, String taxonNameStr,
762 762
			String authorStr, String publishingAutorStr, String basionymAuthor, String reference, String date, String nameStatus, NomenclaturalCode nc) {
763 763
		TaxonBase<?> taxonBase;
764
		NonViralName<?> taxonNameBase = null;
764
		INonViralName taxonNameBase = null;
765 765
		if (nc == NomenclaturalCode.ICVCN){
766 766
			logger.warn("ICVCN not yet supported");
767 767

  
768 768
		}else{
769 769
		    //String taxonNameStr = titleCache.substring(0, titleCache.indexOf(authorStr));
770
			taxonNameBase =(NonViralName<?>) nc.getNewTaxonNameInstance(rank);
770
			taxonNameBase = nc.getNewTaxonNameInstance(rank);
771 771
			NonViralNameParserImpl parser = NonViralNameParserImpl.NewInstance();
772 772
			taxonNameBase = parser.parseFullName(taxonNameStr, nc, rank);
773 773

  
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/markup/MarkupDocumentImportNoComponent.java
35 35
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
36 36
import eu.etaxonomy.cdm.model.description.TaxonDescription;
37 37
import eu.etaxonomy.cdm.model.description.TextData;
38
import eu.etaxonomy.cdm.model.name.NonViralName;
38
import eu.etaxonomy.cdm.model.name.INonViralName;
39 39
import eu.etaxonomy.cdm.model.name.Rank;
40 40
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
41 41
import eu.etaxonomy.cdm.model.reference.Reference;
......
348 348
				if (taxon.getName().getRank().isHigher(Rank.GENUS())){
349 349
					state.setLatestGenusEpithet(null);
350 350
				}else{
351
					state.setLatestGenusEpithet(((NonViralName<?>)taxon.getName()).getGenusOrUninomial());
351
					state.setLatestGenusEpithet(taxon.getName().getGenusOrUninomial());
352 352
				}
353 353
				save(taxon, state);
354 354
				return taxon;
......
522 522
	 */
523 523
	private Taxon createTaxonAndName(MarkupImportState state,
524 524
			Map<String, Attribute> attributes) {
525
		NonViralName<?> name;
525
		INonViralName name;
526 526
		Rank rank = null;  //Rank.SPECIES(); // default
527 527
		boolean isCultivar = checkAndRemoveAttributeValue(attributes, CLASS, "cultivated");
528 528
		if (isCultivar) {
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/markup/MarkupImportBase.java
1141 1141
	 * @param rank
1142 1142
	 * @return
1143 1143
	 */
1144
	protected NonViralName<?> createNameByCode(MarkupImportState state, Rank rank) {
1145
		NonViralName<?> name;
1144
	protected INonViralName createNameByCode(MarkupImportState state, Rank rank) {
1146 1145
		NomenclaturalCode nc = makeNomenclaturalCode(state);
1147
		name = (NonViralName<?>) nc.getNewTaxonNameInstance(rank);
1146
		INonViralName name = nc.getNewTaxonNameInstance(rank);
1148 1147
		return name;
1149 1148
	}
1150 1149

  
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/markup/MarkupKeyImport.java
31 31
import eu.etaxonomy.cdm.model.description.PolytomousKey;
32 32
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
33 33
import eu.etaxonomy.cdm.model.name.INonViralName;
34
import eu.etaxonomy.cdm.model.name.NonViralName;
35 34
import eu.etaxonomy.cdm.model.name.Rank;
36 35
import eu.etaxonomy.cdm.model.taxon.Taxon;
37 36
import eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException;
......
259 258

  
260 259
		taxonNotExists = taxonNotExists || (isBlank(num) && state.isOnlyNumberedTaxaExist());
261 260
		if (taxonNotExists){
262
			NonViralName<?> name = createNameByCode(state, Rank.UNKNOWN_RANK());
261
			INonViralName name = createNameByCode(state, Rank.UNKNOWN_RANK());
263 262
			Taxon taxon = Taxon.NewInstance(name, null);
264 263
			taxon.getName().setTitleCache(taxonKeyStr, true);
265 264
			node.setTaxon(taxon);
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/markup/MarkupNomenclatureImport.java
22 22
import org.apache.log4j.Logger;
23 23

  
24 24
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
25
import eu.etaxonomy.cdm.model.common.CdmBase;
26 25
import eu.etaxonomy.cdm.model.common.OriginalSourceType;
27 26
import eu.etaxonomy.cdm.model.common.TimePeriod;
28 27
import eu.etaxonomy.cdm.model.description.Feature;
......
33 32
import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus;
34 33
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
35 34
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
36
import eu.etaxonomy.cdm.model.name.NonViralName;
37 35
import eu.etaxonomy.cdm.model.name.Rank;
38 36
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
39 37
import eu.etaxonomy.cdm.model.reference.IArticle;
......
163 161
				if (isStartingElement(next, NOM)) {
164 162
					// TODO should we check if the type is always a species, is
165 163
					// this a rule?
166
					NonViralName<?> speciesName = handleNom(state, reader,
167
							next, null);
164
					TaxonNameBase<?,?> speciesName = TaxonNameBase.castAndDeproxy(
165
					        handleNom(state, reader, next, null));
168 166
					for (TaxonNameBase<?, ?> name : homotypicalGroup
169 167
							.getTypifiedNames()) {
170 168
						name.addNameTypeDesignation(speciesName, null, null,
......
196 194
	 * @return
197 195
	 * @throws XMLStreamException
198 196
	 */
199
	private NonViralName<?> handleNom(MarkupImportState state, XMLEventReader reader,
197
	private INonViralName handleNom(MarkupImportState state, XMLEventReader reader,
200 198
			XMLEvent parentEvent, HomotypicalGroup homotypicalGroup) throws XMLStreamException {
201 199
		boolean isSynonym = false;
202 200
		boolean isNameType = state.isNameType();
203 201
		// attributes
204 202
		String classValue = getClassOnlyAttribute(parentEvent);
205
		NonViralName<?> name;
203
		INonViralName name;
206 204
		if (!isNameType && ACCEPTED.equalsIgnoreCase(classValue)) {
207 205
			isSynonym = false;
208 206
			name = createName(state, homotypicalGroup, isSynonym);
......
345 343
	}
346 344

  
347 345
	private void fillName(MarkupImportState state, Map<String, String> nameMap,
348
			TaxonNameBase name, XMLEvent event) {
346
			INonViralName name, XMLEvent event) {
349 347

  
350 348
		// Ranks: family, subfamily, tribus, genus, subgenus, section,
351 349
		// subsection, species, subspecies, variety, subvariety, forma
......
382 380
			try {
383 381
				// TODO handle trim earlier
384 382
				statusStr = statusStr.trim();
385
				NomenclaturalStatusType nomStatusType = NomenclaturalStatusType.getNomenclaturalStatusTypeByAbbreviation(statusStr, name);
383
				NomenclaturalStatusType nomStatusType = NomenclaturalStatusType
384
				        .getNomenclaturalStatusTypeByAbbreviation(statusStr, name);
386 385
				name.addStatus(NomenclaturalStatus.NewInstance(nomStatusType));
387 386
			} catch (UnknownCdmTypeException e) {
388 387
				String message = "Status '%s' could not be recognized";
......
553 552
	 * @param isSynonym
554 553
	 * @return
555 554
	 */
556
	private NonViralName<?> createName(MarkupImportState state,
555
	private INonViralName createName(MarkupImportState state,
557 556
			HomotypicalGroup homotypicalGroup, boolean isSynonym) {
558
		NonViralName<?> name;
557
		INonViralName name;
559 558
		Taxon taxon = state.getCurrentTaxon();
560 559
		if (isSynonym) {
561 560
			Rank defaultRank = Rank.SPECIES(); // can be any
......
567 566
			if (taxon.getHomotypicGroup().equals(homotypicalGroup)) {
568 567
				synonymType = SynonymType.HOMOTYPIC_SYNONYM_OF();
569 568
			}
570
			taxon.addSynonymName(name, synonymType);
569
			taxon.addSynonymName(TaxonNameBase.castAndDeproxy(name), synonymType);
571 570
		} else {
572
			name = CdmBase.deproxy(taxon.getName(), NonViralName.class);
571
			name = taxon.getName();
573 572
		}
574 573
		return name;
575 574
	}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/markup/MarkupSpecimenImport.java
45 45
import eu.etaxonomy.cdm.model.location.NamedArea;
46 46
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
47 47
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
48
import eu.etaxonomy.cdm.model.name.INonViralName;
48 49
import eu.etaxonomy.cdm.model.name.NonViralName;
49 50
import eu.etaxonomy.cdm.model.name.Rank;
50 51
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
......
130 131
			handleNotYetImplementedAttribute(attributes, LOST);
131 132
		}
132 133

  
133
		NonViralName<?> firstName = null;
134
		INonViralName firstName = null;
134 135
		Set<TaxonNameBase> names = homotypicalGroup.getTypifiedNames();
135 136
		if (names.isEmpty()) {
136 137
			String message = "There is no name in a homotypical group. Can't create the specimen type";
......
186 187

  
187 188

  
188 189
	private void makeSpecimenType(MarkupImportState state, DerivedUnitFacade facade, String text, String collectionAndType,
189
			NonViralName<?> name, XMLEvent parentEvent) {
190
			INonViralName name, XMLEvent parentEvent) {
190 191
		text = text.trim();
191 192
		if (isPunctuation(text)){
192 193
			//do nothing
......
232 233
	 * @param parentEvent
233 234
	 * @return
234 235
	 */
235
	private boolean makeFotgSpecimenType(MarkupImportState state, final String collectionAndTypeOrig, DerivedUnitFacade facade, NonViralName<?> name, XMLEvent parentEvent) {
236
	private boolean makeFotgSpecimenType(MarkupImportState state, final String collectionAndTypeOrig, DerivedUnitFacade facade, INonViralName name, XMLEvent parentEvent) {
236 237
		String collectionAndType = collectionAndTypeOrig;
237 238

  
238 239
		String notDesignatedRE = "not\\s+designated";
......
551 552
				handleLocality(state, reader, next, facade);
552 553
			} else if (isStartingElement(next, FULL_NAME)) {
553 554
				Rank defaultRank = Rank.SPECIES(); // can be any
554
				NonViralName<?> name = createNameByCode(state, defaultRank);
555
				handleFullName(state, reader, name, next);
555
				INonViralName nvn = createNameByCode(state, defaultRank);
556
				handleFullName(state, reader, nvn, next);
557
				TaxonNameBase<?,?> name = TaxonNameBase.castAndDeproxy(nvn);
556 558
				DeterminationEvent.NewInstance(name, facade.innerDerivedUnit() != null ? facade.innerDerivedUnit() : facade.innerFieldUnit());
557 559
			} else if (isStartingElement(next, DATES)) {
558 560
				TimePeriod timePeriod = handleDates(state, reader, next);
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/sdd/ikeyplus/IkeyPlusImport.java
27 27
import eu.etaxonomy.cdm.model.description.KeyStatement;
28 28
import eu.etaxonomy.cdm.model.description.PolytomousKey;
29 29
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
30
import eu.etaxonomy.cdm.model.name.NonViralName;
30
import eu.etaxonomy.cdm.model.name.INonViralName;
31 31
import eu.etaxonomy.cdm.model.name.Rank;
32 32
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
33 33
import fr.lis.ikeyplus.IO.SDDSaxParser;
......
173 173
                pkNode = createPkNode(null, statement);
174 174

  
175 175
                //TODO handle rank
176
                NonViralName<?> nonViralName = TaxonNameFactory.NewNonViralInstance(Rank.UNKNOWN_RANK());
176
                INonViralName nonViralName = TaxonNameFactory.NewNonViralInstance(Rank.UNKNOWN_RANK());
177 177
                nonViralName.setTitleCache(taxon.getName(), true);
178 178
                eu.etaxonomy.cdm.model.taxon.Taxon cdmTaxon = eu.etaxonomy.cdm.model.taxon.Taxon.NewInstance(
179 179
                        nonViralName, null); //FIXME !!!!!!
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/sdd/in/SDDImport.java
35 35
import eu.etaxonomy.cdm.api.service.IDescriptionService;
36 36
import eu.etaxonomy.cdm.common.media.ImageInfo;
37 37
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
38
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
39 38
import eu.etaxonomy.cdm.io.common.ICdmImport;
40 39
import eu.etaxonomy.cdm.io.common.ImportHelper;
41 40
import eu.etaxonomy.cdm.io.common.XmlImportBase;
......
80 79
import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
81 80
import eu.etaxonomy.cdm.model.media.Rights;
82 81
import eu.etaxonomy.cdm.model.name.INonViralName;
83
import eu.etaxonomy.cdm.model.name.NonViralName;
82
import eu.etaxonomy.cdm.model.name.ITaxonNameBase;
84 83
import eu.etaxonomy.cdm.model.name.Rank;
85 84
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
86 85
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
......
116 115
    private Map<String,Reference> publications = new HashMap<>();
117 116
    private Map<String,State> states = new HashMap<>();
118 117
    private Map<String,TaxonDescription> taxonDescriptions = new HashMap<>();
119
    private Map<String,NonViralName<?>> taxonNameBases = new HashMap<>();
118
    private Map<String,INonViralName> taxonNameBases = new HashMap<>();
120 119
    private Map<String,MeasurementUnit> units = new HashMap<>();
121 120
    private Map<String,TaxonNode> taxonNodes = new HashMap<>();
122 121
    private Map<String,NamedArea> namedAreas = new HashMap<>();
......
917 916
				String id = elTaxonName.getAttributeValue("id");
918 917
				String uri = elTaxonName.getAttributeValue("uri");
919 918

  
920
				NonViralName<?> tnb = null;
919
				TaxonNameBase<?,?> tnb = null;
921 920
				if (!id.equals("")) {
922 921
					tnb = TaxonNameFactory.NewNonViralInstance(defaultRank);
923 922
					IdentifiableSource source = null;
......
1224 1223
	private Taxon handleCDNoScope(Namespace sddNamespace,
1225 1224
	        SDDImportState cdmState, Element elCodedDescription	) {
1226 1225
		Taxon taxon = null;
1227
		NonViralName<?> nonViralName = TaxonNameFactory.NewNonViralInstance(defaultRank);
1226
		TaxonNameBase<?,?> nonViralName = TaxonNameFactory.NewNonViralInstance(defaultRank);
1228 1227
		String id = new String("" + taxonNamesCount);
1229 1228
		IdentifiableSource source = IdentifiableSource.NewDataImportInstance(id, "TaxonName");
1230 1229
		importRepresentation(elCodedDescription, sddNamespace, nonViralName, id, cdmState);
......
1234 1233
		}
1235 1234

  
1236 1235
		if(taxon != null){
1237
			nonViralName = HibernateProxyHelper.deproxy(taxon.getName(), NonViralName.class);
1236
			nonViralName = CdmBase.deproxy(taxon.getName());
1238 1237
//							taxonNameBases.put(id ,tnb);
1239 1238
//							taxonNamesCount++;
1240 1239
			logger.info("using existing Taxon " + taxon.getTitleCache());
1241 1240
		} else {
1242 1241
			nonViralName.addSource(source);
1243
			taxonNameBases.put(id ,nonViralName);
1242
			taxonNameBases.put(id, nonViralName);
1244 1243
			taxonNamesCount++;
1245 1244
			logger.info("creating new Taxon from TaxonName " + nonViralName.getTitleCache());
1246 1245
			taxon = Taxon.NewInstance(nonViralName, sec);
......
1902 1901

  
1903 1902
						for (Element elNode : listNodes){
1904 1903
							String idN = elNode.getAttributeValue("id");
1905
							TaxonNameBase<?,?> tnb = null;
1904
							ITaxonNameBase tnb = null;
1906 1905
							if (!idN.equals("")) {
1907 1906
								Element elTaxonName = elNode.getChild("TaxonName", sddNamespace);
1908 1907
								String refTN = elTaxonName.getAttributeValue("ref");
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/specimen/excel/in/SpecimenCdmExcelImport.java
591 591
	 * @return
592 592
	 */
593 593
	private Taxon findBestMatchingTaxon(SpecimenCdmExcelImportState state, DeterminationLight determinationLight, boolean createIfNotExists) {
594
		NonViralName<?> name = makeTaxonName(state, determinationLight);
594
		INonViralName name = makeTaxonName(state, determinationLight);
595 595

  
596 596
		String titleCache = makeSearchNameTitleCache(state, determinationLight, name);
597 597

  
......
627 627
	 * @return
628 628
	 */
629 629
	private String makeSearchNameTitleCache(SpecimenCdmExcelImportState state, DeterminationLight determinationLight,
630
				NonViralName<?> name) {
630
				INonViralName name) {
631 631
		String titleCache = determinationLight.fullName;
632 632
		if (! state.getConfig().isPreferNameCache() || StringUtils.isBlank(titleCache) ){
633 633
			String computedTitleCache = name.getTitleCache();
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/taxonx2013/TaxonXTreatmentExtractor.java
3786 3786
			if (newTaxon.isInstanceOf(Synonym.class)){
3787 3787
				return false;
3788 3788
			}
3789
			NonViralName<?> nodeName = CdmBase.deproxy(nodeTaxon.getName(), NonViralName.class);
3790
			NonViralName<?> newName = CdmBase.deproxy(newTaxon.getName(), NonViralName.class);
3789
			INonViralName nodeName = nodeTaxon.getName();
3790
			INonViralName newName = newTaxon.getName();
3791 3791
			if (nodeTaxon.getName() == null ||  newName == null){
3792 3792
				return false;
3793 3793
			}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/tcsxml/in/TcsXmlTaxonNameImport.java
115 115
				if (nomCode != null){
116 116
					nameBase = nomCode.getNewTaxonNameInstance(rank);
117 117
				}else{
118
					nameBase = NonViralName.NewInstance(rank);
118
					nameBase = TaxonNameFactory.NewNonViralInstance(rank);
119 119
				}
120 120
				childName = "Simple";
121 121
				obligatory = true;
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/specimen/abcd206/in/SpecimenImportConfiguratorTest.java
522 522
//        Team team = Team.NewTitledInstance("different author", "different author");
523 523
//        secReference.setAuthorship(team);
524 524
//
525
//        NonViralName<?> taxonName = NonViralName.NewInstance(Rank.VARIETY());
525
//        NonViralName<?> taxonName = TaxonNameFactory.NewNonViralInstance(Rank.VARIETY());
526 526
//        taxonName.setGenusOrUninomial("Campanula");
527 527
//        taxonName.setSpecificEpithet("versicolor");
528 528
//        taxonName.setInfraSpecificEpithet("tomentella");
cdmlib-model/src/main/java/eu/etaxonomy/cdm/hibernate/search/NomenclaturalSortOrderBrigde.java
56 56

  
57 57
    @Override
58 58
    public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
59
        INonViralName n = null;
59
        INonViralName nvn = null;
60 60

  
61 61
        if(value instanceof TaxonBase) {
62 62
            try {
63
                n = HibernateProxyHelper.deproxy(((TaxonBase) value).getName(), NonViralName.class);
64
                if (n == null){
63
                nvn = HibernateProxyHelper.deproxy((TaxonBase) value).getName();
64
                if (nvn == null){
65 65
                	return;
66 66
                }
67 67
            } catch (ClassCastException e) {
......
70 70
            }
71 71

  
72 72
        }else if(value instanceof TaxonNameBase){
73
            n = (INonViralName)value;
73
            nvn = (INonViralName)value;
74 74
        }
75
        if(n == null) {
75
        if(nvn == null) {
76 76
            logger.error("Unsupported type: " + value.getClass().getName());
77 77
            return;
78 78
        }
......
80 80
        // compile sort field
81 81
        StringBuilder txt = new StringBuilder();
82 82

  
83
        if(n.isProtectedNameCache()){
84
            txt.append(n.getNameCache());
83
        if(nvn.isProtectedNameCache()){
84
            txt.append(nvn.getNameCache());
85 85
        } else {
86
            if(StringUtils.isNotBlank(n.getGenusOrUninomial())){
87
                txt.append(StringUtils.rightPad(n.getGenusOrUninomial(), MAX_FIELD_LENGTH, PAD_CHAR));
86
            if(StringUtils.isNotBlank(nvn.getGenusOrUninomial())){
87
                txt.append(StringUtils.rightPad(nvn.getGenusOrUninomial(), MAX_FIELD_LENGTH, PAD_CHAR));
88 88
            }
89
            if(StringUtils.isNotBlank(n.getSpecificEpithet())){
89
            if(StringUtils.isNotBlank(nvn.getSpecificEpithet())){
90 90
                String matchQuotes = "\".*\"";
91
                if(n.getSpecificEpithet().matches(matchQuotes)){
91
                if(nvn.getSpecificEpithet().matches(matchQuotes)){
92 92
                    txt.append("1");
93 93
                } else {
94 94
                    txt.append("0");
95 95
                }
96
                txt.append(StringUtils.rightPad(n.getSpecificEpithet(), MAX_FIELD_LENGTH, PAD_CHAR));
96
                txt.append(StringUtils.rightPad(nvn.getSpecificEpithet(), MAX_FIELD_LENGTH, PAD_CHAR));
97 97
            } else {
98 98
                txt.append(StringUtils.rightPad("", MAX_FIELD_LENGTH, PAD_CHAR));
99 99
            }
100 100
            String rankStr = "99"; // default for no rank
101
            if(n.getRank() != null){
102
                rankStr = Integer.toString(n.getRank().getOrderIndex());
101
            if(nvn.getRank() != null){
102
                rankStr = Integer.toString(nvn.getRank().getOrderIndex());
103 103
            }
104 104
            txt.append(StringUtils.rightPad(rankStr, 2, PAD_CHAR));
105 105
        }
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/IdentifiableEntity.java
55 55
import eu.etaxonomy.cdm.jaxb.LSIDAdapter;
56 56
import eu.etaxonomy.cdm.model.media.Rights;
57 57
import eu.etaxonomy.cdm.model.name.BotanicalName;
58
import eu.etaxonomy.cdm.model.name.INonViralName;
58 59
import eu.etaxonomy.cdm.model.name.NonViralName;
59 60
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
60 61
import eu.etaxonomy.cdm.model.reference.Reference;
......
553 554
         //TODO we can remove all the deproxies here except for the first one
554 555
         identifiableEntity = HibernateProxyHelper.deproxy(identifiableEntity, IdentifiableEntity.class);
555 556
         if(identifiableEntity instanceof NonViralName) {
556
             specifiedNameCache = HibernateProxyHelper.deproxy(identifiableEntity, NonViralName.class).getNameCache();
557
             specifiedNameCache = ((NonViralName)identifiableEntity).getNameCache();
557 558
             specifiedTitleCache = identifiableEntity.getTitleCache();
558 559
            if (identifiableEntity instanceof BotanicalName){
559 560
            	 if (((BotanicalName)identifiableEntity).isAutonym()){
......
571 572
             }
572 573

  
573 574
         } else if(identifiableEntity instanceof TaxonBase) {
574
             TaxonBase taxonBase = HibernateProxyHelper.deproxy(identifiableEntity, TaxonBase.class);
575
             TaxonBase<?> taxonBase = (TaxonBase)identifiableEntity;
575 576

  
576 577
             TaxonNameBase<?,?> taxonNameBase = taxonBase.getName();
577 578

  
578 579

  
579
             NonViralName nonViralName = HibernateProxyHelper.deproxy(taxonNameBase, NonViralName.class);
580
             INonViralName nonViralName = CdmBase.deproxy(taxonNameBase);
580 581
             specifiedNameCache = nonViralName.getNameCache();
581 582
             specifiedTitleCache = taxonNameBase.getTitleCache();
582 583

  
......
589 590
         }
590 591

  
591 592
         if(this.isInstanceOf(NonViralName.class)) {
592
             thisNameCache = HibernateProxyHelper.deproxy(this, NonViralName.class).getNameCache();
593
             INonViralName nvn = CdmBase.deproxy(this, TaxonNameBase.class);
594
             thisNameCache = nvn.getNameCache();
593 595
             thisTitleCache = getTitleCache();
594 596

  
595 597
             if (this instanceof BotanicalName){
......
606 608
            	 }
607 609
             }
608 610
         } else if(this.isInstanceOf(TaxonBase.class)) {
609
             TaxonNameBase<?,?> taxonNameBase= HibernateProxyHelper.deproxy(this, TaxonBase.class).getName();
610
             NonViralName nonViralName = HibernateProxyHelper.deproxy(taxonNameBase, NonViralName.class);
611
             thisNameCache = nonViralName.getNameCache();
612
             thisTitleCache = taxonNameBase.getTitleCache();
611
             //TODO also handle viral names
612
             INonViralName taxonName = CdmBase.deproxy(this, TaxonBase.class).getName();
613
             thisNameCache = taxonName.getNameCache();
614
             thisTitleCache = taxonName.getTitleCache();
613 615
             thisReferenceTitleCache = ((TaxonBase)this).getSec().getTitleCache();
614
             thisGenusString = nonViralName.getGenusOrUninomial();
616
             thisGenusString = taxonName.getGenusOrUninomial();
615 617
         }
616 618

  
617 619
         // Compare name cache of taxon names
618 620

  
619

  
620

  
621 621
         if (!specifiedNameCache.equals("") && !thisNameCache.equals("")) {
622 622

  
623 623
        	 thisNameCache = thisNameCache.replaceAll(HYBRID_SIGN, "");
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/HomotypicalGroup.java
310 310
//    public void guessAndSetBasionym(){
311 311
//         Map<String, NonViralName<?>> candidates = new HashMap<NonViralName<?>>();
312 312
//         for (TaxonNameBase<?,?> typifiedName : this.typifiedNames){
313
//             if (typifiedName.isInstanceOf(NonViralName.class)){
314
//                 NonViralName<?> nvn = CdmBase.deproxy(typifiedName, NonViralName.class);
315
//                 if (! nvn.protectedAuthorshipCache && nvn.getBasionymAuthorship() == null){
316
//                    candidates.add(nvn);
317
//                 }
313
//             if (! typifiedName.protectedAuthorshipCache && nvn.getBasionymAuthorship() == null){
314
//                 candidates.add(typifiedName);
318 315
//             }
319 316
//         }
320 317
//         if (candidates.size() == 1){
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NomenclaturalStatusType.java
821 821
	 * @return  					the nomenclatural status type
822 822
	 *
823 823
	 */
824
	public static NomenclaturalStatusType getNomenclaturalStatusTypeByAbbreviation(String statusAbbreviation, TaxonNameBase name) throws UnknownCdmTypeException{
824
	public static NomenclaturalStatusType getNomenclaturalStatusTypeByAbbreviation(String statusAbbreviation, ITaxonNameBase name) throws UnknownCdmTypeException{
825 825
		if (statusAbbreviation == null){
826 826
			throw new NullPointerException("Abbreviation is NULL in getNomenclaturalStatusTypeByAbbreviation");
827 827
		}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TaxonNameBase.java
3074 3074
     * Returns null as the {@link NomenclaturalCode nomenclatural code} that governs
3075 3075
     * the construction of <i>this</i> taxon name since there is no specific
3076 3076
     * nomenclatural code defined. The real implementention takes place in the
3077
     * subclasses {@link BacterialName BacterialName},
3078
     * {@link BotanicalName BotanicalName}, {@link CultivarPlantName CultivarPlantName} and
3079
     * {@link ZoologicalName ZoologicalName}. Each taxon name is governed by one
3077
     * subclasses {@link IBacterialName BacterialName},
3078
     * {@link IBotanicalName BotanicalName}, {@link ICultivarPlantName CultivarPlantName} and
3079
     * {@link IZoologicalName ZoologicalName}. Each taxon name is governed by one
3080 3080
     * and only one nomenclatural code.
3081 3081
     *
3082 3082
     * @return  null
......
3361 3361
        }
3362 3362

  
3363 3363
    }
3364
    /**
3365
     * @param namesToSave
3366
     * @return
3367
     */
3368
    public static Set<TaxonNameBase> castAndDeproxy(Set<ITaxonNameBase> namesToSave) {
3369
        Set<TaxonNameBase> result = new HashSet<>();
3370
        for (ITaxonNameBase nameToSave : namesToSave){
3371
            result.add(castAndDeproxy(nameToSave));
3372
        }
3373
        return result;
3374
    }
3364 3375
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/name/NonViralNameDefaultCacheStrategy.java
26 26
import eu.etaxonomy.cdm.model.common.Representation;
27 27
import eu.etaxonomy.cdm.model.name.BotanicalName;
28 28
import eu.etaxonomy.cdm.model.name.HybridRelationship;
29
import eu.etaxonomy.cdm.model.name.INonViralName;
29 30
import eu.etaxonomy.cdm.model.name.NameRelationship;
30 31
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
31 32
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
......
594 595
     * @param nonViralName
595 596
     * @return
596 597
     */
597
    private List<TaggedText> getUninomialTaggedPart(NonViralName<?> nonViralName) {
598
    private List<TaggedText> getUninomialTaggedPart(INonViralName nonViralName) {
598 599
        List<TaggedText> tags = new ArrayList<TaggedText>();
599 600

  
600 601
        if (nonViralName.isMonomHybrid()){
......
628 629
     * @param nonViralName
629 630
     * @return
630 631
     */
631
    protected List<TaggedText> getInfraGenusTaggedNameCache(NonViralName<?> nonViralName){
632
    protected List<TaggedText> getInfraGenusTaggedNameCache(INonViralName nonViralName){
632 633
        Rank rank = nonViralName.getRank();
633 634
        if (rank != null && rank.isSpeciesAggregate() && isBlank(nonViralName.getAuthorshipCache())){
634 635
            return getSpeciesAggregateTaggedCache(nonViralName);
......
673 674
	 * @param infraGenericMarker
674 675
	 */
675 676
	protected void addInfraGenericPart(
676
	        @SuppressWarnings("unused") NonViralName<?> name,
677
	        @SuppressWarnings("unused") INonViralName name,
677 678
	        List<TaggedText> tags,
678 679
	        String infraGenericMarker,
679 680
	        String infraGenEpi) {
......
692 693
     * @param nonViralName
693 694
     * @return
694 695
     */
695
    protected List<TaggedText> getSpeciesAggregateTaggedCache(NonViralName<?> nonViralName){
696
    protected List<TaggedText> getSpeciesAggregateTaggedCache(INonViralName nonViralName){
696 697
        if (! isBlank(nonViralName.getAuthorshipCache())){
697 698
        	List<TaggedText> result = getSpeciesTaggedNameCache(nonViralName);
698 699
        	return result;
......
711 712
     * @param tags
712 713
     * @param nonViralName
713 714
     */
714
    private void addSpeciesAggregateTaggedEpithet(List<TaggedText> tags, NonViralName<?> nonViralName) {
715
    private void addSpeciesAggregateTaggedEpithet(List<TaggedText> tags, INonViralName nonViralName) {
715 716
        String marker;
716 717
        try {
717 718
            marker = nonViralName.getRank().getInfraGenericMarker();
......
729 730
     * @param nonViralName
730 731
     * @return
731 732
     */
732
    protected List<TaggedText> getSpeciesTaggedNameCache(NonViralName<?> nonViralName){
733
    protected List<TaggedText> getSpeciesTaggedNameCache(INonViralName nonViralName){
733 734
        List<TaggedText> tags = getGenusAndSpeciesTaggedPart(nonViralName);
734 735
        addAppendedTaggedPhrase(tags, nonViralName);
735 736
        return tags;
......
790 791
     * @param nonViralName
791 792
     * @return
792 793
     */
793
    private List<TaggedText> getGenusAndSpeciesTaggedPart(NonViralName<?> nonViralName) {
794
    private List<TaggedText> getGenusAndSpeciesTaggedPart(INonViralName nonViralName) {
794 795
        //Uninomial
795 796
        List<TaggedText> tags = getUninomialTaggedPart(nonViralName);
796 797

  
......
823 824
     * @param tags
824 825
     * @param nonViralName
825 826
     */
826
    protected void addAppendedTaggedPhrase(List<TaggedText> tags, NonViralName<?> nonViralName){
827
    protected void addAppendedTaggedPhrase(List<TaggedText> tags, INonViralName nonViralName){
827 828
        String appendedPhrase = nonViralName ==null ? null : nonViralName.getAppendedPhrase();
828 829
        String originalName = getOriginalNameString(nonViralName, tags);
829 830
        if (StringUtils.isNotBlank(originalName)){
......
834 835
        }
835 836
    }
836 837

  
837
    private String getOriginalNameString(NonViralName<?> currentName, List<TaggedText> originalNameTaggs) {
838
		List<String> originalNameStrings = new ArrayList<String>(1);
839
		currentName = HibernateProxyHelper.deproxy(currentName, NonViralName.class);
838
    private String getOriginalNameString(INonViralName currentName, List<TaggedText> originalNameTaggs) {
839
		List<String> originalNameStrings = new ArrayList<>(1);
840
		currentName = CdmBase.deproxy(currentName);
840 841
		//Hibernate.initialize(currentName.getRelationsToThisName());
841 842
    	for (NameRelationship nameRel : currentName.getRelationsToThisName()){  //handle list, just in case we have strange data; this may result in strange looking results
842 843
			NameRelationshipType type = nameRel.getType();
......
846 847
    			if (!originalName.isInstanceOf(NonViralName.class)){
847 848
    				originalNameString = originalName.getTitleCache();
848 849
    			}else{
849
    				NonViralName<?> originalNvName = CdmBase.deproxy(originalName, NonViralName.class);
850
    				INonViralName originalNvName = CdmBase.deproxy(originalName);
850 851
    				originalNameString = makeOriginalNameString(currentName, originalNvName, originalNameTaggs);
851 852
    			}
852 853
    			originalNameStrings.add("'" + originalNameString +"'");
......
861 862
	}
862 863

  
863 864

  
864
	private String makeOriginalNameString(NonViralName<?> currentName, NonViralName<?> originalName, List<TaggedText> currentNameTags) {
865
	private String makeOriginalNameString(INonViralName currentName, INonViralName originalName,
866
	        List<TaggedText> currentNameTags) {
865 867
		//use cache if necessary
866 868
		String cacheToUse = null;
867 869
		if (originalName.isProtectedNameCache() && StringUtils.isNotBlank(originalName.getNameCache())){
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/name/ZooNameNoMarkerCacheStrategy.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
15 15
import org.apache.commons.lang.StringUtils;
16 16
import org.apache.log4j.Logger;
17 17

  
18
import eu.etaxonomy.cdm.model.name.NonViralName;
18
import eu.etaxonomy.cdm.model.name.INonViralName;
19 19
import eu.etaxonomy.cdm.model.name.ZoologicalName;
20 20
import eu.etaxonomy.cdm.strategy.cache.TagEnum;
21 21
import eu.etaxonomy.cdm.strategy.cache.TaggedText;
......
26 26
	private static final long serialVersionUID = 2821727191810867550L;
27 27

  
28 28
	final static UUID uuid = UUID.fromString("8ffa5f04-0303-4875-be44-dac5ff95b874");
29
	
30
	
29

  
30

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

  
36

  
37 37
	/**
38 38
	 * Factory method
39 39
	 * @return
......
41 41
	public static ZooNameNoMarkerCacheStrategy NewInstance(){
42 42
		return new ZooNameNoMarkerCacheStrategy();
43 43
	}
44
	
44

  
45 45
	/**
46 46
	 * Constructor
47 47
	 */
......
58 58

  
59 59

  
60 60
	@Override
61
	protected void addInfraGenericPart(NonViralName<?> name, List<TaggedText> tags, String infraGenericMarker, String infraGenEpi) {
61
	protected void addInfraGenericPart(INonViralName name, List<TaggedText> tags, String infraGenericMarker, String infraGenEpi) {
62 62
		//add epitheton
63 63
		if (StringUtils.isNotBlank(infraGenEpi)){
64 64
	        tags.add(new TaggedText(TagEnum.name, "(" + infraGenEpi + ")"));
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/taxon/TaxonBaseShortSecCacheStrategy.java
21 21
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
22 22
import eu.etaxonomy.cdm.model.agent.Person;
23 23
import eu.etaxonomy.cdm.model.agent.Team;
24
import eu.etaxonomy.cdm.model.name.NonViralName;
25 24
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
26 25
import eu.etaxonomy.cdm.model.reference.Reference;
27 26
import eu.etaxonomy.cdm.model.taxon.Synonym;
......
136 135
	 * @param name
137 136
	 */
138 137
	private String getNamePart(TaxonBase<?> taxonBase) {
139
		TaxonNameBase<?,?> nameBase = taxonBase.getName();
140
		String result = nameBase.getTitleCache();
138
		TaxonNameBase<?,?> taxonName = taxonBase.getName();
139
		String result = taxonName.getTitleCache();
141 140
		//use name cache instead of title cache if required
142
		if (taxonBase.isUseNameCache() && nameBase.isInstanceOf(NonViralName.class)){
143
			NonViralName<?> nvn = HibernateProxyHelper.deproxy(nameBase, NonViralName.class);
144
			result = nvn.getNameCache();
141
		if (taxonBase.isUseNameCache()){
142
			result = taxonName.getNameCache();
145 143
		}
146 144
		if (StringUtils.isNotBlank(taxonBase.getAppendedPhrase())){
147 145
			result = result.trim() + " " +  taxonBase.getAppendedPhrase().trim();
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImpl.java
20 20
import org.joda.time.Partial;
21 21

  
22 22
import eu.etaxonomy.cdm.common.CdmUtils;
23
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
24 23
import eu.etaxonomy.cdm.model.agent.Person;
25 24
import eu.etaxonomy.cdm.model.agent.Team;
26 25
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
......
175 174
	 * @return
176 175
	 */
177 176
	private String getCodeSpecificFullNameRegEx(INonViralName nameToBeFilledOrig){
178
	    NonViralName<?> nameToBeFilled = HibernateProxyHelper.deproxy(nameToBeFilledOrig, NonViralName.class);
177
	    INonViralName nameToBeFilled = CdmBase.deproxy(nameToBeFilledOrig);
179 178
		if (nameToBeFilled instanceof ZoologicalName){
180 179
			return anyZooFullName;
181 180
		}else if (nameToBeFilled instanceof BotanicalName) {
......
194 193
	 * @return
195 194
	 */
196 195
	private String getCodeSpecificSimpleNameRegEx(INonViralName nameToBeFilled){
197
		nameToBeFilled = HibernateProxyHelper.deproxy(nameToBeFilled, NonViralName.class);
196
		nameToBeFilled = CdmBase.deproxy(nameToBeFilled);
198 197

  
199 198
		if (nameToBeFilled instanceof ZoologicalName){
200 199
			return anyZooName;
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/name/BotanicNameCacheStrategyTest.java
26 26
import eu.etaxonomy.cdm.model.common.DefaultTermInitializer;
27 27
import eu.etaxonomy.cdm.model.common.TimePeriod;
28 28
import eu.etaxonomy.cdm.model.name.BotanicalName;
29
import eu.etaxonomy.cdm.model.name.INonViralName;
29 30
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
30 31
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
31
import eu.etaxonomy.cdm.model.name.NonViralName;
32 32
import eu.etaxonomy.cdm.model.name.Rank;
33 33
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
34 34
import eu.etaxonomy.cdm.model.reference.Reference;
......
226 226
	@Test
227 227
	public final void testGetInfraGenusTaggedNameCache() {
228 228
		String methodName = "getInfraGenusTaggedNameCache";
229
		Method method = getMethod(NonViralNameDefaultCacheStrategy.class, methodName, NonViralName.class);
229
		Method method = getMethod(NonViralNameDefaultCacheStrategy.class, methodName, INonViralName.class);
230 230
		this.getStringValue(method, strategy, subGenusName);
231 231
		assertEquals("Genus subg. InfraGenericPart", strategy.getNameCache(subGenusName));
232 232
	}
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/name/ZooNameNoMarkerCacheStrategyTest.java
22 22
import eu.etaxonomy.cdm.model.agent.Person;
23 23
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
24 24
import eu.etaxonomy.cdm.model.common.DefaultTermInitializer;
25
import eu.etaxonomy.cdm.model.name.NonViralName;
25
import eu.etaxonomy.cdm.model.name.INonViralName;
26 26
import eu.etaxonomy.cdm.model.name.Rank;
27 27
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
28 28
import eu.etaxonomy.cdm.model.name.ZoologicalName;
......
187 187
	@Test
188 188
	public final void testGetInfraGenusTaggedNameCache() {
189 189
		String methodName = "getInfraGenusTaggedNameCache";
190
		Method method = getMethod(NonViralNameDefaultCacheStrategy.class, methodName, NonViralName.class);
190
		Method method = getMethod(NonViralNameDefaultCacheStrategy.class, methodName, INonViralName.class);
191 191

  
192 192
		this.getStringValue(method, strategy, subGenusName);
193 193
		assertEquals("Genus (InfraGenericPart)", strategy.getNameCache(subGenusName));
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/name/ZoologicalNameCacheStrategyTest.java
24 24
import eu.etaxonomy.cdm.model.agent.Person;
25 25
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
26 26
import eu.etaxonomy.cdm.model.common.DefaultTermInitializer;
27
import eu.etaxonomy.cdm.model.name.NonViralName;
27
import eu.etaxonomy.cdm.model.name.INonViralName;
28 28
import eu.etaxonomy.cdm.model.name.Rank;
29 29
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
30 30
import eu.etaxonomy.cdm.model.name.ZoologicalName;
......
206 206
	@Test
207 207
	public final void testGetInfraGenusTaggedNameCache() {
208 208
		String methodName = "getInfraGenusTaggedNameCache";
209
		Method method = getMethod(NonViralNameDefaultCacheStrategy.class, methodName, NonViralName.class);
209
		Method method = getMethod(NonViralNameDefaultCacheStrategy.class, methodName, INonViralName.class);
210 210

  
211 211
		this.getStringValue(method, strategy, subGenusName);
212 212
		assertEquals("Genus subg. InfraGenericPart", strategy.getNameCache(subGenusName));
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/CdmPersistentDataSource.java
535 535
	 */
536 536
	@SuppressWarnings("unchecked")
537 537
	static public List<CdmPersistentDataSource> getAllDataSources(){
538
		List<CdmPersistentDataSource> dataSources = new ArrayList<CdmPersistentDataSource>();
538
		List<CdmPersistentDataSource> dataSources = new ArrayList<>();
539 539

  
540 540
		Element root = getBeansRoot(CdmPersistentSourceUtils.getCdmSourceInputStream());
541 541
		if (root == null){
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IdentifiableServiceBase.java
39 39
import eu.etaxonomy.cdm.model.common.MarkerType;
40 40
import eu.etaxonomy.cdm.model.media.Rights;
41 41
import eu.etaxonomy.cdm.model.name.INonViralName;
42
import eu.etaxonomy.cdm.model.name.ITaxonName;
42 43
import eu.etaxonomy.cdm.model.name.NonViralName;
44
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
43 45
import eu.etaxonomy.cdm.model.reference.Reference;
44 46
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
45 47
import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;
......
388 390
		String newTitleCache= null;
389 391
		INonViralName nvn = null; //TODO find better solution
390 392
		try{
391
			if (entity instanceof NonViralName){
392
				nvn = (INonViralName) entity;
393
			if (entity instanceof TaxonNameBase){
394
				nvn = (ITaxonName) entity;
393 395
				newTitleCache = entityCacheStrategy.getTitleCache(nvn);
394 396
			} else{
395 397
				 newTitleCache = entityCacheStrategy.getTitleCache(entity);
396 398
			}
397 399
		}catch (ClassCastException e){
398
			nvn = HibernateProxyHelper.deproxy(entity, NonViralName.class);
400
			nvn = HibernateProxyHelper.deproxy(entity, TaxonNameBase.class);
399 401
			newTitleCache = entityCacheStrategy.getTitleCache(nvn);
400
			//System.out.println("titleCache: " +entity.getTitleCache());
401 402
		}
402 403

  
403 404
		if ( oldTitleCache == null   || ! oldTitleCache.equals(newTitleCache) ){

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)