org.opensubsystems.inventory.data
Class Category

java.lang.Object
  extended by org.opensubsystems.core.data.DataObject
      extended by org.opensubsystems.core.data.BasicDataObject
          extended by org.opensubsystems.core.data.ModifiableDataObject
              extended by org.opensubsystems.inventory.data.Category
All Implemented Interfaces:
java.io.Serializable

public class Category
extends org.opensubsystems.core.data.ModifiableDataObject

This class represents category into which items in the inventory can be categorized. Categories are hierarchical and each category can have multiple subcategories. There are possible more implementations for manipulating hierarchical data. Description is available at: http://dev.mysql.com/tech-resources/articles/hierarchical-data.html http://www.sitepoint.com/article/hierarchical-data-database/1 http://www.evolt.org/article/Four_ways_to_work_with_hierarchical_data/17/4047/index.html

Version:
$Id: Category.java,v 1.14 2007/01/07 06:14:30 bastafidli Exp $
Author:
Martin Cerba
See Also:
Serialized Form
Code reviewer:
Miro Halas
Code reviewed:
1.8 2006/02/24 06:02:31 bastafidli

Field Summary
static int[] ALL_CATEGORY_COLUMNS
          Static variable for array of all columns codes.
static int[] ALL_FILTER_COLUMNS
          Static variable for array of all filter columns codes.
static int COL_CATEGORY_CREATION_DATE
          Code for table column.
static int COL_CATEGORY_DESCRIPTION
          Code for table column.
static int COL_CATEGORY_DISPLAY_ORDER
          Code for table column.
static int COL_CATEGORY_DOMAIN_ID
          Code for table column.
static int COL_CATEGORY_ID
          Code for table column.
static int COL_CATEGORY_INVENTORY_ID
          Code for table column.
static int COL_CATEGORY_MODIFICATION_DATE
          Code for table column.
static int COL_CATEGORY_NAME
          Code for table column.
static java.lang.Integer COL_CATEGORY_NAME_OBJ
          Object code for table column.
static int COL_CATEGORY_PARENT_ID
          Code for table column.
static int[] DEFAULT_LIST_COLUMNS
          Default columns to retrieve when asked for list of objects.
static int[] DEFAULT_LIST_SORT_COLUMNS
          Default columns to sort by when asked for list of objects.
static java.lang.String[] DEFAULT_LIST_SORT_ORDER
          Default order in which the columns will be sorted.
protected  int m_iDisplayOrder
          User has requirement to display categories in some particular order, such as 1 1/2", 1", 1/2", 3/4" and 3/8" should be displayed as 3/8", 1/2", 3/4", 1" and 1 1/2".
protected  int m_iInventoryId
          Id of the inventory this category belongs to.
protected  int m_iParentId
          Id of the parent category.
protected  java.lang.String m_strDescription
          Description of the category.
protected  java.lang.String m_strName
          Name of the category.
protected static int s_iDescriptionMaxLength
          Maximal length of category description in chars
protected static int s_iNameMaxLength
          Maximal length of category name in chars
 
Fields inherited from class org.opensubsystems.core.data.ModifiableDataObject
m_modificationTimestamp
 
Fields inherited from class org.opensubsystems.core.data.BasicDataObject
m_creationTimestamp, m_iDomainId
 
Fields inherited from class org.opensubsystems.core.data.DataObject
NEW_ID, NEW_ID_OBJ, NEW_ID_STR
 
Constructor Summary
Category()
          Empty constructor
Category(int iDomainId)
          Empty category for a specified domain initialized to default parameters
Category(int iCategoryId, int iDomainId, int iInventoryId, int iParentId, java.lang.String strName, java.lang.String strDescription, int iDisplayOrder)
          Full constructor.
Category(int id, int iDomainId, int iInventoryId, int iParentId, java.lang.String strName, java.lang.String strDescription, int iDisplayOrder, java.sql.Timestamp creationDate, java.sql.Timestamp modificationDate)
          Full constructor to create new child category.
Category(int iDomainId, int iInventoryId, int iParentId, java.lang.String strName, java.lang.String strDescription, int iDisplayOrder)
          Constructor to create new child category.
Category(int iDomainId, int iInventoryId, java.lang.String strName, java.lang.String strDescription, int iDisplayOrder)
          Full constructor to create new root category.
 
Method Summary
 int getDescriptioMaxLength()
           
 java.lang.String getDescription()
           
static int getDescriptionMaxLengthStatic()
           
 int getDisplayOrder()
           
 int getInventoryId()
           
 java.lang.String getName()
           
 int getNameMaxLength()
           
