Ticket #1063 (closed Task: fixed)

Opened 8 years ago

Last modified 8 years ago

Core: refactor Label Config mechanism

Reported by: jri Owned by: jri
Priority: Major Milestone: Release 4.8.6
Component: DeepaMehta Standard Distribution Version: 4.8.5
Keywords: Cc: dgf, Malte, JuergeN, robert.schuster
Complexity: 5 Area: Application Framework / API
Module: deepamehta-core

Description

There are several problems in the Label Config mechanism and its "Include in Label" setting (#906, #1061, #1062). It became evident that a bigger refactoring of the Core's Label Config code is needed. This will bring BREAKING CHANGES to the public Label Config API and the label_config JSON format as used in declarative migrations and the REST API's update-type request. Also the Webclient needs to be adapted.

Change History

comment:1 Changed 8 years ago by jri

  • Status changed from new to accepted

comment:2 Changed 8 years ago by Jörg Richter <jri@…>

In ca175be695037daa486d119cfdebfdcb1973707b/deepamehta:

Core: change assoc def model factory API (#1063).

BREAKING CHANGES

2 changes in ModelFactory's newAssociationDefinitionModel() method:

Add includeInLabel arg (boolean) to the 6-args form:

AssociationDefinitionModel newAssociationDefinitionModel(String assocTypeUri,
                                                         String customAssocTypeUri, boolean includeInLabel,
                                                         String parentTypeUri, String childTypeUri,
                                                         String parentCardinalityUri, String childCardinalityUri);

Drop 9-args form:

AssociationDefinitionModel newAssociationDefinitionModel(long id, String uri,
                                                         String assocTypeUri, String customAssocTypeUri,
                                                         String parentTypeUri, String childTypeUri,
                                                         String parentCardinalityUri, String childCardinalityUri,
                                                         ViewConfigurationModel viewConfigModel);

See #1063.

comment:3 Changed 8 years ago by Jörg Richter <jri@…>

In c8789acaf9ce119d62f3c69b7ee77097eaf57163/deepamehta:

Core API: remove "Label Config" (#1063).

BREAKING CHANGES

REST API / migrations format (JSON)

In type definitions the label_config property (array) is obsolete.
Instead a include_in_label property (boolean) is used in each single assoc def.
The include_in_label property is optional. Default is false.

Plugin developers: in order to adapt your plugin to DM 4.8.6 (upcoming) in ALL your declarative migrations where you make use of the label_config property (array) you must replace ...

"assoc_defs": [
    {
        "child_type_uri": "dm4.contacts.first_name",
        ...
    },
    {
        "child_type_uri": "dm4.contacts.last_name",
        ...
    }
],
"label_config": ["dm4.contacts.first_name", "dm4.contacts.last_name"]

with ...

"assoc_defs": [
    {
        "child_type_uri": "dm4.contacts.first_name",
        "include_in_label": true
        ...
    },
    {
        "child_type_uri": "dm4.contacts.last_name",
        "include_in_label": true
        ...
    }
]

Note: for a particular DM instance it doesn't matter if the migration has run already or not.
The DB model has not changed. Only the transfer format and API has.

Java API

2 methods dropped from DeepaMehtaType interface:

List<String> getLabelConfig();

DeepaMehtaType setLabelConfig(List<String> labelConfig);

2 methods dropped from TypeModel interface:

List<String> getLabelConfig();

TypeModel setLabelConfig(List<String> labelConfig);

Parameter labelConfig dropped from 2 ModelFactory methods:

TopicTypeModel newTopicTypeModel(TopicModel typeTopic, String dataTypeUri,
                  List<IndexMode> indexModes, List<AssociationDefinitionModel> assocDefs,
                  ViewConfigurationModel viewConfig);

AssociationTypeModel newAssociationTypeModel(TopicModel typeTopic, String dataTypeUri,
                  List<IndexMode> indexModes, List<AssociationDefinitionModel> assocDefs,
                  ViewConfigurationModel viewConfig);

New usage:

To get/set the "Include in Label" flag of an assoc def use generic child topics getters/setters:

boolean includeInLabel = assocDef.getChildTopics().getBoolean("dm4.core.include_in_label")

assocDef.getChildTopics().set("dm4.core.include_in_label", true)

To create an assoc def model with a specific "Include in Label" value, use the newAssociationDefinitionModel() factory method which either takes a

  • includeInLabel parameter (boolean), or which takes a
  • AssociationModel parameter, and put a dm4.core.include_in_label value in the assoc model's child topics.

See #1063.

comment:4 Changed 8 years ago by jri

  • Summary changed from Core: refactor Label Config code to Core: refactor Label Config mechanism

comment:5 Changed 8 years ago by Jörg Richter <jri@…>

In 679590557c10f71bf07942f5ea1788a1e515f122/deepamehta:

Adapt migrations to new label format (#1063).

See #1063.

comment:6 Changed 8 years ago by Jörg Richter <jri@…>

In a9b45477486553742905c5d4ef6c7c6875b9990e/deepamehta:

Adapt Webclient to new assoc def format.

See #1063.
See #906.

comment:7 Changed 8 years ago by jri

  • Status changed from accepted to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.