Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Data Definition

Description

A Data Definition represents a set of data that the Weave server can use in various ways, for example to provide a list of values for the user when entering data, or as a tabular dataset to display textual data about a selected entity.
Basically anywhere that Weave needs some textual data it will retrieve it via a data definition.

There are currently two types of data definitions. One that retrieves it's values from a database (via a Data Source) and one that has it's values embedded within it's configuration.

{{DataDefinition.png}}Image Added

Namespace

urn:com.cohga.server.data.database#1.0

Tags

datadefinition

Properties

Name

Type

Required

Description

id

string

yes

Unique identifier

Sub-tags

Name

Type

Cardinality

datasourcedataconnection

urn:com.cohga.server.data.database#1.0:datasourcedataconnection

0..1

inlinedataconnection

urn:com.cohga.server.data.database#1.0:inlinedataconnection

0..1

Content

None

Notes

  • Only one of datasourcedataconnection or inlinedataconnection can be included.

datasourcedataconnection

Properties

Name

Type

Required

Description

datasource

ref urn:com.cohga.server.datasource.jdbc#1.0:datasource

yes

reference to the data source that this data definition should use to generate its data

table

string

yes

The name of the table that provides the data

key

string

no

If this data definition is generating data relating to an entity then this is the column name that contains the entities id

prefix

string

no

The prefix value will be inserted into the generated SQL statement immediately after the SELECT, for example DISTINCT

trim

boolean

no

If true the generated SQL will ensure that the id's are compared against a trimmed version of the id stored in the database, this helps with Pathway, where some tables store padded id's

Sub-tags

Name

Type

Cardinality

parameter

urn:com.cohga.server.data.database#1.0:parameter

1..n

cache

urn:com.cohga.server.cache#1.0:cache

0..1

Content

None

Notes

  • The cache settings are only used for data source data connections that have a key specified, since it's the key that's used as the cache index
  • If no cache tag is specified then the data will still be cached, but it will use the default cache configuration, to disable caching you need to set disable to true inside the cache definition

inlinedataconnection

Properties

None

Sub-tags

Name

Type

Cardinality

parameter

urn:com.cohga.server.data.database#1.0:parameter

1..n

row

urn:com.cohga.server.data.database#1.0:row

1..n

Content

None

parameter

Properties

Name

Type

Required

Description

column

string

yes

The name of the column within the table that this parameter references (can be an sql function also)

type

'string', 'numeric', 'date' or 'url'

no (default 'string')

An indicator of how the data should be displayed on the client

name

string

no (default lowercase value of column)

A unique identifier for the parameter

label

string

no (default 'pretty' value of column)

A user displayable label for the column

text

string

no

Only when type is 'url'. Specifies text to be displayed to the user instead of the actual url contents

textcolumn

string

no

Only when type is 'url'. Specifies the column that contains text to be displayed to the user instead of the actual url contents

Sub-tags

Name

Type

Cardinality

from

urn:com.cohga.server.data.database#1.0:from

0..n

where

urn:com.cohga.server.data.database#1.0:where

0..n

Content

None

Notes

  • If no label is specified then it will be generated by formatting the name, unless no name is supplied, then it will be generated by formatting the column
  • Formatting involves converting any _'s to spaces, converting the first letter and any letter after a space to upper case and converting every other letter to lower case, e.g. "BOMB_DISPOSAL_METHOD" becomes "Bomb Disposal Method"
  • Only one of text or textcolumn should be specified when type is 'url'

from

Properties

Name

Type

Required

Description

table

string

yes

An additional table to include in the generated SQL

Sub-tags

None

Content

None

where

Properties

Name

Type

Required

Description

clause

string

yes

An additional clause to include in the generated SQL

uppercase

boolean

no

If the clause uses parameter substitution should the value be converted to upper-case before being substituted

Sub-tags

None

Content

None

row

Properties

None

Sub-tags

Name

Type

Cardinality

cell

urn:com.cohga.server.data.database#1.0:cell

1..n

Content

None

Notes

  • The number of cells should match the number of parameters.

cell

Properties

None

Sub-tags

None

Content

The value to be used for this cell, or null if null should be returned as this cells value. Note that you can also use xsi:nil="true" if you have the xsi namespace setup as described in configuration.

Examples

Sample data definition with caching parameters explicitly set

...

Code Block
xml
xml
linenumberstrue
<data:datadefinition id="customerType">
	<inlinedataconnection>
		<parameter type="string" name="label" label="Label" />
		<parameter type="string" name="key" label="Key" />
		<row>
			<cell>Domestic</cell>
			<cell>D</cell>
		</row>
		<row>
			<cell>Commercial</cell>
			<cell>C</cell>
		</row>
		<row>
			<cell>Unknown</cell>
			<cell>null</cell>
		</row>
	</inlinedataconnection>
</data:datadefinition>

More on Caching

To disable the caching all together you'd do the following

...