Project

General

Profile

Download (7.82 KB) Statistics
| Branch: | Tag: | Revision:
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.cdm.api.service;
11

    
12
import java.util.Collection;
13
import java.util.List;
14
import java.util.Map;
15
import java.util.UUID;
16

    
17
//import org.springframework.transaction.TransactionStatus;
18

    
19
import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator;
20
import eu.etaxonomy.cdm.api.service.pager.Pager;
21
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
22
import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary;
23
import eu.etaxonomy.cdm.model.common.RelationshipBase;
24
import eu.etaxonomy.cdm.model.common.TermVocabulary;
25
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
26
import eu.etaxonomy.cdm.model.name.Rank;
27
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
28
import eu.etaxonomy.cdm.model.taxon.Synonym;
29
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
30
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
31
import eu.etaxonomy.cdm.model.taxon.Taxon;
32
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
33
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
34
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
35
import eu.etaxonomy.cdm.persistence.fetch.CdmFetch;
36

    
37

    
38
public interface ITaxonService extends IIdentifiableEntityService<TaxonBase>{
39
	
40
	/**
41
	 * FIXME candidate for harmonization? 
42
	 */
43
	public abstract TaxonBase getTaxonByUuid(UUID uuid);
44

    
45
	/**
46
	 * FIXME candidate for harmonization? 
47
	 * save a taxon and return its UUID
48
	 */
49
	public abstract UUID saveTaxon(TaxonBase taxon);
50

    
51
	/**
52
	 * FIXME candidate for harmonization?
53
	 *  save a taxon and return its UUID
54
	 */
55
	//public abstract UUID saveTaxon(TaxonBase taxon, TransactionStatus txStatus);
56
	
57
	/**
58
	 * FIXME candidate for harmonization?
59
	 * save a collection of taxa and return its UUID
60
	 */
61
	public abstract Map<UUID, ? extends TaxonBase> saveTaxonAll(Collection<? extends TaxonBase> taxonCollection);
62

    
63
	
64
	/**
65
	 * FIXME candidate for harmonization?
66
	 * delete a taxon and return its UUID
67
	 */
68
	public abstract UUID removeTaxon(TaxonBase taxon);
69
	
70
	/**
71
	 * Computes all taxon bases.
72
	 * FIXME could substitute with list(Synonym.class, limit, start)
73
	 * @param limit
74
	 * @param start
75
	 * @return
76
	 */
77
	public abstract List<Synonym> getAllSynonyms(int limit, int start);
78
	
79
	/**
80
	 * Computes all taxon bases.
81
	 * FIXME could substitute with list(Taxon.class, limit,start)
82
	 * @param limit
83
	 * @param start
84
	 * @return
85
	 */
86
	public abstract List<Taxon> getAllTaxa(int limit, int start);
87
	
88
	/**
89
	 * Computes all taxon bases.
90
	 * FIXME could substitute with list(limit,start) from superclass
91
	 * @param limit
92
	 * @param start
93
	 * @return
94
	 */
95
	public abstract List<TaxonBase> getAllTaxonBases(int limit, int start);
96
	
97
	/**
98
	 * Computes all Taxon instances that do not have a taxonomic parent and has at least one child.
99
	 * @param sec The concept reference that the taxon belongs to
100
	 * @return The List<Taxon> of root taxa.
101
	 */
102
	public abstract List<Taxon> getRootTaxa(ReferenceBase sec);
103

    
104
	/**
105
	 * Computes all Taxon instances that do not have a taxonomic parent.
106
	 * @param sec The concept reference that the taxon belongs to
107
	 * 
108
	 * @param onlyWithChildren if true only taxa are returned that have taxonomic children. <Br>Default: true.
109
	 * @return The List<Taxon> of root taxa.
110
	 */
111
	public abstract List<Taxon> getRootTaxa(ReferenceBase sec, CdmFetch cdmFetch, boolean onlyWithChildren);
112

    
113
	/**
114
	 * Computes all Taxon instances that do not have a taxonomic parent.
115
	 * @param sec The concept reference that the taxon belongs to
116
	 * @param onlyWithChildren if true only taxa are returned that have taxonomic children. <Br>Default: true.
117
	 * @param withMisapplications if false taxa that have at least one misapplied name relationship in which they are
118
	 * the misapplied name are not returned.<Br>Default: true.
119
	 * @return The List<Taxon> of root taxa.
120
	 */
121
	public abstract List<Taxon> getRootTaxa(ReferenceBase sec, boolean onlyWithChildren, boolean withMisapplications);
122

    
123
	
124
	/**
125
	 * Computes all relationships.
126
	 * @param limit
127
	 * @param start
128
	 * @return
129
	 */
130
    public abstract List<RelationshipBase> getAllRelationships(int limit, int start);
131

    
132
	/**
133
	 * Returns TaxonRelationshipType vocabulary
134
	 * @return
135
	 */
136
	public OrderedTermVocabulary<TaxonRelationshipType> getTaxonRelationshipTypeVocabulary();
137

    
138
	/** */
139
	public abstract List<TaxonBase> searchTaxaByName(String name, ReferenceBase sec);
140
		
141
	public Synonym makeTaxonSynonym (Taxon oldTaxon, Taxon newAcceptedTaxon, SynonymRelationshipType synonymType, ReferenceBase citation, String citationMicroReference);
142
	
143
	/**
144
	 * Returns the TaxonRelationships (of where relationship.type == type, if this arguement is supplied) 
145
	 * where the supplied taxon is relatedTo.
146
	 * 
147
	 * @param taxon The taxon that is relatedTo
148
	 * @param type The type of TaxonRelationship (can be null)
149
	 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
150
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
151
	 * @return a Pager of TaxonRelationship instances
152
	 */
153
	public Pager<TaxonRelationship> getRelatedTaxa(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber);
154
	
155
	/**
156
	 * Returns the SynonymRelationships (of where relationship.type == type, if this arguement is supplied) 
157
	 * where the supplied taxon is relatedTo.
158
	 * 
159
	 * @param taxon The taxon that is relatedTo
160
	 * @param type The type of SynonymRelationship (can be null)
161
	 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
162
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
163
	 * @return a Pager of SynonymRelationship instances
164
	 */
165
	public Pager<SynonymRelationship> getSynonyms(Taxon taxon, SynonymRelationshipType type, Integer pageSize, Integer pageNumber);
166
	
167
	/**
168
	 * Returns a List of TaxonBase instances (or Taxon instances, if accepted == true, or Synonym instance, if accepted == false) where the 
169
	 * taxonBase.name.nameCache property matches the String queryString (as interpreted by the Lucene QueryParser)
170
	 * 
171
	 * @param queryString
172
	 * @param accepted
173
	 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
174
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
175
	 * @return a Pager Taxon instances
176
	 * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
177
	 */
178
	public Pager<TaxonBase> searchTaxa(String queryString, Boolean accepted, Integer pageSize, Integer pageNumber);
179
	
180
	/**
181
	 * Returns a list of TaxonBase instances (or Taxon instances, if accepted == true, or Synonym instance, if accepted == false) where the
182
	 * taxon.name properties match the parameters passed.
183
	 * 
184
	 * @param accepted Whether the taxon is accepted (true) a synonym (false), or either (null)
185
	 * @param uninomial 
186
	 * @param infragenericEpithet
187
	 * @param specificEpithet
188
	 * @param infraspecificEpithet
189
	 * @param rank
190
	 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
191
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
192
	 * @return a Pager of TaxonBase instances
193
	 */
194
	public Pager<TaxonBase> findTaxaByName(Boolean accepted, String uninomial, String infragenericEpithet, String specificEpithet, String infraspecificEpithet, Rank rank, Integer pageSize, Integer pageNumber);
195

    
196
	/**
197
	 * Returns a list of IdentifiableEntity instances (in particular, TaxonNameBase and TaxonBase instances)
198
	 * that match the properties specified in the configurator.
199
	 * @param configurator
200
	 * @return
201
	 */
202
	public Pager<IdentifiableEntity> findTaxaAndNames(ITaxonServiceConfigurator configurator);
203
}
(17-17/28)