org.rapla.entities
Interface Category

All Superinterfaces:
Annotatable, Entity, MultiLanguageNamed, Named, RaplaObject

public interface Category
extends MultiLanguageNamed, Entity, RaplaObject, Annotatable

Hierarchical categorization of information. Categories can be used as attribute values.

See Also:
Attribute

Field Summary
static Category[] CATEGORY_ARRAY
           
static RaplaType TYPE
           
 
Fields inherited from interface org.rapla.entities.Entity
ENTITY_ARRAY
 
Method Summary
 void addCategory(Category category)
          add a sub-category.
 Category findCategory(Category copy)
          find a sub-category in that equals the specified category.
 Category[] getCategories()
          returns all subcategories
 Category getCategory(String key)
          returns the subcategory with the specified key.
 int getDepth()
          returns the number of ancestors.
 String getKey()
          returns the key of the category
 Category getParent()
          Returns the parent of this category or null if the category has no parent.
 String getPath(Category rootCategory, Locale locale)
          returns the path form the rootCategory to this category.
 boolean hasCategory(Category category)
          returns true if the passed category is a direct child of this category
 boolean isAncestorOf(Category category)
          returns true this category is an ancestor (parent or parent of parent, ...) of the specified category
 void removeCategory(Category category)
          remove a sub-category
 void setKey(String key)
          set the key of the category.
 
Methods inherited from interface org.rapla.entities.MultiLanguageNamed
getName
 
Methods inherited from interface org.rapla.entities.Named
getName
 
Methods inherited from interface org.rapla.entities.Entity
isIdentical, isPersistant
 
Methods inherited from interface org.rapla.entities.RaplaObject
getRaplaType
 
Methods inherited from interface org.rapla.entities.Annotatable
getAnnotation, getAnnotation, getAnnotationKeys, setAnnotation
 

Field Detail

TYPE

static final RaplaType TYPE

CATEGORY_ARRAY

static final Category[] CATEGORY_ARRAY
Method Detail

addCategory

void addCategory(Category category)
add a sub-category. This category is set as parent of the passed category.


removeCategory

void removeCategory(Category category)
remove a sub-category


getCategories

Category[] getCategories()
returns all subcategories


getCategory

Category getCategory(String key)
returns the subcategory with the specified key. null if subcategory was not found.


findCategory

Category findCategory(Category copy)
find a sub-category in that equals the specified category.


getParent

Category getParent()
Returns the parent of this category or null if the category has no parent.


hasCategory

boolean hasCategory(Category category)
returns true if the passed category is a direct child of this category


setKey

void setKey(String key)
set the key of the category. The can be used in the getCategory() method for lookup.


getKey

String getKey()
returns the key of the category


isAncestorOf

boolean isAncestorOf(Category category)
returns true this category is an ancestor (parent or parent of parent, ...) of the specified category


getPath

String getPath(Category rootCategory,
               Locale locale)
returns the path form the rootCategory to this category. Path elements are the category-names in the selected locale separated with the / operator. If the rootCategory is null the path will be calculated to the top-most parent. Example: area51/aliencell


getDepth

int getDepth()
returns the number of ancestors. (How many Time you must call getParent() until you receive null)



Copyright © 2000-2006 Rapla Team. All Rights Reseserved.