Class Column

All Implemented Interfaces:
Attribute, TreeUnit, Unit, DbUnit, Comparable<AbstractUnit>

public class Column extends AbstractUnit implements Attribute, DbUnit
A column into a table.
  • Field Details

  • Constructor Details

  • Method Details

    • getDisplayName

      public String getDisplayName(Diagram diagram)
      Specified by:
      getDisplayName in interface Unit
      Overrides:
      getDisplayName in class AbstractUnit
    • getSyncFolders

      public Folder[] getSyncFolders()
      Overrides:
      getSyncFolders in class AbstractUnit
    • getSymbolicName

      public String getSymbolicName()
      Specified by:
      getSymbolicName in interface Unit
      Specified by:
      getSymbolicName in class AbstractUnit
      Returns:
      "Column"
    • getSymbolicIcon

      public String getSymbolicIcon()
      Specified by:
      getSymbolicIcon in class AbstractUnit
      Returns:
      an icon for the tree
    • getSymbolicGlyph

      public com.wisecoders.dbs.sys.fx.glyph.Glyph getSymbolicGlyph()
      Specified by:
      getSymbolicGlyph in class AbstractUnit
    • getIndexingIcon

      public String getIndexingIcon()
      Specified by:
      getIndexingIcon in interface Attribute
      Returns:
      an icon for the index ( if exists )
    • setDataType

      public void setDataType(DataType dataType)
      Set the column data type definition. The length and decimal are set throgh separate methods
      Parameters:
      dataType - to use
    • hasLength

      public boolean hasLength()
      Returns:
      true if the Attribute has set the length
    • hasDecimal

      public boolean hasDecimal()
      Returns:
      true if the Attribute has a set the decimal
    • getLength

      public int getLength()
      Returns:
      data type length
    • setLength

      public void setLength(int length)
      Set data type current length
      Parameters:
      length - of the column
    • getDecimal

      public int getDecimal()
      Returns:
      data type decimal
    • setDecimal

      public void setDecimal(int decimal)
      Set data type decimal precision
      Parameters:
      decimal - of the column
    • getDataType

      public DataType getDataType()
      Specified by:
      getDataType in interface Attribute
      Returns:
      the column data type definition. The current length, precision, are stored in the Column
    • isUsingSameDataType

      public boolean isUsingSameDataType(Column other)
    • getEnumeration

      public String getEnumeration()
      Returns:
      the enumeration values
    • setEnumeration

      public void setEnumeration(String enumeration)
      Set enumeration values
      Parameters:
      enumeration - as list of comma separated text
    • getTypeOptions

      public String getTypeOptions()
      Returns:
      The string to be added after the data type
    • setTypeOptions

      public void setTypeOptions(String typeOptions)
      Set the string to be added after the data type
      Parameters:
      typeOptions - as string
    • getOptions

      public String getOptions()
      Returns:
      string which will be added on the end of the column definition
    • setOptions

      public boolean setOptions(String options)
      Set the parameters to add after the column definition
      Parameters:
      options - as string
    • appendOptions

      public void appendOptions(String options)
    • isUnsigned

      public boolean isUnsigned()
      Returns:
      true if the column is unsigned
    • setUnsigned

      public void setUnsigned(boolean unsigned)
      Mark the column as unsigned
      Parameters:
      unsigned - - values can be only above 0
    • isIdentity

      public boolean isIdentity()
      Returns:
      true if the column is autoincrement
    • getIdentity

      public String getIdentity()
    • setIdentity

      public void setIdentity(String identity)
      Mark column as autoincrement
      Parameters:
      identity - true if autoincrement
    • setDefaultValue

      public void setDefaultValue(String defaultValue)
      Set the column default value
      Parameters:
      defaultValue - to use on insert if nothing is specified
    • hasDefaultValue

      public boolean hasDefaultValue()
      Returns:
      true if the column has set a default value
    • getDefaultValue

      public String getDefaultValue()
      Returns:
      the column default value
    • defaultValuesAreSimilar

      public boolean defaultValuesAreSimilar(Column target)
      Checks if the default values are similar
      Parameters:
      target - column
      Returns:
      true if the default values are pretty the same. Differences can be in values quotation
    • cloneFrom

      public void cloneFrom(Column other)
      Clone the definition from the given column
      Parameters:
      other - to clone
    • setTicked

      public void setTicked(boolean ticked)
      Not used with column
      Specified by:
      setTicked in interface Attribute
      Parameters:
      ticked - ommited
    • isTicked

      public boolean isTicked()
      Specified by:
      isTicked in interface Attribute
    • getEntity

      public AbstractTable getEntity()
      Specified by:
      getEntity in interface Unit
    • getParentEntity

      public Entity getParentEntity()
      Specified by:
      getParentEntity in interface Unit
      Overrides:
      getParentEntity in class AbstractUnit
    • getRootParentColumn

      public Column getRootParentColumn()
    • getParent

      public TreeUnit getParent()
      Specified by:
      getParent in interface TreeUnit
      Specified by:
      getParent in class AbstractUnit
    • setMarker

      public void setMarker(int marker)
    • hasMarker

      public boolean hasMarker(int marker)
      Specified by:
      hasMarker in interface Attribute
    • resetMarkers

      public void resetMarkers()
    • setMandatory

      public void setMandatory(boolean mandatory)
    • isMandatory

      public boolean isMandatory()
      Specified by:
      isMandatory in interface Attribute
    • getTypeString

      public String getTypeString()
    • getTypeString

      public String getTypeString(DataTypeFormat usage)
      Specified by:
      getTypeString in interface Attribute
    • refresh

      public void refresh()
      Specified by:
      refresh in class AbstractUnit
    • isSelectable

      public boolean isSelectable()
      Specified by:
      isSelectable in interface Attribute
    • compareTo

      public int compareTo(AbstractUnit unit)
      Specified by:
      compareTo in interface Comparable<AbstractUnit>
      Overrides:
      compareTo in class AbstractUnit
    • setToDoFlag

      public void setToDoFlag(short toDo)
    • getToDoFlag

      public short getToDoFlag()
      Specified by:
      getToDoFlag in interface Attribute
    • getGeneratorPattern

      public String getGeneratorPattern()
      Get the data generator pattern
      Returns:
      the pattern
    • setGeneratorPatternClearCache

      public void setGeneratorPatternClearCache(String generatorPattern)
      Set the data generator pattern and clear the pattern cache.
      Parameters:
      generatorPattern - to set
    • setGeneratorPattern

      public boolean setGeneratorPattern(String generatorPattern)
      Set the data generator pattern
      Parameters:
      generatorPattern - is the reverse regexp or pattern for random number, values from file, etc.
      Returns:
      if true if set
    • getGeneratorNullsPercentage

      public short getGeneratorNullsPercentage()
      Get the percentage of the null values for the data generator. Omitted if the column is mandatory
      Returns:
      percentage between 0 and 100
    • hasGeneratorNullsPercentage

      public boolean hasGeneratorNullsPercentage()
    • setGeneratorNullsPercentage

      public void setGeneratorNullsPercentage(short nulls)
      Set the percentage of the null values for the data generator. Omitted if the column is mandatory
      Parameters:
      nulls - as percentage between 0 and 100
    • isUnique

      public boolean isUnique()
      True if the column is unique. This is deduced from the indexes information
      Returns:
      true if the column is unique
    • getGeneratorSeed

      public int getGeneratorSeed()
    • setGeneratorSeed

      public void setGeneratorSeed(int generatorSeed)
    • getOrGuessGeneratorPattern

      public String getOrGuessGeneratorPattern()
      Return the best fitting data generator pattern.
      Returns:
      pattern string, can be reverse reg exp, random number pattern, etc.
    • toString

      public String toString()
      Overrides:
      toString in class AbstractUnit
    • hasAssociatedSequence

      public boolean hasAssociatedSequence()
    • getAssociatedSequence

      public Sequence getAssociatedSequence()
      Specified by:
      getAssociatedSequence in interface Attribute
    • setAssociatedSequence

      public void setAssociatedSequence(Sequence sequence)
    • getNameWithPath

      public String getNameWithPath()
      Specified by:
      getNameWithPath in interface Attribute
    • getParentColumn

      public Column getParentColumn()
    • hasChildEntity

      public boolean hasChildEntity()
    • getChildEntity

      public ChildEntity getChildEntity()
    • getCreateChildEntity

      public ChildEntity getCreateChildEntity()
    • getChildrenCount

      public int getChildrenCount()
      Specified by:
      getChildrenCount in interface TreeUnit
      Overrides:
      getChildrenCount in class AbstractUnit
    • getChildAt

      public TreeUnit getChildAt(int idx)
      Specified by:
      getChildAt in interface TreeUnit
      Overrides:
      getChildAt in class AbstractUnit
    • getColumnByPath

      public static Column getColumnByPath(Folder<? extends Column> columns, String name)
    • getSpec

      public AttributeSpec getSpec()
      Specified by:
      getSpec in interface Attribute
    • setSpec

      public void setSpec(AttributeSpec spec)
    • setDefinition

      public void setDefinition(String definition)
    • getDefinition

      public String getDefinition()
    • getDbId

      public String getDbId()
      Specified by:
      getDbId in interface DbUnit
    • getSchema

      public Schema getSchema()
      Specified by:
      getSchema in interface DbUnit
    • ref

      public String ref()
      Specified by:
      ref in interface Unit
      Overrides:
      ref in class AbstractUnit
    • updateCascade

      public boolean updateCascade(boolean dryRun, String oldName, String newName, DataType dataType, int precision, int decimal)
    • updateCascade

      protected boolean updateCascade(boolean dryRun, String oldName, String newName, DataType dataType, int precision, int decimal, List<Column> alreadyDone)