Fields configuration

The ui for the metadata tab is made from a list of field components. The type of the field component and how they behave can be configured in the yaml file. All fields should be configured as a list which has the parent key attributes.

Field options

A field is defined in the yaml following key-value pairs:

key

The key is the identifier for the field and should therefore be unique. Other configurations can refer the field by using this identifier. E.g the geonetwork mapping, internationalization.

Key

Required

Value

key

yes

a unique string

fieldType

Chooses the type of input widget for the field. A detailed description for each type can be found in the Field Types section.

Key

Required

Value

fieldType

yes

  • COMPLEX

  • TEXT

  • NUMBER

  • TEXT_AREA

  • DATE

  • DATETIME

  • BOOLEAN

  • UUID

  • DROPDOWN

  • SUGGESTBOX

  • REQUIREBOX

  • DERIVED

label

If present this value will be used as the label for the field. When the label is not present in the yaml configuration the key will be used as label. Note: when the key is present in the internationalization (i18n) file see Internationalization support than the value from that file will be used as the label.

Key

Required

Value

label

no

any string

occurrence

The value for occurrence determines whether or not the field should displayed as a table or as a single input field. SINGLE will result in one input field.

../../_images/single-value.png

e.g. single value input field of fieldType TEXT.

Choosing REPEAT will render the field in a table allowing the user to input multiple values.

../../_images/repeat.png

e.g. field of fieldType TEXT rendered as a table.

The data in table can be sorted using the green arrow buttons.

Key

Required

Value

occurrence

no

  • SINGLE (Default)

  • REPEAT

condition

Conditional attributes are attributes that are only visible for some layers. A typical example are attributes only present for raster or vector layers. The condition is specified in CQL which is evaluated against the layer’s ResourceInfo object.

For example:

condition: equalTo(typeOf("."), 'FeatureTypeInfo')

tab

Optionally, attributes may be displayed on separate tabs. All tabs must be listed under tabs in the main configuration. Then this property is used to assign each attribute to a tab, so that the custom metadata panel is divided in tabs:

../../_images/metadata-tabs.png

values

The choices in a DROPDOWN, SUGGESTBOX or REQUIREBOX can be set using the values attribute in the yaml. This is useful for small list, for larger list it can be better to list the choices in a separate .csv file.

derivedFrom

Only used in the DERIVED field. The attribute derivedFrom contains the key for the parent on which the DERIVED field depends. Follow the link for more information on the DERIVED field.

typename

The typename is a required attribute for COMPLEX fields. It contains the key pointing to the definition of the COMPLEX field. A special typename featureAttribute is reserved for the Feature Catalog Generation and should not be used.

Field Types

TEXT

Input field that allows any text.

../../_images/fieldtext.png
attributes:
  - key: text-field
    fieldType: TEXT

TEXT_AREA

A multiline input.

../../_images/fieldtextarea.png
attributes:
  - key: text-area-field
      fieldType: TEXT_AREA

UUID

Input field for a UUID, it allows any text input or the user can generate a UUID.

../../_images/fielduuid.png
attributes:
  - key: uuid-field
    fieldType: UUID

NUMBER

Only numbers are accepted as valid input.

../../_images/fieldnumber.png
attributes:
  - key: number-field
    fieldType: NUMBER

BOOLEAN

Input field with checkbox.

../../_images/fieldboolean.png
attributes:
  - key: boolean-field
    fieldType: BOOLEAN

DATE

Date selection without time information.

../../_images/fielddate.png
attributes:
  - key: date-field
    fieldType: DATE

DATETIME

Selection date with time information.

../../_images/fielddatetime.png
attributes:
  - key: datetime-field
    fieldType: DATETIME

SUGGESTBOX

A field for selecting a value from a suggestbox. Suggestions will be given for the values where the input matches the beginning of the possible values. The values can be put in a separate CSV file in the same way as for the DROPDOWN field.

../../_images/fieldsuggest.png
attributes:
  - key: suggestbox-field
    fieldType: SUGGESTBOX
    values:
          - first
          - second
          - third

REQUIREBOX

