org.opensubsystems.patterns.listdata.data
Class ListDefinition

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.patterns.listdata.data.ListDefinition
All Implemented Interfaces:
java.io.Serializable

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

This class describes the list of data objects. It allows to specify what attributes of the data objects to load, what conditions have to data objects satisfy to be included in the list, what should be the order of data elements, etc.

Version:
$Id: ListDefinition.java,v 1.10 2007/02/20 04:13:02 bastafidli Exp $
Author:
Julo Legeny
See Also:
Serialized Form
Code reviewer:
Miro Halas
Code reviewed:
1.7 2006/02/18 05:31:33 bastafidl

Field Summary
static int DEFAULT_PAGE_SIZE
          Default number of items to display at once page.
protected  int[] m_arrOrderColumnCodes
          Code of the columns to order by, for each column at the same index is in m_arrOrderDirections setup the type of ordering.
protected  java.lang.String[] m_arrOrderDirections
          Type of the ordering ASC/DESC.
protected  int[] m_arrShowColumnCodes
          Default list of attributes to retrieve for each data objects.
protected  int m_iPageSize
          Default page size that is how many items are retrieved at once.
protected  SimpleRule m_rule
          Rule, which the data objects in the list have to satisfy.
static java.lang.String ORDER_ASCENDING
          Order the list in ascending order by specified column.
static java.lang.String[] ORDER_ASCENDING_ARRAY
          Convenience constant of array type.
static java.lang.String[] ORDER_ASCENDING2_ARRAY
          Convenience constant of array type.
static java.lang.String ORDER_DESCENDING
          Order the list in descending order by specified column.
static java.lang.String[] ORDER_DESCENDING_ARRAY
          Convenience constant of array type.
static java.lang.String[] ORDER_DESCENDING2_ARRAY
          Convenience constant of array type.
 
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
ListDefinition()
          Empty constructor - default values
ListDefinition(int[] arrOrderColumnCodes, java.lang.String[] arrOrderDirections, int[] arrShowColumnCodes)
          Default constructor with only the necessary paramaters
ListDefinition(int iId, int iDomainId, int iPageSize, int[] arrOrderColumnCodes, java.lang.String[] arrOrderDirections, int[] arrShowColumnCodes, SimpleRule rule, java.sql.Timestamp creationTimestamp, java.sql.Timestamp modificationTimestamp)
          Complete constructor with all paramaters
 
Method Summary
 int[] getOrderColumnCodes()
          This is the list of column codes to order by which should be taken into account when this filter is used unless otherwise overriden.
 java.lang.String[] getOrderDirections()
          This is the default direction of ordering (ASC/DESC) which should be fetched when this definition is used unless otherwise overriden.
 int getPageSize()
          This is the default page size which should be retrieved and determines how many data objects are retrieved at once.
 SimpleRule getRule()
           
 int[] getShowColumnCodes()
          Set column codes of columns which should be displayed on GUI.
 boolean isSame(java.lang.Object oObject)
          
 void setOrdering(int[] arrOrderColumnCodes, java.lang.String[] arrOrderTypes)
           
 void setPageSize(int iPageSize)
          Set page size for items displayed on GUI.
 void setRule(SimpleRule rule)
          Set the rule for list definition.
 void setShowColumnCodes(int[] wShowColumnCodes)
          Set column codes of data object attributes, which should be retrieved.
 
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

DEFAULT_PAGE_SIZE

public static final int DEFAULT_PAGE_SIZE
Default number of items to display at once page.

See Also:
Constant Field Values

ORDER_ASCENDING

public static final java.lang.String ORDER_ASCENDING
Order the list in ascending order by specified column. This needs to be valid SQL modifier since it will be directly appended to the SQL query. There has to be extra space in the front since there needs to be space between column name and the identifier.

See Also:
Constant Field Values

ORDER_ASCENDING_ARRAY

public static final java.lang.String[] ORDER_ASCENDING_ARRAY
Convenience constant of array type.


ORDER_ASCENDING2_ARRAY

public static final java.lang.String[] ORDER_ASCENDING2_ARRAY
Convenience constant of array type.


ORDER_DESCENDING

public static final java.lang.String ORDER_DESCENDING
Order the list in descending order by specified column. This needs to be valid SQL modifier since it will be directly appended to the SQL query. There has to be extra space in the front since there needs to be space between column name and the identifier.