static int getNameMaxLengthStatic()
           
 int getParentId()
          Id of the parent.
 boolean isSame(java.lang.Object oObject)
          
 void setDescription(java.lang.String strDescription)
           
static void setDescriptionMaxLength(int newDescriptionMaxLength)
          Set static description max length parameter.
 void setDisplayOrder(int iDisplayOrder)
           
 void setInventoryId(int iInventoryId)
           
 void setName(java.lang.String strName)
           
static void setNameMaxLength(int newNameMaxLength)
          Set static description max length parameter.
 void setParentId(int iParentId)
          Id of the parent.
 
Methods inherited from class org.opensubsystems.core.data.ModifiableDataObject
equals, getModificationTimestamp, hashCode, restore, setModificationTimestamp
 
Methods inherited from class org.opensubsystems.core.data.BasicDataObject
getCreationTimestamp, getDomainId, getId, getIdAsObject, restore, setCreationTimestamp, setId
 
Methods inherited from class org.opensubsystems.core.data.DataObject
isFromPersistenceStore, setFromPersistenceStore
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COL_CATEGORY_ID

public static final int COL_CATEGORY_ID
Code for table column.

See Also:
Constant Field Values

COL_CATEGORY_DOMAIN_ID

public static final int COL_CATEGORY_DOMAIN_ID
Code for table column.

See Also:
Constant Field Values

COL_CATEGORY_INVENTORY_ID

public static final int COL_CATEGORY_INVENTORY_ID
Code for table column.

See Also:
Constant Field Values

COL_CATEGORY_PARENT_ID

public static final int COL_CATEGORY_PARENT_ID
Code for table column.

See Also:
Constant Field Values

COL_CATEGORY_NAME

public static final int COL_CATEGORY_NAME
Code for table column.

See Also:
Constant Field Values

COL_CATEGORY_NAME_OBJ

public static final java.lang.Integer COL_CATEGORY_NAME_OBJ
Object code for table column.


COL_CATEGORY_DESCRIPTION

public static final int COL_CATEGORY_DESCRIPTION
Code for table column.

See Also:
Constant Field Values

COL_CATEGORY_DISPLAY_ORDER

public static final int COL_CATEGORY_DISPLAY_ORDER
Code for table column.

See Also:
Constant Field Values

COL_CATEGORY_CREATION_DATE

public static final int COL_CATEGORY_CREATION_DATE
Code for table column.

See Also:
Constant Field Values

COL_CATEGORY_MODIFICATION_DATE

public static final int COL_CATEGORY_MODIFICATION_DATE
Code for table column.

See Also:
Constant Field Values

ALL_CATEGORY_COLUMNS

public static final int[] ALL_CATEGORY_COLUMNS
Static variable for array of all columns codes. The order is important since it is used to retrieve all data from the persistence store efficiently so do not modify it unless you make changes to other places as well.


ALL_FILTER_COLUMNS

public static final int[] ALL_FILTER_COLUMNS
Static variable for array of all filter columns codes. TODO: For Miro: This is not used for now so either we implement filters for it and then remove this to do or remove this attribute.


DEFAULT_LIST_COLUMNS

public static final int[] DEFAULT_LIST_COLUMNS
Default columns to retrieve when asked for list of objects. These should be only columns visible to user on the screen and not any internal columns. Also the columns should be retrievable efficiently so that the default view is very quick.


DEFAULT_LIST_SORT_COLUMNS

public static final int[] DEFAULT_LIST_SORT_COLUMNS
Default columns to sort by when asked for list of objects.


DEFAULT_LIST_SORT_ORDER

public static final java.lang.String[] DEFAULT_LIST_SORT_ORDER
Default order in which the columns will be sorted.


s_iNameMaxLength

protected static int s_iNameMaxLength
Maximal length of category name in chars


s_iDescriptionMaxLength

protected static int s_iDescriptionMaxLength
Maximal length of category description in chars


m_iInventoryId

protected int m_iInventoryId
Id of the inventory this category belongs to.


m_iParentId

protected int m_iParentId
Id of the parent category. If this is DataObject.NEW_ID then this is a top level category.


m_strName

protected java.lang.String m_strName
Name of the category.


m_strDescription

protected java.lang.String m_strDescription
Description of the category.


m_iDisplayOrder

protected int m_iDisplayOrder
User has requirement to display categories in some particular order, such as 1 1/2", 1", 1/2", 3/4" and 3/8" should be displayed as 3/8", 1/2", 3/4", 1" and 1 1/2". This field will be used to store some numeric value based on which the categories should be sorted. They will be displayed sorted according to Display Order and if it is the same then according to Name.

