com.lightdev.tree.data
Interface HierarchicalDataStore


public interface HierarchicalDataStore

HierarchicalDataStore.java

Classes wishing to persistently store or load hierarchical data need to implement this interface. It is assumed that hierarchical data items, i.e. items that are linked with a 1:n parent-child relation, are identified each with a unique id.

Version:
2, 30.03.2006
Author:
Ulrich Hilger, Light Development, http://www.lightdev.com, info@lightdev.com, published under the terms and conditions of the BSD License, for details see file license.txt in the distribution package of this software

Method Summary
 Object createItem(HierarchicalItem item)
          create a new item in the data store
 Object deleteItem(Object id)
          delete the item with the given id from the data store
 Vector<HierarchicalItem> getChildItems(Object id)
          get all child items of a given item
 HierarchicalItem getItem(Object id)
          get the item with the given id
 Vector<HierarchicalItem> getRootItems()
          get all root items in the data store, i.e. all top level items in the item hierarchy that have no parent
 HierarchicalItem putItem(HierarchicalItem item)
          store an item with the given id
 

Method Detail

getItem


HierarchicalItem getItem(Object id)

                         throws StorageException
get the item with the given id

Parameters:
id - the id of the item to get
Returns:
the item with the given id or null, if none was found with that id
Throws:
StorageException

getChildItems


Vector<HierarchicalItem> getChildItems(Object id)

                                       throws StorageException
get all child items of a given item

Parameters:
id - the id of the item to get child items for
Returns:
a Vector of HierarchicalItem objects or null if an item with the given id was not found
Throws:
StorageException

getRootItems


Vector<HierarchicalItem> getRootItems()

                                      throws StorageException
get all root items in the data store, i.e. all top level items in the item hierarchy that have no parent

Returns:
a Vector of HierarchicalItems with all root items
Throws:
StorageException

putItem


HierarchicalItem putItem(HierarchicalItem item)

                         throws StorageException
store an item with the given id

Parameters:
item - the item to store
Returns:
the item that has been stored or null if no item with that id was found
Throws:
StorageException

createItem


Object createItem(HierarchicalItem item)

                  throws StorageException
create a new item in the data store

Parameters:
item - the new item to create
Returns:
the id of the newly create item
Throws:
StorageException

deleteItem


Object deleteItem(Object id)

                  throws StorageException
delete the item with the given id from the data store

Parameters:
id -
Returns:
the id of the deleted item or null if an item with the given id was not found
Throws:
StorageException