-
-
Notifications
You must be signed in to change notification settings - Fork 489
Proposal Edit A Set Of Records
Date | 2015-08-27 | Contacts | Arnaud De Groof, François Prunayre, Vincent Bombaerts |
Status | On going | Release | 3.1 |
Resources | Available | Ticket # | |
Source code | https://github.com/fxprunayre/core-geonetwork/tree/improvement/edit-a-set-of-record | ||
Funding | Metawal |
Batch editor provides the capability to update a set of records at once.
Editor, Reviewers and Administrator can edit a set of records using the batch editing menu.
First, the user select a set of records to update by running searches and selecting the records to edit.
User can:
- restrict to his records only by checking "only my record",
- use facets for filtering or can run full text search,
- select records by clicking the checkbox or use the selection menu to select all, all in page or clear selection,
- click the "view selection only" to display the current selection.
Search is restricted to:
- editable records for current user and
- template and metadata (ie. no directory entry).
At some point, the set of records could also be a predefined search (See https://github.com/geonetwork/core-geonetwork/wiki/Proposal-Save-Your-Search - this is not part of this proposal).
After selection, user can define the changes to be applied to the set of records.
The fields that can be updated for ISO19139 records are the following:
- Identification
- title: Update existing title.
- keyword: Insert a new keyword in the first descriptiveKeyword block.
- topic category: Insert a new topic category.
- geographic extent: Insert a new geographic extent.
- resource language: Insert a new resource language.
- resource status: Insert, or replace if existing
- parent identifier: Insert, or replace if existing, the parent identifier.
- Constraints
- access constraints: Insert a new access constraint.
- lineage: Replace current lineage or insert a new one.
- Contact
- resource contact: Add a new one.
- distributor: Add a new one.
- metadata contact: Add a new one.
- Metadata
- metadata language: Replace current metadata language or insert a new one.
For Dublin Core record, only title can be updated.
When the element is a codelist (eg. resource status), the list of values is proposed (defined in codelist.xml). When the element could have autocompletion (eg. parent identifier), the list of values is proposed by a custom directive (eg. gn-metadata-picker). When the element is complex ie. not a single value field (eg. contact, extent) a custom directive is defined.
One section per standard is created to define the fields to be change.
ISO19139 and ISO19115-3 multilingual metadata are not supported using the form (may be using the advanced mode).
Updates are made using the following rule:
- If the field is mandatory, then the value replace the current one in the metadata record
- If the field allows multiple element, then the new value is added in the metadata record
An advanced mode allows (advanced) users to define manually XPath and values.
The list of fields and section are defined per schema. The form configuration is made in config-editor.xml in a batchEditing section.
- XSD https://github.com/fxprunayre/core-geonetwork/blob/improvement/edit-a-set-of-record/schemas/config-editor.xsd#L1312
- Example for ISO19139 https://github.com/fxprunayre/core-geonetwork/blob/improvement/edit-a-set-of-record/schemas/iso19139/src/main/plugin/iso19139/layout/config-editor.xml#L1338
The configuration defines a set of section containing fields characterized by:
- name: Field identifier (translated on the client side)
- xpath: XPath of the element to be updated
- use: Type of form input
- insertMode: gn_add, gn_replace (See GN XPath update API)
- removable: To allow to mark a field to be deleted
- template (optional): XML Snippet to be inserted
Example:
- A simple gco:CharacterString in ISO19139
<field name="title"
xpath="gmd:identificationInfo/gmd:MD_DataIdentification/
gmd:citation/gmd:CI_Citation/gmd:title"
indexField="title">
<template><![CDATA[<gco:CharacterString xmlns:gco='http://www.isotc211.org/2005/gco'>{{value}}</gco:CharacterString>]]></template>
</field>
- A codelist element in ISO19139
<field name="topicCats"
xpath="gmd:identificationInfo/gmd:MD_DataIdentification/
gmd:topicCategory"
use="data-gn-codelist-picker"
codelist="gmd:MD_TopicCategoryCode"
indexField="topicCat"
insertMode="gn_add">
<template><![CDATA[<gmd:MD_TopicCategoryCode xmlns:gmd='http://www.isotc211.org/2005/gmd' codeListValue='{{value}}'/>]]></template>
</field>
- A field based on a custom directive generating the XML snippet to insert
<field name="extent"
xpath="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent"
use="data-gn-draw-bbox"
insertMode="gn_add"/>
When changes defined, user can apply them to the selection.
TODO:
- A report is displayed listing the number of records updated, with errors.
- Changes layout to improve
- Selection service is migrated to Spring MVC
- Selection service provide the list of currently selected records (and not only the number). It allows to have display current selection
- Type: UX
- Module: Editing
- Vote Proposed: ...
Bugs:
- Subtemplates mix
Features:
- Report changes
- Updates
- Handle multiple updates if XPath match more than one node
- Add mode to update only if a match is found
- Delete: Only first matching node is deleted
- Check if exists before insert ?
- Edits
- Load and save configuration for the advanced mode
- Add backup (& restore) feature
- Add a search and replace feature (could replace the current batch replacer & search & replace processing)
- Doc for the XPath update API
- Vincent Bombaerts
- Arnaud De Groof
- Francois Prunayre
If you have some comments, start a discussion, raise an issue or use one of our other communication channels to talk to us.