...
The things that you can override are the supported geometry typesparameters that the user can edit, the required geometry types and the parameters that the user can editmaximum number of geometry items the user can create and the required number of geometry items the user must create.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<?xml version="1.0" encoding="UTF-8"?> <config xmlns="urn:com.cohga.server.config#1.0" xmlns:edit="urn:com.cohga.spatial.edit#1.0"> <edit:config id="custom.edit"> <entity>graffiti</entity> <label>Grafitti</label> <description>Report graffiti for removal</description> <geometry> <supportedGeometry>point</supportedGeometry> <point minimum="1" maximum="1"/> <requiredGeometry>point<</requiredGeometry>geometry> <parameter id="description"> <label>Description</label> <controlType>text-area</controlType> <column>DESCRIPTION</column> </parameter> </edit:config> </config> |
...
Unless explicitly set the types of geometry that a user can create for an entity, and also if the user can create an entity with no geometry, is defined by the underlying spatial tables, if you wish to override this then you do so with the supportedGeometry
and requiredGeometry
geometry
settings.
Both supportedGeometry
and requiredGeometry
can be listed multiple times if more that one geometry type is supported/required, and the possible values for both of these are:
point
multipoint
linestring
multilinestring
polygon
multipolygon
...
The geometry
settings determine the minimum and maximum number of each geometry type (point, linestring and polygon) that the user can create, as well as the total number of geometry items (of any type) that the user can create.
This is done by specifying point
, linestring
, polygon
and/or geometry
items, and for each one specify the minimum
and maximum
value for each. If no point
, linestring
or polygon
setting is specified then the user will not be able to create those geometry types, unless geometry
is specified in which case the user can create all geometry types.
Some examples of why you would want to set these values are (these assume that you can't change the underlying spatial table):
Spatial table allows nil geometry but you wish to enforce geometry creation
- Add
<requireGeometry>geometryType</requireGeometry>
where geometryType matches the underlying spatial table
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<geometry minimum="1"/>
|
or
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<geometry>
<polygon minimum="1"/>
</geometry>
|
Spatial table allows multi part geometry but you wish to enforce creation of single part geometry
- Add
<supportGeometry>geometryType</supportGeometry>
where geometryType matches the underlying spatial table
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<geometry maximum="1"/>
|
or
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<geometry>
<polygon maximum="1"/>
</geometry>
|
The spatial engine supports multiple geometry types in a single table, for example Oracle Spatial, and you wish to limit the geometry
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<geometry>
<polygon/>
</geometry>
|
...
You want the user to specify 2 geometries, including 1 polygon and either a point or a line.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<geometry minimum="2" maximum="2">
<polygon minimum="1" maximum="1"/>
<linestring/>
<point/>
</geometry>
|
...
You want the user to specify 2 geometries, including 1 polygon and either a point, line or polygon.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<geometry minimum="2" maximum="2">
<polygon minimum="1"/>
<linestring/>
<point/>
</geometry>
|
...
You want the user to specify 1 or 2 geometries, including 1 polygon and optionally a point or line.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<geometry maximum="2">
<polygon minimum="1"/>
<linestring/>
<point/>
</geometry>
|
...
You want the user to specify between 2 and four points.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<geometry>
<point minimum="2" maximum="4"/>
</geometry>
|
Info |
---|
If minimum is not specified it defaults to 0. |
Custom attributes
If the default attribute editing setup isn't suitable you can directly specify the attributes that the user can edit and how they appear to the user.
...
column
is optional, if not provided then the field will still appear, but an attempt to write the entered value into the underlying spatial table will not be made. The user entered value can still be used by other means that will be covered later.- The
controltype
now supports 'textarea' which isn't available for search fields, it provides a multi-line text input field. readonly
,readonlyoninsert
andreadonlyonupdate
aren't available for search field either, they're special marker that allow you to alter the ability of the user to change the value in a field. These are client side flags, and if set alter the display of the field so that the user cannot change the value, the field is still displayed, just not editable.updatable
specifies that one a value is set it can't be changed, this is similar toreadonlyonupdate
, and in factreadonlyonupdate
will be set totrue
ifupdatable
is set to false, but it also provides additional checks on the server to ensure that the value is not updated.value
can be used to set a value explicitly by directly supplying the value, or there are a number of formulas that are available.entity()
The name of the entity type being edited.userid()
The current username.datetime()
The current date/time.operation()
The type of operation being perform, will be one of the strings 'create', 'update' or 'delete'.nextval()
The value used for the column will be the previous largest value from the column plus one, the underlying column must be numeric.geometry()
A WKT (Well Known Text) representation of the geometry if available, otherwisenull
.id()
The value for the key field for the spatial table will be used if available, otherwisenull
.auto()
The value for the field is auto-generated by the database.the underlying column must be numeric.geometry()
A WKT (Well Known Text) representation of the geometry if available, otherwisenull
.id()
The value for the key field for the spatial table will be used if available, otherwisenull
.auto()
The value for the field is auto-generated by the database.count()
The number of geometry objects.area()
The area of the geometry.length()
The length of the geometry.
Note |
---|
When geometry is being written to multiple spatial tables the count(), area() and length() functions will behave differently when used in an edit config item versus an edit audit item. |
Info | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Custom parameter examplesAuditing changesTo record who created and who modifies an entity
In this example the audit information is stored in the spatial table itself, so the table must already contain the Setting an id fieldSpecifying an field as an id field to be created by using the maximum value from the column.
This example sets an id field that's hidden from the user and it's created from the existing values in the table. This is not an optimal solution to generating new key values, and it would be much better to use the functionality provided by the underlying database (sequences, auto-generate, identity, etc). Drop down listsSpecifying that the value for a field is chosen from a list. Here we have a static list, status, included directly in the configuration, and a dynamic list populated from a data definition, reporter.
Writing to other tables
So far all attribute values entered by the user were written directly to the underlying spatial table, it's also possible to write values, including those entered by the user and those available via value formulas, to another database table. This can be done by creating an The | |||||||||||||||||||||||||||||||||||
Info |
Parameters in edit
configurations can be setup with or without a column
attribute. If there is a column
specified then the value will be written to the corresponding column in the underlying spatial table, if there is no column
specified then no value will be written during this phase. However, the value the user enters for the parameter, in both cases, is available to be written as part of an audit
configuration.
Info |
---|
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<edit:config id="custom.edit"> <entity>graffiti</entity> <label>Grafitti</label> <description>Report graffiti for removal</description> <supportedGeometry>point</supportedGeometry> <requiredGeometry>point</requiredGeometry> <parameter id="id" hidden="true" label="Id" column="ID" value="auto()"/> <parameter id="description" label="Description" controlType="text-area" column="DESCRIPTION"/> </edit:config> <edit:audit id="custom.audit"> <edit>custom.edit</edit> <datasource>datasource.main</datasource> <table>EDIT_AUDIT</table> <parameter column="ID" value="id()"/> <parameter column="DESC" parameter="description"/> <parameter column="USER" value="userid()"/> <parameter column="MODIFIED" value="datetime()"/> </edit:audit> |
...