Project

General

Profile

Revision a147c1df

IDa147c1dfacf69b3bc4be22eb8008d7ed0bffb3ce
Parent 2b50eebb
Child bad14dbc

Added by Andreas Müller over 2 years ago

cleanup

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DescriptionHelper.java
75 75
 *
76 76
 * @author p.ciardelli
77 77
 * @author n.hoffmann
78
 * @created 02.04.2009
79 78
 */
80 79
public class DescriptionHelper {
81 80

  
......
147 146
			}
148 147
		}
149 148
		String result = cache == null ? "" : cache;
150
		if (StringUtils.isNotBlank(mainElementLabel)){
149
		if (isNotBlank(mainElementLabel)){
151 150
			result = CdmUtils.concat(" ", result, "(" + mainElementLabel + ")");
152 151
		}
153 152
		return result;
......
286 285
		if (taxonName != null){
287 286
			taxonStr = taxonName.getTitleCache();
288 287
		}
289
		if (StringUtils.isBlank(taxonStr) && taxon != null){
288
		if (isBlank(taxonStr) && taxon != null){
290 289
			taxonStr = taxon.getTitleCache();
291 290
		}
292
		if (StringUtils.isBlank(taxonStr)){
291
		if (isBlank(taxonStr)){
293 292
			taxonStr = "no or unlabled taxon";
294 293
		}
295 294

  
......
299 298
		String unitStr;
300 299
		if (unit != null){
301 300
			unitStr = unit.getTitleCache();
302
			if (StringUtils.isBlank(unitStr)){
301
			if (isBlank(unitStr)){
303 302
				unitStr = "Unlabled unit";
304 303
			}
305 304
		}else{
......
317 316
		if (classification != null){
318 317
			String classificationStr = classification.getName() == null ? "" : classification.getName().getText();
319 318
			result = CdmUtils.concat("" , result, classificationStr);
320
			if (StringUtils.isBlank(result)){
319
			if (isBlank(result)){
321 320
				result = classification.toString();
322 321
			}
323 322
		}
......
362 361
			if (typeRepr != null){
363 362
				typeLabel = typeRepr.getAbbreviatedLabel();
364 363
			}
365
			if (StringUtils.isBlank(typeLabel) && typeRepr != null){
364
			if (isBlank(typeLabel) && typeRepr != null){
366 365
				typeLabel = typeRepr.getLabel();
367 366
			}
368
			if (StringUtils.isBlank(typeLabel) ){
367
			if (isBlank(typeLabel) ){
369 368
				typeLabel = status.getSymbol();
370 369
			}
371
			if (StringUtils.isBlank(typeLabel)){
370
			if (isBlank(typeLabel)){
372 371
				typeLabel = status.getTitleCache();
373 372
			}
374 373
		}
375
		if (StringUtils.isBlank(typeLabel)){
374
		if (isBlank(typeLabel)){
376 375
			typeLabel = "->";
377 376
		}
378 377
		String fromString = "";
......
417 416
			if (typeRepr != null){
418 417
				typeLabel = typeRepr.getAbbreviatedLabel();
419 418
			}
420
			if (StringUtils.isBlank(typeLabel) && typeRepr != null){
419
			if (isBlank(typeLabel) && typeRepr != null){
421 420
				typeLabel = typeRepr.getLabel();
422 421
			}
423
			if (StringUtils.isBlank(typeLabel) ){
422
			if (isBlank(typeLabel) ){
424 423
				typeLabel = type.getSymbol();
425 424
			}
426
			if (StringUtils.isBlank(typeLabel)){
425
			if (isBlank(typeLabel)){
427 426
				typeLabel = type.getTitleCache();
428 427
			}
429 428
		}
430
		if (StringUtils.isBlank(typeLabel)){
429
		if (isBlank(typeLabel)){
431 430
			typeLabel = "->";
432 431
		}
433 432
		String result = CdmUtils.concat(" ", new String[]{from == null ? null : from.getTitleCache(),
......
441 440
		for (TaxonName tnb : hg.getTypifiedNames()){
442 441
			result = CdmUtils.concat(", ", result, tnb.getTitleCache());
443 442
		}
444
		if (StringUtils.isBlank(result)){
443
		if (isBlank(result)){
445 444
			result = "No typified names";
446 445
		}
447 446
		return result;
......
578 577
					text += " [ " + source.getNameUsedInSource().getTitleCache() + " ]";
579 578
				}
580 579
			}
581
			if(CdmUtils.isEmpty(text)){
580
			if(isBlank(text)){
582 581
				text = "No sources provided";
583 582
			}
584 583
		}else{
......
586 585
			LanguageString languageString = element.getPreferredLanguageString(languages);
587 586
			text = languageString != null ? languageString.getText() : null;
588 587
		}
589
		return CdmUtils.isEmpty(text) ? "No text provided" : text;
588
		return isBlank(text) ? "No text provided" : text;
590 589
	}
591 590

  
592 591
	/**
......
703 702
			return element.toString();
704 703
		}
705 704
	}
705
	
706
	private static boolean isNotBlank(String str){
707
		return StringUtils.isNotBlank(str);
708
	}
709
	
710
	private static boolean isBlank(String str){
711
		return StringUtils.isBlank(str);
712
	}
706 713
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)