Questions about the product

Hi,
I am considering migrating our .net core application to this amazing platform and I have some general questions about the product if I may.

  1. Multi-tenant - Is this supported by the nature of the app? or i need to develop that with custom entities and row level security?

  2. Working in a modal dialog, Is the system supports modal dialogs? for many cases, edit entity from the grid or even a custom button and modal prompt for more data.

  3. Database migrations, when I develop I see that the studio generate upgrade script for each small change. even if I added a field and I regret. Can the system aggregate that to one script per upgrade?

  4. Search queries - will you consider the OR statement? I know it is complex when it comes to UI.

  5. in .NET you can query the database with strong type lambdas, is it possible with your ORM? so when you refactor something the query will automatically be changed?

  6. Custom screens and forms - Let’s say that I want extra data from the user without any relation to a specific entity. let’s say that I need an action that will ask from the user 10 fields and a custom server-side handler will handle that data. Possible?

  7. What are the boundaries when it comes to coding, how can I know which file is allowed to be edit and which one isn’t?

  8. Linkable pages and views. Is it possible to create a linkable page view? let’s say that I want to send my college a link for a customer. so if the app links were http://app.com/customers/edit/56 this way my college will not have to go and search for customer 56…

  9. Build the XMLs with fluent API so they may be changed in runtime. Is it possible to build the XML is a fluent API like
    new Window()
    .setCaption(“msg://editorCaption”)
    .setClass(‘com.platform.crm.web.order.OrderEdit’)
    .dsContext(
    new DataSource().setId(‘orderDs’).setView(‘order-with-customer0’)
    ).setDialogMode(new DialogMode(…))
    I would really like one day in the far future not to use the studio, only IDE. Im a code-first kind a guy. (:smile:

Thank you for your time!

Hi Avi,

Thank you for the good questions! It’s a chance for us to shed some light on non-obvious things in the platform :slight_smile:

Multi-tenant - Is this supported by the nature of the app? or i need to develop that with custom entities and row level security?

It’s not in the core framework, but you can use the Multitenancy add-on to make multitenancy an inherent feature of your application and avoid setting up row-level security.

Working in a modal dialog, Is the system supports modal dialogs? for many cases, edit entity from the grid or even a custom button and modal prompt for more data.

Sure, modal dialog or edit windows are supported. In fact, you can open any window as a modal dialog, see openWindow() method and its OpenType parameter.

Database migrations, when I develop I see that the studio generate upgrade script for each small change. even if I added a field and I regret. Can the system aggregate that to one script per upgrade?

Right, Studio generates diffs each time you run “Generate DB scripts”, or in background when you run the app with the changed model. Now it cannot automatically aggregate scripts, but you can do it with some manipulations.

First of all, you should have two databases: one original, which can be a copy of the production or test database, and second for development. All intermediate update scripts go to the dev database. At the moment when you want to have an aggregated update script, switch to the original database in Studio and run “Generate DB scripts” command. You will see a warning saying that there are update scripts in your project that were not applied to this database. You click “Continue” (do not apply), and Studio deletes all intermediate scripts and creates a new set of scripts which is the exact difference between your model and the original database. You can apply them, test the app and commit the scripts to VCS for further building of the product.

Search queries - will you consider the OR statement? I know it is complex when it comes to UI.

Grouping of conditions by OR is supported by the Filter component: open the full-featured “Edit” dialog via the options popup button and you will see the “Add OR” button.

in .NET you can query the database with strong type lambdas, is it possible with your ORM? so when you refactor something the query will automatically be changed?

No, currently you can define JPQL queries only as strings. We understand the importance of type-safe queries and it’s one of our tasks for 2019.

Custom screens and forms - Let’s say that I want extra data from the user without any relation to a specific entity. let’s say that I need an action that will ask from the user 10 fields and a custom server-side handler will handle that data. Possible?

Sure. A simple screen without any data binding:

<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
        caption="msg://caption"
        class="com.company.sales.web.screens.Screen"
        messagesPack="com.company.sales.web.screens">
    <dialogMode height="600"
                width="800"/>
    <layout expand="buttonsBox"
            spacing="true">
        <grid spacing="true">
            <columns count="2"/>
            <rows>
                <row>
                    <label value="Foo"/>
                    <textField id="fooField"/>
                </row>
                <row>
                    <label value="Bar"/>
                    <lookupField id="barField"/>
                </row>
            </rows>
        </grid>
        <hbox id="buttonsBox"
            spacing="true">
            <button id="okBtn"
                    caption="OK"
                    invoke="onOkBtnClick"/>
            <button id="cancelBtn"
                    caption="Cancel"/>
        </hbox>
    </layout>
</window>
package com.company.sales.web.screens;

import com.company.sales.service.FooBarService;
import com.haulmont.cuba.gui.components.AbstractWindow;
import com.haulmont.cuba.gui.components.LookupField;
import com.haulmont.cuba.gui.components.TextField;

import javax.inject.Inject;
import java.util.HashMap;
import java.util.Map;

public class Screen extends AbstractWindow {

    @Inject
    private TextField fooField;
    @Inject
    private LookupField barField;

    @Inject
    private FooBarService service;

    @Override
    public void ready() {
        fooField.setValue("Initial Foo");

        Map<String, Integer> barOptions = new HashMap<>();
        barOptions.put("Bar1", 1);
        barOptions.put("Bar2", 2);
        barField.setOptionsMap(barOptions);
    }

    public void onOkBtnClick() {
        service.doSomething(fooField.getValue(), barField.getValue());
    }
}

Result:
image

What are the boundaries when it comes to coding, how can I know which file is allowed to be edit and which one isn’t?

You can edit everything, Studio will parse back your code and configuration files. However, you shouldn’t arbitrarily change the structure of build.gradle and the overall structure of the project, because at some point Studio will not be able to recognize the project or some of its elements.

1 Like

@knstvk - Thank you for the answers. it will take some time to digest.
Any way, I have added 2 more questions in the body of the original messages. (for the benefit of the community).

Thanks!

Linkable pages and views. Is it possible to create a linkable page view? let’s say that I want to send my college a link for a customer.

Currently you can do it using the Screen Links mechanism. And we are now working on a more sophisticated feature for the upcoming version 7.

Build the XMLs with fluent API so they may be changed in runtime.

In the version 7 (which will be released this year), we provide much more sensible and convenient API on the front-end tier. It includes the ability to create screens with Java code only, without any XML layout descriptors. Also, if you don’t like visual tools, take a look at CUBA CLI - it provides basic scaffolding of CUBA projects, entities, screens, etc. from the command line and works with the current framework version 6.x.