Package com.wisecoders.dbs.schema
Class Column
java.lang.Object
com.wisecoders.dbs.diagram.model.AbstractUnit
com.wisecoders.dbs.schema.Column
- All Implemented Interfaces:
Attribute
,TreeUnit
,Unit
,DbUnit
,Comparable<AbstractUnit>
A column into a table.
-
Field Summary
FieldsFields inherited from interface com.wisecoders.dbs.diagram.model.Attribute
MARKER_ARRAY, MARKER_BLOB, MARKER_BOOLEAN, MARKER_CHAR, MARKER_DATE, MARKER_FIRST, MARKER_FK, MARKER_INDEX, MARKER_INDEX1, MARKER_INDEX2, MARKER_INDEX3, MARKER_INDEX4, MARKER_JSON_ARRAY, MARKER_JSON_OBJECT, MARKER_NUMBER, MARKER_OPTION_ASC, MARKER_OPTION_DESC, MARKER_PK, MARKER_REF, MARKER_TEXT, MARKER_UNIQUE, TYPE_STRING_MAX_LENGTH
-
Constructor Summary
ConstructorsConstructorDescriptionColumn
(AbstractTable table, String name) Public constructor.Column
(AbstractTable table, String name, DataType dataType) Public constructorColumn
(AbstractTable table, String name, DataType dataType, AttributeSpec spec) Column
(ChildEntity childEntity, String name, DataType dataType) -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendOptions
(String options) void
Clone the definition from the given columnint
compareTo
(AbstractUnit unit) boolean
defaultValuesAreSimilar
(Column target) Checks if the default values are similargetChildAt
(int idx) int
static Column
getColumnByPath
(Folder<? extends Column> columns, String name) getDbId()
int
getDisplayName
(Diagram diagram) short
Get the percentage of the null values for the data generator.Get the data generator patternint
int
Return the best fitting data generator pattern.getSpec()
com.wisecoders.dbs.sys.fx.glyph.Glyph
Folder[]
short
getTypeString
(DataTypeFormat usage) boolean
boolean
boolean
boolean
boolean
boolean
boolean
hasMarker
(int marker) boolean
boolean
boolean
boolean
isTicked()
boolean
isUnique()
True if the column is unique.boolean
boolean
isUsingSameDataType
(Column other) ref()
void
refresh()
void
void
setAssociatedSequence
(Sequence sequence) void
setDataType
(DataType dataType) Set the column data type definition.void
setDecimal
(int decimal) Set data type decimal precisionvoid
setDefaultValue
(String defaultValue) Set the column default valuevoid
setDefinition
(String definition) void
setEnumeration
(String enumeration) Set enumeration valuesvoid
setGeneratorNullsPercentage
(short nulls) Set the percentage of the null values for the data generator.boolean
setGeneratorPattern
(String generatorPattern) Set the data generator patternvoid
setGeneratorPatternClearCache
(String generatorPattern) Set the data generator pattern and clear the pattern cache.void
setGeneratorSeed
(int generatorSeed) void
setIdentity
(String identity) Mark column as autoincrementvoid
setLength
(int length) Set data type current lengthvoid
setMandatory
(boolean mandatory) void
setMarker
(int marker) boolean
setOptions
(String options) Set the parameters to add after the column definitionvoid
setSpec
(AttributeSpec spec) void
setTicked
(boolean ticked) Not used with columnvoid
setToDoFlag
(short toDo) void
setTypeOptions
(String typeOptions) Set the string to be added after the data typevoid
setUnsigned
(boolean unsigned) Mark the column as unsignedtoString()
boolean
updateCascade
(boolean dryRun, String oldName, String newName, DataType dataType, int precision, int decimal) protected boolean
updateCascade
(boolean dryRun, String oldName, String newName, DataType dataType, int precision, int decimal, List<Column> alreadyDone) Methods inherited from class com.wisecoders.dbs.diagram.model.AbstractUnit
fixNull, getByName, getByName, getComment, getCommentNotNull, getCommentTag, getCommentTags, getDefaultKey, getKey, getName, getPlainName, getPropertyAddOnFolder, getString, getTickId, getTouchId, getUnitProperty, has, is, is, isMarkedForDeletion, isVirtual, markForDeletion, matches, removeUnitProperty, rename, sameAs, sameAs, setComment, setCommentTag, setCommentTags, setTouchId, setUnitProperty, setVirtual
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.wisecoders.dbs.diagram.model.Unit
getComment, getCommentTag, getCommentTags, is, isMarkedForDeletion, markForDeletion, setComment, setCommentTag, setCommentTags
-
Field Details
-
ICON_COLUMN
- See Also:
-
table
-
generatorPatternCache
-
-
Constructor Details
-
Column
Public constructor. By default, set as integer data type.- Parameters:
table
- it belongs toname
- of the column
-
Column
-
Column
-
Column
Public constructor- Parameters:
table
- it belongs toname
- of the columndataType
- to be used.
-
-
Method Details
-
getDisplayName
- Specified by:
getDisplayName
in interfaceUnit
- Overrides:
getDisplayName
in classAbstractUnit
-
getSyncFolders
- Overrides:
getSyncFolders
in classAbstractUnit
-
getSymbolicName
- Specified by:
getSymbolicName
in interfaceUnit
- Specified by:
getSymbolicName
in classAbstractUnit
- Returns:
- "Column"
-
getSymbolicIcon
- Specified by:
getSymbolicIcon
in classAbstractUnit
- Returns:
- an icon for the tree
-
getSymbolicGlyph
public com.wisecoders.dbs.sys.fx.glyph.Glyph getSymbolicGlyph()- Specified by:
getSymbolicGlyph
in classAbstractUnit
-
getIndexingIcon
- Specified by:
getIndexingIcon
in interfaceAttribute
- Returns:
- an icon for the index ( if exists )
-
setDataType
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
- Specified by:
getDataType
in interfaceAttribute
- Returns:
- the column data type definition. The current length, precision, are stored in the Column
-
isUsingSameDataType
-
getEnumeration
- Returns:
- the enumeration values
-
setEnumeration
Set enumeration values- Parameters:
enumeration
- as list of comma separated text
-
getTypeOptions
- Returns:
- The string to be added after the data type
-
setTypeOptions
Set the string to be added after the data type- Parameters:
typeOptions
- as string
-
getOptions
- Returns:
- string which will be added on the end of the column definition
-
setOptions
Set the parameters to add after the column definition- Parameters:
options
- as string
-
appendOptions
-
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
-
setIdentity
Mark column as autoincrement- Parameters:
identity
- true if autoincrement
-
setDefaultValue
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
- Returns:
- the column default value
-
defaultValuesAreSimilar
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
Clone the definition from the given column- Parameters:
other
- to clone
-
setTicked
public void setTicked(boolean ticked) Not used with column -
isTicked
public boolean isTicked() -
getEntity
-
getParentEntity
- Specified by:
getParentEntity
in interfaceUnit
- Overrides:
getParentEntity
in classAbstractUnit
-
getRootParentColumn
-
getParent
- Specified by:
getParent
in interfaceTreeUnit
- Specified by:
getParent
in classAbstractUnit
-
setMarker
public void setMarker(int marker) -
hasMarker
public boolean hasMarker(int marker) -
resetMarkers
public void resetMarkers() -
setMandatory
public void setMandatory(boolean mandatory) -
isMandatory
public boolean isMandatory()- Specified by:
isMandatory
in interfaceAttribute
-
getTypeString
-
getTypeString
- Specified by:
getTypeString
in interfaceAttribute
-
refresh
public void refresh()- Specified by:
refresh
in classAbstractUnit
-
isSelectable
public boolean isSelectable()- Specified by:
isSelectable
in interfaceAttribute
-
compareTo
- Specified by:
compareTo
in interfaceComparable<AbstractUnit>
- Overrides:
compareTo
in classAbstractUnit
-
setToDoFlag
public void setToDoFlag(short toDo) -
getToDoFlag
public short getToDoFlag()- Specified by:
getToDoFlag
in interfaceAttribute
-
getGeneratorPattern
Get the data generator pattern- Returns:
- the pattern
-
setGeneratorPatternClearCache
Set the data generator pattern and clear the pattern cache.- Parameters:
generatorPattern
- to set
-
setGeneratorPattern
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
Return the best fitting data generator pattern.- Returns:
- pattern string, can be reverse reg exp, random number pattern, etc.
-
toString
- Overrides:
toString
in classAbstractUnit
-
hasAssociatedSequence
public boolean hasAssociatedSequence() -
getAssociatedSequence
- Specified by:
getAssociatedSequence
in interfaceAttribute
-
setAssociatedSequence
-
getNameWithPath
- Specified by:
getNameWithPath
in interfaceAttribute
-
getParentColumn
-
hasChildEntity
public boolean hasChildEntity() -
getChildEntity
-
getCreateChildEntity
-
getChildrenCount
public int getChildrenCount()- Specified by:
getChildrenCount
in interfaceTreeUnit
- Overrides:
getChildrenCount
in classAbstractUnit
-
getChildAt
- Specified by:
getChildAt
in interfaceTreeUnit
- Overrides:
getChildAt
in classAbstractUnit
-
getColumnByPath
-
getSpec
-
setSpec
-
setDefinition
-
getDefinition
-
getDbId
-
getSchema
-
ref
- Specified by:
ref
in interfaceUnit
- Overrides:
ref
in classAbstractUnit
-
updateCascade
-
updateCascade
-