Constructor Detail

Category

public Category()
Empty constructor


Category

public Category(int iDomainId)
Empty category for a specified domain initialized to default parameters

Parameters:
iDomainId - - Id of the domain this category belongs to

Category

public Category(int iDomainId,
                int iInventoryId,
                java.lang.String strName,
                java.lang.String strDescription,
                int iDisplayOrder)
Full constructor to create new root category.

Parameters:
iDomainId - - domain id
iInventoryId - - inventory id
strName - - category name
strDescription - - category description
iDisplayOrder - - order in which the categories should appear when displayed in the list, if the same or 0, they will be displayed sorted by the name

Category

public Category(int iDomainId,
                int iInventoryId,
                int iParentId,
                java.lang.String strName,
                java.lang.String strDescription,
                int iDisplayOrder)
Constructor to create new child category.

Parameters:
iDomainId - - domain id
iParentId - - category parent id
iInventoryId - - inventory id
strName - - category name
strDescription - - category description
iDisplayOrder - - order in which the categories should appear when displayed in the list, if the same or 0, they will be displayed sorted by the name

Category

public Category(int iCategoryId,
                int iDomainId,
                int iInventoryId,
                int iParentId,
                java.lang.String strName,
                java.lang.String strDescription,
                int iDisplayOrder)
Full constructor.

Parameters:
iCategoryId - - category id
iDomainId - - domain id
iInventoryId - - inventory id
iParentId - - category parent id
strName - - category name
strDescription - - category description
iDisplayOrder - - order in which the categories should appear when displayed in the list, if the same or 0, they will be displayed sorted by the name

Category

public Category(int id,
                int iDomainId,
                int iInventoryId,
                int iParentId,
                java.lang.String strName,
                java.lang.String strDescription,
                int iDisplayOrder,
                java.sql.Timestamp creationDate,
                java.sql.Timestamp modificationDate)
Full constructor to create new child category.

Parameters:
id - - category id
iDomainId - - domain id
iInventoryId - - inventory id
iParentId - - category parent id
strName - - category name
strDescription - - category description
iDisplayOrder - - order in which the categories should appear when displayed in the list, if the same or 0, they will be displayed sorted by the name
creationDate - - category creation date
modificationDate - - category modification date
Method Detail

setNameMaxLength

public static void setNameMaxLength(int newNameMaxLength)
Set static description max length parameter. It is used by database layer to adjust this parameter based on database capabilities.

Parameters:
newNameMaxLength - - new name max length

setDescriptionMaxLength

public static void setDescriptionMaxLength(int newDescriptionMaxLength)
Set static description max length parameter. It is used by database layer to adjust this parameter based on database capabilities.

Parameters:
newDescriptionMaxLength - - new description max length

getNameMaxLength

public int getNameMaxLength()
Returns:
int

getNameMaxLengthStatic

public static int getNameMaxLengthStatic()
Returns:
int

getDescriptioMaxLength

public int getDescriptioMaxLength()
Returns:
int

getDescriptionMaxLengthStatic

public static int getDescriptionMaxLengthStatic()
Returns:
int

getName

public java.lang.String getName()
Returns:
String - category name

setName

public void setName(java.lang.String strName)
Parameters:
strName - - new name to set

getDescription

public java.lang.String getDescription()
Returns:
String - category description

setDescription

public void setDescription(java.lang.String strDescription)
Parameters:
strDescription - - new description to set

getParentId

public int getParentId()
Id of the parent. If this is DataObject.NEW_ID then this is a top level category.

Returns:
int - if this is DataObject.NEW_ID then this is root category

setParentId

public void setParentId(int iParentId)
Id of the parent. If this is DataObject.NEW_ID then this is a top level category.

Parameters:
iParentId - - if this is DataObject.NEW_ID then this is root category

getInventoryId

public int getInventoryId()
Returns:
int - Id of inventory where this category belongs

setInventoryId

public void setInventoryId(int iInventoryId)
Parameters:
iInventoryId - - Id of inventory where this category belongs

getDisplayOrder

public int getDisplayOrder()
Returns:
int - integer value used to sort categories for display

setDisplayOrder

public void setDisplayOrder(int iDisplayOrder)
Parameters:
iDisplayOrder - - integer value used to sort categories for display

isSame

public boolean isSame(java.lang.Object oObject)

Specified by:
isSame in class org.opensubsystems.core.data.DataObject


Copyright © 2003 - 2006 OpenSubsystems s.r.o.