📜 ⬆️ ⬇️

What's new in CUBA Platform 6.5

You may have noticed that we have published new minor releases of the CUBA platform and CUBA Studio. The new version implements improvements, mainly related to the current functionality, but we have added some new useful features.

Under the cut:


Uber jar


The most awaited feature in the community of developers of the platform. Thanks to Uber JAR, we have maximally simplified the distribution of CUBA applications.
')
To create a Uber JAR, it is enough to determine the desired configuration in CUBA Studio or in your IDE and collect JAR files in a couple of clicks.

CUBA Studio overview

To start the application, it is enough to execute two commands:

java -jar app-core.jar
java -jar app.jar

Uber JAR already contains all the dependent components, as well as a lightweight HTTP Server. More information can be found in this chapter of the documentation.

Enter text with prompts


SuggestionPickerField appeared in the set of visual components. As the user enters the text, he searches in the background and offers suitable value choices.

SuggestionPickerField

Read more in the documentation . The live component can be found in the Sampler online demo application.

Versioning REST API


When an application is already in industrial operation, it happens that, due to the usual refactoring of entity names or attributes, the universal REST API becomes incompatible with the old version of the client (for example, a mobile application) or external systems.

To solve this problem, in the new version of CUBA a mechanism for transforming REST requests has been added. Transformation rules can be set in a simple XML format, according to which the platform leads requests in the old format to the latest version of the API.

For example, if we rename the OldOrder entity to NewOrder , as well as its date attribute to deliveryDate , then using the following XML for transformations, we will maintain compatibility with clients that use the old API.

 <?xml version="1.0"?> <transformations xmlns="http://schemas.haulmont.com/cuba/rest-json-transformations.xsd"> <transformation modelVersion="1.0" oldEntityName="sales$OldOrder" currentEntityName="sales$NewOrder"> <renameAttribute oldName="date" currentName="deliveryDate"/> <toVersion> <removeAttribute name="discount"/> </toVersion> </transformation> </transformations> 

As usual, details are described in the documentation .

Cluster load balancing


Prior to version 6.5, the platform did not support load balancing between the web and the middle layer. Accordingly, the web server from the very beginning chose the middle layer server from the cuba.connectionUrlList list and did not change it until it became unavailable.

In the latest version of the platform distribution is carried out at the level of the user session. The middle layer server is randomly selected during the first remote connection. The established session is sticky and fixes the selected server for its entire duration. If the request comes from an anonymous session or without a session, then the assignment does not occur and the request goes to a randomly specified server in the cluster.

If in a separate case you need to define distribution rules yourself, then this can be done by overriding the cuba_ServerSorter bean, which by default uses the RandomServerSorter class.

Component of the ZooKeeper application


Adding this component greatly simplifies cluster configuration management. The new component integrates your application with Apache ZooKeeper , a centralized service for maintaining configuration information.

Now to manage the cluster topology, all you have to do is give the address of ZooKeeper. After that, the servers of the middle layer will publish their addresses through the ZooKeeper directory, and the mechanisms for detecting a new component will request the addresses of the available servers from ZooKeeper. If the server of the middle layer becomes unavailable, it is automatically excluded from the directory - at the same moment or after a timeout.

The source code for the application component with documentation is available on GitHub . Binary artifacts are published in the standard CUBA repositories.

Improvements in Polymer UI


Judging by the activity on the support forum, more and more developers are starting to use the new web client for CUBA applications based on Google Polymer. In this release, we added a number of features that are designed to simplify development.

Firstly, when opening an entity from the list for editing, the user will be redirected to an edit form located at a different URL. That is, you can now use the standard history tracking mechanism in the browser, and direct links to the editor of a specific entity.

The second refinement is the cuba-lookup component. It allows you to choose the value of the reference attribute not from the drop-down list, but from the pop-up window with the list of entities.

Finally, a component has been added to the library of visual components for uploading files to the server. The downloaded file is displayed as an active link.

Support for Bean Validation in CUBA Studio


Configuring data validation is now supported from the CUBA Studio user interface. You can define attribute constraints as well as messages that will be displayed if the entered values ​​do not match the specified constraints.

For example, to make sure that you have a valid email address in the string, you just need to set up validation in CUBA Studio as shown below.

Bean validation

Groovy support in entity listeners


CUBA Studio now supports scaffolding Entity Listeners on Groovy. To do this, simply turn on Groovy Support in Project properties> Advanced tab.

Groovy Entity Listeners

Summary


This article describes the most important changes to the Platform and Studio. A complete list of changes can be found here:

platform-6.5-release
studio-6.5-release

Also, we invite you to watch the video recording of the webinar dedicated to the release (eng.).

Source: https://habr.com/ru/post/332906/


All Articles