|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.tenduke.types.AbstractBindableObject
com.tenduke.objectmodel.TendukeObject
com.tenduke.objectmodel.Category
public class Category
Hierarchical category object that can be referenced from TendukeObjects
Category model is flexible and can be used in several variations. Usage variations are enabled by the hierarchical nature of
the Category model and that Category is used to categorize other objects. The relation is many to one from categorized object
point of view (an object can be in one category and one category may hold several objects).
It is important to note that known default bind implementation (com.tenduke.binding) uses Category object's parent field
(AbstractBindableObject.getParent()) to determine parent based naming.
The default bind implementation chooses to persist Category object in a table, which is named using the
categorized object (e.g. when writing a Category object who's parent is a VideoEntry the Category object will be stored into a
table called VideoCategory). Parent based naming is only activated if the Category object's parent handle is set.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.tenduke.objectmodel.TendukeObject |
|---|
TendukeObject.CreatedDateComparator<T extends TendukeObject>, TendukeObject.ModifiedDateComparator<T extends TendukeObject> |
| Field Summary | |
|---|---|
static int |
FIELD_LENGTH_CATEGORY_DESCRIPTION
Maximum length for field data that holds category description. |
static int |
FIELD_LENGTH_CATEGORY_NAME
Maximum length for field data that holds category name. |
static int |
FIELD_LENGTH_CATEGORY_PARENT_ID
Maximum length for field data that holds parent category id. |
static java.lang.String |
FIELD_NAME_CATEGORY_DESCRIPTION
Identifier for field that holds category description. |
static java.lang.String |
FIELD_NAME_CATEGORY_NAME
Identifier for field that holds category name. |
static java.lang.String |
FIELD_NAME_CATEGORY_OWNER
Identifier for field that holds category "owner" object. |
static java.lang.String |
FIELD_NAME_CHILD_CATEGORIES
Identifier for field that holds child categories objects. |
static java.lang.String |
FIELD_NAME_PARENT_CATEGORY_ID
Identifier for field that holds parent category id. |
| Fields inherited from class com.tenduke.types.AbstractBindableObject |
|---|
FIELD_LENGTH_SHORT_ID, FIELD_NAME_OBJECT_STATE_CHANGE, FIELD_NAME_REPLACES_OBJECT, FIELD_NAME_SHORT_ID, PERMISSION_ACTION_CREATE, PERMISSION_ACTION_DELETE, PERMISSION_ACTION_MODIFY, PERMISSION_ACTION_READ |
| Constructor Summary | |
|---|---|
Category()
Construct new Category with random UUID. |
|
Category(java.lang.String name,
java.lang.String description)
Construct new Category with caller defined name and description and a random UUID as object's id. |
|
Category(java.util.UUID categoryId)
Construct new Category with caller defined UUID as object's unique id. |
|
Category(java.util.UUID categoryId,
java.lang.String name,
java.lang.String description)
Construct new Category with caller defined name, description and UUID as object's id. |
|
| Method Summary | |
|---|---|
void |
addChildCategory(Category childCategory)
Adds a category as child category of this category and sets the child's parent id to id of this. |
java.lang.Object |
clone()
Clones the instance. |
void |
copyThis(Category result)
Copies this instance into caller defined result object. |
java.util.UUID |
getCategoryId()
Gets the object's unique id. |
TendukeObject |
getCategoryOwner()
Gets category's owner object (the categorized object). |
java.util.List<Category> |
getChildCategories()
Gets this category's child categories. |
java.lang.String |
getDescription()
Gets the category description. |
java.util.UUID |
getId()
Gets object's unique id. |
java.lang.String |
getName()
Gets the category name. |
java.util.UUID |
getParentCategoryId()
Gets the parent category's id. |
protected void |
resolveParentBindableType()
Resolves and sets #getParentBindType() based on currently set parent object. |
void |
setCategoryId(java.util.UUID categoryId)
Sets object's unique id. |
void |
setCategoryOwner(TendukeObject categoryOwner)
Sets category's owner object (the categorized object). |
void |
setChildCategories(java.util.List<Category> childCategories)
Sets the child list, also sets parent id of each child. |
void |
setDescription(java.lang.String value)
Sets category description. |
void |
setId(java.util.UUID id)
Sets object's unique id. |
void |
setName(java.lang.String name)
Sets the category name. |
void |
setParentCategoryId(java.util.UUID categoryParentId)
Sets parent category's id. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int FIELD_LENGTH_CATEGORY_DESCRIPTION
public static final int FIELD_LENGTH_CATEGORY_NAME
public static final int FIELD_LENGTH_CATEGORY_PARENT_ID
public static final java.lang.String FIELD_NAME_CATEGORY_DESCRIPTION
public static final java.lang.String FIELD_NAME_CATEGORY_NAME
public static final java.lang.String FIELD_NAME_CATEGORY_OWNER
public static final java.lang.String FIELD_NAME_CHILD_CATEGORIES
public static final java.lang.String FIELD_NAME_PARENT_CATEGORY_ID
Category model.
| Constructor Detail |
|---|
public Category()
public Category(java.lang.String name,
java.lang.String description)
name - Category name.description - Category description.public Category(java.util.UUID categoryId)
categoryId - object's unique id to set.
public Category(java.util.UUID categoryId,
java.lang.String name,
java.lang.String description)
categoryId - Unique id for object.name - Category name.description - Category description.| Method Detail |
|---|
public void addChildCategory(Category childCategory)
childCategory - The category to add as a child to this.
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class TendukeObjectjava.lang.CloneNotSupportedException - Clone is implemented, exceptions not explicitly thrown.public void copyThis(Category result)
result - caller defined result object.public java.util.UUID getCategoryId()
public TendukeObject getCategoryOwner()
public java.util.List<Category> getChildCategories()
public java.lang.String getDescription()
public java.util.UUID getId()
getId in interface SerializableObjectgetId in class AbstractBindableObjectpublic java.lang.String getName()
public java.util.UUID getParentCategoryId()
protected void resolveParentBindableType()
#getParentBindType() based on currently set parent object. Called by AbstractBindableObject.getParent() after setting
parent, parent type and parent id. Overridden in this class for using parent object type based on first parent in current hierarchy
that is of different type than this object.
resolveParentBindableType in class AbstractBindableObjectpublic void setCategoryId(java.util.UUID categoryId)
categoryId - object's unique id to set.public void setCategoryOwner(TendukeObject categoryOwner)
categoryOwner - category's owner object (the categorized object) to set.public void setChildCategories(java.util.List<Category> childCategories)
childCategories - this category's child categories to set.public void setDescription(java.lang.String value)
value - category description to set.public void setId(java.util.UUID id)
setId in interface SerializableObjectsetId in class AbstractBindableObjectid - object's unique id to set.public void setName(java.lang.String name)
name - category name to set.public void setParentCategoryId(java.util.UUID categoryParentId)
categoryParentId - parent category's id to set.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||