easik.sketch.attribute
Class EntityAttribute

java.lang.Object
  extended by easik.sketch.attribute.EntityAttribute

public class EntityAttribute
extends java.lang.Object

This class is used to store information related to entity attributes.

Version:
2006-07-13 Kevin Green
Author:
Kevin Green 2006

Field Summary
private  javax.swing.tree.DefaultMutableTreeNode _attNode
          The representation of this attribute as a DefaultMutableTreeNode
private  DataType _dataType
          The data type of the attribute
private  java.lang.String _name
          The name of the attribute
private  java.lang.String _tempDataType
          The temporary data type
 
Constructor Summary
EntityAttribute(java.lang.String inName, DataType inDataType)
          Default Constructor
EntityAttribute(java.lang.String inName, java.lang.String inType)
          Constructor for reading in from file when the data types have not yet been initiated and thus we must load their references after loading them into the data type controller
 
Method Summary
 DataType getDataType()
          Returns data type
 java.lang.String getName()
          Returns name of attribute.
 javax.swing.tree.DefaultMutableTreeNode getNode()
          Returns the node used for displaying the attribute
static boolean isAttNameUsed(EntityNode inNode, java.lang.String attName)
          Check to see if an attribute name is already used in the entity
static boolean isProtectedName(EntityNode parent, java.lang.String attName)
          Determines whether an attribute name is protected.
 void setDataType(DataType inType)
          Sets the data type of the attribute
 void setName(java.lang.String inName)
          Sets the attribute name.
 void setNode(javax.swing.tree.DefaultMutableTreeNode inNode)
          Sets the node used for displaying the attribute
 void setTypeFromTemp()
          Sets the data type from the temporary type name
 java.lang.String toString()
          Overwrite standard toString function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_name

private java.lang.String _name
The name of the attribute


_dataType

private DataType _dataType
The data type of the attribute


_tempDataType

private java.lang.String _tempDataType
The temporary data type


_attNode

private javax.swing.tree.DefaultMutableTreeNode _attNode
The representation of this attribute as a DefaultMutableTreeNode

Constructor Detail

EntityAttribute

public EntityAttribute(java.lang.String inName,
                       DataType inDataType)
Default Constructor

Parameters:
inName - Name of attribute
inDataType - Data type of attribute

EntityAttribute

public EntityAttribute(java.lang.String inName,
                       java.lang.String inType)
Constructor for reading in from file when the data types have not yet been initiated and thus we must load their references after loading them into the data type controller

Parameters:
inName - The name of the attribute
inType - The name of the data type used for the attribute
Method Detail

toString

public java.lang.String toString()
Overwrite standard toString function. (provides functionality for inserting attributes to the tree)

Overrides:
toString in class java.lang.Object
Returns:
The name of this attribute formatted for display on the tree

setName

public void setName(java.lang.String inName)
Sets the attribute name.

Parameters:
inName - Attribute Name

getName

public java.lang.String getName()
Returns name of attribute.

Returns:
Name of attribute.

getDataType

public DataType getDataType()
Returns data type

Returns:
Data type

setTypeFromTemp

public void setTypeFromTemp()
Sets the data type from the temporary type name


setDataType

public void setDataType(DataType inType)
Sets the data type of the attribute

Parameters:
inType - The data type of the attribute

setNode

public void setNode(javax.swing.tree.DefaultMutableTreeNode inNode)
Sets the node used for displaying the attribute

Parameters:
inNode - The node used for displaying the attribute

getNode

public javax.swing.tree.DefaultMutableTreeNode getNode()
Returns the node used for displaying the attribute

Returns:
The node used for displaying the attribute

isAttNameUsed

public static boolean isAttNameUsed(EntityNode inNode,
                                    java.lang.String attName)
Check to see if an attribute name is already used in the entity

Parameters:
inNode - The entity being checked against
attName - The name being checked for duplication
Returns:
true if the name is in use, false otherwise

isProtectedName

public static boolean isProtectedName(EntityNode parent,
                                      java.lang.String attName)
Determines whether an attribute name is protected. Attribute names that commence with the name of the entity followed by the SQL identifier are protected

Parameters:
parent - The entity node to which the attribute is being added.
attName - The potential name of the attribute
Returns:
true if name is protected, false otherwise
Since:
2006-08-03 Vera Ranieri