3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.model
.common
;
12 import java
.util
.Collection
;
13 import java
.util
.List
;
15 import org
.hibernate
.event
.spi
.SaveOrUpdateEventListener
;
18 * Common interface for all tree data structures supporting tree indexing.
19 * Mainly used by {@link SaveOrUpdateEventListener} to update the indices.
25 public interface ITreeNode
<T
extends ITreeNode
<T
>> extends ICdmBase
{
28 //the separator used in the tree index to separate the id's of the parent nodes
29 public static final String separator
= "#";
31 //The prefix used in the tree index for the id of the tree itself
32 public static final String treePrefix
= "t";
39 * Returns the tree index of this tree node.
40 * @return the tree index
42 public String
treeIndex();
46 * Returns the parent node of this node.
47 * Returns <code>null</code> if this
48 * node is a root node.
51 public ITreeNode
<T
> getParent();
54 * Sets the tree index of this node.
55 * @deprecated preliminary implementation for updating the treeindex.
56 * Maybe removed once index updating is improved.
59 public void setTreeIndex(String newTreeIndex
);
62 * Returns all direct child nodes of this node.
63 * As tree node children do not necessarily need to be
64 * {@link List lists} the return type of this method may change
65 * to {@link Collection} in future. Therefore the use
66 * at the moment is deprecated.
67 * @deprecated return type may become {@link Collection} in future
68 * @return the list of children
70 public List
<T
> getChildNodes();
73 * Returns the {@link ICdmBase#getId() id} of the tree object,
74 * this node belongs to.
75 * @deprecated may be removed in future when index updating does not
77 * @return the id of the tree