Project

General

Profile

« Previous | Next » 

Revision a784f00f

Added by Katja Luther about 14 years ago

merge cate-development2 branch with trunk

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/validation/constraint/MustHaveAuthorityValidator.java
14 14

  
15 15
import eu.etaxonomy.cdm.model.name.BotanicalName;
16 16
import eu.etaxonomy.cdm.model.name.NonViralName;
17
import eu.etaxonomy.cdm.model.name.Rank;
17 18
import eu.etaxonomy.cdm.validation.annotation.MustHaveAuthority;
18 19

  
19 20
public class MustHaveAuthorityValidator implements
......
25 26
		boolean valid = true;
26 27
		
27 28
		if(name.getBasionymAuthorTeam() == null && name.getAuthorshipCache() == null) {
28
		
29
		    valid = false;
29 30
		    if(name instanceof BotanicalName && name.getRank().isInfraSpecific()) {
30 31
			    if(name.getSpecificEpithet() != null && name.getInfraSpecificEpithet() != null && name.getInfraSpecificEpithet().equals(name.getSpecificEpithet())) {
31 32
				    valid = true; // is AUTONYM
32
			    } else {
33
				    valid = false;
33
			    } 
34
		    } 
35
		    if(name.getRank().isSpeciesAggregate()) { // Species aggregates don't have authorities
36
		    	valid = true;
34 37
			    }
38
		    
35 39
		    } else {
40
			valid = true;
41
			if(name instanceof BotanicalName && name.getRank().isInfraSpecific()) {
42
			    if(name.getSpecificEpithet() != null && name.getInfraSpecificEpithet() != null && name.getInfraSpecificEpithet().equals(name.getSpecificEpithet())) {
43
				    valid = false; // is AUTONYM
44
			    } 
45
		    } 
46
		    if(name.getRank().isSpeciesAggregate()) { // Species aggregates don't have authorities
36 47
			    valid = false;
37 48
		    }
38 49
		}

Also available in: Unified diff