newest changes for INameService.delete
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / ITermService.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.cdm.api.service;
12
13 import java.net.URI;
14 import java.util.Enumeration;
15 import java.util.List;
16 import java.util.Locale;
17 import java.util.Set;
18 import java.util.UUID;
19
20 import eu.etaxonomy.cdm.api.service.pager.Pager;
21 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
22 import eu.etaxonomy.cdm.model.common.Language;
23 import eu.etaxonomy.cdm.model.common.LanguageString;
24 import eu.etaxonomy.cdm.model.common.LanguageStringBase;
25 import eu.etaxonomy.cdm.model.common.Representation;
26 import eu.etaxonomy.cdm.model.location.NamedArea;
27 import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
28 import eu.etaxonomy.cdm.model.location.NamedAreaType;
29 import eu.etaxonomy.cdm.model.media.Media;
30 import eu.etaxonomy.cdm.persistence.dao.BeanInitializer;
31 import eu.etaxonomy.cdm.persistence.query.OrderHint;
32
33 public interface ITermService extends IIdentifiableEntityService<DefinedTermBase> {
34
35 /**
36 * Returns a term according to it's uri
37 * @param uri
38 * @return
39 */
40 public DefinedTermBase getByUri(URI uri);
41
42 public UUID saveLanguageData(LanguageStringBase languageData);
43
44 public List<LanguageString> getAllLanguageStrings(int limit, int start);
45
46 public List<Representation> getAllRepresentations(int limit, int start);
47
48 public Language getLanguageByIso(String iso639);
49
50 public List<Language> getLanguagesByLocale(Enumeration<Locale> locales);
51
52 public NamedArea getAreaByTdwgAbbreviation(String tdwgAbbreviation);
53
54 /**
55 * Returns a paged list of Media that represent a given DefinedTerm instance
56 *
57 * @param definedTerm the definedTerm represented by these media
58 * @param pageSize The maximum number of media returned (can be null for all related media)
59 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
60 * @return a Pager of media instances
61 */
62 public Pager<Media> getMedia(DefinedTermBase definedTerm, Integer pageSize, Integer pageNumber);
63
64 /**
65 * Returns a paged list of NamedArea instances (optionally filtered by type or level)
66 *
67 * @param level restrict the result set to named areas of a certain level (can be null)
68 * @param type restrict the result set to named areas of a certain type (can be null)
69 * @param pageSize The maximum number of namedAreas returned (can be null for all named areas)
70 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
71 * @return a Pager of named areas
72 */
73 public Pager<NamedArea> list(NamedAreaLevel level, NamedAreaType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
74
75 /**
76 * Return a paged list of terms which are specializations of a given definedTerm
77 *
78 * @param definedTerm The term which is a generalization of the terms returned
79 * @param pageSize The maximum number of terms returned (can be null for all specializations)
80 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
81 * @return a Pager of DefinedTerms
82 */
83 public <T extends DefinedTermBase> Pager<T> getGeneralizationOf(T definedTerm, Integer pageSize, Integer pageNumber);
84
85 /**
86 * Return a paged list of distinct terms which include the terms supplied
87 *
88 * @param definedTerms the set of terms which are part of the terms of interest
89 * @param pageSize The maximum number of terms returned (can be null for all terms)
90 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
91 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
92 * @return a Pager of DefinedTerms
93 */
94 public <T extends DefinedTermBase> Pager<T> getPartOf(Set<T> definedTerms, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
95
96 /**
97 * Return a paged list of terms which are part of the terms supplied
98 *
99 * @param definedTerms the set of terms which include the terms of interest
100 * @param pageSize The maximum number of terms returned (can be null for all terms)
101 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
102 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
103 * @return a Pager of DefinedTerms
104 */
105 public <T extends DefinedTermBase> Pager<T> getIncludes(Set<T> definedTerms, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
106
107 /**
108 * Return a paged list of terms which have representations that match the supplied string in the text (description)
109 *
110 * @param label a string to match (exactly)
111 * @param pageSize The maximum number of terms returned (can be null for all terms)
112 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
113 * @return a Pager of DefinedTerms
114 */
115 public <T extends DefinedTermBase> Pager<T> findByRepresentationText(String label, Class<T> clazz, Integer pageSize, Integer pageNumber);
116
117 /**
118 * Return a paged list of terms which have representations that match the supplied string in the abbreviated label
119 *
120 * @param label a string to match (exactly)
121 * @param pageSize The maximum number of terms returned (can be null for all terms)
122 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
123 * @return a Pager of DefinedTerms
124 */
125 public <T extends DefinedTermBase> Pager<T> findByRepresentationAbbreviation(String abbrev, Class<T> clazz, Integer pageSize, Integer pageNumber);
126
127
128 /**
129 *
130 * @param <TERM>
131 * @param clazz
132 * @param limit
133 * @param start
134 * @param orderHints
135 * @param propertyPaths
136 * @return
137 */
138 public <TERM extends DefinedTermBase> List<TERM> listByTermClass(Class<TERM> clazz, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
139 }