Revision bb082354
Added by Katja Luther over 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionColumnAccessor.java | ||
---|---|---|
142 | 142 |
taxonWrapper.getDescriptionsWrapper().getDescriptions().add(desc); |
143 | 143 |
} |
144 | 144 |
desc.addElement(dist); |
145 |
editor.part.getCdmEntitySession().load(desc, true); |
|
145 | 146 |
distributions.add(dist); |
146 | 147 |
|
147 | 148 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditor.java | ||
---|---|---|
440 | 440 |
|
441 | 441 |
@Override |
442 | 442 |
public void widgetSelected(SelectionEvent event) { |
443 |
defaultSource = part.getCdmEntitySession().load(ReferenceSelectionDialog.select(AbstractUtility.getShell(), null), true);
|
|
443 |
defaultSource = ReferenceSelectionDialog.select(AbstractUtility.getShell(), null);
|
|
444 | 444 |
|
445 | 445 |
String defaultSourceStr = (defaultSource == null) ? "" : "Default Source Reference: " + defaultSource.getTitleCache(); |
446 | 446 |
if (defaultSourceStr.length()> 100){ |
... | ... | |
692 | 692 |
return defaultSource; |
693 | 693 |
} |
694 | 694 |
|
695 |
/** |
|
696 |
* @param result |
|
697 |
*/ |
|
698 |
public void reloadDistributions() { |
|
699 |
loadDistributions(taxonList); |
|
700 |
|
|
701 |
} |
|
695 |
// /**
|
|
696 |
// * @param result
|
|
697 |
// */
|
|
698 |
// public void reloadDistributions() {
|
|
699 |
// loadDistributions(taxonList);
|
|
700 |
// |
|
701 |
// }
|
|
702 | 702 |
|
703 | 703 |
|
704 | 704 |
|
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditorPart.java | ||
---|---|---|
36 | 36 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
37 | 37 |
import eu.etaxonomy.cdm.api.service.IDescriptionService; |
38 | 38 |
import eu.etaxonomy.cdm.api.service.ITaxonNodeService; |
39 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
|
39 | 40 |
import eu.etaxonomy.cdm.api.service.UpdateResult; |
40 | 41 |
import eu.etaxonomy.cdm.api.service.dto.TaxonDistributionDTO; |
41 | 42 |
import eu.etaxonomy.cdm.model.description.DescriptionBase; |
43 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
|
42 | 44 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
43 | 45 |
import eu.etaxonomy.cdm.persistence.dto.MergeResult; |
44 | 46 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
... | ... | |
228 | 230 |
|
229 | 231 |
protected void saveDistributions() { |
230 | 232 |
Set<TaxonDistributionDTO> coll = new HashSet(); |
231 |
editor.taxonList.forEach(dto->coll.add(dto)); |
|
233 |
editor.getDescriptionsToSave().forEach(dto->coll.add(dto)); |
|
234 |
for (TaxonDistributionDTO dto: coll){ |
|
235 |
Taxon taxon = null; |
|
236 |
for(TaxonDescription desc: dto.getDescriptionsWrapper().getDescriptions()){ |
|
237 |
if (desc.getTaxon() == null){ |
|
238 |
if (taxon == null){ |
|
239 |
taxon = (Taxon)CdmStore.getService(ITaxonService.class).load(dto.getTaxonUuid()); |
|
240 |
} |
|
241 |
taxon.addDescription(desc); |
|
242 |
} |
|
243 |
if (taxon != null){ |
|
244 |
CdmStore.getService(ITaxonService.class).merge(taxon, true); |
|
245 |
} |
|
246 |
} |
|
247 |
} |
|
248 |
|
|
232 | 249 |
List<MergeResult<DescriptionBase>> result = CdmStore.getService(IDescriptionService.class).mergeDescriptionElements(coll, true); |
233 | 250 |
for (MergeResult<DescriptionBase> mergeRes: result ){ |
234 | 251 |
cdmEntitySession.load(mergeRes, true); |
252 |
cdmEntitySession.load(editor.getDefaultSource(), true); |
|
235 | 253 |
} |
236 |
// editor.createTaxonDistributionMap();
|
|
254 |
editor.createTaxonDistributionMap(); |
|
237 | 255 |
conversation.commit(); |
238 | 256 |
this.dirty.setDirty(false); |
239 | 257 |
editor.getDescriptionsToSave().clear(); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/ChecklistEditorGeneralPreference.java | ||
---|---|---|
268 | 268 |
if (PreferencesUtil.getStringValue(EditorPreferencePredicate.DistributionEditorActivated.getKey()) != null){ |
269 | 269 |
TermDisplayEnum areaDisplay; |
270 | 270 |
try{ |
271 |
areaDisplay = TermDisplayEnum.valueOf(displayArea); |
|
271 |
if (displayArea != null){ |
|
272 |
areaDisplay = TermDisplayEnum.valueOf(displayArea); |
|
273 |
}else{ |
|
274 |
areaDisplay = TermDisplayEnum.Title; |
|
275 |
} |
|
272 | 276 |
}catch(IllegalArgumentException e){ |
273 | 277 |
areaDisplay = TermDisplayEnum.Title; |
274 | 278 |
} |
... | ... | |
319 | 323 |
statusDisplaySelectionCombo.add(display.getLabel()); |
320 | 324 |
} |
321 | 325 |
index = 0; |
322 |
if (PreferencesUtil.displayStatusInChecklistEditor() != null){
|
|
326 |
if (displayStatus != null){
|
|
323 | 327 |
TermDisplayEnum statusDisplay = TermDisplayEnum.valueOf(displayStatus); |
324 | 328 |
for (String itemLabel : statusDisplaySelectionCombo.getItems()){ |
325 | 329 |
if (itemLabel.equalsIgnoreCase(statusDisplay.getLabel())){ |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java | ||
---|---|---|
957 | 957 |
public static FeatureTree getDefaultFeatureTreeForTextualDescription() { |
958 | 958 |
String uuidString = getStringValue( |
959 | 959 |
FEATURE_TREE_DEFAULT_TEXT); |
960 |
if (uuidString == null) {
|
|
960 |
if (StringUtils.isBlank(uuidString)) {
|
|
961 | 961 |
return null; |
962 | 962 |
} |
963 | 963 |
FeatureTree tree = CdmStore.getService( |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/AvailableDistributionStatusAdminWizard.java | ||
---|---|---|
20 | 20 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
21 | 21 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
22 | 22 |
import eu.etaxonomy.cdm.api.service.ITermService; |
23 |
import eu.etaxonomy.cdm.api.service.IVocabularyService; |
|
24 | 23 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
25 | 24 |
import eu.etaxonomy.cdm.model.metadata.CdmPreference; |
26 | 25 |
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate; |
... | ... | |
105 | 104 |
savePref.setAllowOverride(pref.isAllowOverride()); |
106 | 105 |
PreferencesUtil.setPreferenceToDB(savePref); |
107 | 106 |
Collection<DefinedTermBase> terms = new ArrayList<>(); |
108 |
Collection<TermDto> termDtos = CdmStore.getService(IVocabularyService.class).getCompleteTermHierarchy(aPage.getVocabularies().get(0).getUuid()); |
|
109 |
termDtos.forEach(dto -> terms.add(CdmStore.getService(ITermService.class).load(dto.getUuid()))); |
|
107 |
// Collection<TermDto> termDtos = CdmStore.getService(IVocabularyService.class).getCompleteTermHierarchy(aPage.getVocabularies().get(0).getUuid()); |
|
108 |
// termDtos.forEach(dto -> terms.add(CdmStore.getService(ITermService.class).load(dto.getUuid()))); |
|
109 |
// CdmStore.getTermManager().setPreferredTerms(preferredTerms, terms); |
|
110 |
terms.addAll(CdmStore.getService(ITermService.class).listByTermType(this.aPage.type, null, 0, null, null)); |
|
111 |
|
|
112 |
// aPage.getVocabularies().get(0).getTerms() |
|
113 |
// .forEach(dto -> terms.add(CdmStore.getService(ITermService.class).load(dto.getUuid()))); |
|
110 | 114 |
CdmStore.getTermManager().setPreferredTerms(preferredTerms, terms); |
115 |
CdmStore.getTermManager().clearTermMapForTermType(this.aPage.type); |
|
111 | 116 |
PreferencesUtil.firePreferencesChanged(this.getClass()); |
112 | 117 |
return true; |
113 | 118 |
} |
Also available in: Unified diff
ref #7854: fix exceptions in distribution editor when saving new created descriptions