...
Content
None
Examples
Code Block |
---|
xmllanguage | xml | title | Basic data definition where output is based on columns in the underlying table |
---|
linenumbers | true |
---|
|
<data:datadefinition id="roadDetails">
<datasourcedataconnection datasource="datasource.main" table="ROADS" key="RD_NAME" prefix="DISTINCT"/>
</data:datadefinition>
|
...
Note |
---|
In the following examples the || operator is used to concatenate strings, this operator is Oracle specific, and my require using a different operator for other databases, for example + |
Code Block |
---|
xmllanguage | xml | title | Sample data definition with caching parameters explicitly set |
---|
linenumbers | true |
---|
|
<data:datadefinition id="roadDetails">
<datasourcedataconnection datasource="datasource.main" table="ROADS" key="RD_NAME" prefix="DISTINCT">
<from table="PLANS"/>
<where clause="PLANS.ID=ROADS.PLAN_ID"/>
<parameter name="name" label="Name" column="RD_NAME"/>
<parameter name="suffix" label="Suffix" column="RD_SUFFIX"/>
<parameter name="type" label="Type" column="RD_TYPE"/>
<parameter name="altname" label="Alt. Name" column="ALT_NAME"/>
<parameter name="altsuffix" label="Alt. Suffix" column="ALT_SUFFIX"/>
<parameter name="alttype" label="Alt. Type" column="ALT_TYPE"/>
<parameter type="integer" name="class" label="Class" column="CLASS_CODE"/>
<parameter type="url" name="plan" label="Plan" column="'http://imgsvr:8080/gis/documents/plan_'||PLANS.PLAN_CODE||'.pdf'" text="Open"/>
<cache>
<maxElementsInMemory>500</maxElementsInMemory>
<eternal>false</eternal>
<timeToIdleSeconds>60</timeToIdleSeconds>
<timeToLiveSeconds>300</timeToLiveSeconds>
<overflowToDisk>true</overflowToDisk>
<maxElementsOnDisk>20000</maxElementsOnDisk>
<diskPersistent>false</diskPersistent>
<diskExpiryThreadIntervalSeconds>120</diskExpiryThreadIntervalSeconds>
<memoryStoreEvictionPolicy>LRU</memoryStoreEvictionPolicy>
</cache>
</datasourcedataconnection>
</data:datadefinition>
|
Code Block |
---|
xmllanguage | xml | title | Sample data definition with caching disabled |
---|
linenumbers | true |
---|
|
<data:datadefinition id="roadDetails">
<datasourcedataconnection datasource="datasource.main" table="ROADS" key="RD_NAME" prefix="DISTINCT">
<from table="PLANS"/>
<where clause="PLANS.ID=ROADS.PLAN_ID"/>
<parameter name="name" label="Name" column="RD_NAME"/>
<parameter name="suffix" label="Suffix" column="RD_SUFFIX"/>
<parameter name="type" label="Type" column="RD_TYPE"/>
<parameter name="altname" label="Alt. Name" column="ALT_NAME"/>
<parameter name="altsuffix" label="Alt. Suffix" column="ALT_SUFFIX"/>
<parameter name="alttype" label="Alt. Type" column="ALT_TYPE"/>
<parameter type="integer" name="class" label="Class" column="CLASS_CODE"/>
<parameter type="url" name="plan" label="Plan" column="'http://imgsvr:8080/gis/documents/plan_'||PLANS.PLAN_CODE||'.pdf'" text="Open"/>
<cache disable="true"/>
</datasourcedataconnection>
</data:datadefinition>
|
Code Block |
---|
xmllanguage | xml | title | Sample data definition with caching parameters supplied by a cache configuration (so the cache definition can be reused) |
---|
linenumbers | true |
---|
|
<data:cache id="test.cache">
<maxElementsInMemory>500</maxElementsInMemory>
<eternal>false</eternal>
<timeToIdleSeconds>60</timeToIdleSeconds>
<timeToLiveSeconds>300</timeToLiveSeconds>
<overflowToDisk>true</overflowToDisk>
<maxElementsOnDisk>20000</maxElementsOnDisk>
<diskPersistent>false</diskPersistent>
<diskExpiryThreadIntervalSeconds>120</diskExpiryThreadIntervalSeconds>
<memoryStoreEvictionPolicy>LRU</memoryStoreEvictionPolicy>
</data:cache>
<data:datadefinition id="roadDetails">
<datasourcedataconnection datasource="datasource.main" table="ROADS" key="RD_NAME" prefix="DISTINCT">
<from table="PLANS"/>
<where clause="PLANS.ID=ROADS.PLAN_ID"/>
<parameter name="name" label="Name" column="RD_NAME"/>
<parameter name="suffix" label="Suffix" column="RD_SUFFIX"/>
<parameter name="type" label="Type" column="RD_TYPE"/>
<parameter name="altname" label="Alt. Name" column="ALT_NAME"/>
<parameter name="altsuffix" label="Alt. Suffix" column="ALT_SUFFIX"/>
<parameter name="alttype" label="Alt. Type" column="ALT_TYPE"/>
<parameter type="integer" name="class" label="Class" column="CLASS_CODE"/>
<parameter type="url" name="plan" label="Plan" column="'http://imgsvr:8080/gis/documents/plan_'||PLANS.PLAN_CODE||'.pdf'" text="Open"/>
<cache id="test.cache"/>
</datasourcedataconnection>
</data:datadefinition>
|
Code Block |
---|
xmllanguage | xml | title | A data definition for supplying a list of values (no key is defined), probably for a cascading input parameter for a search |
---|
linenumbers | true |
---|
|
<data:datadefinition id="suburbRoads">
<datasourcedataconnection datasource="datasource.main" table="PROPERTY" prefix="DISTINCT">
<parameter name="suburb" label="Suburb" column="PRSUB_NAME"/>
<parameter name="roadname" label="Road Name" column="PRROD_NAME"/>
</datasourcedataconnection>
</data:datadefinition>
|
Code Block |
---|
xmllanguage | xml | title | Another data definition for supplying a list of values, probably for a triple field cascading input parameter for a search |
---|
linenumbers | true |
---|
|
<data:datadefinition id="suburbRoadType">
<datasourcedataconnection datasource="datasource.main" table="PROPERTY" prefix="DISTINCT">
<parameter name="suburb" label="Suburb" column="PRSUB_NAME"/>
<parameter name="roadname" label="Road Name" column="PRROD_NAME"/>
<parameter name="roadtype" label="Road Type" column="PRROD_TYPE"/>
</datasourcedataconnection>
</data:datadefinition>
|
More on Caching
To disable the caching all together you'd do the following
Code Block |
---|
xmllanguage | xml | linenumbers | true title | Set a timeout for a data definition |
---|
|
<data:datadefinition id="...suburbRoadType">
<datasourcedataconnection ...>
...
<cache disable="true"/>
datasource="datasource.main" table="PROPERTY" prefix="DISTINCT">
<parameter name="suburb" label="Suburb" column="PRSUB_NAME"/>
<parameter name="roadname" label="Road Name" column="PRROD_NAME"/>
<parameter name="roadtype" label="Road Type" column="PRROD_TYPE"/>
<options>
<timeout>15000</timeout>
</options>
</datasourcedataconnection>
</data:datadefinition>
|
More on Caching
To disable the caching all together you'd do the following
Code Block |
---|
language | xml |
---|
linenumbers | true |
---|
|
<data:datadefinition id="...">
<datasourcedataconnection ...>
...
<cache disable="true"/>
</datasourcedataconnection>
</data:datadefinition>
|
To modify the default caching options
Code Block |
---|
xmllanguage | xml | linenumbers | true |
---|
|
<data:datadefinition id="...">
<datasourcedataconnection ...>
...
<cache>
<setting>value</setting>
<setting>value</setting>
<setting>value</setting>
</cache>
</datasourcedataconnection>
</data:datadefinition>
|
...
You can set the default cache settings with
Code Block |
---|
xmllanguage | xml | linenumbers | true |
---|
|
<data:cache>
<setting>value</setting>
<setting>value</setting>
<setting>value</setting>
</data:cache>
|
and create a cache definition that can be re-used
Code Block |
---|
xmllanguage | xml | linenumbers | true |
---|
|
<data:cache id="test">
<setting>value</setting>
<setting>value</setting>
<setting>value</setting>
</data:cache>
<data:datadefinition id="...">
<datasourcedataconnection ...>
...
<cache id="test"/>
</datasourcedataconnection>
</data:datadefinition>
|
...
You can add <sort> tags to specify what column(s) to sort by by default, e.g.
Code Block |
---|
|
<data:datadefinition id="roadDetails">
<datasourcedataconnection datasource="datasource.main" table="ROADS" key="RD_NAME" prefix="DISTINCT">
<from table="PLANS"/>
<where clause="PLANS.ID=ROADS.PLAN_ID"/>
<parameter name="name" label="Name" column="RD_NAME"/>
<parameter name="suffix" label="Suffix" column="RD_SUFFIX"/>
<parameter name="type" label="Type" column="RD_TYPE"/>
<parameter name="altname" label="Alt. Name" column="ALT_NAME"/>
<parameter name="altsuffix" label="Alt. Suffix" column="ALT_SUFFIX"/>
<parameter name="alttype" label="Alt. Type" column="ALT_TYPE"/>
<sort parameter="type"/>
<sort parameter="name"/>
</datasourcedataconnection>
</data:datadefinition> |
...