merge from trunk
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / TaxonEditorInput.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9
10 package eu.etaxonomy.taxeditor.editor;
11
12 import java.util.Arrays;
13 import java.util.HashSet;
14 import java.util.List;
15 import java.util.Set;
16 import java.util.UUID;
17
18 import org.eclipse.jface.resource.ImageDescriptor;
19 import org.eclipse.ui.IEditorInput;
20 import org.eclipse.ui.IMemento;
21 import org.eclipse.ui.IPersistableElement;
22
23 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
24 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
25 import eu.etaxonomy.cdm.api.service.IClassificationService;
26 import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
27 import eu.etaxonomy.cdm.api.service.ITaxonService;
28 import eu.etaxonomy.cdm.model.common.CdmBase;
29 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
30 import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
31 import eu.etaxonomy.cdm.model.taxon.Synonym;
32 import eu.etaxonomy.cdm.model.taxon.Taxon;
33 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
34 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
35 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
36 import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
37 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
38 import eu.etaxonomy.taxeditor.model.DataChangeBridge;
39 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
40 import eu.etaxonomy.taxeditor.store.CdmStore;
41
42
43 /**
44 * <p>TaxonEditorInput class.</p>
45 *
46 * @author n.hoffmann
47 * @created 19.03.2009
48 * @version 1.0
49 */
50 public class TaxonEditorInput implements IEditorInput, IConversationEnabled, IPersistableElement {
51
52 private ConversationHolder conversation;
53
54 private TaxonNode taxonNode;
55
56 private TaxonEditorInputDataChangeBehaviour dataChangeBehavior;
57
58 private TaxonBase initiallySelectedTaxonBase;
59
60 private TaxonEditorInput(TaxonNode taxonNode, ConversationHolder conversation){
61 this.conversation = conversation;
62 this.taxonNode = taxonNode;
63 }
64
65
66
67 /**
68 * <p>NewInstance</p>
69 *
70 * @param taxonNodeUuid a {@link java.util.UUID} object.
71 * @return a {@link eu.etaxonomy.taxeditor.editor.TaxonEditorInput} object.
72 * @throws java.lang.Exception if any.
73 */
74 public static TaxonEditorInput NewInstance(UUID taxonNodeUuid) throws Exception{
75 try{
76 ConversationHolder conversation = CdmStore.createConversation();
77 return NewInstance(taxonNodeUuid, conversation);
78 }catch(Exception e){
79 throw e;
80 }
81 }
82
83 /**
84 *
85 * @param taxonNodeUuid
86 * @param conversation
87 * @return
88 */
89 private static TaxonEditorInput NewInstance(UUID taxonNodeUuid, ConversationHolder conversation){
90
91
92 TaxonNode taxonNode = CdmStore.getService(ITaxonNodeService.class).load(taxonNodeUuid, null);
93
94 if(taxonNode == null){
95 EditorUtil.warningDialog("Not yet implemented", TaxonEditorInput.class, "Selected element is not type TaxonBase.");
96 return null;
97 }
98
99 return new TaxonEditorInput(taxonNode, conversation);
100 }
101
102 /**
103 * <p>NewInstanceFromTaxonBase</p>
104 *
105 * @param taxonBaseUuid a {@link java.util.UUID} object.
106 * @return a {@link eu.etaxonomy.taxeditor.editor.TaxonEditorInput} object.
107 */
108 public static TaxonEditorInput NewInstanceFromTaxonBase(UUID taxonBaseUuid){
109 ConversationHolder conversation = CdmStore.createConversation();
110
111 TaxonEditorInput input = null;
112
113 TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid);
114 if(taxonBase.isOrphaned()) {
115 EditorUtil.warningDialog("Orphaned Taxon", TaxonEditorInput.class, "This is an orphaned taxon i.e. a taxon that is not connected to a classification and not having any taxonomic relationships. Editing of orphaned taxon is currently not supported.");
116 }
117 else if(taxonBase.isInstanceOf(Taxon.class)){
118 Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class);
119
120 if (taxon.isMisapplication()){
121 // TODO get accepted taxon
122 EditorUtil.info("trying to open Mispplied Name ");
123
124 Set<Taxon> acceptedTaxa = new HashSet<Taxon>();
125 Set<TaxonRelationship> relations = taxon.getRelationsFromThisTaxon();
126 for(TaxonRelationship relation : relations){
127 if(relation.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){
128 acceptedTaxa.add(relation.getToTaxon());
129 }
130 }
131 input = getInputForMultipleTaxa(conversation, acceptedTaxa);
132
133 }else{
134 input = getInputForMultipleNodes(conversation, taxon.getTaxonNodes());
135 }
136 }else if(taxonBase instanceof Synonym){
137 Synonym synonym = (Synonym) taxonBase;
138
139 Set<Taxon> taxa = synonym.getAcceptedTaxa();
140 input = getInputForMultipleTaxa(conversation, taxa);
141 }
142
143 input.setInitiallySelectedTaxonBase(taxonBase);
144
145 return input;
146 }
147
148 private static TaxonEditorInput getInputForMultipleNodes(ConversationHolder conversation, Set<TaxonNode> taxonNodes){
149 if(taxonNodes.size() == 1){
150 TaxonNode taxonNode = taxonNodes.iterator().next();
151 return NewInstance(taxonNode.getUuid(), conversation);
152 }else if(taxonNodes.size() > 1){
153 TaxonNode taxonNode = ChooseFromMultipleTaxonNodesDialog.choose(taxonNodes);
154 if(taxonNode != null){
155 return NewInstance(taxonNode.getUuid(), conversation);
156 }
157 }else if(taxonNodes.size() == 0){
158 // this is an undesired state
159 EditorUtil.warningDialog("Incorrect state", TaxonEditorInput.class, "The accepted taxon is not part of any classification. This should not have happened.");
160 }
161 return null;
162 }
163
164 private static TaxonEditorInput getInputForMultipleTaxa(ConversationHolder conversation, Set<Taxon> taxa){
165 if(taxa.size() == 1){
166 Taxon taxon = taxa.iterator().next();
167 Set<TaxonNode> nodes = taxon.getTaxonNodes();
168 return getInputForMultipleNodes(conversation, nodes);
169 }else if(taxa.size() > 1){
170 Set<TaxonNode> taxonNodes = new HashSet<TaxonNode>();
171 for ( Taxon taxon : taxa ){
172 taxonNodes.addAll(taxon.getTaxonNodes());
173 }
174 return getInputForMultipleNodes(conversation, taxonNodes);
175 }else if(taxa.size() == 0){
176 // this is an undesired state
177 EditorUtil.warningDialog("Incorrect state", TaxonEditorInput.class, "Trying to open accepted taxon for a synonym or misapplication but" +
178 " no accepted taxa are present. This should not have happened.");
179 }
180 return null;
181 }
182
183 /**
184 * <p>NewEmptyInstance</p>
185 *
186 * @param parentNodeUuid a {@link java.util.UUID} object.
187 * @return a {@link eu.etaxonomy.taxeditor.editor.TaxonEditorInput} object.
188 */
189 public static TaxonEditorInput NewEmptyInstance(UUID parentNodeUuid){
190 ConversationHolder conversation = CdmStore.createConversation();
191
192 TaxonNameBase<?, ?> name = PreferencesUtil.getPreferredNomenclaturalCode().getNewTaxonNameInstance(null);
193 ITaxonTreeNode parentNode = CdmStore.getService(IClassificationService.class).getTreeNodeByUuid(parentNodeUuid);
194
195 Taxon newTaxon = Taxon.NewInstance(name, parentNode.getReference());
196 TaxonNode newTaxonNode = parentNode.addChildTaxon(newTaxon, parentNode.getReference(), parentNode.getMicroReference());
197
198 // add the new taxon to the editors persistence context
199 UUID newTaxonNodeUuid = CdmStore.getService(ITaxonNodeService.class).save(newTaxonNode);
200
201 return new TaxonEditorInput(newTaxonNode, conversation);
202 }
203
204 /* (non-Javadoc)
205 * @see org.eclipse.ui.IEditorInput#exists()
206 */
207 /**
208 * <p>exists</p>
209 *
210 * @return a boolean.
211 */
212 @Override
213 public boolean exists() {
214 return taxonNode != null;
215 }
216
217 /* (non-Javadoc)
218 * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
219 */
220 /**
221 * <p>getImageDescriptor</p>
222 *
223 * @return a {@link org.eclipse.jface.resource.ImageDescriptor} object.
224 */
225 @Override
226 public ImageDescriptor getImageDescriptor() {
227 return null;
228 }
229
230 /* (non-Javadoc)
231 * @see org.eclipse.ui.IEditorInput#getName()
232 */
233 /**
234 * <p>getName</p>
235 *
236 * @return a {@link java.lang.String} object.
237 */
238 @Override
239 public String getName() {
240 if(getTaxon() == null){
241 return null;
242 }
243 TaxonNameBase<?, ?> name = getTaxon().getName();
244 if (name == null || name.getTitleCache() == null) {
245 return "New taxon";
246 } else {
247 return name.getTitleCache();
248 }
249 }
250
251 /* (non-Javadoc)
252 * @see org.eclipse.ui.IEditorInput#getPersistable()
253 */
254 /**
255 * <p>getPersistable</p>
256 *
257 * @return a {@link org.eclipse.ui.IPersistableElement} object.
258 */
259 @Override
260 public IPersistableElement getPersistable() {
261 // if(CdmStore.isActive()){
262 // TaxonNode test = CdmStore.getTaxonTreeService().getTaxonNodeByUuid(taxonNode.getUuid());
263 // boolean isPersistable = CdmStore.getTaxonTreeService().getTaxonNodeByUuid(taxonNode.getUuid()) != null;
264 // if (isPersistable) {
265 // return this;
266 // }
267 // }
268 return null;
269 }
270
271 /* (non-Javadoc)
272 * @see org.eclipse.ui.IEditorInput#getToolTipText()
273 */
274 /**
275 * <p>getToolTipText</p>
276 *
277 * @return a {@link java.lang.String} object.
278 */
279 @Override
280 public String getToolTipText() {
281 return getName();
282 }
283
284 /* (non-Javadoc)
285 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
286 */
287 /** {@inheritDoc} */
288 @Override
289 public Object getAdapter(Class adapter) {
290
291 if (adapter == Taxon.class) {
292 return taxonNode.getTaxon();
293 }
294
295 if (adapter == TaxonNode.class) {
296 return taxonNode;
297 }
298
299 return null;
300 }
301
302 /**
303 * {@inheritDoc}
304 *
305 * Overrides equals to ensure that a taxon can only be edited by
306 * one editor at a time.
307 */
308 @Override
309 public boolean equals(Object obj) {
310 if (TaxonEditorInput.class.equals(obj.getClass())
311 && getTaxon() != null
312 && getTaxon().equals(((TaxonEditorInput) obj).getTaxon())){
313 if(((TaxonEditorInput) obj).getInitiallySelectedTaxonBase() != null){
314 setInitiallySelectedTaxonBase(((TaxonEditorInput) obj).getInitiallySelectedTaxonBase());
315 }
316 return true;
317 }
318 return false;
319 }
320
321 /**
322 * <p>getTaxon</p>
323 *
324 * @return the taxon
325 */
326 public Taxon getTaxon(){
327
328 List<String> TAXON_INIT_STRATEGY = Arrays.asList(new String []{
329 // CdmBase : toOne-> "created, createdBy, uuid"
330 // VersionableEntity : toOne-> "updated, updatedBy"
331 // AnnotatableEntity : toMany-> "annotations, markers"
332 // IdentifiableEntity : toMany-> "credits, extensions, rights, sources"
333 // : toOne-> "lsid"
334 // TaxonBase : toOne-> "homotypicgroup, name, sec"
335 // Taxon : toMany-> "descriptions, heterotypicSynonymyGroups, homotypicSynonymsByHomotypicGroup, homotypicSynonymsByHomotypicRelationship, homotypicSynonymyGroups, misappliedNames, relationsFromThisTaxon, relationsToThisTaxon, synonymNames, synonymRelations, synonyms, synonymsSortedByType, taxonNodes, taxonRelations"
336 // : toOne-> "imageGallery"
337 "*",
338
339 // CdmBase : toOne-> "created, createdBy, uuid"
340 // VersionableEntity : toOne-> "updated, updatedBy"
341 // AnnotatableEntity : toMany-> "" (available: "annotations, markers")
342 // LanguageStringBase : toOne-> "language"
343 // Annotation : toOne-> "annotatedObj, annotationType, commentator, linkbackUrl
344 "annotations.$",
345
346 // CdmBase : toOne-> "created, createdBy, uuid"
347 // VersionableEntity : toOne-> "updated, updatedBy"
348 // Marker : toOne-> "markedObj, markerType"
349 "markers.$",
350 "markers.markerType.$",
351
352 // CdmBase : toOne-> "created, createdBy, uuid"
353 // AnnotatableEntity : toMany-> "" (available: "annotations, markers")
354 // LanguageStringBase : toOne-> "language"
355 // Annotation : toOne-> "annotatedObj, annotationType, commentator, linkbackUrl
356 // Credit : toOne-> "agent"
357 "credits.$",
358
359 // CdmBase : toOne-> "created, createdBy, uuid"
360 // VersionableEntity : toOne-> "updated, updatedBy"
361 // Extension : toOne-> "extendedObj, type"
362 "extensions.$",
363 "extensions.type.$",
364
365 // CdmBase : toOne-> "created, createdBy, uuid"
366 // VersionableEntity : toOne-> "updated, updatedBy"
367 // AnnotatableEntity : toMany-> "" (available: "annotations, markers")
368 // LanguageStringBase : toOne-> "language"
369 // Rights : toOne-> "agent, type, uri"
370 "rights.$",
371
372 // CdmBase : toOne-> "created, createdBy, uuid"
373 // VersionableEntity : toOne-> "updated, updatedBy"
374 // AnnotatableEntity : toMany-> "" (available: "annotations, markers")
375 // ReferencedEntityBase : toOne-> "citation"
376 // OriginalSourceBase :
377 // IdentifiableSource : toOne-> "sourcedObj"
378 "sources.$",
379
380 // CdmBase : toOne-> "created, createdBy, uuid"
381 // AnnotatableEntity : toMany-> "" (available: "annotations, markers")
382 // HomotypicalGroup : toMany-> "" (available: "basionymAndReplacedSynonymRelations, basionyms, basionymsOrReplacedSynonyms, nameTypeDesignations, newCombinations, replacedSynonym, specimenTypeDesignations, synonymsInGroup, typeDesignations, typifiedNames, unrelatedNames" )
383 "homotypicGroup.$",
384
385 // CdmBase : toOne-> "created, createdBy, uuid"
386 // AnnotatableEntity : toMany-> "" (available: "annotations, markers")
387 // TaxonNameBase : toMany-> "" (available: "basionyms, descriptions, nameRelations, nameTypeDesignations, relationsFromThisName, relationsToThisName, specimenTypeDesignations, specimenTypeDesignationsOfHomotypicalGroup, status, synonyms, taggedName, taxa, taxonBases, typeDesignations" )
388 // : toOne-> "basionym, citation, homotypicalGroup, nomenclaturalCode, nomenclaturalReference, rank"
389 // ViralName
390 // NonViralName : toMany->"" (available: "childRelationships, hybridChildRelations, hybridParentRelations, orderedChildRelationships, parentRelationships")
391 // : toOne-> "basionymAuthorTeam, combinationAuthorTeam, exBasionymAuthorTeam, exCombinationAuthorTeam"
392 "name.$",
393
394 // CdmBase : toOne-> "created, createdBy, uuid"
395 // VersionableEntity : toOne-> "updated, updatedBy"
396 // AnnotatableEntity : toMany-> "annotations, markers"
397 // IdentifiableEntity : toMany-> "credits, extensions, rights, sources"
398 // : toOne-> "lsid"
399 // IdentifiableMediaEntity : toMany->"" (available: "media")
400 // Reference : toOne->"authorTeam, datePublished, inBook, inJournal, inProceedings, inReference, inSeries, institution, school, type, uri"
401 "sec.$",
402
403 // CdmBase : toOne-> "created, createdBy, uuid"
404 // AnnotatableEntity : toMany-> "annotations, markers"
405 // IdentifiableEntity : toMany-> "credits, extensions, rights, sources"
406 // : toOne-> "lsid"
407 // DescriptionBase : toMany->"" (available: "describedSpecimenOrObservations, descriptiveSystem, elements, workingSets" )
408 // TaxonDescription : toMany->"" (available: "geoScopes, scopes" )
409 // : toOne-> "taxon"
410 "descriptions.$",
411
412
413 // CdmBase : toOne-> "created, createdBy, uuid"
414 // VersionableEntity : toOne-> "updated, updatedBy"
415 // AnnotatableEntity : toMany-> "annotations, markers"
416 // ReferencedEntityBase : toOne-> "citation"
417 // RelationshipBase :
418 // TaxonRelationship : toOne->"fromTaxon, relatedFrom, relatedTo, toTaxon, type"
419 "relationsFromThisTaxon.$",
420
421 // CdmBase : toOne-> "created, createdBy, uuid"
422 // VersionableEntity : toOne-> "updated, updatedBy"
423 // AnnotatableEntity : toMany-> "annotations, markers"
424 // ReferencedEntityBase : toOne-> "citation"
425 // RelationshipBase :
426 // TaxonRelationship : toOne->"fromTaxon, relatedFrom, relatedTo, toTaxon, type"
427 "relationsToThisTaxon.$",
428
429 // CdmBase : toOne-> "created, createdBy, uuid"
430 // VersionableEntity : toOne-> "updated, updatedBy"
431 // AnnotatableEntity : toMany-> "annotations, markers"
432 // ReferencedEntityBase : toOne-> "citation"
433 // RelationshipBase :
434 // SynonymRelationship : toOne->"acceptedTaxon, relatedFrom, relatedTo, synonym, type"
435 "synonymRelations.$",
436
437 // CdmBase : toOne-> "created, createdBy, uuid"
438 // VersionableEntity : toOne-> "updated, updatedBy"
439 // AnnotatableEntity : toMany-> "annotations, markers"
440 // IdentifiableEntity : toMany-> "credits, extensions, rights, sources"
441 // : toOne-> "lsid"
442 // TaxonBase : toOne-> "homotypicgroup, name, sec"
443 // Synonym : toMany-> "" (available: "acceptedTaxa, relationType, synonymRelations" )
444 "synonyms.$",
445
446
447 "misappliedNames.$",
448 "misappliedNames.name.extensions.type.$",
449 "misappliedNames.name.status.$",
450 "misappliedNames.name.status.type.$",
451 "misappliedNames.name.descriptions.elements.$",
452 "misappliedNames.name.typeDesignations.$",
453 "misappliedNames.name.typeDesignations.typeStatus.$",
454
455 // "relationsFromThisTaxon.fromTaxon.$",
456 // "relationsFromThisTaxon.fromTaxon.name.status.$",
457 // "relationsFromThisTaxon.fromTaxon.name.status.type.$",
458 // "relationsFromThisTaxon.fromTaxon.name.descriptions.elements.$",
459 // "relationsFromThisTaxon.fromTaxon.name.typeDesignations.typeStatus.$",
460 // "relationsFromThisTaxon.toTaxon.$",
461 //// "relationsFromThisTaxon.toTaxon.name.extensions.type.$",
462 // "relationsFromThisTaxon.toTaxon.name.status.$",
463 // "relationsFromThisTaxon.toTaxon.name.status.type.$",
464 // "relationsFromThisTaxon.toTaxon.name.descriptions.elements.$",
465 // "relationsFromThisTaxon.toTaxon.name.typeDesignations.typeStatus.$",
466
467 // "relationsToThisTaxon.fromTaxon.$",
468 // "relationsToThisTaxon.fromTaxon.name.extensions.type.$",
469 // "relationsToThisTaxon.fromTaxon.name.status.type.$",
470 // "relationsToThisTaxon.fromTaxon.name.descriptions.elements.$",
471 // "relationsToThisTaxon.fromTaxon.name.typeDesignations.typeStatus.$",
472 // "relationsToThisTaxon.toTaxon.$",
473 // "relationsToThisTaxon.toTaxon.name.status.type.$",
474 // "relationsToThisTaxon.toTaxon.name.descriptions.elements.$",
475 // "relationsToThisTaxon.toTaxon.name.typeDesignations.typeStatus.$",
476
477 // TaxonNameEditor.createOrUpdateNameComposites()
478 // ContainerFactory.createOrUpdateAcceptedTaxonsHomotypicGroup()
479 "name.homotypicalGroup.typifiedNames.$",
480 "name.homotypicalGroup.synonymsInGroup",
481 "name.synonymRelations",
482 "name.descriptions.elements.$",
483
484 // "name.descriptions.scopes.$",
485 // "name.descriptions.scopes.terms.$",
486 "name.descriptions.geoscopes.$",
487 "name.descriptions.geoscopes.vocabulary.$",
488 "name.descriptions.geoscopes.vocabulary.terms.$",
489
490 // ContainerFactory.createOrUpdateAcceptedTaxonsHomotypicGroup()
491 "name.homotypicalGroup.$",
492 "name.homotypicalGroup.typifiedNames:$",
493
494 "synonymRelations.synonym.name.$",
495 "synonymRelations.synonym.name.descriptions.elements.$",
496 "synonymRelations.synonym.name.homotypicalGroup.$",
497 "synonymRelations.synonym.name.homotypicalGroup.typifiedNames.$",
498 "synonymRelations.synonym.name.status.$",
499
500 "synonymRelations.synonym.name.typeDesignations.$",
501 "synonymRelations.synonym.name.typeDesignations.typifiedNames.$",
502 "synonymRelations.synonym.name.typeDesignations.typeStatus.$",
503 "synonymRelations.synonym.name.typeDesignations.typeName.$",
504 "synonymRelations.synonym.name.typeDesignations.typeSpecimen.$",
505
506
507 // CdmBase : toOne-> "created, createdBy, uuid"
508 // VersionableEntity : toOne-> "updated, updatedBy"
509 // AnnotatableEntity : toMany-> "annotations, markers"
510 // DescriptionElementBase : toMany->"" (available: "media, modifiers, modifyingText, sources" )
511 // : toOne-> "feature, inDescription"
512 // CategoricalData : toMany->"" (available: "states" )
513 // CommonTaxaName : toOne->"area, language"
514 // Distribution : toOne->"area, status"
515 // IndividualsAssociation : toMany->"" (available: "description" )
516 // : toOne-> "associatedSpecimenOrObserviation"
517 // QuantitativeData : toMany->"" (available: "statisticalValues" )
518 // : toOne-> "unit"
519 // TaxonInteraction : toMany->"" (available: "descriptions" )
520 // : toOne-> "taxon2"
521 // TextData : toMany->"" (available: "multilanguageText" )
522 // : toOne-> "format, languageText, preferredLanguageString"
523 "descriptions.elements.$",
524
525 "descriptions.elements.annotations.$",
526 "descriptions.elements.markers.markerType.$",
527
528 "descriptions.elements.modifiers.$",
529 "descriptions.elements.modifyingText.$",
530
531 "descriptions.elements.description.$",
532
533 "descriptions.elements.associatedSpecimenOrObservation.$",
534 "descriptions.elements.associatedSpecimenOrObservation.annotations.$",
535 "descriptions.elements.associatedSpecimenOrObservation.annotations.annotationType.$",
536 "descriptions.elements.associatedSpecimenOrObservation.markers.markerType.$",
537 "descriptions.elements.associatedSpecimenOrObservation.credits.$",
538 "descriptions.elements.associatedSpecimenOrObservation.extensions.type.$",
539 "descriptions.elements.associatedSpecimenOrObservation.rights.$",
540 "descriptions.elements.associatedSpecimenOrObservation.sources.$",
541 "descriptions.elements.associatedSpecimenOrObservation.media.$",
542 "descriptions.elements.associatedSpecimenOrObservation.media.representations.parts.$",
543
544 "descriptions.elements.descriptions.$",
545
546 "descriptions.elements.multilanguageText.$",
547
548 // CdmBase : toOne-> "created, createdBy, uuid"
549 // VersionableEntity : toOne-> "updated, updatedBy"
550 // AnnotatableEntity : toMany-> "annotations, markers"
551 // IdentifiableEntity : toMany-> "credits, extensions, rights, sources"
552 // : toOne-> "lsid"
553 // Media : toMany->"allDescriptions, allTitles, representations"
554 // : toOne-> "artist, description, mediaCreated, title"
555 "descriptions.elements.media.$",
556 // "descriptions.elements.media.allDescriptions.$",
557 // CdmBase : toOne-> "created, createdBy, uuid"
558 // VersionableEntity : toOne-> "updated, updatedBy"
559 // MediaRepresentation : toMany-> "parts"
560 // : toOne-> "media"
561 // MediaRepresentationPart : toOne-> "mediaRepresentation, size, uri"
562 "descriptions.elements.media.representations.parts.$",
563
564 "descriptions.elements.media.annotations.$",
565 "descriptions.elements.media.annotations.annotationType.$",
566 "descriptions.elements.media.credits.$",
567 "descriptions.elements.media.extensions.$",
568 "descriptions.elements.media.extensions.type.$",
569 "descriptions.elements.media.markers.$",
570 "descriptions.elements.media.markers.marker.Type.$",
571 "descriptions.elements.media.rights.$",
572 "descriptions.elements.media.sources.$",
573
574 "descriptions.elements.states.$",
575 "descriptions.elements.statisticalValues.$",
576
577
578 // DescriptiveContentProvider.getContainerTreeForDesription()
579 // FeatureNodeContainerTree.getDescriptionsElementsForFeature()
580 // DescriptionHelper.getElementText()
581
582 // CdmBase : toOne-> "created, createdBy, uuid"
583 // VersionableEntity : toOne-> "updated, updatedBy"
584 // AnnotatableEntity : toMany-> "annotations, markers"
585 // ReferencedEntityBase : toOne-> "citation"
586 // DescriptionElementSource : toOne-> "nameUsedInSource, sourcedObj"
587 "descriptions.elements.sources.$",
588
589 // NamedArea.labelWithLevel()
590
591 // CdmBase : toOne-> "created, createdBy, uuid"
592 // VersionableEntity : toOne-> "updated, updatedBy"
593 // AnnotatableEntity : toMany-> "annotations, markers"
594 // ReferencedEntityBase : toOne-> "citation"
595 // NamedArea : toMany->"" (available: "allLevelList, generalizationOf, includes, waterbodiesOrCountries" )
596 // : toOne-> "hierarchieList, kindOf, level, partOf, pointApproximation, shape, type, validPeriod"
597 "descriptions.elements.area.$",
598 "descriptions.elements.area.allLevelList.$",
599 "descriptions.elements.area.allLevelList.vocabulary.$",
600 "descriptions.elements.area.allLevelList.vocabulary.terms.$",
601 "descriptions.elements.area.vocabulary.$",
602 "descriptions.elements.area.vocabulary.terms.$",
603 "descriptions.elements.vocabulary.$",
604 "descriptions.elements.vocabulary.terms.$",
605
606
607 // "descriptions.scopes.$",
608 // "descriptions.scopes.terms.$",
609 // "descriptions.geoscopes.$",
610 // "descriptions.geoscopes.vocabulary.$",
611 // "descriptions.geoscopes.vocabulary.terms.$",
612
613 // NameRelationshipDetailSection.createElementComposite()
614 // NameRelationshipDetailElement.setEntity()
615 "name.nameRelations.$",
616
617
618 "name.extensions.$",
619 "name.extensions.type.$",
620
621 "name.basionymAuthorTeam.$",
622 "name.basionymAuthorTeam.annotations.$",
623 "name.basionymAuthorTeam.annotations.annotationType.$",
624 "name.basionymAuthorTeam.markers.markerType.$",
625 "name.basionymAuthorTeam.credits.$",
626 "name.basionymAuthorTeam.extensions.type.$",
627 "name.basionymAuthorTeam.rights.$",
628 "name.basionymAuthorTeam.sources.$",
629 "name.basionymAuthorTeam.media.$",
630 "name.basionymAuthorTeam.media.representations.parts.$",
631 "name.basionymAuthorTeam.teamMembers.$",
632 "name.basionymAuthorTeam.teamMembers.annotations.$",
633 "name.basionymAuthorTeam.teamMembers.annotations.annotationType.$",
634 "name.basionymAuthorTeam.teamMembers.markers.markerType.$",
635 "name.basionymAuthorTeam.teamMembers.credits.$",
636 "name.basionymAuthorTeam.teamMembers.extensions.type.$",
637 "name.basionymAuthorTeam.teamMembers.rights.$",
638 "name.basionymAuthorTeam.teamMembers.sources.$",
639 "name.basionymAuthorTeam.teamMembers.media.$",
640 "name.basionymAuthorTeam.teamMembers.media.representations.parts.$",
641
642 "name.combinationAuthorTeam.$",
643 "name.combinationAuthorTeam.annotations.$",
644 "name.combinationAuthorTeam.annotations.annotationType.$",
645 "name.combinationAuthorTeam.markers.markerType.$",
646 "name.combinationAuthorTeam.credits.$",
647 "name.combinationAuthorTeam.extensions.type.$",
648 "name.combinationAuthorTeam.rights.$",
649 "name.combinationAuthorTeam.sources.$",
650 "name.combinationAuthorTeam.media.$",
651 "name.combinationAuthorTeam.media.representations.parts.$",
652 "name.combinationAuthorTeam.teamMembers.$",
653 "name.combinationAuthorTeam.teamMembers.annotations.$",
654 "name.combinationAuthorTeam.teamMembers.annotations.annotationType.$",
655 "name.combinationAuthorTeam.teamMembers.markers.markerType.$",
656 "name.combinationAuthorTeam.teamMembers.credits.$",
657 "name.combinationAuthorTeam.teamMembers.extensions.type.$",
658 "name.combinationAuthorTeam.teamMembers.rights.$",
659 "name.combinationAuthorTeam.teamMembers.sources.$",
660 "name.combinationAuthorTeam.teamMembers.media.$",
661 "name.combinationAuthorTeam.teamMembers.media.representations.parts.$",
662
663 "name.exBasionymAuthorTeam.$",
664 "name.exBasionymAuthorTeam.annotations.$",
665 "name.exBasionymAuthorTeam.annotations.annotationType.$",
666 "name.exBasionymAuthorTeam.markers.markerType.$",
667 "name.exBasionymAuthorTeam.credits.$",
668 "name.exBasionymAuthorTeam.extensions.type.$",
669 "name.exBasionymAuthorTeam.rights.$",
670 "name.exBasionymAuthorTeam.sources.$",
671 "name.exBasionymAuthorTeam.media.$",
672 "name.exBasionymAuthorTeam.media.representations.parts.$",
673 "name.exBasionymAuthorTeam.teamMembers.$",
674 "name.exBasionymAuthorTeam.teamMembers.annotations.$",
675 "name.exBasionymAuthorTeam.teamMembers.annotations.annotationType.$",
676 "name.exBasionymAuthorTeam.teamMembers.markers.markerType.$",
677 "name.exBasionymAuthorTeam.teamMembers.credits.$",
678 "name.exBasionymAuthorTeam.teamMembers.extensions.type.$",
679 "name.exBasionymAuthorTeam.teamMembers.rights.$",
680 "name.exBasionymAuthorTeam.teamMembers.sources.$",
681 "name.exBasionymAuthorTeam.teamMembers.media.$",
682 "name.exBasionymAuthorTeam.teamMembers.media.representations.parts.$",
683
684 "name.exCombinationAuthorTeam.$",
685 "name.exCombinationAuthorTeam.annotations.$",
686 "name.exCombinationAuthorTeam.annotations.annotationType.$",
687 "name.exCombinationAuthorTeam.markers.markerType.$",
688 "name.exCombinationAuthorTeam.credits.$",
689 "name.exCombinationAuthorTeam.extensions.type.$",
690 "name.exCombinationAuthorTeam.rights.$",
691 "name.exCombinationAuthorTeam.sources.$",
692 "name.exCombinationAuthorTeam.media.$",
693 "name.exCombinationAuthorTeam.media.representations.parts.$",
694 "name.exCombinationAuthorTeam.teamMembers.$",
695 "name.exCombinationAuthorTeam.teamMembers.annotations.$",
696 "name.exCombinationAuthorTeam.teamMembers.annotations.annotationType.$",
697 "name.exCombinationAuthorTeam.teamMembers.markers.markerType.$",
698 "name.exCombinationAuthorTeam.teamMembers.credits.$",
699 "name.exCombinationAuthorTeam.teamMembers.extensions.type.$",
700 "name.exCombinationAuthorTeam.teamMembers.rights.$",
701 "name.exCombinationAuthorTeam.teamMembers.sources.$",
702 "name.exCombinationAuthorTeam.teamMembers.media.$",
703 "name.exCombinationAuthorTeam.teamMembers.media.representations.parts.$",
704
705 "name.nomenclaturalReference.annotations.$",
706 "name.nomenclaturalReference.annotations.annotationType.$",
707 "name.nomenclaturalReference.authorTeam.$",
708 "name.nomenclaturalReference.authorTeam.media.$",
709 "name.nomenclaturalReference.authorTeam.media.representations.parts.$",
710 "name.nomenclaturalReference.markers.markerType.$",
711 "name.nomenclaturalReference.credits.$",
712 "name.nomenclaturalReference.extensions.type.$",
713 "name.nomenclaturalReference.rights.$",
714 "name.nomenclaturalReference.rights.type.$",
715 "name.nomenclaturalReference.sources.$",
716 "name.nomenclaturalReference.media.$",
717 "name.nomenclaturalReference.media.representations.parts.$",
718 "name.nomenclaturalReference.inReference.$",
719 "name.nomenclaturalReference.inReference.annotations.$",
720 "name.nomenclaturalReference.inReference.annotations.annotationType.$",
721 "name.nomenclaturalReference.inReference.markers.markerType.$",
722
723 "name.nomenclaturalReference.inReference.credits.$",
724 "name.nomenclaturalReference.inReference.extensions.type.$",
725 "name.nomenclaturalReference.inReference.rights.$",
726 "name.nomenclaturalReference.inReference.rights.type.$",
727 "name.nomenclaturalReference.inReference.sources.$",
728 "name.nomenclaturalReference.inReference.media.$",
729 "name.nomenclaturalReference.inReference.media.representations.parts.$",
730
731 "name.status.$",
732 "name.status.annotations.$",
733 "name.status.annotations.annotationType.$",
734 "name.status.markers.markerType.$",
735 "name.status.type.$",
736
737 "name.typeDesignations.$",
738 "name.typeDesignations.typifiedNames.$",
739 "name.typeDesignations.typeStatus.$",
740 "name.typeDesignations.typeName.$",
741 "name.typeDesignations.typeSpecimen.$",
742
743 });
744
745 return (Taxon) CdmStore.getService(ITaxonService.class).load(taxonNode.getTaxon().getUuid(), TAXON_INIT_STRATEGY);
746
747 }
748
749 /**
750 * <p>Getter for the field <code>taxonNode</code>.</p>
751 *
752 * @return the taxonNode
753 */
754 public TaxonNode getTaxonNode() {
755 return taxonNode;
756 }
757
758 /*
759 * (non-Javadoc)
760 * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
761 */
762 /**
763 * <p>getConversationHolder</p>
764 *
765 * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
766 */
767 @Override
768 public ConversationHolder getConversationHolder() {
769 return conversation;
770 }
771
772 /*
773 * (non-Javadoc)
774 * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostCrudObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmCrudEvent)
775 */
776 /** {@inheritDoc} */
777 @Override
778 public void update(CdmDataChangeMap events) {
779 if(dataChangeBehavior == null){
780 dataChangeBehavior = new TaxonEditorInputDataChangeBehaviour(this);
781 }
782
783 DataChangeBridge.handleDataChange(events, dataChangeBehavior);
784 }
785
786 /* (non-Javadoc)
787 * @see org.eclipse.ui.IPersistableElement#getFactoryId()
788 */
789 /**
790 * <p>getFactoryId</p>
791 *
792 * @return a {@link java.lang.String} object.
793 */
794 @Override
795 public String getFactoryId() {
796 return TaxonEditorInputFactory.getFactoryId();
797 }
798
799 /* (non-Javadoc)
800 * @see org.eclipse.ui.IPersistable#saveState(org.eclipse.ui.IMemento)
801 */
802 /** {@inheritDoc} */
803 @Override
804 public void saveState(IMemento memento) {
805 TaxonEditorInputFactory.saveState(memento, this);
806 }
807
808
809 /**
810 * <p>Setter for the field <code>initiallySelectedTaxonBase</code>.</p>
811 *
812 * @param taxonBase a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.
813 */
814 public void setInitiallySelectedTaxonBase(TaxonBase taxonBase) {
815 this.initiallySelectedTaxonBase = taxonBase;
816 }
817
818 /**
819 * <p>Getter for the field <code>initiallySelectedTaxonBase</code>.</p>
820 *
821 * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.
822 */
823 public TaxonBase getInitiallySelectedTaxonBase() {
824 return initiallySelectedTaxonBase;
825 }
826
827 @Override
828 public String toString() {
829 return String.format("%s[%s]", this.getClass().getSimpleName(), getTaxon());
830 }
831 }