Revision a248ff4a
Added by Patrick Plitzner almost 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/MoveDefinedTermOperation.java | ||
---|---|---|
9 | 9 |
package eu.etaxonomy.taxeditor.editor.definedterm.operation; |
10 | 10 |
|
11 | 11 |
import java.util.Collection; |
12 |
import java.util.HashSet; |
|
12 | 13 |
import java.util.UUID; |
13 | 14 |
|
14 | 15 |
import org.eclipse.core.commands.ExecutionException; |
... | ... | |
22 | 23 |
import eu.etaxonomy.cdm.api.service.TermServiceImpl.TermMovePosition; |
23 | 24 |
import eu.etaxonomy.cdm.persistence.dto.AbstractTermDto; |
24 | 25 |
import eu.etaxonomy.cdm.persistence.dto.TermDto; |
26 |
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto; |
|
25 | 27 |
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation; |
26 | 28 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
27 | 29 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
... | ... | |
34 | 36 |
public class MoveDefinedTermOperation extends AbstractPostTaxonOperation { |
35 | 37 |
|
36 | 38 |
private final Collection<TermDto> sourceTerms;// the actual DefinedTermBase(s) we are moving |
39 |
private final Collection<TermVocabularyDto> sourceVocabularies; |
|
37 | 40 |
private final AbstractTermDto targetTermOrVocabulary;// the target VOCABULARY or DefinedTerm we are moving these to |
38 | 41 |
private final int currentLocation; |
39 | 42 |
|
... | ... | |
55 | 58 |
this.targetTermOrVocabulary = target; |
56 | 59 |
this.sourceTerms = sourceTerms; |
57 | 60 |
this.currentLocation = currentLocation; |
61 |
sourceVocabularies = new HashSet<>(); |
|
58 | 62 |
} |
59 | 63 |
|
60 | 64 |
@Override |
61 | 65 |
public IStatus execute(IProgressMonitor monitor, IAdaptable info) |
62 | 66 |
throws ExecutionException { |
63 |
sourceTerms.forEach(term->
|
|
64 |
{
|
|
67 |
for(TermDto term:sourceTerms){
|
|
68 |
sourceVocabularies.add(term.getVocabularyDto());
|
|
65 | 69 |
UUID parentUuid = targetTermOrVocabulary.getUuid(); |
66 | 70 |
TermMovePosition termMovePosition = TermMovePosition.ON; |
67 | 71 |
if(currentLocation == ViewerDropAdapter.LOCATION_BEFORE) { |
... | ... | |
71 | 75 |
termMovePosition = TermMovePosition.AFTER; |
72 | 76 |
} |
73 | 77 |
CdmStore.getService(ITermService.class).moveTerm(term, parentUuid, termMovePosition); |
74 |
}); |
|
75 |
return postExecute(targetTermOrVocabulary); |
|
78 |
} |
|
79 |
Collection<AbstractTermDto> affectedObjects = new HashSet<>(sourceTerms); |
|
80 |
affectedObjects.addAll(sourceVocabularies); |
|
81 |
affectedObjects.add(targetTermOrVocabulary); |
|
82 |
return postExecute(affectedObjects); |
|
76 | 83 |
} |
77 | 84 |
|
78 | 85 |
@Override |
Also available in: Unified diff
ref #8263 Fix refresh of source vocabulary after moving terms