Skip to content

Metadata categories doesn't work properly with the metadata working copies (workflow enabled) #7047

Description

@josegar74

Describe the bug
When editing an approved metadata with metadata categories, the working copy doesn't get assigned any category.

Editing the metadata working copy and assigning categories in the metadata editor, are not assigned to the working copy version.

To Reproduce
Steps to reproduce the behaviour:

  1. Enable the metadata workflow.
  2. Create a new metadata.
  3. In the metadata editor assign the Dataset category and save it.
  4. Approve the metadata and edit it to create a working copy.
  5. Edit the metadata --> in the metadata editor the category Dataset is not selected.
  6. Assign another category, for example Directories and save the metadata --> In the metadata view page the category is not displayed in the working copy.

Expected behavior
The metadata working copy gets assigned the same categories as the approved version. Editing the working copy and assigning categories are assigned to the working copy.

When approving again the working copy, the categories from the approved version are replaced by the ones defined in the working copy.


Doing some research, it seems the categories are only available for metadata in the Metadata table

/**
* Get the set of metadata categories this metadata is part of. This is lazily
* loaded and all operations are cascaded
*
* @return the metadata categories
*/
@ManyToMany(cascade = {CascadeType.DETACH, CascadeType.REFRESH},
fetch = FetchType.EAGER)
@JoinTable(name = METADATA_CATEG_JOIN_TABLE_NAME,
joinColumns = @JoinColumn(name = "metadataId"),
inverseJoinColumns = @JoinColumn(name =
METADATA_CATEG_JOIN_TABLE_CATEGORY_ID))
@Nonnull
public Set<MetadataCategory> getMetadataCategories() {
return metadataCategories;
}

, but not in the MetadataDraft table.

A simpler solution for now could be to disable the categories dropdown from the metadata editor (at least when editing a working copy) and use the update categories batch action in the editor board.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions