Revision ad2e9ab4
Added by Katja Luther over 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditorPart.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.taxeditor.editor.view.checklist.e4; |
10 | 10 |
|
11 |
import java.util.ArrayList; |
|
11 | 12 |
import java.util.Arrays; |
12 | 13 |
import java.util.Collection; |
14 |
import java.util.HashSet; |
|
13 | 15 |
import java.util.List; |
14 | 16 |
import java.util.Map; |
17 |
import java.util.Set; |
|
15 | 18 |
import java.util.UUID; |
16 | 19 |
|
17 | 20 |
import javax.annotation.PostConstruct; |
... | ... | |
172 | 175 |
|
173 | 176 |
@Override |
174 | 177 |
public List<DescriptionBase> getRootEntities() { |
175 |
return editor.getDistributions(); |
|
178 |
List<DescriptionBase> rootEntities = new ArrayList(); |
|
179 |
editor.taxonList.forEach(dto -> rootEntities.addAll(dto.getDescriptionsWrapper().getDescriptions())); |
|
180 |
return rootEntities; |
|
176 | 181 |
} |
177 | 182 |
|
178 | 183 |
/** |
... | ... | |
213 | 218 |
return conversation; |
214 | 219 |
} |
215 | 220 |
|
221 |
|
|
216 | 222 |
@Persist |
217 | 223 |
@Override |
218 | 224 |
public void save(IProgressMonitor monitor) { |
219 |
List<MergeResult<DescriptionBase>> result =CdmStore.getService(IDescriptionService.class).merge(editor.getDistributions(), true); |
|
220 |
// for (MergeResult mergeRes: result){ |
|
221 |
// mergeRes.getNewEntities() |
|
222 |
// } |
|
223 |
conversation.commit(); |
|
224 |
//editor.getDescriptionsToSave().clear(); |
|
225 |
|
|
226 |
dirty.setDirty(false); |
|
225 |
saveDistributions(); |
|
226 |
dirty.setDirty(false); |
|
227 |
} |
|
228 |
|
|
229 |
protected void saveDistributions() { |
|
230 |
Set<TaxonDistributionDTO> coll = new HashSet(); |
|
231 |
editor.taxonList.forEach(dto->coll.add(dto)); |
|
232 |
List<MergeResult<DescriptionBase>> result = CdmStore.getService(IDescriptionService.class).mergeDescriptionElements(coll, true); |
|
233 |
for (MergeResult<DescriptionBase> mergeRes: result ){ |
|
234 |
cdmEntitySession.load(mergeRes, true); |
|
235 |
} |
|
236 |
// editor.createTaxonDistributionMap(); |
|
237 |
conversation.commit(); |
|
238 |
this.dirty.setDirty(false); |
|
239 |
editor.getDescriptionsToSave().clear(); |
|
227 | 240 |
} |
228 | 241 |
|
229 | 242 |
/** |
Also available in: Unified diff
ref #7854: continue session handling in distribution editor