Name

script — Defines a script generator.

Synopsis

<script language="sourceLanguage">
... script language source code ...
</script>
				

Description

This element defines a generator that executes a script to create the next value. Every time the application needs a new value, it will execute the script source code that it is inside this element. For now, only a javascript engine is available. The code execution must set the value variable to the result of the calculation.

The javascript engine used is the JDK 1.6 scripting engine, see JSR 223 specification for details.

Attributes

language

The scripting language used, for now only javascript is available.

Variables defined

Inside the script you will find the following variables already set by the application:

randomSeed

The randomSeed used to generate the data.

randomData

An object with several methods to generate random data initialized with the randomSeed (**TODO** insert the function descriptions).

Example

Example 29. Script generator.

<project name="postgresqlTest">
	<metadata>
		<table name="table0">
			<generator row-count="10000" />
			...
			<column name="some_phone" ds-type="varchar" size="20">
				<generator>
					<script language="javascript">
						var val = randomData.nextInt(0, 40) * randomSeed;
						value = "Hello World!";
					</script>
				</generator>
			</column>
			...
		</table>
		...
	</metadata>
	...
</project>