Revision 1dc37073
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrixBottomToolbar.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
import java.util.ArrayList; |
12 | 12 |
import java.util.Collection; |
13 |
import java.util.HashMap; |
|
14 | 13 |
import java.util.List; |
15 | 14 |
import java.util.Map; |
16 |
import java.util.Set; |
|
17 | 15 |
import java.util.UUID; |
18 | 16 |
import java.util.stream.Collectors; |
19 | 17 |
|
... | ... | |
32 | 30 |
import eu.etaxonomy.cdm.api.service.UpdateResult; |
33 | 31 |
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO; |
34 | 32 |
import eu.etaxonomy.cdm.api.service.dto.SpecimenRowWrapperDTO; |
33 |
import eu.etaxonomy.cdm.api.service.dto.TaxonRowWrapperDTO; |
|
35 | 34 |
import eu.etaxonomy.cdm.common.CdmUtils; |
36 | 35 |
import eu.etaxonomy.cdm.model.description.CategoricalData; |
37 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
|
38 | 36 |
import eu.etaxonomy.cdm.model.description.Feature; |
39 | 37 |
import eu.etaxonomy.cdm.model.description.QuantitativeData; |
40 | 38 |
import eu.etaxonomy.cdm.model.description.SpecimenDescription; |
... | ... | |
81 | 79 |
if(dialog.open()==Window.OK){ |
82 | 80 |
Collection<SpecimenNodeWrapper> wrappers = dialog.getSpecimen(); |
83 | 81 |
for (SpecimenNodeWrapper wrapper : wrappers) { |
84 |
SpecimenDescription description = CdmStore.getService(IDescriptiveDataSetService.class)
|
|
85 |
.findDescriptionForDescriptiveDataSet(matrix.getDescriptiveDataSet().getUuid(),
|
|
82 |
SpecimenDescription specimenDescription = CdmStore.getService(IDescriptiveDataSetService.class)
|
|
83 |
.findSpecimenDescription(matrix.getDescriptiveDataSet().getUuid(),
|
|
86 | 84 |
wrapper.getUuidAndTitleCache().getUuid()); |
87 |
// description elements |
|
88 |
Map<Feature, DescriptionElementBase> featureToElementMap = new HashMap<>(); |
|
89 |
Set<DescriptionElementBase> elements = description.getElements(); |
|
90 |
for (DescriptionElementBase descriptionElementBase : elements) { |
|
91 |
Feature feature = descriptionElementBase.getFeature(); |
|
92 |
featureToElementMap.put(feature, descriptionElementBase); |
|
93 |
} |
|
94 |
RowWrapperDTO rowWrapper = CdmStore.getService(IDescriptiveDataSetService.class).createSpecimenRowWrapper(description, matrix.getDescriptiveDataSet()); |
|
85 |
SpecimenRowWrapperDTO rowWrapper = CdmStore.getService(IDescriptiveDataSetService.class) |
|
86 |
.createSpecimenRowWrapper(specimenDescription, matrix.getDescriptiveDataSet(), true); |
|
95 | 87 |
if(rowWrapper==null){ |
96 |
error += description;
|
|
88 |
error += specimenDescription;
|
|
97 | 89 |
continue; |
98 | 90 |
} |
91 |
//add specimen description |
|
99 | 92 |
matrix.getDescriptions().add(rowWrapper); |
100 |
matrix.getDescriptiveDataSet().addDescription(description); |
|
93 |
matrix.getDescriptiveDataSet().addDescription(specimenDescription); |
|
94 |
matrix.getCdmEntitiySession().load(specimenDescription, true); |
|
95 |
|
|
96 |
//add taxon description |
|
97 |
TaxonRowWrapperDTO taxonDescription = rowWrapper.getDefaultTaxonDescription(); |
|
98 |
matrix.getDescriptiveDataSet().addDescription(taxonDescription.getDescription()); |
|
99 |
matrix.getCdmEntitiySession().load(taxonDescription.getDescription(), true); |
|
100 |
|
|
101 | 101 |
matrix.setDirty(); |
102 | 102 |
matrix.getSpecimenCache().remove(wrapper); |
103 | 103 |
} |
Also available in: Unified diff
ref #7674 Create default taxon description when adding specimens