Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

What's New in CUBA Platform 6.6

DZone's Guide to

What's New in CUBA Platform 6.6

Take a look at what's new with CUBA Platform and Studio! From Uber JAR support to mapping database views for migration, see what's out there.

· Java Zone
Free Resource

Get the Edge with a Professional Java IDE. 30-day free trial.

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 the 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:

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 JARs

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 the 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 a 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 the authentication process to provide an easier way to implement additional authentication mechanisms for a 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.
  • A created OAuth2 token is returned to the user.
  • After that, the REST API client can use the OAuth2 token, as usual, passing it to a REST API.

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

User Session Log

Tracking user activity is quite a 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 during report generation, you should only set the reporting.useBackgroundReportProcessing application property to true, and all reports executing in a background thread can be aborted if a user clicks the "Cancel" button or via timeout. When a report is canceled 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 a 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.

CUBA Platform Webinar: What's new in release 6.6 from Haulmont on Vimeo.

Get the Java IDE that understands code & makes developing enjoyable. Level up your code with IntelliJ IDEA. Download the free trial.

Topics:
java ,cuba platform ,uber jar ,polymer ,rest api

Published at DZone with permission of Aleksey Stukalov, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}