See Also:
Constant Field Values

ORDER_DESCENDING_ARRAY

public static final java.lang.String[] ORDER_DESCENDING_ARRAY
Convenience constant of array type.


ORDER_DESCENDING2_ARRAY

public static final java.lang.String[] ORDER_DESCENDING2_ARRAY
Convenience constant of array type.


m_arrOrderColumnCodes

protected int[] m_arrOrderColumnCodes
Code of the columns to order by, for each column at the same index is in m_arrOrderDirections setup the type of ordering.


m_arrOrderDirections

protected java.lang.String[] m_arrOrderDirections
Type of the ordering ASC/DESC. See ORDER_XXX constants in the ListDefinition. The constant coresponds to the column code in m_iOrderColumnsCodes.


m_iPageSize

protected int m_iPageSize
Default page size that is how many items are retrieved at once.


m_arrShowColumnCodes

protected int[] m_arrShowColumnCodes
Default list of attributes to retrieve for each data objects.


m_rule

protected SimpleRule m_rule
Rule, which the data objects in the list have to satisfy.

Constructor Detail

ListDefinition

public ListDefinition()
Empty constructor - default values


ListDefinition

public ListDefinition(int[] arrOrderColumnCodes,
                      java.lang.String[] arrOrderDirections,
                      int[] arrShowColumnCodes)
Default constructor with only the necessary paramaters

Parameters:
arrOrderColumnCodes - - codes for columns to order by, pass null if none
arrOrderDirections - - order directions (ASC/DESC), see ORDER_XXX constants
arrShowColumnCodes - - array of attributes to retrieve for each data object

ListDefinition

public ListDefinition(int iId,
                      int iDomainId,
                      int iPageSize,
                      int[] arrOrderColumnCodes,
                      java.lang.String[] arrOrderDirections,
                      int[] arrShowColumnCodes,
                      SimpleRule rule,
                      java.sql.Timestamp creationTimestamp,
                      java.sql.Timestamp modificationTimestamp)
Complete constructor with all paramaters

Parameters:
iId - - List definition ID
iDomainId - - domain ID
iPageSize - - page size determines how many items are retrieved at once
arrOrderColumnCodes - - codes for columns to order by, pass null if none
arrOrderDirections - - order directions (ASC/DESC), see ORDER_XXX constants
arrShowColumnCodes - - array of column codes to show
rule - - rule which the data in the list have to satisfy
creationTimestamp - - creation date
modificationTimestamp - - last modification date
Method Detail

getOrderDirections

public java.lang.String[] getOrderDirections()
This is the default direction of ordering (ASC/DESC) which should be fetched when this definition is used unless otherwise overriden.

Returns:
String[] - one of the ORDER_XXX constants

getOrderColumnCodes

public int[] getOrderColumnCodes()
This is the list of column codes to order by which should be taken into account when this filter is used unless otherwise overriden. Direction of ordering is set in getOrderDirections.

Returns:
int[]

getPageSize

public int getPageSize()
This is the default page size which should be retrieved and determines how many data objects are retrieved at once.

Returns:
int

getShowColumnCodes

public int[] getShowColumnCodes()
Set column codes of columns which should be displayed on GUI.

Returns:
int[]

getRule

public SimpleRule getRule()
Returns:
SimpleRule - rule that data object has to match to be included in the list

setRule

public void setRule(SimpleRule rule)
Set the rule for list definition.

Parameters:
rule - - simple rule

setPageSize

public void setPageSize(int iPageSize)
Set page size for items displayed on GUI.

Parameters:
iPageSize - - array of column codes to show

setShowColumnCodes

public void setShowColumnCodes(int[] wShowColumnCodes)
Set column codes of data object attributes, which should be retrieved. This is not necessary the list of fields, which will be retrieved from the database since some fields such as IDs of the objects are never shown on the GUI but they are still needed to construct the page.

Parameters:
wShowColumnCodes - - array of column codes to show

setOrdering

public void setOrdering(int[] arrOrderColumnCodes,
                        java.lang.String[] arrOrderTypes)
Parameters:
arrOrderColumnCodes - - codes for columns to order by, pass null if none
arrOrderTypes - - types of ordering for each column

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.