Project

General

Profile

« Previous | Next » 

Revision 87d0418a

Added by Andreas Müller almost 8 years ago

Cache for TaxonNodes #5835

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DescriptionHelper.java
62 62
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
63 63
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
64 64
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
65
import eu.etaxonomy.cdm.model.taxon.Classification;
65 66
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
66 67
import eu.etaxonomy.cdm.model.taxon.Taxon;
68
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
67 69
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
68 70
import eu.etaxonomy.taxeditor.store.CdmStore;
69 71

  
......
241 243
			return getCache((TypeDesignationBase<?>) element);
242 244
		}else if (element instanceof HomotypicalGroup) {
243 245
			return getCache((HomotypicalGroup) element);
246
		}else if (element instanceof TaxonNode) {
247
			return getCache((TaxonNode) element);
244 248
		}else if (element instanceof Marker) {
245 249
			Marker marker = (Marker) element;
246 250
			MarkerType type = marker.getMarkerType();
......
258 262
	}
259 263

  
260 264

  
265
	private static String getCache(TaxonNode taxonNode) {
266
		String result = "";
267
		Classification classification = taxonNode.getClassification();
268
		if (classification != null){
269
			String classificationStr = classification.getName() == null ? "" : classification.getName().getText();
270
			result = CdmUtils.concat("" , result, classificationStr);
271
			if (StringUtils.isBlank(result)){
272
				result = classification.toString();
273
			}
274
		}
275
		String parentStr;
276
		TaxonNode parentNode = taxonNode.getParent();
277
		if (parentNode == null){
278
			parentStr = "no parent";
279
		}else{
280
			Taxon parentTaxon = parentNode.getTaxon();
281
			if (parentTaxon == null){
282
				parentStr = "no parent taxon";
283
			}else{
284
				TaxonNameBase<?,?> parentName = parentTaxon.getName();
285
				if (parentName == null){
286
					parentStr = parentTaxon.getTitleCache();
287
				}else{
288
					parentStr = parentName.getTitleCache();
289
				}
290
			}
291
		}
292
		result = CdmUtils.concat(": ", result, parentStr);
293
		
294
		return null;
295
	}
296

  
261 297
	private static String getCache(TypeDesignationBase<?> designation) {
262 298
		designation = CdmBase.deproxy(designation);
263 299
		TypeDesignationStatusBase<?> status = designation.getTypeStatus();

Also available in: Unified diff