Features lists now sorted alphabetically. Added microreference, cache strings to...
[taxeditor.git] / eclipseprojects / eu.etaxonomy.taxeditor / src / eu / etaxonomy / taxeditor / model / ICdmSessionDataRepository.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.model;
11
12 import java.util.Collection;
13 import java.util.List;
14 import java.util.Set;
15 import java.util.SortedSet;
16
17 import org.eclipse.core.databinding.observable.set.IObservableSet;
18
19 import eu.etaxonomy.cdm.api.application.CdmApplicationController;
20 import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary;
21 import eu.etaxonomy.cdm.model.common.TermVocabulary;
22 import eu.etaxonomy.cdm.model.description.Feature;
23 import eu.etaxonomy.cdm.model.name.NameRelationshipType;
24 import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
25 import eu.etaxonomy.cdm.model.name.Rank;
26 import eu.etaxonomy.cdm.model.name.TypeDesignationStatus;
27 import eu.etaxonomy.cdm.model.reference.ReferenceBase;
28 import eu.etaxonomy.cdm.model.taxon.Taxon;
29 import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
30
31 /**
32 * All session data - taxa, term vocabularies, etc. - are stored in a
33 * session data repository. Any CDM data that is stored locally during execution
34 * should be kept here while the Editor is running. This makes it convenient
35 * to clear all data in case everything needs to be reloaded, for example, when
36 * the data source is changed.
37 * <p>
38 * The repository uses a CDM application controller to retrieve data.
39 * <p>
40 * Any method starting with "add" or "remove" deals with data solely in the session.
41 * For instance, <code>addTaxon(taxon)</code> will cause a new <code>taxon</code>
42 * to appear in the taxonomic tree, but will not save it to the CDM data source.
43 * <p>
44 * Any method starting with "save" or "delete" will call its corresponding "add"/"remove"
45 * method, and commit the change to the CDM data source.
46 *
47 * @author p.ciardelli
48 * @created 16.12.2008
49 * @version 1.0
50 */
51 public interface ICdmSessionDataRepository {
52
53 /**
54 * Returns the root taxa associated with the current data source, and
55 * adds them to session data if not already there.
56 *
57 * @return
58 */
59 public Set<Taxon> getRootTaxa();
60
61 /**
62 * Returns all of a taxon's children, and adds them to session data
63 * if not already there.
64 *
65 * @param parentTaxon
66 * @return
67 */
68 public Set<Taxon> getTaxonomicChildren(Taxon parentTaxon);
69
70 /**
71 * Get the default sec. reference used by the current dataset
72 * @return
73 */
74 public ReferenceBase getDefaultSec();
75
76 /**
77 * Adds a taxon to the repository.
78 *
79 * @param taxon
80 */
81 public void addTaxon(Taxon taxon);
82
83 /**
84 * Removes a taxon from the repository.
85 *
86 * @param taxon
87 */
88 public void removeTaxon(Taxon taxon);
89
90 /**
91 * Removes all taxa from the repository.
92 * replaces clearSessionTaxa
93 *
94 * @param taxon
95 */
96 public void removeAllTaxa();
97
98 /**
99 * This is a set that can be used to be notified when there are changes
100 * to the list of all taxa, or to their names, for instance, when the name
101 * of a taxon displayed in a tree changes.
102 *
103 * @return
104 */
105 public IObservableSet getObservableTaxa();
106
107 public void setApplicationController(CdmApplicationController applicationController);
108
109 /**
110 * Sets all term vocabularies to NULL to be regenerated the next time
111 * they are needed, i.e. when a new transaction is opened.
112 */
113 public void clearNonTaxonData();
114
115 /**
116 * Sets all taxon collections to NULL to be regenerated the next time
117 * they are needed.
118 */
119 public void clearTaxonData();
120
121 public void clearAllData();
122
123 public void addTaxonSetListener(ICdmTaxonSetListener listener);
124
125 public Collection<Taxon> getAllTaxa();
126
127 public boolean saveTaxon(Taxon taxon);
128
129 public boolean deleteTaxon(Taxon taxon);
130
131 public void setTaxonomicParent(Taxon taxon, Taxon newParentTaxon);
132
133 public List<Feature> getFeatures();
134
135 public SortedSet<Rank> getRanks();
136
137 public TermVocabulary<NomenclaturalStatusType> getNomStatus();
138
139 public SortedSet<NameRelationshipType> getNameRelationshipTypes();
140
141 public OrderedTermVocabulary<TaxonRelationshipType> getTaxonRelationshipTypes();
142
143 public Set<TaxonRelationshipType> getConceptRelationshipTypes();
144
145 public TermVocabulary<TypeDesignationStatus> getTypeDesignationStatus();
146 }