com.altair.hwm.database.dbmodel
Class HWMAttributeConstraints

java.lang.Object
  extended by com.altair.hwm.database.dbmodel.HWMAttributeConstraints

public class HWMAttributeConstraints
extends java.lang.Object

Title: HWMAttributeConstraints

Description: The class that represents the constraints valid for attributes. It currently will support not null, unique and default value

Company: Altair Engineering, Inc.


Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener propChangeListener)
          Add property change listener
 void Export(org.jdom.Element elemConst)
          Creates XML element representation for this constraint class
 java.lang.String GetDefaultValue()
          Get the default value(if null...
 java.lang.String GetSQLString(HWMDatabaseInfo hwmDBInfo)
          Create and return the SQL string for the constraints
 void Import(org.jdom.Element elemConst)
          Recreates the attribute's constraints
 boolean IsAutoInc()
          Returns true if the auto increment constraint is used
 boolean IsNotNull()
          Returns true if the not null constraint is used
 boolean IsPrimaryKey()
          Returns the value of the primary key property
 boolean IsUnique()
          Returns true if unique constraint is used else false
 void removePropertyChangeListener(java.beans.PropertyChangeListener propChangeListener)
          Remove property change listener
 void SetAutoInc(boolean bAutoInc)
          Set the auto increment constraint to true or false
 void SetDefaultValue(java.lang.String strDefValue)
          Set the default value to use (if null...
 void SetNotNull(boolean bNotNull)
          Set the not null constraint to true or false
 void SetPrimaryKey(boolean bIsPrimaryKey)
          Sets the primary key property
 void SetUnique(boolean bUnique)
          Set the unique constraint to true or false
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

SetUnique

public void SetUnique(boolean bUnique)
Set the unique constraint to true or false

Parameters:
bUnique - If true the unique constraint is used.

IsUnique

public boolean IsUnique()
Returns true if unique constraint is used else false

Returns:
boolean Returns true if the unique constraint is used.

SetNotNull

public void SetNotNull(boolean bNotNull)
Set the not null constraint to true or false

Parameters:
bNotNull - If true the not null constraint is used.

IsNotNull

public boolean IsNotNull()
Returns true if the not null constraint is used

Returns:
boolean Returns true if the not null constraint is used.

SetAutoInc

public void SetAutoInc(boolean bAutoInc)
Set the auto increment constraint to true or false

Parameters:
bAutoInc - If true the auto increment constraint is used.

IsAutoInc

public boolean IsAutoInc()
Returns true if the auto increment constraint is used

Returns:
boolean Returns true if the auto increment constraint is used.

SetDefaultValue

public void SetDefaultValue(java.lang.String strDefValue)
Set the default value to use (if null... then no default value is to be used)

Parameters:
strDefValue - The default value to use

GetDefaultValue

public java.lang.String GetDefaultValue()
Get the default value(if null... then no default value is used)

Returns:
String The default value used. If not present then it returns null

SetPrimaryKey

public void SetPrimaryKey(boolean bIsPrimaryKey)
Sets the primary key property

Parameters:
bIsPrimaryKey - True if pk, false if not

IsPrimaryKey

public boolean IsPrimaryKey()
Returns the value of the primary key property

Returns:
boolean True if primary key, false if not

GetSQLString

public java.lang.String GetSQLString(HWMDatabaseInfo hwmDBInfo)
Create and return the SQL string for the constraints

Parameters:
hwmDBInfo - The DB info that contains the types supported and the syntax used by the DB
Returns:
String The SQL representation for the constraints

Export

public void Export(org.jdom.Element elemConst)
Creates XML element representation for this constraint class

Parameters:
elemConst - The element representing this constraint class

Import

public void Import(org.jdom.Element elemConst)
            throws java.lang.Exception
Recreates the attribute's constraints

Parameters:
elemConst - The element representing this attribute's constraints
Throws:
java.lang.Exception

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener propChangeListener)
Add property change listener

Parameters:
propChangeListener - The listener for property change events fired by this class

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener propChangeListener)
Remove property change listener

Parameters:
propChangeListener - The listener to be removed