Next training October 24. Next free webinar October 17.

What's New in CUBA Platform 6.6

goryacheva's picture

A few weeks ago we published the new minor release of CUBA platform and Studio. As always, it brings some very awaited features and improvements, making development process more straightforward, transparent and fast.

This article covers major enhancements of Platform and Studio. The full list of changes is available in the corresponding release notes:

platform-6.6-release
studio-6.6-release

Contents

Uber JAR
Polymer UI in Single WAR
Health Check URL
Image Component
REST API Custom Authentication
User Session Log
Cancelable Report Generation
REST API Services and Queries
Mapping Database Views for Migration from Legacy DB
Test Infrastructure Stubs
Summary

Single Uber Jar

In the previous version we announced the Uber JAR feature, allowing developers to build executable jars for CUBA applications in a few clicks from CUBA Studio. However, the final build consisted of two parts: app-core.jar and app.jar, referring to server and client parts of the application.

Now, the buildUberJar Gradle task can now be configured to build a single all-in-one JAR file including all application blocks.

All you have to do is to set to true the singleJar parameter (it is false by default to preserve existing configurations), for example:

task buildUberJar(type: CubaUberJarBuilding) {
    singleJar = true
    coreJettyEnvPath = 'modules/core/web/META-INF/jetty-env.xml'
    appProperties = ['cuba.automaticDatabaseUpdate' : true]
}

After building, you can run your application by calling a single command:
java -jar app.jar

Polymer UI in Single WAR

In the past half year we have noticed quite intensive growth of the community, who use Google Polymer client as a customer-faced UI for CUBA applications.
So, keeping track of simplifying the deployment process we supported the Polymer client in single WAR. Now, if you use the single WAR deployment option, the Polymer UI will be available via /front URL, for example:

http://localhost:8080/app/front

Health Check URL

Following the trend of microservices, now every application block deployed as a web application provides a health check URL, for example http://localhost:8080/app/rest/health. An HTTP GET request of this URL returns ok if the block is alive.

Image Component

In the previous versions there was no specialized data aware UI component to show images. So, developers had to use the Embedded component to illustrate pictures in the UI.

Now, the new Image component greatly simplifies displaying of images from different sources:
  • from an entity attribute of FileDescriptor or byte array types
  • from a classpath resource
  • from a file
  • from an input stream
  • from a theme resource
  • from a URL

The component can also be bound to a datasource and configured declaratively.

REST API Custom Authentication

In response to requests from our community we reworked authentication process to provide an easier way to implement additional authentication mechanisms for REST API, e.g. login-by-link, social login (Facebook, Twitter, etc.) or LDAP. It can be done using the new REST API component: OAuthTokenIssuer.

The process is as follows:
  • Implement custom Spring MVC controller that performs custom authentication.
  • Register this controller in REST API Spring context using a custom Spring XML file and cuba.restSpringContextConfig application property.
  • If a user is authenticated, the controller creates OAuth2 Access token using the OAuthTokenIssuer bean.
  • Created OAuth2 token is returned to the user.
  • After that, the REST API client can use the OAuth2 token as usual passing it to REST API.

We also published a sample project, that shows how you can use this feature in your applications.

User Session Log

Tracking users activity is quite common feature in the world of enterprise applications. Now, this requirement is covered right out of the box. Simply find the User Session Log item under the Administration menu and enable logging in your system. The system will show you who, where and when accessed the system.

Cancelable Report Generation

Sometimes report generation is not a fast process. Now, to enable cancellation while report generation you should only set the reporting.useBackgroundReportProcessing application property to ture and all reports executing in a background thread can be aborted if a user clicks Cancel button or by a timeout. When a report is cancelled or timed out, the execution is aborted both on the middleware and in the database.

REST API Services and Queries

The new version of Studio provides the user interface for configuring queries and service methods for REST API. So, now, managing your REST API becomes as simple as it is shown in the pictures below:

Mapping Database Views for Migration from Legacy DB

Now database views can be mapped to entities when generating model from an existing database. The only restriction is that the view must contain a column or a set of columns suitable for the entity identifier.
Views are shown together with tables in the same list. If you select a view for mapping, on the next screen its status will be Choose primary key for DB view. Click the Choose PK button at the bottom and select columns for the primary key:

Test Infrastructure Stubs

If you create a new project based on the platform 6.6+, Studio will generate the integration test infrastructure in its core module. You can find the created classes in the modules/core/test folder. You can run the tests from the IDE or from the command line (provided that you have created the Gradle wrapper) by calling

gradlew test

Summary

Traditionally, let me thank all proactive members of our community, who participated the platform development and helped with testing the release candidate version. As long as the platform now fully open for your contribution we will be happy to see not only your ideas on our forum, but also pull requests with their implementation! You are welcome to watch the recorded video of the live webinar session about the release.

Read more

Comments