ThinkUI Data Generator 1.0.2 API

thinkui.datagen.generators
Class DynamicDataGenerator

java.lang.Object
  extended bythinkui.datagen.AbstractAttributeValueGenerator
      extended bythinkui.datagen.generators.DynamicDataGenerator
All Implemented Interfaces:
AttributeValueGenerator, java.lang.Cloneable
Direct Known Subclasses:
ForeignKeyIdGenerator, LastNameGenerator

public class DynamicDataGenerator
extends AbstractAttributeValueGenerator

Implements an AttributeValueGenerator for generating values based on the data from a column from database table. The values will be distributed based on the specified probability model on the data row index. Alternatively, if a custom distribution is specified in the data itself, then that distribution model will be used.

The IndexedValueDataGenerator class will be delegated to perform the actual data generation.

Note: if mutiple values are retrieve, a data object will be generated. The appropriate attribute value should be access in this case.


Field Summary
 
Fields inherited from interface thinkui.datagen.AttributeValueGenerator
ALL_MODES, BERNOULLI_MODE, BINOMIAL_MODE, CONSTANT_MODE, DEFAULT_MODE, EXPONENTIAL_MODE, MILLIS_PER_DAY, MILLIS_PER_HOUR, MILLIS_PER_MINUTE, MILLIS_PER_SECOND, NORMAL_MODE, POISON_MODE, SEQUENTIAL_MODE, UNIFORM_MODE
 
Constructor Summary
DynamicDataGenerator()
          DynamicDataGenerator constructor.
DynamicDataGenerator(DataClass dataClass, java.lang.String attributeName)
          DynamicDataGenerator constructor.
 
Method Summary
 java.lang.Object generateValue()
          Generate a value for the attribute.
 DataClass getDataClass()
           
 thinkui.db.jdbc.JDBCDataObjectManager getDataObjectManager()
           
 int getGeneratorMode()
           
 java.lang.String getIndexAttributeName()
           
 int getMaxObjectCount()
           
 AttributeType getMinMaxAttributeType()
          Override to return AttributeType.INTEGER.
 java.lang.String getOrderByAttributeName()
           
 int getProbabilityNull()
           
 thinkui.db.criteria.SearchCriteria getSearchCriteria()
           
 java.lang.String getSQLQuery()
           
 java.lang.String getValueAttributeName()
          Returns the attribute name in the case where we are generating data objects.
 void initGenerator()
          Resolves all SQL variables and clear any cache data values.
 void setDataClass(DataClass dataClass)
          Sets the data class.
 void setDataObjectManager(thinkui.db.jdbc.JDBCDataObjectManager dataObjectManager)
          Sets the data object manager to use to lookup the data objects.
 void setGeneratorMode(int generatorMode)
          Sets the generation mode for the generator.
 void setIndexAttributeName(java.lang.String indexAttributeName)
          Sets the attribute name containing the distribution index.
 void setMaxObjectCount(int maxObjectCount)
          Sets the maximum object count or use -1 to indicate no limit.
 void setOrderByAttributeName(java.lang.String orderByAttributeName)
          Sets the attribute name to order the data objects by.
 void setProbabilityNull(int probabilityNull)
          Sets the probability that the generated value is null.
 void setSearchCriteria(thinkui.db.criteria.SearchCriteria searchCriteria)
          Sets the search criteria.
 void setSQLQuery(java.lang.String sqlQuery)
          Sets the SQL query to execute to lookup data values.
 void setValueAttributeName(java.lang.String valueAttributeName)
          Sets the attribute name containing the distribution index.
 
Methods inherited from class thinkui.datagen.AbstractAttributeValueGenerator
copy, createGenerator, getAttribute, getConstantValue, getCount, getCountAsInt, getDataObject, getDataObjectMap, getMaxValue, getMeanIndex, getMeanIndexAsDouble, getMeanLength, getMeanLengthAsDouble, getMeanValue, getMeanValueAsDouble, getMinValue, getParameterData, getParentDataObject, getProbability, getProbabilityAsDouble, getStdDevValue, getStdDevValueAsDouble, isDataDependent, isMultiValued, isParentDataDependent, setAttribute, setConstantValue, setCount, setDataDependent, setDataObject, setDataObjectMap, setMaxValue, setMeanIndex, setMeanLength, setMeanValue, setMinValue, setMultiValued, setParentDataDependent, setParentDataObject, setProbability, setStdDevValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicDataGenerator

public DynamicDataGenerator()
DynamicDataGenerator constructor.


DynamicDataGenerator

public DynamicDataGenerator(DataClass dataClass,
                            java.lang.String attributeName)
