Project

General

Profile

« Previous | Next » 

Revision b30b7482

Added by Andreas Müller almost 6 years ago

ref #6945 implement common name status as markers for recommended and synonym

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/berlinModel/in/BerlinModelCommonNamesImport.java
32 32
import eu.etaxonomy.cdm.io.common.ResultSetPartitioner;
33 33
import eu.etaxonomy.cdm.io.common.Source;
34 34
import eu.etaxonomy.cdm.io.common.TdwgAreaProvider;
35
import eu.etaxonomy.cdm.model.common.Annotation;
36
import eu.etaxonomy.cdm.model.common.AnnotationType;
37 35
import eu.etaxonomy.cdm.model.common.CdmBase;
38 36
import eu.etaxonomy.cdm.model.common.Extension;
39 37
import eu.etaxonomy.cdm.model.common.ExtensionType;
......
64 62

  
65 63
	public static final UUID REFERENCE_LANGUAGE_ISO639_2_UUID = UUID.fromString("40c4f8dd-3d9c-44a4-b77a-76e137a89a5f");
66 64
	public static final UUID REFERENCE_LANGUAGE_STRING_UUID = UUID.fromString("2a1b678f-c27d-48c1-b43e-98fd0d426305");
67
	public static final UUID STATUS_ANNOTATION_UUID = UUID.fromString("e3f7b80a-1286-458d-812c-5e818f731968");
65
	public static final UUID COMMONNAME_STATUS_RECOMMENDED_UUID = UUID.fromString("e3f7b80a-1286-458d-812c-5e818f731968");
66
	public static final UUID COMMONNAME_STATUS_SYNONYM_UUID = UUID.fromString("169b2d97-a706-49de-b28b-c67f0ee6764b");
68 67

  
69 68
	public static final String NAMESPACE = "common name";
70 69

  
......
370 369

  
371 370
				//status
372 371
				if (isNotBlank(status)){
373
					AnnotationType statusAnnotationType = getAnnotationType( state, STATUS_ANNOTATION_UUID, "status","The status of this object","status", null);
374
					for (CommonTaxonName commonTaxonName : commonTaxonNames){
375
						Annotation annotation = Annotation.NewInstance(status, statusAnnotationType, Language.DEFAULT());
376
						commonTaxonName.addAnnotation(annotation);
372
					MarkerType recommendedMarkerType = getMarkerType( state, COMMONNAME_STATUS_RECOMMENDED_UUID, "recommended","If the common name has the status recommended (see also status 'synonym', if none of them is true the default status is 'unassessed')","recommended", null);
373
					MarkerType synonymMarkerType = getMarkerType( state, COMMONNAME_STATUS_SYNONYM_UUID, "synonym","If the common name has the status synonym (see also status 'recommended', if none of them is true the default status is 'unassessed')","synonym", null);
374
                    for (CommonTaxonName commonTaxonName : commonTaxonNames){
375
                        Marker marker = null;
376
                        if (status.equals("recommended")){
377
						    marker = Marker.NewInstance(recommendedMarkerType, true);
378
                        }else if (status.equals("synonym")){
379
                            marker = Marker.NewInstance(synonymMarkerType, true);
380
                        }else if (status.equals("unassessed")){
381
                            //do nothing
382
                        }else{
383
						    logger.warn("Unknown common name status: " + status);
384
						}
385
                        if (marker != null){
386
                            commonTaxonName.addMarker(marker);
387
                        }
377 388
					}
378 389
				}
379 390

  

Also available in: Unified diff