FileDocCategorySizeDatePackage
ColumnImpl.javaAPI DocExample3092Tue Dec 08 01:21:00 GMT 1998oisoft.togetherx.scripts.SQL.impl

ColumnImpl

public class ColumnImpl extends Object implements oisoft.togetherx.scripts.SQL.SQLColumn

Fields Summary
private TableImpl
myTable
private oisoft.togetherx.scriptapi.UML.UMLAttribute
myAttribute
private String
myName
private boolean
myNullable
private boolean
myForcePrimaryKey
private boolean
myForeignKey
Constructors Summary
ColumnImpl(oisoft.togetherx.scriptapi.UML.UMLAttribute attribute, boolean nullable, boolean forcePrimaryKey, TableImpl table)

    this( attribute, nullable, forcePrimaryKey, table,
      !attribute.getContainingClass().equals(table.getUMLClass())
    );
  
ColumnImpl(oisoft.togetherx.scriptapi.UML.UMLAttribute attribute, boolean nullable, boolean forcePrimaryKey, TableImpl table, boolean foreignKey)

    myAttribute = attribute;
    myNullable = nullable;
    myForcePrimaryKey = forcePrimaryKey;
    myTable = table;
    myForeignKey = foreignKey;
  
Methods Summary
oisoft.togetherx.scriptapi.UML.UMLAttributegetAttribute()

    return myAttribute;
  
public java.util.EnumerationgetConstraints()

todo
Implement it!

    return new EmptyEnumeration();
  
public intgetDecimalDigits()

    String tagValue = myAttribute.getProperty(tagNameSQLDigits());
    if(tagValue != null){
      try{
        return Integer.parseInt(tagValue);
      }
      catch(NumberFormatException err){
        err.printStackTrace();
      }
    }
    // Size not set by some reason.
    return 0;
  
public java.lang.StringgetName()

    if( myName == null ){
      myName = myTable.createColumnName(this);
    }
    return myName;
  
public java.lang.StringgetRemarks()

    return "";
  
public intgetSize()

    String tagValue = myAttribute.getProperty(tagNameSQLSize());
    if(tagValue != null){
      try{
        return Integer.parseInt(tagValue);
      }
      catch(NumberFormatException err){
        err.printStackTrace();
      }
    }
    // Size not set by some reason.
    return 0;
  
public oisoft.togetherx.scripts.SQL.SQLTablegetTable()


    
    return myTable;
  
SQLDiagramTagsgetTags()

    return myTable.getTags();
  
public shortgetType()

todo
Implement it!

    return 0;
  
public java.lang.StringgetTypeName()

todo
Create real implementation using getType and type-mapping settings

    return myAttribute.getProperty(tagNameSQLType());
  
booleanisForeignKey()

    //return !myAttribute.getContainingClass().equals(myTable.getUMLClass());
    return myForeignKey;
  
public booleanisNullAllowed()

    return myNullable;
  
booleanisPrimaryKey()

    return myForcePrimaryKey
      || (!isForeignKey() && getAttribute().hasProperty(getTags().attributePrimaryKey()));
  
private java.lang.StringtagNameSQLDigits()

    return getTags().attributePrecision();
  
private java.lang.StringtagNameSQLSize()

    return getTags().attributeLength();
  
private java.lang.StringtagNameSQLType()

    return getTags().attributeSQLType();