Project

General

Profile

Download (2.17 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
package eu.etaxonomy.cdm.model.common;
10

    
11
import java.util.Collection;
12
import java.util.List;
13

    
14
import org.hibernate.event.spi.SaveOrUpdateEventListener;
15

    
16
/**
17
 * Common interface for all tree data structures supporting tree indexing.
18
 * Mainly used by {@link SaveOrUpdateEventListener} to update the indices.
19
 * 
20
 * @author a.mueller
21
 * @since 12.08.2013
22
 *
23
 */
24
public interface ITreeNode<T extends ITreeNode<T>> extends ICdmBase {
25
	
26
	//Constants
27
	//the separator used in the tree index to separate the id's of the parent nodes
28
	public static final String separator = "#";
29
	
30
	//The prefix used in the tree index for the id of the tree itself
31
	public static final String treePrefix = "t";
32
	
33
	
34
	//METHODS
35
	
36
	
37
	/**
38
	 * Returns the tree index of this tree node.
39
	 * @return the tree index
40
	 */
41
	public String treeIndex();
42

    
43
	
44
	/**
45
	 * Returns the parent node of this node.
46
	 * Returns <code>null</code> if this
47
	 * node is a root node.
48
	 * @return
49
	 */
50
	public ITreeNode<T> getParent();
51

    
52
	/**
53
	 * Sets the tree index of this node.
54
	 * @deprecated preliminary implementation for updating the treeindex.
55
	 * Maybe removed once index updating is improved.
56
	 * @param newTreeIndex
57
	 */
58
	public void setTreeIndex(String newTreeIndex);
59
	
60
	/**
61
	 * Returns all direct child nodes of this node.
62
	 * As tree node children do not necessarily need to be
63
	 * {@link List lists} the return type of this method may change
64
	 * to {@link Collection} in future. Therefore the use
65
	 * at the moment is deprecated.
66
	 * @deprecated return type may become {@link Collection} in future 
67
	 * @return the list of children
68
	 */
69
	public List<T> getChildNodes();
70

    
71
	/**
72
	 * Returns the {@link ICdmBase#getId() id} of the tree object,
73
	 * this node belongs to.
74
	 * @deprecated may be removed in future when index updating does not
75
	 * use this anymore
76
	 * @return the id of the tree
77
	 */
78
	public int treeId();
79

    
80
}
(36-36/79)