字段配置

元数据选项卡的用户界面由字段组件列表构成。可以在yaml文件中配置字段组件的类型及其行为方式。所有字段都应配置为具有父密钥的列表 attributes .

字段选项

在yaml中定义了一个字段,其键值对如下:

钥匙

键是字段的标识符,因此应该是唯一的。其他配置可以使用此标识符引用该字段。E、 地理网络制图,国际化。

要求的

价值

钥匙

唯一的字符串

字段类型

为字段选择输入小部件的类型。每种类型的详细说明可以在 Field Types 部分。

要求的

价值

字段类型

  • COMPLEX

  • TEXT

  • NUMBER

  • TEXT_AREA

  • DATE

  • DATETIME

  • BOOLEAN

  • UUID

  • DROPDOWN

  • SUGGESTBOX

  • REQUIREBOX

  • DERIVED

标签

如果存在,此值将用作字段的标签。当标签不在yaml配置中时,密钥将用作标签。注意:当密钥出现在国际化(i18n)文件中时,请参见 Internationalization support 则该文件中的值将用作标签。

要求的

价值

标签

任何字符串

发生

价值 occurrence 确定字段是否应显示为表或单个输入字段。 SINGLE 将生成一个输入字段。

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

e、 g.字段类型的单值输入字段 TEXT .

选择 REPEAT 将呈现表中的字段,允许用户输入多个值。

../../_images/repeat.png

e、 g.字段类型字段 TEXT 呈现为表格。

表中的数据可以使用绿色箭头按钮进行排序。

要求的

价值

发生

  • 单一(默认)

  • REPEAT

条件

条件属性是仅对某些层可见的属性。一个典型的例子是仅存在于栅格或矢量图层的属性。条件在中指定 CQL 它是根据图层的 ResourceInfo 对象。

例如:

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

价值观

中的选择 DROPDOWNSUGGESTBOXREQUIREBOX 可以使用 values 山药中的属性。这对于小列表很有用,对于大列表,最好在单独的.csv文件中列出选项。

来源

仅用于 DERIVED 字段。属性 derivedFrom 包含 DERIVED 视情况而定。请按链接获取有关 DERIVED 字段。

类别名

这个 typename 是的必需属性 COMPLEX 领域。它包含指向 COMPLEX 字段。特别的 typename featureAttribute is reserved for the Feature Catalog Generation 不应该使用。

字段类型

TEXT

允许任何文本的输入字段。

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

TEXT_AREA

多行输入。

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

UUID

输入字段对于UUID,它允许任何文本输入,或者用户可以生成UUID。

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

NUMBER

只接受数字作为有效输入。

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

BOOLEAN

带复选框的输入字段。

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

DATE

没有时间信息的日期选择。

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

DATETIME

带有时间信息的选择日期。

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

SUGGESTBOX

用于从建议框中选择值的字段。对于输入与可能值开头匹配的值,将给出建议。这些值可以以与下拉字段相同的方式放在单独的CSV文件中。

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

REQUIREBOX

此类型与suggestbox相同,只是不允许用户填写自定义值,而是强制用户选择建议的值。当字段值必须是列表中的元素时,这很方便,但此列表太长,下拉列表不实用。

DERIVED

派生字段是一个隐藏字段,其值取决于其他字段。山药钥匙 derivedFrom 应该包含它所依赖的字段的键。在父字段中选择值时,将在csv文件中搜索派生字段的匹配值,或从“值”列表中选择具有相同索引的值。

CSV文件应至少有两列,并以第一列中父字段的键后跟父字段的值开始,其他列应包含第一行中派生字段的键,后跟匹配值。

CSV文件中配置的派生字段示例:

../../_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

具有值列表的示例派生字段:

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

一个复杂的域由多个其他域组成。山药钥匙 typename 添加到字段配置中。在根级别上,yaml键 types 指示所有复杂类型定义的开头。类型定义应包含 typename 然后是钥匙 attributes 包含子字段的配置。

../../_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

要素目录生成

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 .

在示例中,featureCatalog对象有两个属性。类型的唯一标识符 UUID 以及特征属性字段。

../../_images/fa01.png

e、 g.空特征属性字段

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

这个 Generate action将检查该层的数据库元数据,并为表中的每一列生成一个feature属性。

../../_images/fa02.png

e、 g.具有生成特征类型的特征属性

在每个特征属性中都有另一个 Generate 将生成域的操作。

../../_images/generate_domain.png

e、 g.生成域对话框

有两种选择:
  • 将数据库中的现有数据用于此属性。

  • 使用同一数据库中查找表中的数据。在这种情况下,必须指定表、从中获取值的属性和从中获取定义的属性。

../../_images/fa03.png

e、 g.具有生成域的特征属性

国际化支持

中显示的所有元数据字段标签 Metadata fields 可以国际化。这是通过创建名为元数据.properties. 按照以下模式为gui配置中的每个键创建一个条目: PREFIX.attribute-key

例如

metadata.properties

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

metadata_nl.properties

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

也可以使用键在同一属性文件中转换下拉标签 metadata.generated.form.[attributeKey].[value]=[label] . 将为此字段内部存储的值保持不变。

隐藏字段

隐藏字段在GUI中不可见,不需要配置。它们会自动更新。

  • _timestamp :上次元数据更新的日期和时间。

Previous: 入门