Project

General

Profile

« Previous | Next » 

Revision 2e814df1

Added by Andreas Kohlbecker almost 6 years ago

ref #7458 implementation of the note field for the NameTypeEditor

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/view/name/NameTypeDesignationPresenter.java
8 8
*/
9 9
package eu.etaxonomy.cdm.vaadin.view.name;
10 10

  
11
import java.util.ArrayList;
11 12
import java.util.Arrays;
12 13
import java.util.EnumSet;
13 14
import java.util.HashSet;
......
24 25
import eu.etaxonomy.cdm.api.service.IService;
25 26
import eu.etaxonomy.cdm.api.service.dto.RegistrationDTO;
26 27
import eu.etaxonomy.cdm.api.service.name.TypeDesignationSetManager.TypeDesignationWorkingSet;
28
import eu.etaxonomy.cdm.model.common.Annotation;
27 29
import eu.etaxonomy.cdm.model.name.NameTypeDesignation;
28 30
import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus;
29 31
import eu.etaxonomy.cdm.model.name.TaxonName;
......
99 101
    protected NameTypeDesignation loadCdmEntity(UUID uuid) {
100 102
        List<String> initStrategy = Arrays.asList(new String []{
101 103
                "$",
104
                "annotations.*", // * is needed as log as we are using a table in FilterableAnnotationsField
102 105
                "typifiedNames.typeDesignations", // important !!
103 106
                "typeName.$",
104 107
                "citation.authorship.$",
......
218 221
            // FIXME do we need to save the names here or is the delete cascaded from the typedesignation to the name?
219 222
        }
220 223

  
224
        // handle annotation changes
225
        List<Annotation> annotations = getView().getAnnotationsField().getValue();
226
        List<Annotation> currentAnnotations = new ArrayList<>(bean.getAnnotations());
227
        List<Annotation> annotationsSeen = new ArrayList<>();
228
        for(Annotation a : annotations){
229
            if(a == null){
230
                continue;
231
            }
232
            if(!currentAnnotations.contains(a)){
233
                bean.addAnnotation(a);
234
            }
235
            annotationsSeen.add(a);
236
        }
237
        for(Annotation a : currentAnnotations){
238
            if(!annotationsSeen.contains(a)){
239
                bean.removeAnnotation(a);
240
            }
241
        }
242

  
243

  
221 244
        return bean;
222 245
    }
223 246

  

Also available in: Unified diff