Revision baace0b5
Added by Katja Luther almost 6 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java | ||
---|---|---|
205 | 205 |
} |
206 | 206 |
toDelete.clear(); |
207 | 207 |
if (!saveCandidates.isEmpty()){ |
208 |
CdmStore.getService(saveCandidates.get(0)).merge(saveCandidates, true);
|
|
208 |
CdmStore.getService(saveCandidates.get(0)).merge(saveCandidates, true);
|
|
209 | 209 |
} |
210 | 210 |
if(resetMerge){ |
211 | 211 |
//merge entities |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/NameEditorInput.java | ||
---|---|---|
17 | 17 |
import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase; |
18 | 18 |
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator; |
19 | 19 |
import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator; |
20 |
import eu.etaxonomy.cdm.model.name.HybridRelationship; |
|
20 | 21 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
21 | 22 |
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator; |
22 | 23 |
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider; |
... | ... | |
145 | 146 |
List<String> propertyPaths = Arrays.asList(new String[]{}); |
146 | 147 |
return CdmStore.getService(INameService.class).load(entityUuid, getPropertyPaths()); |
147 | 148 |
} |
149 |
@Override |
|
150 |
public void addSaveCandidate(TaxonName name){ |
|
151 |
if (!name.getHybridChildRelations().isEmpty()){ |
|
152 |
for (HybridRelationship rel: name.getHybridChildRelations()){ |
|
153 |
if (!rel.getParentName().isPersited()){ |
|
154 |
super.addSaveCandidate(rel.getParentName()); |
|
155 |
} |
|
156 |
if (!rel.getHybridName().isPersited()){ |
|
157 |
super.addSaveCandidate(rel.getHybridName()); |
|
158 |
} |
|
159 |
} |
|
160 |
} |
|
161 |
|
|
162 |
super.addSaveCandidate(name); |
|
163 |
} |
|
148 | 164 |
|
149 | 165 |
|
150 | 166 |
private List<String> getPropertyPaths(){ |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/TaxonEditorInput.java | ||
---|---|---|
5 | 5 |
import java.util.List; |
6 | 6 |
import java.util.UUID; |
7 | 7 |
|
8 |
import eu.etaxonomy.cdm.api.service.INameService; |
|
8 | 9 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
9 | 10 |
import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase; |
10 | 11 |
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator; |
... | ... | |
12 | 13 |
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator; |
13 | 14 |
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException; |
14 | 15 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
16 |
import eu.etaxonomy.cdm.model.name.HybridRelationship; |
|
17 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
15 | 18 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
16 | 19 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
17 | 20 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
... | ... | |
27 | 30 |
/** Constant <code>ID="bulkeditor.input.taxon"</code> */ |
28 | 31 |
public static final String ID = "bulkeditor.input.taxon"; |
29 | 32 |
|
33 |
private List<TaxonName> saveNameCandidates = new ArrayList<>(); |
|
30 | 34 |
|
31 | 35 |
|
32 | 36 |
/** |
... | ... | |
147 | 151 |
|
148 | 152 |
} |
149 | 153 |
|
154 |
@Override |
|
155 |
public void addSaveCandidate(TaxonBase taxonBase){ |
|
156 |
if (!taxonBase.getName().getHybridChildRelations().isEmpty()){ |
|
157 |
for (HybridRelationship rel: taxonBase.getName().getHybridChildRelations()){ |
|
158 |
if (!rel.getParentName().isPersited()){ |
|
159 |
this.saveNameCandidates.add(rel.getParentName()); |
|
160 |
} |
|
161 |
if (!rel.getHybridName().isPersited()){ |
|
162 |
this.saveNameCandidates.add(rel.getHybridName()); |
|
163 |
} |
|
164 |
} |
|
165 |
} |
|
166 |
|
|
167 |
super.addSaveCandidate(taxonBase); |
|
168 |
} |
|
169 |
|
|
170 |
@Override |
|
171 |
public void saveModel(boolean resetMerge){ |
|
172 |
CdmStore.getService(INameService.class).save(this.saveNameCandidates); |
|
173 |
super.saveModel(resetMerge); |
|
174 |
} |
|
175 |
|
|
150 | 176 |
} |
Also available in: Unified diff
fix #7393: fix saving of new hybrid names in bulk editor