[deepamehta-devel] changing label config of existing topic type

Jörg Richter jri at deepamehta.de
Tue Jan 17 18:58:11 CET 2017


Hi Robert,

> On 17 Jan 2017, at 17:20, Robert Schuster <robert.schuster.rs01 at gmail.com> wrote:
> 
> Yes, you were right, the "Include in Label" topics are missing for two of "Proposal"'s child types. These are:
> 
> "dm4.events.from"
> "dm4.events.to"
> 
> I added those to the Proposal in an earlier migration by running:
> 
>         return dm4.getTopicType(topicTypeUri)
>             .addAssocDef(
>                 mf.newAssociationDefinitionModel("dm4.core.aggregation_def", "dm4.events.from",
>                     topicTypeUri, "dm4.datetime.date", "dm4.core.many", "dm4.core.one"))
>             .addAssocDef(
>                 mf.newAssociationDefinitionModel("dm4.core.aggregation_def", "dm4.events.to",
>                     topicTypeUri, "dm4.datetime.date", "dm4.core.many", "dm4.core.one"));

Your code looks good.

> (This means other types in my project affected by this problem too but its harmless because I am not changing their label config atm).

Confirmed!

> I understand, that I need to fix those types now. But at the same time creating an association definition with the above method should not result in broken types, right?

Yes, you're completely right!

Now I see there is a bug in DM Core: when programmatically adding an assoc def to an existing type the assoc def might get no "Include in Label" setting, causing a NPE when trying to update the parent type's Label Config afterwards.

I'll create a ticket and fix that bug in 4.8.6.

For the meantime you could consider one of these workarounds:

* Do the missing "Include in Label" settings manually in the Webclient. That works when you edit the assoc def directly (instead of the parent type). But to make your changes effective you have to restart the DM server afterwards (to update its type cache.)

* Run a DB-fixing migration *before* your update-label-config migration. The fixing migration would directly fetch all assoc defs and store a "Include in Label" setting if no one exist. If you want I could provide you with the migration code.

Please excuse the inconvenience.

Thank you for reporting!

Cheers,
Jörg

-------------- n?chster Teil --------------
Ein Dateianhang mit Bin?rdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigr??e  : 496 bytes
Beschreibung: Message signed with OpenPGP using GPGMail
URL         : <http://lists.deepamehta.de/pipermail/devel-lists.deepamehta.de/attachments/20170117/33d822db/attachment.sig>


More information about the devel mailing list