Configuring Attribute Parameters

Configuring what attributes/columns can be edited requires the use of parameter elements in an edit:config.

A parameter represents a column of an entity.

In the following custom.edit config a single parameter (id="description") is added which only allows for the display and editing of the description column in the graffitientity.

<?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 (custom)</label> <publish>true</publish> <description>Report graffiti for removal</description> <parameter id="description"> <label>Description</label> <controlType>textarea</controlType> <column>description</column> <hidden>false</hidden> <!-- this is not needed but is included for completeness --> </parameter> </edit:config> </config>

Saving the custom.edit configuration, reloading the client and selecting the Grafitti (custom) configuration from the Edit tab’s pulldown will display the following.

Custom Edit

The <column> value can be case sensitive depending on the underlying database. For example, a column called "DESCRIPTION" may not be the same as "description". For PostgreSQL graffiti table’s columns are all defined in lower case so all <column>values should be in lowercase.

What happens to all the columns in the table that are not referenced by parameters in the edit configuration (no value is created by Weave for them)?

As long as an underlying column is declared as allowing NULL values, any create action will succeed. If a column is declared NOT NULL and does not have an associated parameter for which a value is defined, the create action will fail (because Weave will attempt to write a NULL value to that column).

Though the id column (id serial not null primary key) is not referenced or displayed by the custom.editedit configuration, any create action will succeed because the database will automatically supply the value from the sequence associated with the column.