Versions Compared

Key

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

...

  • Spatial mapper for entity must have <dynamic> set to true and <cache> set to false
    • But this is generally the case for any entity that can have it's underlying data altered on the fly

Installation

Currently the Weave editing sub-system is provided as a single bundle, com.cohga.spatial.edit, but this may change before release.

...

  • 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 and readonlyonupdate 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 to readonlyonupdate, and in fact readonlyonupdate will be set to true if updatable 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 id of the entity being edited.
    • userid() The current username.
    • datetime() The current date/time.
    • operation() The type of operation being perform, 'create', 'update' or 'delete'.
    • maxvaluenextval() 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 Know Text) representation of the geometry if available, otherwise null.
    • id() The value for the key field for the spatial table will be used if available, otherwise null.

...

To record who created and who modifies an entity

Code Block
xml
xml
titleBasic custom edit configuration Auditing changes example
linenumberstrue
  <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="description">
      <label>Description</label>
      <controlType>text-area</controlType>
      <column>DESCRIPTION</column>
    </parameter>
    <!-- Hidden parameterparameters to record audit information -->
    <parameter id="createdby">
      <hidden>true</hidden>
      <column>CREATEDBY</column
      <value>userid()</value>
      <updatable>false</updatable>
    </parameter>
    <parameter id="createdon">
      <hidden>true</hidden>
      <column>CREATEDON</column>
      <value>datetime()</value>
      <updatable>false</updatable>
    </parameter>
    <parameter id="modifiedby">
      <hidden>true</hidden>
      <column>MODIFIEDBY</column
      <value>userid()</value>
    </parameter>
    <parameter id="modifiedon">
      <hidden>true</hidden>
      <column>MODIFIEDON</column>
      <value>datetime()</value>
    </parameter>
  </edit:config>

In this example the audit information is stored in the spatial table itself, so the table must already contain the CREATEDBY, CREATEDON, MODIFIEDBY and MODIFIEDON fields and they need to by character fields for the 'by' fields and timestamps for the 'on' fields.
Also, the about configuration assumes that there is an additional column that's used to identify the records, the id column, but that the column is auto-generated by the database and is not user editable.

...

Setting an id field

...

Code Block
xml
xml
titleId column example
linenumberstrue

  <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</hidden>
      <column>ID</column>
      <value>nextval()</value>
    </parameter>
    <parameter id="description">
      <label>Description</label>
      <controlType>text-area</controlType>
      <column>DESCRIPTION</column>
    </parameter>
  </edit:config>

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).