Merge branch 'develop' of ssh://dev.e-taxonomy.eu/var/git/cdmlib into develop
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / ITermTreeService.java
1 /**
2 * Copyright (C) 2009 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.Arrays;
13 import java.util.Collection;
14 import java.util.List;
15 import java.util.Map;
16 import java.util.UUID;
17
18 import eu.etaxonomy.cdm.api.service.pager.Pager;
19 import eu.etaxonomy.cdm.model.term.TermNode;
20 import eu.etaxonomy.cdm.model.term.TermTree;
21 import eu.etaxonomy.cdm.model.term.TermType;
22 import eu.etaxonomy.cdm.persistence.dao.common.Restriction;
23 import eu.etaxonomy.cdm.persistence.dao.common.Restriction.Operator;
24 import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
25 import eu.etaxonomy.cdm.persistence.query.OrderHint;
26
27 public interface ITermTreeService extends IIdentifiableEntityService<TermTree> {
28
29 public List<TermTree> list(TermType termType, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
30
31 public Pager<TermTree> page(TermType termType, Integer pageSize, Integer pageIndex, List<OrderHint> orderHints, List<String> propertyPaths);
32
33 /**
34 * Loads a term tree including all of its nodes (all the way down to the tips of the tree).
35 * Because this method automatically adds term nodes recursively, adding "root" to property paths
36 * is superfluous - the propertyPaths argument should be used to initialize property paths <i>in addition</i>
37 * to the term nodes. The nodePaths argument is applied to each node in turn, so again, adding "children"
38 * is also superfluous. The nodePaths argument should be used to specify additional properties of the term node
39 * to initialize (e.g. feature).
40 *
41 */
42 public TermTree loadWithNodes(UUID uuid, List<String> propertyPaths, List<String> nodePaths);
43
44 public Map<UUID, TermNode> saveNodesAll(Collection<TermNode> featureNodeCollection);
45
46 public Map<UUID, TermNode> saveOrUpdateNodesAll(Collection<TermNode> featureNodeCollection);
47
48 public <S extends TermTree> List<UuidAndTitleCache<S>> getUuidAndTitleCacheByTermType(
49 Class<S> clazz, TermType termType, Integer limit, String pattern);
50
51 List<Restriction<?>> buildTermTypeFilterRestrictions(TermType termType);
52 }