Cuba 6 vs Cuba 7 Declarative data

Hello,

Recently I imported a Cuba 6 project in Cuba 7.
In Cuba 7 I created a new visual component.
The problem is that now I have two kind of Declarative data:

Cuba 7
https://doc.cuba-platform.com/manual-7.0/gui_data_comp_decl.html

<data>
    <instance id="orderDc" class="com.company.sales.entity.Order" view="order-edit">
        <loader/>

        <collection id="linesDc" property="lines"/>

and Cuba 6
https://doc.cuba-platform.com/manual-6.10/datasource_decl_creation.html

<dsContext>
    <datasource id="carDs" class="com.haulmont.sample.entity.Car" view="carEdit">
        <collectionDatasource id="allocationsDs" property="driverAllocations"/>
        <collectionDatasource id="repairsDs" property="repairs"/>
    </datasource>

(These kind of data declaration are proprietary to Cuba or comes from Spring? Which is better?)

How can I handle this situation?
For instance if I want to define a new nested datasource (or collection), part of Cuba 7 view, in Cuba 6 context how should I proceed?

On the other hand I have a tokenList that now doesn’t work.

Please advise.

Hello @neutrino

In the first case <data/>, <instance/>, and <collection/> are declarations of new Containers introduced in CUBA 7 and supported only in new screens.

<datasource/>, <collectionDatasource/>, etc are legacy data biding abstractions - Datasources that are supported only for legacy screens (CUBA 6).

And they cannot be used in the same time in the same screen.

Regards,
Daniil

And what is the solution: to redo all the Cuba 6 screens in Cuba 7 screens or vice versa? Is it possibly to do that?
Is there any example?

It depends on your needs. Migrate screens to CUBA 7 if you want to use new features, or keep them with legacy API to save time.

Basic migration should not cause many problems. I suggest you to read new Screens documentation and ask questions here.

Regards,
Daniil

1 Like

And what is the solution: to redo all the Cuba 6 screens in Cuba 7 screens or vice versa? Is it possibly to do that?

I’m not sure if there’s really any advantage in doing it unless you’re after some specific feature that isn’t supported in Cuba 6. I changed a couple of screens because they needed to support three levels of composition (Cuba 6 only supports two). I often ran into trouble converting other ones for various reasons (there was a problem with one using a twin-column list I never got to the bottom of), so I just left them at version 6 as there was no real gain for the effort (YMMV)

1 Like