All articles
Contents

    What's New in CUBA Platform 5.4 and Studio 1.4

    CUBA Platform 5.4 has now been released, bringing new features, as well as a number of bug fixes and improvements. This is also the first release available on the English version of our website. The detailed release notes are available here.

    Filter

    Perhaps the most notable new feature is the redesigned Filter component. Now it looks more clear and compact: only the widely used functions are available, others are hidden inside the drop-down lists.

    Here is how an empty filter looks:

    text

    The updated component supports ad-hoc filtering: to use a filter, you don't need to "create" and save it first. You can immediately add conditions, select comparison operations, enter search criteria and then apply the filter. The following image shows a filter with three conditions:

    text

    Note the blue cross signs - now you can instantly remove the conditions. The asterisk in the filter caption means that the filter is changed and should be saved if required for later use.

    Selection of a pre-saved filter:

    text

    A saved filter can be modified in a separate modal window opened by the Edit command available in the Settings popup button.

    The layout of Filter in your project can be easily customized by means of the cuba.gui.genericFilterControlsLayout application property. For example, if you set it to the value

    cuba.gui.genericFilterControlsLayout = [add_condition] [spacer] \ 
        [filters_popup] [save | no-caption] \ 
        [settings | save_as, edit, remove, make_default, pin, \ 
            save_search_folder, save_app_folder] \ 
        [max_results] [fts_switch]
    

    the filter will look as below:

    text

    As you can see, the “Add search condition” link goes first, and the “Save” command has been pulled from the “Settings” popup and placed onto the main panel as a button without caption.

    A pre-saved filter in this layout:

    text

    To allow even deeper customization, we encapsulated most of the filter functionality in the FilterDelegateImpl managed bean, which can be extended in your project.

    You can get much more from the filter if you use the Full-Text Search base project. If the filter is connected to a datasource with an indexed entity, it will show the additional “Full-Text Search” checkbox:

    text

    In the FTS mode, the filter contains only one input field and the “Search” button:

    text

    When you enter a search term, the filter looks up appropriate entities in the full-text index, and then loads the matching instances from the database taking into account security constraints.

    Time Zones

    Another enhancement is user time zones support. A time zone is assigned to a user by system administrator in the user editor screen; alternatively the user can choose it himself in the Help > Settings screen. A time zone can be either defined explicitly, or set to “Auto” value. In the latter case the user time zone will be acquired from the web browser or desktop client OS, which is convenient for travelling users. If set, the timezone is shown in the main window next to the login name.

    The user time zone affects DateTime attributes displayed in the Table and DateField components. The application code always works with time in the server time zone. The components convert time values from server time to a user time for display, and from the user time to server time when the user enters new values. If you don’t need such conversion for a particular attribute, annotate it with @IgnoreUserTimeZone.

    The DataManager Interface

    The new DataManager interface is intended for uniform access to data both from the middle and client tiers. It works with detached entities and always starts new transactions when it loads and commits entities.

    So now the platform provides two interfaces to work with entities: EntityManager and DataManager. Below is a list of distinctions between them.

    EntityManager mostly resembles the standard javax.persistence.EntityManager. DataManager defines a few high-level methods for working with detached entities: load(), loadList(), reload(), commit().
    EntityManager is available only on the middle tier. DataManager is available on both middle and client tiers.
    You should obtain a reference to EntityManager through the Persistence interface.

    DataManager is a singleton bean.

    You have to open a transaction before working with EntityManager.

    DataManager starts new transactions internally.
    EntityManager does not impose security constraints. DataManager applies all security constraints except entity attribute permissions.

    REST API

    You can now call arbitrary services through the standard REST API. Service methods can have parameters and results of primitive types or corresponding object wrappers, entities and collections of entities.

    For security reasons, a service should be registered in the special configuration file before it will become available through the REST API.

    CUBA Studio 1.4

    As usual, we have released a new version of Studio, supporting projects based on the Platform 5.4. Besides the automatic migration to the new platform version, this Studio release offers some useful new features:

    • Full Entity Listeners support.
    • Hot deploy now works for views.xml, screens.xml and menu.xml. It means that if your project is based on the platform version 5.4+, you don’t need to restart the application server when you change views, modify and register new screens and main menu items.
    • Full support for transient attributes in persistent entities.
    • When you create a Many-To-Many association, it becomes owning on the both sides. So the newly generated standard screens for both sides of the association will have Add/Edit/Remove controls.
    • We have added a toolbar with some frequently used actions.
    • The project search, invoked by the “Alt+/” shortcut, now includes more actions which enables working with Studio with the keyboard only.

    The full list of changes in this Studio release can be found here.

    Jmix is an open-source platform for building enterprise applications in Java