DynamicDataGenerator constructor.

Method Detail

generateValue

public java.lang.Object generateValue()
                               throws java.lang.Exception
Generate a value for the attribute.

Specified by:
generateValue in interface AttributeValueGenerator
Specified by:
generateValue in class AbstractAttributeValueGenerator
Throws:
java.lang.Exception

getDataClass

public final DataClass getDataClass()
Returns:
the data class or null.

getDataObjectManager

public final thinkui.db.jdbc.JDBCDataObjectManager getDataObjectManager()
Returns:
the data object manager to use to lookup the data objects.

getGeneratorMode

public final int getGeneratorMode()
Specified by:
getGeneratorMode in interface AttributeValueGenerator
Overrides:
getGeneratorMode in class AbstractAttributeValueGenerator
Returns:
the generation mode for the generator.

getIndexAttributeName

public final java.lang.String getIndexAttributeName()
Returns:
the attribute name containing the distribution index or null.

getMaxObjectCount

public final int getMaxObjectCount()
Returns:
the maximum object count or -1 (for no limit).

getMinMaxAttributeType

public final AttributeType getMinMaxAttributeType()
Override to return AttributeType.INTEGER.

Specified by:
getMinMaxAttributeType in interface AttributeValueGenerator
Overrides:
getMinMaxAttributeType in class AbstractAttributeValueGenerator

getOrderByAttributeName

public final java.lang.String getOrderByAttributeName()
Returns:
the attribute name to order the data objects by.

getProbabilityNull

public final int getProbabilityNull()
Specified by:
getProbabilityNull in interface AttributeValueGenerator
Overrides:
getProbabilityNull in class AbstractAttributeValueGenerator
Returns:
the probability that the generated value is null.

getSearchCriteria

public final thinkui.db.criteria.SearchCriteria getSearchCriteria()
Returns:
the search criteria or null.

getSQLQuery

public final java.lang.String getSQLQuery()
Returns:
the SQL query to execute to lookup data values or null.

getValueAttributeName

public final java.lang.String getValueAttributeName()
Description copied from class: AbstractAttributeValueGenerator
Returns the attribute name in the case where we are generating data objects. The current method simply returns null. Derived classes must override this method if isMultiValued() can return true.

Specified by:
getValueAttributeName in interface AttributeValueGenerator
Overrides:
getValueAttributeName in class AbstractAttributeValueGenerator
Returns:
the attribute name containing the value or null.

initGenerator

public final void initGenerator()
                         throws java.lang.Exception
Resolves all SQL variables and clear any cache data values.

Specified by:
initGenerator in interface AttributeValueGenerator
Overrides:
initGenerator in class AbstractAttributeValueGenerator
Throws:
java.lang.Exception

setDataClass

public final void setDataClass(DataClass dataClass)
Sets the data class.


setDataObjectManager

public final void setDataObjectManager(thinkui.db.jdbc.JDBCDataObjectManager dataObjectManager)
Sets the data object manager to use to lookup the data objects.


setGeneratorMode

public final void setGeneratorMode(int generatorMode)
Sets the generation mode for the generator.

Specified by:
setGeneratorMode in interface AttributeValueGenerator
Overrides:
setGeneratorMode in class AbstractAttributeValueGenerator

setIndexAttributeName

public final void setIndexAttributeName(java.lang.String indexAttributeName)
Sets the attribute name containing the distribution index.


setMaxObjectCount

public final void setMaxObjectCount(int maxObjectCount)
Sets the maximum object count or use -1 to indicate no limit. It is important to set a limit if there are a large number of records source data set since all the data will be loaded into memory.


setOrderByAttributeName

public final void setOrderByAttributeName(java.lang.String orderByAttributeName)
Sets the attribute name to order the data objects by.


setProbabilityNull

public final void setProbabilityNull(int probabilityNull)
Sets the probability that the generated value is null.

Specified by:
setProbabilityNull in interface AttributeValueGenerator
Overrides:
setProbabilityNull in class AbstractAttributeValueGenerator

setSearchCriteria

public final void setSearchCriteria(thinkui.db.criteria.SearchCriteria searchCriteria)
Sets the search criteria.


setSQLQuery

public final void setSQLQuery(java.lang.String sqlQuery)
Sets the SQL query to execute to lookup data values.


setValueAttributeName

public final void setValueAttributeName(java.lang.String valueAttributeName)
Sets the attribute name containing the distribution index.


ThinkUI Data Generator 1.0.2 API

Copyright © 2007-2009. ThinkUI Software Inc. All rights reserved.