Search
Description
A search allows the server to locate entities.
Current implementations perform those searches either on a database, using either SQL or Stored Procedures, or on a spatial engine.
An attribute search uses SQL to search a database and locate the entities.
Namespace
urn:com.cohga.server.search.database#1.0
Tags
attribute
Properties
Name |
Type |
Required |
Description |
id |
string |
yes |
Unique identifier |
entity |
yes |
The id of the entity that this search will be searching for |
|
label |
string |
yes |
Text to be displayed to the user to represent this search |
description |
string |
no |
Description of the search that could be displayed to the user to explain this search |
datasource |
yes |
The data source that should be connected to to perform the search |
|
table |
string |
yes |
The name of the table in the datasource that is the root of the generated SQL |
key |
string |
yes |
The column in table that represents the unique id of the entity being searched for |
acl |
no |
A reference to an ACL to attach to the search |
Sub-tags
Name |
Type |
Cardinality |
from |
urn:com.cohga.server.search.database#1.0:from |
0..n |
where |
urn:com.cohga.server.search.database#1.0:where |
0..n |
parameter |
urn:com.cohga.server.search.database#1.0:parameter |
1..n |
combination |
urn:com.cohga.server.search.database#1.0:combination |
0..n |
acl |
0..1 |
|
cache |
0..1 |
Content
None
Notes
An ACL can either be defined in-line or referenced indirectly, but only one should be used (the in-line version will take priority).
parameter
Properties
Name |
Type |
Required |
Default |
Description |
id |
string |
yes |
|
A unique identifier for the parameter |
label |
string |
yes |
|
The prompt text displayed when user input the parameter value |
column |
string |
yes |
|
The name of the column within the table that this parameter references |
displayname |
string |
no |
label |
Provides a user-friendly name for the element |
helptext |
string |
no |
|
Additional text to display for the parameter to explain how to use the parameter |
hidden |
boolean |
no |
false |
Hides the parameter from the parameter UI |
alignment |
'left', 'center', 'right', 'auto' |
no |
'auto' |
How the items should appear in the UI |
controltype |
'listbox', 'checkbox', 'radiobutton', 'textbox' |
no |
'textbox' |
The suggested type of UI control to use when displaying the parameter |
datatype |
'any', 'boolean', 'datetime', 'decimal', 'float', 'integer', 'string' |
no |
'string' |
The data type for the parameter |
allownull |
boolean |
no |
false |
Whether a null value is allowed for this parameter |
allowblank |
boolean |
no |
true |
Give the user the choice of an empty value in the listbox (as opposed to a null value) |
allownewvalues |
boolean |
no |
false |
Allow the user to enter values not in the listbox already |
defaultvalue |
any |
no |
|
The default value of the parameter |
displayformat |
string |
no |
|
the formatting instructions for the parameter value within the parameter UI |
datadefinition |
no |
|
Where to get the values for a listbox |
|
labelcolumn |
string |
no |
|
Column in the datadefinition that supplies the label of the value to show the user |
valuecolumn |
string |
no |
|
Column in the datadefinition that supplies the value of the value to use in the SQL |
uppercase |
boolean |
no |
false |
Should the value be converted to upper case in the generated SQL |
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 |
parameter |
urn:com.cohga.server.data.database#1.0:parameter |
0..n |
Notes
- If the controltype is listbox then a datadefinition must be provided, this datadefinition will provide the values to be displayed in the listbox.
- If the listbox datadefinition only contains 1 column then that column will supply both the label and the value, if it contains two values then the first column will supply the label and the second the value.
- If a parameter contains another parameter then you are defining a cascading parameter, where setting the first sub-parameter will enable, and filter, the second parameter, and setting the second parameter will do the same for the third, etc.
- In a cascading parameter all sub-parameters must be of listbox type, and the datadefinition should be set in the outer parameter, not the sub parameters.
- In a cascading parameter only one level of nesting should be used.
- In a cascading parameter the datadefinition should supply the columns for all of the parameters, and valuecolumn properties should be set for each sub-parameter, and labelcolumn should be also set for all parameters if a different label is to be displayed to the user.
combination
Properties
None
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 |
1..n |
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
Examples
<data:datadefinition id="dd_roadtypes"> <datasourcedataconnection datasource="datasource.main" table="ROAD" prefix="DISTINCT"> <parameter type="string" name="roadname" column="ROADNAME"/> <parameter type="string" name="roadname_code" column="ROADNAME_CODE"/> <parameter type="string" name="roadtype" column="ROADTYPE"/> <parameter type="string" name="roadtype_code" column="ROADTYPE_CODE"/> </datasourcedataconnection> </data:datadefinition> <search:attribute id="property.address.entry"> <entity>property</entity> <label>Address by Entry</label> <description>Locate a property or properties by their street address</description> <datasource>datasource.main</datasource> <table>PID_LINK</table> <key>PID</key> <from> <table>PROPERTY</table> </from> <where> <clause>LINK.ID=PROPERTY.ID</clause> </where> <parameter id="unit"> <label>Unit</label> <column>UNIT</column> </parameter> <parameter id="house_from"> <label>House From</label> <datatype>integer</datatype> <column>PROP_NO</column> </parameter> <parameter id="house_to"> <label>House To</label> <datatype>integer</datatype> <column>PROP_NO</column> </parameter> <parameter id="suburb"> <label>Suburb</label> <controltype>listbox</controltype> <allownull>true</allownull> <column>SUBURB</column> <datadefinition>dd_suburbs</datadefinition> </parameter> <parameter id="road"> <datadefinition>dd_roadtypes</datadefinition> <parameter id="roadname"> <label>Road Name</label> <controltype>listbox</controltype> <column>ROADNAME_CODE</column> <valuecolumn>roadname_code</valuecolumn> <labelcolumn>roadname</labelcolumn> </parameter> <parameter id="roadtype"> <label>Road Type</label> <controltype>listbox</controltype> <column>ROADTYPE_CODE</column> <valuecolumn>roadtype_code</valuecolumn> <labelcolumn>roadtype</labelcolumn> </parameter> </parameter> <parameter id="postcode"> <label>Postcode</label> <datatype>integer</datatype> <where> <clause><![CDATA[POSTCODE=${postcode}]]></clause> </where> </parameter> <combination> <where> <clause><![CDATA[PROP_NO >= ${house_from} and PROP_NO <= ${house_to}]]></clause> </where> </combination> <cache:cache> <maxElementsInMemory>50</maxElementsInMemory> <eternal>false</eternal> <timeToIdleSeconds>0</timeToIdleSeconds> <timeToLiveSeconds>300</timeToLiveSeconds> <overflowToDisk>true</overflowToDisk> <maxElementsOnDisk>2000</maxElementsOnDisk> <diskPersistent>false</diskPersistent> <diskExpiryThreadIntervalSeconds>120</diskExpiryThreadIntervalSeconds> <memoryStoreEvictionPolicy>LRU</memoryStoreEvictionPolicy> </cache:cache> </search:attribute>