This type is identical to suggestbox, except that the user is not allowed to fill in a custom value but enforced to choose a suggested value. This can be handy when an field value must be an element from a list, but this list is too long for a dropdown to be practical.

DERIVED

A derived field is a hidden field whose value depends on an other field. The yaml key derivedFrom should contain the key of the field it depends on. When a value is selected in the parent field a matching value for the derived field is searched in csv file or the value with the same index is picked from the values list.

The CSV file should have at least two columns and start with the key of the parent field in the first column followed by the values for the parent field, the other columns should contain the key(s) of the derived field(s) in the first row followed by the matching values.

Example derived field with config in a CSV file:

../../_images/fielddireved.png

metadata-ui.yaml

attributes:
  - key: derived-parent-field
    fieldType: DROPDOWN
  - key: hidden-field
    fieldType: DERIVED
    derivedFrom: derived-parent-field
csvImports:
  - derived-mapping.csv

derivedmapping.csv

derived-parent-field;hidden-field
parent-value01;hidden-value01
parent-value02;hidden-value02
parent-value03;hidden-value03

Example derived field with values lists:

metadata-ui.yaml

attributes:
  - key: derived-parent-field
    fieldType: DROPDOWN
    values:
        - parent-value01
        - parent-value02
        - parent-value03
  - key: hidden-field
    fieldType: DERIVED
    derivedFrom: derived-parent-field
    values:
        - hidden-value01
        - hidden-value02
        - hidden-value03

COMPLEX

A complex field is composed of multiple other fields. The yaml key typename is added to the field configuration. On the root level the yaml key types indicates the beginning of all complex type definition. A type definition should contain the typename followed by the key attributes which contains the configuration for the subfields.

../../_images/fieldcomplex.png
attributes:
  - key: complex-type
    fieldType: COMPLEX
    typename: complex-field

types:
   - typename: complex-field
     attributes:
          - key: object-text
            fieldType: TEXT
          - key: object-numer
            fieldType: NUMBER

Feature Catalog Generation

To create a feature catalog for a vector layer, a complex structure is needed to describe all the attributes. A lot of this information is already present in the GeoServer feature type or the database. Metadata supports automatically generating a new structure in the metadata from the information at hands that can be customised afterwards. To create support for this feature in your configuration, define a repeatable COMPLEX field with built-in fieldType featureAttribute .

In the example the featureCatalog object has two attributes. A unique identifier of the type UUID and the feature attribute field.

../../_images/fa01.png

e.g. Empty Feature attribute field

- typename: featureCatalog
  attributes:
      - label: Unique identifier
        key: feature-catalog-identifier
        fieldType: UUID
      - label: Feature attribute
        key: feature-attribute
        fieldType: COMPLEX
        typename: featureAttribute
        occurrence: REPEAT

The Generate action will check the database metadata for that layer and generate a feature attribute for each column in the table.

../../_images/fa02.png

e.g. Feature attribute with generate feature types

Whitin each feature attribute there is another Generate action that will generate the domain.

../../_images/generate_domain.png

e.g. Generate domain dialog

There are two options to do this:
  • Using the existing data in the database for this attribute.

  • Using data from a look-up table in the same database. In this case you must specify the table, an attribute from which to take values and an attribute from which to take definitions.

../../_images/fa03.png

e.g. Feature attribute with generate domain

Internationalization support

All metadata field labels that appear in the Metadata fields can be internationalized. This is performed by creating an internationalization (i18n) file named metadata.properties. Create an entry for each key in the gui configuration following this pattern: PREFIX.attribute-key

e.g.

metadata.properties

metadata.generated.form.metadata-identifier=Unique identifier for the metadata

metadata_nl.properties

metadata.generated.form.metadata-identifier=Metadata identificator

Drop-down labels can be translated too, in the same properties file, using the key metadata.generated.form.[attributeKey].[value]=[label]. The value that will be internally stored for this field stays the same.

Hidden Fields

Hidden fields are not visible in the GUI and do not need to be configured. They are updated automatically.

  • _timestamp: date and time of the last metadata update.