How to create new SContainmentLink for non-existent role?

Good afternoon.

I want to create a util method to be able to create invalid data inside already created nodes. For example, I would like to create a child node with role that is not defined in the concept.

The reason is to check migration scripts on real data that migration is working. Yes, we have migration script tests but they not allowed to create incorrect data (for example, if child was moved from one concept to another).

I know that there is exists deprecated method for this: ownerNode/.addChild(roleName, newChildNode);

But I would like to use not deprecated method with SContainmentLink attribute instead of roleName. But I don't understand how to create a new one.

Util method example:

I will be very thankful for the help.

Comment actions Permalink

SContainmentLink can be created through MetaAdapterFactory ( and the other methods). I am not sure whether the `concept` parameter should be your `owner.getConcept()` or `childConcept`. The `long link` looks like the part which will make your node invalid, so maybe just put a 0 there?

EDIT: After some reverse engineering I found out the `concept` parameter should be the owner concept of the containment link (your `owner.getConcept()`).


You should also check out the following links, maybe you need some of them.

Other MetaAdapters which you will maybe use: (note: deprecated)


Comment actions Permalink

Adrian Szegedi, thanks a lot for your help.

MetaAdapterFactory works like a charm )


Please sign in to leave a comment.